Completed
Push — develop ( 245e80...ac52df )
by David
03:51 queued 11s
created

Wordlift::run()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 3
rs 10
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
use Wordlift\Cache\Ttl_Cache;
16
use Wordlift\Faq\Faq_Content_Filter;
17
use Wordlift\Faq\Faq_Tinymce_Adapter;
18
use Wordlift\Jsonld\Jsonld_Adapter;
19
use Wordlift\Jsonld\Jsonld_By_Id_Endpoint;
20
use Wordlift\Jsonld\Jsonld_Endpoint;
21
use Wordlift\Jsonld\Jsonld_Service;
22
use Wordlift\Jsonld\Jsonld_User_Service;
23
24
/**
25
 * The core plugin class.
26
 *
27
 * This is used to define internationalization, admin-specific hooks, and
28
 * public-facing site hooks.
29
 *
30
 * Also maintains the unique identifier of this plugin as well as the current
31
 * version of the plugin.
32
 *
33
 * @since      1.0.0
34
 * @package    Wordlift
35
 * @subpackage Wordlift/includes
36
 * @author     WordLift <[email protected]>
37
 */
38
class Wordlift {
39
40
	//<editor-fold desc="## FIELDS">
41
42
	/**
43
	 * The loader that's responsible for maintaining and registering all hooks that power
44
	 * the plugin.
45
	 *
46
	 * @since    1.0.0
47
	 * @access   protected
48
	 * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
49
	 */
50
	protected $loader;
51
52
	/**
53
	 * The unique identifier of this plugin.
54
	 *
55
	 * @since    1.0.0
56
	 * @access   protected
57
	 * @var      string $plugin_name The string used to uniquely identify this plugin.
58
	 */
59
	protected $plugin_name;
60
61
	/**
62
	 * The current version of the plugin.
63
	 *
64
	 * @since    1.0.0
65
	 * @access   protected
66
	 * @var      string $version The current version of the plugin.
67
	 */
68
	protected $version;
69
70
	/**
71
	 * The {@link Wordlift_Tinymce_Adapter} instance.
72
	 *
73
	 * @since  3.12.0
74
	 * @access protected
75
	 * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
76
	 */
77
	protected $tinymce_adapter;
78
79
	/**
80
	 * The {@link Faq_Tinymce_Adapter} instance
81
	 * @since 3.26.0
82
	 * @access protected
83
	 * @var Faq_Tinymce_Adapter $faq_tinymce_adapter .
84
	 */
85
	//protected $faq_tinymce_adapter;
86
87
	/**
88
	 * The Thumbnail service.
89
	 *
90
	 * @since  3.1.5
91
	 * @access private
92
	 * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
93
	 */
94
	private $thumbnail_service;
95
96
	/**
97
	 * The UI service.
98
	 *
99
	 * @since  3.2.0
100
	 * @access private
101
	 * @var \Wordlift_UI_Service $ui_service The UI service.
102
	 */
103
	private $ui_service;
104
105
	/**
106
	 * The Schema service.
107
	 *
108
	 * @since  3.3.0
109
	 * @access protected
110
	 * @var \Wordlift_Schema_Service $schema_service The Schema service.
111
	 */
112
	protected $schema_service;
113
114
	/**
115
	 * The Entity service.
116
	 *
117
	 * @since  3.1.0
118
	 * @access protected
119
	 * @var \Wordlift_Entity_Service $entity_service The Entity service.
120
	 */
121
	protected $entity_service;
122
123
	/**
124
	 * The Topic Taxonomy service.
125
	 *
126
	 * @since  3.5.0
127
	 * @access private
128
	 * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
129
	 */
130
	private $topic_taxonomy_service;
131
132
	/**
133
	 * The Entity Types Taxonomy service.
134
	 *
135
	 * @since  3.18.0
136
	 * @access private
137
	 * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service.
138
	 */
139
	private $entity_types_taxonomy_service;
140
141
	/**
142
	 * The User service.
143
	 *
144
	 * @since  3.1.7
145
	 * @access protected
146
	 * @var \Wordlift_User_Service $user_service The User service.
147
	 */
148
	protected $user_service;
149
150
	/**
151
	 * The Timeline service.
152
	 *
153
	 * @since  3.1.0
154
	 * @access private
155
	 * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
156
	 */
157
	private $timeline_service;
158
159
	/**
160
	 * The Redirect service.
161
	 *
162
	 * @since  3.2.0
163
	 * @access private
164
	 * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
165
	 */
166
	private $redirect_service;
167
168
	/**
169
	 * The Notice service.
170
	 *
171
	 * @since  3.3.0
172
	 * @access private
173
	 * @var \Wordlift_Notice_Service $notice_service The Notice service.
174
	 */
175
	private $notice_service;
176
177
	/**
178
	 * The Entity list customization.
179
	 *
180
	 * @since  3.3.0
181
	 * @access protected
182
	 * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
183
	 */
184
	protected $entity_list_service;
185
186
	/**
187
	 * The Entity Types Taxonomy Walker.
188
	 *
189
	 * @since  3.1.0
190
	 * @access private
191
	 * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
192
	 */
193
	private $entity_types_taxonomy_walker;
194
195
	/**
196
	 * The ShareThis service.
197
	 *
198
	 * @since  3.2.0
199
	 * @access private
200
	 * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
201
	 */
202
	private $sharethis_service;
203
204
	/**
205
	 * The PrimaShop adapter.
206
	 *
207
	 * @since  3.2.3
208
	 * @access private
209
	 * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
210
	 */
211
	private $primashop_adapter;
212
213
	/**
214
	 * The WordLift Dashboard adapter.
215
	 *
216
	 * @since  3.4.0
217
	 * @access private
218
	 * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
219
	 */
220
	private $dashboard_service;
221
222
	/**
223
	 * The entity type service.
224
	 *
225
	 * @since  3.6.0
226
	 * @access private
227
	 * @var \Wordlift_Entity_Post_Type_Service
228
	 */
229
	private $entity_post_type_service;
230
231
	/**
232
	 * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
233
	 *
234
	 * @since  3.6.0
235
	 * @access private
236
	 * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance.
237
	 */
238
	private $entity_link_service;
239
240
	/**
241
	 * A {@link Wordlift_Sparql_Service} instance.
242
	 *
243
	 * @since    3.6.0
244
	 * @access   protected
245
	 * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
246
	 */
247
	protected $sparql_service;
248
249
	/**
250
	 * A {@link Wordlift_Import_Service} instance.
251
	 *
252
	 * @since  3.6.0
253
	 * @access private
254
	 * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
255
	 */
256
	private $import_service;
257
258
	/**
259
	 * A {@link Wordlift_Rebuild_Service} instance.
260
	 *
261
	 * @since  3.6.0
262
	 * @access private
263
	 * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
264
	 */
265
	private $rebuild_service;
266
267
	/**
268
	 * A {@link Wordlift_Jsonld_Service} instance.
269
	 *
270
	 * @since  3.7.0
271
	 * @access protected
272
	 * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
273
	 */
274
	protected $jsonld_service;
275
276
	/**
277
	 * A {@link Wordlift_Website_Jsonld_Converter} instance.
278
	 *
279
	 * @since  3.14.0
280
	 * @access protected
281
	 * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance.
282
	 */
283
	protected $jsonld_website_converter;
284
285
	/**
286
	 * A {@link Wordlift_Property_Factory} instance.
287
	 *
288
	 * @since  3.7.0
289
	 * @access private
290
	 * @var \Wordlift_Property_Factory $property_factory
291
	 */
292
	private $property_factory;
293
294
	/**
295
	 * The 'Download Your Data' page.
296
	 *
297
	 * @since  3.6.0
298
	 * @access private
299
	 * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
300
	 */
301
	private $download_your_data_page;
302
303
	/**
304
	 * The 'WordLift Settings' page.
305
	 *
306
	 * @since  3.11.0
307
	 * @access protected
308
	 * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
309
	 */
310
	protected $settings_page;
311
312
	/**
313
	 * The install wizard page.
314
	 *
315
	 * @since  3.9.0
316
	 * @access private
317
	 * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
318
	 */
319
	public $admin_setup;
320
321
	/**
322
	 * The Content Filter Service hooks up to the 'the_content' filter and provides
323
	 * linking of entities to their pages.
324
	 *
325
	 * @since  3.8.0
326
	 * @access private
327
	 * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
328
	 */
329
	private $content_filter_service;
330
331
	/**
332
	 * The Faq Content filter service
333
	 * @since  3.26.0
334
	 * @access private
335
	 * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance.
336
	 */
337
	private $faq_content_filter_service;
338
339
	/**
340
	 * A {@link Wordlift_Key_Validation_Service} instance.
341
	 *
342
	 * @since  3.9.0
343
	 * @access private
344
	 * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
345
	 */
346
	private $key_validation_service;
347
348
	/**
349
	 * A {@link Wordlift_Rating_Service} instance.
350
	 *
351
	 * @since  3.10.0
352
	 * @access private
353
	 * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
354
	 */
355
	private $rating_service;
356
357
	/**
358
	 * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
359
	 *
360
	 * @since  3.10.0
361
	 * @access protected
362
	 * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
363
	 */
364
	protected $post_to_jsonld_converter;
365
366
	/**
367
	 * A {@link Wordlift_Configuration_Service} instance.
368
	 *
369
	 * @since  3.10.0
370
	 * @access protected
371
	 * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
372
	 */
373
	protected $configuration_service;
374
375
	/**
376
	 * A {@link Wordlift_Install_Service} instance.
377
	 *
378
	 * @since  3.18.0
379
	 * @access protected
380
	 * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance.
381
	 */
382
	protected $install_service;
383
384
	/**
385
	 * A {@link Wordlift_Entity_Type_Service} instance.
386
	 *
387
	 * @since  3.10.0
388
	 * @access protected
389
	 * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
390
	 */
391
	protected $entity_type_service;
392
393
	/**
394
	 * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
395
	 *
396
	 * @since  3.10.0
397
	 * @access protected
398
	 * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
399
	 */
400
	protected $entity_post_to_jsonld_converter;
401
402
	/**
403
	 * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
404
	 *
405
	 * @since  3.10.0
406
	 * @access protected
407
	 * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
408
	 */
409
	protected $postid_to_jsonld_converter;
410
411
	/**
412
	 * The {@link Wordlift_Admin_Status_Page} class.
413
	 *
414
	 * @since  3.9.8
415
	 * @access private
416
	 * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
417
	 */
418
	private $status_page;
419
420
	/**
421
	 * The {@link Wordlift_Category_Taxonomy_Service} instance.
422
	 *
423
	 * @since  3.11.0
424
	 * @access protected
425
	 * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
426
	 */
427
	protected $category_taxonomy_service;
428
429
	/**
430
	 * The {@link Wordlift_Entity_Page_Service} instance.
431
	 *
432
	 * @since  3.11.0
433
	 * @access protected
434
	 * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance.
435
	 */
436
	protected $entity_page_service;
437
438
	/**
439
	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
440
	 *
441
	 * @since  3.11.0
442
	 * @access protected
443
	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
444
	 */
445
	protected $settings_page_action_link;
446
447
	/**
448
	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
449
	 *
450
	 * @since  3.11.0
451
	 * @access protected
452
	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
453
	 */
454
	protected $analytics_settings_page_action_link;
455
456
	/**
457
	 * The {@link Wordlift_Analytics_Connect} class.
458
	 *
459
	 * @since  3.11.0
460
	 * @access protected
461
	 * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class.
462
	 */
463
	protected $analytics_connect;
464
465
	/**
466
	 * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
467
	 *
468
	 * @since  3.11.0
469
	 * @access protected
470
	 * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
471
	 */
472
	protected $publisher_ajax_adapter;
473
474
	/**
475
	 * The {@link Wordlift_Admin_Input_Element} element renderer.
476
	 *
477
	 * @since  3.11.0
478
	 * @access protected
479
	 * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
480
	 */
481
	protected $input_element;
482
483
	/**
484
	 * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
485
	 *
486
	 * @since  3.13.0
487
	 * @access protected
488
	 * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
489
	 */
490
	protected $radio_input_element;
491
492
	/**
493
	 * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
494
	 *
495
	 * @since  3.11.0
496
	 * @access protected
497
	 * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
498
	 */
499
	protected $language_select_element;
500
501
	/**
502
	 * The {@link Wordlift_Admin_Country_Select_Element} element renderer.
503
	 *
504
	 * @since  3.18.0
505
	 * @access protected
506
	 * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer.
507
	 */
508
	protected $country_select_element;
509
510
	/**
511
	 * The {@link Wordlift_Admin_Publisher_Element} element renderer.
512
	 *
513
	 * @since  3.11.0
514
	 * @access protected
515
	 * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
516
	 */
517
	protected $publisher_element;
518
519
	/**
520
	 * The {@link Wordlift_Admin_Select2_Element} element renderer.
521
	 *
522
	 * @since  3.11.0
523
	 * @access protected
524
	 * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
525
	 */
526
	protected $select2_element;
527
528
	/**
529
	 * The controller for the entity type list admin page
530
	 *
531
	 * @since  3.11.0
532
	 * @access private
533
	 * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
534
	 */
535
	private $entity_type_admin_page;
536
537
	/**
538
	 * The controller for the entity type settings admin page
539
	 *
540
	 * @since  3.11.0
541
	 * @access private
542
	 * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
543
	 */
544
	private $entity_type_settings_admin_page;
545
546
	/**
547
	 * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
548
	 *
549
	 * @since  3.11.0
550
	 * @access protected
551
	 * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
552
	 */
553
	protected $related_entities_cloud_widget;
554
555
	/**
556
	 * The {@link Wordlift_Admin_Author_Element} instance.
557
	 *
558
	 * @since  3.14.0
559
	 * @access protected
560
	 * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
561
	 */
562
	protected $author_element;
563
564
	/**
565
	 * The {@link Wordlift_Sample_Data_Service} instance.
566
	 *
567
	 * @since  3.12.0
568
	 * @access protected
569
	 * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
570
	 */
571
	protected $sample_data_service;
572
573
	/**
574
	 * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
575
	 *
576
	 * @since  3.12.0
577
	 * @access protected
578
	 * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
579
	 */
580
	protected $sample_data_ajax_adapter;
581
582
	/**
583
	 * The {@link Wordlift_Relation_Rebuild_Service} instance.
584
	 *
585
	 * @since  3.14.3
586
	 * @access private
587
	 * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance.
588
	 */
589
	private $relation_rebuild_service;
590
591
	/**
592
	 * The {@link Wordlift_Relation_Rebuild_Adapter} instance.
593
	 *
594
	 * @since  3.14.3
595
	 * @access private
596
	 * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance.
597
	 */
598
	private $relation_rebuild_adapter;
599
600
	/**
601
	 * The {@link Wordlift_Reference_Rebuild_Service} instance.
602
	 *
603
	 * @since  3.18.0
604
	 * @access private
605
	 * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance.
606
	 */
607
	private $reference_rebuild_service;
608
609
	/**
610
	 * The {@link Wordlift_Google_Analytics_Export_Service} instance.
611
	 *
612
	 * @since  3.16.0
613
	 * @access protected
614
	 * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance.
615
	 */
616
	protected $google_analytics_export_service;
617
618
	/**
619
	 * {@link Wordlift}'s singleton instance.
620
	 *
621
	 * @since  3.15.0
622
	 * @access protected
623
	 * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance.
624
	 */
625
	protected $entity_type_adapter;
626
627
	/**
628
	 * The {@link Wordlift_Storage_Factory} instance.
629
	 *
630
	 * @since  3.15.0
631
	 * @access protected
632
	 * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance.
633
	 */
634
	protected $storage_factory;
635
636
	/**
637
	 * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
638
	 *
639
	 * @since  3.15.0
640
	 * @access protected
641
	 * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
642
	 */
643
	protected $rendition_factory;
644
645
	/**
646
	 * The {@link Wordlift_Autocomplete_Adapter} instance.
647
	 *
648
	 * @since  3.15.0
649
	 * @access private
650
	 * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance.
651
	 */
652
	private $autocomplete_adapter;
653
654
	/**
655
	 * The {@link Wordlift_Relation_Service} instance.
656
	 *
657
	 * @since  3.15.0
658
	 * @access protected
659
	 * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
660
	 */
661
	protected $relation_service;
662
663
	/**
664
	 * The {@link Wordlift_Cached_Post_Converter} instance.
665
	 *
666
	 * @since  3.16.0
667
	 * @access protected
668
	 * @var  \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance.
669
	 *
670
	 */
671
	protected $cached_postid_to_jsonld_converter;
672
673
	/**
674
	 * The {@link Wordlift_Entity_Uri_Service} instance.
675
	 *
676
	 * @since  3.16.3
677
	 * @access protected
678
	 * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
679
	 */
680
	protected $entity_uri_service;
681
682
	/**
683
	 * The {@link Wordlift_Publisher_Service} instance.
684
	 *
685
	 * @since  3.19.0
686
	 * @access protected
687
	 * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
688
	 */
689
	protected $publisher_service;
690
691
	/**
692
	 * The {@link Wordlift_Context_Cards_Service} instance.
693
	 *
694
	 * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance.
695
	 */
696
	protected $context_cards_service;
697
698
	/**
699
	 * {@link Wordlift}'s singleton instance.
700
	 *
701
	 * @since  3.11.2
702
	 * @access private
703
	 * @var Wordlift $instance {@link Wordlift}'s singleton instance.
704
	 */
705
	private static $instance;
706
707
	//</editor-fold>
708
709
	/**
710
	 * Define the core functionality of the plugin.
711
	 *
712
	 * Set the plugin name and the plugin version that can be used throughout the plugin.
713
	 * Load the dependencies, define the locale, and set the hooks for the admin area and
714
	 * the public-facing side of the site.
715
	 *
716
	 * @since    1.0.0
717
	 */
718
	public function __construct() {
719
720
		self::$instance = $this;
721
722
		$this->plugin_name = 'wordlift';
723
		$this->version     = '3.27.6.3';
724
		$this->load_dependencies();
725
		$this->set_locale();
726
		$this->define_admin_hooks();
727
		$this->define_public_hooks();
728
729
		// If we're in `WP_CLI` load the related files.
730
		if ( class_exists( 'WP_CLI' ) ) {
731
			$this->load_cli_dependencies();
732
		}
733
734
	}
735
736
	/**
737
	 * Get the singleton instance.
738
	 *
739
	 * @return Wordlift The {@link Wordlift} singleton instance.
740
	 * @since 3.11.2
741
	 *
742
	 */
743
	public static function get_instance() {
744
745
		return self::$instance;
746
	}
747
748
	/**
749
	 * Load the required dependencies for this plugin.
750
	 *
751
	 * Include the following files that make up the plugin:
752
	 *
753
	 * - Wordlift_Loader. Orchestrates the hooks of the plugin.
754
	 * - Wordlift_i18n. Defines internationalization functionality.
755
	 * - Wordlift_Admin. Defines all hooks for the admin area.
756
	 * - Wordlift_Public. Defines all hooks for the public side of the site.
757
	 *
758
	 * Create an instance of the loader which will be used to register the hooks
759
	 * with WordPress.
760
	 *
761
	 * @throws Exception
762
	 * @since    1.0.0
763
	 * @access   private
764
	 */
765
	private function load_dependencies() {
766
767
		/**
768
		 * The class responsible for orchestrating the actions and filters of the
769
		 * core plugin.
770
		 */
771
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
772
773
		// The class responsible for plugin uninstall.
774
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php';
775
776
		/**
777
		 * The class responsible for defining internationalization functionality
778
		 * of the plugin.
779
		 */
780
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
781
782
		/**
783
		 * WordLift's supported languages.
784
		 */
785
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
786
787
		/**
788
		 * WordLift's supported countries.
789
		 */
790
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php';
791
792
		/**
793
		 * Provide support functions to sanitize data.
794
		 */
795
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
796
797
		/** Services. */
798
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
799
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
800
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
801
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
802
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
803
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
804
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
805
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
806
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
807
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php';
808
809
		/**
810
		 * The Query builder.
811
		 */
812
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
813
814
		/**
815
		 * The Schema service.
816
		 */
817
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
818
819
		/**
820
		 * The schema:url property service.
821
		 */
822
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
823
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
824
825
		/**
826
		 * The UI service.
827
		 */
828
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
829
830
		/**
831
		 * The Thumbnail service.
832
		 */
833
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
834
835
		/**
836
		 * The Entity Types Taxonomy service.
837
		 */
838
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
839
840
		/**
841
		 * The Entity service.
842
		 */
843
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
844
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
845
846
		// Add the entity rating service.
847
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
848
849
		/**
850
		 * The User service.
851
		 */
852
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
853
854
		/**
855
		 * The Timeline service.
856
		 */
857
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
858
859
		/**
860
		 * The Topic Taxonomy service.
861
		 */
862
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
863
864
		/**
865
		 * The SPARQL service.
866
		 */
867
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
868
869
		/**
870
		 * The WordLift import service.
871
		 */
872
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
873
874
		/**
875
		 * The WordLift URI service.
876
		 */
877
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
878
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
879
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
880
881
		/**
882
		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
883
		 */
884
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php';
885
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php';
886
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php';
887
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php';
888
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
889
890
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
891
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
892
893
		/**
894
		 * Load the converters.
895
		 */
896
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
897
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
898
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
899
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
900
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
901
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
902
903
		/**
904
		 * Load cache-related files.
905
		 */
906
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
907
908
		/**
909
		 * Load the content filter.
910
		 */
911
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
912
913
		/*
914
		 * Load the excerpt helper.
915
		 */
916
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
917
918
		/**
919
		 * Load the JSON-LD service to publish entities using JSON-LD.s
920
		 *
921
		 * @since 3.8.0
922
		 */
923
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
924
925
		// The Publisher Service and the AJAX adapter.
926
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
927
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
928
929
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
930
931
		/**
932
		 * Load the WordLift key validation service.
933
		 */
934
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
935
936
		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
937
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
938
939
		// Load the `Wordlift_Entity_Page_Service` class definition.
940
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
941
942
		/** Linked Data. */
943
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
944
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
945
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
946
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
947
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
948
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
949
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
950
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
951
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
952
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
953
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
954
955
		/** Linked Data Rendition. */
956
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
957
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
958
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
959
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
960
961
		/** Services. */
962
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
963
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php';
964
965
		/** Adapters. */
966
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
967
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
968
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
969
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
970
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php';
971
972
		/** Async Tasks. */
973
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
974
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
975
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php';
976
977
		/** Autocomplete. */
978
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
979
980
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
981
982
		/** Analytics */
983
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php';
984
985
		/**
986
		 * The class responsible for defining all actions that occur in the admin area.
987
		 */
988
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
989
990
		/**
991
		 * The class to customize the entity list admin page.
992
		 */
993
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
994
995
		/**
996
		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
997
		 */
998
		global $wp_version;
999
		if ( version_compare( $wp_version, '5.3', '<' ) ) {
1000
			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
1001
		} else {
1002
			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php';
1003
		}
1004
1005
		/**
1006
		 * The Notice service.
1007
		 */
1008
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
1009
1010
		/**
1011
		 * The PrimaShop adapter.
1012
		 */
1013
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
1014
1015
		/**
1016
		 * The WordLift Dashboard service.
1017
		 */
1018
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
1019
1020
		/**
1021
		 * The admin 'Install wizard' page.
1022
		 */
1023
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
1024
1025
		/**
1026
		 * The WordLift entity type list admin page controller.
1027
		 */
1028
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1029
1030
		/**
1031
		 * The WordLift entity type settings admin page controller.
1032
		 */
1033
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
1034
1035
		/**
1036
		 * The admin 'Download Your Data' page.
1037
		 */
1038
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
1039
1040
		/**
1041
		 * The admin 'WordLift Settings' page.
1042
		 */
1043
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php';
1044
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php';
1045
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php';
1046
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php';
1047
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php';
1048
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php';
1049
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php';
1050
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php';
1051
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php';
1052
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php';
1053
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
1054
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
1055
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php';
1056
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
1057
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php';
1058
1059
		/** Admin Pages */
1060
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
1061
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
1062
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php';
1063
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
1064
1065
		/**
1066
		 * The class responsible for defining all actions that occur in the public-facing
1067
		 * side of the site.
1068
		 */
1069
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1070
1071
		/**
1072
		 * The shortcode abstract class.
1073
		 */
1074
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1075
1076
		/**
1077
		 * The Timeline shortcode.
1078
		 */
1079
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1080
1081
		/**
1082
		 * The Navigator shortcode.
1083
		 */
1084
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1085
1086
		/**
1087
		 * The Products Navigator shortcode.
1088
		 */
1089
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php';
1090
1091
		/**
1092
		 * The chord shortcode.
1093
		 */
1094
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1095
1096
		/**
1097
		 * The geomap shortcode.
1098
		 */
1099
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1100
1101
		/**
1102
		 * The entity cloud shortcode.
1103
		 */
1104
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1105
1106
		/**
1107
		 * The entity glossary shortcode.
1108
		 */
1109
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1110
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1111
1112
		/**
1113
		 * Faceted Search shortcode.
1114
		 */
1115
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php';
1116
1117
		/**
1118
		 * The ShareThis service.
1119
		 */
1120
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1121
1122
		/**
1123
		 * The SEO service.
1124
		 */
1125
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1126
1127
		/**
1128
		 * The AMP service.
1129
		 */
1130
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1131
1132
		/** Widgets */
1133
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1134
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1135
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php';
1136
1137
		/*
1138
		 * Schema.org Services.
1139
		 *
1140
		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1141
		 */
1142
		if ( WL_ALL_ENTITY_TYPES ) {
1143
			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php';
1144
			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php';
1145
			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php';
1146
			new Wordlift_Schemaorg_Sync_Service();
1147
			$schemaorg_property_service = new Wordlift_Schemaorg_Property_Service();
1148
			new Wordlift_Schemaorg_Class_Service();
1149
		} else {
1150
			$schemaorg_property_service = null;
1151
		}
1152
1153
		$this->loader = new Wordlift_Loader();
1154
1155
		// Instantiate a global logger.
1156
		global $wl_logger;
1157
		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1158
1159
		// Load the `wl-api` end-point.
1160
		new Wordlift_Http_Api();
1161
1162
		// Load the Install Service.
1163
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
1164
		$this->install_service = new Wordlift_Install_Service();
1165
1166
		/** Services. */
1167
		// Create the configuration service.
1168
		$this->configuration_service = new Wordlift_Configuration_Service();
1169
		$api_service                 = new Wordlift_Api_Service( $this->configuration_service );
1170
1171
		// Create an entity type service instance. It'll be later bound to the init action.
1172
		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1173
1174
		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1175
		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1176
1177
		// Create an instance of the UI service.
1178
		$this->ui_service = new Wordlift_UI_Service();
1179
1180
		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
1181
		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
1182
1183
		$this->sparql_service        = new Wordlift_Sparql_Service();
1184
		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1185
		$this->notice_service        = new Wordlift_Notice_Service();
1186
		$this->relation_service      = new Wordlift_Relation_Service();
1187
1188
		$entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1189
		$this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1190
		$this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1191
		$this->user_service       = new Wordlift_User_Service( $this->sparql_service, $this->entity_service );
1192
1193
		// Instantiate the JSON-LD service.
1194
		$property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1195
1196
		/** Linked Data. */
1197
		$this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1198
		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1199
1200
		$this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1201
1202
		// Create a new instance of the Redirect service.
1203
		$this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_uri_service );
1204
		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1205
1206
		if ( apply_filters( 'wl_feature__enable__dataset-ng', false ) ) {
1207
			new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service );
1208
		}
1209
1210
		// Create a new instance of the Timeline service and Timeline shortcode.
1211
		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1212
1213
		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1214
1215
		$this->topic_taxonomy_service        = new Wordlift_Topic_Taxonomy_Service();
1216
		$this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service();
1217
1218
		// Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1219
		$this->sharethis_service = new Wordlift_ShareThis_Service();
1220
1221
		// Create an instance of the PrimaShop adapter.
1222
		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1223
1224
		// Create an import service instance to hook later to WP's import function.
1225
		$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() );
1226
1227
		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1228
1229
		// Create the entity rating service.
1230
		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1231
1232
		// Create entity list customization (wp-admin/edit.php).
1233
		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1234
1235
		// Create a new instance of the Redirect service.
1236
		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1237
1238
		// Create an instance of the Publisher Service and the AJAX Adapter.
1239
		$this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service );
1240
		$this->property_factory  = new Wordlift_Property_Factory( $schema_url_property_service );
1241
		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1242
1243
		$attachment_service = new Wordlift_Attachment_Service();
1244
1245
		// Instantiate the JSON-LD service.
1246
		$property_getter                       = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1247
		$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 );
1248
		$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, $schemaorg_property_service, $this->post_to_jsonld_converter );
1249
		$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 );
1250
		$this->jsonld_website_converter        = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1251
1252
		$jsonld_cache                            = new Ttl_Cache( 'jsonld', 86400 );
1253
		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache );
1254
		$this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1255
1256
		/*
1257
		 * Load the `Wordlift_Term_JsonLd_Adapter`.
1258
		 *
1259
		 * @see https://github.com/insideout10/wordlift-plugin/issues/892
1260
		 *
1261
		 * @since 3.20.0
1262
		 */
1263
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php';
1264
		$term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service );
1265
		$jsonld_service      = new Jsonld_Service(
1266
			$this->jsonld_service,
1267
			$term_jsonld_adapter,
1268
			new Jsonld_User_Service( $this->user_service ) );
1269
		new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service );
1270
1271
		// Prints the JSON-LD in the head.
1272
		new Jsonld_Adapter( $this->jsonld_service );
1273
1274
		new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service );
1275
1276
		$this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service );
1277
		$this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1278
		// Creating Faq Content filter service.
1279
		$this->faq_content_filter_service = new Faq_Content_Filter();
1280
		$this->relation_rebuild_service   = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1281
		$this->sample_data_service        = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1282
		$this->sample_data_ajax_adapter   = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1283
		$this->reference_rebuild_service  = new Wordlift_Reference_Rebuild_Service( $this->entity_service );
1284
1285
		$this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' );
1286
1287
		/**
1288
		 * Filter: wl_feature__enable__blocks.
1289
		 *
1290
		 * @param bool whether the blocks needed to be registered, defaults to true.
1291
		 *
1292
		 * @return bool
1293
		 * @since 3.27.6
1294
		 */
1295
		<<<<
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...
1296
		<<< HEAD
1297
=======
1298
		wp_register_script( 'wl_enabled_blocks', false );
1299
		$enabled_blocks = array( 'wordlift/products-navigator' );
1300
>>>>>>> master
1301
1302
		if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
1303
			// Initialize the short-codes.
1304
			new Wordlift_Navigator_Shortcode();
1305
			new Wordlift_Chord_Shortcode();
1306
			new Wordlift_Geomap_Shortcode();
1307
			new Wordlift_Timeline_Shortcode();
1308
			new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1309
			new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1310
			new Wordlift_Faceted_Search_Shortcode();
1311
<<<<<<< HEAD
1312
=======
1313
1314
			// To intimate JS
1315
			$enabled_blocks = array_merge( $enabled_blocks, array(
1316
				'wordlift/navigator',
1317
				'wordlift/chord',
1318
				'wordlift/geomap',
1319
				'wordlift/timeline',
1320
				'wordlift/cloud',
1321
				'wordlift/vocabulary',
1322
				'wordlift/faceted-search'
1323
			) );
1324
>>>>>>> master
1325
		}
1326
1327
		new Wordlift_Products_Navigator_Shortcode();
1328
1329
1330
		// Initialize the Context Cards Service
1331
		$this->context_cards_service = new Wordlift_Context_Cards_Service();
1332
1333
		// Initialize the SEO service.
1334
		new Wordlift_Seo_Service();
1335
1336
		// Initialize the AMP service.
1337
		new Wordlift_AMP_Service( $this->jsonld_service );
1338
1339
		/** Services. */
1340
		$this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1341
		new Wordlift_Image_Service();
1342
1343
		/** Adapters. */
1344
		$this->entity_type_adapter    = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1345
		$this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service );
1346
		$this->tinymce_adapter        = new Wordlift_Tinymce_Adapter( $this );
1347
		//$this->faq_tinymce_adapter      = new Faq_Tinymce_Adapter();
1348
		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1349
1350
		/*
1351
		 * Exclude our public js from WP-Rocket.
1352
		 *
1353
		 * @since 3.19.4
1354
		 *
1355
		 * @see https://github.com/insideout10/wordlift-plugin/issues/842.
1356
		 */
1357
		new Wordlift_WpRocket_Adapter();
1358
1359
		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
1360
		$this->rebuild_service = new Wordlift_Rebuild_Service(
1361
			$this->sparql_service,
1362
			$uri_service
1363
		);
1364
1365
		/** Async Tasks. */
1366
		if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) {
1367
			new Wordlift_Sparql_Query_Async_Task();
1368
			new Wordlift_Push_References_Async_Task();
1369
		}
1370
1371
		/** WordPress Admin UI. */
1372
1373
		// UI elements.
1374
		$this->input_element           = new Wordlift_Admin_Input_Element();
1375
		$this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1376
		$this->select2_element         = new Wordlift_Admin_Select2_Element();
1377
		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1378
		$this->country_select_element  = new Wordlift_Admin_Country_Select_Element();
1379
		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
1380
		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element );
1381
		$this->author_element          = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element );
1382
1383
		$this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element );
1384
		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1385
1386
		$this->analytics_settings_page             = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element );
1387
		$this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page );
1388
		$this->analytics_connect                   = new Wordlift_Analytics_Connect();
1389
1390
		// Pages.
1391
		/*
1392
		 * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box.
1393
		 *
1394
		 * @since 3.20.3
1395
		 *
1396
		 * @see https://github.com/insideout10/wordlift-plugin/issues/914
1397
		 */
1398
		if ( apply_filters( 'wl_can_see_classification_box', true ) ) {
1399
			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1400
			new Wordlift_Admin_Post_Edit_Page( $this );
1401
		}
1402
		new Wordlift_Entity_Type_Admin_Service();
1403
1404
		// create an instance of the entity type list admin page controller.
1405
		$this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1406
1407
		// create an instance of the entity type setting admin page controller.
1408
		$this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1409
1410
		/** Widgets */
1411
		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1412
1413
		/* WordPress Admin. */
1414
		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1415
		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1416
1417
		// Create an instance of the install wizard.
1418
		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element );
1419
1420
		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1421
1422
		// User Profile.
1423
		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1424
1425
		$this->entity_page_service = new Wordlift_Entity_Page_Service();
1426
1427
		// Load the debug service if WP is in debug mode.
1428
		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1429
			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1430
			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1431
		}
1432
1433
		// Remote Image Service.
1434
		new Wordlift_Remote_Image_Service();
1435
1436
		/*
1437
		 * Provides mappings between post types and entity types.
1438
		 *
1439
		 * @since 3.20.0
1440
		 *
1441
		 * @see https://github.com/insideout10/wordlift-plugin/issues/852.
1442
		 */
1443
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php';
1444
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php';
1445
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php';
1446
1447
		// Create an instance of the Mapping Service and assign it to the Ajax Adapter.
1448
		new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) );
1449
1450
		/*
1451
		 * Batch Operations. They're similar to Batch Actions but do not require working on post types.
1452
		 *
1453
		 * Eventually Batch Actions will become Batch Operations.
1454
		 *
1455
		 * @since 3.20.0
1456
		 */
1457
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php';
1458
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php';
1459
1460
		/*
1461
		 * Add the Search Keywords taxonomy to manage the Search Keywords on WLS.
1462
		 *
1463
		 * @link https://github.com/insideout10/wordlift-plugin/issues/761
1464
		 *
1465
		 * @since 3.20.0
1466
		 */
1467
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php';
1468
		new Wordlift_Search_Keyword_Taxonomy( $api_service );
1469
1470
		/*
1471
		 * Load the Mappings JSON-LD post processing.
1472
		 *
1473
		 * @since 3.25.0
1474
		 */
1475
1476
		$mappings_dbo           = new Mappings_DBO();
1477
		$default_rule_validator = new Taxonomy_Rule_Validator();
1478
		new Post_Type_Rule_Validator();
1479
		// Taxonomy term rule validator for validating rules for term pages.
1480
		new Taxonomy_Term_Rule_Validator();
1481
		$rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator );
1482
		$rule_groups_validator    = new Rule_Groups_Validator( $rule_validators_registry );
1483
		$mappings_validator       = new Mappings_Validator( $mappings_dbo, $rule_groups_validator );
1484
1485
		new Url_To_Entity_Transform_Function( $this->entity_uri_service );
1486
		new Taxonomy_To_Terms_Transform_Function();
1487
		new Post_Id_To_Entity_Transform_Function();
1488
		$mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry();
1489
1490
		/**
1491
		 * @since 3.27.1
1492
		 * Intiailize the acf group data formatter.
1493
		 */
1494
		new Acf_Group_Formatter();
1495
		new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry );
1496
1497
		/**
1498
		 * @since 3.26.0
1499
		 * Initialize the Faq JSON LD converter here - disabled.
1500
		 */
1501
		// new Faq_To_Jsonld_Converter();
1502
		/*
1503
		 * Use the Templates Ajax Endpoint to load HTML templates for the legacy Angular app via admin-ajax.php
1504
		 * end-point.
1505
		 *
1506
		 * @see https://github.com/insideout10/wordlift-plugin/issues/834
1507
		 * @since 3.24.4
1508
		 */
1509
		new Templates_Ajax_Endpoint();
1510
		// Call this static method to register FAQ routes to rest api - disabled
1511
		//Faq_Rest_Controller::register_routes();
1512
1513
		/*
1514
		 * Create a singleton for the Analysis_Response_Ops_Factory.
1515
		 */
1516
		$entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service );
1517
		new Analysis_Response_Ops_Factory(
1518
			$this->entity_uri_service,
1519
			$this->entity_service,
1520
			$this->entity_type_service,
1521
			$this->storage_factory->post_images(),
1522
			$entity_helper
1523
		);
1524
1525
		/** WL Autocomplete. */
1526
		$autocomplete_service       = new All_Autocomplete_Service( array(
1527
			new Local_Autocomplete_Service(),
1528
			new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ),
1529
		) );
1530
		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service );
1531
1532
		/**
1533
		 * @since 3.27.2
1534
		 * Integrate the recipe maker jsonld & set recipe
1535
		 * as default entity type to the wprm_recipe CPT.
1536
		 */
1537
		new Recipe_Maker_Post_Type_Hook();
1538
		$recipe_maker_validation_service = new Recipe_Maker_Validation_Service();
1539
		new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service );
1540
		new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service );
1541
		new Recipe_Maker_Warning( $recipe_maker_validation_service );
1542
		new Yoast_Jsonld( $recipe_maker_validation_service );
1543
1544
		/**
1545
		 * @since 3.27.4
1546
		 * Add the faq duplicate markup hook.
1547
		 */
1548
		new Faq_Duplicate_Markup_Remover();
1549
	}
1550
1551
	/**
1552
	 * Define the locale for this plugin for internationalization.
1553
	 *
1554
	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1555
	 * with WordPress.
1556
	 *
1557
	 * @since    1.0.0
1558
	 * @access   private
1559
	 */
1560
	private function set_locale() {
1561
1562
		$plugin_i18n = new Wordlift_i18n();
1563
		$plugin_i18n->set_domain( $this->get_plugin_name() );
1564
1565
		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1566
1567
	}
1568
1569
	/**
1570
	 * Register all of the hooks related to the admin area functionality
1571
	 * of the plugin.
1572
	 *
1573
	 * @since    1.0.0
1574
	 * @access   private
1575
	 */
1576
	private function define_admin_hooks() {
1577
1578
		$plugin_admin = new Wordlift_Admin(
1579
			$this->get_plugin_name(),
1580
			$this->get_version(),
1581
			$this->configuration_service,
1582
			$this->notice_service,
1583
			$this->user_service
1584
		);
1585
1586
		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1587
		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 );
1588
1589
		// Hook the init action to taxonomy services.
1590
		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1591
		$this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 );
1592
1593
		// Hook the deleted_post_meta action to the Thumbnail service.
1594
		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1595
1596
		// Hook the added_post_meta action to the Thumbnail service.
1597
		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1598
1599
		// Hook the updated_post_meta action to the Thumbnail service.
1600
		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1601
1602
		// Hook the AJAX wl_timeline action to the Timeline service.
1603
		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1604
1605
		// Register custom allowed redirect hosts.
1606
		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1607
		// Hook the AJAX wordlift_redirect action to the Redirect service.
1608
		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1609
1610
		/*
1611
		 * The old dashboard is replaced with dashboard v2.
1612
		 *
1613
		 * The old dashboard service is still loaded because its functions are used.
1614
		 *
1615
		 * @see https://github.com/insideout10/wordlift-plugin/issues/879
1616
		 *
1617
		 * @since 3.20.0
1618
		 */
1619
		// Hook the AJAX wordlift_redirect action to the Redirect service.
1620
		// $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1621
		// Hook the AJAX wordlift_redirect action to the Redirect service.
1622
		// $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1623
1624
		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1625
		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1626
		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1627
		$this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1628
1629
		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1630
		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1631
1632
		// Entity listing customization (wp-admin/edit.php)
1633
		// Add custom columns.
1634
		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1635
		// no explicit entity as it prevents handling of other post types.
1636
		$this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1637
		// Add 4W selection.
1638
		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1639
		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1640
		$this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1641
		$this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1642
1643
		/*
1644
		 * If `All Entity Types` is disable, use the radio button Walker.
1645
		 *
1646
		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1647
		 */
1648
		if ( ! WL_ALL_ENTITY_TYPES ) {
1649
			$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1650
		}
1651
1652
		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1653
		// entities.
1654
		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1655
1656
		// Filter imported post meta.
1657
		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1658
1659
		// Notify the import service when an import starts and ends.
1660
		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1661
		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1662
1663
		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1664
		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1665
		$this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' );
1666
1667
		/**
1668
		 * Filter: wl_feature__enable__screens.
1669
		 *
1670
		 * @param bool whether the screens needed to be registered, defaults to true.
1671
		 *
1672
		 * @return bool
1673
		 * @since 3.27.6
1674
		 */
1675
		if ( apply_filters( 'wl_feature__enable__screens', true ) ) {
1676
			// Hook the menu to the Download Your Data page.
1677
			$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1678
			$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1679
			$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1680
		}
1681
		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1682
		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1683
1684
		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1685
		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1686
		$this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' );
1687
		$this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1688
1689
		// Hook the AJAX wl_validate_key action to the Key Validation service.
1690
		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1691
1692
		// Hook the AJAX wl_update_country_options action to the countries.
1693
		$this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' );
1694
1695
		// Hook the `admin_init` function to the Admin Setup.
1696
		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1697
1698
		// Hook the admin_init to the settings page.
1699
		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1700
		$this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' );
1701
1702
		$this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' );
1703
1704
		// Hook the menu creation on the general wordlift menu creation.
1705
		/**
1706
		 * Filter: wl_feature__enable__screens.
1707
		 *
1708
		 * @param bool whether the screens needed to be registered, defaults to true.
1709
		 *
1710
		 * @return bool
1711
		 * @since 3.27.6
1712
		 */
1713
		if ( apply_filters( 'wl_feature__enable__screens', true ) ) {
1714
			$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1715
		}
1716
		/*
1717
		 * Display the `Wordlift_Admin_Search_Rankings_Page` page.
1718
		 *
1719
		 * @link https://github.com/insideout10/wordlift-plugin/issues/761
1720
		 *
1721
		 * @since 3.20.0
1722
		 */
1723
		if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) {
1724
			/**
1725
			 * Filter: wl_feature__enable__screens.
1726
			 *
1727
			 * @param bool whether the screens needed to be registered, defaults to true.
1728
			 *
1729
			 * @return bool
1730
			 * @since 3.27.6
1731
			 */
1732
			if ( apply_filters( 'wl_feature__enable__screens', true ) ) {
1733
				$admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page();
1734
				$this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' );
1735
			}
1736
		}
1737
1738
		// Hook key update.
1739
		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1740
		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1741
1742
		// Add additional action links to the WordLift plugin in the plugins page.
1743
		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1744
1745
		/*
1746
		 * Remove the Analytics Settings link from the plugin page.
1747
		 *
1748
		 * @see https://github.com/insideout10/wordlift-plugin/issues/932
1749
		 * @since 3.21.1
1750
		 */
1751
		// $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 );
1752
1753
		// Hook the AJAX `wl_publisher` action name.
1754
		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1755
1756
		// Hook row actions for the entity type list admin.
1757
		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1758
1759
		/** Ajax actions. */
1760
		$this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1761
1762
		// Hook capabilities manipulation to allow access to entity type admin
1763
		// page  on WordPress versions before 4.7.
1764
		global $wp_version;
1765
		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1766
			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1767
		}
1768
1769
		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1770
1771
		/** Adapters. */
1772
		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1773
		/**
1774
		 * Disabling Faq temporarily.
1775
		 * Load the tinymce editor button on the tool bar.
1776
		 * @since 3.26.0
1777
		 */
1778
		//$this->loader->add_filter( 'tiny_mce_before_init', $this->faq_tinymce_adapter, 'register_custom_tags' );
1779
		//$this->loader->add_filter( 'mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 );
1780
		//$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 );
1781
1782
1783
		$this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1784
		$this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1785
		$this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1786
		/**
1787
		 * @since 3.26.0
1788
		 */
1789
		if ( apply_filters( 'wl_feature__enable__post_excerpt', true ) ) {
1790
			$excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter();
1791
			$this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' );
1792
			// Adding Rest route for the post excerpt
1793
			Post_Excerpt_Rest_Controller::register_routes();
1794
		}
1795
1796
		$this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 );
1797
		$this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 );
1798
1799
		// Handle the autocomplete request.
1800
		add_action( 'wp_ajax_wl_autocomplete', array(
1801
			$this->autocomplete_adapter,
1802
			'wl_autocomplete',
1803
		) );
1804
		add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1805
			$this->autocomplete_adapter,
1806
			'wl_autocomplete',
1807
		) );
1808
1809
		// Hooks to restrict multisite super admin from manipulating entity types.
1810
		if ( is_multisite() ) {
1811
			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1812
		}
1813
1814
		$deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service );
1815
1816
		add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) );
1817
		add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) );
1818
		add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) );
1819
1820
		/**
1821
		 * Always allow the `wordlift/classification` block.
1822
		 *
1823
		 * @since 3.23.0
1824
		 */
1825
		add_filter( 'allowed_block_types', function ( $value ) {
1826
1827
			if ( true === $value ) {
1828
				return $value;
1829
			}
1830
1831
			return array_merge( (array) $value, array( 'wordlift/classification' ) );
1832
		}, PHP_INT_MAX );
1833
1834
		/**
1835
		 * @since 3.27.7
1836
		 * @see https://github.com/insideout10/wordlift-plugin/issues/1214
1837
		 */
1838
		new Top_Entities();
1839
	}
1840
1841
	/**
1842
	 * Register all of the hooks related to the public-facing functionality
1843
	 * of the plugin.
1844
	 *
1845
	 * @since    1.0.0
1846
	 * @access   private
1847
	 */
1848
	private function define_public_hooks() {
1849
1850
		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1851
1852
		// Register the entity post type.
1853
		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1854
1855
		// Bind the link generation and handling hooks to the entity link service.
1856
		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1857
		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1858
		$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 );
1859
		$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 );
1860
1861
		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1862
		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1863
		$this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' );
1864
1865
		// Registering Faq_Content_Filter service used for removing faq question and answer tags from the html.
1866
		$this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' );
1867
		// Hook the content filter service to add entity links.
1868
		if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1869
			$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1870
		}
1871
1872
		// Hook the AJAX wl_timeline action to the Timeline service.
1873
		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1874
1875
		// Hook the ShareThis service.
1876
		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1877
		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1878
1879
		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1880
		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1881
1882
		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1883
		// in order to tweak WP's `WP_Query` to include entities in queries related
1884
		// to categories.
1885
		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1886
1887
		/*
1888
		 * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service`
1889
		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1890
		 * order of start time.
1891
		 */
1892
		$this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1893
1894
		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1895
1896
		// This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1897
		$this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1898
1899
		// Analytics Script Frontend.
1900
		if ( $this->configuration_service->is_analytics_enable() ) {
1901
			$this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 );
1902
		}
1903
1904
	}
1905
1906
	/**
1907
	 * Run the loader to execute all of the hooks with WordPress.
1908
	 *
1909
	 * @since    1.0.0
1910
	 */
1911
	public function run() {
1912
		$this->loader->run();
1913
	}
1914
1915
	/**
1916
	 * The name of the plugin used to uniquely identify it within the context of
1917
	 * WordPress and to define internationalization functionality.
1918
	 *
1919
	 * @return    string    The name of the plugin.
1920
	 * @since     1.0.0
1921
	 */
1922
	public function get_plugin_name() {
1923
		return $this->plugin_name;
1924
	}
1925
1926
	/**
1927
	 * The reference to the class that orchestrates the hooks with the plugin.
1928
	 *
1929
	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1930
	 * @since     1.0.0
1931
	 */
1932
	public function get_loader() {
1933
		return $this->loader;
1934
	}
1935
1936
	/**
1937
	 * Retrieve the version number of the plugin.
1938
	 *
1939
	 * @return    string    The version number of the plugin.
1940
	 * @since     1.0.0
1941
	 */
1942
	public function get_version() {
1943
		return $this->version;
1944
	}
1945
1946
	/**
1947
	 * Load dependencies for WP-CLI.
1948
	 *
1949
	 * @throws Exception
1950
	 * @since 3.18.0
1951
	 */
1952
	private function load_cli_dependencies() {
1953
1954
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php';
1955
1956
		$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 );
1957
1958
		WP_CLI::add_command( 'wl references push', $push_reference_data_command );
1959
1960
	}
1961
1962
	/**
1963
	 * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions.
1964
	 *
1965
	 * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance.
1966
	 * @since 3.20.0
1967
	 */
1968
	public function get_dashboard_service() {
1969
1970
		return $this->dashboard_service;
1971
	}
1972
1973
	public function add_wl_enabled_blocks() {
1974
		/**
1975
		 * Filter: wl_feature__enable__blocks.
1976
		 *
1977
		 * @param bool whether the blocks needed to be registered, defaults to true.
1978
		 *
1979
		 * @return bool
1980
		 * @since 3.27.6
1981
		 */
1982
1983
		wp_register_script( 'wl_enabled_blocks', false );
1984
1985
		$enabled_blocks = array( 'wordlift/products-navigator' );
1986
1987
		if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
1988
			// To intimate JS
1989
			$enabled_blocks = array_merge( $enabled_blocks, array(
1990
				'wordlift/navigator',
1991
				'wordlift/chord',
1992
				'wordlift/geomap',
1993
				'wordlift/timeline',
1994
				'wordlift/cloud',
1995
				'wordlift/vocabulary',
1996
				'wordlift/faceted-search'
1997
			) );
1998
		}
1999
2000
		wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks );
2001
		wp_enqueue_script( 'wl_enabled_blocks' );
2002
	}
2003
2004
}
2005