Completed
Pull Request — develop (#1328)
by Naveen
03:08
created

Wordlift::load_dependencies()   C

Complexity

Conditions 10
Paths 32

Size

Total Lines 801

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 10
nc 32
nop 0
dl 0
loc 801
rs 6.1333
c 0
b 0
f 0

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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\Admin\Admin_User_Option;
16
use Wordlift\Admin\Key_Validation_Notice;
17
use Wordlift\Admin\Top_Entities;
18
use Wordlift\Analysis\Response\Analysis_Response_Ops_Factory;
19
use Wordlift\Autocomplete\All_Autocomplete_Service;
20
use Wordlift\Autocomplete\Linked_Data_Autocomplete_Service;
21
use Wordlift\Autocomplete\Local_Autocomplete_Service;
22
use Wordlift\Cache\Ttl_Cache;
23
use Wordlift\Duplicate_Markup_Remover\Faq_Duplicate_Markup_Remover;
24
use Wordlift\Entity\Entity_Helper;
25
use Wordlift\Entity\Entity_Rest_Service;
26
use Wordlift\External_Plugin_Hooks\Recipe_Maker\Recipe_Maker_After_Get_Jsonld_Hook;
27
use Wordlift\External_Plugin_Hooks\Recipe_Maker\Recipe_Maker_Jsonld_Hook;
28
use Wordlift\External_Plugin_Hooks\Recipe_Maker\Recipe_Maker_Post_Type_Hook;
29
use Wordlift\External_Plugin_Hooks\Recipe_Maker\Recipe_Maker_Validation_Service;
30
use Wordlift\External_Plugin_Hooks\Recipe_Maker\Recipe_Maker_Warning;
31
use Wordlift\External_Plugin_Hooks\Yoast\Yoast_Jsonld;
32
use Wordlift\Faq\Faq_Content_Filter;
33
use Wordlift\Faq\Faq_Tinymce_Adapter;
34
use Wordlift\Jsonld\Jsonld_Adapter;
35
use Wordlift\Jsonld\Jsonld_Article_Wrapper;
36
use Wordlift\Jsonld\Jsonld_By_Id_Endpoint;
37
use Wordlift\Jsonld\Jsonld_Endpoint;
38
use Wordlift\Jsonld\Jsonld_Service;
39
use Wordlift\Jsonld\Jsonld_User_Service;
40
use Wordlift\Mappings\Formatters\Acf_Group_Formatter;
41
use Wordlift\Mappings\Jsonld_Converter;
42
use Wordlift\Mappings\Mappings_DBO;
43
use Wordlift\Mappings\Mappings_Transform_Functions_Registry;
44
use Wordlift\Mappings\Mappings_Validator;
45
use Wordlift\Mappings\Transforms\Post_Id_To_Entity_Transform_Function;
46
use Wordlift\Mappings\Transforms\Taxonomy_To_Terms_Transform_Function;
47
use Wordlift\Mappings\Transforms\Url_To_Entity_Transform_Function;
48
use Wordlift\Mappings\Validators\Post_Type_Rule_Validator;
49
use Wordlift\Mappings\Validators\Rule_Groups_Validator;
50
use Wordlift\Mappings\Validators\Rule_Validators_Registry;
51
use Wordlift\Mappings\Validators\Taxonomy_Rule_Validator;
52
use Wordlift\Mappings\Validators\Taxonomy_Term_Rule_Validator;
53
use Wordlift\Mappings\Validators\Post_Taxonomy_Term_Rule_Validator;
54
use Wordlift\Post_Excerpt\Post_Excerpt_Meta_Box_Adapter;
55
use Wordlift\Post_Excerpt\Post_Excerpt_Rest_Controller;
56
use Wordlift\Templates\Templates_Ajax_Endpoint;
57
use Wordlift\Vocabulary\Vocabulary_Loader;
58
use Wordlift\Widgets\Async_Template_Decorator;
59
60
/**
61
 * The core plugin class.
62
 *
63
 * This is used to define internationalization, admin-specific hooks, and
64
 * public-facing site hooks.
65
 *
66
 * Also maintains the unique identifier of this plugin as well as the current
67
 * version of the plugin.
68
 *
69
 * @since      1.0.0
70
 * @package    Wordlift
71
 * @subpackage Wordlift/includes
72
 * @author     WordLift <[email protected]>
73
 */
74
class Wordlift {
75
76
	//<editor-fold desc="## FIELDS">
77
78
	/**
79
	 * The loader that's responsible for maintaining and registering all hooks that power
80
	 * the plugin.
81
	 *
82
	 * @since    1.0.0
83
	 * @access   protected
84
	 * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
85
	 */
86
	protected $loader;
87
88
	/**
89
	 * The unique identifier of this plugin.
90
	 *
91
	 * @since    1.0.0
92
	 * @access   protected
93
	 * @var      string $plugin_name The string used to uniquely identify this plugin.
94
	 */
95
	protected $plugin_name;
96
97
	/**
98
	 * The current version of the plugin.
99
	 *
100
	 * @since    1.0.0
101
	 * @access   protected
102
	 * @var      string $version The current version of the plugin.
103
	 */
104
	protected $version;
105
106
	/**
107
	 * The {@link Wordlift_Tinymce_Adapter} instance.
108
	 *
109
	 * @since  3.12.0
110
	 * @access protected
111
	 * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
112
	 */
113
	protected $tinymce_adapter;
114
115
	/**
116
	 * The {@link Faq_Tinymce_Adapter} instance
117
	 * @since 3.26.0
118
	 * @access protected
119
	 * @var Faq_Tinymce_Adapter $faq_tinymce_adapter .
120
	 */
121
	//protected $faq_tinymce_adapter;
122
123
	/**
124
	 * The Thumbnail service.
125
	 *
126
	 * @since  3.1.5
127
	 * @access private
128
	 * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
129
	 */
130
	private $thumbnail_service;
131
132
	/**
133
	 * The UI service.
134
	 *
135
	 * @since  3.2.0
136
	 * @access private
137
	 * @var \Wordlift_UI_Service $ui_service The UI service.
138
	 */
139
	private $ui_service;
140
141
	/**
142
	 * The Schema service.
143
	 *
144
	 * @since  3.3.0
145
	 * @access protected
146
	 * @var \Wordlift_Schema_Service $schema_service The Schema service.
147
	 */
148
	protected $schema_service;
149
150
	/**
151
	 * The Entity service.
152
	 *
153
	 * @since  3.1.0
154
	 * @access protected
155
	 * @var \Wordlift_Entity_Service $entity_service The Entity service.
156
	 */
157
	protected $entity_service;
158
159
	/**
160
	 * The Topic Taxonomy service.
161
	 *
162
	 * @since  3.5.0
163
	 * @access private
164
	 * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
165
	 */
166
	private $topic_taxonomy_service;
167
168
	/**
169
	 * The Entity Types Taxonomy service.
170
	 *
171
	 * @since  3.18.0
172
	 * @access private
173
	 * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service.
174
	 */
175
	private $entity_types_taxonomy_service;
176
177
	/**
178
	 * The User service.
179
	 *
180
	 * @since  3.1.7
181
	 * @access protected
182
	 * @var \Wordlift_User_Service $user_service The User service.
183
	 */
184
	protected $user_service;
185
186
	/**
187
	 * The Timeline service.
188
	 *
189
	 * @since  3.1.0
190
	 * @access private
191
	 * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
192
	 */
193
	private $timeline_service;
194
195
	/**
196
	 * The Redirect service.
197
	 *
198
	 * @since  3.2.0
199
	 * @access private
200
	 * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
201
	 */
202
	private $redirect_service;
203
204
	/**
205
	 * The Notice service.
206
	 *
207
	 * @since  3.3.0
208
	 * @access private
209
	 * @var \Wordlift_Notice_Service $notice_service The Notice service.
210
	 */
211
	private $notice_service;
212
213
	/**
214
	 * The Entity list customization.
215
	 *
216
	 * @since  3.3.0
217
	 * @access protected
218
	 * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
219
	 */
220
	protected $entity_list_service;
221
222
	/**
223
	 * The Entity Types Taxonomy Walker.
224
	 *
225
	 * @since  3.1.0
226
	 * @access private
227
	 * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
228
	 */
229
	private $entity_types_taxonomy_walker;
230
231
	/**
232
	 * The ShareThis service.
233
	 *
234
	 * @since  3.2.0
235
	 * @access private
236
	 * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
237
	 */
238
	private $sharethis_service;
239
240
	/**
241
	 * The PrimaShop adapter.
242
	 *
243
	 * @since  3.2.3
244
	 * @access private
245
	 * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
246
	 */
247
	private $primashop_adapter;
248
249
	/**
250
	 * The WordLift Dashboard adapter.
251
	 *
252
	 * @since  3.4.0
253
	 * @access private
254
	 * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
255
	 */
256
	private $dashboard_service;
257
258
	/**
259
	 * The entity type service.
260
	 *
261
	 * @since  3.6.0
262
	 * @access private
263
	 * @var \Wordlift_Entity_Post_Type_Service
264
	 */
265
	private $entity_post_type_service;
266
267
	/**
268
	 * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
269
	 *
270
	 * @since  3.6.0
271
	 * @access private
272
	 * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance.
273
	 */
274
	private $entity_link_service;
275
276
	/**
277
	 * A {@link Wordlift_Sparql_Service} instance.
278
	 *
279
	 * @since    3.6.0
280
	 * @access   protected
281
	 * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
282
	 */
283
	protected $sparql_service;
284
285
	/**
286
	 * A {@link Wordlift_Import_Service} instance.
287
	 *
288
	 * @since  3.6.0
289
	 * @access private
290
	 * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
291
	 */
292
	private $import_service;
293
294
	/**
295
	 * A {@link Wordlift_Rebuild_Service} instance.
296
	 *
297
	 * @since  3.6.0
298
	 * @access private
299
	 * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
300
	 */
301
	private $rebuild_service;
302
303
	/**
304
	 * A {@link Wordlift_Jsonld_Service} instance.
305
	 *
306
	 * @since  3.7.0
307
	 * @access protected
308
	 * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
309
	 */
310
	protected $jsonld_service;
311
312
	/**
313
	 * A {@link Wordlift_Website_Jsonld_Converter} instance.
314
	 *
315
	 * @since  3.14.0
316
	 * @access protected
317
	 * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance.
318
	 */
319
	protected $jsonld_website_converter;
320
321
	/**
322
	 * A {@link Wordlift_Property_Factory} instance.
323
	 *
324
	 * @since  3.7.0
325
	 * @access private
326
	 * @var \Wordlift_Property_Factory $property_factory
327
	 */
328
	private $property_factory;
329
330
	/**
331
	 * The 'Download Your Data' page.
332
	 *
333
	 * @since  3.6.0
334
	 * @access private
335
	 * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
336
	 */
337
	private $download_your_data_page;
338
339
	/**
340
	 * The 'WordLift Settings' page.
341
	 *
342
	 * @since  3.11.0
343
	 * @access protected
344
	 * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
345
	 */
346
	protected $settings_page;
347
348
	/**
349
	 * The install wizard page.
350
	 *
351
	 * @since  3.9.0
352
	 * @access private
353
	 * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
354
	 */
355
	public $admin_setup;
356
357
	/**
358
	 * The Content Filter Service hooks up to the 'the_content' filter and provides
359
	 * linking of entities to their pages.
360
	 *
361
	 * @since  3.8.0
362
	 * @access private
363
	 * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
364
	 */
365
	private $content_filter_service;
366
367
	/**
368
	 * The Faq Content filter service
369
	 * @since  3.26.0
370
	 * @access private
371
	 * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance.
372
	 */
373
	private $faq_content_filter_service;
374
375
	/**
376
	 * A {@link Wordlift_Key_Validation_Service} instance.
377
	 *
378
	 * @since  3.9.0
379
	 * @access private
380
	 * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
381
	 */
382
	private $key_validation_service;
383
384
	/**
385
	 * A {@link Wordlift_Rating_Service} instance.
386
	 *
387
	 * @since  3.10.0
388
	 * @access private
389
	 * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
390
	 */
391
	private $rating_service;
392
393
	/**
394
	 * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
395
	 *
396
	 * @since  3.10.0
397
	 * @access protected
398
	 * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
399
	 */
400
	protected $post_to_jsonld_converter;
401
402
	/**
403
	 * A {@link Wordlift_Configuration_Service} instance.
404
	 *
405
	 * @since  3.10.0
406
	 * @access protected
407
	 * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
408
	 */
409
	protected $configuration_service;
410
411
	/**
412
	 * A {@link Wordlift_Install_Service} instance.
413
	 *
414
	 * @since  3.18.0
415
	 * @access protected
416
	 * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance.
417
	 */
418
	protected $install_service;
419
420
	/**
421
	 * A {@link Wordlift_Entity_Type_Service} instance.
422
	 *
423
	 * @since  3.10.0
424
	 * @access protected
425
	 * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
426
	 */
427
	protected $entity_type_service;
428
429
	/**
430
	 * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
431
	 *
432
	 * @since  3.10.0
433
	 * @access protected
434
	 * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
435
	 */
436
	protected $entity_post_to_jsonld_converter;
437
438
	/**
439
	 * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
440
	 *
441
	 * @since  3.10.0
442
	 * @access protected
443
	 * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
444
	 */
445
	protected $postid_to_jsonld_converter;
446
447
	/**
448
	 * The {@link Wordlift_Admin_Status_Page} class.
449
	 *
450
	 * @since  3.9.8
451
	 * @access private
452
	 * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
453
	 */
454
	private $status_page;
455
456
	/**
457
	 * The {@link Wordlift_Category_Taxonomy_Service} instance.
458
	 *
459
	 * @since  3.11.0
460
	 * @access protected
461
	 * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
462
	 */
463
	protected $category_taxonomy_service;
464
465
	/**
466
	 * The {@link Wordlift_Entity_Page_Service} instance.
467
	 *
468
	 * @since  3.11.0
469
	 * @access protected
470
	 * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance.
471
	 */
472
	protected $entity_page_service;
473
474
	/**
475
	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
476
	 *
477
	 * @since  3.11.0
478
	 * @access protected
479
	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
480
	 */
481
	protected $settings_page_action_link;
482
483
	/**
484
	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
485
	 *
486
	 * @since  3.11.0
487
	 * @access protected
488
	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
489
	 */
490
	protected $analytics_settings_page_action_link;
491
492
	/**
493
	 * The {@link Wordlift_Analytics_Connect} class.
494
	 *
495
	 * @since  3.11.0
496
	 * @access protected
497
	 * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class.
498
	 */
499
	protected $analytics_connect;
500
501
	/**
502
	 * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
503
	 *
504
	 * @since  3.11.0
505
	 * @access protected
506
	 * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
507
	 */
508
	protected $publisher_ajax_adapter;
509
510
	/**
511
	 * The {@link Wordlift_Admin_Input_Element} element renderer.
512
	 *
513
	 * @since  3.11.0
514
	 * @access protected
515
	 * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
516
	 */
517
	protected $input_element;
518
519
	/**
520
	 * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
521
	 *
522
	 * @since  3.13.0
523
	 * @access protected
524
	 * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
525
	 */
526
	protected $radio_input_element;
527
528
	/**
529
	 * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
530
	 *
531
	 * @since  3.11.0
532
	 * @access protected
533
	 * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
534
	 */
535
	protected $language_select_element;
536
537
	/**
538
	 * The {@link Wordlift_Admin_Country_Select_Element} element renderer.
539
	 *
540
	 * @since  3.18.0
541
	 * @access protected
542
	 * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer.
543
	 */
544
	protected $country_select_element;
545
546
	/**
547
	 * The {@link Wordlift_Admin_Publisher_Element} element renderer.
548
	 *
549
	 * @since  3.11.0
550
	 * @access protected
551
	 * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
552
	 */
553
	protected $publisher_element;
554
555
	/**
556
	 * The {@link Wordlift_Admin_Select2_Element} element renderer.
557
	 *
558
	 * @since  3.11.0
559
	 * @access protected
560
	 * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
561
	 */
562
	protected $select2_element;
563
564
	/**
565
	 * The controller for the entity type list admin page
566
	 *
567
	 * @since  3.11.0
568
	 * @access private
569
	 * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
570
	 */
571
	private $entity_type_admin_page;
572
573
	/**
574
	 * The controller for the entity type settings admin page
575
	 *
576
	 * @since  3.11.0
577
	 * @access private
578
	 * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
579
	 */
580
	private $entity_type_settings_admin_page;
581
582
	/**
583
	 * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
584
	 *
585
	 * @since  3.11.0
586
	 * @access protected
587
	 * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
588
	 */
589
	protected $related_entities_cloud_widget;
590
591
	/**
592
	 * The {@link Wordlift_Admin_Author_Element} instance.
593
	 *
594
	 * @since  3.14.0
595
	 * @access protected
596
	 * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
597
	 */
598
	protected $author_element;
599
600
	/**
601
	 * The {@link Wordlift_Sample_Data_Service} instance.
602
	 *
603
	 * @since  3.12.0
604
	 * @access protected
605
	 * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
606
	 */
607
	protected $sample_data_service;
608
609
	/**
610
	 * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
611
	 *
612
	 * @since  3.12.0
613
	 * @access protected
614
	 * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
615
	 */
616
	protected $sample_data_ajax_adapter;
617
618
	/**
619
	 * The {@link Wordlift_Relation_Rebuild_Service} instance.
620
	 *
621
	 * @since  3.14.3
622
	 * @access private
623
	 * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance.
624
	 */
625
	private $relation_rebuild_service;
626
627
	/**
628
	 * The {@link Wordlift_Relation_Rebuild_Adapter} instance.
629
	 *
630
	 * @since  3.14.3
631
	 * @access private
632
	 * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance.
633
	 */
634
	private $relation_rebuild_adapter;
635
636
	/**
637
	 * The {@link Wordlift_Reference_Rebuild_Service} instance.
638
	 *
639
	 * @since  3.18.0
640
	 * @access private
641
	 * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance.
642
	 */
643
	private $reference_rebuild_service;
644
645
	/**
646
	 * The {@link Wordlift_Google_Analytics_Export_Service} instance.
647
	 *
648
	 * @since  3.16.0
649
	 * @access protected
650
	 * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance.
651
	 */
652
	protected $google_analytics_export_service;
653
654
	/**
655
	 * {@link Wordlift}'s singleton instance.
656
	 *
657
	 * @since  3.15.0
658
	 * @access protected
659
	 * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance.
660
	 */
661
	protected $entity_type_adapter;
662
663
	/**
664
	 * The {@link Wordlift_Storage_Factory} instance.
665
	 *
666
	 * @since  3.15.0
667
	 * @access protected
668
	 * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance.
669
	 */
670
	protected $storage_factory;
671
672
	/**
673
	 * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
674
	 *
675
	 * @since  3.15.0
676
	 * @access protected
677
	 * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
678
	 */
679
	protected $rendition_factory;
680
681
	/**
682
	 * The {@link Wordlift_Autocomplete_Adapter} instance.
683
	 *
684
	 * @since  3.15.0
685
	 * @access private
686
	 * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance.
687
	 */
688
	private $autocomplete_adapter;
689
690
	/**
691
	 * The {@link Wordlift_Relation_Service} instance.
692
	 *
693
	 * @since  3.15.0
694
	 * @access protected
695
	 * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
696
	 */
697
	protected $relation_service;
698
699
	/**
700
	 * The {@link Wordlift_Cached_Post_Converter} instance.
701
	 *
702
	 * @since  3.16.0
703
	 * @access protected
704
	 * @var  \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance.
705
	 *
706
	 */
707
	protected $cached_postid_to_jsonld_converter;
708
709
	/**
710
	 * The {@link Wordlift_Entity_Uri_Service} instance.
711
	 *
712
	 * @since  3.16.3
713
	 * @access protected
714
	 * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
715
	 */
716
	protected $entity_uri_service;
717
718
	/**
719
	 * The {@link Wordlift_Publisher_Service} instance.
720
	 *
721
	 * @since  3.19.0
722
	 * @access protected
723
	 * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
724
	 */
725
	protected $publisher_service;
726
727
	/**
728
	 * The {@link Wordlift_Context_Cards_Service} instance.
729
	 *
730
	 * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance.
731
	 */
732
	protected $context_cards_service;
733
734
	/**
735
	 * {@link Wordlift}'s singleton instance.
736
	 *
737
	 * @since  3.11.2
738
	 * @access private
739
	 * @var Wordlift $instance {@link Wordlift}'s singleton instance.
740
	 */
741
	private static $instance;
742
743
	//</editor-fold>
744
745
	/**
746
	 * Define the core functionality of the plugin.
747
	 *
748
	 * Set the plugin name and the plugin version that can be used throughout the plugin.
749
	 * Load the dependencies, define the locale, and set the hooks for the admin area and
750
	 * the public-facing side of the site.
751
	 *
752
	 * @since    1.0.0
753
	 */
754
	public function __construct() {
755
756
		self::$instance = $this;
757
758
		$this->plugin_name = 'wordlift';
759
		$this->version     = '3.29.1';
760
		$this->load_dependencies();
761
		$this->set_locale();
762
		$this->define_admin_hooks();
763
		$this->define_public_hooks();
764
765
		// If we're in `WP_CLI` load the related files.
766
		if ( class_exists( 'WP_CLI' ) ) {
767
			$this->load_cli_dependencies();
768
		}
769
770
	}
771
772
	/**
773
	 * Get the singleton instance.
774
	 *
775
	 * @return Wordlift The {@link Wordlift} singleton instance.
776
	 * @since 3.11.2
777
	 *
778
	 */
779
	public static function get_instance() {
780
781
		return self::$instance;
782
	}
783
784
	/**
785
	 * Load the required dependencies for this plugin.
786
	 *
787
	 * Include the following files that make up the plugin:
788
	 *
789
	 * - Wordlift_Loader. Orchestrates the hooks of the plugin.
790
	 * - Wordlift_i18n. Defines internationalization functionality.
791
	 * - Wordlift_Admin. Defines all hooks for the admin area.
792
	 * - Wordlift_Public. Defines all hooks for the public side of the site.
793
	 *
794
	 * Create an instance of the loader which will be used to register the hooks
795
	 * with WordPress.
796
	 *
797
	 * @throws Exception
798
	 * @since    1.0.0
799
	 * @access   private
800
	 */
801
	private function load_dependencies() {
802
803
		/**
804
		 * The class responsible for orchestrating the actions and filters of the
805
		 * core plugin.
806
		 */
807
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
808
809
		// The class responsible for plugin uninstall.
810
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php';
811
812
		/**
813
		 * The class responsible for defining internationalization functionality
814
		 * of the plugin.
815
		 */
816
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
817
818
		/**
819
		 * WordLift's supported languages.
820
		 */
821
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
822
823
		/**
824
		 * WordLift's supported countries.
825
		 */
826
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php';
827
828
		/**
829
		 * Provide support functions to sanitize data.
830
		 */
831
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
832
833
		/** Services. */
834
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
835
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
836
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
837
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
838
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
839
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
840
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
841
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
842
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
843
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php';
844
845
		/**
846
		 * The Query builder.
847
		 */
848
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
849
850
		/**
851
		 * The Schema service.
852
		 */
853
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
854
855
		/**
856
		 * The schema:url property service.
857
		 */
858
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
859
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
860
861
		/**
862
		 * The UI service.
863
		 */
864
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
865
866
		/**
867
		 * The Thumbnail service.
868
		 */
869
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
870
871
		/**
872
		 * The Entity Types Taxonomy service.
873
		 */
874
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
875
876
		/**
877
		 * The Entity service.
878
		 */
879
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
880
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
881
882
		// Add the entity rating service.
883
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
884
885
		/**
886
		 * The User service.
887
		 */
888
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
889
890
		/**
891
		 * The Timeline service.
892
		 */
893
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
894
895
		/**
896
		 * The Topic Taxonomy service.
897
		 */
898
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
899
900
		/**
901
		 * The SPARQL service.
902
		 */
903
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
904
905
		/**
906
		 * The WordLift import service.
907
		 */
908
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
909
910
		/**
911
		 * The WordLift URI service.
912
		 */
913
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
914
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
915
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
916
917
		/**
918
		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
919
		 */
920
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php';
921
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php';
922
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php';
923
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php';
924
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
925
926
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
927
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
928
929
		/**
930
		 * Load the converters.
931
		 */
932
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
933
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
934
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
935
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
936
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
937
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
938
939
		/**
940
		 * Load cache-related files.
941
		 */
942
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
943
944
		/**
945
		 * Load the content filter.
946
		 */
947
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
948
949
		/*
950
		 * Load the excerpt helper.
951
		 */
952
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
953
954
		/**
955
		 * Load the JSON-LD service to publish entities using JSON-LD.s
956
		 *
957
		 * @since 3.8.0
958
		 */
959
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
960
961
		// The Publisher Service and the AJAX adapter.
962
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
963
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
964
965
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
966
967
		/**
968
		 * Load the WordLift key validation service.
969
		 */
970
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
971
972
		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
973
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
974
975
		// Load the `Wordlift_Entity_Page_Service` class definition.
976
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
977
978
		/** Linked Data. */
979
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
980
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
981
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
982
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
983
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
984
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
985
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
986
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
987
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
988
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
989
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
990
991
		/** Linked Data Rendition. */
992
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
993
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
994
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
995
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
996
997
		/** Services. */
998
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
999
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php';
1000
1001
		/** Adapters. */
1002
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
1003
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
1004
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
1005
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
1006
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php';
1007
1008
		/** Async Tasks. */
1009
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
1010
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
1011
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php';
1012
1013
		/** Autocomplete. */
1014
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
1015
1016
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
1017
1018
		/** Analytics */
1019
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php';
1020
1021
		/**
1022
		 * The class responsible for defining all actions that occur in the admin area.
1023
		 */
1024
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
1025
1026
		/**
1027
		 * The class to customize the entity list admin page.
1028
		 */
1029
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
1030
1031
		/**
1032
		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
1033
		 */
1034
		global $wp_version;
1035
		if ( version_compare( $wp_version, '5.3', '<' ) ) {
1036
			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
1037
		} else {
1038
			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php';
1039
		}
1040
1041
		/**
1042
		 * The Notice service.
1043
		 */
1044
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
1045
1046
		/**
1047
		 * The PrimaShop adapter.
1048
		 */
1049
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
1050
1051
		/**
1052
		 * The WordLift Dashboard service.
1053
		 */
1054
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
1055
1056
		/**
1057
		 * The admin 'Install wizard' page.
1058
		 */
1059
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
1060
1061
		/**
1062
		 * The WordLift entity type list admin page controller.
1063
		 */
1064
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1065
1066
		/**
1067
		 * The WordLift entity type settings admin page controller.
1068
		 */
1069
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
1070
1071
		/**
1072
		 * The admin 'Download Your Data' page.
1073
		 */
1074
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
1075
1076
		/**
1077
		 * The admin 'WordLift Settings' page.
1078
		 */
1079
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php';
1080
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php';
1081
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php';
1082
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php';
1083
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php';
1084
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php';
1085
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php';
1086
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php';
1087
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php';
1088
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php';
1089
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
1090
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
1091
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php';
1092
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
1093
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php';
1094
1095
		/** Admin Pages */
1096
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
1097
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
1098
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php';
1099
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
1100
1101
		/**
1102
		 * The class responsible for defining all actions that occur in the public-facing
1103
		 * side of the site.
1104
		 */
1105
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1106
1107
		/**
1108
		 * The shortcode abstract class.
1109
		 */
1110
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1111
1112
		/**
1113
		 * The Timeline shortcode.
1114
		 */
1115
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1116
1117
		/**
1118
		 * The Navigator shortcode.
1119
		 */
1120
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1121
1122
		/**
1123
		 * The Products Navigator shortcode.
1124
		 */
1125
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php';
1126
1127
		/**
1128
		 * The chord shortcode.
1129
		 */
1130
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1131
1132
		/**
1133
		 * The geomap shortcode.
1134
		 */
1135
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1136
1137
		/**
1138
		 * The entity cloud shortcode.
1139
		 */
1140
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1141
1142
		/**
1143
		 * The entity glossary shortcode.
1144
		 */
1145
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1146
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1147
1148
		/**
1149
		 * Faceted Search shortcode.
1150
		 */
1151
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php';
1152
1153
		/**
1154
		 * The ShareThis service.
1155
		 */
1156
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1157
1158
		/**
1159
		 * The SEO service.
1160
		 */
1161
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1162
1163
		/**
1164
		 * The AMP service.
1165
		 */
1166
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1167
1168
		/** Widgets */
1169
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1170
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1171
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php';
1172
1173
		/*
1174
		 * Schema.org Services.
1175
		 *
1176
		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1177
		 */
1178
		if ( WL_ALL_ENTITY_TYPES ) {
1179
			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php';
1180
			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php';
1181
			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php';
1182
			new Wordlift_Schemaorg_Sync_Service();
1183
			$schemaorg_property_service = new Wordlift_Schemaorg_Property_Service();
1184
			new Wordlift_Schemaorg_Class_Service();
1185
		} else {
1186
			$schemaorg_property_service = null;
1187
		}
1188
1189
		$this->loader = new Wordlift_Loader();
1190
1191
		// Instantiate a global logger.
1192
		global $wl_logger;
1193
		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1194
1195
		// Load the `wl-api` end-point.
1196
		new Wordlift_Http_Api();
1197
1198
		// Load the Install Service.
1199
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
1200
		$this->install_service = new Wordlift_Install_Service();
1201
1202
		/** Services. */
1203
		// Create the configuration service.
1204
		$this->configuration_service = new Wordlift_Configuration_Service();
1205
		$api_service                 = new Wordlift_Api_Service( $this->configuration_service );
1206
1207
		// Create an entity type service instance. It'll be later bound to the init action.
1208
		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1209
1210
		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1211
		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1212
1213
		// Create an instance of the UI service.
1214
		$this->ui_service = new Wordlift_UI_Service();
1215
1216
		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
1217
		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
1218
1219
		$this->sparql_service        = new Wordlift_Sparql_Service();
1220
		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1221
		$this->notice_service        = new Wordlift_Notice_Service();
1222
		$this->relation_service      = new Wordlift_Relation_Service();
1223
1224
		$entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1225
		$this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1226
		$this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1227
		$this->user_service       = new Wordlift_User_Service( $this->sparql_service, $this->entity_service );
1228
1229
		// Instantiate the JSON-LD service.
1230
		$property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1231
1232
		/** Linked Data. */
1233
		$this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1234
		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1235
1236
		$this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1237
1238
		// Create a new instance of the Redirect service.
1239
		$this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_uri_service );
1240
		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1241
1242
		// Create a new instance of the Timeline service and Timeline shortcode.
1243
		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1244
1245
		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1246
1247
		$this->topic_taxonomy_service        = new Wordlift_Topic_Taxonomy_Service();
1248
		$this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service();
1249
1250
		// Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1251
		$this->sharethis_service = new Wordlift_ShareThis_Service();
1252
1253
		// Create an instance of the PrimaShop adapter.
1254
		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1255
1256
		// Create an import service instance to hook later to WP's import function.
1257
		$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() );
1258
1259
		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1260
1261
		// Create the entity rating service.
1262
		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1263
1264
		// Create entity list customization (wp-admin/edit.php).
1265
		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1266
1267
		// Create a new instance of the Redirect service.
1268
		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1269
1270
		// Create an instance of the Publisher Service and the AJAX Adapter.
1271
		$this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service );
1272
		$this->property_factory  = new Wordlift_Property_Factory( $schema_url_property_service );
1273
		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1274
1275
		$attachment_service = new Wordlift_Attachment_Service();
1276
1277
		// Instantiate the JSON-LD service.
1278
		$property_getter                       = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1279
		$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 );
1280
		$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 );
0 ignored issues
show
Bug introduced by
It seems like $schemaorg_property_service defined by null on line 1186 can be null; however, Wordlift_Entity_Post_To_...onverter::__construct() does not accept null, maybe add an additional type check?

Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code:

/** @return stdClass|null */
function mayReturnNull() { }

function doesNotAcceptNull(stdClass $x) { }

// With potential error.
function withoutCheck() {
    $x = mayReturnNull();
    doesNotAcceptNull($x); // Potential error here.
}

// Safe - Alternative 1
function withCheck1() {
    $x = mayReturnNull();
    if ( ! $x instanceof stdClass) {
        throw new \LogicException('$x must be defined.');
    }
    doesNotAcceptNull($x);
}

// Safe - Alternative 2
function withCheck2() {
    $x = mayReturnNull();
    if ($x instanceof stdClass) {
        doesNotAcceptNull($x);
    }
}
Loading history...
1281
		$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 );
1282
		$this->jsonld_website_converter        = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1283
1284
		$jsonld_cache                            = new Ttl_Cache( 'jsonld', 86400 );
1285
		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache );
1286
		$this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1287
1288
		/*
1289
		 * Load the `Wordlift_Term_JsonLd_Adapter`.
1290
		 *
1291
		 * @see https://github.com/insideout10/wordlift-plugin/issues/892
1292
		 *
1293
		 * @since 3.20.0
1294
		 */
1295
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php';
1296
		$term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service );
1297
		$jsonld_service      = new Jsonld_Service(
1298
			$this->jsonld_service,
1299
			$term_jsonld_adapter,
1300
			new Jsonld_User_Service( $this->user_service ) );
1301
		new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service );
1302
1303
		// Prints the JSON-LD in the head.
1304
		new Jsonld_Adapter( $this->jsonld_service );
1305
1306
		new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service );
1307
1308
		$this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service );
1309
		$this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1310
		// Creating Faq Content filter service.
1311
		$this->faq_content_filter_service = new Faq_Content_Filter();
1312
		$this->relation_rebuild_service   = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1313
		$this->sample_data_service        = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1314
		$this->sample_data_ajax_adapter   = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1315
		$this->reference_rebuild_service  = new Wordlift_Reference_Rebuild_Service( $this->entity_service );
1316
1317
		$this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' );
1318
		$this->loader->add_action( 'admin_enqueue_scripts', $this, 'add_wl_enabled_blocks' );
1319
1320
		/**
1321
		 * Filter: wl_feature__enable__blocks.
1322
		 *
1323
		 * @param bool whether the blocks needed to be registered, defaults to true.
1324
		 *
1325
		 * @return bool
1326
		 * @since 3.27.6
1327
		 */
1328
		if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
1329
			// Initialize the short-codes.
1330
			new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() );
1331
			new Wordlift_Chord_Shortcode();
1332
			new Wordlift_Geomap_Shortcode();
1333
			new Wordlift_Timeline_Shortcode();
1334
			new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1335
			new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1336
			new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() );
1337
		}
1338
1339
		new Wordlift_Products_Navigator_Shortcode();
1340
1341
1342
		// Initialize the Context Cards Service
1343
		$this->context_cards_service = new Wordlift_Context_Cards_Service();
1344
1345
		// Initialize the SEO service.
1346
		new Wordlift_Seo_Service();
1347
1348
		// Initialize the AMP service.
1349
		new Wordlift_AMP_Service( $this->jsonld_service );
1350
1351
		/** Services. */
1352
		$this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1353
		new Wordlift_Image_Service();
1354
1355
		/** Adapters. */
1356
		$this->entity_type_adapter    = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1357
		$this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service );
1358
		$this->tinymce_adapter        = new Wordlift_Tinymce_Adapter( $this );
1359
		//$this->faq_tinymce_adapter      = new Faq_Tinymce_Adapter();
1360
		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1361
1362
		/*
1363
		 * Exclude our public js from WP-Rocket.
1364
		 *
1365
		 * @since 3.19.4
1366
		 *
1367
		 * @see https://github.com/insideout10/wordlift-plugin/issues/842.
1368
		 */
1369
		new Wordlift_WpRocket_Adapter();
1370
1371
		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
1372
		$this->rebuild_service = new Wordlift_Rebuild_Service(
1373
			$this->sparql_service,
1374
			$uri_service
1375
		);
1376
1377
		$that = $this;
1378
		add_action( 'plugins_loaded', function () use ( $that ) {
1379
			if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) {
1380
				new Wordlift_Linked_Data_Service( $that->entity_service, $that->entity_type_service, $that->schema_service, $that->sparql_service );
1381
				new Wordlift_Sparql_Query_Async_Task();
1382
				new Wordlift_Push_References_Async_Task();
1383
			}
1384
		} );
1385
1386
		/** WordPress Admin UI. */
1387
1388
		// UI elements.
1389
		$this->input_element           = new Wordlift_Admin_Input_Element();
1390
		$this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1391
		$this->select2_element         = new Wordlift_Admin_Select2_Element();
1392
		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1393
		$this->country_select_element  = new Wordlift_Admin_Country_Select_Element();
1394
		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
1395
		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element );
1396
		$this->author_element          = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element );
1397
1398
		$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 );
1399
		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1400
1401
		$this->analytics_settings_page             = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element );
0 ignored issues
show
Bug introduced by
The property analytics_settings_page does not seem to exist. Did you mean settings_page?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
1402
		$this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page );
0 ignored issues
show
Bug introduced by
The property analytics_settings_page does not seem to exist. Did you mean settings_page?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
Documentation Bug introduced by
It seems like new \Wordlift_Admin_Sett...nalytics_settings_page) of type object<Wordlift_Admin_Se...ytics_Page_Action_Link> is incompatible with the declared type object<Wordlift_Admin_Settings_Page_Action_Link> of property $analytics_settings_page_action_link.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
1403
		$this->analytics_connect                   = new Wordlift_Analytics_Connect();
1404
1405
		// Pages.
1406
		/*
1407
		 * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box.
1408
		 *
1409
		 * @since 3.20.3
1410
		 *
1411
		 * @see https://github.com/insideout10/wordlift-plugin/issues/914
1412
		 */
1413
		if ( apply_filters( 'wl_can_see_classification_box', true ) ) {
1414
			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1415
			new Wordlift_Admin_Post_Edit_Page( $this );
1416
		}
1417
		new Wordlift_Entity_Type_Admin_Service();
1418
1419
		// create an instance of the entity type list admin page controller.
1420
		$this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1421
1422
		// create an instance of the entity type setting admin page controller.
1423
		$this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1424
1425
		/** Widgets */
1426
		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1427
1428
		/* WordPress Admin. */
1429
		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1430
		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1431
1432
		// Create an instance of the install wizard.
1433
		$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 );
1434
1435
		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1436
1437
		// User Profile.
1438
		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1439
1440
		$this->entity_page_service = new Wordlift_Entity_Page_Service();
1441
1442
		// Load the debug service if WP is in debug mode.
1443
		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1444
			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1445
			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1446
		}
1447
1448
		// Remote Image Service.
1449
		new Wordlift_Remote_Image_Service();
1450
1451
		/*
1452
		 * Provides mappings between post types and entity types.
1453
		 *
1454
		 * @since 3.20.0
1455
		 *
1456
		 * @see https://github.com/insideout10/wordlift-plugin/issues/852.
1457
		 */
1458
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php';
1459
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php';
1460
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php';
1461
1462
		// Create an instance of the Mapping Service and assign it to the Ajax Adapter.
1463
		new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) );
1464
1465
		/*
1466
		 * Batch Operations. They're similar to Batch Actions but do not require working on post types.
1467
		 *
1468
		 * Eventually Batch Actions will become Batch Operations.
1469
		 *
1470
		 * @since 3.20.0
1471
		 */
1472
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php';
1473
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php';
1474
1475
		/*
1476
		 * Add the Search Keywords taxonomy to manage the Search Keywords on WLS.
1477
		 *
1478
		 * @link https://github.com/insideout10/wordlift-plugin/issues/761
1479
		 *
1480
		 * @since 3.20.0
1481
		 */
1482
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php';
1483
		new Wordlift_Search_Keyword_Taxonomy( $api_service );
1484
1485
		/*
1486
		 * Load the Mappings JSON-LD post processing.
1487
		 *
1488
		 * @since 3.25.0
1489
		 */
1490
1491
		$mappings_dbo           = new Mappings_DBO();
1492
		$default_rule_validator = new Taxonomy_Rule_Validator();
1493
		new Post_Type_Rule_Validator();
1494
		// Taxonomy term rule validator for validating rules for term pages.
1495
		new Taxonomy_Term_Rule_Validator();
1496
		new Post_Taxonomy_Term_Rule_Validator();
1497
		$rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator );
1498
		$rule_groups_validator    = new Rule_Groups_Validator( $rule_validators_registry );
1499
		$mappings_validator       = new Mappings_Validator( $mappings_dbo, $rule_groups_validator );
1500
1501
		new Url_To_Entity_Transform_Function( $this->entity_uri_service );
1502
		new Taxonomy_To_Terms_Transform_Function();
1503
		new Post_Id_To_Entity_Transform_Function();
1504
		$mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry();
1505
1506
		/**
1507
		 * @since 3.27.1
1508
		 * Intiailize the acf group data formatter.
1509
		 */
1510
		new Acf_Group_Formatter();
1511
		new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry );
1512
1513
		/**
1514
		 * @since 3.26.0
1515
		 * Initialize the Faq JSON LD converter here - disabled.
1516
		 */
1517
		// new Faq_To_Jsonld_Converter();
1518
		/*
1519
		 * Use the Templates Ajax Endpoint to load HTML templates for the legacy Angular app via admin-ajax.php
1520
		 * end-point.
1521
		 *
1522
		 * @see https://github.com/insideout10/wordlift-plugin/issues/834
1523
		 * @since 3.24.4
1524
		 */
1525
		new Templates_Ajax_Endpoint();
1526
		// Call this static method to register FAQ routes to rest api - disabled
1527
		//Faq_Rest_Controller::register_routes();
1528
1529
		/*
1530
		 * Create a singleton for the Analysis_Response_Ops_Factory.
1531
		 */
1532
		$entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service );
1533
		new Analysis_Response_Ops_Factory(
1534
			$this->entity_uri_service,
1535
			$this->entity_service,
1536
			$this->entity_type_service,
1537
			$this->storage_factory->post_images(),
1538
			$entity_helper
1539
		);
1540
1541
		/** WL Autocomplete. */
1542
		$autocomplete_service       = new All_Autocomplete_Service( array(
1543
			new Local_Autocomplete_Service(),
1544
			new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ),
1545
		) );
1546
		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service );
1547
1548
		/**
1549
		 * @since 3.27.2
1550
		 * Integrate the recipe maker jsonld & set recipe
1551
		 * as default entity type to the wprm_recipe CPT.
1552
		 */
1553
		new Recipe_Maker_Post_Type_Hook();
1554
		$recipe_maker_validation_service = new Recipe_Maker_Validation_Service();
1555
		new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service );
1556
		new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service );
1557
		new Recipe_Maker_Warning( $recipe_maker_validation_service );
1558
		new Yoast_Jsonld( $recipe_maker_validation_service );
1559
1560
		/**
1561
		 * @since 3.27.4
1562
		 * Add the faq duplicate markup hook.
1563
		 */
1564
		new Faq_Duplicate_Markup_Remover();
1565
		/**
1566
		 * @since 3.27.8
1567
		 * @see https://github.com/insideout10/wordlift-plugin/issues/1248
1568
		 */
1569
		new Key_Validation_Notice( $this->key_validation_service, $this->configuration_service );
1570
		/**
1571
		 * @since 3.29.0
1572
		 * @see https://github.com/insideout10/wordlift-plugin/issues/1304
1573
		 */
1574
		new Entity_Rest_Service( $this->entity_type_service );
1575
1576
		/**
1577
		 * Expand author in to references.
1578
		 * @since 3.30.0
1579
		 * @see https://github.com/insideout10/wordlift-plugin/issues/1318
1580
		 */
1581
		add_action( 'plugins_loaded', function () use ( $that ) {
1582
1583
			if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) {
1584
				new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter );
1585
			}
1586
1587
			if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) {
1588
				$vocabulary_loader = new Vocabulary_Loader();
1589
				$vocabulary_loader->init_vocabulary();
1590
			}
1591
1592
		} );
1593
1594
		/**
1595
		 * @since 3.30.0
1596
		 * Add a checkbox to user option screen for wordlift admin.
1597
		 */
1598
		$wordlift_admin_checkbox = new Admin_User_Option();
1599
		$wordlift_admin_checkbox->connect_hook();
1600
1601
	}
1602
1603
	/**
1604
	 * Define the locale for this plugin for internationalization.
1605
	 *
1606
	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1607
	 * with WordPress.
1608
	 *
1609
	 * @since    1.0.0
1610
	 * @access   private
1611
	 */
1612
	private function set_locale() {
1613
1614
		$plugin_i18n = new Wordlift_i18n();
1615
		$plugin_i18n->set_domain( $this->get_plugin_name() );
1616
1617
		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1618
1619
	}
1620
1621
	/**
1622
	 * Register all of the hooks related to the admin area functionality
1623
	 * of the plugin.
1624
	 *
1625
	 * @since    1.0.0
1626
	 * @access   private
1627
	 */
1628
	private function define_admin_hooks() {
1629
1630
		$plugin_admin = new Wordlift_Admin(
1631
			$this->get_plugin_name(),
1632
			$this->get_version(),
1633
			$this->configuration_service,
1634
			$this->notice_service,
1635
			$this->user_service
1636
		);
1637
1638
		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1639
		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 );
1640
1641
		// Hook the init action to taxonomy services.
1642
		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1643
		$this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 );
1644
1645
		// Hook the deleted_post_meta action to the Thumbnail service.
1646
		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1647
1648
		// Hook the added_post_meta action to the Thumbnail service.
1649
		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1650
1651
		// Hook the updated_post_meta action to the Thumbnail service.
1652
		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1653
1654
		// Hook the AJAX wl_timeline action to the Timeline service.
1655
		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1656
1657
		// Register custom allowed redirect hosts.
1658
		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1659
		// Hook the AJAX wordlift_redirect action to the Redirect service.
1660
		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1661
1662
		/*
1663
		 * The old dashboard is replaced with dashboard v2.
1664
		 *
1665
		 * The old dashboard service is still loaded because its functions are used.
1666
		 *
1667
		 * @see https://github.com/insideout10/wordlift-plugin/issues/879
1668
		 *
1669
		 * @since 3.20.0
1670
		 */
1671
		// Hook the AJAX wordlift_redirect action to the Redirect service.
1672
		// $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1673
		// Hook the AJAX wordlift_redirect action to the Redirect service.
1674
		// $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1675
1676
		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1677
		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1678
		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1679
		$this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1680
1681
		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1682
		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1683
1684
		// Entity listing customization (wp-admin/edit.php)
1685
		// Add custom columns.
1686
		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1687
		// no explicit entity as it prevents handling of other post types.
1688
		$this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1689
		// Add 4W selection.
1690
		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1691
		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1692
		$this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1693
		$this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1694
1695
		/*
1696
		 * If `All Entity Types` is disable, use the radio button Walker.
1697
		 *
1698
		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1699
		 */
1700
		if ( ! WL_ALL_ENTITY_TYPES ) {
1701
			$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1702
		}
1703
1704
		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1705
		// entities.
1706
		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1707
1708
		// Filter imported post meta.
1709
		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1710
1711
		// Notify the import service when an import starts and ends.
1712
		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1713
		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1714
1715
		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1716
		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1717
		$this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' );
1718
1719
		/**
1720
		 * Filter: wl_feature__enable__screens.
1721
		 *
1722
		 * @param bool whether the screens needed to be registered, defaults to true.
1723
		 *
1724
		 * @return bool
1725
		 * @since 3.27.6
1726
		 */
1727
		if ( apply_filters( 'wl_feature__enable__screens', true ) ) {
1728
			// Hook the menu to the Download Your Data page.
1729
			if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) {
1730
				$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1731
			}
1732
			$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1733
			$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1734
		}
1735
		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1736
		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1737
1738
		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1739
		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1740
		$this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' );
1741
		$this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1742
1743
		// Hook the AJAX wl_validate_key action to the Key Validation service.
1744
		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1745
1746
		// Hook the AJAX wl_update_country_options action to the countries.
1747
		$this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' );
1748
1749
		// Hook the `admin_init` function to the Admin Setup.
1750
		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1751
1752
		// Hook the admin_init to the settings page.
1753
		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1754
		$this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' );
0 ignored issues
show
Bug introduced by
The property analytics_settings_page does not seem to exist. Did you mean settings_page?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
1755
1756
		$this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' );
1757
1758
		// Hook the menu creation on the general wordlift menu creation.
1759
		/**
1760
		 * Filter: wl_feature__enable__screens.
1761
		 *
1762
		 * @param bool whether the screens needed to be registered, defaults to true.
1763
		 *
1764
		 * @return bool
1765
		 * @since 3.27.6
1766
		 */
1767
		if ( apply_filters( 'wl_feature__enable__screens', true )
1768
		     && ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) ) {
1769
			$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1770
		}
1771
		/*
1772
		 * Display the `Wordlift_Admin_Search_Rankings_Page` page.
1773
		 *
1774
		 * @link https://github.com/insideout10/wordlift-plugin/issues/761
1775
		 *
1776
		 * @since 3.20.0
1777
		 */
1778
		if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) {
1779
			/**
1780
			 * Filter: wl_feature__enable__screens.
1781
			 *
1782
			 * @param bool whether the screens needed to be registered, defaults to true.
1783
			 *
1784
			 * @return bool
1785
			 * @since 3.27.6
1786
			 */
1787
//			if ( apply_filters( 'wl_feature__enable__screens', true ) ) {
1788
//				$admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page();
1789
//				$this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' );
1790
//			}
1791
		}
1792
1793
		// Hook key update.
1794
		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1795
		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1796
1797
		// Add additional action links to the WordLift plugin in the plugins page.
1798
		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1799
1800
		/*
1801
		 * Remove the Analytics Settings link from the plugin page.
1802
		 *
1803
		 * @see https://github.com/insideout10/wordlift-plugin/issues/932
1804
		 * @since 3.21.1
1805
		 */
1806
		// $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 );
1807
1808
		// Hook the AJAX `wl_publisher` action name.
1809
		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1810
1811
		// Hook row actions for the entity type list admin.
1812
		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1813
1814
		/** Ajax actions. */
1815
		$this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1816
1817
		// Hook capabilities manipulation to allow access to entity type admin
1818
		// page  on WordPress versions before 4.7.
1819
		global $wp_version;
1820
		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1821
			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1822
		}
1823
1824
		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1825
1826
		/** Adapters. */
1827
		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1828
		/**
1829
		 * Disabling Faq temporarily.
1830
		 * Load the tinymce editor button on the tool bar.
1831
		 * @since 3.26.0
1832
		 */
1833
		//$this->loader->add_filter( 'tiny_mce_before_init', $this->faq_tinymce_adapter, 'register_custom_tags' );
1834
		//$this->loader->add_filter( 'mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 );
1835
		//$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 );
1836
1837
1838
		$this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1839
		$this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1840
		$this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1841
		/**
1842
		 * @since 3.26.0
1843
		 */
1844
		if ( apply_filters( 'wl_feature__enable__post_excerpt', true ) ) {
1845
			$excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter();
1846
			$this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' );
1847
			// Adding Rest route for the post excerpt
1848
			Post_Excerpt_Rest_Controller::register_routes();
1849
		}
1850
1851
		$this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 );
1852
		$this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 );
1853
1854
		// Handle the autocomplete request.
1855
		add_action( 'wp_ajax_wl_autocomplete', array(
1856
			$this->autocomplete_adapter,
1857
			'wl_autocomplete',
1858
		) );
1859
		add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1860
			$this->autocomplete_adapter,
1861
			'wl_autocomplete',
1862
		) );
1863
1864
		// Hooks to restrict multisite super admin from manipulating entity types.
1865
		if ( is_multisite() ) {
1866
			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1867
		}
1868
1869
		$deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service );
1870
1871
		add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) );
1872
		add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) );
1873
		add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) );
1874
1875
		/**
1876
		 * Always allow the `wordlift/classification` block.
1877
		 *
1878
		 * @since 3.23.0
1879
		 */
1880
		add_filter( 'allowed_block_types', function ( $value ) {
1881
1882
			if ( true === $value ) {
1883
				return $value;
1884
			}
1885
1886
			return array_merge( (array) $value, array( 'wordlift/classification' ) );
1887
		}, PHP_INT_MAX );
1888
1889
		/**
1890
		 * @since 3.27.7
1891
		 * @see https://github.com/insideout10/wordlift-plugin/issues/1214
1892
		 */
1893
		new Top_Entities();
1894
	}
1895
1896
	/**
1897
	 * Register all of the hooks related to the public-facing functionality
1898
	 * of the plugin.
1899
	 *
1900
	 * @since    1.0.0
1901
	 * @access   private
1902
	 */
1903
	private function define_public_hooks() {
1904
1905
		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1906
1907
		// Register the entity post type.
1908
		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1909
1910
		// Bind the link generation and handling hooks to the entity link service.
1911
		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1912
		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1913
		// $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 );
1914
		// $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 );
1915
1916
		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1917
		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1918
		$this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' );
1919
1920
		// Registering Faq_Content_Filter service used for removing faq question and answer tags from the html.
1921
		$this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' );
1922
		// Hook the content filter service to add entity links.
1923
		if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1924
			$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1925
		}
1926
1927
		// Hook the AJAX wl_timeline action to the Timeline service.
1928
		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1929
1930
		// Hook the ShareThis service.
1931
		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1932
		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1933
1934
		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1935
		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1936
1937
		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1938
		// in order to tweak WP's `WP_Query` to include entities in queries related
1939
		// to categories.
1940
		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1941
1942
		/*
1943
		 * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service`
1944
		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1945
		 * order of start time.
1946
		 */
1947
		$this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1948
1949
		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1950
1951
		// This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1952
		$this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1953
1954
		// Analytics Script Frontend.
1955
		if ( $this->configuration_service->is_analytics_enable() ) {
1956
			$this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 );
1957
		}
1958
1959
	}
1960
1961
	/**
1962
	 * Run the loader to execute all of the hooks with WordPress.
1963
	 *
1964
	 * @since    1.0.0
1965
	 */
1966
	public function run() {
1967
		$this->loader->run();
1968
	}
1969
1970
	/**
1971
	 * The name of the plugin used to uniquely identify it within the context of
1972
	 * WordPress and to define internationalization functionality.
1973
	 *
1974
	 * @return    string    The name of the plugin.
1975
	 * @since     1.0.0
1976
	 */
1977
	public function get_plugin_name() {
1978
		return $this->plugin_name;
1979
	}
1980
1981
	/**
1982
	 * The reference to the class that orchestrates the hooks with the plugin.
1983
	 *
1984
	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1985
	 * @since     1.0.0
1986
	 */
1987
	public function get_loader() {
1988
		return $this->loader;
1989
	}
1990
1991
	/**
1992
	 * Retrieve the version number of the plugin.
1993
	 *
1994
	 * @return    string    The version number of the plugin.
1995
	 * @since     1.0.0
1996
	 */
1997
	public function get_version() {
1998
		return $this->version;
1999
	}
2000
2001
	/**
2002
	 * Load dependencies for WP-CLI.
2003
	 *
2004
	 * @throws Exception
2005
	 * @since 3.18.0
2006
	 */
2007
	private function load_cli_dependencies() {
2008
2009
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php';
2010
2011
		$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 );
2012
2013
		WP_CLI::add_command( 'wl references push', $push_reference_data_command );
2014
2015
	}
2016
2017
	/**
2018
	 * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions.
2019
	 *
2020
	 * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance.
2021
	 * @since 3.20.0
2022
	 */
2023
	public function get_dashboard_service() {
2024
2025
		return $this->dashboard_service;
2026
	}
2027
2028
	public function add_wl_enabled_blocks() {
2029
		/**
2030
		 * Filter: wl_feature__enable__blocks.
2031
		 *
2032
		 * @param bool whether the blocks needed to be registered, defaults to true.
2033
		 *
2034
		 * @return bool
2035
		 * @since 3.27.6
2036
		 */
2037
2038
		wp_register_script( 'wl_enabled_blocks', false );
2039
2040
		$enabled_blocks = array();
2041
2042
		/**
2043
		 * Filter name: wl_feature_enable__product_navigator
2044
		 * @since 3.30.0
2045
		 */
2046
		if ( apply_filters( 'wl_feature_enable__product-navigator', true ) ) {
2047
			$enabled_blocks[] = 'wordlift/products-navigator';
2048
		}
2049
2050
		if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
2051
			// To intimate JS
2052
			$enabled_blocks = array_merge( $enabled_blocks, array(
2053
				'wordlift/navigator',
2054
				'wordlift/chord',
2055
				'wordlift/geomap',
2056
				'wordlift/timeline',
2057
				'wordlift/cloud',
2058
				'wordlift/vocabulary',
2059
				'wordlift/faceted-search'
2060
			) );
2061
		}
2062
2063
		wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks );
2064
		wp_enqueue_script( 'wl_enabled_blocks' );
2065
	}
2066
2067
}
2068