Completed
Push — develop ( f4ddc9...22700d )
by David
14:07 queued 10s
created

Wordlift::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 10
nc 2
nop 0
dl 0
loc 17
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * The file that defines the core plugin class
4
 *
5
 * A class definition that includes attributes and functions used across both the
6
 * public-facing side of the site and the admin area.
7
 *
8
 * @link       https://wordlift.io
9
 * @since      1.0.0
10
 *
11
 * @package    Wordlift
12
 * @subpackage Wordlift/includes
13
 */
14
15
/**
16
 * The core plugin class.
17
 *
18
 * This is used to define internationalization, admin-specific hooks, and
19
 * public-facing site hooks.
20
 *
21
 * Also maintains the unique identifier of this plugin as well as the current
22
 * version of the plugin.
23
 *
24
 * @since      1.0.0
25
 * @package    Wordlift
26
 * @subpackage Wordlift/includes
27
 * @author     WordLift <[email protected]>
28
 */
29
class Wordlift {
0 ignored issues
show
Bug introduced by
Possible parse error: class missing opening or closing brace
Loading history...
30
31
	//<editor-fold desc="## FIELDS">
32
33
	/**
34
	 * The loader that's responsible for maintaining and registering all hooks that power
35
	 * the plugin.
36
	 *
37
	 * @since    1.0.0
38
	 * @access   protected
39
	 * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
40
	 */
41
	protected $loader;
42
43
	/**
44
	 * The unique identifier of this plugin.
45
	 *
46
	 * @since    1.0.0
47
	 * @access   protected
48
	 * @var      string $plugin_name The string used to uniquely identify this plugin.
49
	 */
50
	protected $plugin_name;
51
52
	/**
53
	 * The current version of the plugin.
54
	 *
55
	 * @since    1.0.0
56
	 * @access   protected
57
	 * @var      string $version The current version of the plugin.
58
	 */
59
	protected $version;
60
61
	/**
62
	 * The {@link Wordlift_Tinymce_Adapter} instance.
63
	 *
64
	 * @since  3.12.0
65
	 * @access protected
66
	 * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
67
	 */
68
	protected $tinymce_adapter;
69
70
	/**
71
	 * The Thumbnail service.
72
	 *
73
	 * @since  3.1.5
74
	 * @access private
75
	 * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
76
	 */
77
	private $thumbnail_service;
78
79
	/**
80
	 * The UI service.
81
	 *
82
	 * @since  3.2.0
83
	 * @access private
84
	 * @var \Wordlift_UI_Service $ui_service The UI service.
85
	 */
86
	private $ui_service;
87
88
	/**
89
	 * The Schema service.
90
	 *
91
	 * @since  3.3.0
92
	 * @access protected
93
	 * @var \Wordlift_Schema_Service $schema_service The Schema service.
94
	 */
95
	protected $schema_service;
96
97
	/**
98
	 * The Entity service.
99
	 *
100
	 * @since  3.1.0
101
	 * @access protected
102
	 * @var \Wordlift_Entity_Service $entity_service The Entity service.
103
	 */
104
	protected $entity_service;
105
106
	/**
107
	 * The Topic Taxonomy service.
108
	 *
109
	 * @since  3.5.0
110
	 * @access private
111
	 * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
112
	 */
113
	private $topic_taxonomy_service;
114
115
	/**
116
	 * The Entity Types Taxonomy service.
117
	 *
118
	 * @since  3.18.0
119
	 * @access private
120
	 * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service.
121
	 */
122
	private $entity_types_taxonomy_service;
123
124
	/**
125
	 * The User service.
126
	 *
127
	 * @since  3.1.7
128
	 * @access protected
129
	 * @var \Wordlift_User_Service $user_service The User service.
130
	 */
131
	protected $user_service;
132
133
	/**
134
	 * The Timeline service.
135
	 *
136
	 * @since  3.1.0
137
	 * @access private
138
	 * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
139
	 */
140
	private $timeline_service;
141
142
	/**
143
	 * The Redirect service.
144
	 *
145
	 * @since  3.2.0
146
	 * @access private
147
	 * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
148
	 */
149
	private $redirect_service;
150
151
	/**
152
	 * The Notice service.
153
	 *
154
	 * @since  3.3.0
155
	 * @access private
156
	 * @var \Wordlift_Notice_Service $notice_service The Notice service.
157
	 */
158
	private $notice_service;
159
160
	/**
161
	 * The Entity list customization.
162
	 *
163
	 * @since  3.3.0
164
	 * @access protected
165
	 * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
166
	 */
167
	protected $entity_list_service;
168
169
	/**
170
	 * The Entity Types Taxonomy Walker.
171
	 *
172
	 * @since  3.1.0
173
	 * @access private
174
	 * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
175
	 */
176
	private $entity_types_taxonomy_walker;
177
178
	/**
179
	 * The ShareThis service.
180
	 *
181
	 * @since  3.2.0
182
	 * @access private
183
	 * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
184
	 */
185
	private $sharethis_service;
186
187
	/**
188
	 * The PrimaShop adapter.
189
	 *
190
	 * @since  3.2.3
191
	 * @access private
192
	 * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
193
	 */
194
	private $primashop_adapter;
195
196
	/**
197
	 * The WordLift Dashboard adapter.
198
	 *
199
	 * @since  3.4.0
200
	 * @access private
201
	 * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
202
	 */
203
	private $dashboard_service;
204
205
	/**
206
	 * The entity type service.
207
	 *
208
	 * @since  3.6.0
209
	 * @access private
210
	 * @var \Wordlift_Entity_Post_Type_Service
211
	 */
212
	private $entity_post_type_service;
213
214
	/**
215
	 * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
216
	 *
217
	 * @since  3.6.0
218
	 * @access private
219
	 * @var \Wordlift_Entity_Link_Service
220
	 */
221
	private $entity_link_service;
222
223
	/**
224
	 * A {@link Wordlift_Sparql_Service} instance.
225
	 *
226
	 * @since    3.6.0
227
	 * @access   protected
228
	 * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
229
	 */
230
	protected $sparql_service;
231
232
	/**
233
	 * A {@link Wordlift_Import_Service} instance.
234
	 *
235
	 * @since  3.6.0
236
	 * @access private
237
	 * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
238
	 */
239
	private $import_service;
240
241
	/**
242
	 * A {@link Wordlift_Rebuild_Service} instance.
243
	 *
244
	 * @since  3.6.0
245
	 * @access private
246
	 * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
247
	 */
248
	private $rebuild_service;
249
250
	/**
251
	 * A {@link Wordlift_Jsonld_Service} instance.
252
	 *
253
	 * @since  3.7.0
254
	 * @access protected
255
	 * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
256
	 */
257
	protected $jsonld_service;
258
259
	/**
260
	 * A {@link Wordlift_Website_Jsonld_Converter} instance.
261
	 *
262
	 * @since  3.14.0
263
	 * @access protected
264
	 * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance.
265
	 */
266
	protected $jsonld_website_converter;
267
268
	/**
269
	 * A {@link Wordlift_Property_Factory} instance.
270
	 *
271
	 * @since  3.7.0
272
	 * @access private
273
	 * @var \Wordlift_Property_Factory $property_factory
274
	 */
275
	private $property_factory;
276
277
	/**
278
	 * The 'Download Your Data' page.
279
	 *
280
	 * @since  3.6.0
281
	 * @access private
282
	 * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
283
	 */
284
	private $download_your_data_page;
285
286
	/**
287
	 * The 'WordLift Settings' page.
288
	 *
289
	 * @since  3.11.0
290
	 * @access protected
291
	 * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
292
	 */
293
	protected $settings_page;
294
295
	/**
296
	 * The 'WordLift Batch analysis' page.
297
	 *
298
	 * @since  3.14.0
299
	 * @access protected
300
	 * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page.
301
	 */
302
	protected $batch_analysis_page;
303
304
	/**
305
	 * The install wizard page.
306
	 *
307
	 * @since  3.9.0
308
	 * @access private
309
	 * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
310
	 */
311
	private $admin_setup;
312
313
	/**
314
	 * The Content Filter Service hooks up to the 'the_content' filter and provides
315
	 * linking of entities to their pages.
316
	 *
317
	 * @since  3.8.0
318
	 * @access private
319
	 * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
320
	 */
321
	private $content_filter_service;
322
323
	/**
324
	 * A {@link Wordlift_Key_Validation_Service} instance.
325
	 *
326
	 * @since  3.9.0
327
	 * @access private
328
	 * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
329
	 */
330
	private $key_validation_service;
331
332
	/**
333
	 * A {@link Wordlift_Rating_Service} instance.
334
	 *
335
	 * @since  3.10.0
336
	 * @access private
337
	 * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
338
	 */
339
	private $rating_service;
340
341
	/**
342
	 * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
343
	 *
344
	 * @since  3.10.0
345
	 * @access protected
346
	 * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
347
	 */
348
	protected $post_to_jsonld_converter;
349
350
	/**
351
	 * A {@link Wordlift_Configuration_Service} instance.
352
	 *
353
	 * @since  3.10.0
354
	 * @access protected
355
	 * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
356
	 */
357
	protected $configuration_service;
358
359
	/**
360
	 * A {@link Wordlift_Install_Service} instance.
361
	 *
362
	 * @since  3.18.0
363
	 * @access protected
364
	 * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance.
365
	 */
366
	protected $install_service;
367
368
	/**
369
	 * A {@link Wordlift_Entity_Type_Service} instance.
370
	 *
371
	 * @since  3.10.0
372
	 * @access protected
373
	 * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
374
	 */
375
	protected $entity_type_service;
376
377
	/**
378
	 * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
379
	 *
380
	 * @since  3.10.0
381
	 * @access protected
382
	 * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
383
	 */
384
	protected $entity_post_to_jsonld_converter;
385
386
	/**
387
	 * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
388
	 *
389
	 * @since  3.10.0
390
	 * @access protected
391
	 * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
392
	 */
393
	protected $postid_to_jsonld_converter;
394
395
	/**
396
	 * The {@link Wordlift_Admin_Status_Page} class.
397
	 *
398
	 * @since  3.9.8
399
	 * @access private
400
	 * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
401
	 */
402
	private $status_page;
403
404
	/**
405
	 * The {@link Wordlift_Category_Taxonomy_Service} instance.
406
	 *
407
	 * @since  3.11.0
408
	 * @access protected
409
	 * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
410
	 */
411
	protected $category_taxonomy_service;
412
413
	/**
414
	 * The {@link Wordlift_Entity_Page_Service} instance.
415
	 *
416
	 * @since  3.11.0
417
	 * @access protected
418
	 * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance.
419
	 */
420
	protected $entity_page_service;
421
422
	/**
423
	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
424
	 *
425
	 * @since  3.11.0
426
	 * @access protected
427
	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
428
	 */
429
	protected $settings_page_action_link;
430
431
	/**
432
	 * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
433
	 *
434
	 * @since  3.11.0
435
	 * @access protected
436
	 * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
437
	 */
438
	protected $publisher_ajax_adapter;
439
440
	/**
441
	 * The {@link Wordlift_Admin_Input_Element} element renderer.
442
	 *
443
	 * @since  3.11.0
444
	 * @access protected
445
	 * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
446
	 */
447
	protected $input_element;
448
449
	/**
450
	 * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
451
	 *
452
	 * @since  3.13.0
453
	 * @access protected
454
	 * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
455
	 */
456
	protected $radio_input_element;
457
458
	/**
459
	 * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
460
	 *
461
	 * @since  3.11.0
462
	 * @access protected
463
	 * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
464
	 */
465
	protected $language_select_element;
466
467
	/**
468
	 * The {@link Wordlift_Admin_Publisher_Element} element renderer.
469
	 *
470
	 * @since  3.11.0
471
	 * @access protected
472
	 * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
473
	 */
474
	protected $publisher_element;
475
476
	/**
477
	 * The {@link Wordlift_Admin_Select2_Element} element renderer.
478
	 *
479
	 * @since  3.11.0
480
	 * @access protected
481
	 * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
482
	 */
483
	protected $select2_element;
484
485
	/**
486
	 * The controller for the entity type list admin page
487
	 *
488
	 * @since  3.11.0
489
	 * @access private
490
	 * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
491
	 */
492
	private $entity_type_admin_page;
493
494
	/**
495
	 * The controller for the entity type settings admin page
496
	 *
497
	 * @since  3.11.0
498
	 * @access private
499
	 * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
500
	 */
501
	private $entity_type_settings_admin_page;
502
503
	/**
504
	 * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
505
	 *
506
	 * @since  3.11.0
507
	 * @access protected
508
	 * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
509
	 */
510
	protected $related_entities_cloud_widget;
511
512
	/**
513
	 * The {@link Wordlift_Admin_Author_Element} instance.
514
	 *
515
	 * @since  3.14.0
516
	 * @access protected
517
	 * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
518
	 */
519
	protected $author_element;
520
521
	/**
522
	 * The {@link Wordlift_Batch_Analysis_Service} instance.
523
	 *
524
	 * @since  3.14.0
525
	 * @access protected
526
	 * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance.
527
	 */
528
	protected $batch_analysis_service;
529
530
	/**
531
	 * The {@link Wordlift_Sample_Data_Service} instance.
532
	 *
533
	 * @since  3.12.0
534
	 * @access protected
535
	 * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
536
	 */
537
	protected $sample_data_service;
538
539
	/**
540
	 * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
541
	 *
542
	 * @since  3.12.0
543
	 * @access protected
544
	 * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
545
	 */
546
	protected $sample_data_ajax_adapter;
547
548
	/**
549
	 * The {@link Wordlift_Batch_Analysis_Adapter} instance.
550
	 *
551
	 * @since  3.14.2
552
	 * @access protected
553
	 * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance.
554
	 */
555
	private $batch_analysis_adapter;
556
557
	/**
558
	 * The {@link Wordlift_Relation_Rebuild_Service} instance.
559
	 *
560
	 * @since  3.14.3
561
	 * @access private
562
	 * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance.
563
	 */
564
	private $relation_rebuild_service;
565
566
	/**
567
	 * The {@link Wordlift_Relation_Rebuild_Adapter} instance.
568
	 *
569
	 * @since  3.14.3
570
	 * @access private
571
	 * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance.
572
	 */
573
	private $relation_rebuild_adapter;
574
575
	/**
576
	 * The {@link Wordlift_Reference_Rebuild_Service} instance.
577
	 *
578
	 * @since  3.18.0
579
	 * @access private
580
	 * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance.
581
	 */
582
	private $reference_rebuild_service;
583
584
	/**
585
	 * The {@link Wordlift_Google_Analytics_Export_Service} instance.
586
	 *
587
	 * @since  3.16.0
588
	 * @access protected
589
	 * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance.
590
	 */
591
	protected $google_analytics_export_service;
592
593
	/**
594
	 * {@link Wordlift}'s singleton instance.
595
	 *
596
	 * @since  3.15.0
597
	 * @access protected
598
	 * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance.
599
	 */
600
	protected $entity_type_adapter;
601
602
	/**
603
	 * The {@link Wordlift_Linked_Data_Service} instance.
604
	 *
605
	 * @since  3.15.0
606
	 * @access protected
607
	 * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance.
608
	 */
609
	protected $linked_data_service;
610
611
	/**
612
	 * The {@link Wordlift_Storage_Factory} instance.
613
	 *
614
	 * @since  3.15.0
615
	 * @access protected
616
	 * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance.
617
	 */
618
	protected $storage_factory;
619
620
	/**
621
	 * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
622
	 *
623
	 * @since  3.15.0
624
	 * @access protected
625
	 * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
626
	 */
627
	protected $rendition_factory;
628
629
	/**
630
	 * The {@link Wordlift_Autocomplete_Service} instance.
631
	 *
632
	 * @since  3.15.0
633
	 * @access private
634
	 * @var \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance.
635
	 */
636
	private $autocomplete_service;
637
638
	/**
639
	 * The {@link Wordlift_Autocomplete_Adapter} instance.
640
	 *
641
	 * @since  3.15.0
642
	 * @access private
643
	 * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance.
644
	 */
645
	private $autocomplete_adapter;
646
647
	/**
648
	 * The {@link Wordlift_Relation_Service} instance.
649
	 *
650
	 * @since  3.15.0
651
	 * @access protected
652
	 * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
653
	 */
654
	protected $relation_service;
655
656
	/**
657
	 * The {@link Wordlift_Cached_Post_Converter} instance.
658
	 *
659
	 * @since  3.16.0
660
	 * @access protected
661
	 * @var  \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance.
662
	 *
663
	 */
664
	protected $cached_postid_to_jsonld_converter;
665
666
	/**
667
	 * The {@link Wordlift_File_Cache_Service} instance.
668
	 *
669
	 * @since  3.16.0
670
	 * @access protected
671
	 * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance.
672
	 */
673
	protected $file_cache_service;
674
675
	/**
676
	 * The {@link Wordlift_Entity_Uri_Service} instance.
677
	 *
678
	 * @since  3.16.3
679
	 * @access protected
680
	 * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
681
	 */
682
	protected $entity_uri_service;
683
684
	/**
685
	 * The {@link Wordlift_Publisher_Service} instance.
686
	 *
687
	 * @since  3.19.0
688
	 * @access protected
689
	 * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
690
	 */
691
	protected $publisher_service;
692
693
	/**
694
	 * {@link Wordlift}'s singleton instance.
695
	 *
696
	 * @since  3.11.2
697
	 * @access private
698
	 * @var Wordlift $instance {@link Wordlift}'s singleton instance.
699
	 */
700
	private static $instance;
701
	//</editor-fold>
702
703
	/**
704
	 * Define the core functionality of the plugin.
705
	 *
706
	 * Set the plugin name and the plugin version that can be used throughout the plugin.
707
	 * Load the dependencies, define the locale, and set the hooks for the admin area and
708
	 * the public-facing side of the site.
709
	 *
710
	 * @since    1.0.0
711
	 */
712
	public function __construct() {
713
714
		$this->plugin_name = 'wordlift';
715
<<<<<<< HEAD
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_SL
Loading history...
716
		$this->version     = '3.19.0-rc1';
717
=======
718
		$this->version     = '3.18.6';
719
>>>>>>> release/3.18.6
720
		$this->load_dependencies();
721
		$this->set_locale();
722
		$this->define_admin_hooks();
723
		$this->define_public_hooks();
724
725
		// If we're in `WP_CLI` load the related files.
726
		if ( class_exists( 'WP_CLI' ) ) {
727
			$this->load_cli_dependencies();
728
		}
729
730
		self::$instance = $this;
731
732
	}
733
734
	/**
735
	 * Get the singleton instance.
736
	 *
737
	 * @since 3.11.2
738
	 *
739
	 * @return Wordlift The {@link Wordlift} singleton instance.
740
	 */
741
	public static function get_instance() {
742
743
		return self::$instance;
744
	}
745
746
	/**
747
	 * Load the required dependencies for this plugin.
748
	 *
749
	 * Include the following files that make up the plugin:
750
	 *
751
	 * - Wordlift_Loader. Orchestrates the hooks of the plugin.
752
	 * - Wordlift_i18n. Defines internationalization functionality.
753
	 * - Wordlift_Admin. Defines all hooks for the admin area.
754
	 * - Wordlift_Public. Defines all hooks for the public side of the site.
755
	 *
756
	 * Create an instance of the loader which will be used to register the hooks
757
	 * with WordPress.
758
	 *
759
	 * @since    1.0.0
760
	 * @access   private
761
	 */
762
	private function load_dependencies() {
763
764
		/**
765
		 * The class responsible for orchestrating the actions and filters of the
766
		 * core plugin.
767
		 */
768
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
769
770
		// The class responsible for plugin uninstall.
771
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php';
772
773
		/**
774
		 * The class responsible for defining internationalization functionality
775
		 * of the plugin.
776
		 */
777
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
778
779
		/**
780
		 * WordLift's supported languages.
781
		 */
782
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
783
784
		/**
785
		 * Provide support functions to sanitize data.
786
		 */
787
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
788
789
		/** Installs. */
790
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install.php';
791
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
792
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-1-0-0.php';
793
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-10-0.php';
794
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-12-0.php';
795
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-14-0.php';
796
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-15-0.php';
797
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-0.php';
798
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-3.php';
799
800
		/** Services. */
801
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
802
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
803
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
804
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
805
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
806
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
807
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
808
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
809
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
810
811
		/**
812
		 * The Query builder.
813
		 */
814
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
815
816
		/**
817
		 * The Schema service.
818
		 */
819
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
820
821
		/**
822
		 * The schema:url property service.
823
		 */
824
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
825
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
826
827
		/**
828
		 * The UI service.
829
		 */
830
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
831
832
		/**
833
		 * The Thumbnail service.
834
		 */
835
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
836
837
		/**
838
		 * The Entity Types Taxonomy service.
839
		 */
840
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
841
842
		/**
843
		 * The Entity service.
844
		 */
845
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
846
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
847
848
		// Add the entity rating service.
849
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
850
851
		/**
852
		 * The User service.
853
		 */
854
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
855
856
		/**
857
		 * The Timeline service.
858
		 */
859
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
860
861
		/**
862
		 * The Topic Taxonomy service.
863
		 */
864
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
865
866
		/**
867
		 * The SPARQL service.
868
		 */
869
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
870
871
		/**
872
		 * The WordLift import service.
873
		 */
874
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
875
876
		/**
877
		 * The WordLift URI service.
878
		 */
879
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
880
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
881
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
882
883
		/**
884
		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
885
		 */
886
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php';
887
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php';
888
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php';
889
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php';
890
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
891
892
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
893
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
894
895
		/**
896
		 * Load the converters.
897
		 */
898
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
899
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
900
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
901
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
902
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
903
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
904
905
		/**
906
		 * Load cache-related files.
907
		 */
908
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
909
910
		/**
911
		 * Load the content filter.
912
		 */
913
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
914
915
		/*
916
		 * Load the excerpt helper.
917
		 */
918
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
919
920
		/**
921
		 * Load the JSON-LD service to publish entities using JSON-LD.s
922
		 *
923
		 * @since 3.8.0
924
		 */
925
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
926
927
		// The Publisher Service and the AJAX adapter.
928
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
929
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
930
931
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
932
933
		/**
934
		 * Load the WordLift key validation service.
935
		 */
936
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
937
938
		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
939
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
940
941
		// Load the `Wordlift_Entity_Page_Service` class definition.
942
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
943
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php';
944
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php';
945
946
		/** Linked Data. */
947
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
948
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
949
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
950
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
951
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
952
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
953
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
954
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
955
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
956
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
957
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
958
959
		/** Linked Data Rendition. */
960
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
961
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
962
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
963
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
964
965
		/** Services. */
966
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
967
968
		/** Adapters. */
969
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
970
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
971
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
972
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
973
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php';
974
975
		/** Async Tasks. */
976
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
977
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
978
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
979
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
980
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php';
981
982
		/** Async Tasks. */
983
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php';
984
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
985
986
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
987
988
		/**
989
		 * The class responsible for defining all actions that occur in the admin area.
990
		 */
991
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
992
993
		/**
994
		 * The class to customize the entity list admin page.
995
		 */
996
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
997
998
		/**
999
		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
1000
		 */
1001
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
1002
1003
		/**
1004
		 * The Notice service.
1005
		 */
1006
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
1007
1008
		/**
1009
		 * The PrimaShop adapter.
1010
		 */
1011
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
1012
1013
		/**
1014
		 * The WordLift Dashboard service.
1015
		 */
1016
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
1017
1018
		/**
1019
		 * The admin 'Install wizard' page.
1020
		 */
1021
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
1022
1023
		/**
1024
		 * The WordLift entity type list admin page controller.
1025
		 */
1026
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1027
1028
		/**
1029
		 * The WordLift entity type settings admin page controller.
1030
		 */
1031
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
1032
1033
		/**
1034
		 * The admin 'Download Your Data' page.
1035
		 */
1036
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
1037
1038
		/**
1039
		 * The admin 'WordLift Settings' page.
1040
		 */
1041
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
1042
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
1043
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
1044
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
1045
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
1046
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
1047
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
1048
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
1049
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
1050
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
1051
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php';
1052
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
1053
1054
		/** Admin Pages */
1055
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1056
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
1057
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
1058
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
1059
1060
		/**
1061
		 * The class responsible for defining all actions that occur in the public-facing
1062
		 * side of the site.
1063
		 */
1064
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1065
1066
		/**
1067
		 * The shortcode abstract class.
1068
		 */
1069
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1070
1071
		/**
1072
		 * The Timeline shortcode.
1073
		 */
1074
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1075
1076
		/**
1077
		 * The Navigator shortcode.
1078
		 */
1079
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1080
1081
		/**
1082
		 * The chord shortcode.
1083
		 */
1084
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1085
1086
		/**
1087
		 * The geomap shortcode.
1088
		 */
1089
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1090
1091
		/**
1092
		 * The entity cloud shortcode.
1093
		 */
1094
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1095
1096
		/**
1097
		 * The entity glossary shortcode.
1098
		 */
1099
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1100
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1101
1102
		/**
1103
		 * The ShareThis service.
1104
		 */
1105
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1106
1107
		/**
1108
		 * The SEO service.
1109
		 */
1110
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1111
1112
		/**
1113
		 * The AMP service.
1114
		 */
1115
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1116
1117
		/** Widgets */
1118
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1119
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1120
1121
		$this->loader = new Wordlift_Loader();
1122
1123
		// Instantiate a global logger.
1124
		global $wl_logger;
1125
		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1126
1127
		// Load the `wl-api` end-point.
1128
		new Wordlift_Http_Api();
1129
1130
		// Load the Install Service.
1131
		$this->install_service = new Wordlift_Install_Service();
1132
1133
		/** Services. */
1134
		// Create the configuration service.
1135
		$this->configuration_service = new Wordlift_Configuration_Service();
1136
1137
		// Create an entity type service instance. It'll be later bound to the init action.
1138
		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1139
1140
		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1141
		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1142
1143
		// Create an instance of the UI service.
1144
		$this->ui_service = new Wordlift_UI_Service();
1145
1146
		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
1147
		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
1148
1149
		$this->sparql_service        = new Wordlift_Sparql_Service();
1150
		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1151
		$this->notice_service        = new Wordlift_Notice_Service();
1152
		$this->relation_service      = new Wordlift_Relation_Service();
1153
1154
		$entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1155
		$this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' );
1156
		$this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1157
		$this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1158
		$this->user_service       = new Wordlift_User_Service( $this->sparql_service, $this->entity_service );
1159
1160
		// Instantiate the JSON-LD service.
1161
		$property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1162
1163
		/** Linked Data. */
1164
		$this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1165
		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1166
1167
		$this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1168
1169
		// Create a new instance of the Redirect service.
1170
		$this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_service );
1171
		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1172
		$this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service );
1173
1174
		// Create a new instance of the Timeline service and Timeline shortcode.
1175
		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1176
1177
		$this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service );
1178
1179
		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1180
1181
		$this->topic_taxonomy_service        = new Wordlift_Topic_Taxonomy_Service();
1182
		$this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service();
1183
1184
		// Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1185
		$this->sharethis_service = new Wordlift_ShareThis_Service();
1186
1187
		// Create an instance of the PrimaShop adapter.
1188
		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1189
1190
		// Create an import service instance to hook later to WP's import function.
1191
		$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() );
1192
1193
		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1194
1195
		// Create the entity rating service.
1196
		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1197
1198
		// Create entity list customization (wp-admin/edit.php).
1199
		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1200
1201
		// Create a new instance of the Redirect service.
1202
		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1203
1204
		// Create an instance of the Publisher Service and the AJAX Adapter.
1205
		$this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service );
1206
		$this->property_factory  = new Wordlift_Property_Factory( $schema_url_property_service );
1207
		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1208
1209
		$attachment_service = new Wordlift_Attachment_Service();
1210
1211
		// Instantiate the JSON-LD service.
1212
		$property_getter                         = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1213
		$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 );
1214
		$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 );
1215
		$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 );
1216
		$this->jsonld_website_converter          = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1217
		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service );
1218
		$this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1219
1220
1221
		$this->key_validation_service    = new Wordlift_Key_Validation_Service( $this->configuration_service );
1222
		$this->content_filter_service    = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1223
		$this->relation_rebuild_service  = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1224
		$this->sample_data_service       = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1225
		$this->sample_data_ajax_adapter  = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1226
		$this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service );
1227
1228
		// Initialize the shortcodes.
1229
		new Wordlift_Navigator_Shortcode();
1230
		new Wordlift_Chord_Shortcode();
1231
		new Wordlift_Geomap_Shortcode();
1232
		new Wordlift_Timeline_Shortcode();
1233
		new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1234
		new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1235
1236
		// Initialize the SEO service.
1237
		new Wordlift_Seo_Service();
1238
1239
		// Initialize the AMP service.
1240
		new Wordlift_AMP_Service();
1241
1242
		/** Services. */
1243
		$this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1244
1245
		/** Adapters. */
1246
		$this->entity_type_adapter      = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1247
		$this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service );
1248
		$this->tinymce_adapter          = new Wordlift_Tinymce_Adapter( $this );
1249
		$this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service );
1250
		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1251
1252
		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
1253
		$this->rebuild_service = new Wordlift_Rebuild_Service(
1254
			$this->sparql_service,
1255
			$uri_service
1256
		);
1257
1258
		/** Async Tasks. */
1259
		new Wordlift_Sparql_Query_Async_Task();
1260
		new Wordlift_Batch_Analysis_Request_Async_Task();
1261
		new Wordlift_Batch_Analysis_Complete_Async_Task();
1262
		new Wordlift_Batch_Analysis_Complete_Async_Task();
1263
		new Wordlift_Push_References_Async_Task();
1264
1265
		/** WL Autocomplete. */
1266
		$this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service );
1267
		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service );
1268
1269
		/** WordPress Admin UI. */
1270
1271
		// UI elements.
1272
		$this->input_element           = new Wordlift_Admin_Input_Element();
1273
		$this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1274
		$this->select2_element         = new Wordlift_Admin_Select2_Element();
1275
		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1276
		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
1277
		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element );
1278
		$this->author_element          = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element );
1279
1280
		$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 );
1281
		$this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service );
1282
		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1283
1284
		// Pages.
1285
		new Wordlift_Admin_Post_Edit_Page( $this );
1286
		new Wordlift_Entity_Type_Admin_Service();
1287
1288
		// create an instance of the entity type list admin page controller.
1289
		$this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1290
1291
		// create an instance of the entity type etting admin page controller.
1292
		$this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1293
1294
		/** Widgets */
1295
		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1296
1297
		/* WordPress Admin. */
1298
		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1299
		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1300
1301
		// Create an instance of the install wizard.
1302
		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1303
1304
		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1305
1306
		// User Profile.
1307
		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1308
1309
		$this->entity_page_service = new Wordlift_Entity_Page_Service();
1310
1311
		// Load the debug service if WP is in debug mode.
1312
		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1313
			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1314
			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1315
		}
1316
1317
		// Remote Image Service.
1318
		new Wordlift_Remote_Image_Service();
1319
	}
1320
1321
	/**
1322
	 * Define the locale for this plugin for internationalization.
1323
	 *
1324
	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1325
	 * with WordPress.
1326
	 *
1327
	 * @since    1.0.0
1328
	 * @access   private
1329
	 */
1330
	private function set_locale() {
1331
1332
		$plugin_i18n = new Wordlift_i18n();
1333
		$plugin_i18n->set_domain( $this->get_plugin_name() );
1334
1335
		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1336
1337
	}
1338
1339
	/**
1340
	 * Register all of the hooks related to the admin area functionality
1341
	 * of the plugin.
1342
	 *
1343
	 * @since    1.0.0
1344
	 * @access   private
1345
	 */
1346
	private function define_admin_hooks() {
1347
1348
		$plugin_admin = new Wordlift_Admin(
1349
			$this->get_plugin_name(),
1350
			$this->get_version(),
1351
			$this->configuration_service,
1352
			$this->notice_service,
1353
			$this->user_service
1354
		);
1355
1356
		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1357
		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1358
1359
		// Hook the init action to taxonomy services.
1360
		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1361
		$this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 );
1362
1363
		// Hook the deleted_post_meta action to the Thumbnail service.
1364
		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1365
1366
		// Hook the added_post_meta action to the Thumbnail service.
1367
		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1368
1369
		// Hook the updated_post_meta action to the Thumbnail service.
1370
		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1371
1372
		// Hook the AJAX wl_timeline action to the Timeline service.
1373
		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1374
1375
		// Register custom allowed redirect hosts.
1376
		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1377
		// Hook the AJAX wordlift_redirect action to the Redirect service.
1378
		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1379
		// Hook the AJAX wordlift_redirect action to the Redirect service.
1380
		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1381
		// Hook the AJAX wordlift_redirect action to the Redirect service.
1382
		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1383
1384
		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1385
		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1386
		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1387
		$this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1388
1389
		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1390
		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1391
1392
		// Entity listing customization (wp-admin/edit.php)
1393
		// Add custom columns.
1394
		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1395
		// no explicit entity as it prevents handling of other post types.
1396
		$this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1397
		// Add 4W selection.
1398
		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1399
		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1400
		$this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1401
		$this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1402
		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1403
1404
		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1405
		// entities.
1406
		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1407
1408
		// Filter imported post meta.
1409
		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1410
1411
		// Notify the import service when an import starts and ends.
1412
		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1413
		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1414
1415
		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1416
		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1417
		$this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' );
1418
1419
		// Hook the menu to the Download Your Data page.
1420
		$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1421
		$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1422
		$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1423
1424
		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1425
		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1426
1427
		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1428
		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1429
		$this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' );
1430
		$this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1431
1432
		// Hook the AJAX wl_validate_key action to the Key Validation service.
1433
		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1434
1435
		// Hook the `admin_init` function to the Admin Setup.
1436
		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1437
1438
		// Hook the admin_init to the settings page.
1439
		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1440
1441
		$this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' );
1442
1443
		// Hook the menu creation on the general wordlift menu creation.
1444
		$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1445
		if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) {
1446
			// Add the functionality only if a flag is set in wp-config.php .
1447
			$this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 );
1448
		}
1449
1450
		// Hook key update.
1451
		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1452
		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1453
1454
		// Add additional action links to the WordLift plugin in the plugins page.
1455
		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1456
1457
		// Hook the AJAX `wl_publisher` action name.
1458
		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1459
1460
		// Hook row actions for the entity type list admin.
1461
		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1462
1463
		/** Ajax actions. */
1464
		$this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1465
1466
		// Hook capabilities manipulation to allow access to entity type admin
1467
		// page  on WordPress versions before 4.7.
1468
		global $wp_version;
1469
		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1470
			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1471
		}
1472
1473
		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1474
1475
		/** Adapters. */
1476
		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1477
		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' );
1478
		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' );
1479
		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' );
1480
		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' );
1481
		$this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1482
1483
		$this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1484
		$this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1485
1486
1487
		$this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 );
1488
		$this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 );
1489
1490
		// Handle the autocomplete request.
1491
		add_action( 'wp_ajax_wl_autocomplete', array(
1492
			$this->autocomplete_adapter,
1493
			'wl_autocomplete',
1494
		) );
1495
		add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1496
			$this->autocomplete_adapter,
1497
			'wl_autocomplete',
1498
		) );
1499
1500
		// Hooks to restrict multisite super admin from manipulating entity types.
1501
		if ( is_multisite() ) {
1502
			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1503
		}
1504
1505
		$deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service );
1506
1507
		add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) );
1508
		add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) );
1509
		add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) );
1510
	}
1511
1512
	/**
1513
	 * Register all of the hooks related to the public-facing functionality
1514
	 * of the plugin.
1515
	 *
1516
	 * @since    1.0.0
1517
	 * @access   private
1518
	 */
1519
	private function define_public_hooks() {
1520
1521
		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1522
1523
		// Register the entity post type.
1524
		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1525
		$this->loader->add_action( 'init', $this->install_service, 'install' );
1526
1527
		// Bind the link generation and handling hooks to the entity link service.
1528
		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1529
		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1530
		$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 );
1531
		$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 );
1532
1533
		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1534
		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1535
1536
		// Hook the content filter service to add entity links.
1537
		if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1538
			$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1539
		}
1540
1541
		// Hook the AJAX wl_timeline action to the Timeline service.
1542
		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1543
1544
		// Hook the ShareThis service.
1545
		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1546
		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1547
1548
		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1549
		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1550
1551
		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1552
		// in order to tweak WP's `WP_Query` to include entities in queries related
1553
		// to categories.
1554
		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1555
1556
		/*
1557
		 * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service`
1558
		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1559
		 * order of start time.
1560
		 */
1561
		$this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1562
1563
		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1564
1565
		// This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1566
		$this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1567
1568
	}
1569
1570
	/**
1571
	 * Run the loader to execute all of the hooks with WordPress.
1572
	 *
1573
	 * @since    1.0.0
1574
	 */
1575
	public function run() {
1576
		$this->loader->run();
1577
	}
1578
1579
	/**
1580
	 * The name of the plugin used to uniquely identify it within the context of
1581
	 * WordPress and to define internationalization functionality.
1582
	 *
1583
	 * @since     1.0.0
1584
	 * @return    string    The name of the plugin.
1585
	 */
1586
	public function get_plugin_name() {
1587
		return $this->plugin_name;
1588
	}
1589
1590
	/**
1591
	 * The reference to the class that orchestrates the hooks with the plugin.
1592
	 *
1593
	 * @since     1.0.0
1594
	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1595
	 */
1596
	public function get_loader() {
1597
		return $this->loader;
1598
	}
1599
1600
	/**
1601
	 * Retrieve the version number of the plugin.
1602
	 *
1603
	 * @since     1.0.0
1604
	 * @return    string    The version number of the plugin.
1605
	 */
1606
	public function get_version() {
1607
		return $this->version;
1608
	}
1609
1610
	/**
1611
	 * Load dependencies for WP-CLI.
1612
	 *
1613
	 * @since 3.18.0
1614
	 * @throws Exception
1615
	 */
1616
	private function load_cli_dependencies() {
1617
1618
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php';
1619
1620
		$push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service );
1621
1622
		WP_CLI::add_command( 'wl references push', $push_reference_data_command );
1623
1624
	}
1625
1626
}
1627