Completed
Push — develop ( a64e13...6f83f2 )
by David
06:12 queued 51s
created
src/includes/class-wordlift.php 2 patches
Indentation   +1448 added lines, -1448 removed lines patch added patch discarded remove patch
@@ -28,1493 +28,1493 @@
 block discarded – undo
28 28
  */
29 29
 class Wordlift {
30 30
 
31
-	/**
32
-	 * The loader that's responsible for maintaining and registering all hooks that power
33
-	 * the plugin.
34
-	 *
35
-	 * @since    1.0.0
36
-	 * @access   protected
37
-	 * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
38
-	 */
39
-	protected $loader;
40
-
41
-	/**
42
-	 * The unique identifier of this plugin.
43
-	 *
44
-	 * @since    1.0.0
45
-	 * @access   protected
46
-	 * @var      string $plugin_name The string used to uniquely identify this plugin.
47
-	 */
48
-	protected $plugin_name;
49
-
50
-	/**
51
-	 * The current version of the plugin.
52
-	 *
53
-	 * @since    1.0.0
54
-	 * @access   protected
55
-	 * @var      string $version The current version of the plugin.
56
-	 */
57
-	protected $version;
58
-
59
-	/**
60
-	 * The {@link Wordlift_Tinymce_Adapter} instance.
61
-	 *
62
-	 * @since  3.12.0
63
-	 * @access protected
64
-	 * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
65
-	 */
66
-	protected $tinymce_adapter;
67
-
68
-	/**
69
-	 * The Thumbnail service.
70
-	 *
71
-	 * @since  3.1.5
72
-	 * @access private
73
-	 * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
74
-	 */
75
-	private $thumbnail_service;
76
-
77
-	/**
78
-	 * The UI service.
79
-	 *
80
-	 * @since  3.2.0
81
-	 * @access private
82
-	 * @var \Wordlift_UI_Service $ui_service The UI service.
83
-	 */
84
-	private $ui_service;
85
-
86
-	/**
87
-	 * The Schema service.
88
-	 *
89
-	 * @since  3.3.0
90
-	 * @access protected
91
-	 * @var \Wordlift_Schema_Service $schema_service The Schema service.
92
-	 */
93
-	protected $schema_service;
94
-
95
-	/**
96
-	 * The Entity service.
97
-	 *
98
-	 * @since  3.1.0
99
-	 * @access protected
100
-	 * @var \Wordlift_Entity_Service $entity_service The Entity service.
101
-	 */
102
-	protected $entity_service;
103
-
104
-	/**
105
-	 * The Topic Taxonomy service.
106
-	 *
107
-	 * @since  3.5.0
108
-	 * @access private
109
-	 * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
110
-	 */
111
-	private $topic_taxonomy_service;
112
-
113
-	/**
114
-	 * The User service.
115
-	 *
116
-	 * @since  3.1.7
117
-	 * @access protected
118
-	 * @var \Wordlift_User_Service $user_service The User service.
119
-	 */
120
-	protected $user_service;
121
-
122
-	/**
123
-	 * The Timeline service.
124
-	 *
125
-	 * @since  3.1.0
126
-	 * @access private
127
-	 * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
128
-	 */
129
-	private $timeline_service;
130
-
131
-	/**
132
-	 * The Redirect service.
133
-	 *
134
-	 * @since  3.2.0
135
-	 * @access private
136
-	 * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
137
-	 */
138
-	private $redirect_service;
139
-
140
-	/**
141
-	 * The Notice service.
142
-	 *
143
-	 * @since  3.3.0
144
-	 * @access private
145
-	 * @var \Wordlift_Notice_Service $notice_service The Notice service.
146
-	 */
147
-	private $notice_service;
148
-
149
-	/**
150
-	 * The Entity list customization.
151
-	 *
152
-	 * @since  3.3.0
153
-	 * @access protected
154
-	 * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
155
-	 */
156
-	protected $entity_list_service;
157
-
158
-	/**
159
-	 * The Entity Types Taxonomy Walker.
160
-	 *
161
-	 * @since  3.1.0
162
-	 * @access private
163
-	 * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
164
-	 */
165
-	private $entity_types_taxonomy_walker;
166
-
167
-	/**
168
-	 * The ShareThis service.
169
-	 *
170
-	 * @since  3.2.0
171
-	 * @access private
172
-	 * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
173
-	 */
174
-	private $sharethis_service;
175
-
176
-	/**
177
-	 * The PrimaShop adapter.
178
-	 *
179
-	 * @since  3.2.3
180
-	 * @access private
181
-	 * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
182
-	 */
183
-	private $primashop_adapter;
184
-
185
-	/**
186
-	 * The WordLift Dashboard adapter.
187
-	 *
188
-	 * @since  3.4.0
189
-	 * @access private
190
-	 * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
191
-	 */
192
-	private $dashboard_service;
193
-
194
-	/**
195
-	 * The entity type service.
196
-	 *
197
-	 * @since  3.6.0
198
-	 * @access private
199
-	 * @var \Wordlift_Entity_Post_Type_Service
200
-	 */
201
-	private $entity_post_type_service;
202
-
203
-	/**
204
-	 * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
205
-	 *
206
-	 * @since  3.6.0
207
-	 * @access private
208
-	 * @var \Wordlift_Entity_Link_Service
209
-	 */
210
-	private $entity_link_service;
211
-
212
-	/**
213
-	 * A {@link Wordlift_Sparql_Service} instance.
214
-	 *
215
-	 * @since    3.6.0
216
-	 * @access   protected
217
-	 * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
218
-	 */
219
-	protected $sparql_service;
220
-
221
-	/**
222
-	 * A {@link Wordlift_Import_Service} instance.
223
-	 *
224
-	 * @since  3.6.0
225
-	 * @access private
226
-	 * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
227
-	 */
228
-	private $import_service;
229
-
230
-	/**
231
-	 * A {@link Wordlift_Rebuild_Service} instance.
232
-	 *
233
-	 * @since  3.6.0
234
-	 * @access private
235
-	 * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
236
-	 */
237
-	private $rebuild_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 'WordLift Batch analysis' page.
286
-	 *
287
-	 * @since  3.14.0
288
-	 * @access protected
289
-	 * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page.
290
-	 */
291
-	protected $batch_analysis_page;
292
-
293
-	/**
294
-	 * The install wizard page.
295
-	 *
296
-	 * @since  3.9.0
297
-	 * @access private
298
-	 * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
299
-	 */
300
-	private $admin_setup;
301
-
302
-	/**
303
-	 * The Content Filter Service hooks up to the 'the_content' filter and provides
304
-	 * linking of entities to their pages.
305
-	 *
306
-	 * @since  3.8.0
307
-	 * @access private
308
-	 * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
309
-	 */
310
-	private $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_Configuration_Service} instance.
341
-	 *
342
-	 * @since  3.10.0
343
-	 * @access protected
344
-	 * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
345
-	 */
346
-	protected $configuration_service;
347
-
348
-	/**
349
-	 * A {@link Wordlift_Entity_Type_Service} instance.
350
-	 *
351
-	 * @since  3.10.0
352
-	 * @access protected
353
-	 * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
354
-	 */
355
-	protected $entity_type_service;
356
-
357
-	/**
358
-	 * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
359
-	 *
360
-	 * @since  3.10.0
361
-	 * @access protected
362
-	 * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
363
-	 */
364
-	protected $entity_post_to_jsonld_converter;
365
-
366
-	/**
367
-	 * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
368
-	 *
369
-	 * @since  3.10.0
370
-	 * @access protected
371
-	 * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
372
-	 */
373
-	protected $postid_to_jsonld_converter;
374
-
375
-	/**
376
-	 * The {@link Wordlift_Admin_Status_Page} class.
377
-	 *
378
-	 * @since  3.9.8
379
-	 * @access private
380
-	 * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
381
-	 */
382
-	private $status_page;
383
-
384
-	/**
385
-	 * The {@link Wordlift_Category_Taxonomy_Service} instance.
386
-	 *
387
-	 * @since  3.11.0
388
-	 * @access protected
389
-	 * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
390
-	 */
391
-	protected $category_taxonomy_service;
392
-
393
-	/**
394
-	 * The {@link Wordlift_Entity_Page_Service} instance.
395
-	 *
396
-	 * @since  3.11.0
397
-	 * @access protected
398
-	 * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance.
399
-	 */
400
-	protected $entity_page_service;
401
-
402
-	/**
403
-	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
404
-	 *
405
-	 * @since  3.11.0
406
-	 * @access protected
407
-	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
408
-	 */
409
-	protected $settings_page_action_link;
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_Publisher_Element} element renderer.
449
-	 *
450
-	 * @since  3.11.0
451
-	 * @access protected
452
-	 * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
453
-	 */
454
-	protected $publisher_element;
455
-
456
-	/**
457
-	 * The {@link Wordlift_Admin_Select2_Element} element renderer.
458
-	 *
459
-	 * @since  3.11.0
460
-	 * @access protected
461
-	 * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
462
-	 */
463
-	protected $select2_element;
464
-
465
-	/**
466
-	 * The controller for the entity type list admin page
467
-	 *
468
-	 * @since  3.11.0
469
-	 * @access private
470
-	 * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
471
-	 */
472
-	private $entity_type_admin_page;
473
-
474
-	/**
475
-	 * The controller for the entity type settings admin page
476
-	 *
477
-	 * @since  3.11.0
478
-	 * @access private
479
-	 * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
480
-	 */
481
-	private $entity_type_settings_admin_page;
482
-
483
-	/**
484
-	 * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
485
-	 *
486
-	 * @since  3.11.0
487
-	 * @access protected
488
-	 * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
489
-	 */
490
-	protected $related_entities_cloud_widget;
491
-
492
-	/**
493
-	 * The {@link Wordlift_Admin_Author_Element} instance.
494
-	 *
495
-	 * @since  3.14.0
496
-	 * @access protected
497
-	 * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
498
-	 */
499
-	protected $author_element;
500
-
501
-	/**
502
-	 * The {@link Wordlift_Batch_Analysis_Service} instance.
503
-	 *
504
-	 * @since  3.14.0
505
-	 * @access protected
506
-	 * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance.
507
-	 */
508
-	protected $batch_analysis_service;
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_Batch_Analysis_Adapter} instance.
530
-	 *
531
-	 * @since  3.14.2
532
-	 * @access protected
533
-	 * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance.
534
-	 */
535
-	private $batch_analysis_adapter;
536
-
537
-	/**
538
-	 * The {@link Wordlift_Relation_Rebuild_Service} instance.
539
-	 *
540
-	 * @since  3.14.3
541
-	 * @access private
542
-	 * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance.
543
-	 */
544
-	private $relation_rebuild_service;
545
-
546
-	/**
547
-	 * The {@link Wordlift_Relation_Rebuild_Adapter} instance.
548
-	 *
549
-	 * @since  3.14.3
550
-	 * @access private
551
-	 * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance.
552
-	 */
553
-	private $relation_rebuild_adapter;
554
-
555
-	/**
556
-	 * The {@link Wordlift_Google_Analytics_Export_Service} instance.
557
-	 *
558
-	 * @since  3.16.0
559
-	 * @access protected
560
-	 * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance.
561
-	 */
562
-	protected $google_analytics_export_service;
563
-
564
-	/**
565
-	 * {@link Wordlift}'s singleton instance.
566
-	 *
567
-	 * @since  3.15.0
568
-	 * @access protected
569
-	 * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance.
570
-	 */
571
-	protected $entity_type_adapter;
572
-
573
-	/**
574
-	 * The {@link Wordlift_Linked_Data_Service} instance.
575
-	 *
576
-	 * @since  3.15.0
577
-	 * @access protected
578
-	 * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance.
579
-	 */
580
-	protected $linked_data_service;
581
-
582
-	/**
583
-	 * The {@link Wordlift_Storage_Factory} instance.
584
-	 *
585
-	 * @since  3.15.0
586
-	 * @access protected
587
-	 * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance.
588
-	 */
589
-	protected $storage_factory;
590
-
591
-	/**
592
-	 * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
593
-	 *
594
-	 * @since  3.15.0
595
-	 * @access protected
596
-	 * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
597
-	 */
598
-	protected $rendition_factory;
599
-
600
-	/**
601
-	 * The {@link Wordlift_Autocomplete_Service} instance.
602
-	 *
603
-	 * @since  3.15.0
604
-	 * @access private
605
-	 * @var \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance.
606
-	 */
607
-	private $autocomplete_service;
608
-
609
-	/**
610
-	 * The {@link Wordlift_Autocomplete_Adapter} instance.
611
-	 *
612
-	 * @since  3.15.0
613
-	 * @access private
614
-	 * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance.
615
-	 */
616
-	private $autocomplete_adapter;
617
-
618
-	/**
619
-	 * The {@link Wordlift_Relation_Service} instance.
620
-	 *
621
-	 * @since  3.15.0
622
-	 * @access protected
623
-	 * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
624
-	 */
625
-	protected $relation_service;
626
-
627
-	/**
628
-	 * The {@link Wordlift_Cached_Post_Converter} instance.
629
-	 *
630
-	 * @since  3.16.0
631
-	 * @access protected
632
-	 * @var  \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance.
633
-	 *
634
-	 */
635
-	protected $cached_postid_to_jsonld_converter;
636
-
637
-	/**
638
-	 * The {@link Wordlift_File_Cache_Service} instance.
639
-	 *
640
-	 * @since  3.16.0
641
-	 * @access protected
642
-	 * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance.
643
-	 */
644
-	protected $file_cache_service;
645
-
646
-	/**
647
-	 * The {@link Wordlift_Entity_Uri_Service} instance.
648
-	 *
649
-	 * @since  3.16.3
650
-	 * @access protected
651
-	 * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
652
-	 */
653
-	protected $entity_uri_service;
654
-
655
-	/**
656
-	 * {@link Wordlift}'s singleton instance.
657
-	 *
658
-	 * @since  3.11.2
659
-	 * @access private
660
-	 * @var Wordlift $instance {@link Wordlift}'s singleton instance.
661
-	 */
662
-	private static $instance;
663
-
664
-	/**
665
-	 * Define the core functionality of the plugin.
666
-	 *
667
-	 * Set the plugin name and the plugin version that can be used throughout the plugin.
668
-	 * Load the dependencies, define the locale, and set the hooks for the admin area and
669
-	 * the public-facing side of the site.
670
-	 *
671
-	 * @since    1.0.0
672
-	 */
673
-	public function __construct() {
674
-
675
-		$this->plugin_name = 'wordlift';
676
-		$this->version     = '3.18.0-dev';
677
-		$this->load_dependencies();
678
-		$this->set_locale();
679
-		$this->define_admin_hooks();
680
-		$this->define_public_hooks();
681
-
682
-		self::$instance = $this;
683
-
684
-	}
685
-
686
-	/**
687
-	 * Get the singleton instance.
688
-	 *
689
-	 * @since 3.11.2
690
-	 *
691
-	 * @return Wordlift The {@link Wordlift} singleton instance.
692
-	 */
693
-	public static function get_instance() {
694
-
695
-		return self::$instance;
696
-	}
697
-
698
-	/**
699
-	 * Load the required dependencies for this plugin.
700
-	 *
701
-	 * Include the following files that make up the plugin:
702
-	 *
703
-	 * - Wordlift_Loader. Orchestrates the hooks of the plugin.
704
-	 * - Wordlift_i18n. Defines internationalization functionality.
705
-	 * - Wordlift_Admin. Defines all hooks for the admin area.
706
-	 * - Wordlift_Public. Defines all hooks for the public side of the site.
707
-	 *
708
-	 * Create an instance of the loader which will be used to register the hooks
709
-	 * with WordPress.
710
-	 *
711
-	 * @since    1.0.0
712
-	 * @access   private
713
-	 */
714
-	private function load_dependencies() {
715
-
716
-		/**
717
-		 * The class responsible for orchestrating the actions and filters of the
718
-		 * core plugin.
719
-		 */
720
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
721
-
722
-		/**
723
-		 * The class responsible for defining internationalization functionality
724
-		 * of the plugin.
725
-		 */
726
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
727
-
728
-		/**
729
-		 * WordLift's supported languages.
730
-		 */
731
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
732
-
733
-		/**
734
-		 * Provide support functions to sanitize data.
735
-		 */
736
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
737
-
738
-		/** Services. */
739
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
740
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
741
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
742
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
743
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
744
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
745
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
746
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
747
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
748
-
749
-		/**
750
-		 * The Query builder.
751
-		 */
752
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
753
-
754
-		/**
755
-		 * The Schema service.
756
-		 */
757
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
758
-
759
-		/**
760
-		 * The schema:url property service.
761
-		 */
762
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
763
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
764
-
765
-		/**
766
-		 * The UI service.
767
-		 */
768
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
769
-
770
-		/**
771
-		 * The Thumbnail service.
772
-		 */
773
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
774
-
775
-		/**
776
-		 * The Entity Types Taxonomy service.
777
-		 */
778
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
779
-
780
-		/**
781
-		 * The Entity service.
782
-		 */
783
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
784
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
785
-
786
-		// Add the entity rating service.
787
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
788
-
789
-		/**
790
-		 * The User service.
791
-		 */
792
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
793
-
794
-		/**
795
-		 * The Timeline service.
796
-		 */
797
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
798
-
799
-		/**
800
-		 * The Topic Taxonomy service.
801
-		 */
802
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
803
-
804
-		/**
805
-		 * The SPARQL service.
806
-		 */
807
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
808
-
809
-		/**
810
-		 * The WordLift import service.
811
-		 */
812
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
813
-
814
-		/**
815
-		 * The WordLift URI service.
816
-		 */
817
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
818
-
819
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php';
820
-
821
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
822
-
823
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
824
-
825
-		/**
826
-		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
827
-		 */
828
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php';
829
-
830
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
831
-
832
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
833
-
834
-		/**
835
-		 * Load the converters.
836
-		 */
837
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
838
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
839
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
840
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
841
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
842
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
843
-
844
-		/**
845
-		 * Load cache-related files.
846
-		 */
847
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
848
-
849
-		/**
850
-		 * Load the content filter.
851
-		 */
852
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
853
-
854
-		/*
31
+    /**
32
+     * The loader that's responsible for maintaining and registering all hooks that power
33
+     * the plugin.
34
+     *
35
+     * @since    1.0.0
36
+     * @access   protected
37
+     * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
38
+     */
39
+    protected $loader;
40
+
41
+    /**
42
+     * The unique identifier of this plugin.
43
+     *
44
+     * @since    1.0.0
45
+     * @access   protected
46
+     * @var      string $plugin_name The string used to uniquely identify this plugin.
47
+     */
48
+    protected $plugin_name;
49
+
50
+    /**
51
+     * The current version of the plugin.
52
+     *
53
+     * @since    1.0.0
54
+     * @access   protected
55
+     * @var      string $version The current version of the plugin.
56
+     */
57
+    protected $version;
58
+
59
+    /**
60
+     * The {@link Wordlift_Tinymce_Adapter} instance.
61
+     *
62
+     * @since  3.12.0
63
+     * @access protected
64
+     * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
65
+     */
66
+    protected $tinymce_adapter;
67
+
68
+    /**
69
+     * The Thumbnail service.
70
+     *
71
+     * @since  3.1.5
72
+     * @access private
73
+     * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
74
+     */
75
+    private $thumbnail_service;
76
+
77
+    /**
78
+     * The UI service.
79
+     *
80
+     * @since  3.2.0
81
+     * @access private
82
+     * @var \Wordlift_UI_Service $ui_service The UI service.
83
+     */
84
+    private $ui_service;
85
+
86
+    /**
87
+     * The Schema service.
88
+     *
89
+     * @since  3.3.0
90
+     * @access protected
91
+     * @var \Wordlift_Schema_Service $schema_service The Schema service.
92
+     */
93
+    protected $schema_service;
94
+
95
+    /**
96
+     * The Entity service.
97
+     *
98
+     * @since  3.1.0
99
+     * @access protected
100
+     * @var \Wordlift_Entity_Service $entity_service The Entity service.
101
+     */
102
+    protected $entity_service;
103
+
104
+    /**
105
+     * The Topic Taxonomy service.
106
+     *
107
+     * @since  3.5.0
108
+     * @access private
109
+     * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
110
+     */
111
+    private $topic_taxonomy_service;
112
+
113
+    /**
114
+     * The User service.
115
+     *
116
+     * @since  3.1.7
117
+     * @access protected
118
+     * @var \Wordlift_User_Service $user_service The User service.
119
+     */
120
+    protected $user_service;
121
+
122
+    /**
123
+     * The Timeline service.
124
+     *
125
+     * @since  3.1.0
126
+     * @access private
127
+     * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
128
+     */
129
+    private $timeline_service;
130
+
131
+    /**
132
+     * The Redirect service.
133
+     *
134
+     * @since  3.2.0
135
+     * @access private
136
+     * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
137
+     */
138
+    private $redirect_service;
139
+
140
+    /**
141
+     * The Notice service.
142
+     *
143
+     * @since  3.3.0
144
+     * @access private
145
+     * @var \Wordlift_Notice_Service $notice_service The Notice service.
146
+     */
147
+    private $notice_service;
148
+
149
+    /**
150
+     * The Entity list customization.
151
+     *
152
+     * @since  3.3.0
153
+     * @access protected
154
+     * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
155
+     */
156
+    protected $entity_list_service;
157
+
158
+    /**
159
+     * The Entity Types Taxonomy Walker.
160
+     *
161
+     * @since  3.1.0
162
+     * @access private
163
+     * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
164
+     */
165
+    private $entity_types_taxonomy_walker;
166
+
167
+    /**
168
+     * The ShareThis service.
169
+     *
170
+     * @since  3.2.0
171
+     * @access private
172
+     * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
173
+     */
174
+    private $sharethis_service;
175
+
176
+    /**
177
+     * The PrimaShop adapter.
178
+     *
179
+     * @since  3.2.3
180
+     * @access private
181
+     * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
182
+     */
183
+    private $primashop_adapter;
184
+
185
+    /**
186
+     * The WordLift Dashboard adapter.
187
+     *
188
+     * @since  3.4.0
189
+     * @access private
190
+     * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
191
+     */
192
+    private $dashboard_service;
193
+
194
+    /**
195
+     * The entity type service.
196
+     *
197
+     * @since  3.6.0
198
+     * @access private
199
+     * @var \Wordlift_Entity_Post_Type_Service
200
+     */
201
+    private $entity_post_type_service;
202
+
203
+    /**
204
+     * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
205
+     *
206
+     * @since  3.6.0
207
+     * @access private
208
+     * @var \Wordlift_Entity_Link_Service
209
+     */
210
+    private $entity_link_service;
211
+
212
+    /**
213
+     * A {@link Wordlift_Sparql_Service} instance.
214
+     *
215
+     * @since    3.6.0
216
+     * @access   protected
217
+     * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
218
+     */
219
+    protected $sparql_service;
220
+
221
+    /**
222
+     * A {@link Wordlift_Import_Service} instance.
223
+     *
224
+     * @since  3.6.0
225
+     * @access private
226
+     * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
227
+     */
228
+    private $import_service;
229
+
230
+    /**
231
+     * A {@link Wordlift_Rebuild_Service} instance.
232
+     *
233
+     * @since  3.6.0
234
+     * @access private
235
+     * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
236
+     */
237
+    private $rebuild_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 'WordLift Batch analysis' page.
286
+     *
287
+     * @since  3.14.0
288
+     * @access protected
289
+     * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page.
290
+     */
291
+    protected $batch_analysis_page;
292
+
293
+    /**
294
+     * The install wizard page.
295
+     *
296
+     * @since  3.9.0
297
+     * @access private
298
+     * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
299
+     */
300
+    private $admin_setup;
301
+
302
+    /**
303
+     * The Content Filter Service hooks up to the 'the_content' filter and provides
304
+     * linking of entities to their pages.
305
+     *
306
+     * @since  3.8.0
307
+     * @access private
308
+     * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
309
+     */
310
+    private $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_Configuration_Service} instance.
341
+     *
342
+     * @since  3.10.0
343
+     * @access protected
344
+     * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
345
+     */
346
+    protected $configuration_service;
347
+
348
+    /**
349
+     * A {@link Wordlift_Entity_Type_Service} instance.
350
+     *
351
+     * @since  3.10.0
352
+     * @access protected
353
+     * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
354
+     */
355
+    protected $entity_type_service;
356
+
357
+    /**
358
+     * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
359
+     *
360
+     * @since  3.10.0
361
+     * @access protected
362
+     * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
363
+     */
364
+    protected $entity_post_to_jsonld_converter;
365
+
366
+    /**
367
+     * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
368
+     *
369
+     * @since  3.10.0
370
+     * @access protected
371
+     * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
372
+     */
373
+    protected $postid_to_jsonld_converter;
374
+
375
+    /**
376
+     * The {@link Wordlift_Admin_Status_Page} class.
377
+     *
378
+     * @since  3.9.8
379
+     * @access private
380
+     * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
381
+     */
382
+    private $status_page;
383
+
384
+    /**
385
+     * The {@link Wordlift_Category_Taxonomy_Service} instance.
386
+     *
387
+     * @since  3.11.0
388
+     * @access protected
389
+     * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
390
+     */
391
+    protected $category_taxonomy_service;
392
+
393
+    /**
394
+     * The {@link Wordlift_Entity_Page_Service} instance.
395
+     *
396
+     * @since  3.11.0
397
+     * @access protected
398
+     * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance.
399
+     */
400
+    protected $entity_page_service;
401
+
402
+    /**
403
+     * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
404
+     *
405
+     * @since  3.11.0
406
+     * @access protected
407
+     * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
408
+     */
409
+    protected $settings_page_action_link;
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_Publisher_Element} element renderer.
449
+     *
450
+     * @since  3.11.0
451
+     * @access protected
452
+     * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
453
+     */
454
+    protected $publisher_element;
455
+
456
+    /**
457
+     * The {@link Wordlift_Admin_Select2_Element} element renderer.
458
+     *
459
+     * @since  3.11.0
460
+     * @access protected
461
+     * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
462
+     */
463
+    protected $select2_element;
464
+
465
+    /**
466
+     * The controller for the entity type list admin page
467
+     *
468
+     * @since  3.11.0
469
+     * @access private
470
+     * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
471
+     */
472
+    private $entity_type_admin_page;
473
+
474
+    /**
475
+     * The controller for the entity type settings admin page
476
+     *
477
+     * @since  3.11.0
478
+     * @access private
479
+     * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
480
+     */
481
+    private $entity_type_settings_admin_page;
482
+
483
+    /**
484
+     * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
485
+     *
486
+     * @since  3.11.0
487
+     * @access protected
488
+     * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
489
+     */
490
+    protected $related_entities_cloud_widget;
491
+
492
+    /**
493
+     * The {@link Wordlift_Admin_Author_Element} instance.
494
+     *
495
+     * @since  3.14.0
496
+     * @access protected
497
+     * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
498
+     */
499
+    protected $author_element;
500
+
501
+    /**
502
+     * The {@link Wordlift_Batch_Analysis_Service} instance.
503
+     *
504
+     * @since  3.14.0
505
+     * @access protected
506
+     * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance.
507
+     */
508
+    protected $batch_analysis_service;
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_Batch_Analysis_Adapter} instance.
530
+     *
531
+     * @since  3.14.2
532
+     * @access protected
533
+     * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance.
534
+     */
535
+    private $batch_analysis_adapter;
536
+
537
+    /**
538
+     * The {@link Wordlift_Relation_Rebuild_Service} instance.
539
+     *
540
+     * @since  3.14.3
541
+     * @access private
542
+     * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance.
543
+     */
544
+    private $relation_rebuild_service;
545
+
546
+    /**
547
+     * The {@link Wordlift_Relation_Rebuild_Adapter} instance.
548
+     *
549
+     * @since  3.14.3
550
+     * @access private
551
+     * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance.
552
+     */
553
+    private $relation_rebuild_adapter;
554
+
555
+    /**
556
+     * The {@link Wordlift_Google_Analytics_Export_Service} instance.
557
+     *
558
+     * @since  3.16.0
559
+     * @access protected
560
+     * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance.
561
+     */
562
+    protected $google_analytics_export_service;
563
+
564
+    /**
565
+     * {@link Wordlift}'s singleton instance.
566
+     *
567
+     * @since  3.15.0
568
+     * @access protected
569
+     * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance.
570
+     */
571
+    protected $entity_type_adapter;
572
+
573
+    /**
574
+     * The {@link Wordlift_Linked_Data_Service} instance.
575
+     *
576
+     * @since  3.15.0
577
+     * @access protected
578
+     * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance.
579
+     */
580
+    protected $linked_data_service;
581
+
582
+    /**
583
+     * The {@link Wordlift_Storage_Factory} instance.
584
+     *
585
+     * @since  3.15.0
586
+     * @access protected
587
+     * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance.
588
+     */
589
+    protected $storage_factory;
590
+
591
+    /**
592
+     * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
593
+     *
594
+     * @since  3.15.0
595
+     * @access protected
596
+     * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
597
+     */
598
+    protected $rendition_factory;
599
+
600
+    /**
601
+     * The {@link Wordlift_Autocomplete_Service} instance.
602
+     *
603
+     * @since  3.15.0
604
+     * @access private
605
+     * @var \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance.
606
+     */
607
+    private $autocomplete_service;
608
+
609
+    /**
610
+     * The {@link Wordlift_Autocomplete_Adapter} instance.
611
+     *
612
+     * @since  3.15.0
613
+     * @access private
614
+     * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance.
615
+     */
616
+    private $autocomplete_adapter;
617
+
618
+    /**
619
+     * The {@link Wordlift_Relation_Service} instance.
620
+     *
621
+     * @since  3.15.0
622
+     * @access protected
623
+     * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
624
+     */
625
+    protected $relation_service;
626
+
627
+    /**
628
+     * The {@link Wordlift_Cached_Post_Converter} instance.
629
+     *
630
+     * @since  3.16.0
631
+     * @access protected
632
+     * @var  \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance.
633
+     *
634
+     */
635
+    protected $cached_postid_to_jsonld_converter;
636
+
637
+    /**
638
+     * The {@link Wordlift_File_Cache_Service} instance.
639
+     *
640
+     * @since  3.16.0
641
+     * @access protected
642
+     * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance.
643
+     */
644
+    protected $file_cache_service;
645
+
646
+    /**
647
+     * The {@link Wordlift_Entity_Uri_Service} instance.
648
+     *
649
+     * @since  3.16.3
650
+     * @access protected
651
+     * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
652
+     */
653
+    protected $entity_uri_service;
654
+
655
+    /**
656
+     * {@link Wordlift}'s singleton instance.
657
+     *
658
+     * @since  3.11.2
659
+     * @access private
660
+     * @var Wordlift $instance {@link Wordlift}'s singleton instance.
661
+     */
662
+    private static $instance;
663
+
664
+    /**
665
+     * Define the core functionality of the plugin.
666
+     *
667
+     * Set the plugin name and the plugin version that can be used throughout the plugin.
668
+     * Load the dependencies, define the locale, and set the hooks for the admin area and
669
+     * the public-facing side of the site.
670
+     *
671
+     * @since    1.0.0
672
+     */
673
+    public function __construct() {
674
+
675
+        $this->plugin_name = 'wordlift';
676
+        $this->version     = '3.18.0-dev';
677
+        $this->load_dependencies();
678
+        $this->set_locale();
679
+        $this->define_admin_hooks();
680
+        $this->define_public_hooks();
681
+
682
+        self::$instance = $this;
683
+
684
+    }
685
+
686
+    /**
687
+     * Get the singleton instance.
688
+     *
689
+     * @since 3.11.2
690
+     *
691
+     * @return Wordlift The {@link Wordlift} singleton instance.
692
+     */
693
+    public static function get_instance() {
694
+
695
+        return self::$instance;
696
+    }
697
+
698
+    /**
699
+     * Load the required dependencies for this plugin.
700
+     *
701
+     * Include the following files that make up the plugin:
702
+     *
703
+     * - Wordlift_Loader. Orchestrates the hooks of the plugin.
704
+     * - Wordlift_i18n. Defines internationalization functionality.
705
+     * - Wordlift_Admin. Defines all hooks for the admin area.
706
+     * - Wordlift_Public. Defines all hooks for the public side of the site.
707
+     *
708
+     * Create an instance of the loader which will be used to register the hooks
709
+     * with WordPress.
710
+     *
711
+     * @since    1.0.0
712
+     * @access   private
713
+     */
714
+    private function load_dependencies() {
715
+
716
+        /**
717
+         * The class responsible for orchestrating the actions and filters of the
718
+         * core plugin.
719
+         */
720
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
721
+
722
+        /**
723
+         * The class responsible for defining internationalization functionality
724
+         * of the plugin.
725
+         */
726
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
727
+
728
+        /**
729
+         * WordLift's supported languages.
730
+         */
731
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
732
+
733
+        /**
734
+         * Provide support functions to sanitize data.
735
+         */
736
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
737
+
738
+        /** Services. */
739
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
740
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
741
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
742
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
743
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
744
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
745
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
746
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
747
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
748
+
749
+        /**
750
+         * The Query builder.
751
+         */
752
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
753
+
754
+        /**
755
+         * The Schema service.
756
+         */
757
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
758
+
759
+        /**
760
+         * The schema:url property service.
761
+         */
762
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
763
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
764
+
765
+        /**
766
+         * The UI service.
767
+         */
768
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
769
+
770
+        /**
771
+         * The Thumbnail service.
772
+         */
773
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
774
+
775
+        /**
776
+         * The Entity Types Taxonomy service.
777
+         */
778
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
779
+
780
+        /**
781
+         * The Entity service.
782
+         */
783
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
784
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
785
+
786
+        // Add the entity rating service.
787
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
788
+
789
+        /**
790
+         * The User service.
791
+         */
792
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
793
+
794
+        /**
795
+         * The Timeline service.
796
+         */
797
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
798
+
799
+        /**
800
+         * The Topic Taxonomy service.
801
+         */
802
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
803
+
804
+        /**
805
+         * The SPARQL service.
806
+         */
807
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
808
+
809
+        /**
810
+         * The WordLift import service.
811
+         */
812
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
813
+
814
+        /**
815
+         * The WordLift URI service.
816
+         */
817
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
818
+
819
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php';
820
+
821
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
822
+
823
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
824
+
825
+        /**
826
+         * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
827
+         */
828
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php';
829
+
830
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
831
+
832
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
833
+
834
+        /**
835
+         * Load the converters.
836
+         */
837
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
838
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
839
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
840
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
841
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
842
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
843
+
844
+        /**
845
+         * Load cache-related files.
846
+         */
847
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
848
+
849
+        /**
850
+         * Load the content filter.
851
+         */
852
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
853
+
854
+        /*
855 855
 		 * Load the excerpt helper.
856 856
 		 */
857
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
858
-
859
-		/**
860
-		 * Load the JSON-LD service to publish entities using JSON-LD.s
861
-		 *
862
-		 * @since 3.8.0
863
-		 */
864
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
865
-
866
-		// The Publisher Service and the AJAX adapter.
867
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
868
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
869
-
870
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
871
-
872
-		/**
873
-		 * Load the WordLift key validation service.
874
-		 */
875
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
876
-
877
-		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
878
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
879
-
880
-		// Load the `Wordlift_Entity_Page_Service` class definition.
881
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
882
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php';
883
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php';
884
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-rebuild-service.php';
885
-
886
-		/** Linked Data. */
887
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
888
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
889
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
890
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
891
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
892
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
893
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
894
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
895
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
896
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
897
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
898
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition.php';
899
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
900
-
901
-		/** Services. */
902
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
903
-
904
-		/** Adapters. */
905
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
906
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
907
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
908
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
909
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php';
910
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-rebuild-adapter.php';
911
-
912
-		/** Async Tasks. */
913
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
914
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
915
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
916
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
917
-
918
-		/** Async Tasks. */
919
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php';
920
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
921
-
922
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
923
-
924
-		/**
925
-		 * The class responsible for defining all actions that occur in the admin area.
926
-		 */
927
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
928
-
929
-		/**
930
-		 * The class to customize the entity list admin page.
931
-		 */
932
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
933
-
934
-		/**
935
-		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
936
-		 */
937
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
938
-
939
-		/**
940
-		 * The Notice service.
941
-		 */
942
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
943
-
944
-		/**
945
-		 * The PrimaShop adapter.
946
-		 */
947
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
948
-
949
-		/**
950
-		 * The WordLift Dashboard service.
951
-		 */
952
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
953
-
954
-		/**
955
-		 * The admin 'Install wizard' page.
956
-		 */
957
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
958
-
959
-		/**
960
-		 * The WordLift entity type list admin page controller.
961
-		 */
962
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
963
-
964
-		/**
965
-		 * The WordLift entity type settings admin page controller.
966
-		 */
967
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
968
-
969
-		/**
970
-		 * The admin 'Download Your Data' page.
971
-		 */
972
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
973
-
974
-		/**
975
-		 * The admin 'WordLift Settings' page.
976
-		 */
977
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
978
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
979
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
980
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
981
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
982
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
983
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
984
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
985
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
986
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
987
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php';
988
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
989
-
990
-		/** Admin Pages */
991
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
992
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
993
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
994
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
995
-
996
-		/**
997
-		 * The class responsible for defining all actions that occur in the public-facing
998
-		 * side of the site.
999
-		 */
1000
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1001
-
1002
-		/**
1003
-		 * The shortcode abstract class.
1004
-		 */
1005
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1006
-
1007
-		/**
1008
-		 * The Timeline shortcode.
1009
-		 */
1010
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1011
-
1012
-		/**
1013
-		 * The Navigator shortcode.
1014
-		 */
1015
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1016
-
1017
-		/**
1018
-		 * The chord shortcode.
1019
-		 */
1020
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1021
-
1022
-		/**
1023
-		 * The geomap shortcode.
1024
-		 */
1025
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1026
-
1027
-		/**
1028
-		 * The entity cloud shortcode.
1029
-		 */
1030
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1031
-
1032
-		/**
1033
-		 * The entity glossary shortcode.
1034
-		 */
1035
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1036
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1037
-
1038
-		/**
1039
-		 * The ShareThis service.
1040
-		 */
1041
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1042
-
1043
-		/**
1044
-		 * The SEO service.
1045
-		 */
1046
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1047
-
1048
-		/**
1049
-		 * The AMP service.
1050
-		 */
1051
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1052
-
1053
-		/** Widgets */
1054
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1055
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1056
-
1057
-		$this->loader = new Wordlift_Loader();
1058
-
1059
-		// Instantiate a global logger.
1060
-		global $wl_logger;
1061
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1062
-
1063
-		// Load the `wl-api` end-point.
1064
-		new Wordlift_Http_Api();
1065
-
1066
-		/** Services. */
1067
-		// Create the configuration service.
1068
-		$this->configuration_service = new Wordlift_Configuration_Service();
1069
-
1070
-		// Create an entity type service instance. It'll be later bound to the init action.
1071
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1072
-
1073
-		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1074
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1075
-
1076
-		// Create an instance of the UI service.
1077
-		$this->ui_service = new Wordlift_UI_Service();
1078
-
1079
-		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
1080
-		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
1081
-
1082
-		$this->sparql_service        = new Wordlift_Sparql_Service();
1083
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1084
-		$this->notice_service        = new Wordlift_Notice_Service();
1085
-		$this->relation_service      = new Wordlift_Relation_Service();
857
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
858
+
859
+        /**
860
+         * Load the JSON-LD service to publish entities using JSON-LD.s
861
+         *
862
+         * @since 3.8.0
863
+         */
864
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
865
+
866
+        // The Publisher Service and the AJAX adapter.
867
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
868
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
869
+
870
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
871
+
872
+        /**
873
+         * Load the WordLift key validation service.
874
+         */
875
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
876
+
877
+        // Load the `Wordlift_Category_Taxonomy_Service` class definition.
878
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
879
+
880
+        // Load the `Wordlift_Entity_Page_Service` class definition.
881
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
882
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php';
883
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php';
884
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-rebuild-service.php';
885
+
886
+        /** Linked Data. */
887
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
888
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
889
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
890
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
891
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
892
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
893
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
894
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
895
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
896
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
897
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
898
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition.php';
899
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
900
+
901
+        /** Services. */
902
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
903
+
904
+        /** Adapters. */
905
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
906
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
907
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
908
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
909
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php';
910
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-rebuild-adapter.php';
911
+
912
+        /** Async Tasks. */
913
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
914
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
915
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
916
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
917
+
918
+        /** Async Tasks. */
919
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php';
920
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
921
+
922
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
923
+
924
+        /**
925
+         * The class responsible for defining all actions that occur in the admin area.
926
+         */
927
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
928
+
929
+        /**
930
+         * The class to customize the entity list admin page.
931
+         */
932
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
933
+
934
+        /**
935
+         * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
936
+         */
937
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
938
+
939
+        /**
940
+         * The Notice service.
941
+         */
942
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
943
+
944
+        /**
945
+         * The PrimaShop adapter.
946
+         */
947
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
948
+
949
+        /**
950
+         * The WordLift Dashboard service.
951
+         */
952
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
953
+
954
+        /**
955
+         * The admin 'Install wizard' page.
956
+         */
957
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
958
+
959
+        /**
960
+         * The WordLift entity type list admin page controller.
961
+         */
962
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
963
+
964
+        /**
965
+         * The WordLift entity type settings admin page controller.
966
+         */
967
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
968
+
969
+        /**
970
+         * The admin 'Download Your Data' page.
971
+         */
972
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
973
+
974
+        /**
975
+         * The admin 'WordLift Settings' page.
976
+         */
977
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
978
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
979
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
980
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
981
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
982
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
983
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
984
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
985
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
986
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
987
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php';
988
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
989
+
990
+        /** Admin Pages */
991
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
992
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
993
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
994
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
995
+
996
+        /**
997
+         * The class responsible for defining all actions that occur in the public-facing
998
+         * side of the site.
999
+         */
1000
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1001
+
1002
+        /**
1003
+         * The shortcode abstract class.
1004
+         */
1005
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1006
+
1007
+        /**
1008
+         * The Timeline shortcode.
1009
+         */
1010
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1011
+
1012
+        /**
1013
+         * The Navigator shortcode.
1014
+         */
1015
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1016
+
1017
+        /**
1018
+         * The chord shortcode.
1019
+         */
1020
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1021
+
1022
+        /**
1023
+         * The geomap shortcode.
1024
+         */
1025
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1026
+
1027
+        /**
1028
+         * The entity cloud shortcode.
1029
+         */
1030
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1031
+
1032
+        /**
1033
+         * The entity glossary shortcode.
1034
+         */
1035
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1036
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1037
+
1038
+        /**
1039
+         * The ShareThis service.
1040
+         */
1041
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1042
+
1043
+        /**
1044
+         * The SEO service.
1045
+         */
1046
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1047
+
1048
+        /**
1049
+         * The AMP service.
1050
+         */
1051
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1052
+
1053
+        /** Widgets */
1054
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1055
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1056
+
1057
+        $this->loader = new Wordlift_Loader();
1058
+
1059
+        // Instantiate a global logger.
1060
+        global $wl_logger;
1061
+        $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1062
+
1063
+        // Load the `wl-api` end-point.
1064
+        new Wordlift_Http_Api();
1065
+
1066
+        /** Services. */
1067
+        // Create the configuration service.
1068
+        $this->configuration_service = new Wordlift_Configuration_Service();
1069
+
1070
+        // Create an entity type service instance. It'll be later bound to the init action.
1071
+        $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1072
+
1073
+        // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1074
+        $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1075
+
1076
+        // Create an instance of the UI service.
1077
+        $this->ui_service = new Wordlift_UI_Service();
1078
+
1079
+        // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
1080
+        $this->thumbnail_service = new Wordlift_Thumbnail_Service();
1081
+
1082
+        $this->sparql_service        = new Wordlift_Sparql_Service();
1083
+        $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1084
+        $this->notice_service        = new Wordlift_Notice_Service();
1085
+        $this->relation_service      = new Wordlift_Relation_Service();
1086 1086
 
1087
-		$entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1088
-		$this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' );
1089
-		$this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1090
-		$this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1091
-		$this->user_service       = new Wordlift_User_Service();
1087
+        $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1088
+        $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' );
1089
+        $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1090
+        $this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1091
+        $this->user_service       = new Wordlift_User_Service();
1092 1092
 
1093
-		// Instantiate the JSON-LD service.
1094
-		$property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1093
+        // Instantiate the JSON-LD service.
1094
+        $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1095 1095
 
1096
-		/** Linked Data. */
1097
-		$this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1098
-		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1096
+        /** Linked Data. */
1097
+        $this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1098
+        $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1099 1099
 
1100
-		$this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1100
+        $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1101 1101
 
1102
-		// Create a new instance of the Redirect service.
1103
-		$this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_service );
1104
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1105
-		$this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service );
1102
+        // Create a new instance of the Redirect service.
1103
+        $this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_service );
1104
+        $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1105
+        $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service );
1106 1106
 
1107
-		// Create a new instance of the Timeline service and Timeline shortcode.
1108
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1107
+        // Create a new instance of the Timeline service and Timeline shortcode.
1108
+        $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1109 1109
 
1110
-		$this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service );
1110
+        $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service );
1111 1111
 
1112
-		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1112
+        $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1113 1113
 
1114
-		$this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service();
1114
+        $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service();
1115 1115
 
1116
-		// Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1117
-		$this->sharethis_service = new Wordlift_ShareThis_Service();
1116
+        // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1117
+        $this->sharethis_service = new Wordlift_ShareThis_Service();
1118 1118
 
1119
-		// Create an instance of the PrimaShop adapter.
1120
-		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1119
+        // Create an instance of the PrimaShop adapter.
1120
+        $this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1121 1121
 
1122
-		// Create an import service instance to hook later to WP's import function.
1123
-		$this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() );
1122
+        // Create an import service instance to hook later to WP's import function.
1123
+        $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() );
1124 1124
 
1125
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1125
+        $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1126 1126
 
1127
-		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
1128
-		$this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service );
1127
+        // Create a Rebuild Service instance, which we'll later bound to an ajax call.
1128
+        $this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service );
1129 1129
 
1130
-		// Create the entity rating service.
1131
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1130
+        // Create the entity rating service.
1131
+        $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1132 1132
 
1133
-		// Create entity list customization (wp-admin/edit.php).
1134
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1133
+        // Create entity list customization (wp-admin/edit.php).
1134
+        $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1135 1135
 
1136
-		// Create a new instance of the Redirect service.
1137
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1136
+        // Create a new instance of the Redirect service.
1137
+        $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1138 1138
 
1139
-		// Create an instance of the Publisher Service and the AJAX Adapter.
1140
-		$publisher_service      = new Wordlift_Publisher_Service();
1141
-		$this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service );
1142
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1139
+        // Create an instance of the Publisher Service and the AJAX Adapter.
1140
+        $publisher_service      = new Wordlift_Publisher_Service();
1141
+        $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service );
1142
+        $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1143 1143
 
1144
-		$attachment_service = new Wordlift_Attachment_Service();
1144
+        $attachment_service = new Wordlift_Attachment_Service();
1145 1145
 
1146
-		// Instantiate the JSON-LD service.
1147
-		$property_getter                         = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1148
-		$this->entity_post_to_jsonld_converter   = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter );
1149
-		$this->post_to_jsonld_converter          = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1150
-		$this->postid_to_jsonld_converter        = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter );
1151
-		$this->jsonld_website_converter          = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1152
-		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service );
1153
-		$this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1146
+        // Instantiate the JSON-LD service.
1147
+        $property_getter                         = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1148
+        $this->entity_post_to_jsonld_converter   = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter );
1149
+        $this->post_to_jsonld_converter          = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1150
+        $this->postid_to_jsonld_converter        = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter );
1151
+        $this->jsonld_website_converter          = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1152
+        $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service );
1153
+        $this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1154 1154
 
1155 1155
 
1156
-		$this->key_validation_service   = new Wordlift_Key_Validation_Service( $this->configuration_service );
1157
-		$this->content_filter_service   = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1158
-		$this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1159
-		$this->sample_data_service      = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1160
-		$this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1156
+        $this->key_validation_service   = new Wordlift_Key_Validation_Service( $this->configuration_service );
1157
+        $this->content_filter_service   = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1158
+        $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1159
+        $this->sample_data_service      = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1160
+        $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1161 1161
 
1162
-		// Initialize the shortcodes.
1163
-		new Wordlift_Navigator_Shortcode();
1164
-		new Wordlift_Chord_Shortcode();
1165
-		new Wordlift_Geomap_Shortcode();
1166
-		new Wordlift_Timeline_Shortcode();
1167
-		new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1168
-		new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1162
+        // Initialize the shortcodes.
1163
+        new Wordlift_Navigator_Shortcode();
1164
+        new Wordlift_Chord_Shortcode();
1165
+        new Wordlift_Geomap_Shortcode();
1166
+        new Wordlift_Timeline_Shortcode();
1167
+        new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1168
+        new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1169 1169
 
1170
-		// Initialize the SEO service.
1171
-		new Wordlift_Seo_Service();
1170
+        // Initialize the SEO service.
1171
+        new Wordlift_Seo_Service();
1172 1172
 
1173
-		// Initialize the AMP service.
1174
-		new Wordlift_AMP_Service();
1173
+        // Initialize the AMP service.
1174
+        new Wordlift_AMP_Service();
1175 1175
 
1176
-		/** Services. */
1177
-		$this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1176
+        /** Services. */
1177
+        $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1178 1178
 
1179
-		/** Adapters. */
1180
-		$this->entity_type_adapter      = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1181
-		$this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter( $publisher_service );
1182
-		$this->tinymce_adapter          = new Wordlift_Tinymce_Adapter( $this );
1183
-		$this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service );
1184
-		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1179
+        /** Adapters. */
1180
+        $this->entity_type_adapter      = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1181
+        $this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter( $publisher_service );
1182
+        $this->tinymce_adapter          = new Wordlift_Tinymce_Adapter( $this );
1183
+        $this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service );
1184
+        $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1185 1185
 
1186
-		/** Async Tasks. */
1187
-		new Wordlift_Sparql_Query_Async_Task();
1188
-		new Wordlift_Batch_Analysis_Request_Async_Task();
1189
-		new Wordlift_Batch_Analysis_Complete_Async_Task();
1186
+        /** Async Tasks. */
1187
+        new Wordlift_Sparql_Query_Async_Task();
1188
+        new Wordlift_Batch_Analysis_Request_Async_Task();
1189
+        new Wordlift_Batch_Analysis_Complete_Async_Task();
1190 1190
 
1191
-		/** WL Autocomplete. */
1192
-		$this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service );
1193
-		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service );
1191
+        /** WL Autocomplete. */
1192
+        $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service );
1193
+        $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service );
1194 1194
 
1195
-		/** WordPress Admin UI. */
1195
+        /** WordPress Admin UI. */
1196 1196
 
1197
-		// UI elements.
1198
-		$this->input_element           = new Wordlift_Admin_Input_Element();
1199
-		$this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1200
-		$this->select2_element         = new Wordlift_Admin_Select2_Element();
1201
-		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1202
-		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
1203
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element );
1204
-		$this->author_element          = new Wordlift_Admin_Author_Element( $publisher_service, $this->select2_element );
1197
+        // UI elements.
1198
+        $this->input_element           = new Wordlift_Admin_Input_Element();
1199
+        $this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1200
+        $this->select2_element         = new Wordlift_Admin_Select2_Element();
1201
+        $this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1202
+        $tabs_element                  = new Wordlift_Admin_Tabs_Element();
1203
+        $this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element );
1204
+        $this->author_element          = new Wordlift_Admin_Author_Element( $publisher_service, $this->select2_element );
1205 1205
 
1206
-		$this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element );
1207
-		$this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service );
1208
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1206
+        $this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element );
1207
+        $this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service );
1208
+        $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1209 1209
 
1210
-		// Pages.
1211
-		new Wordlift_Admin_Post_Edit_Page( $this );
1212
-		new Wordlift_Entity_Type_Admin_Service();
1210
+        // Pages.
1211
+        new Wordlift_Admin_Post_Edit_Page( $this );
1212
+        new Wordlift_Entity_Type_Admin_Service();
1213 1213
 
1214
-		// create an instance of the entity type list admin page controller.
1215
-		$this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1216
-
1217
-		// create an instance of the entity type etting admin page controller.
1218
-		$this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1219
-
1220
-		/** Widgets */
1221
-		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1222
-
1223
-		/* WordPress Admin. */
1224
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1225
-		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1226
-
1227
-		// Create an instance of the install wizard.
1228
-		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1229
-
1230
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1231
-
1232
-		// User Profile.
1233
-		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1234
-
1235
-		$this->entity_page_service = new Wordlift_Entity_Page_Service();
1236
-
1237
-		// Load the debug service if WP is in debug mode.
1238
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1239
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1240
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1241
-		}
1242
-
1243
-		// Remote Image Service.
1244
-		new Wordlift_Remote_Image_Service();
1245
-	}
1246
-
1247
-	/**
1248
-	 * Define the locale for this plugin for internationalization.
1249
-	 *
1250
-	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1251
-	 * with WordPress.
1252
-	 *
1253
-	 * @since    1.0.0
1254
-	 * @access   private
1255
-	 */
1256
-	private function set_locale() {
1257
-
1258
-		$plugin_i18n = new Wordlift_i18n();
1259
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1260
-
1261
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1262
-
1263
-	}
1264
-
1265
-	/**
1266
-	 * Register all of the hooks related to the admin area functionality
1267
-	 * of the plugin.
1268
-	 *
1269
-	 * @since    1.0.0
1270
-	 * @access   private
1271
-	 */
1272
-	private function define_admin_hooks() {
1273
-
1274
-		$plugin_admin = new Wordlift_Admin(
1275
-			$this->get_plugin_name(),
1276
-			$this->get_version(),
1277
-			$this->configuration_service,
1278
-			$this->notice_service,
1279
-			$this->user_service
1280
-		);
1281
-
1282
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1283
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1284
-
1285
-		// Hook the init action to the Topic Taxonomy service.
1286
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1287
-
1288
-		// Hook the deleted_post_meta action to the Thumbnail service.
1289
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1290
-
1291
-		// Hook the added_post_meta action to the Thumbnail service.
1292
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1293
-
1294
-		// Hook the updated_post_meta action to the Thumbnail service.
1295
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1296
-
1297
-		// Hook the AJAX wl_timeline action to the Timeline service.
1298
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1299
-
1300
-		// Register custom allowed redirect hosts.
1301
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1302
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1303
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1304
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1305
-		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1306
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1307
-		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1308
-
1309
-		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1310
-		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1311
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1312
-		$this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1313
-
1314
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1315
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1316
-
1317
-		// Entity listing customization (wp-admin/edit.php)
1318
-		// Add custom columns.
1319
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1320
-		// no explicit entity as it prevents handling of other post types.
1321
-		$this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1322
-		// Add 4W selection.
1323
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1324
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1325
-		$this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1326
-		$this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1327
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1328
-
1329
-		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1330
-		// entities.
1331
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1332
-
1333
-		// Filter imported post meta.
1334
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1335
-
1336
-		// Notify the import service when an import starts and ends.
1337
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1338
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1339
-
1340
-		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1341
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1342
-
1343
-		// Hook the menu to the Download Your Data page.
1344
-		$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1345
-		$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1346
-		$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1347
-
1348
-		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1349
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1350
-
1351
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1352
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1353
-
1354
-		// Hook the AJAX wl_validate_key action to the Key Validation service.
1355
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1356
-
1357
-		// Hook the `admin_init` function to the Admin Setup.
1358
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1359
-
1360
-		// Hook the admin_init to the settings page.
1361
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1362
-
1363
-		// Hook the menu creation on the general wordlift menu creation.
1364
-		$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1365
-		if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) {
1366
-			// Add the functionality only if a flag is set in wp-config.php .
1367
-			$this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 );
1368
-		}
1369
-
1370
-		// Hook key update.
1371
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1372
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1373
-
1374
-		// Add additional action links to the WordLift plugin in the plugins page.
1375
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1376
-
1377
-		// Hook the AJAX `wl_publisher` action name.
1378
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1379
-
1380
-		// Hook row actions for the entity type list admin.
1381
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1382
-
1383
-		/** Ajax actions. */
1384
-		$this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1385
-
1386
-		// Hook capabilities manipulation to allow access to entity type admin
1387
-		// page  on WordPress versions before 4.7.
1388
-		global $wp_version;
1389
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1390
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1391
-		}
1392
-
1393
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1394
-
1395
-		/** Adapters. */
1396
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1397
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' );
1398
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' );
1399
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' );
1400
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' );
1401
-		$this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1402
-
1403
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1404
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1405
-
1406
-		// Handle the autocomplete request.
1407
-		add_action( 'wp_ajax_wl_autocomplete', array(
1408
-			$this->autocomplete_adapter,
1409
-			'wl_autocomplete',
1410
-		) );
1411
-		add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1412
-			$this->autocomplete_adapter,
1413
-			'wl_autocomplete',
1414
-		) );
1415
-
1416
-		// Hooks to restrict multisite super admin from manipulating entity types.
1417
-		if ( is_multisite() ) {
1418
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1419
-		}
1420
-
1421
-	}
1422
-
1423
-	/**
1424
-	 * Register all of the hooks related to the public-facing functionality
1425
-	 * of the plugin.
1426
-	 *
1427
-	 * @since    1.0.0
1428
-	 * @access   private
1429
-	 */
1430
-	private function define_public_hooks() {
1431
-
1432
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1433
-
1434
-		// Register the entity post type.
1435
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1436
-
1437
-		// Bind the link generation and handling hooks to the entity link service.
1438
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1439
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1440
-		$this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 );
1441
-		$this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 );
1442
-
1443
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1444
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1445
-
1446
-		// Hook the content filter service to add entity links.
1447
-		if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1448
-			$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1449
-		}
1450
-
1451
-		// Hook the AJAX wl_timeline action to the Timeline service.
1452
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1453
-
1454
-		// Hook the ShareThis service.
1455
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1456
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1457
-
1458
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1459
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1460
-
1461
-		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1462
-		// in order to tweak WP's `WP_Query` to include entities in queries related
1463
-		// to categories.
1464
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1465
-
1466
-		/*
1214
+        // create an instance of the entity type list admin page controller.
1215
+        $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1216
+
1217
+        // create an instance of the entity type etting admin page controller.
1218
+        $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1219
+
1220
+        /** Widgets */
1221
+        $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1222
+
1223
+        /* WordPress Admin. */
1224
+        $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1225
+        $this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1226
+
1227
+        // Create an instance of the install wizard.
1228
+        $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1229
+
1230
+        $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1231
+
1232
+        // User Profile.
1233
+        new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1234
+
1235
+        $this->entity_page_service = new Wordlift_Entity_Page_Service();
1236
+
1237
+        // Load the debug service if WP is in debug mode.
1238
+        if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1239
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1240
+            new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1241
+        }
1242
+
1243
+        // Remote Image Service.
1244
+        new Wordlift_Remote_Image_Service();
1245
+    }
1246
+
1247
+    /**
1248
+     * Define the locale for this plugin for internationalization.
1249
+     *
1250
+     * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1251
+     * with WordPress.
1252
+     *
1253
+     * @since    1.0.0
1254
+     * @access   private
1255
+     */
1256
+    private function set_locale() {
1257
+
1258
+        $plugin_i18n = new Wordlift_i18n();
1259
+        $plugin_i18n->set_domain( $this->get_plugin_name() );
1260
+
1261
+        $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1262
+
1263
+    }
1264
+
1265
+    /**
1266
+     * Register all of the hooks related to the admin area functionality
1267
+     * of the plugin.
1268
+     *
1269
+     * @since    1.0.0
1270
+     * @access   private
1271
+     */
1272
+    private function define_admin_hooks() {
1273
+
1274
+        $plugin_admin = new Wordlift_Admin(
1275
+            $this->get_plugin_name(),
1276
+            $this->get_version(),
1277
+            $this->configuration_service,
1278
+            $this->notice_service,
1279
+            $this->user_service
1280
+        );
1281
+
1282
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1283
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1284
+
1285
+        // Hook the init action to the Topic Taxonomy service.
1286
+        $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1287
+
1288
+        // Hook the deleted_post_meta action to the Thumbnail service.
1289
+        $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1290
+
1291
+        // Hook the added_post_meta action to the Thumbnail service.
1292
+        $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1293
+
1294
+        // Hook the updated_post_meta action to the Thumbnail service.
1295
+        $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1296
+
1297
+        // Hook the AJAX wl_timeline action to the Timeline service.
1298
+        $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1299
+
1300
+        // Register custom allowed redirect hosts.
1301
+        $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1302
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1303
+        $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1304
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1305
+        $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1306
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1307
+        $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1308
+
1309
+        // Hook save_post to the entity service to update custom fields (such as alternate labels).
1310
+        // We have a priority of 9 because we want to be executed before data is sent to Redlink.
1311
+        $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1312
+        $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1313
+
1314
+        $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1315
+        $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1316
+
1317
+        // Entity listing customization (wp-admin/edit.php)
1318
+        // Add custom columns.
1319
+        $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1320
+        // no explicit entity as it prevents handling of other post types.
1321
+        $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1322
+        // Add 4W selection.
1323
+        $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1324
+        $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1325
+        $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1326
+        $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1327
+        $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1328
+
1329
+        // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1330
+        // entities.
1331
+        $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1332
+
1333
+        // Filter imported post meta.
1334
+        $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1335
+
1336
+        // Notify the import service when an import starts and ends.
1337
+        $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1338
+        $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1339
+
1340
+        // Hook the AJAX wl_rebuild action to the Rebuild Service.
1341
+        $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1342
+
1343
+        // Hook the menu to the Download Your Data page.
1344
+        $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1345
+        $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1346
+        $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1347
+
1348
+        // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1349
+        $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1350
+
1351
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1352
+        $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1353
+
1354
+        // Hook the AJAX wl_validate_key action to the Key Validation service.
1355
+        $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1356
+
1357
+        // Hook the `admin_init` function to the Admin Setup.
1358
+        $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1359
+
1360
+        // Hook the admin_init to the settings page.
1361
+        $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1362
+
1363
+        // Hook the menu creation on the general wordlift menu creation.
1364
+        $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1365
+        if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) {
1366
+            // Add the functionality only if a flag is set in wp-config.php .
1367
+            $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 );
1368
+        }
1369
+
1370
+        // Hook key update.
1371
+        $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1372
+        $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1373
+
1374
+        // Add additional action links to the WordLift plugin in the plugins page.
1375
+        $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1376
+
1377
+        // Hook the AJAX `wl_publisher` action name.
1378
+        $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1379
+
1380
+        // Hook row actions for the entity type list admin.
1381
+        $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1382
+
1383
+        /** Ajax actions. */
1384
+        $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1385
+
1386
+        // Hook capabilities manipulation to allow access to entity type admin
1387
+        // page  on WordPress versions before 4.7.
1388
+        global $wp_version;
1389
+        if ( version_compare( $wp_version, '4.7', '<' ) ) {
1390
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1391
+        }
1392
+
1393
+        $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1394
+
1395
+        /** Adapters. */
1396
+        $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1397
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' );
1398
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' );
1399
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' );
1400
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' );
1401
+        $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1402
+
1403
+        $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1404
+        $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1405
+
1406
+        // Handle the autocomplete request.
1407
+        add_action( 'wp_ajax_wl_autocomplete', array(
1408
+            $this->autocomplete_adapter,
1409
+            'wl_autocomplete',
1410
+        ) );
1411
+        add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1412
+            $this->autocomplete_adapter,
1413
+            'wl_autocomplete',
1414
+        ) );
1415
+
1416
+        // Hooks to restrict multisite super admin from manipulating entity types.
1417
+        if ( is_multisite() ) {
1418
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1419
+        }
1420
+
1421
+    }
1422
+
1423
+    /**
1424
+     * Register all of the hooks related to the public-facing functionality
1425
+     * of the plugin.
1426
+     *
1427
+     * @since    1.0.0
1428
+     * @access   private
1429
+     */
1430
+    private function define_public_hooks() {
1431
+
1432
+        $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1433
+
1434
+        // Register the entity post type.
1435
+        $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1436
+
1437
+        // Bind the link generation and handling hooks to the entity link service.
1438
+        $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1439
+        $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1440
+        $this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 );
1441
+        $this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 );
1442
+
1443
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1444
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1445
+
1446
+        // Hook the content filter service to add entity links.
1447
+        if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1448
+            $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1449
+        }
1450
+
1451
+        // Hook the AJAX wl_timeline action to the Timeline service.
1452
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1453
+
1454
+        // Hook the ShareThis service.
1455
+        $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1456
+        $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1457
+
1458
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1459
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1460
+
1461
+        // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1462
+        // in order to tweak WP's `WP_Query` to include entities in queries related
1463
+        // to categories.
1464
+        $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1465
+
1466
+        /*
1467 1467
 		 * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service`
1468 1468
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1469 1469
 		 * order of start time.
1470 1470
 		 */
1471
-		$this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1472
-
1473
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1474
-
1475
-		// This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1476
-		$this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1477
-
1478
-	}
1479
-
1480
-	/**
1481
-	 * Run the loader to execute all of the hooks with WordPress.
1482
-	 *
1483
-	 * @since    1.0.0
1484
-	 */
1485
-	public function run() {
1486
-		$this->loader->run();
1487
-	}
1488
-
1489
-	/**
1490
-	 * The name of the plugin used to uniquely identify it within the context of
1491
-	 * WordPress and to define internationalization functionality.
1492
-	 *
1493
-	 * @since     1.0.0
1494
-	 * @return    string    The name of the plugin.
1495
-	 */
1496
-	public function get_plugin_name() {
1497
-		return $this->plugin_name;
1498
-	}
1499
-
1500
-	/**
1501
-	 * The reference to the class that orchestrates the hooks with the plugin.
1502
-	 *
1503
-	 * @since     1.0.0
1504
-	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1505
-	 */
1506
-	public function get_loader() {
1507
-		return $this->loader;
1508
-	}
1509
-
1510
-	/**
1511
-	 * Retrieve the version number of the plugin.
1512
-	 *
1513
-	 * @since     1.0.0
1514
-	 * @return    string    The version number of the plugin.
1515
-	 */
1516
-	public function get_version() {
1517
-		return $this->version;
1518
-	}
1471
+        $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1472
+
1473
+        $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1474
+
1475
+        // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1476
+        $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1477
+
1478
+    }
1479
+
1480
+    /**
1481
+     * Run the loader to execute all of the hooks with WordPress.
1482
+     *
1483
+     * @since    1.0.0
1484
+     */
1485
+    public function run() {
1486
+        $this->loader->run();
1487
+    }
1488
+
1489
+    /**
1490
+     * The name of the plugin used to uniquely identify it within the context of
1491
+     * WordPress and to define internationalization functionality.
1492
+     *
1493
+     * @since     1.0.0
1494
+     * @return    string    The name of the plugin.
1495
+     */
1496
+    public function get_plugin_name() {
1497
+        return $this->plugin_name;
1498
+    }
1499
+
1500
+    /**
1501
+     * The reference to the class that orchestrates the hooks with the plugin.
1502
+     *
1503
+     * @since     1.0.0
1504
+     * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1505
+     */
1506
+    public function get_loader() {
1507
+        return $this->loader;
1508
+    }
1509
+
1510
+    /**
1511
+     * Retrieve the version number of the plugin.
1512
+     *
1513
+     * @since     1.0.0
1514
+     * @return    string    The version number of the plugin.
1515
+     */
1516
+    public function get_version() {
1517
+        return $this->version;
1518
+    }
1519 1519
 
1520 1520
 }
Please login to merge, or discard this patch.
Spacing   +262 added lines, -262 removed lines patch added patch discarded remove patch
@@ -717,348 +717,348 @@  discard block
 block discarded – undo
717 717
 		 * The class responsible for orchestrating the actions and filters of the
718 718
 		 * core plugin.
719 719
 		 */
720
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
720
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php';
721 721
 
722 722
 		/**
723 723
 		 * The class responsible for defining internationalization functionality
724 724
 		 * of the plugin.
725 725
 		 */
726
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
726
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php';
727 727
 
728 728
 		/**
729 729
 		 * WordLift's supported languages.
730 730
 		 */
731
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
731
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-languages.php';
732 732
 
733 733
 		/**
734 734
 		 * Provide support functions to sanitize data.
735 735
 		 */
736
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
736
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php';
737 737
 
738 738
 		/** Services. */
739
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
740
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
741
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
742
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
743
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
744
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
745
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
746
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
747
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
739
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php';
740
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-http-api.php';
741
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php';
742
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php';
743
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-type-service.php';
744
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php';
745
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php';
746
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-linked-data-service.php';
747
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-service.php';
748 748
 
749 749
 		/**
750 750
 		 * The Query builder.
751 751
 		 */
752
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
752
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php';
753 753
 
754 754
 		/**
755 755
 		 * The Schema service.
756 756
 		 */
757
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
757
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php';
758 758
 
759 759
 		/**
760 760
 		 * The schema:url property service.
761 761
 		 */
762
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
763
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
762
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php';
763
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php';
764 764
 
765 765
 		/**
766 766
 		 * The UI service.
767 767
 		 */
768
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
768
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php';
769 769
 
770 770
 		/**
771 771
 		 * The Thumbnail service.
772 772
 		 */
773
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
773
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php';
774 774
 
775 775
 		/**
776 776
 		 * The Entity Types Taxonomy service.
777 777
 		 */
778
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
778
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-types-taxonomy-service.php';
779 779
 
780 780
 		/**
781 781
 		 * The Entity service.
782 782
 		 */
783
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
784
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
783
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-uri-service.php';
784
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php';
785 785
 
786 786
 		// Add the entity rating service.
787
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
787
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rating-service.php';
788 788
 
789 789
 		/**
790 790
 		 * The User service.
791 791
 		 */
792
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
792
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php';
793 793
 
794 794
 		/**
795 795
 		 * The Timeline service.
796 796
 		 */
797
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
797
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php';
798 798
 
799 799
 		/**
800 800
 		 * The Topic Taxonomy service.
801 801
 		 */
802
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
802
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php';
803 803
 
804 804
 		/**
805 805
 		 * The SPARQL service.
806 806
 		 */
807
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
807
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sparql-service.php';
808 808
 
809 809
 		/**
810 810
 		 * The WordLift import service.
811 811
 		 */
812
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
812
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-import-service.php';
813 813
 
814 814
 		/**
815 815
 		 * The WordLift URI service.
816 816
 		 */
817
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
817
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php';
818 818
 
819
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php';
819
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-listable.php';
820 820
 
821
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
821
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-factory.php';
822 822
 
823
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
823
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-service.php';
824 824
 
825 825
 		/**
826 826
 		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
827 827
 		 */
828
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php';
828
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rebuild-service.php';
829 829
 
830
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
830
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/properties/class-wordlift-property-getter-factory.php';
831 831
 
832
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
832
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-attachment-service.php';
833 833
 
834 834
 		/**
835 835
 		 * Load the converters.
836 836
 		 */
837
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
838
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
839
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
840
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
841
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
842
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
837
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/intf-wordlift-post-converter.php';
838
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
839
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-postid-to-jsonld-converter.php';
840
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-to-jsonld-converter.php';
841
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-to-jsonld-converter.php';
842
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-website-converter.php';
843 843
 
844 844
 		/**
845 845
 		 * Load cache-related files.
846 846
 		 */
847
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
847
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/cache/require.php';
848 848
 
849 849
 		/**
850 850
 		 * Load the content filter.
851 851
 		 */
852
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
852
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-content-filter-service.php';
853 853
 
854 854
 		/*
855 855
 		 * Load the excerpt helper.
856 856
 		 */
857
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
857
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-excerpt-helper.php';
858 858
 
859 859
 		/**
860 860
 		 * Load the JSON-LD service to publish entities using JSON-LD.s
861 861
 		 *
862 862
 		 * @since 3.8.0
863 863
 		 */
864
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
864
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-service.php';
865 865
 
866 866
 		// The Publisher Service and the AJAX adapter.
867
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
868
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
867
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-service.php';
868
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-ajax-adapter.php';
869 869
 
870
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
870
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-adapter.php';
871 871
 
872 872
 		/**
873 873
 		 * Load the WordLift key validation service.
874 874
 		 */
875
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
875
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php';
876 876
 
877 877
 		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
878
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
878
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php';
879 879
 
880 880
 		// Load the `Wordlift_Entity_Page_Service` class definition.
881
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
882
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php';
883
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php';
884
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-rebuild-service.php';
881
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-page-service.php';
882
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php';
883
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-service.php';
884
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-rebuild-service.php';
885 885
 
886 886
 		/** Linked Data. */
887
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
888
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
889
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
890
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
891
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
892
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
893
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
894
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
895
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
896
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
897
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
898
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition.php';
899
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
887
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage.php';
888
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
889
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-property-storage.php';
890
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
891
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
892
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-author-storage.php';
893
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
894
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-image-storage.php';
895
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-related-storage.php';
896
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-url-property-storage.php';
897
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage-factory.php';
898
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition.php';
899
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
900 900
 
901 901
 		/** Services. */
902
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
902
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-google-analytics-export-service.php';
903 903
 
904 904
 		/** Adapters. */
905
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
906
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
907
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
908
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
909
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php';
910
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-rebuild-adapter.php';
905
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php';
906
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-newrelic-adapter.php';
907
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-ajax-adapter.php';
908
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-adapter.php';
909
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php';
910
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-rebuild-adapter.php';
911 911
 
912 912
 		/** Async Tasks. */
913
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
914
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
915
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
916
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
913
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-async-task.php';
914
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
915
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
916
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
917 917
 
918 918
 		/** Async Tasks. */
919
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php';
920
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
919
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-service.php';
920
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-adapter.php';
921 921
 
922
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
922
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-remote-image-service.php';
923 923
 
924 924
 		/**
925 925
 		 * The class responsible for defining all actions that occur in the admin area.
926 926
 		 */
927
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
927
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php';
928 928
 
929 929
 		/**
930 930
 		 * The class to customize the entity list admin page.
931 931
 		 */
932
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
932
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php';
933 933
 
934 934
 		/**
935 935
 		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
936 936
 		 */
937
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
937
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php';
938 938
 
939 939
 		/**
940 940
 		 * The Notice service.
941 941
 		 */
942
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
942
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php';
943 943
 
944 944
 		/**
945 945
 		 * The PrimaShop adapter.
946 946
 		 */
947
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
947
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php';
948 948
 
949 949
 		/**
950 950
 		 * The WordLift Dashboard service.
951 951
 		 */
952
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
952
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php';
953 953
 
954 954
 		/**
955 955
 		 * The admin 'Install wizard' page.
956 956
 		 */
957
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
957
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php';
958 958
 
959 959
 		/**
960 960
 		 * The WordLift entity type list admin page controller.
961 961
 		 */
962
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
962
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
963 963
 
964 964
 		/**
965 965
 		 * The WordLift entity type settings admin page controller.
966 966
 		 */
967
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
967
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php';
968 968
 
969 969
 		/**
970 970
 		 * The admin 'Download Your Data' page.
971 971
 		 */
972
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
972
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php';
973 973
 
974 974
 		/**
975 975
 		 * The admin 'WordLift Settings' page.
976 976
 		 */
977
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
978
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
979
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
980
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
981
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
982
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
983
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
984
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
985
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
986
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
987
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php';
988
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
977
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/intf-wordlift-admin-element.php';
978
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-input-element.php';
979
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-input-radio-element.php';
980
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-select2-element.php';
981
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-language-select-element.php';
982
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-tabs-element.php';
983
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-author-element.php';
984
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-publisher-element.php';
985
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php';
986
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php';
987
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-batch-analysis-page.php';
988
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php';
989 989
 
990 990
 		/** Admin Pages */
991
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
992
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
993
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
994
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
991
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php';
992
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-user-profile-page.php';
993
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-status-page.php';
994
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-admin-service.php';
995 995
 
996 996
 		/**
997 997
 		 * The class responsible for defining all actions that occur in the public-facing
998 998
 		 * side of the site.
999 999
 		 */
1000
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1000
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php';
1001 1001
 
1002 1002
 		/**
1003 1003
 		 * The shortcode abstract class.
1004 1004
 		 */
1005
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1005
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php';
1006 1006
 
1007 1007
 		/**
1008 1008
 		 * The Timeline shortcode.
1009 1009
 		 */
1010
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1010
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php';
1011 1011
 
1012 1012
 		/**
1013 1013
 		 * The Navigator shortcode.
1014 1014
 		 */
1015
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1015
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php';
1016 1016
 
1017 1017
 		/**
1018 1018
 		 * The chord shortcode.
1019 1019
 		 */
1020
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1020
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php';
1021 1021
 
1022 1022
 		/**
1023 1023
 		 * The geomap shortcode.
1024 1024
 		 */
1025
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1025
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php';
1026 1026
 
1027 1027
 		/**
1028 1028
 		 * The entity cloud shortcode.
1029 1029
 		 */
1030
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1030
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php';
1031 1031
 
1032 1032
 		/**
1033 1033
 		 * The entity glossary shortcode.
1034 1034
 		 */
1035
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1036
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1035
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-alphabet-service.php';
1036
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-vocabulary-shortcode.php';
1037 1037
 
1038 1038
 		/**
1039 1039
 		 * The ShareThis service.
1040 1040
 		 */
1041
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1041
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php';
1042 1042
 
1043 1043
 		/**
1044 1044
 		 * The SEO service.
1045 1045
 		 */
1046
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1046
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php';
1047 1047
 
1048 1048
 		/**
1049 1049
 		 * The AMP service.
1050 1050
 		 */
1051
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1051
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-amp-service.php';
1052 1052
 
1053 1053
 		/** Widgets */
1054
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1055
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1054
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php';
1055
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php';
1056 1056
 
1057 1057
 		$this->loader = new Wordlift_Loader();
1058 1058
 
1059 1059
 		// Instantiate a global logger.
1060 1060
 		global $wl_logger;
1061
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1061
+		$wl_logger = Wordlift_Log_Service::get_logger('WordLift');
1062 1062
 
1063 1063
 		// Load the `wl-api` end-point.
1064 1064
 		new Wordlift_Http_Api();
@@ -1068,10 +1068,10 @@  discard block
 block discarded – undo
1068 1068
 		$this->configuration_service = new Wordlift_Configuration_Service();
1069 1069
 
1070 1070
 		// Create an entity type service instance. It'll be later bound to the init action.
1071
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1071
+		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path());
1072 1072
 
1073 1073
 		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1074
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1074
+		$this->entity_link_service = new Wordlift_Entity_Link_Service($this->entity_post_type_service, $this->configuration_service->get_entity_base_path());
1075 1075
 
1076 1076
 		// Create an instance of the UI service.
1077 1077
 		$this->ui_service = new Wordlift_UI_Service();
@@ -1080,34 +1080,34 @@  discard block
 block discarded – undo
1080 1080
 		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
1081 1081
 
1082 1082
 		$this->sparql_service        = new Wordlift_Sparql_Service();
1083
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1083
+		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service($this->sparql_service);
1084 1084
 		$this->notice_service        = new Wordlift_Notice_Service();
1085 1085
 		$this->relation_service      = new Wordlift_Relation_Service();
1086 1086
 
1087
-		$entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1088
-		$this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' );
1089
-		$this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1090
-		$this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1087
+		$entity_uri_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'entity_uri/');
1088
+		$this->file_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'converter/');
1089
+		$this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service($this->configuration_service, $entity_uri_cache_service);
1090
+		$this->entity_service     = new Wordlift_Entity_Service($this->ui_service, $this->relation_service, $this->entity_uri_service);
1091 1091
 		$this->user_service       = new Wordlift_User_Service();
1092 1092
 
1093 1093
 		// Instantiate the JSON-LD service.
1094
-		$property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1094
+		$property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service);
1095 1095
 
1096 1096
 		/** Linked Data. */
1097
-		$this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1098
-		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1097
+		$this->storage_factory   = new Wordlift_Storage_Factory($this->entity_service, $this->user_service, $property_getter);
1098
+		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory($this->entity_service);
1099 1099
 
1100
-		$this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1100
+		$this->schema_service = new Wordlift_Schema_Service($this->storage_factory, $this->rendition_factory, $this->configuration_service);
1101 1101
 
1102 1102
 		// Create a new instance of the Redirect service.
1103
-		$this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_service );
1104
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1105
-		$this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service );
1103
+		$this->redirect_service    = new Wordlift_Redirect_Service($this->entity_service);
1104
+		$this->entity_type_service = new Wordlift_Entity_Type_Service($this->schema_service);
1105
+		$this->linked_data_service = new Wordlift_Linked_Data_Service($this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service);
1106 1106
 
1107 1107
 		// Create a new instance of the Timeline service and Timeline shortcode.
1108
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1108
+		$this->timeline_service = new Wordlift_Timeline_Service($this->entity_service, $this->entity_type_service);
1109 1109
 
1110
-		$this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service );
1110
+		$this->batch_analysis_service = new Wordlift_Batch_Analysis_Service($this, $this->configuration_service, $this->file_cache_service);
1111 1111
 
1112 1112
 		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1113 1113
 
@@ -1120,52 +1120,52 @@  discard block
 block discarded – undo
1120 1120
 		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1121 1121
 
1122 1122
 		// Create an import service instance to hook later to WP's import function.
1123
-		$this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() );
1123
+		$this->import_service = new Wordlift_Import_Service($this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri());
1124 1124
 
1125
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1125
+		$uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']);
1126 1126
 
1127 1127
 		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
1128
-		$this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service );
1128
+		$this->rebuild_service = new Wordlift_Rebuild_Service($this->sparql_service, $uri_service);
1129 1129
 
1130 1130
 		// Create the entity rating service.
1131
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1131
+		$this->rating_service = new Wordlift_Rating_Service($this->entity_service, $this->entity_type_service, $this->notice_service);
1132 1132
 
1133 1133
 		// Create entity list customization (wp-admin/edit.php).
1134
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1134
+		$this->entity_list_service = new Wordlift_Entity_List_Service($this->rating_service);
1135 1135
 
1136 1136
 		// Create a new instance of the Redirect service.
1137
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1137
+		$this->dashboard_service = new Wordlift_Dashboard_Service($this->rating_service, $this->entity_service);
1138 1138
 
1139 1139
 		// Create an instance of the Publisher Service and the AJAX Adapter.
1140 1140
 		$publisher_service      = new Wordlift_Publisher_Service();
1141
-		$this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service );
1142
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1141
+		$this->property_factory = new Wordlift_Property_Factory($schema_url_property_service);
1142
+		$this->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service);
1143 1143
 
1144 1144
 		$attachment_service = new Wordlift_Attachment_Service();
1145 1145
 
1146 1146
 		// Instantiate the JSON-LD service.
1147
-		$property_getter                         = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1148
-		$this->entity_post_to_jsonld_converter   = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter );
1149
-		$this->post_to_jsonld_converter          = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1150
-		$this->postid_to_jsonld_converter        = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter );
1151
-		$this->jsonld_website_converter          = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1152
-		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service );
1153
-		$this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1147
+		$property_getter                         = Wordlift_Property_Getter_Factory::create($this->entity_service);
1148
+		$this->entity_post_to_jsonld_converter   = new Wordlift_Entity_Post_To_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter);
1149
+		$this->post_to_jsonld_converter          = new Wordlift_Post_To_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service);
1150
+		$this->postid_to_jsonld_converter        = new Wordlift_Postid_To_Jsonld_Converter($this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter);
1151
+		$this->jsonld_website_converter          = new Wordlift_Website_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service);
1152
+		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter($this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service);
1153
+		$this->jsonld_service                    = new Wordlift_Jsonld_Service($this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter);
1154 1154
 
1155 1155
 
1156
-		$this->key_validation_service   = new Wordlift_Key_Validation_Service( $this->configuration_service );
1157
-		$this->content_filter_service   = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1158
-		$this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1159
-		$this->sample_data_service      = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1160
-		$this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1156
+		$this->key_validation_service   = new Wordlift_Key_Validation_Service($this->configuration_service);
1157
+		$this->content_filter_service   = new Wordlift_Content_Filter_Service($this->entity_service, $this->configuration_service, $this->entity_uri_service);
1158
+		$this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service($this->content_filter_service, $this->entity_service);
1159
+		$this->sample_data_service      = new Wordlift_Sample_Data_Service($this->entity_type_service, $this->configuration_service, $this->user_service);
1160
+		$this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter($this->sample_data_service);
1161 1161
 
1162 1162
 		// Initialize the shortcodes.
1163 1163
 		new Wordlift_Navigator_Shortcode();
1164 1164
 		new Wordlift_Chord_Shortcode();
1165 1165
 		new Wordlift_Geomap_Shortcode();
1166 1166
 		new Wordlift_Timeline_Shortcode();
1167
-		new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1168
-		new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1167
+		new Wordlift_Related_Entities_Cloud_Shortcode($this->relation_service);
1168
+		new Wordlift_Vocabulary_Shortcode($this->configuration_service);
1169 1169
 
1170 1170
 		// Initialize the SEO service.
1171 1171
 		new Wordlift_Seo_Service();
@@ -1177,11 +1177,11 @@  discard block
 block discarded – undo
1177 1177
 		$this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1178 1178
 
1179 1179
 		/** Adapters. */
1180
-		$this->entity_type_adapter      = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1181
-		$this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter( $publisher_service );
1182
-		$this->tinymce_adapter          = new Wordlift_Tinymce_Adapter( $this );
1183
-		$this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service );
1184
-		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1180
+		$this->entity_type_adapter      = new Wordlift_Entity_Type_Adapter($this->entity_type_service);
1181
+		$this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter($publisher_service);
1182
+		$this->tinymce_adapter          = new Wordlift_Tinymce_Adapter($this);
1183
+		$this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter($this->batch_analysis_service);
1184
+		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter($this->relation_rebuild_service);
1185 1185
 
1186 1186
 		/** Async Tasks. */
1187 1187
 		new Wordlift_Sparql_Query_Async_Task();
@@ -1189,8 +1189,8 @@  discard block
 block discarded – undo
1189 1189
 		new Wordlift_Batch_Analysis_Complete_Async_Task();
1190 1190
 
1191 1191
 		/** WL Autocomplete. */
1192
-		$this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service );
1193
-		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service );
1192
+		$this->autocomplete_service = new Wordlift_Autocomplete_Service($this->configuration_service);
1193
+		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter($this->autocomplete_service);
1194 1194
 
1195 1195
 		/** WordPress Admin UI. */
1196 1196
 
@@ -1200,15 +1200,15 @@  discard block
 block discarded – undo
1200 1200
 		$this->select2_element         = new Wordlift_Admin_Select2_Element();
1201 1201
 		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1202 1202
 		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
1203
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element );
1204
-		$this->author_element          = new Wordlift_Admin_Author_Element( $publisher_service, $this->select2_element );
1203
+		$this->publisher_element       = new Wordlift_Admin_Publisher_Element($this->configuration_service, $publisher_service, $tabs_element, $this->select2_element);
1204
+		$this->author_element          = new Wordlift_Admin_Author_Element($publisher_service, $this->select2_element);
1205 1205
 
1206
-		$this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element );
1207
-		$this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service );
1208
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1206
+		$this->settings_page             = new Wordlift_Admin_Settings_Page($this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element);
1207
+		$this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page($this->batch_analysis_service);
1208
+		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($this->settings_page);
1209 1209
 
1210 1210
 		// Pages.
1211
-		new Wordlift_Admin_Post_Edit_Page( $this );
1211
+		new Wordlift_Admin_Post_Edit_Page($this);
1212 1212
 		new Wordlift_Entity_Type_Admin_Service();
1213 1213
 
1214 1214
 		// create an instance of the entity type list admin page controller.
@@ -1221,23 +1221,23 @@  discard block
 block discarded – undo
1221 1221
 		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1222 1222
 
1223 1223
 		/* WordPress Admin. */
1224
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1225
-		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1224
+		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service);
1225
+		$this->status_page             = new Wordlift_Admin_Status_Page($this->entity_service, $this->sparql_service);
1226 1226
 
1227 1227
 		// Create an instance of the install wizard.
1228
-		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1228
+		$this->admin_setup = new Wordlift_Admin_Setup($this->configuration_service, $this->key_validation_service, $this->entity_service);
1229 1229
 
1230
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1230
+		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($this->entity_post_type_service);
1231 1231
 
1232 1232
 		// User Profile.
1233
-		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1233
+		new Wordlift_Admin_User_Profile_Page($this->author_element, $this->user_service);
1234 1234
 
1235 1235
 		$this->entity_page_service = new Wordlift_Entity_Page_Service();
1236 1236
 
1237 1237
 		// Load the debug service if WP is in debug mode.
1238
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1239
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1240
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1238
+		if (defined('WP_DEBUG') && WP_DEBUG) {
1239
+			require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php';
1240
+			new Wordlift_Debug_Service($this->entity_service, $uri_service);
1241 1241
 		}
1242 1242
 
1243 1243
 		// Remote Image Service.
@@ -1256,9 +1256,9 @@  discard block
 block discarded – undo
1256 1256
 	private function set_locale() {
1257 1257
 
1258 1258
 		$plugin_i18n = new Wordlift_i18n();
1259
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1259
+		$plugin_i18n->set_domain($this->get_plugin_name());
1260 1260
 
1261
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1261
+		$this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain');
1262 1262
 
1263 1263
 	}
1264 1264
 
@@ -1279,143 +1279,143 @@  discard block
 block discarded – undo
1279 1279
 			$this->user_service
1280 1280
 		);
1281 1281
 
1282
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1283
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1282
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles');
1283
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts');
1284 1284
 
1285 1285
 		// Hook the init action to the Topic Taxonomy service.
1286
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1286
+		$this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0);
1287 1287
 
1288 1288
 		// Hook the deleted_post_meta action to the Thumbnail service.
1289
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1289
+		$this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4);
1290 1290
 
1291 1291
 		// Hook the added_post_meta action to the Thumbnail service.
1292
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1292
+		$this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4);
1293 1293
 
1294 1294
 		// Hook the updated_post_meta action to the Thumbnail service.
1295
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1295
+		$this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4);
1296 1296
 
1297 1297
 		// Hook the AJAX wl_timeline action to the Timeline service.
1298
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1298
+		$this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline');
1299 1299
 
1300 1300
 		// Register custom allowed redirect hosts.
1301
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1301
+		$this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts');
1302 1302
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1303
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1303
+		$this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect');
1304 1304
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1305
-		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1305
+		$this->loader->add_action('wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats');
1306 1306
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1307
-		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1307
+		$this->loader->add_action('wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets');
1308 1308
 
1309 1309
 		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1310 1310
 		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1311
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1312
-		$this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1311
+		$this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3);
1312
+		$this->loader->add_action('save_post', $this->rating_service, 'set_rating_for', 20, 1);
1313 1313
 
1314
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1315
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1314
+		$this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1);
1315
+		$this->loader->add_action('in_admin_header', $this->rating_service, 'in_admin_header');
1316 1316
 
1317 1317
 		// Entity listing customization (wp-admin/edit.php)
1318 1318
 		// Add custom columns.
1319
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1319
+		$this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns');
1320 1320
 		// no explicit entity as it prevents handling of other post types.
1321
-		$this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1321
+		$this->loader->add_filter('manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2);
1322 1322
 		// Add 4W selection.
1323
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1324
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1325
-		$this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1326
-		$this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1327
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1323
+		$this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope');
1324
+		$this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope');
1325
+		$this->loader->add_action('pre_get_posts', $this->entity_list_service, 'pre_get_posts');
1326
+		$this->loader->add_action('load-edit.php', $this->entity_list_service, 'load_edit');
1327
+		$this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args');
1328 1328
 
1329 1329
 		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1330 1330
 		// entities.
1331
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1331
+		$this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2);
1332 1332
 
1333 1333
 		// Filter imported post meta.
1334
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1334
+		$this->loader->add_filter('wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3);
1335 1335
 
1336 1336
 		// Notify the import service when an import starts and ends.
1337
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1338
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1337
+		$this->loader->add_action('import_start', $this->import_service, 'import_start', 10, 0);
1338
+		$this->loader->add_action('import_end', $this->import_service, 'import_end', 10, 0);
1339 1339
 
1340 1340
 		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1341
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1341
+		$this->loader->add_action('wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild');
1342 1342
 
1343 1343
 		// Hook the menu to the Download Your Data page.
1344
-		$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1345
-		$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1346
-		$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1344
+		$this->loader->add_action('admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0);
1345
+		$this->loader->add_action('admin_menu', $this->status_page, 'admin_menu', 100, 0);
1346
+		$this->loader->add_action('admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0);
1347 1347
 
1348 1348
 		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1349
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1349
+		$this->loader->add_action('wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10);
1350 1350
 
1351 1351
 		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1352
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1352
+		$this->loader->add_action('wp_ajax_wl_jsonld', $this->jsonld_service, 'get');
1353 1353
 
1354 1354
 		// Hook the AJAX wl_validate_key action to the Key Validation service.
1355
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1355
+		$this->loader->add_action('wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key');
1356 1356
 
1357 1357
 		// Hook the `admin_init` function to the Admin Setup.
1358
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1358
+		$this->loader->add_action('admin_init', $this->admin_setup, 'admin_init');
1359 1359
 
1360 1360
 		// Hook the admin_init to the settings page.
1361
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1361
+		$this->loader->add_action('admin_init', $this->settings_page, 'admin_init');
1362 1362
 
1363 1363
 		// Hook the menu creation on the general wordlift menu creation.
1364
-		$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1365
-		if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) {
1364
+		$this->loader->add_action('wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2);
1365
+		if (defined('WORDLIFT_BATCH') && WORDLIFT_BATCH) {
1366 1366
 			// Add the functionality only if a flag is set in wp-config.php .
1367
-			$this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 );
1367
+			$this->loader->add_action('wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2);
1368 1368
 		}
1369 1369
 
1370 1370
 		// Hook key update.
1371
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1372
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1371
+		$this->loader->add_action('pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2);
1372
+		$this->loader->add_action('update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2);
1373 1373
 
1374 1374
 		// Add additional action links to the WordLift plugin in the plugins page.
1375
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1375
+		$this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1);
1376 1376
 
1377 1377
 		// Hook the AJAX `wl_publisher` action name.
1378
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1378
+		$this->loader->add_action('wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher');
1379 1379
 
1380 1380
 		// Hook row actions for the entity type list admin.
1381
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1381
+		$this->loader->add_filter('wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2);
1382 1382
 
1383 1383
 		/** Ajax actions. */
1384
-		$this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1384
+		$this->loader->add_action('wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export');
1385 1385
 
1386 1386
 		// Hook capabilities manipulation to allow access to entity type admin
1387 1387
 		// page  on WordPress versions before 4.7.
1388 1388
 		global $wp_version;
1389
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1390
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1389
+		if (version_compare($wp_version, '4.7', '<')) {
1390
+			$this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4);
1391 1391
 		}
1392 1392
 
1393
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1393
+		$this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1);
1394 1394
 
1395 1395
 		/** Adapters. */
1396
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1397
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' );
1398
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' );
1399
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' );
1400
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' );
1401
-		$this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1396
+		$this->loader->add_filter('mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1);
1397
+		$this->loader->add_action('wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit');
1398
+		$this->loader->add_action('wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts');
1399
+		$this->loader->add_action('wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel');
1400
+		$this->loader->add_action('wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning');
1401
+		$this->loader->add_action('wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all');
1402 1402
 
1403
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1404
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1403
+		$this->loader->add_action('wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create');
1404
+		$this->loader->add_action('wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete');
1405 1405
 
1406 1406
 		// Handle the autocomplete request.
1407
-		add_action( 'wp_ajax_wl_autocomplete', array(
1407
+		add_action('wp_ajax_wl_autocomplete', array(
1408 1408
 			$this->autocomplete_adapter,
1409 1409
 			'wl_autocomplete',
1410
-		) );
1411
-		add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1410
+		));
1411
+		add_action('wp_ajax_nopriv_wl_autocomplete', array(
1412 1412
 			$this->autocomplete_adapter,
1413 1413
 			'wl_autocomplete',
1414
-		) );
1414
+		));
1415 1415
 
1416 1416
 		// Hooks to restrict multisite super admin from manipulating entity types.
1417
-		if ( is_multisite() ) {
1418
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1417
+		if (is_multisite()) {
1418
+			$this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4);
1419 1419
 		}
1420 1420
 
1421 1421
 	}
@@ -1429,51 +1429,51 @@  discard block
 block discarded – undo
1429 1429
 	 */
1430 1430
 	private function define_public_hooks() {
1431 1431
 
1432
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1432
+		$plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version());
1433 1433
 
1434 1434
 		// Register the entity post type.
1435
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1435
+		$this->loader->add_action('init', $this->entity_post_type_service, 'register');
1436 1436
 
1437 1437
 		// Bind the link generation and handling hooks to the entity link service.
1438
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1439
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1440
-		$this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 );
1441
-		$this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 );
1438
+		$this->loader->add_filter('post_type_link', $this->entity_link_service, 'post_type_link', 10, 4);
1439
+		$this->loader->add_action('pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1);
1440
+		$this->loader->add_filter('wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3);
1441
+		$this->loader->add_filter('wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4);
1442 1442
 
1443
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1444
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1443
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles');
1444
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts');
1445 1445
 
1446 1446
 		// Hook the content filter service to add entity links.
1447
-		if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1448
-			$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1447
+		if ( ! defined('WL_DISABLE_CONTENT_FILTER') || ! WL_DISABLE_CONTENT_FILTER) {
1448
+			$this->loader->add_filter('the_content', $this->content_filter_service, 'the_content');
1449 1449
 		}
1450 1450
 
1451 1451
 		// Hook the AJAX wl_timeline action to the Timeline service.
1452
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1452
+		$this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline');
1453 1453
 
1454 1454
 		// Hook the ShareThis service.
1455
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1456
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1455
+		$this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99);
1456
+		$this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99);
1457 1457
 
1458 1458
 		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1459
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1459
+		$this->loader->add_action('wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get');
1460 1460
 
1461 1461
 		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1462 1462
 		// in order to tweak WP's `WP_Query` to include entities in queries related
1463 1463
 		// to categories.
1464
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1464
+		$this->loader->add_action('pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1);
1465 1465
 
1466 1466
 		/*
1467 1467
 		 * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service`
1468 1468
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1469 1469
 		 * order of start time.
1470 1470
 		 */
1471
-		$this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1471
+		$this->loader->add_action('pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1);
1472 1472
 
1473
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1473
+		$this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1);
1474 1474
 
1475 1475
 		// This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1476
-		$this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1476
+		$this->loader->add_action('save_post', $this->entity_type_adapter, 'save_post', 9, 3);
1477 1477
 
1478 1478
 	}
1479 1479
 
Please login to merge, or discard this patch.
src/includes/class-wordlift-remote-image-service.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
 	 *
91 91
 	 * @since 3.18.0
92 92
 	 *
93
-	 * @return string|bool The file extension on success and
93
+	 * @return string|false The file extension on success and
94 94
 	 * false on fail or if the content type is not supported.
95 95
 	 */
96 96
 	private static function get_extension_from_content_type( $content_type ) {
Please login to merge, or discard this patch.
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -8,134 +8,134 @@
 block discarded – undo
8 8
  */
9 9
 class Wordlift_Remote_Image_Service {
10 10
 
11
-	/**
12
-	 * Save the image with the specified URL locally.
13
-	 *
14
-	 * @param string $url The image remote URL.
15
-	 *
16
-	 * @since 3.18.0
17
-	 *
18
-	 * @return array|false An array with information about the saved image (*path*: the local path to the image, *url*: the local
19
-	 * url, *content_type*: the image content type) or false on error.
20
-	 */
21
-	public static function save_from_url( $url ) {
22
-
23
-		// Load `WP_Filesystem`.
24
-		WP_Filesystem();
25
-		global $wp_filesystem;
26
-
27
-		// Parse the url.
28
-		$parts = wp_parse_url( $url );
29
-
30
-		// Get the bare filename (filename w/o the extension).
31
-		$basename = pathinfo( $parts['path'], PATHINFO_FILENAME );
32
-
33
-		// Get the base dir.
34
-		$wp_upload_dir = wp_upload_dir();
35
-
36
-		// Set the upload directory and URL.
37
-		$upload_dir = $wp_upload_dir['basedir'] . '/wl' . $wp_upload_dir['subdir'];
38
-		$upload_url = $wp_upload_dir['baseurl'] . '/wl' . $wp_upload_dir['subdir'];
39
-
40
-		// Get the full path to the local filename.
41
-		$image_full_path = $upload_dir . '/' . $basename;
42
-		$image_full_url  = $upload_url . '/' . $basename;
43
-
44
-		// Create custom directory and bail on failure.
45
-		if ( ! wp_mkdir_p( $upload_dir ) ) {
46
-			wl_write_log( "save_image_from_url : failed creating upload dir $upload_dir \n" );
47
-
48
-			return false;
49
-		};
50
-
51
-		$response = self::get_response( $url );
52
-
53
-		// Bail if the response is not set.
54
-		if ( false === $response ) {
55
-			wl_write_log( "save_image_from_url : failed to fetch the response from: $url \n" );
56
-
57
-			return false;
58
-		}
59
-
60
-		// Get the content type of response.
61
-		$content_type = wp_remote_retrieve_header( $response, 'content-type' );
62
-
63
-		// Get the file extension.
64
-		$extension = self::get_extension_from_content_type( $content_type );
65
-
66
-		// Bail if the content type is not supported.
67
-		if ( empty( $extension ) ) {
68
-			return false;
69
-		}
70
-
71
-		// Complete the local filename.
72
-		$image_full_path .= $extension;
73
-		$image_full_url  .= $extension;
74
-
75
-		// Store the data locally.
76
-		$wp_filesystem->put_contents( $image_full_path, wp_remote_retrieve_body( $response ) );
77
-
78
-		// Return the path.
79
-		return array(
80
-			'path'         => $image_full_path,
81
-			'url'          => $image_full_url,
82
-			'content_type' => $content_type,
83
-		);
84
-	}
85
-
86
-	/**
87
-	 * Returns the file extension using the content type.
88
-	 *
89
-	 * @param string $content_type File content type.
90
-	 *
91
-	 * @since 3.18.0
92
-	 *
93
-	 * @return string|bool The file extension on success and
94
-	 * false on fail or if the content type is not supported.
95
-	 */
96
-	private static function get_extension_from_content_type( $content_type ) {
97
-
98
-		// Return the extension if match.
99
-		switch ( $content_type ) {
100
-			case 'image/jpeg':
101
-			case 'image/jpg':
102
-				return '.jpg';
103
-			case 'image/gif':
104
-				return '.gif';
105
-			case 'image/png':
106
-				return '.png';
107
-		}
108
-
109
-		// Otherwise return false.
110
-		return false;
111
-	}
112
-
113
-	/**
114
-	 * Retrieve the response from url and sets the response.
115
-	 *
116
-	 * @param string $url The url to retrieve.
117
-	 *
118
-	 * @since 3.18.0
119
-	 *
120
-	 * @return false|array True on success and false on failure.
121
-	 */
122
-	private static function get_response( $url ) {
123
-		// Request the remote file.
124
-		$response = wp_remote_get( $url );
125
-
126
-		// Bail out if the response is not ok.
127
-		if (
128
-			is_wp_error( $response )
129
-			|| 200 !== (int) $response['response']['code']
130
-			|| ! isset( $response['body'] )
131
-		) {
132
-			wl_write_log( "save_image_from_url : error fetching image $url \n" );
133
-
134
-			return false;
135
-		}
136
-
137
-		// Set the response.
138
-		return $response;
139
-	}
11
+    /**
12
+     * Save the image with the specified URL locally.
13
+     *
14
+     * @param string $url The image remote URL.
15
+     *
16
+     * @since 3.18.0
17
+     *
18
+     * @return array|false An array with information about the saved image (*path*: the local path to the image, *url*: the local
19
+     * url, *content_type*: the image content type) or false on error.
20
+     */
21
+    public static function save_from_url( $url ) {
22
+
23
+        // Load `WP_Filesystem`.
24
+        WP_Filesystem();
25
+        global $wp_filesystem;
26
+
27
+        // Parse the url.
28
+        $parts = wp_parse_url( $url );
29
+
30
+        // Get the bare filename (filename w/o the extension).
31
+        $basename = pathinfo( $parts['path'], PATHINFO_FILENAME );
32
+
33
+        // Get the base dir.
34
+        $wp_upload_dir = wp_upload_dir();
35
+
36
+        // Set the upload directory and URL.
37
+        $upload_dir = $wp_upload_dir['basedir'] . '/wl' . $wp_upload_dir['subdir'];
38
+        $upload_url = $wp_upload_dir['baseurl'] . '/wl' . $wp_upload_dir['subdir'];
39
+
40
+        // Get the full path to the local filename.
41
+        $image_full_path = $upload_dir . '/' . $basename;
42
+        $image_full_url  = $upload_url . '/' . $basename;
43
+
44
+        // Create custom directory and bail on failure.
45
+        if ( ! wp_mkdir_p( $upload_dir ) ) {
46
+            wl_write_log( "save_image_from_url : failed creating upload dir $upload_dir \n" );
47
+
48
+            return false;
49
+        };
50
+
51
+        $response = self::get_response( $url );
52
+
53
+        // Bail if the response is not set.
54
+        if ( false === $response ) {
55
+            wl_write_log( "save_image_from_url : failed to fetch the response from: $url \n" );
56
+
57
+            return false;
58
+        }
59
+
60
+        // Get the content type of response.
61
+        $content_type = wp_remote_retrieve_header( $response, 'content-type' );
62
+
63
+        // Get the file extension.
64
+        $extension = self::get_extension_from_content_type( $content_type );
65
+
66
+        // Bail if the content type is not supported.
67
+        if ( empty( $extension ) ) {
68
+            return false;
69
+        }
70
+
71
+        // Complete the local filename.
72
+        $image_full_path .= $extension;
73
+        $image_full_url  .= $extension;
74
+
75
+        // Store the data locally.
76
+        $wp_filesystem->put_contents( $image_full_path, wp_remote_retrieve_body( $response ) );
77
+
78
+        // Return the path.
79
+        return array(
80
+            'path'         => $image_full_path,
81
+            'url'          => $image_full_url,
82
+            'content_type' => $content_type,
83
+        );
84
+    }
85
+
86
+    /**
87
+     * Returns the file extension using the content type.
88
+     *
89
+     * @param string $content_type File content type.
90
+     *
91
+     * @since 3.18.0
92
+     *
93
+     * @return string|bool The file extension on success and
94
+     * false on fail or if the content type is not supported.
95
+     */
96
+    private static function get_extension_from_content_type( $content_type ) {
97
+
98
+        // Return the extension if match.
99
+        switch ( $content_type ) {
100
+            case 'image/jpeg':
101
+            case 'image/jpg':
102
+                return '.jpg';
103
+            case 'image/gif':
104
+                return '.gif';
105
+            case 'image/png':
106
+                return '.png';
107
+        }
108
+
109
+        // Otherwise return false.
110
+        return false;
111
+    }
112
+
113
+    /**
114
+     * Retrieve the response from url and sets the response.
115
+     *
116
+     * @param string $url The url to retrieve.
117
+     *
118
+     * @since 3.18.0
119
+     *
120
+     * @return false|array True on success and false on failure.
121
+     */
122
+    private static function get_response( $url ) {
123
+        // Request the remote file.
124
+        $response = wp_remote_get( $url );
125
+
126
+        // Bail out if the response is not ok.
127
+        if (
128
+            is_wp_error( $response )
129
+            || 200 !== (int) $response['response']['code']
130
+            || ! isset( $response['body'] )
131
+        ) {
132
+            wl_write_log( "save_image_from_url : error fetching image $url \n" );
133
+
134
+            return false;
135
+        }
136
+
137
+        // Set the response.
138
+        return $response;
139
+    }
140 140
 
141 141
 }
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -18,53 +18,53 @@  discard block
 block discarded – undo
18 18
 	 * @return array|false An array with information about the saved image (*path*: the local path to the image, *url*: the local
19 19
 	 * url, *content_type*: the image content type) or false on error.
20 20
 	 */
21
-	public static function save_from_url( $url ) {
21
+	public static function save_from_url($url) {
22 22
 
23 23
 		// Load `WP_Filesystem`.
24 24
 		WP_Filesystem();
25 25
 		global $wp_filesystem;
26 26
 
27 27
 		// Parse the url.
28
-		$parts = wp_parse_url( $url );
28
+		$parts = wp_parse_url($url);
29 29
 
30 30
 		// Get the bare filename (filename w/o the extension).
31
-		$basename = pathinfo( $parts['path'], PATHINFO_FILENAME );
31
+		$basename = pathinfo($parts['path'], PATHINFO_FILENAME);
32 32
 
33 33
 		// Get the base dir.
34 34
 		$wp_upload_dir = wp_upload_dir();
35 35
 
36 36
 		// Set the upload directory and URL.
37
-		$upload_dir = $wp_upload_dir['basedir'] . '/wl' . $wp_upload_dir['subdir'];
38
-		$upload_url = $wp_upload_dir['baseurl'] . '/wl' . $wp_upload_dir['subdir'];
37
+		$upload_dir = $wp_upload_dir['basedir'].'/wl'.$wp_upload_dir['subdir'];
38
+		$upload_url = $wp_upload_dir['baseurl'].'/wl'.$wp_upload_dir['subdir'];
39 39
 
40 40
 		// Get the full path to the local filename.
41
-		$image_full_path = $upload_dir . '/' . $basename;
42
-		$image_full_url  = $upload_url . '/' . $basename;
41
+		$image_full_path = $upload_dir.'/'.$basename;
42
+		$image_full_url  = $upload_url.'/'.$basename;
43 43
 
44 44
 		// Create custom directory and bail on failure.
45
-		if ( ! wp_mkdir_p( $upload_dir ) ) {
46
-			wl_write_log( "save_image_from_url : failed creating upload dir $upload_dir \n" );
45
+		if ( ! wp_mkdir_p($upload_dir)) {
46
+			wl_write_log("save_image_from_url : failed creating upload dir $upload_dir \n");
47 47
 
48 48
 			return false;
49 49
 		};
50 50
 
51
-		$response = self::get_response( $url );
51
+		$response = self::get_response($url);
52 52
 
53 53
 		// Bail if the response is not set.
54
-		if ( false === $response ) {
55
-			wl_write_log( "save_image_from_url : failed to fetch the response from: $url \n" );
54
+		if (false === $response) {
55
+			wl_write_log("save_image_from_url : failed to fetch the response from: $url \n");
56 56
 
57 57
 			return false;
58 58
 		}
59 59
 
60 60
 		// Get the content type of response.
61
-		$content_type = wp_remote_retrieve_header( $response, 'content-type' );
61
+		$content_type = wp_remote_retrieve_header($response, 'content-type');
62 62
 
63 63
 		// Get the file extension.
64
-		$extension = self::get_extension_from_content_type( $content_type );
64
+		$extension = self::get_extension_from_content_type($content_type);
65 65
 
66 66
 		// Bail if the content type is not supported.
67
-		if ( empty( $extension ) ) {
67
+		if (empty($extension)) {
68 68
 			return false;
69 69
 		}
70 70
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 		$image_full_url  .= $extension;
74 74
 
75 75
 		// Store the data locally.
76
-		$wp_filesystem->put_contents( $image_full_path, wp_remote_retrieve_body( $response ) );
76
+		$wp_filesystem->put_contents($image_full_path, wp_remote_retrieve_body($response));
77 77
 
78 78
 		// Return the path.
79 79
 		return array(
@@ -93,10 +93,10 @@  discard block
 block discarded – undo
93 93
 	 * @return string|bool The file extension on success and
94 94
 	 * false on fail or if the content type is not supported.
95 95
 	 */
96
-	private static function get_extension_from_content_type( $content_type ) {
96
+	private static function get_extension_from_content_type($content_type) {
97 97
 
98 98
 		// Return the extension if match.
99
-		switch ( $content_type ) {
99
+		switch ($content_type) {
100 100
 			case 'image/jpeg':
101 101
 			case 'image/jpg':
102 102
 				return '.jpg';
@@ -119,17 +119,17 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return false|array True on success and false on failure.
121 121
 	 */
122
-	private static function get_response( $url ) {
122
+	private static function get_response($url) {
123 123
 		// Request the remote file.
124
-		$response = wp_remote_get( $url );
124
+		$response = wp_remote_get($url);
125 125
 
126 126
 		// Bail out if the response is not ok.
127 127
 		if (
128
-			is_wp_error( $response )
128
+			is_wp_error($response)
129 129
 			|| 200 !== (int) $response['response']['code']
130
-			|| ! isset( $response['body'] )
130
+			|| ! isset($response['body'])
131 131
 		) {
132
-			wl_write_log( "save_image_from_url : error fetching image $url \n" );
132
+			wl_write_log("save_image_from_url : error fetching image $url \n");
133 133
 
134 134
 			return false;
135 135
 		}
Please login to merge, or discard this patch.
src/modules/linked_data/wordlift_linked_data.php 2 patches
Indentation   +351 added lines, -351 removed lines patch added patch discarded remove patch
@@ -16,38 +16,38 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function wl_linked_data_save_post( $post_id ) {
18 18
 
19
-	$log = Wordlift_Log_Service::get_logger( 'wl_linked_data_save_post' );
19
+    $log = Wordlift_Log_Service::get_logger( 'wl_linked_data_save_post' );
20 20
 
21
-	$log->trace( "Saving post $post_id to Linked Data..." );
21
+    $log->trace( "Saving post $post_id to Linked Data..." );
22 22
 
23
-	// If it's not numeric exit from here.
24
-	if ( ! is_numeric( $post_id ) || is_numeric( wp_is_post_revision( $post_id ) ) ) {
25
-		$log->debug( "Skipping $post_id, because id is not numeric or is a post revision." );
23
+    // If it's not numeric exit from here.
24
+    if ( ! is_numeric( $post_id ) || is_numeric( wp_is_post_revision( $post_id ) ) ) {
25
+        $log->debug( "Skipping $post_id, because id is not numeric or is a post revision." );
26 26
 
27
-		return;
28
-	}
27
+        return;
28
+    }
29 29
 
30
-	// Get the post type and check whether it supports the editor.
31
-	//
32
-	// See https://github.com/insideout10/wordlift-plugin/issues/659.
33
-	$post_type           = get_post_type( $post_id );
34
-	$is_editor_supported = post_type_supports( $post_type, 'editor' );
30
+    // Get the post type and check whether it supports the editor.
31
+    //
32
+    // See https://github.com/insideout10/wordlift-plugin/issues/659.
33
+    $post_type           = get_post_type( $post_id );
34
+    $is_editor_supported = post_type_supports( $post_type, 'editor' );
35 35
 
36
-	// Bail out if it's not an entity.
37
-	if ( ! $is_editor_supported ) {
38
-		$log->debug( "Skipping $post_id, because $post_type doesn't support the editor (content)." );
36
+    // Bail out if it's not an entity.
37
+    if ( ! $is_editor_supported ) {
38
+        $log->debug( "Skipping $post_id, because $post_type doesn't support the editor (content)." );
39 39
 
40
-		return;
41
-	}
40
+        return;
41
+    }
42 42
 
43
-	// Unhook this function so it doesn't loop infinitely.
44
-	remove_action( 'save_post', 'wl_linked_data_save_post' );
43
+    // Unhook this function so it doesn't loop infinitely.
44
+    remove_action( 'save_post', 'wl_linked_data_save_post' );
45 45
 
46
-	// raise the *wl_linked_data_save_post* event.
47
-	do_action( 'wl_linked_data_save_post', $post_id );
46
+    // raise the *wl_linked_data_save_post* event.
47
+    do_action( 'wl_linked_data_save_post', $post_id );
48 48
 
49
-	// Re-hook this function.
50
-	add_action( 'save_post', 'wl_linked_data_save_post' );
49
+    // Re-hook this function.
50
+    add_action( 'save_post', 'wl_linked_data_save_post' );
51 51
 }
52 52
 
53 53
 add_action( 'save_post', 'wl_linked_data_save_post' );
@@ -61,156 +61,156 @@  discard block
 block discarded – undo
61 61
  */
62 62
 function wl_linked_data_save_post_and_related_entities( $post_id ) {
63 63
 
64
-	$log = Wordlift_Log_Service::get_logger( 'wl_linked_data_save_post_and_related_entities' );
64
+    $log = Wordlift_Log_Service::get_logger( 'wl_linked_data_save_post_and_related_entities' );
65 65
 
66
-	$log->trace( "Saving $post_id to Linked Data along with related entities..." );
66
+    $log->trace( "Saving $post_id to Linked Data along with related entities..." );
67 67
 
68
-	// Ignore auto-saves
69
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
70
-		$log->trace( 'Doing autosave, skipping...' );
68
+    // Ignore auto-saves
69
+    if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
70
+        $log->trace( 'Doing autosave, skipping...' );
71 71
 
72
-		return;
73
-	}
72
+        return;
73
+    }
74 74
 
75
-	// get the current post.
76
-	$post = get_post( $post_id );
75
+    // get the current post.
76
+    $post = get_post( $post_id );
77 77
 
78
-	remove_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' );
78
+    remove_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' );
79 79
 
80
-	// wl_write_log( "[ post id :: $post_id ][ autosave :: false ][ post type :: $post->post_type ]" );
80
+    // wl_write_log( "[ post id :: $post_id ][ autosave :: false ][ post type :: $post->post_type ]" );
81 81
 
82
-	// Get the entity service instance.
83
-	$entity_service = Wordlift_Entity_Service::get_instance();
82
+    // Get the entity service instance.
83
+    $entity_service = Wordlift_Entity_Service::get_instance();
84 84
 
85
-	// Store mapping between tmp new entities uris and real new entities uri
86
-	$entities_uri_mapping = array();
85
+    // Store mapping between tmp new entities uris and real new entities uri
86
+    $entities_uri_mapping = array();
87 87
 
88
-	// Save the entities coming with POST data.
89
-	if ( isset( $_POST['wl_entities'] ) && isset( $_POST['wl_boxes'] ) ) {
88
+    // Save the entities coming with POST data.
89
+    if ( isset( $_POST['wl_entities'] ) && isset( $_POST['wl_boxes'] ) ) {
90 90
 
91
-		wl_write_log( "[ post id :: $post_id ][ POST(wl_entities) :: " );
92
-		wl_write_log( json_encode( $_POST['wl_entities'] ) );
93
-		wl_write_log( "]" );
94
-		wl_write_log( "[ post id :: $post_id ][ POST(wl_boxes) :: " );
95
-		wl_write_log( json_encode( $_POST['wl_boxes'], true ) );
96
-		wl_write_log( "]" );
91
+        wl_write_log( "[ post id :: $post_id ][ POST(wl_entities) :: " );
92
+        wl_write_log( json_encode( $_POST['wl_entities'] ) );
93
+        wl_write_log( "]" );
94
+        wl_write_log( "[ post id :: $post_id ][ POST(wl_boxes) :: " );
95
+        wl_write_log( json_encode( $_POST['wl_boxes'], true ) );
96
+        wl_write_log( "]" );
97 97
 
98
-		$entities_via_post = $_POST['wl_entities'];
99
-		$boxes_via_post    = $_POST['wl_boxes'];
98
+        $entities_via_post = $_POST['wl_entities'];
99
+        $boxes_via_post    = $_POST['wl_boxes'];
100 100
 
101
-		foreach ( $entities_via_post as $entity_uri => $entity ) {
101
+        foreach ( $entities_via_post as $entity_uri => $entity ) {
102 102
 
103
-			// Only if the current entity is created from scratch let's avoid to
104
-			// create more than one entity with same label & entity type.
105
-			$entity_type = ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) ?
106
-				$entity['main_type'] : null;
103
+            // Only if the current entity is created from scratch let's avoid to
104
+            // create more than one entity with same label & entity type.
105
+            $entity_type = ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) ?
106
+                $entity['main_type'] : null;
107 107
 
108
-			// Look if current entity uri matches an internal existing entity, meaning:
109
-			// 1. when $entity_uri is an internal uri
110
-			// 2. when $entity_uri is an external uri used as sameAs of an internal entity
111
-			$ie = $entity_service->get_entity_post_by_uri( $entity_uri );
108
+            // Look if current entity uri matches an internal existing entity, meaning:
109
+            // 1. when $entity_uri is an internal uri
110
+            // 2. when $entity_uri is an external uri used as sameAs of an internal entity
111
+            $ie = $entity_service->get_entity_post_by_uri( $entity_uri );
112 112
 
113
-			// Detect the uri depending if is an existing or a new entity
114
-			$uri = ( null === $ie ) ?
115
-				Wordlift_Uri_Service::get_instance()->build_uri(
116
-					$entity['label'],
117
-					Wordlift_Entity_Service::TYPE_NAME,
118
-					$entity_type
119
-				) : wl_get_entity_uri( $ie->ID );
113
+            // Detect the uri depending if is an existing or a new entity
114
+            $uri = ( null === $ie ) ?
115
+                Wordlift_Uri_Service::get_instance()->build_uri(
116
+                    $entity['label'],
117
+                    Wordlift_Entity_Service::TYPE_NAME,
118
+                    $entity_type
119
+                ) : wl_get_entity_uri( $ie->ID );
120 120
 
121
-			wl_write_log( "Map $entity_uri on $uri" );
122
-			$entities_uri_mapping[ $entity_uri ] = $uri;
121
+            wl_write_log( "Map $entity_uri on $uri" );
122
+            $entities_uri_mapping[ $entity_uri ] = $uri;
123 123
 
124
-			// Local entities have a tmp uri with 'local-entity-' prefix
125
-			// These uris need to be rewritten here and replaced in the content
126
-			if ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) {
127
-				// Override the entity obj
128
-				$entity['uri'] = $uri;
129
-			}
124
+            // Local entities have a tmp uri with 'local-entity-' prefix
125
+            // These uris need to be rewritten here and replaced in the content
126
+            if ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) {
127
+                // Override the entity obj
128
+                $entity['uri'] = $uri;
129
+            }
130 130
 
131
-			// Update entity data with related post
132
-			$entity['related_post_id'] = $post_id;
131
+            // Update entity data with related post
132
+            $entity['related_post_id'] = $post_id;
133 133
 
134
-			// Save the entity if is a new entity
135
-			if ( null === $ie ) {
136
-				wl_save_entity( $entity );
137
-			}
134
+            // Save the entity if is a new entity
135
+            if ( null === $ie ) {
136
+                wl_save_entity( $entity );
137
+            }
138 138
 
139
-		}
139
+        }
140 140
 
141
-	}
141
+    }
142 142
 
143
-	// Replace tmp uris in content post if needed
144
-	$updated_post_content = $post->post_content;
143
+    // Replace tmp uris in content post if needed
144
+    $updated_post_content = $post->post_content;
145 145
 
146
-	// Update the post content if we found mappings of new entities.
147
-	if ( ! empty( $entities_uri_mapping ) ) {
148
-		// Save each entity and store the post id.
149
-		foreach ( $entities_uri_mapping as $tmp_uri => $uri ) {
150
-			$updated_post_content = str_replace( $tmp_uri, $uri, $updated_post_content );
151
-		}
146
+    // Update the post content if we found mappings of new entities.
147
+    if ( ! empty( $entities_uri_mapping ) ) {
148
+        // Save each entity and store the post id.
149
+        foreach ( $entities_uri_mapping as $tmp_uri => $uri ) {
150
+            $updated_post_content = str_replace( $tmp_uri, $uri, $updated_post_content );
151
+        }
152 152
 
153
-		// Update the post content.
154
-		wp_update_post( array(
155
-			'ID'           => $post->ID,
156
-			'post_content' => $updated_post_content,
157
-		) );
158
-	}
153
+        // Update the post content.
154
+        wp_update_post( array(
155
+            'ID'           => $post->ID,
156
+            'post_content' => $updated_post_content,
157
+        ) );
158
+    }
159 159
 
160
-	// Extract related/referenced entities from text.
161
-	$disambiguated_entities = wl_linked_data_content_get_embedded_entities( $updated_post_content );
160
+    // Extract related/referenced entities from text.
161
+    $disambiguated_entities = wl_linked_data_content_get_embedded_entities( $updated_post_content );
162 162
 
163
-	// Reset previously saved instances.
164
-	wl_core_delete_relation_instances( $post_id );
163
+    // Reset previously saved instances.
164
+    wl_core_delete_relation_instances( $post_id );
165 165
 
166
-	// Save relation instances
167
-	foreach ( array_unique( $disambiguated_entities ) as $referenced_entity_id ) {
166
+    // Save relation instances
167
+    foreach ( array_unique( $disambiguated_entities ) as $referenced_entity_id ) {
168 168
 
169
-		wl_core_add_relation_instance(
170
-			$post_id,
171
-			$entity_service->get_classification_scope_for( $referenced_entity_id ),
172
-			$referenced_entity_id
173
-		);
169
+        wl_core_add_relation_instance(
170
+            $post_id,
171
+            $entity_service->get_classification_scope_for( $referenced_entity_id ),
172
+            $referenced_entity_id
173
+        );
174 174
 
175
-	}
175
+    }
176 176
 
177
-	if ( isset( $_POST['wl_entities'] ) ) {
178
-		// Save post metadata if available
179
-		$metadata_via_post = ( isset( $_POST['wl_metadata'] ) ) ?
180
-			$_POST['wl_metadata'] : array();
181
-
182
-		$fields = array(
183
-			Wordlift_Schema_Service::FIELD_LOCATION_CREATED,
184
-			Wordlift_Schema_Service::FIELD_TOPIC,
185
-		);
186
-
187
-		// Unlink topic taxonomy terms
188
-		Wordlift_Topic_Taxonomy_Service::get_instance()->unlink_topic_for( $post->ID );
189
-
190
-		foreach ( $fields as $field ) {
191
-
192
-			// Delete current values
193
-			delete_post_meta( $post->ID, $field );
194
-			// Retrieve the entity uri
195
-			$uri = ( isset( $metadata_via_post[ $field ] ) ) ?
196
-				stripslashes( $metadata_via_post[ $field ] ) : '';
197
-
198
-			$entity = $entity_service->get_entity_post_by_uri( $uri );
199
-
200
-			if ( $entity ) {
201
-				add_post_meta( $post->ID, $field, $entity->ID, true );
202
-				// Set also the topic taxonomy
203
-				if ( $field === Wordlift_Schema_Service::FIELD_TOPIC ) {
204
-					Wordlift_Topic_Taxonomy_Service::get_instance()->set_topic_for( $post->ID, $entity );
205
-				}
206
-			}
207
-		}
208
-	}
209
-
210
-	// Push the post to Redlink.
211
-	Wordlift_Linked_Data_Service::get_instance()->push( $post->ID );
212
-
213
-	add_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' );
177
+    if ( isset( $_POST['wl_entities'] ) ) {
178
+        // Save post metadata if available
179
+        $metadata_via_post = ( isset( $_POST['wl_metadata'] ) ) ?
180
+            $_POST['wl_metadata'] : array();
181
+
182
+        $fields = array(
183
+            Wordlift_Schema_Service::FIELD_LOCATION_CREATED,
184
+            Wordlift_Schema_Service::FIELD_TOPIC,
185
+        );
186
+
187
+        // Unlink topic taxonomy terms
188
+        Wordlift_Topic_Taxonomy_Service::get_instance()->unlink_topic_for( $post->ID );
189
+
190
+        foreach ( $fields as $field ) {
191
+
192
+            // Delete current values
193
+            delete_post_meta( $post->ID, $field );
194
+            // Retrieve the entity uri
195
+            $uri = ( isset( $metadata_via_post[ $field ] ) ) ?
196
+                stripslashes( $metadata_via_post[ $field ] ) : '';
197
+
198
+            $entity = $entity_service->get_entity_post_by_uri( $uri );
199
+
200
+            if ( $entity ) {
201
+                add_post_meta( $post->ID, $field, $entity->ID, true );
202
+                // Set also the topic taxonomy
203
+                if ( $field === Wordlift_Schema_Service::FIELD_TOPIC ) {
204
+                    Wordlift_Topic_Taxonomy_Service::get_instance()->set_topic_for( $post->ID, $entity );
205
+                }
206
+            }
207
+        }
208
+    }
209
+
210
+    // Push the post to Redlink.
211
+    Wordlift_Linked_Data_Service::get_instance()->push( $post->ID );
212
+
213
+    add_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' );
214 214
 }
215 215
 
216 216
 add_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' );
@@ -233,196 +233,196 @@  discard block
 block discarded – undo
233 233
  */
234 234
 function wl_save_entity( $entity_data ) {
235 235
 
236
-	$log = Wordlift_Log_Service::get_logger( 'wl_save_entity' );
237
-
238
-	$uri              = $entity_data['uri'];
239
-	$label            = $entity_data['label'];
240
-	$type_uri         = $entity_data['main_type'];
241
-	$entity_types     = isset( $entity_data['type'] ) ? $entity_data['type'] : array();
242
-	$description      = $entity_data['description'];
243
-	$images           = isset( $entity_data['image'] ) ? (array) $entity_data['image'] : array();
244
-	$same_as          = isset( $entity_data['sameas'] ) ? (array) $entity_data['sameas'] : array();
245
-	$related_post_id  = isset( $entity_data['related_post_id'] ) ? $entity_data['related_post_id'] : null;
246
-	$other_properties = isset( $entity_data['properties'] ) ? $entity_data['properties'] : array();
247
-
248
-	// Get the synonyms.
249
-	$synonyms = isset( $entity_data['synonym'] ) ? $entity_data['synonym'] : array();
250
-
251
-	// Check whether an entity already exists with the provided URI.
252
-	if ( null !== $post = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( $uri ) ) {
253
-		$log->debug( "Post already exists for URI $uri." );
254
-
255
-		return $post;
256
-	}
257
-
258
-	// Prepare properties of the new entity.
259
-	$params = array(
260
-		'post_status'  => ( is_numeric( $related_post_id ) ? get_post_status( $related_post_id ) : 'draft' ),
261
-		'post_type'    => Wordlift_Entity_Service::TYPE_NAME,
262
-		'post_title'   => $label,
263
-		'post_content' => $description,
264
-		'post_excerpt' => '',
265
-		// Ensure we're using a valid slug. We're not overwriting an existing
266
-		// entity with a post_name already set, since this call is made only for
267
-		// new entities.
268
-		//
269
-		// See https://github.com/insideout10/wordlift-plugin/issues/282
270
-		'post_name'    => sanitize_title( $label ),
271
-	);
272
-
273
-	// If Yoast is installed and active, we temporary remove the save_postdata hook which causes Yoast to "pass over"
274
-	// the local SEO form values to the created entity (https://github.com/insideout10/wordlift-plugin/issues/156)
275
-	// Same thing applies to SEO Ultimate (https://github.com/insideout10/wordlift-plugin/issues/148)
276
-	// This does NOT affect saving an entity from the entity admin page since this function is called when an entity
277
-	// is created when saving a post.
278
-	global $wpseo_metabox, $seo_ultimate;
279
-	if ( isset( $wpseo_metabox ) ) {
280
-		remove_action( 'wp_insert_post', array(
281
-			$wpseo_metabox,
282
-			'save_postdata',
283
-		) );
284
-	}
285
-
286
-	if ( isset( $seo_ultimate ) ) {
287
-		remove_action( 'save_post', array(
288
-			$seo_ultimate,
289
-			'save_postmeta_box',
290
-		) );
291
-	}
292
-
293
-	// The fact that we're calling here wp_insert_post is causing issues with plugins (and ourselves too) that hook to
294
-	// save_post in order to save additional inputs from the edit page. In order to avoid issues, we pop all the hooks
295
-	// to the save_post and restore them after we saved the entity.
296
-	// see https://github.com/insideout10/wordlift-plugin/issues/203
297
-	// see https://github.com/insideout10/wordlift-plugin/issues/156
298
-	// see https://github.com/insideout10/wordlift-plugin/issues/148
299
-	global $wp_filter;
300
-	$save_post_filters = is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] : $wp_filter['save_post']->callbacks;
301
-	is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] = array() : $wp_filter['save_post']->remove_all_filters();
302
-
303
-
304
-	$log->trace( 'Going to insert new post...' );
305
-
306
-	// create or update the post.
307
-	$post_id = wp_insert_post( $params, true );
308
-
309
-	// Setting the alternative labels for this entity.
310
-	Wordlift_Entity_Service::get_instance()
311
-						   ->set_alternative_labels( $post_id, $synonyms );
312
-
313
-	// Restore all the existing filters.
314
-	is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] = $save_post_filters : $wp_filter['save_post']->callbacks = $save_post_filters;
315
-
316
-	// If Yoast is installed and active, we restore the Yoast save_postdata hook (https://github.com/insideout10/wordlift-plugin/issues/156)
317
-	if ( isset( $wpseo_metabox ) ) {
318
-		add_action( 'wp_insert_post', array(
319
-			$wpseo_metabox,
320
-			'save_postdata',
321
-		) );
322
-	}
323
-
324
-	// If SEO Ultimate is installed, add back the hook we removed a few lines above.
325
-	if ( isset( $seo_ultimate ) ) {
326
-		add_action( 'save_post', array(
327
-			$seo_ultimate,
328
-			'save_postmeta_box',
329
-		), 10, 2 );
330
-	}
331
-
332
-	// TODO: handle errors.
333
-	if ( is_wp_error( $post_id ) ) {
334
-		$log->error( 'An error occurred: ' . $post_id->get_error_message() );
335
-
336
-		// inform an error occurred.
337
-		return null;
338
-	}
339
-
340
-	wl_set_entity_main_type( $post_id, $type_uri );
341
-
342
-	// Save the entity types.
343
-	wl_set_entity_rdf_types( $post_id, $entity_types );
344
-
345
-	// Get a dataset URI for the entity.
346
-	$wl_uri = wl_build_entity_uri( $post_id );
347
-
348
-	// Save the entity URI.
349
-	wl_set_entity_uri( $post_id, $wl_uri );
350
-
351
-	// Add the uri to the sameAs data if it's not a local URI.
352
-	if ( $wl_uri !== $uri ) {
353
-		array_push( $same_as, $uri );
354
-	}
355
-
356
-	$new_uri = wl_get_entity_uri( $post_id );
357
-
358
-	// Save the sameAs data for the entity.
359
-	wl_schema_set_value( $post_id, 'sameAs', $same_as );
360
-
361
-	// Save the other properties (latitude, langitude, startDate, endDate, etc.)
362
-	foreach ( $other_properties as $property_name => $property_value ) {
363
-		wl_schema_set_value( $post_id, $property_name, $property_value );
364
-	}
365
-
366
-	// Call hooks.
367
-	do_action( 'wl_save_entity', $post_id );
368
-
369
-	foreach ( $images as $image_remote_url ) {
370
-
371
-		// Check if image is already present in local DB
372
-		if ( strpos( $image_remote_url, site_url() ) !== false ) {
373
-			// Do nothing.
374
-			continue;
375
-		}
376
-
377
-		// Check if there is an existing attachment for this post ID and source URL.
378
-		$existing_image = wl_get_attachment_for_source_url( $post_id, $image_remote_url );
379
-
380
-		// Skip if an existing image is found.
381
-		if ( null !== $existing_image ) {
382
-			continue;
383
-		}
384
-
385
-		// Save the image and get the local path.
386
-		$image = Wordlift_Remote_Image_Service::save_from_url( $image_remote_url );
387
-
388
-		if ( false === $image ) {
389
-			continue;
390
-		}
236
+    $log = Wordlift_Log_Service::get_logger( 'wl_save_entity' );
237
+
238
+    $uri              = $entity_data['uri'];
239
+    $label            = $entity_data['label'];
240
+    $type_uri         = $entity_data['main_type'];
241
+    $entity_types     = isset( $entity_data['type'] ) ? $entity_data['type'] : array();
242
+    $description      = $entity_data['description'];
243
+    $images           = isset( $entity_data['image'] ) ? (array) $entity_data['image'] : array();
244
+    $same_as          = isset( $entity_data['sameas'] ) ? (array) $entity_data['sameas'] : array();
245
+    $related_post_id  = isset( $entity_data['related_post_id'] ) ? $entity_data['related_post_id'] : null;
246
+    $other_properties = isset( $entity_data['properties'] ) ? $entity_data['properties'] : array();
247
+
248
+    // Get the synonyms.
249
+    $synonyms = isset( $entity_data['synonym'] ) ? $entity_data['synonym'] : array();
250
+
251
+    // Check whether an entity already exists with the provided URI.
252
+    if ( null !== $post = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( $uri ) ) {
253
+        $log->debug( "Post already exists for URI $uri." );
254
+
255
+        return $post;
256
+    }
257
+
258
+    // Prepare properties of the new entity.
259
+    $params = array(
260
+        'post_status'  => ( is_numeric( $related_post_id ) ? get_post_status( $related_post_id ) : 'draft' ),
261
+        'post_type'    => Wordlift_Entity_Service::TYPE_NAME,
262
+        'post_title'   => $label,
263
+        'post_content' => $description,
264
+        'post_excerpt' => '',
265
+        // Ensure we're using a valid slug. We're not overwriting an existing
266
+        // entity with a post_name already set, since this call is made only for
267
+        // new entities.
268
+        //
269
+        // See https://github.com/insideout10/wordlift-plugin/issues/282
270
+        'post_name'    => sanitize_title( $label ),
271
+    );
272
+
273
+    // If Yoast is installed and active, we temporary remove the save_postdata hook which causes Yoast to "pass over"
274
+    // the local SEO form values to the created entity (https://github.com/insideout10/wordlift-plugin/issues/156)
275
+    // Same thing applies to SEO Ultimate (https://github.com/insideout10/wordlift-plugin/issues/148)
276
+    // This does NOT affect saving an entity from the entity admin page since this function is called when an entity
277
+    // is created when saving a post.
278
+    global $wpseo_metabox, $seo_ultimate;
279
+    if ( isset( $wpseo_metabox ) ) {
280
+        remove_action( 'wp_insert_post', array(
281
+            $wpseo_metabox,
282
+            'save_postdata',
283
+        ) );
284
+    }
285
+
286
+    if ( isset( $seo_ultimate ) ) {
287
+        remove_action( 'save_post', array(
288
+            $seo_ultimate,
289
+            'save_postmeta_box',
290
+        ) );
291
+    }
292
+
293
+    // The fact that we're calling here wp_insert_post is causing issues with plugins (and ourselves too) that hook to
294
+    // save_post in order to save additional inputs from the edit page. In order to avoid issues, we pop all the hooks
295
+    // to the save_post and restore them after we saved the entity.
296
+    // see https://github.com/insideout10/wordlift-plugin/issues/203
297
+    // see https://github.com/insideout10/wordlift-plugin/issues/156
298
+    // see https://github.com/insideout10/wordlift-plugin/issues/148
299
+    global $wp_filter;
300
+    $save_post_filters = is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] : $wp_filter['save_post']->callbacks;
301
+    is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] = array() : $wp_filter['save_post']->remove_all_filters();
302
+
303
+
304
+    $log->trace( 'Going to insert new post...' );
305
+
306
+    // create or update the post.
307
+    $post_id = wp_insert_post( $params, true );
308
+
309
+    // Setting the alternative labels for this entity.
310
+    Wordlift_Entity_Service::get_instance()
311
+                            ->set_alternative_labels( $post_id, $synonyms );
312
+
313
+    // Restore all the existing filters.
314
+    is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] = $save_post_filters : $wp_filter['save_post']->callbacks = $save_post_filters;
315
+
316
+    // If Yoast is installed and active, we restore the Yoast save_postdata hook (https://github.com/insideout10/wordlift-plugin/issues/156)
317
+    if ( isset( $wpseo_metabox ) ) {
318
+        add_action( 'wp_insert_post', array(
319
+            $wpseo_metabox,
320
+            'save_postdata',
321
+        ) );
322
+    }
323
+
324
+    // If SEO Ultimate is installed, add back the hook we removed a few lines above.
325
+    if ( isset( $seo_ultimate ) ) {
326
+        add_action( 'save_post', array(
327
+            $seo_ultimate,
328
+            'save_postmeta_box',
329
+        ), 10, 2 );
330
+    }
331
+
332
+    // TODO: handle errors.
333
+    if ( is_wp_error( $post_id ) ) {
334
+        $log->error( 'An error occurred: ' . $post_id->get_error_message() );
335
+
336
+        // inform an error occurred.
337
+        return null;
338
+    }
339
+
340
+    wl_set_entity_main_type( $post_id, $type_uri );
341
+
342
+    // Save the entity types.
343
+    wl_set_entity_rdf_types( $post_id, $entity_types );
344
+
345
+    // Get a dataset URI for the entity.
346
+    $wl_uri = wl_build_entity_uri( $post_id );
347
+
348
+    // Save the entity URI.
349
+    wl_set_entity_uri( $post_id, $wl_uri );
350
+
351
+    // Add the uri to the sameAs data if it's not a local URI.
352
+    if ( $wl_uri !== $uri ) {
353
+        array_push( $same_as, $uri );
354
+    }
355
+
356
+    $new_uri = wl_get_entity_uri( $post_id );
357
+
358
+    // Save the sameAs data for the entity.
359
+    wl_schema_set_value( $post_id, 'sameAs', $same_as );
360
+
361
+    // Save the other properties (latitude, langitude, startDate, endDate, etc.)
362
+    foreach ( $other_properties as $property_name => $property_value ) {
363
+        wl_schema_set_value( $post_id, $property_name, $property_value );
364
+    }
365
+
366
+    // Call hooks.
367
+    do_action( 'wl_save_entity', $post_id );
368
+
369
+    foreach ( $images as $image_remote_url ) {
370
+
371
+        // Check if image is already present in local DB
372
+        if ( strpos( $image_remote_url, site_url() ) !== false ) {
373
+            // Do nothing.
374
+            continue;
375
+        }
376
+
377
+        // Check if there is an existing attachment for this post ID and source URL.
378
+        $existing_image = wl_get_attachment_for_source_url( $post_id, $image_remote_url );
379
+
380
+        // Skip if an existing image is found.
381
+        if ( null !== $existing_image ) {
382
+            continue;
383
+        }
384
+
385
+        // Save the image and get the local path.
386
+        $image = Wordlift_Remote_Image_Service::save_from_url( $image_remote_url );
387
+
388
+        if ( false === $image ) {
389
+            continue;
390
+        }
391 391
 
392
-		// Get the local URL.
393
-		$filename     = $image['path'];
394
-		$url          = $image['url'];
395
-		$content_type = $image['content_type'];
392
+        // Get the local URL.
393
+        $filename     = $image['path'];
394
+        $url          = $image['url'];
395
+        $content_type = $image['content_type'];
396 396
 
397
-		$attachment = array(
398
-			'guid'           => $url,
399
-			// post_title, post_content (the value for this key should be the empty string), post_status and post_mime_type
400
-			'post_title'     => $label,
401
-			// Set the title to the post title.
402
-			'post_content'   => '',
403
-			'post_status'    => 'inherit',
404
-			'post_mime_type' => $content_type,
405
-		);
406
-
407
-		// Create the attachment in WordPress and generate the related metadata.
408
-		$attachment_id = wp_insert_attachment( $attachment, $filename, $post_id );
409
-
410
-		// Set the source URL for the image.
411
-		wl_set_source_url( $attachment_id, $image_remote_url );
397
+        $attachment = array(
398
+            'guid'           => $url,
399
+            // post_title, post_content (the value for this key should be the empty string), post_status and post_mime_type
400
+            'post_title'     => $label,
401
+            // Set the title to the post title.
402
+            'post_content'   => '',
403
+            'post_status'    => 'inherit',
404
+            'post_mime_type' => $content_type,
405
+        );
406
+
407
+        // Create the attachment in WordPress and generate the related metadata.
408
+        $attachment_id = wp_insert_attachment( $attachment, $filename, $post_id );
409
+
410
+        // Set the source URL for the image.
411
+        wl_set_source_url( $attachment_id, $image_remote_url );
412 412
 
413
-		$attachment_data = wp_generate_attachment_metadata( $attachment_id, $filename );
414
-		wp_update_attachment_metadata( $attachment_id, $attachment_data );
413
+        $attachment_data = wp_generate_attachment_metadata( $attachment_id, $filename );
414
+        wp_update_attachment_metadata( $attachment_id, $attachment_data );
415 415
 
416
-		// Set it as the featured image.
417
-		set_post_thumbnail( $post_id, $attachment_id );
418
-	}
416
+        // Set it as the featured image.
417
+        set_post_thumbnail( $post_id, $attachment_id );
418
+    }
419 419
 
420
-	// The entity is pushed to Redlink on save by the function hooked to save_post.
421
-	// save the entity in the triple store.
422
-	Wordlift_Linked_Data_Service::get_instance()->push( $post_id );
420
+    // The entity is pushed to Redlink on save by the function hooked to save_post.
421
+    // save the entity in the triple store.
422
+    Wordlift_Linked_Data_Service::get_instance()->push( $post_id );
423 423
 
424
-	// finally return the entity post.
425
-	return get_post( $post_id );
424
+    // finally return the entity post.
425
+    return get_post( $post_id );
426 426
 }
427 427
 
428 428
 /**
@@ -436,40 +436,40 @@  discard block
 block discarded – undo
436 436
  */
437 437
 function wl_linked_data_content_get_embedded_entities( $content ) {
438 438
 
439
-	// Remove quote escapes.
440
-	$content = str_replace( '\\"', '"', $content );
439
+    // Remove quote escapes.
440
+    $content = str_replace( '\\"', '"', $content );
441 441
 
442
-	// Match all itemid attributes.
443
-	$pattern = '/<\w+[^>]*\sitemid="([^"]+)"[^>]*>/im';
442
+    // Match all itemid attributes.
443
+    $pattern = '/<\w+[^>]*\sitemid="([^"]+)"[^>]*>/im';
444 444
 
445
-	//	wl_write_log( "Getting entities embedded into content [ pattern :: $pattern ]" );
445
+    //	wl_write_log( "Getting entities embedded into content [ pattern :: $pattern ]" );
446 446
 
447
-	// Remove the pattern while it is found (match nested annotations).
448
-	$matches = array();
447
+    // Remove the pattern while it is found (match nested annotations).
448
+    $matches = array();
449 449
 
450
-	// In case of errors, return an empty array.
451
-	if ( false === preg_match_all( $pattern, $content, $matches ) ) {
452
-		wl_write_log( "Found no entities embedded in content" );
450
+    // In case of errors, return an empty array.
451
+    if ( false === preg_match_all( $pattern, $content, $matches ) ) {
452
+        wl_write_log( "Found no entities embedded in content" );
453 453
 
454
-		return array();
455
-	}
454
+        return array();
455
+    }
456 456
 
457 457
 //    wl_write_log("wl_update_related_entities [ content :: $content ][ data :: " . var_export($data, true). " ][ matches :: " . var_export($matches, true) . " ]");
458 458
 
459
-	// Collect the entities.
460
-	$entities = array();
461
-	foreach ( $matches[1] as $uri ) {
462
-		$uri_d = html_entity_decode( $uri );
459
+    // Collect the entities.
460
+    $entities = array();
461
+    foreach ( $matches[1] as $uri ) {
462
+        $uri_d = html_entity_decode( $uri );
463 463
 
464
-		$entity = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( $uri_d );
464
+        $entity = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( $uri_d );
465 465
 
466
-		if ( null !== $entity ) {
467
-			array_push( $entities, $entity->ID );
468
-		}
469
-	}
466
+        if ( null !== $entity ) {
467
+            array_push( $entities, $entity->ID );
468
+        }
469
+    }
470 470
 
471
-	// $count = sizeof( $entities );
472
-	// wl_write_log( "Found $count entities embedded in content" );
471
+    // $count = sizeof( $entities );
472
+    // wl_write_log( "Found $count entities embedded in content" );
473 473
 
474
-	return $entities;
474
+    return $entities;
475 475
 }
Please login to merge, or discard this patch.
Spacing   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -14,15 +14,15 @@  discard block
 block discarded – undo
14 14
  *
15 15
  * @param int $post_id The post id.
16 16
  */
17
-function wl_linked_data_save_post( $post_id ) {
17
+function wl_linked_data_save_post($post_id) {
18 18
 
19
-	$log = Wordlift_Log_Service::get_logger( 'wl_linked_data_save_post' );
19
+	$log = Wordlift_Log_Service::get_logger('wl_linked_data_save_post');
20 20
 
21
-	$log->trace( "Saving post $post_id to Linked Data..." );
21
+	$log->trace("Saving post $post_id to Linked Data...");
22 22
 
23 23
 	// If it's not numeric exit from here.
24
-	if ( ! is_numeric( $post_id ) || is_numeric( wp_is_post_revision( $post_id ) ) ) {
25
-		$log->debug( "Skipping $post_id, because id is not numeric or is a post revision." );
24
+	if ( ! is_numeric($post_id) || is_numeric(wp_is_post_revision($post_id))) {
25
+		$log->debug("Skipping $post_id, because id is not numeric or is a post revision.");
26 26
 
27 27
 		return;
28 28
 	}
@@ -30,27 +30,27 @@  discard block
 block discarded – undo
30 30
 	// Get the post type and check whether it supports the editor.
31 31
 	//
32 32
 	// See https://github.com/insideout10/wordlift-plugin/issues/659.
33
-	$post_type           = get_post_type( $post_id );
34
-	$is_editor_supported = post_type_supports( $post_type, 'editor' );
33
+	$post_type           = get_post_type($post_id);
34
+	$is_editor_supported = post_type_supports($post_type, 'editor');
35 35
 
36 36
 	// Bail out if it's not an entity.
37
-	if ( ! $is_editor_supported ) {
38
-		$log->debug( "Skipping $post_id, because $post_type doesn't support the editor (content)." );
37
+	if ( ! $is_editor_supported) {
38
+		$log->debug("Skipping $post_id, because $post_type doesn't support the editor (content).");
39 39
 
40 40
 		return;
41 41
 	}
42 42
 
43 43
 	// Unhook this function so it doesn't loop infinitely.
44
-	remove_action( 'save_post', 'wl_linked_data_save_post' );
44
+	remove_action('save_post', 'wl_linked_data_save_post');
45 45
 
46 46
 	// raise the *wl_linked_data_save_post* event.
47
-	do_action( 'wl_linked_data_save_post', $post_id );
47
+	do_action('wl_linked_data_save_post', $post_id);
48 48
 
49 49
 	// Re-hook this function.
50
-	add_action( 'save_post', 'wl_linked_data_save_post' );
50
+	add_action('save_post', 'wl_linked_data_save_post');
51 51
 }
52 52
 
53
-add_action( 'save_post', 'wl_linked_data_save_post' );
53
+add_action('save_post', 'wl_linked_data_save_post');
54 54
 
55 55
 /**
56 56
  * Save the post to the triple store. Also saves the entities locally and on the triple store.
@@ -59,23 +59,23 @@  discard block
 block discarded – undo
59 59
  *
60 60
  * @param int $post_id The post id being saved.
61 61
  */
62
-function wl_linked_data_save_post_and_related_entities( $post_id ) {
62
+function wl_linked_data_save_post_and_related_entities($post_id) {
63 63
 
64
-	$log = Wordlift_Log_Service::get_logger( 'wl_linked_data_save_post_and_related_entities' );
64
+	$log = Wordlift_Log_Service::get_logger('wl_linked_data_save_post_and_related_entities');
65 65
 
66
-	$log->trace( "Saving $post_id to Linked Data along with related entities..." );
66
+	$log->trace("Saving $post_id to Linked Data along with related entities...");
67 67
 
68 68
 	// Ignore auto-saves
69
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
70
-		$log->trace( 'Doing autosave, skipping...' );
69
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
70
+		$log->trace('Doing autosave, skipping...');
71 71
 
72 72
 		return;
73 73
 	}
74 74
 
75 75
 	// get the current post.
76
-	$post = get_post( $post_id );
76
+	$post = get_post($post_id);
77 77
 
78
-	remove_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' );
78
+	remove_action('wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities');
79 79
 
80 80
 	// wl_write_log( "[ post id :: $post_id ][ autosave :: false ][ post type :: $post->post_type ]" );
81 81
 
@@ -86,44 +86,44 @@  discard block
 block discarded – undo
86 86
 	$entities_uri_mapping = array();
87 87
 
88 88
 	// Save the entities coming with POST data.
89
-	if ( isset( $_POST['wl_entities'] ) && isset( $_POST['wl_boxes'] ) ) {
89
+	if (isset($_POST['wl_entities']) && isset($_POST['wl_boxes'])) {
90 90
 
91
-		wl_write_log( "[ post id :: $post_id ][ POST(wl_entities) :: " );
92
-		wl_write_log( json_encode( $_POST['wl_entities'] ) );
93
-		wl_write_log( "]" );
94
-		wl_write_log( "[ post id :: $post_id ][ POST(wl_boxes) :: " );
95
-		wl_write_log( json_encode( $_POST['wl_boxes'], true ) );
96
-		wl_write_log( "]" );
91
+		wl_write_log("[ post id :: $post_id ][ POST(wl_entities) :: ");
92
+		wl_write_log(json_encode($_POST['wl_entities']));
93
+		wl_write_log("]");
94
+		wl_write_log("[ post id :: $post_id ][ POST(wl_boxes) :: ");
95
+		wl_write_log(json_encode($_POST['wl_boxes'], true));
96
+		wl_write_log("]");
97 97
 
98 98
 		$entities_via_post = $_POST['wl_entities'];
99 99
 		$boxes_via_post    = $_POST['wl_boxes'];
100 100
 
101
-		foreach ( $entities_via_post as $entity_uri => $entity ) {
101
+		foreach ($entities_via_post as $entity_uri => $entity) {
102 102
 
103 103
 			// Only if the current entity is created from scratch let's avoid to
104 104
 			// create more than one entity with same label & entity type.
105
-			$entity_type = ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) ?
105
+			$entity_type = (preg_match('/^local-entity-.+/', $entity_uri) > 0) ?
106 106
 				$entity['main_type'] : null;
107 107
 
108 108
 			// Look if current entity uri matches an internal existing entity, meaning:
109 109
 			// 1. when $entity_uri is an internal uri
110 110
 			// 2. when $entity_uri is an external uri used as sameAs of an internal entity
111
-			$ie = $entity_service->get_entity_post_by_uri( $entity_uri );
111
+			$ie = $entity_service->get_entity_post_by_uri($entity_uri);
112 112
 
113 113
 			// Detect the uri depending if is an existing or a new entity
114
-			$uri = ( null === $ie ) ?
114
+			$uri = (null === $ie) ?
115 115
 				Wordlift_Uri_Service::get_instance()->build_uri(
116 116
 					$entity['label'],
117 117
 					Wordlift_Entity_Service::TYPE_NAME,
118 118
 					$entity_type
119
-				) : wl_get_entity_uri( $ie->ID );
119
+				) : wl_get_entity_uri($ie->ID);
120 120
 
121
-			wl_write_log( "Map $entity_uri on $uri" );
122
-			$entities_uri_mapping[ $entity_uri ] = $uri;
121
+			wl_write_log("Map $entity_uri on $uri");
122
+			$entities_uri_mapping[$entity_uri] = $uri;
123 123
 
124 124
 			// Local entities have a tmp uri with 'local-entity-' prefix
125 125
 			// These uris need to be rewritten here and replaced in the content
126
-			if ( preg_match( '/^local-entity-.+/', $entity_uri ) > 0 ) {
126
+			if (preg_match('/^local-entity-.+/', $entity_uri) > 0) {
127 127
 				// Override the entity obj
128 128
 				$entity['uri'] = $uri;
129 129
 			}
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 			$entity['related_post_id'] = $post_id;
133 133
 
134 134
 			// Save the entity if is a new entity
135
-			if ( null === $ie ) {
136
-				wl_save_entity( $entity );
135
+			if (null === $ie) {
136
+				wl_save_entity($entity);
137 137
 			}
138 138
 
139 139
 		}
@@ -144,39 +144,39 @@  discard block
 block discarded – undo
144 144
 	$updated_post_content = $post->post_content;
145 145
 
146 146
 	// Update the post content if we found mappings of new entities.
147
-	if ( ! empty( $entities_uri_mapping ) ) {
147
+	if ( ! empty($entities_uri_mapping)) {
148 148
 		// Save each entity and store the post id.
149
-		foreach ( $entities_uri_mapping as $tmp_uri => $uri ) {
150
-			$updated_post_content = str_replace( $tmp_uri, $uri, $updated_post_content );
149
+		foreach ($entities_uri_mapping as $tmp_uri => $uri) {
150
+			$updated_post_content = str_replace($tmp_uri, $uri, $updated_post_content);
151 151
 		}
152 152
 
153 153
 		// Update the post content.
154
-		wp_update_post( array(
154
+		wp_update_post(array(
155 155
 			'ID'           => $post->ID,
156 156
 			'post_content' => $updated_post_content,
157
-		) );
157
+		));
158 158
 	}
159 159
 
160 160
 	// Extract related/referenced entities from text.
161
-	$disambiguated_entities = wl_linked_data_content_get_embedded_entities( $updated_post_content );
161
+	$disambiguated_entities = wl_linked_data_content_get_embedded_entities($updated_post_content);
162 162
 
163 163
 	// Reset previously saved instances.
164
-	wl_core_delete_relation_instances( $post_id );
164
+	wl_core_delete_relation_instances($post_id);
165 165
 
166 166
 	// Save relation instances
167
-	foreach ( array_unique( $disambiguated_entities ) as $referenced_entity_id ) {
167
+	foreach (array_unique($disambiguated_entities) as $referenced_entity_id) {
168 168
 
169 169
 		wl_core_add_relation_instance(
170 170
 			$post_id,
171
-			$entity_service->get_classification_scope_for( $referenced_entity_id ),
171
+			$entity_service->get_classification_scope_for($referenced_entity_id),
172 172
 			$referenced_entity_id
173 173
 		);
174 174
 
175 175
 	}
176 176
 
177
-	if ( isset( $_POST['wl_entities'] ) ) {
177
+	if (isset($_POST['wl_entities'])) {
178 178
 		// Save post metadata if available
179
-		$metadata_via_post = ( isset( $_POST['wl_metadata'] ) ) ?
179
+		$metadata_via_post = (isset($_POST['wl_metadata'])) ?
180 180
 			$_POST['wl_metadata'] : array();
181 181
 
182 182
 		$fields = array(
@@ -185,35 +185,35 @@  discard block
 block discarded – undo
185 185
 		);
186 186
 
187 187
 		// Unlink topic taxonomy terms
188
-		Wordlift_Topic_Taxonomy_Service::get_instance()->unlink_topic_for( $post->ID );
188
+		Wordlift_Topic_Taxonomy_Service::get_instance()->unlink_topic_for($post->ID);
189 189
 
190
-		foreach ( $fields as $field ) {
190
+		foreach ($fields as $field) {
191 191
 
192 192
 			// Delete current values
193
-			delete_post_meta( $post->ID, $field );
193
+			delete_post_meta($post->ID, $field);
194 194
 			// Retrieve the entity uri
195
-			$uri = ( isset( $metadata_via_post[ $field ] ) ) ?
196
-				stripslashes( $metadata_via_post[ $field ] ) : '';
195
+			$uri = (isset($metadata_via_post[$field])) ?
196
+				stripslashes($metadata_via_post[$field]) : '';
197 197
 
198
-			$entity = $entity_service->get_entity_post_by_uri( $uri );
198
+			$entity = $entity_service->get_entity_post_by_uri($uri);
199 199
 
200
-			if ( $entity ) {
201
-				add_post_meta( $post->ID, $field, $entity->ID, true );
200
+			if ($entity) {
201
+				add_post_meta($post->ID, $field, $entity->ID, true);
202 202
 				// Set also the topic taxonomy
203
-				if ( $field === Wordlift_Schema_Service::FIELD_TOPIC ) {
204
-					Wordlift_Topic_Taxonomy_Service::get_instance()->set_topic_for( $post->ID, $entity );
203
+				if ($field === Wordlift_Schema_Service::FIELD_TOPIC) {
204
+					Wordlift_Topic_Taxonomy_Service::get_instance()->set_topic_for($post->ID, $entity);
205 205
 				}
206 206
 			}
207 207
 		}
208 208
 	}
209 209
 
210 210
 	// Push the post to Redlink.
211
-	Wordlift_Linked_Data_Service::get_instance()->push( $post->ID );
211
+	Wordlift_Linked_Data_Service::get_instance()->push($post->ID);
212 212
 
213
-	add_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' );
213
+	add_action('wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities');
214 214
 }
215 215
 
216
-add_action( 'wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities' );
216
+add_action('wl_linked_data_save_post', 'wl_linked_data_save_post_and_related_entities');
217 217
 
218 218
 /**
219 219
  * Save the specified data as an entity in WordPress. This method only create new entities. When an existing entity is
@@ -231,33 +231,33 @@  discard block
 block discarded – undo
231 231
  *
232 232
  * @return null|WP_Post A post instance or null in case of failure.
233 233
  */
234
-function wl_save_entity( $entity_data ) {
234
+function wl_save_entity($entity_data) {
235 235
 
236
-	$log = Wordlift_Log_Service::get_logger( 'wl_save_entity' );
236
+	$log = Wordlift_Log_Service::get_logger('wl_save_entity');
237 237
 
238 238
 	$uri              = $entity_data['uri'];
239 239
 	$label            = $entity_data['label'];
240 240
 	$type_uri         = $entity_data['main_type'];
241
-	$entity_types     = isset( $entity_data['type'] ) ? $entity_data['type'] : array();
241
+	$entity_types     = isset($entity_data['type']) ? $entity_data['type'] : array();
242 242
 	$description      = $entity_data['description'];
243
-	$images           = isset( $entity_data['image'] ) ? (array) $entity_data['image'] : array();
244
-	$same_as          = isset( $entity_data['sameas'] ) ? (array) $entity_data['sameas'] : array();
245
-	$related_post_id  = isset( $entity_data['related_post_id'] ) ? $entity_data['related_post_id'] : null;
246
-	$other_properties = isset( $entity_data['properties'] ) ? $entity_data['properties'] : array();
243
+	$images           = isset($entity_data['image']) ? (array) $entity_data['image'] : array();
244
+	$same_as          = isset($entity_data['sameas']) ? (array) $entity_data['sameas'] : array();
245
+	$related_post_id  = isset($entity_data['related_post_id']) ? $entity_data['related_post_id'] : null;
246
+	$other_properties = isset($entity_data['properties']) ? $entity_data['properties'] : array();
247 247
 
248 248
 	// Get the synonyms.
249
-	$synonyms = isset( $entity_data['synonym'] ) ? $entity_data['synonym'] : array();
249
+	$synonyms = isset($entity_data['synonym']) ? $entity_data['synonym'] : array();
250 250
 
251 251
 	// Check whether an entity already exists with the provided URI.
252
-	if ( null !== $post = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( $uri ) ) {
253
-		$log->debug( "Post already exists for URI $uri." );
252
+	if (null !== $post = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri($uri)) {
253
+		$log->debug("Post already exists for URI $uri.");
254 254
 
255 255
 		return $post;
256 256
 	}
257 257
 
258 258
 	// Prepare properties of the new entity.
259 259
 	$params = array(
260
-		'post_status'  => ( is_numeric( $related_post_id ) ? get_post_status( $related_post_id ) : 'draft' ),
260
+		'post_status'  => (is_numeric($related_post_id) ? get_post_status($related_post_id) : 'draft'),
261 261
 		'post_type'    => Wordlift_Entity_Service::TYPE_NAME,
262 262
 		'post_title'   => $label,
263 263
 		'post_content' => $description,
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 		// new entities.
268 268
 		//
269 269
 		// See https://github.com/insideout10/wordlift-plugin/issues/282
270
-		'post_name'    => sanitize_title( $label ),
270
+		'post_name'    => sanitize_title($label),
271 271
 	);
272 272
 
273 273
 	// If Yoast is installed and active, we temporary remove the save_postdata hook which causes Yoast to "pass over"
@@ -276,18 +276,18 @@  discard block
 block discarded – undo
276 276
 	// This does NOT affect saving an entity from the entity admin page since this function is called when an entity
277 277
 	// is created when saving a post.
278 278
 	global $wpseo_metabox, $seo_ultimate;
279
-	if ( isset( $wpseo_metabox ) ) {
280
-		remove_action( 'wp_insert_post', array(
279
+	if (isset($wpseo_metabox)) {
280
+		remove_action('wp_insert_post', array(
281 281
 			$wpseo_metabox,
282 282
 			'save_postdata',
283
-		) );
283
+		));
284 284
 	}
285 285
 
286
-	if ( isset( $seo_ultimate ) ) {
287
-		remove_action( 'save_post', array(
286
+	if (isset($seo_ultimate)) {
287
+		remove_action('save_post', array(
288 288
 			$seo_ultimate,
289 289
 			'save_postmeta_box',
290
-		) );
290
+		));
291 291
 	}
292 292
 
293 293
 	// The fact that we're calling here wp_insert_post is causing issues with plugins (and ourselves too) that hook to
@@ -297,95 +297,95 @@  discard block
 block discarded – undo
297 297
 	// see https://github.com/insideout10/wordlift-plugin/issues/156
298 298
 	// see https://github.com/insideout10/wordlift-plugin/issues/148
299 299
 	global $wp_filter;
300
-	$save_post_filters = is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] : $wp_filter['save_post']->callbacks;
301
-	is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] = array() : $wp_filter['save_post']->remove_all_filters();
300
+	$save_post_filters = is_array($wp_filter['save_post']) ? $wp_filter['save_post'] : $wp_filter['save_post']->callbacks;
301
+	is_array($wp_filter['save_post']) ? $wp_filter['save_post'] = array() : $wp_filter['save_post']->remove_all_filters();
302 302
 
303 303
 
304
-	$log->trace( 'Going to insert new post...' );
304
+	$log->trace('Going to insert new post...');
305 305
 
306 306
 	// create or update the post.
307
-	$post_id = wp_insert_post( $params, true );
307
+	$post_id = wp_insert_post($params, true);
308 308
 
309 309
 	// Setting the alternative labels for this entity.
310 310
 	Wordlift_Entity_Service::get_instance()
311
-						   ->set_alternative_labels( $post_id, $synonyms );
311
+						   ->set_alternative_labels($post_id, $synonyms);
312 312
 
313 313
 	// Restore all the existing filters.
314
-	is_array( $wp_filter['save_post'] ) ? $wp_filter['save_post'] = $save_post_filters : $wp_filter['save_post']->callbacks = $save_post_filters;
314
+	is_array($wp_filter['save_post']) ? $wp_filter['save_post'] = $save_post_filters : $wp_filter['save_post']->callbacks = $save_post_filters;
315 315
 
316 316
 	// If Yoast is installed and active, we restore the Yoast save_postdata hook (https://github.com/insideout10/wordlift-plugin/issues/156)
317
-	if ( isset( $wpseo_metabox ) ) {
318
-		add_action( 'wp_insert_post', array(
317
+	if (isset($wpseo_metabox)) {
318
+		add_action('wp_insert_post', array(
319 319
 			$wpseo_metabox,
320 320
 			'save_postdata',
321
-		) );
321
+		));
322 322
 	}
323 323
 
324 324
 	// If SEO Ultimate is installed, add back the hook we removed a few lines above.
325
-	if ( isset( $seo_ultimate ) ) {
326
-		add_action( 'save_post', array(
325
+	if (isset($seo_ultimate)) {
326
+		add_action('save_post', array(
327 327
 			$seo_ultimate,
328 328
 			'save_postmeta_box',
329
-		), 10, 2 );
329
+		), 10, 2);
330 330
 	}
331 331
 
332 332
 	// TODO: handle errors.
333
-	if ( is_wp_error( $post_id ) ) {
334
-		$log->error( 'An error occurred: ' . $post_id->get_error_message() );
333
+	if (is_wp_error($post_id)) {
334
+		$log->error('An error occurred: '.$post_id->get_error_message());
335 335
 
336 336
 		// inform an error occurred.
337 337
 		return null;
338 338
 	}
339 339
 
340
-	wl_set_entity_main_type( $post_id, $type_uri );
340
+	wl_set_entity_main_type($post_id, $type_uri);
341 341
 
342 342
 	// Save the entity types.
343
-	wl_set_entity_rdf_types( $post_id, $entity_types );
343
+	wl_set_entity_rdf_types($post_id, $entity_types);
344 344
 
345 345
 	// Get a dataset URI for the entity.
346
-	$wl_uri = wl_build_entity_uri( $post_id );
346
+	$wl_uri = wl_build_entity_uri($post_id);
347 347
 
348 348
 	// Save the entity URI.
349
-	wl_set_entity_uri( $post_id, $wl_uri );
349
+	wl_set_entity_uri($post_id, $wl_uri);
350 350
 
351 351
 	// Add the uri to the sameAs data if it's not a local URI.
352
-	if ( $wl_uri !== $uri ) {
353
-		array_push( $same_as, $uri );
352
+	if ($wl_uri !== $uri) {
353
+		array_push($same_as, $uri);
354 354
 	}
355 355
 
356
-	$new_uri = wl_get_entity_uri( $post_id );
356
+	$new_uri = wl_get_entity_uri($post_id);
357 357
 
358 358
 	// Save the sameAs data for the entity.
359
-	wl_schema_set_value( $post_id, 'sameAs', $same_as );
359
+	wl_schema_set_value($post_id, 'sameAs', $same_as);
360 360
 
361 361
 	// Save the other properties (latitude, langitude, startDate, endDate, etc.)
362
-	foreach ( $other_properties as $property_name => $property_value ) {
363
-		wl_schema_set_value( $post_id, $property_name, $property_value );
362
+	foreach ($other_properties as $property_name => $property_value) {
363
+		wl_schema_set_value($post_id, $property_name, $property_value);
364 364
 	}
365 365
 
366 366
 	// Call hooks.
367
-	do_action( 'wl_save_entity', $post_id );
367
+	do_action('wl_save_entity', $post_id);
368 368
 
369
-	foreach ( $images as $image_remote_url ) {
369
+	foreach ($images as $image_remote_url) {
370 370
 
371 371
 		// Check if image is already present in local DB
372
-		if ( strpos( $image_remote_url, site_url() ) !== false ) {
372
+		if (strpos($image_remote_url, site_url()) !== false) {
373 373
 			// Do nothing.
374 374
 			continue;
375 375
 		}
376 376
 
377 377
 		// Check if there is an existing attachment for this post ID and source URL.
378
-		$existing_image = wl_get_attachment_for_source_url( $post_id, $image_remote_url );
378
+		$existing_image = wl_get_attachment_for_source_url($post_id, $image_remote_url);
379 379
 
380 380
 		// Skip if an existing image is found.
381
-		if ( null !== $existing_image ) {
381
+		if (null !== $existing_image) {
382 382
 			continue;
383 383
 		}
384 384
 
385 385
 		// Save the image and get the local path.
386
-		$image = Wordlift_Remote_Image_Service::save_from_url( $image_remote_url );
386
+		$image = Wordlift_Remote_Image_Service::save_from_url($image_remote_url);
387 387
 
388
-		if ( false === $image ) {
388
+		if (false === $image) {
389 389
 			continue;
390 390
 		}
391 391
 
@@ -405,24 +405,24 @@  discard block
 block discarded – undo
405 405
 		);
406 406
 
407 407
 		// Create the attachment in WordPress and generate the related metadata.
408
-		$attachment_id = wp_insert_attachment( $attachment, $filename, $post_id );
408
+		$attachment_id = wp_insert_attachment($attachment, $filename, $post_id);
409 409
 
410 410
 		// Set the source URL for the image.
411
-		wl_set_source_url( $attachment_id, $image_remote_url );
411
+		wl_set_source_url($attachment_id, $image_remote_url);
412 412
 
413
-		$attachment_data = wp_generate_attachment_metadata( $attachment_id, $filename );
414
-		wp_update_attachment_metadata( $attachment_id, $attachment_data );
413
+		$attachment_data = wp_generate_attachment_metadata($attachment_id, $filename);
414
+		wp_update_attachment_metadata($attachment_id, $attachment_data);
415 415
 
416 416
 		// Set it as the featured image.
417
-		set_post_thumbnail( $post_id, $attachment_id );
417
+		set_post_thumbnail($post_id, $attachment_id);
418 418
 	}
419 419
 
420 420
 	// The entity is pushed to Redlink on save by the function hooked to save_post.
421 421
 	// save the entity in the triple store.
422
-	Wordlift_Linked_Data_Service::get_instance()->push( $post_id );
422
+	Wordlift_Linked_Data_Service::get_instance()->push($post_id);
423 423
 
424 424
 	// finally return the entity post.
425
-	return get_post( $post_id );
425
+	return get_post($post_id);
426 426
 }
427 427
 
428 428
 /**
@@ -434,10 +434,10 @@  discard block
 block discarded – undo
434 434
  *
435 435
  * @return array An array of entity posts.
436 436
  */
437
-function wl_linked_data_content_get_embedded_entities( $content ) {
437
+function wl_linked_data_content_get_embedded_entities($content) {
438 438
 
439 439
 	// Remove quote escapes.
440
-	$content = str_replace( '\\"', '"', $content );
440
+	$content = str_replace('\\"', '"', $content);
441 441
 
442 442
 	// Match all itemid attributes.
443 443
 	$pattern = '/<\w+[^>]*\sitemid="([^"]+)"[^>]*>/im';
@@ -448,8 +448,8 @@  discard block
 block discarded – undo
448 448
 	$matches = array();
449 449
 
450 450
 	// In case of errors, return an empty array.
451
-	if ( false === preg_match_all( $pattern, $content, $matches ) ) {
452
-		wl_write_log( "Found no entities embedded in content" );
451
+	if (false === preg_match_all($pattern, $content, $matches)) {
452
+		wl_write_log("Found no entities embedded in content");
453 453
 
454 454
 		return array();
455 455
 	}
@@ -458,13 +458,13 @@  discard block
 block discarded – undo
458 458
 
459 459
 	// Collect the entities.
460 460
 	$entities = array();
461
-	foreach ( $matches[1] as $uri ) {
462
-		$uri_d = html_entity_decode( $uri );
461
+	foreach ($matches[1] as $uri) {
462
+		$uri_d = html_entity_decode($uri);
463 463
 
464
-		$entity = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( $uri_d );
464
+		$entity = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri($uri_d);
465 465
 
466
-		if ( null !== $entity ) {
467
-			array_push( $entities, $entity->ID );
466
+		if (null !== $entity) {
467
+			array_push($entities, $entity->ID);
468 468
 		}
469 469
 	}
470 470
 
Please login to merge, or discard this patch.