Completed
Push — develop ( 6c1f8e...32716e )
by Naveen
01:18 queued 13s
created
src/wordlift/no-editor-analysis/class-edit-screen-setting.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@
 block discarded – undo
10 10
 class Edit_Screen_Setting {
11 11
 
12 12
 	public function add_setting() {
13
-		add_filter( 'wl_admin_settings', array( $this, 'wl_admin_settings' ) );
13
+		add_filter('wl_admin_settings', array($this, 'wl_admin_settings'));
14 14
 	}
15 15
 
16
-	function wl_admin_settings( $settings ) {
17
-		$settings['analysis']['isNoEditorAnalysisActive'] = No_Editor_Analysis_Feature::can_no_editor_analysis_be_used( get_the_ID() );
16
+	function wl_admin_settings($settings) {
17
+		$settings['analysis']['isNoEditorAnalysisActive'] = No_Editor_Analysis_Feature::can_no_editor_analysis_be_used(get_the_ID());
18 18
 
19 19
 		return $settings;
20 20
 	}
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,14 +9,14 @@
 block discarded – undo
9 9
  */
10 10
 class Edit_Screen_Setting {
11 11
 
12
-	public function add_setting() {
13
-		add_filter( 'wl_admin_settings', array( $this, 'wl_admin_settings' ) );
14
-	}
12
+    public function add_setting() {
13
+        add_filter( 'wl_admin_settings', array( $this, 'wl_admin_settings' ) );
14
+    }
15 15
 
16
-	function wl_admin_settings( $settings ) {
17
-		$settings['analysis']['isNoEditorAnalysisActive'] = No_Editor_Analysis_Feature::can_no_editor_analysis_be_used( get_the_ID() );
18
-		return $settings;
19
-	}
16
+    function wl_admin_settings( $settings ) {
17
+        $settings['analysis']['isNoEditorAnalysisActive'] = No_Editor_Analysis_Feature::can_no_editor_analysis_be_used( get_the_ID() );
18
+        return $settings;
19
+    }
20 20
 
21 21
 
22 22
 }
23 23
\ No newline at end of file
Please login to merge, or discard this patch.
src/includes/class-wordlift.php 1 patch
Indentation   +1933 added lines, -1933 removed lines patch added patch discarded remove patch
@@ -85,1657 +85,1657 @@  discard block
 block discarded – undo
85 85
  */
86 86
 class Wordlift {
87 87
 
88
-	//<editor-fold desc="## FIELDS">
89
-
90
-	/**
91
-	 * The loader that's responsible for maintaining and registering all hooks that power
92
-	 * the plugin.
93
-	 *
94
-	 * @since    1.0.0
95
-	 * @access   protected
96
-	 * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
97
-	 */
98
-	protected $loader;
99
-
100
-	/**
101
-	 * The unique identifier of this plugin.
102
-	 *
103
-	 * @since    1.0.0
104
-	 * @access   protected
105
-	 * @var      string $plugin_name The string used to uniquely identify this plugin.
106
-	 */
107
-	protected $plugin_name;
108
-
109
-	/**
110
-	 * The current version of the plugin.
111
-	 *
112
-	 * @since    1.0.0
113
-	 * @access   protected
114
-	 * @var      string $version The current version of the plugin.
115
-	 */
116
-	protected $version;
117
-
118
-	/**
119
-	 * The {@link Wordlift_Tinymce_Adapter} instance.
120
-	 *
121
-	 * @since  3.12.0
122
-	 * @access protected
123
-	 * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
124
-	 */
125
-	protected $tinymce_adapter;
126
-
127
-	/**
128
-	 * The {@link Faq_Tinymce_Adapter} instance
129
-	 * @since 3.26.0
130
-	 * @access protected
131
-	 * @var Faq_Tinymce_Adapter $faq_tinymce_adapter .
132
-	 */
133
-	//protected $faq_tinymce_adapter;
134
-
135
-	/**
136
-	 * The Thumbnail service.
137
-	 *
138
-	 * @since  3.1.5
139
-	 * @access private
140
-	 * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
141
-	 */
142
-	private $thumbnail_service;
143
-
144
-	/**
145
-	 * The UI service.
146
-	 *
147
-	 * @since  3.2.0
148
-	 * @access private
149
-	 * @var \Wordlift_UI_Service $ui_service The UI service.
150
-	 */
151
-	private $ui_service;
152
-
153
-	/**
154
-	 * The Schema service.
155
-	 *
156
-	 * @since  3.3.0
157
-	 * @access protected
158
-	 * @var \Wordlift_Schema_Service $schema_service The Schema service.
159
-	 */
160
-	protected $schema_service;
161
-
162
-	/**
163
-	 * The Entity service.
164
-	 *
165
-	 * @since  3.1.0
166
-	 * @access protected
167
-	 * @var \Wordlift_Entity_Service $entity_service The Entity service.
168
-	 */
169
-	protected $entity_service;
170
-
171
-	/**
172
-	 * The Topic Taxonomy service.
173
-	 *
174
-	 * @since  3.5.0
175
-	 * @access private
176
-	 * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
177
-	 */
178
-	private $topic_taxonomy_service;
179
-
180
-	/**
181
-	 * The Entity Types Taxonomy service.
182
-	 *
183
-	 * @since  3.18.0
184
-	 * @access private
185
-	 * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service.
186
-	 */
187
-	private $entity_types_taxonomy_service;
188
-
189
-	/**
190
-	 * The User service.
191
-	 *
192
-	 * @since  3.1.7
193
-	 * @access protected
194
-	 * @var \Wordlift_User_Service $user_service The User service.
195
-	 */
196
-	protected $user_service;
197
-
198
-	/**
199
-	 * The Timeline service.
200
-	 *
201
-	 * @since  3.1.0
202
-	 * @access private
203
-	 * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
204
-	 */
205
-	private $timeline_service;
206
-
207
-	/**
208
-	 * The Redirect service.
209
-	 *
210
-	 * @since  3.2.0
211
-	 * @access private
212
-	 * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
213
-	 */
214
-	private $redirect_service;
215
-
216
-	/**
217
-	 * The Notice service.
218
-	 *
219
-	 * @since  3.3.0
220
-	 * @access private
221
-	 * @var \Wordlift_Notice_Service $notice_service The Notice service.
222
-	 */
223
-	private $notice_service;
224
-
225
-	/**
226
-	 * The Entity list customization.
227
-	 *
228
-	 * @since  3.3.0
229
-	 * @access protected
230
-	 * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
231
-	 */
232
-	protected $entity_list_service;
233
-
234
-	/**
235
-	 * The Entity Types Taxonomy Walker.
236
-	 *
237
-	 * @since  3.1.0
238
-	 * @access private
239
-	 * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
240
-	 */
241
-	private $entity_types_taxonomy_walker;
242
-
243
-	/**
244
-	 * The ShareThis service.
245
-	 *
246
-	 * @since  3.2.0
247
-	 * @access private
248
-	 * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
249
-	 */
250
-	private $sharethis_service;
251
-
252
-	/**
253
-	 * The PrimaShop adapter.
254
-	 *
255
-	 * @since  3.2.3
256
-	 * @access private
257
-	 * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
258
-	 */
259
-	private $primashop_adapter;
260
-
261
-	/**
262
-	 * The WordLift Dashboard adapter.
263
-	 *
264
-	 * @since  3.4.0
265
-	 * @access private
266
-	 * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
267
-	 */
268
-	private $dashboard_service;
269
-
270
-	/**
271
-	 * The entity type service.
272
-	 *
273
-	 * @since  3.6.0
274
-	 * @access private
275
-	 * @var \Wordlift_Entity_Post_Type_Service
276
-	 */
277
-	private $entity_post_type_service;
278
-
279
-	/**
280
-	 * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
281
-	 *
282
-	 * @since  3.6.0
283
-	 * @access private
284
-	 * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance.
285
-	 */
286
-	private $entity_link_service;
287
-
288
-	/**
289
-	 * A {@link Wordlift_Sparql_Service} instance.
290
-	 *
291
-	 * @since    3.6.0
292
-	 * @access   protected
293
-	 * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
294
-	 */
295
-	protected $sparql_service;
296
-
297
-	/**
298
-	 * A {@link Wordlift_Import_Service} instance.
299
-	 *
300
-	 * @since  3.6.0
301
-	 * @access private
302
-	 * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
303
-	 */
304
-	private $import_service;
305
-
306
-	/**
307
-	 * A {@link Wordlift_Rebuild_Service} instance.
308
-	 *
309
-	 * @since  3.6.0
310
-	 * @access private
311
-	 * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
312
-	 */
313
-	private $rebuild_service;
314
-
315
-	/**
316
-	 * A {@link Wordlift_Jsonld_Service} instance.
317
-	 *
318
-	 * @since  3.7.0
319
-	 * @access protected
320
-	 * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
321
-	 */
322
-	protected $jsonld_service;
323
-
324
-	/**
325
-	 * A {@link Wordlift_Website_Jsonld_Converter} instance.
326
-	 *
327
-	 * @since  3.14.0
328
-	 * @access protected
329
-	 * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance.
330
-	 */
331
-	protected $jsonld_website_converter;
332
-
333
-	/**
334
-	 * A {@link Wordlift_Property_Factory} instance.
335
-	 *
336
-	 * @since  3.7.0
337
-	 * @access private
338
-	 * @var \Wordlift_Property_Factory $property_factory
339
-	 */
340
-	private $property_factory;
341
-
342
-	/**
343
-	 * The 'Download Your Data' page.
344
-	 *
345
-	 * @since  3.6.0
346
-	 * @access private
347
-	 * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
348
-	 */
349
-	private $download_your_data_page;
350
-
351
-	/**
352
-	 * The 'WordLift Settings' page.
353
-	 *
354
-	 * @since  3.11.0
355
-	 * @access protected
356
-	 * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
357
-	 */
358
-	protected $settings_page;
359
-
360
-	/**
361
-	 * The install wizard page.
362
-	 *
363
-	 * @since  3.9.0
364
-	 * @access private
365
-	 * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
366
-	 */
367
-	public $admin_setup;
368
-
369
-	/**
370
-	 * The Content Filter Service hooks up to the 'the_content' filter and provides
371
-	 * linking of entities to their pages.
372
-	 *
373
-	 * @since  3.8.0
374
-	 * @access private
375
-	 * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
376
-	 */
377
-	private $content_filter_service;
378
-
379
-	/**
380
-	 * The Faq Content filter service
381
-	 * @since  3.26.0
382
-	 * @access private
383
-	 * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance.
384
-	 */
385
-	private $faq_content_filter_service;
386
-
387
-	/**
388
-	 * A {@link Wordlift_Key_Validation_Service} instance.
389
-	 *
390
-	 * @since  3.9.0
391
-	 * @access private
392
-	 * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
393
-	 */
394
-	private $key_validation_service;
395
-
396
-	/**
397
-	 * A {@link Wordlift_Rating_Service} instance.
398
-	 *
399
-	 * @since  3.10.0
400
-	 * @access private
401
-	 * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
402
-	 */
403
-	private $rating_service;
404
-
405
-	/**
406
-	 * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
407
-	 *
408
-	 * @since  3.10.0
409
-	 * @access protected
410
-	 * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
411
-	 */
412
-	protected $post_to_jsonld_converter;
413
-
414
-	/**
415
-	 * A {@link Wordlift_Configuration_Service} instance.
416
-	 *
417
-	 * @since  3.10.0
418
-	 * @access protected
419
-	 * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
420
-	 */
421
-	protected $configuration_service;
422
-
423
-	/**
424
-	 * A {@link Wordlift_Install_Service} instance.
425
-	 *
426
-	 * @since  3.18.0
427
-	 * @access protected
428
-	 * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance.
429
-	 */
430
-	protected $install_service;
431
-
432
-	/**
433
-	 * A {@link Wordlift_Entity_Type_Service} instance.
434
-	 *
435
-	 * @since  3.10.0
436
-	 * @access protected
437
-	 * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
438
-	 */
439
-	protected $entity_type_service;
440
-
441
-	/**
442
-	 * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
443
-	 *
444
-	 * @since  3.10.0
445
-	 * @access protected
446
-	 * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
447
-	 */
448
-	protected $entity_post_to_jsonld_converter;
449
-
450
-	/**
451
-	 * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
452
-	 *
453
-	 * @since  3.10.0
454
-	 * @access protected
455
-	 * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
456
-	 */
457
-	protected $postid_to_jsonld_converter;
458
-
459
-	/**
460
-	 * The {@link Wordlift_Admin_Status_Page} class.
461
-	 *
462
-	 * @since  3.9.8
463
-	 * @access private
464
-	 * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
465
-	 */
466
-	private $status_page;
467
-
468
-	/**
469
-	 * The {@link Wordlift_Category_Taxonomy_Service} instance.
470
-	 *
471
-	 * @since  3.11.0
472
-	 * @access protected
473
-	 * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
474
-	 */
475
-	protected $category_taxonomy_service;
476
-
477
-	/**
478
-	 * The {@link Wordlift_Entity_Page_Service} instance.
479
-	 *
480
-	 * @since  3.11.0
481
-	 * @access protected
482
-	 * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance.
483
-	 */
484
-	protected $entity_page_service;
485
-
486
-	/**
487
-	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
488
-	 *
489
-	 * @since  3.11.0
490
-	 * @access protected
491
-	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
492
-	 */
493
-	protected $settings_page_action_link;
494
-
495
-	/**
496
-	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
497
-	 *
498
-	 * @since  3.11.0
499
-	 * @access protected
500
-	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
501
-	 */
502
-	protected $analytics_settings_page_action_link;
503
-
504
-	/**
505
-	 * The {@link Wordlift_Analytics_Connect} class.
506
-	 *
507
-	 * @since  3.11.0
508
-	 * @access protected
509
-	 * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class.
510
-	 */
511
-	protected $analytics_connect;
512
-
513
-	/**
514
-	 * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
515
-	 *
516
-	 * @since  3.11.0
517
-	 * @access protected
518
-	 * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
519
-	 */
520
-	protected $publisher_ajax_adapter;
521
-
522
-	/**
523
-	 * The {@link Wordlift_Admin_Input_Element} element renderer.
524
-	 *
525
-	 * @since  3.11.0
526
-	 * @access protected
527
-	 * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
528
-	 */
529
-	protected $input_element;
530
-
531
-	/**
532
-	 * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
533
-	 *
534
-	 * @since  3.13.0
535
-	 * @access protected
536
-	 * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
537
-	 */
538
-	protected $radio_input_element;
539
-
540
-	/**
541
-	 * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
542
-	 *
543
-	 * @since  3.11.0
544
-	 * @access protected
545
-	 * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
546
-	 */
547
-	protected $language_select_element;
548
-
549
-	/**
550
-	 * The {@link Wordlift_Admin_Country_Select_Element} element renderer.
551
-	 *
552
-	 * @since  3.18.0
553
-	 * @access protected
554
-	 * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer.
555
-	 */
556
-	protected $country_select_element;
557
-
558
-	/**
559
-	 * The {@link Wordlift_Admin_Publisher_Element} element renderer.
560
-	 *
561
-	 * @since  3.11.0
562
-	 * @access protected
563
-	 * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
564
-	 */
565
-	protected $publisher_element;
566
-
567
-	/**
568
-	 * The {@link Wordlift_Admin_Select2_Element} element renderer.
569
-	 *
570
-	 * @since  3.11.0
571
-	 * @access protected
572
-	 * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
573
-	 */
574
-	protected $select2_element;
575
-
576
-	/**
577
-	 * The controller for the entity type list admin page
578
-	 *
579
-	 * @since  3.11.0
580
-	 * @access private
581
-	 * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
582
-	 */
583
-	private $entity_type_admin_page;
584
-
585
-	/**
586
-	 * The controller for the entity type settings admin page
587
-	 *
588
-	 * @since  3.11.0
589
-	 * @access private
590
-	 * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
591
-	 */
592
-	private $entity_type_settings_admin_page;
593
-
594
-	/**
595
-	 * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
596
-	 *
597
-	 * @since  3.11.0
598
-	 * @access protected
599
-	 * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
600
-	 */
601
-	protected $related_entities_cloud_widget;
602
-
603
-	/**
604
-	 * The {@link Wordlift_Admin_Author_Element} instance.
605
-	 *
606
-	 * @since  3.14.0
607
-	 * @access protected
608
-	 * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
609
-	 */
610
-	protected $author_element;
611
-
612
-	/**
613
-	 * The {@link Wordlift_Sample_Data_Service} instance.
614
-	 *
615
-	 * @since  3.12.0
616
-	 * @access protected
617
-	 * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
618
-	 */
619
-	protected $sample_data_service;
620
-
621
-	/**
622
-	 * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
623
-	 *
624
-	 * @since  3.12.0
625
-	 * @access protected
626
-	 * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
627
-	 */
628
-	protected $sample_data_ajax_adapter;
629
-
630
-	/**
631
-	 * The {@link Wordlift_Relation_Rebuild_Service} instance.
632
-	 *
633
-	 * @since  3.14.3
634
-	 * @access private
635
-	 * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance.
636
-	 */
637
-	private $relation_rebuild_service;
638
-
639
-	/**
640
-	 * The {@link Wordlift_Relation_Rebuild_Adapter} instance.
641
-	 *
642
-	 * @since  3.14.3
643
-	 * @access private
644
-	 * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance.
645
-	 */
646
-	private $relation_rebuild_adapter;
647
-
648
-	/**
649
-	 * The {@link Wordlift_Reference_Rebuild_Service} instance.
650
-	 *
651
-	 * @since  3.18.0
652
-	 * @access private
653
-	 * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance.
654
-	 */
655
-	private $reference_rebuild_service;
656
-
657
-	/**
658
-	 * The {@link Wordlift_Google_Analytics_Export_Service} instance.
659
-	 *
660
-	 * @since  3.16.0
661
-	 * @access protected
662
-	 * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance.
663
-	 */
664
-	protected $google_analytics_export_service;
665
-
666
-	/**
667
-	 * {@link Wordlift}'s singleton instance.
668
-	 *
669
-	 * @since  3.15.0
670
-	 * @access protected
671
-	 * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance.
672
-	 */
673
-	protected $entity_type_adapter;
674
-
675
-	/**
676
-	 * The {@link Wordlift_Storage_Factory} instance.
677
-	 *
678
-	 * @since  3.15.0
679
-	 * @access protected
680
-	 * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance.
681
-	 */
682
-	protected $storage_factory;
683
-
684
-	/**
685
-	 * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
686
-	 *
687
-	 * @since  3.15.0
688
-	 * @access protected
689
-	 * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
690
-	 */
691
-	protected $rendition_factory;
692
-
693
-	/**
694
-	 * The {@link Wordlift_Autocomplete_Adapter} instance.
695
-	 *
696
-	 * @since  3.15.0
697
-	 * @access private
698
-	 * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance.
699
-	 */
700
-	private $autocomplete_adapter;
701
-
702
-	/**
703
-	 * The {@link Wordlift_Relation_Service} instance.
704
-	 *
705
-	 * @since  3.15.0
706
-	 * @access protected
707
-	 * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
708
-	 */
709
-	protected $relation_service;
710
-
711
-	/**
712
-	 * The {@link Wordlift_Cached_Post_Converter} instance.
713
-	 *
714
-	 * @since  3.16.0
715
-	 * @access protected
716
-	 * @var  \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance.
717
-	 *
718
-	 */
719
-	protected $cached_postid_to_jsonld_converter;
720
-
721
-	/**
722
-	 * The {@link Wordlift_Entity_Uri_Service} instance.
723
-	 *
724
-	 * @since  3.16.3
725
-	 * @access protected
726
-	 * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
727
-	 */
728
-	protected $entity_uri_service;
729
-
730
-	/**
731
-	 * The {@link Wordlift_Publisher_Service} instance.
732
-	 *
733
-	 * @since  3.19.0
734
-	 * @access protected
735
-	 * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
736
-	 */
737
-	protected $publisher_service;
738
-
739
-	/**
740
-	 * The {@link Wordlift_Context_Cards_Service} instance.
741
-	 *
742
-	 * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance.
743
-	 */
744
-	protected $context_cards_service;
745
-
746
-	/**
747
-	 * {@link Wordlift}'s singleton instance.
748
-	 *
749
-	 * @since  3.11.2
750
-	 * @access private
751
-	 * @var Wordlift $instance {@link Wordlift}'s singleton instance.
752
-	 */
753
-	private static $instance;
754
-
755
-	/**
756
-	 * A singleton instance of features registry.
757
-	 * @since 3.30.0
758
-	 * @var Features_Registry
759
-	 */
760
-	private $features_registry;
761
-
762
-	//</editor-fold>
763
-
764
-	/**
765
-	 * Define the core functionality of the plugin.
766
-	 *
767
-	 * Set the plugin name and the plugin version that can be used throughout the plugin.
768
-	 * Load the dependencies, define the locale, and set the hooks for the admin area and
769
-	 * the public-facing side of the site.
770
-	 *
771
-	 * @since    1.0.0
772
-	 */
773
-	public function __construct() {
774
-
775
-		self::$instance = $this;
776
-
777
-		$this->plugin_name = 'wordlift';
778
-		$this->version     = '3.33.2';
779
-		$this->load_dependencies();
780
-		$this->set_locale();
781
-		$this->define_admin_hooks();
782
-		$this->define_public_hooks();
783
-
784
-		// If we're in `WP_CLI` load the related files.
785
-		if ( class_exists( 'WP_CLI' ) ) {
786
-			$this->load_cli_dependencies();
787
-		}
788
-
789
-	}
790
-
791
-	/**
792
-	 * Get the singleton instance.
793
-	 *
794
-	 * @return Wordlift The {@link Wordlift} singleton instance.
795
-	 * @since 3.11.2
796
-	 *
797
-	 */
798
-	public static function get_instance() {
799
-
800
-		return self::$instance;
801
-	}
802
-
803
-	/**
804
-	 * Load the required dependencies for this plugin.
805
-	 *
806
-	 * Include the following files that make up the plugin:
807
-	 *
808
-	 * - Wordlift_Loader. Orchestrates the hooks of the plugin.
809
-	 * - Wordlift_i18n. Defines internationalization functionality.
810
-	 * - Wordlift_Admin. Defines all hooks for the admin area.
811
-	 * - Wordlift_Public. Defines all hooks for the public side of the site.
812
-	 *
813
-	 * Create an instance of the loader which will be used to register the hooks
814
-	 * with WordPress.
815
-	 *
816
-	 * @throws Exception
817
-	 * @since    1.0.0
818
-	 * @access   private
819
-	 */
820
-	private function load_dependencies() {
821
-
822
-		/**
823
-		 * The class responsible for orchestrating the actions and filters of the
824
-		 * core plugin.
825
-		 */
826
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
827
-
828
-		// The class responsible for plugin uninstall.
829
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php';
830
-
831
-		/**
832
-		 * The class responsible for defining internationalization functionality
833
-		 * of the plugin.
834
-		 */
835
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
836
-
837
-		/**
838
-		 * WordLift's supported languages.
839
-		 */
840
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
841
-
842
-		/**
843
-		 * WordLift's supported countries.
844
-		 */
845
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php';
846
-
847
-		/**
848
-		 * Provide support functions to sanitize data.
849
-		 */
850
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
851
-
852
-		/** Services. */
853
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
854
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
855
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
856
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
857
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
858
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
859
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
860
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
861
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
862
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php';
863
-
864
-		/**
865
-		 * The Query builder.
866
-		 */
867
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
868
-
869
-		/**
870
-		 * The Schema service.
871
-		 */
872
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
873
-
874
-		/**
875
-		 * The schema:url property service.
876
-		 */
877
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
878
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
879
-
880
-		/**
881
-		 * The UI service.
882
-		 */
883
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
884
-
885
-		/**
886
-		 * The Thumbnail service.
887
-		 */
888
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
889
-
890
-		/**
891
-		 * The Entity Types Taxonomy service.
892
-		 */
893
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
894
-
895
-		/**
896
-		 * The Entity service.
897
-		 */
898
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
899
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
900
-
901
-		// Add the entity rating service.
902
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
903
-
904
-		/**
905
-		 * The User service.
906
-		 */
907
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
908
-
909
-		/**
910
-		 * The Timeline service.
911
-		 */
912
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
913
-
914
-		/**
915
-		 * The Topic Taxonomy service.
916
-		 */
917
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
918
-
919
-		/**
920
-		 * The SPARQL service.
921
-		 */
922
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
923
-
924
-		/**
925
-		 * The WordLift import service.
926
-		 */
927
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
928
-
929
-		/**
930
-		 * The WordLift URI service.
931
-		 */
932
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
933
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
934
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
935
-
936
-		/**
937
-		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
938
-		 */
939
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php';
940
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php';
941
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php';
942
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php';
943
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
944
-
945
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
946
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
947
-
948
-		/**
949
-		 * Load the converters.
950
-		 */
951
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
952
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
953
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
954
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
955
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
956
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
957
-
958
-		/**
959
-		 * Load cache-related files.
960
-		 */
961
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
962
-
963
-		/**
964
-		 * Load the content filter.
965
-		 */
966
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
967
-
968
-		/*
88
+    //<editor-fold desc="## FIELDS">
89
+
90
+    /**
91
+     * The loader that's responsible for maintaining and registering all hooks that power
92
+     * the plugin.
93
+     *
94
+     * @since    1.0.0
95
+     * @access   protected
96
+     * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
97
+     */
98
+    protected $loader;
99
+
100
+    /**
101
+     * The unique identifier of this plugin.
102
+     *
103
+     * @since    1.0.0
104
+     * @access   protected
105
+     * @var      string $plugin_name The string used to uniquely identify this plugin.
106
+     */
107
+    protected $plugin_name;
108
+
109
+    /**
110
+     * The current version of the plugin.
111
+     *
112
+     * @since    1.0.0
113
+     * @access   protected
114
+     * @var      string $version The current version of the plugin.
115
+     */
116
+    protected $version;
117
+
118
+    /**
119
+     * The {@link Wordlift_Tinymce_Adapter} instance.
120
+     *
121
+     * @since  3.12.0
122
+     * @access protected
123
+     * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
124
+     */
125
+    protected $tinymce_adapter;
126
+
127
+    /**
128
+     * The {@link Faq_Tinymce_Adapter} instance
129
+     * @since 3.26.0
130
+     * @access protected
131
+     * @var Faq_Tinymce_Adapter $faq_tinymce_adapter .
132
+     */
133
+    //protected $faq_tinymce_adapter;
134
+
135
+    /**
136
+     * The Thumbnail service.
137
+     *
138
+     * @since  3.1.5
139
+     * @access private
140
+     * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
141
+     */
142
+    private $thumbnail_service;
143
+
144
+    /**
145
+     * The UI service.
146
+     *
147
+     * @since  3.2.0
148
+     * @access private
149
+     * @var \Wordlift_UI_Service $ui_service The UI service.
150
+     */
151
+    private $ui_service;
152
+
153
+    /**
154
+     * The Schema service.
155
+     *
156
+     * @since  3.3.0
157
+     * @access protected
158
+     * @var \Wordlift_Schema_Service $schema_service The Schema service.
159
+     */
160
+    protected $schema_service;
161
+
162
+    /**
163
+     * The Entity service.
164
+     *
165
+     * @since  3.1.0
166
+     * @access protected
167
+     * @var \Wordlift_Entity_Service $entity_service The Entity service.
168
+     */
169
+    protected $entity_service;
170
+
171
+    /**
172
+     * The Topic Taxonomy service.
173
+     *
174
+     * @since  3.5.0
175
+     * @access private
176
+     * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
177
+     */
178
+    private $topic_taxonomy_service;
179
+
180
+    /**
181
+     * The Entity Types Taxonomy service.
182
+     *
183
+     * @since  3.18.0
184
+     * @access private
185
+     * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service.
186
+     */
187
+    private $entity_types_taxonomy_service;
188
+
189
+    /**
190
+     * The User service.
191
+     *
192
+     * @since  3.1.7
193
+     * @access protected
194
+     * @var \Wordlift_User_Service $user_service The User service.
195
+     */
196
+    protected $user_service;
197
+
198
+    /**
199
+     * The Timeline service.
200
+     *
201
+     * @since  3.1.0
202
+     * @access private
203
+     * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
204
+     */
205
+    private $timeline_service;
206
+
207
+    /**
208
+     * The Redirect service.
209
+     *
210
+     * @since  3.2.0
211
+     * @access private
212
+     * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
213
+     */
214
+    private $redirect_service;
215
+
216
+    /**
217
+     * The Notice service.
218
+     *
219
+     * @since  3.3.0
220
+     * @access private
221
+     * @var \Wordlift_Notice_Service $notice_service The Notice service.
222
+     */
223
+    private $notice_service;
224
+
225
+    /**
226
+     * The Entity list customization.
227
+     *
228
+     * @since  3.3.0
229
+     * @access protected
230
+     * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
231
+     */
232
+    protected $entity_list_service;
233
+
234
+    /**
235
+     * The Entity Types Taxonomy Walker.
236
+     *
237
+     * @since  3.1.0
238
+     * @access private
239
+     * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
240
+     */
241
+    private $entity_types_taxonomy_walker;
242
+
243
+    /**
244
+     * The ShareThis service.
245
+     *
246
+     * @since  3.2.0
247
+     * @access private
248
+     * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
249
+     */
250
+    private $sharethis_service;
251
+
252
+    /**
253
+     * The PrimaShop adapter.
254
+     *
255
+     * @since  3.2.3
256
+     * @access private
257
+     * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
258
+     */
259
+    private $primashop_adapter;
260
+
261
+    /**
262
+     * The WordLift Dashboard adapter.
263
+     *
264
+     * @since  3.4.0
265
+     * @access private
266
+     * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
267
+     */
268
+    private $dashboard_service;
269
+
270
+    /**
271
+     * The entity type service.
272
+     *
273
+     * @since  3.6.0
274
+     * @access private
275
+     * @var \Wordlift_Entity_Post_Type_Service
276
+     */
277
+    private $entity_post_type_service;
278
+
279
+    /**
280
+     * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
281
+     *
282
+     * @since  3.6.0
283
+     * @access private
284
+     * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance.
285
+     */
286
+    private $entity_link_service;
287
+
288
+    /**
289
+     * A {@link Wordlift_Sparql_Service} instance.
290
+     *
291
+     * @since    3.6.0
292
+     * @access   protected
293
+     * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
294
+     */
295
+    protected $sparql_service;
296
+
297
+    /**
298
+     * A {@link Wordlift_Import_Service} instance.
299
+     *
300
+     * @since  3.6.0
301
+     * @access private
302
+     * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
303
+     */
304
+    private $import_service;
305
+
306
+    /**
307
+     * A {@link Wordlift_Rebuild_Service} instance.
308
+     *
309
+     * @since  3.6.0
310
+     * @access private
311
+     * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
312
+     */
313
+    private $rebuild_service;
314
+
315
+    /**
316
+     * A {@link Wordlift_Jsonld_Service} instance.
317
+     *
318
+     * @since  3.7.0
319
+     * @access protected
320
+     * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
321
+     */
322
+    protected $jsonld_service;
323
+
324
+    /**
325
+     * A {@link Wordlift_Website_Jsonld_Converter} instance.
326
+     *
327
+     * @since  3.14.0
328
+     * @access protected
329
+     * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance.
330
+     */
331
+    protected $jsonld_website_converter;
332
+
333
+    /**
334
+     * A {@link Wordlift_Property_Factory} instance.
335
+     *
336
+     * @since  3.7.0
337
+     * @access private
338
+     * @var \Wordlift_Property_Factory $property_factory
339
+     */
340
+    private $property_factory;
341
+
342
+    /**
343
+     * The 'Download Your Data' page.
344
+     *
345
+     * @since  3.6.0
346
+     * @access private
347
+     * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
348
+     */
349
+    private $download_your_data_page;
350
+
351
+    /**
352
+     * The 'WordLift Settings' page.
353
+     *
354
+     * @since  3.11.0
355
+     * @access protected
356
+     * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
357
+     */
358
+    protected $settings_page;
359
+
360
+    /**
361
+     * The install wizard page.
362
+     *
363
+     * @since  3.9.0
364
+     * @access private
365
+     * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
366
+     */
367
+    public $admin_setup;
368
+
369
+    /**
370
+     * The Content Filter Service hooks up to the 'the_content' filter and provides
371
+     * linking of entities to their pages.
372
+     *
373
+     * @since  3.8.0
374
+     * @access private
375
+     * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
376
+     */
377
+    private $content_filter_service;
378
+
379
+    /**
380
+     * The Faq Content filter service
381
+     * @since  3.26.0
382
+     * @access private
383
+     * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance.
384
+     */
385
+    private $faq_content_filter_service;
386
+
387
+    /**
388
+     * A {@link Wordlift_Key_Validation_Service} instance.
389
+     *
390
+     * @since  3.9.0
391
+     * @access private
392
+     * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
393
+     */
394
+    private $key_validation_service;
395
+
396
+    /**
397
+     * A {@link Wordlift_Rating_Service} instance.
398
+     *
399
+     * @since  3.10.0
400
+     * @access private
401
+     * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
402
+     */
403
+    private $rating_service;
404
+
405
+    /**
406
+     * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
407
+     *
408
+     * @since  3.10.0
409
+     * @access protected
410
+     * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
411
+     */
412
+    protected $post_to_jsonld_converter;
413
+
414
+    /**
415
+     * A {@link Wordlift_Configuration_Service} instance.
416
+     *
417
+     * @since  3.10.0
418
+     * @access protected
419
+     * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
420
+     */
421
+    protected $configuration_service;
422
+
423
+    /**
424
+     * A {@link Wordlift_Install_Service} instance.
425
+     *
426
+     * @since  3.18.0
427
+     * @access protected
428
+     * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance.
429
+     */
430
+    protected $install_service;
431
+
432
+    /**
433
+     * A {@link Wordlift_Entity_Type_Service} instance.
434
+     *
435
+     * @since  3.10.0
436
+     * @access protected
437
+     * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
438
+     */
439
+    protected $entity_type_service;
440
+
441
+    /**
442
+     * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
443
+     *
444
+     * @since  3.10.0
445
+     * @access protected
446
+     * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
447
+     */
448
+    protected $entity_post_to_jsonld_converter;
449
+
450
+    /**
451
+     * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
452
+     *
453
+     * @since  3.10.0
454
+     * @access protected
455
+     * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
456
+     */
457
+    protected $postid_to_jsonld_converter;
458
+
459
+    /**
460
+     * The {@link Wordlift_Admin_Status_Page} class.
461
+     *
462
+     * @since  3.9.8
463
+     * @access private
464
+     * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
465
+     */
466
+    private $status_page;
467
+
468
+    /**
469
+     * The {@link Wordlift_Category_Taxonomy_Service} instance.
470
+     *
471
+     * @since  3.11.0
472
+     * @access protected
473
+     * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
474
+     */
475
+    protected $category_taxonomy_service;
476
+
477
+    /**
478
+     * The {@link Wordlift_Entity_Page_Service} instance.
479
+     *
480
+     * @since  3.11.0
481
+     * @access protected
482
+     * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance.
483
+     */
484
+    protected $entity_page_service;
485
+
486
+    /**
487
+     * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
488
+     *
489
+     * @since  3.11.0
490
+     * @access protected
491
+     * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
492
+     */
493
+    protected $settings_page_action_link;
494
+
495
+    /**
496
+     * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
497
+     *
498
+     * @since  3.11.0
499
+     * @access protected
500
+     * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
501
+     */
502
+    protected $analytics_settings_page_action_link;
503
+
504
+    /**
505
+     * The {@link Wordlift_Analytics_Connect} class.
506
+     *
507
+     * @since  3.11.0
508
+     * @access protected
509
+     * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class.
510
+     */
511
+    protected $analytics_connect;
512
+
513
+    /**
514
+     * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
515
+     *
516
+     * @since  3.11.0
517
+     * @access protected
518
+     * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
519
+     */
520
+    protected $publisher_ajax_adapter;
521
+
522
+    /**
523
+     * The {@link Wordlift_Admin_Input_Element} element renderer.
524
+     *
525
+     * @since  3.11.0
526
+     * @access protected
527
+     * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
528
+     */
529
+    protected $input_element;
530
+
531
+    /**
532
+     * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
533
+     *
534
+     * @since  3.13.0
535
+     * @access protected
536
+     * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
537
+     */
538
+    protected $radio_input_element;
539
+
540
+    /**
541
+     * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
542
+     *
543
+     * @since  3.11.0
544
+     * @access protected
545
+     * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
546
+     */
547
+    protected $language_select_element;
548
+
549
+    /**
550
+     * The {@link Wordlift_Admin_Country_Select_Element} element renderer.
551
+     *
552
+     * @since  3.18.0
553
+     * @access protected
554
+     * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer.
555
+     */
556
+    protected $country_select_element;
557
+
558
+    /**
559
+     * The {@link Wordlift_Admin_Publisher_Element} element renderer.
560
+     *
561
+     * @since  3.11.0
562
+     * @access protected
563
+     * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
564
+     */
565
+    protected $publisher_element;
566
+
567
+    /**
568
+     * The {@link Wordlift_Admin_Select2_Element} element renderer.
569
+     *
570
+     * @since  3.11.0
571
+     * @access protected
572
+     * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
573
+     */
574
+    protected $select2_element;
575
+
576
+    /**
577
+     * The controller for the entity type list admin page
578
+     *
579
+     * @since  3.11.0
580
+     * @access private
581
+     * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
582
+     */
583
+    private $entity_type_admin_page;
584
+
585
+    /**
586
+     * The controller for the entity type settings admin page
587
+     *
588
+     * @since  3.11.0
589
+     * @access private
590
+     * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
591
+     */
592
+    private $entity_type_settings_admin_page;
593
+
594
+    /**
595
+     * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
596
+     *
597
+     * @since  3.11.0
598
+     * @access protected
599
+     * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
600
+     */
601
+    protected $related_entities_cloud_widget;
602
+
603
+    /**
604
+     * The {@link Wordlift_Admin_Author_Element} instance.
605
+     *
606
+     * @since  3.14.0
607
+     * @access protected
608
+     * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
609
+     */
610
+    protected $author_element;
611
+
612
+    /**
613
+     * The {@link Wordlift_Sample_Data_Service} instance.
614
+     *
615
+     * @since  3.12.0
616
+     * @access protected
617
+     * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
618
+     */
619
+    protected $sample_data_service;
620
+
621
+    /**
622
+     * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
623
+     *
624
+     * @since  3.12.0
625
+     * @access protected
626
+     * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
627
+     */
628
+    protected $sample_data_ajax_adapter;
629
+
630
+    /**
631
+     * The {@link Wordlift_Relation_Rebuild_Service} instance.
632
+     *
633
+     * @since  3.14.3
634
+     * @access private
635
+     * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance.
636
+     */
637
+    private $relation_rebuild_service;
638
+
639
+    /**
640
+     * The {@link Wordlift_Relation_Rebuild_Adapter} instance.
641
+     *
642
+     * @since  3.14.3
643
+     * @access private
644
+     * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance.
645
+     */
646
+    private $relation_rebuild_adapter;
647
+
648
+    /**
649
+     * The {@link Wordlift_Reference_Rebuild_Service} instance.
650
+     *
651
+     * @since  3.18.0
652
+     * @access private
653
+     * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance.
654
+     */
655
+    private $reference_rebuild_service;
656
+
657
+    /**
658
+     * The {@link Wordlift_Google_Analytics_Export_Service} instance.
659
+     *
660
+     * @since  3.16.0
661
+     * @access protected
662
+     * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance.
663
+     */
664
+    protected $google_analytics_export_service;
665
+
666
+    /**
667
+     * {@link Wordlift}'s singleton instance.
668
+     *
669
+     * @since  3.15.0
670
+     * @access protected
671
+     * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance.
672
+     */
673
+    protected $entity_type_adapter;
674
+
675
+    /**
676
+     * The {@link Wordlift_Storage_Factory} instance.
677
+     *
678
+     * @since  3.15.0
679
+     * @access protected
680
+     * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance.
681
+     */
682
+    protected $storage_factory;
683
+
684
+    /**
685
+     * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
686
+     *
687
+     * @since  3.15.0
688
+     * @access protected
689
+     * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
690
+     */
691
+    protected $rendition_factory;
692
+
693
+    /**
694
+     * The {@link Wordlift_Autocomplete_Adapter} instance.
695
+     *
696
+     * @since  3.15.0
697
+     * @access private
698
+     * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance.
699
+     */
700
+    private $autocomplete_adapter;
701
+
702
+    /**
703
+     * The {@link Wordlift_Relation_Service} instance.
704
+     *
705
+     * @since  3.15.0
706
+     * @access protected
707
+     * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
708
+     */
709
+    protected $relation_service;
710
+
711
+    /**
712
+     * The {@link Wordlift_Cached_Post_Converter} instance.
713
+     *
714
+     * @since  3.16.0
715
+     * @access protected
716
+     * @var  \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance.
717
+     *
718
+     */
719
+    protected $cached_postid_to_jsonld_converter;
720
+
721
+    /**
722
+     * The {@link Wordlift_Entity_Uri_Service} instance.
723
+     *
724
+     * @since  3.16.3
725
+     * @access protected
726
+     * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
727
+     */
728
+    protected $entity_uri_service;
729
+
730
+    /**
731
+     * The {@link Wordlift_Publisher_Service} instance.
732
+     *
733
+     * @since  3.19.0
734
+     * @access protected
735
+     * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
736
+     */
737
+    protected $publisher_service;
738
+
739
+    /**
740
+     * The {@link Wordlift_Context_Cards_Service} instance.
741
+     *
742
+     * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance.
743
+     */
744
+    protected $context_cards_service;
745
+
746
+    /**
747
+     * {@link Wordlift}'s singleton instance.
748
+     *
749
+     * @since  3.11.2
750
+     * @access private
751
+     * @var Wordlift $instance {@link Wordlift}'s singleton instance.
752
+     */
753
+    private static $instance;
754
+
755
+    /**
756
+     * A singleton instance of features registry.
757
+     * @since 3.30.0
758
+     * @var Features_Registry
759
+     */
760
+    private $features_registry;
761
+
762
+    //</editor-fold>
763
+
764
+    /**
765
+     * Define the core functionality of the plugin.
766
+     *
767
+     * Set the plugin name and the plugin version that can be used throughout the plugin.
768
+     * Load the dependencies, define the locale, and set the hooks for the admin area and
769
+     * the public-facing side of the site.
770
+     *
771
+     * @since    1.0.0
772
+     */
773
+    public function __construct() {
774
+
775
+        self::$instance = $this;
776
+
777
+        $this->plugin_name = 'wordlift';
778
+        $this->version     = '3.33.2';
779
+        $this->load_dependencies();
780
+        $this->set_locale();
781
+        $this->define_admin_hooks();
782
+        $this->define_public_hooks();
783
+
784
+        // If we're in `WP_CLI` load the related files.
785
+        if ( class_exists( 'WP_CLI' ) ) {
786
+            $this->load_cli_dependencies();
787
+        }
788
+
789
+    }
790
+
791
+    /**
792
+     * Get the singleton instance.
793
+     *
794
+     * @return Wordlift The {@link Wordlift} singleton instance.
795
+     * @since 3.11.2
796
+     *
797
+     */
798
+    public static function get_instance() {
799
+
800
+        return self::$instance;
801
+    }
802
+
803
+    /**
804
+     * Load the required dependencies for this plugin.
805
+     *
806
+     * Include the following files that make up the plugin:
807
+     *
808
+     * - Wordlift_Loader. Orchestrates the hooks of the plugin.
809
+     * - Wordlift_i18n. Defines internationalization functionality.
810
+     * - Wordlift_Admin. Defines all hooks for the admin area.
811
+     * - Wordlift_Public. Defines all hooks for the public side of the site.
812
+     *
813
+     * Create an instance of the loader which will be used to register the hooks
814
+     * with WordPress.
815
+     *
816
+     * @throws Exception
817
+     * @since    1.0.0
818
+     * @access   private
819
+     */
820
+    private function load_dependencies() {
821
+
822
+        /**
823
+         * The class responsible for orchestrating the actions and filters of the
824
+         * core plugin.
825
+         */
826
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
827
+
828
+        // The class responsible for plugin uninstall.
829
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php';
830
+
831
+        /**
832
+         * The class responsible for defining internationalization functionality
833
+         * of the plugin.
834
+         */
835
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
836
+
837
+        /**
838
+         * WordLift's supported languages.
839
+         */
840
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
841
+
842
+        /**
843
+         * WordLift's supported countries.
844
+         */
845
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php';
846
+
847
+        /**
848
+         * Provide support functions to sanitize data.
849
+         */
850
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
851
+
852
+        /** Services. */
853
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
854
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
855
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
856
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
857
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
858
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
859
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
860
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
861
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
862
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php';
863
+
864
+        /**
865
+         * The Query builder.
866
+         */
867
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
868
+
869
+        /**
870
+         * The Schema service.
871
+         */
872
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
873
+
874
+        /**
875
+         * The schema:url property service.
876
+         */
877
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
878
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
879
+
880
+        /**
881
+         * The UI service.
882
+         */
883
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
884
+
885
+        /**
886
+         * The Thumbnail service.
887
+         */
888
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
889
+
890
+        /**
891
+         * The Entity Types Taxonomy service.
892
+         */
893
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
894
+
895
+        /**
896
+         * The Entity service.
897
+         */
898
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
899
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
900
+
901
+        // Add the entity rating service.
902
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
903
+
904
+        /**
905
+         * The User service.
906
+         */
907
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
908
+
909
+        /**
910
+         * The Timeline service.
911
+         */
912
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
913
+
914
+        /**
915
+         * The Topic Taxonomy service.
916
+         */
917
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
918
+
919
+        /**
920
+         * The SPARQL service.
921
+         */
922
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
923
+
924
+        /**
925
+         * The WordLift import service.
926
+         */
927
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
928
+
929
+        /**
930
+         * The WordLift URI service.
931
+         */
932
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
933
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
934
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
935
+
936
+        /**
937
+         * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
938
+         */
939
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php';
940
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php';
941
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php';
942
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php';
943
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
944
+
945
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
946
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
947
+
948
+        /**
949
+         * Load the converters.
950
+         */
951
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
952
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
953
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
954
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
955
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
956
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
957
+
958
+        /**
959
+         * Load cache-related files.
960
+         */
961
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
962
+
963
+        /**
964
+         * Load the content filter.
965
+         */
966
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
967
+
968
+        /*
969 969
 		 * Load the excerpt helper.
970 970
 		 */
971
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
972
-
973
-		/**
974
-		 * Load the JSON-LD service to publish entities using JSON-LD.s
975
-		 *
976
-		 * @since 3.8.0
977
-		 */
978
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
979
-
980
-		// The Publisher Service and the AJAX adapter.
981
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
982
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
983
-
984
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
985
-
986
-		/**
987
-		 * Load the WordLift key validation service.
988
-		 */
989
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
990
-
991
-		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
992
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
993
-
994
-		// Load the `Wordlift_Entity_Page_Service` class definition.
995
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
996
-
997
-		/** Linked Data. */
998
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
999
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
1000
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
1001
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
1002
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
1003
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
1004
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
1005
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
1006
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
1007
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
1008
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
1009
-
1010
-		/** Linked Data Rendition. */
1011
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
1012
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
1013
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
1014
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
1015
-
1016
-		/** Services. */
1017
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
1018
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php';
1019
-
1020
-		/** Adapters. */
1021
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
1022
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
1023
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
1024
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
1025
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php';
1026
-
1027
-		/** Async Tasks. */
1028
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
1029
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
1030
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php';
1031
-
1032
-		/** Autocomplete. */
1033
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
1034
-
1035
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
1036
-
1037
-		/** Analytics */
1038
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php';
1039
-
1040
-		/**
1041
-		 * The class responsible for defining all actions that occur in the admin area.
1042
-		 */
1043
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
1044
-
1045
-		/**
1046
-		 * The class to customize the entity list admin page.
1047
-		 */
1048
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
1049
-
1050
-		/**
1051
-		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
1052
-		 */
1053
-		global $wp_version;
1054
-		if ( version_compare( $wp_version, '5.3', '<' ) ) {
1055
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
1056
-		} else {
1057
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php';
1058
-		}
1059
-
1060
-		/**
1061
-		 * The Notice service.
1062
-		 */
1063
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
1064
-
1065
-		/**
1066
-		 * The PrimaShop adapter.
1067
-		 */
1068
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
1069
-
1070
-		/**
1071
-		 * The WordLift Dashboard service.
1072
-		 */
1073
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
1074
-
1075
-		/**
1076
-		 * The admin 'Install wizard' page.
1077
-		 */
1078
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
1079
-
1080
-		/**
1081
-		 * The WordLift entity type list admin page controller.
1082
-		 */
1083
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1084
-
1085
-		/**
1086
-		 * The WordLift entity type settings admin page controller.
1087
-		 */
1088
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
1089
-
1090
-		/**
1091
-		 * The admin 'Download Your Data' page.
1092
-		 */
1093
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
1094
-
1095
-		/**
1096
-		 * The admin 'WordLift Settings' page.
1097
-		 */
1098
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php';
1099
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php';
1100
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php';
1101
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php';
1102
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php';
1103
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php';
1104
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php';
1105
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php';
1106
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php';
1107
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php';
1108
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
1109
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
1110
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php';
1111
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
1112
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php';
1113
-
1114
-		/** Admin Pages */
1115
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
1116
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
1117
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
1118
-
1119
-		/**
1120
-		 * The class responsible for defining all actions that occur in the public-facing
1121
-		 * side of the site.
1122
-		 */
1123
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1124
-
1125
-		/**
1126
-		 * The shortcode abstract class.
1127
-		 */
1128
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1129
-
1130
-		/**
1131
-		 * The Timeline shortcode.
1132
-		 */
1133
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1134
-
1135
-		/**
1136
-		 * The Navigator shortcode.
1137
-		 */
1138
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1139
-
1140
-		/**
1141
-		 * The Products Navigator shortcode.
1142
-		 */
1143
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php';
1144
-
1145
-		/**
1146
-		 * The chord shortcode.
1147
-		 */
1148
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1149
-
1150
-		/**
1151
-		 * The geomap shortcode.
1152
-		 */
1153
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1154
-
1155
-		/**
1156
-		 * The entity cloud shortcode.
1157
-		 */
1158
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1159
-
1160
-		/**
1161
-		 * The entity glossary shortcode.
1162
-		 */
1163
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1164
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1165
-
1166
-		/**
1167
-		 * Faceted Search shortcode.
1168
-		 */
1169
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php';
1170
-
1171
-		/**
1172
-		 * The ShareThis service.
1173
-		 */
1174
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1175
-
1176
-		/**
1177
-		 * The SEO service.
1178
-		 */
1179
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1180
-
1181
-		/**
1182
-		 * The AMP service.
1183
-		 */
1184
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1185
-
1186
-		/** Widgets */
1187
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1188
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1189
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php';
1190
-
1191
-		/*
971
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
972
+
973
+        /**
974
+         * Load the JSON-LD service to publish entities using JSON-LD.s
975
+         *
976
+         * @since 3.8.0
977
+         */
978
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
979
+
980
+        // The Publisher Service and the AJAX adapter.
981
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
982
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
983
+
984
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
985
+
986
+        /**
987
+         * Load the WordLift key validation service.
988
+         */
989
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
990
+
991
+        // Load the `Wordlift_Category_Taxonomy_Service` class definition.
992
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
993
+
994
+        // Load the `Wordlift_Entity_Page_Service` class definition.
995
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
996
+
997
+        /** Linked Data. */
998
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
999
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
1000
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
1001
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
1002
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
1003
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
1004
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
1005
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
1006
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
1007
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
1008
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
1009
+
1010
+        /** Linked Data Rendition. */
1011
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
1012
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
1013
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
1014
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
1015
+
1016
+        /** Services. */
1017
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
1018
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php';
1019
+
1020
+        /** Adapters. */
1021
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
1022
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
1023
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
1024
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
1025
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php';
1026
+
1027
+        /** Async Tasks. */
1028
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
1029
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
1030
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php';
1031
+
1032
+        /** Autocomplete. */
1033
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
1034
+
1035
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
1036
+
1037
+        /** Analytics */
1038
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php';
1039
+
1040
+        /**
1041
+         * The class responsible for defining all actions that occur in the admin area.
1042
+         */
1043
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
1044
+
1045
+        /**
1046
+         * The class to customize the entity list admin page.
1047
+         */
1048
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
1049
+
1050
+        /**
1051
+         * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
1052
+         */
1053
+        global $wp_version;
1054
+        if ( version_compare( $wp_version, '5.3', '<' ) ) {
1055
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
1056
+        } else {
1057
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php';
1058
+        }
1059
+
1060
+        /**
1061
+         * The Notice service.
1062
+         */
1063
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
1064
+
1065
+        /**
1066
+         * The PrimaShop adapter.
1067
+         */
1068
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
1069
+
1070
+        /**
1071
+         * The WordLift Dashboard service.
1072
+         */
1073
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
1074
+
1075
+        /**
1076
+         * The admin 'Install wizard' page.
1077
+         */
1078
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
1079
+
1080
+        /**
1081
+         * The WordLift entity type list admin page controller.
1082
+         */
1083
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1084
+
1085
+        /**
1086
+         * The WordLift entity type settings admin page controller.
1087
+         */
1088
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
1089
+
1090
+        /**
1091
+         * The admin 'Download Your Data' page.
1092
+         */
1093
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
1094
+
1095
+        /**
1096
+         * The admin 'WordLift Settings' page.
1097
+         */
1098
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php';
1099
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php';
1100
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php';
1101
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php';
1102
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php';
1103
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php';
1104
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php';
1105
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php';
1106
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php';
1107
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php';
1108
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
1109
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
1110
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php';
1111
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
1112
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php';
1113
+
1114
+        /** Admin Pages */
1115
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
1116
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
1117
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
1118
+
1119
+        /**
1120
+         * The class responsible for defining all actions that occur in the public-facing
1121
+         * side of the site.
1122
+         */
1123
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1124
+
1125
+        /**
1126
+         * The shortcode abstract class.
1127
+         */
1128
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1129
+
1130
+        /**
1131
+         * The Timeline shortcode.
1132
+         */
1133
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1134
+
1135
+        /**
1136
+         * The Navigator shortcode.
1137
+         */
1138
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1139
+
1140
+        /**
1141
+         * The Products Navigator shortcode.
1142
+         */
1143
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php';
1144
+
1145
+        /**
1146
+         * The chord shortcode.
1147
+         */
1148
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1149
+
1150
+        /**
1151
+         * The geomap shortcode.
1152
+         */
1153
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1154
+
1155
+        /**
1156
+         * The entity cloud shortcode.
1157
+         */
1158
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1159
+
1160
+        /**
1161
+         * The entity glossary shortcode.
1162
+         */
1163
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1164
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1165
+
1166
+        /**
1167
+         * Faceted Search shortcode.
1168
+         */
1169
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php';
1170
+
1171
+        /**
1172
+         * The ShareThis service.
1173
+         */
1174
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1175
+
1176
+        /**
1177
+         * The SEO service.
1178
+         */
1179
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1180
+
1181
+        /**
1182
+         * The AMP service.
1183
+         */
1184
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1185
+
1186
+        /** Widgets */
1187
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1188
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1189
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php';
1190
+
1191
+        /*
1192 1192
 		 * Schema.org Services.
1193 1193
 		 *
1194 1194
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1195 1195
 		 */
1196
-		if ( WL_ALL_ENTITY_TYPES ) {
1197
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php';
1198
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php';
1199
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php';
1200
-			new Wordlift_Schemaorg_Sync_Service();
1201
-			$schemaorg_property_service = new Wordlift_Schemaorg_Property_Service();
1202
-			new Wordlift_Schemaorg_Class_Service();
1203
-		} else {
1204
-			$schemaorg_property_service = null;
1205
-		}
1206
-
1207
-		$this->loader = new Wordlift_Loader();
1208
-		/**
1209
-		 * @since 3.30.0
1210
-		 */
1211
-		$this->features_registry = Features_Registry::get_instance();
1196
+        if ( WL_ALL_ENTITY_TYPES ) {
1197
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php';
1198
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php';
1199
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php';
1200
+            new Wordlift_Schemaorg_Sync_Service();
1201
+            $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service();
1202
+            new Wordlift_Schemaorg_Class_Service();
1203
+        } else {
1204
+            $schemaorg_property_service = null;
1205
+        }
1212 1206
 
1213
-		// Instantiate a global logger.
1214
-		global $wl_logger;
1215
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1207
+        $this->loader = new Wordlift_Loader();
1208
+        /**
1209
+         * @since 3.30.0
1210
+         */
1211
+        $this->features_registry = Features_Registry::get_instance();
1216 1212
 
1217
-		// Load the `wl-api` end-point.
1218
-		new Wordlift_Http_Api();
1213
+        // Instantiate a global logger.
1214
+        global $wl_logger;
1215
+        $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1219 1216
 
1220
-		// Load the Install Service.
1221
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
1222
-		$this->install_service = new Wordlift_Install_Service();
1217
+        // Load the `wl-api` end-point.
1218
+        new Wordlift_Http_Api();
1223 1219
 
1224
-		/** Services. */
1225
-		// Create the configuration service.
1226
-		$this->configuration_service = new Wordlift_Configuration_Service();
1227
-		$api_service                 = new Wordlift_Api_Service( $this->configuration_service );
1220
+        // Load the Install Service.
1221
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
1222
+        $this->install_service = new Wordlift_Install_Service();
1228 1223
 
1229
-		// Create an entity type service instance. It'll be later bound to the init action.
1230
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1224
+        /** Services. */
1225
+        // Create the configuration service.
1226
+        $this->configuration_service = new Wordlift_Configuration_Service();
1227
+        $api_service                 = new Wordlift_Api_Service( $this->configuration_service );
1231 1228
 
1232
-		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1233
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1229
+        // Create an entity type service instance. It'll be later bound to the init action.
1230
+        $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1234 1231
 
1235
-		// Create an instance of the UI service.
1236
-		$this->ui_service = new Wordlift_UI_Service();
1232
+        // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1233
+        $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1237 1234
 
1238
-		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
1239
-		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
1235
+        // Create an instance of the UI service.
1236
+        $this->ui_service = new Wordlift_UI_Service();
1240 1237
 
1241
-		$this->sparql_service        = new Wordlift_Sparql_Service();
1242
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1243
-		$this->notice_service        = new Wordlift_Notice_Service();
1244
-		$this->relation_service      = new Wordlift_Relation_Service();
1238
+        // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
1239
+        $this->thumbnail_service = new Wordlift_Thumbnail_Service();
1245 1240
 
1246
-		$entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1247
-		$this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1248
-		$this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1249
-		$this->user_service       = new Wordlift_User_Service( $this->sparql_service, $this->entity_service );
1241
+        $this->sparql_service        = new Wordlift_Sparql_Service();
1242
+        $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1243
+        $this->notice_service        = new Wordlift_Notice_Service();
1244
+        $this->relation_service      = new Wordlift_Relation_Service();
1250 1245
 
1251
-		// Instantiate the JSON-LD service.
1252
-		$property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1246
+        $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1247
+        $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1248
+        $this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1249
+        $this->user_service       = new Wordlift_User_Service( $this->sparql_service, $this->entity_service );
1253 1250
 
1254
-		/** Linked Data. */
1255
-		$this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1256
-		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1251
+        // Instantiate the JSON-LD service.
1252
+        $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1257 1253
 
1258
-		$this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1254
+        /** Linked Data. */
1255
+        $this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1256
+        $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1259 1257
 
1260
-		// Create a new instance of the Redirect service.
1261
-		$this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_uri_service );
1262
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1258
+        $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1263 1259
 
1264
-		// Create a new instance of the Timeline service and Timeline shortcode.
1265
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1260
+        // Create a new instance of the Redirect service.
1261
+        $this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_uri_service );
1262
+        $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1266 1263
 
1267
-		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1264
+        // Create a new instance of the Timeline service and Timeline shortcode.
1265
+        $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1268 1266
 
1269
-		$this->topic_taxonomy_service        = new Wordlift_Topic_Taxonomy_Service();
1270
-		$this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service();
1267
+        $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1271 1268
 
1272
-		// Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1273
-		$this->sharethis_service = new Wordlift_ShareThis_Service();
1269
+        $this->topic_taxonomy_service        = new Wordlift_Topic_Taxonomy_Service();
1270
+        $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service();
1274 1271
 
1275
-		// Create an instance of the PrimaShop adapter.
1276
-		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1272
+        // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1273
+        $this->sharethis_service = new Wordlift_ShareThis_Service();
1277 1274
 
1278
-		// Create an import service instance to hook later to WP's import function.
1279
-		$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() );
1275
+        // Create an instance of the PrimaShop adapter.
1276
+        $this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1280 1277
 
1281
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1278
+        // Create an import service instance to hook later to WP's import function.
1279
+        $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() );
1282 1280
 
1283
-		// Create the entity rating service.
1284
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1281
+        $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1285 1282
 
1286
-		// Create entity list customization (wp-admin/edit.php).
1287
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1283
+        // Create the entity rating service.
1284
+        $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1288 1285
 
1289
-		// Create a new instance of the Redirect service.
1290
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1286
+        // Create entity list customization (wp-admin/edit.php).
1287
+        $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1291 1288
 
1292
-		// Create an instance of the Publisher Service and the AJAX Adapter.
1293
-		$this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service );
1294
-		$this->property_factory  = new Wordlift_Property_Factory( $schema_url_property_service );
1295
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1289
+        // Create a new instance of the Redirect service.
1290
+        $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1296 1291
 
1297
-		$attachment_service = new Wordlift_Attachment_Service();
1292
+        // Create an instance of the Publisher Service and the AJAX Adapter.
1293
+        $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service );
1294
+        $this->property_factory  = new Wordlift_Property_Factory( $schema_url_property_service );
1295
+        $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1298 1296
 
1299
-		// Instantiate the JSON-LD service.
1300
-		$property_getter                       = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1301
-		$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 );
1302
-		$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 );
1303
-		$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 );
1304
-		$this->jsonld_website_converter        = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1297
+        $attachment_service = new Wordlift_Attachment_Service();
1305 1298
 
1306
-		$jsonld_cache                            = new Ttl_Cache( 'jsonld', 86400 );
1307
-		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache );
1308
-		/*
1299
+        // Instantiate the JSON-LD service.
1300
+        $property_getter                       = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1301
+        $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 );
1302
+        $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 );
1303
+        $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 );
1304
+        $this->jsonld_website_converter        = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1305
+
1306
+        $jsonld_cache                            = new Ttl_Cache( 'jsonld', 86400 );
1307
+        $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache );
1308
+        /*
1309 1309
 		 * Load the `Wordlift_Term_JsonLd_Adapter`.
1310 1310
 		 *
1311 1311
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/892
1312 1312
 		 *
1313 1313
 		 * @since 3.20.0
1314 1314
 		 */
1315
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php';
1316
-
1317
-		$term_jsonld_adapter  = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->cached_postid_to_jsonld_converter );
1318
-		$this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter, $term_jsonld_adapter );
1319
-
1320
-		$jsonld_service = new Jsonld_Service(
1321
-			$this->jsonld_service,
1322
-			$term_jsonld_adapter,
1323
-			new Jsonld_User_Service( $this->user_service ) );
1324
-		new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service );
1325
-
1326
-		// Prints the JSON-LD in the head.
1327
-		new Jsonld_Adapter( $this->jsonld_service );
1328
-
1329
-		new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service );
1330
-
1331
-		$this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service );
1332
-		$this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1333
-		// Creating Faq Content filter service.
1334
-		$this->faq_content_filter_service = new Faq_Content_Filter();
1335
-		$this->relation_rebuild_service   = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1336
-		$this->sample_data_service        = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1337
-		$this->sample_data_ajax_adapter   = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1338
-		$this->reference_rebuild_service  = new Wordlift_Reference_Rebuild_Service( $this->entity_service );
1339
-
1340
-		$this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' );
1341
-		$this->loader->add_action( 'admin_enqueue_scripts', $this, 'add_wl_enabled_blocks' );
1342
-
1343
-		/**
1344
-		 * Filter: wl_feature__enable__blocks.
1345
-		 *
1346
-		 * @param bool whether the blocks needed to be registered, defaults to true.
1347
-		 *
1348
-		 * @return bool
1349
-		 * @since 3.27.6
1350
-		 */
1351
-		if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
1352
-			// Initialize the short-codes.
1353
-			new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() );
1354
-			new Wordlift_Chord_Shortcode();
1355
-			new Wordlift_Geomap_Shortcode();
1356
-			new Wordlift_Timeline_Shortcode();
1357
-			new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service, $this->entity_service );
1358
-			new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1359
-			new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() );
1360
-		}
1361
-
1362
-		new Wordlift_Products_Navigator_Shortcode();
1363
-
1364
-
1365
-		// Initialize the Context Cards Service
1366
-		$this->context_cards_service = new Wordlift_Context_Cards_Service();
1367
-
1368
-		// Initialize the SEO service.
1369
-		new Wordlift_Seo_Service();
1370
-
1371
-		// Initialize the AMP service.
1372
-		new Wordlift_AMP_Service( $this->jsonld_service );
1373
-
1374
-		/** Services. */
1375
-		$this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1376
-		new Wordlift_Image_Service();
1377
-
1378
-		/** Adapters. */
1379
-		$this->entity_type_adapter    = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1380
-		$this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service );
1381
-		$this->tinymce_adapter        = new Wordlift_Tinymce_Adapter( $this );
1382
-		//$this->faq_tinymce_adapter      = new Faq_Tinymce_Adapter();
1383
-		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1384
-
1385
-		/*
1315
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php';
1316
+
1317
+        $term_jsonld_adapter  = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->cached_postid_to_jsonld_converter );
1318
+        $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter, $term_jsonld_adapter );
1319
+
1320
+        $jsonld_service = new Jsonld_Service(
1321
+            $this->jsonld_service,
1322
+            $term_jsonld_adapter,
1323
+            new Jsonld_User_Service( $this->user_service ) );
1324
+        new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service );
1325
+
1326
+        // Prints the JSON-LD in the head.
1327
+        new Jsonld_Adapter( $this->jsonld_service );
1328
+
1329
+        new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service );
1330
+
1331
+        $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service );
1332
+        $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1333
+        // Creating Faq Content filter service.
1334
+        $this->faq_content_filter_service = new Faq_Content_Filter();
1335
+        $this->relation_rebuild_service   = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1336
+        $this->sample_data_service        = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1337
+        $this->sample_data_ajax_adapter   = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1338
+        $this->reference_rebuild_service  = new Wordlift_Reference_Rebuild_Service( $this->entity_service );
1339
+
1340
+        $this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' );
1341
+        $this->loader->add_action( 'admin_enqueue_scripts', $this, 'add_wl_enabled_blocks' );
1342
+
1343
+        /**
1344
+         * Filter: wl_feature__enable__blocks.
1345
+         *
1346
+         * @param bool whether the blocks needed to be registered, defaults to true.
1347
+         *
1348
+         * @return bool
1349
+         * @since 3.27.6
1350
+         */
1351
+        if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
1352
+            // Initialize the short-codes.
1353
+            new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() );
1354
+            new Wordlift_Chord_Shortcode();
1355
+            new Wordlift_Geomap_Shortcode();
1356
+            new Wordlift_Timeline_Shortcode();
1357
+            new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service, $this->entity_service );
1358
+            new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1359
+            new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() );
1360
+        }
1361
+
1362
+        new Wordlift_Products_Navigator_Shortcode();
1363
+
1364
+
1365
+        // Initialize the Context Cards Service
1366
+        $this->context_cards_service = new Wordlift_Context_Cards_Service();
1367
+
1368
+        // Initialize the SEO service.
1369
+        new Wordlift_Seo_Service();
1370
+
1371
+        // Initialize the AMP service.
1372
+        new Wordlift_AMP_Service( $this->jsonld_service );
1373
+
1374
+        /** Services. */
1375
+        $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1376
+        new Wordlift_Image_Service();
1377
+
1378
+        /** Adapters. */
1379
+        $this->entity_type_adapter    = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1380
+        $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service );
1381
+        $this->tinymce_adapter        = new Wordlift_Tinymce_Adapter( $this );
1382
+        //$this->faq_tinymce_adapter      = new Faq_Tinymce_Adapter();
1383
+        $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1384
+
1385
+        /*
1386 1386
 		 * Exclude our public js from WP-Rocket.
1387 1387
 		 *
1388 1388
 		 * @since 3.19.4
1389 1389
 		 *
1390 1390
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/842.
1391 1391
 		 */
1392
-		new Wordlift_WpRocket_Adapter();
1393
-
1394
-		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
1395
-		$this->rebuild_service = new Wordlift_Rebuild_Service(
1396
-			$this->sparql_service,
1397
-			$uri_service
1398
-		);
1399
-
1400
-		$that = $this;
1401
-		add_action( 'plugins_loaded', function () use ( $that ) {
1402
-			if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) {
1403
-				new Wordlift_Linked_Data_Service( $that->entity_service, $that->entity_type_service, $that->schema_service, $that->sparql_service );
1404
-				new Wordlift_Sparql_Query_Async_Task();
1405
-				new Wordlift_Push_References_Async_Task();
1406
-			}
1407
-		} );
1408
-
1409
-		/** WordPress Admin UI. */
1410
-
1411
-		// UI elements.
1412
-		$this->input_element           = new Wordlift_Admin_Input_Element();
1413
-		$this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1414
-		$this->select2_element         = new Wordlift_Admin_Select2_Element();
1415
-		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1416
-		$this->country_select_element  = new Wordlift_Admin_Country_Select_Element();
1417
-		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
1418
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element );
1419
-		$this->author_element          = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element );
1420
-
1421
-		$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 );
1422
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1423
-
1424
-		$this->analytics_settings_page             = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element );
1425
-		$this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page );
1426
-		$this->analytics_connect                   = new Wordlift_Analytics_Connect();
1427
-
1428
-		// Pages.
1429
-		/*
1392
+        new Wordlift_WpRocket_Adapter();
1393
+
1394
+        // Create a Rebuild Service instance, which we'll later bound to an ajax call.
1395
+        $this->rebuild_service = new Wordlift_Rebuild_Service(
1396
+            $this->sparql_service,
1397
+            $uri_service
1398
+        );
1399
+
1400
+        $that = $this;
1401
+        add_action( 'plugins_loaded', function () use ( $that ) {
1402
+            if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) {
1403
+                new Wordlift_Linked_Data_Service( $that->entity_service, $that->entity_type_service, $that->schema_service, $that->sparql_service );
1404
+                new Wordlift_Sparql_Query_Async_Task();
1405
+                new Wordlift_Push_References_Async_Task();
1406
+            }
1407
+        } );
1408
+
1409
+        /** WordPress Admin UI. */
1410
+
1411
+        // UI elements.
1412
+        $this->input_element           = new Wordlift_Admin_Input_Element();
1413
+        $this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1414
+        $this->select2_element         = new Wordlift_Admin_Select2_Element();
1415
+        $this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1416
+        $this->country_select_element  = new Wordlift_Admin_Country_Select_Element();
1417
+        $tabs_element                  = new Wordlift_Admin_Tabs_Element();
1418
+        $this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element );
1419
+        $this->author_element          = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element );
1420
+
1421
+        $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 );
1422
+        $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1423
+
1424
+        $this->analytics_settings_page             = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element );
1425
+        $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page );
1426
+        $this->analytics_connect                   = new Wordlift_Analytics_Connect();
1427
+
1428
+        // Pages.
1429
+        /*
1430 1430
 		 * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box.
1431 1431
 		 *
1432 1432
 		 * @since 3.20.3
1433 1433
 		 *
1434 1434
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/914
1435 1435
 		 */
1436
-		if ( apply_filters( 'wl_can_see_classification_box', true ) ) {
1437
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1438
-			new Wordlift_Admin_Post_Edit_Page( $this );
1439
-		}
1440
-		new Wordlift_Entity_Type_Admin_Service();
1436
+        if ( apply_filters( 'wl_can_see_classification_box', true ) ) {
1437
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1438
+            new Wordlift_Admin_Post_Edit_Page( $this );
1439
+        }
1440
+        new Wordlift_Entity_Type_Admin_Service();
1441 1441
 
1442
-		// create an instance of the entity type list admin page controller.
1443
-		$this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1442
+        // create an instance of the entity type list admin page controller.
1443
+        $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1444 1444
 
1445
-		// create an instance of the entity type setting admin page controller.
1446
-		$this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1445
+        // create an instance of the entity type setting admin page controller.
1446
+        $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1447 1447
 
1448
-		/** Widgets */
1449
-		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1448
+        /** Widgets */
1449
+        $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1450 1450
 
1451
-		/* WordPress Admin. */
1452
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1453
-		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1451
+        /* WordPress Admin. */
1452
+        $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1453
+        $this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1454 1454
 
1455
-		// Create an instance of the install wizard.
1456
-		$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 );
1455
+        // Create an instance of the install wizard.
1456
+        $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 );
1457 1457
 
1458
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1458
+        $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1459 1459
 
1460
-		// User Profile.
1461
-		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1460
+        // User Profile.
1461
+        new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1462 1462
 
1463
-		$this->entity_page_service = new Wordlift_Entity_Page_Service();
1463
+        $this->entity_page_service = new Wordlift_Entity_Page_Service();
1464 1464
 
1465
-		// Load the debug service if WP is in debug mode.
1466
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1467
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1468
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1469
-		}
1465
+        // Load the debug service if WP is in debug mode.
1466
+        if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1467
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1468
+            new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1469
+        }
1470 1470
 
1471
-		// Remote Image Service.
1472
-		new Wordlift_Remote_Image_Service();
1471
+        // Remote Image Service.
1472
+        new Wordlift_Remote_Image_Service();
1473 1473
 
1474
-		/*
1474
+        /*
1475 1475
 		 * Provides mappings between post types and entity types.
1476 1476
 		 *
1477 1477
 		 * @since 3.20.0
1478 1478
 		 *
1479 1479
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/852.
1480 1480
 		 */
1481
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php';
1482
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php';
1483
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php';
1481
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php';
1482
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php';
1483
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php';
1484 1484
 
1485
-		// Create an instance of the Mapping Service and assign it to the Ajax Adapter.
1486
-		new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) );
1485
+        // Create an instance of the Mapping Service and assign it to the Ajax Adapter.
1486
+        new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) );
1487 1487
 
1488
-		/*
1488
+        /*
1489 1489
 		 * Batch Operations. They're similar to Batch Actions but do not require working on post types.
1490 1490
 		 *
1491 1491
 		 * Eventually Batch Actions will become Batch Operations.
1492 1492
 		 *
1493 1493
 		 * @since 3.20.0
1494 1494
 		 */
1495
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php';
1496
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php';
1497
-		/*
1495
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php';
1496
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php';
1497
+        /*
1498 1498
 		 * Load the Mappings JSON-LD post processing.
1499 1499
 		 *
1500 1500
 		 * @since 3.25.0
1501 1501
 		 */
1502 1502
 
1503
-		$mappings_dbo           = new Mappings_DBO();
1504
-		$default_rule_validator = new Taxonomy_Rule_Validator();
1505
-		new Post_Type_Rule_Validator();
1506
-		// Taxonomy term rule validator for validating rules for term pages.
1507
-		new Taxonomy_Term_Rule_Validator();
1508
-		new Post_Taxonomy_Term_Rule_Validator();
1509
-		$rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator );
1510
-		$rule_groups_validator    = new Rule_Groups_Validator( $rule_validators_registry );
1511
-		$mappings_validator       = new Mappings_Validator( $mappings_dbo, $rule_groups_validator );
1512
-
1513
-		new Url_To_Entity_Transform_Function( $this->entity_uri_service );
1514
-		new Taxonomy_To_Terms_Transform_Function();
1515
-		new Post_Id_To_Entity_Transform_Function();
1516
-		$mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry();
1517
-
1518
-		/**
1519
-		 * @since 3.27.1
1520
-		 * Intiailize the acf group data formatter.
1521
-		 */
1522
-		new Acf_Group_Formatter();
1523
-		new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry );
1524
-
1525
-		/**
1526
-		 * @since 3.26.0
1527
-		 * Initialize the Faq JSON LD converter here - disabled.
1528
-		 */
1529
-		// new Faq_To_Jsonld_Converter();
1530
-		/*
1503
+        $mappings_dbo           = new Mappings_DBO();
1504
+        $default_rule_validator = new Taxonomy_Rule_Validator();
1505
+        new Post_Type_Rule_Validator();
1506
+        // Taxonomy term rule validator for validating rules for term pages.
1507
+        new Taxonomy_Term_Rule_Validator();
1508
+        new Post_Taxonomy_Term_Rule_Validator();
1509
+        $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator );
1510
+        $rule_groups_validator    = new Rule_Groups_Validator( $rule_validators_registry );
1511
+        $mappings_validator       = new Mappings_Validator( $mappings_dbo, $rule_groups_validator );
1512
+
1513
+        new Url_To_Entity_Transform_Function( $this->entity_uri_service );
1514
+        new Taxonomy_To_Terms_Transform_Function();
1515
+        new Post_Id_To_Entity_Transform_Function();
1516
+        $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry();
1517
+
1518
+        /**
1519
+         * @since 3.27.1
1520
+         * Intiailize the acf group data formatter.
1521
+         */
1522
+        new Acf_Group_Formatter();
1523
+        new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry );
1524
+
1525
+        /**
1526
+         * @since 3.26.0
1527
+         * Initialize the Faq JSON LD converter here - disabled.
1528
+         */
1529
+        // new Faq_To_Jsonld_Converter();
1530
+        /*
1531 1531
 		 * Use the Templates Ajax Endpoint to load HTML templates for the legacy Angular app via admin-ajax.php
1532 1532
 		 * end-point.
1533 1533
 		 *
1534 1534
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/834
1535 1535
 		 * @since 3.24.4
1536 1536
 		 */
1537
-		new Templates_Ajax_Endpoint();
1538
-		// Call this static method to register FAQ routes to rest api - disabled
1539
-		//Faq_Rest_Controller::register_routes();
1537
+        new Templates_Ajax_Endpoint();
1538
+        // Call this static method to register FAQ routes to rest api - disabled
1539
+        //Faq_Rest_Controller::register_routes();
1540 1540
 
1541
-		/*
1541
+        /*
1542 1542
 		 * Create a singleton for the Analysis_Response_Ops_Factory.
1543 1543
 		 */
1544
-		$entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service );
1545
-		/**
1546
-		 * @since 3.32.0
1547
-		 * Initialize a local entity provider which acts as an abstraction layer
1548
-		 * between the different types of objects in wordpress.
1549
-		 */
1550
-		$entity_provider_registry = new Entity_Provider_Registry();
1551
-
1552
-		/**
1553
-		 * @since 3.32.0
1554
-		 * The post entity provider has the legacy code which provides the entity
1555
-		 * if the object is post {@link \Wordlift\Object_Type_Enum::POST}
1556
-		 */
1557
-		new Post_Entity_Provider( $this->entity_uri_service,
1558
-			$this->entity_type_service, $this->storage_factory->post_images() );
1559
-		/**
1560
-		 * @since 3.32.0
1561
-		 * The term entity provider provides the entity
1562
-		 * if the object is term {@link \Wordlift\Object_Type_Enum::POST}
1563
-		 */
1564
-		new Term_Entity_Provider();
1565
-
1566
-		new Analysis_Response_Ops_Factory(
1567
-			$this->entity_uri_service,
1568
-			$entity_helper,
1569
-			$entity_provider_registry
1570
-		);
1571
-
1572
-		/** WL Autocomplete. */
1573
-		$autocomplete_service       = new All_Autocomplete_Service( array(
1574
-			new Local_Autocomplete_Service(),
1575
-			new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ),
1576
-		) );
1577
-		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service );
1578
-
1579
-		/**
1580
-		 * @since 3.27.2
1581
-		 * Integrate the recipe maker jsonld & set recipe
1582
-		 * as default entity type to the wprm_recipe CPT.
1583
-		 */
1584
-		new Recipe_Maker_Post_Type_Hook();
1585
-		$recipe_maker_validation_service = new Recipe_Maker_Validation_Service();
1586
-		new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service );
1587
-		new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service );
1588
-		new Recipe_Maker_Warning( $recipe_maker_validation_service );
1589
-		new Yoast_Jsonld( $recipe_maker_validation_service );
1590
-
1591
-		/**
1592
-		 * @since 3.27.4
1593
-		 * Add the faq duplicate markup hook.
1594
-		 */
1595
-		new Faq_Duplicate_Markup_Remover();
1596
-		/**
1597
-		 * @since 3.33.1
1598
-		 * Remove the duplicate HowTo Markup.
1599
-		 */
1600
-		new How_To_Duplicate_Markup_Remover();
1601
-
1602
-		/**
1603
-		 * @since 3.27.8
1604
-		 * @see https://github.com/insideout10/wordlift-plugin/issues/1248
1605
-		 */
1606
-		new Key_Validation_Notice( $this->key_validation_service, $this->configuration_service );
1607
-		/**
1608
-		 * @since 3.28.0
1609
-		 * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen
1610
-		 */
1611
-		new Entity_No_Index_Flag();
1612
-
1613
-		/**
1614
-		 * @since 3.29.0
1615
-		 * @see https://github.com/insideout10/wordlift-plugin/issues/1304
1616
-		 */
1617
-		new Entity_Rest_Service( $this->entity_type_service );
1618
-
1619
-		/**
1620
-		 * Expand author in to references.
1621
-		 * @since 3.30.0
1622
-		 * @see https://github.com/insideout10/wordlift-plugin/issues/1318
1623
-		 */
1624
-
1625
-		add_action( 'plugins_loaded', function () use ( $that ) {
1626
-
1627
-			if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) {
1628
-				new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter );
1629
-			}
1630
-
1631
-			if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) {
1632
-				$vocabulary_loader = new Vocabulary_Loader();
1633
-				$vocabulary_loader->init_vocabulary();
1634
-			}
1635
-
1636
-		} );
1637
-
1638
-		/**
1639
-		 * @since 3.30.0
1640
-		 * Add a checkbox to user option screen for wordlift admin.
1641
-		 */
1642
-		$wordlift_admin_checkbox = new Admin_User_Option();
1643
-		$wordlift_admin_checkbox->connect_hook();
1644
-		/**
1645
-		 * @since 3.31.0
1646
-		 * Init loader class for videoobject.
1647
-		 */
1648
-		$videoobject_loader = new Loader();
1649
-		$videoobject_loader->init_feature();
1650
-		/**
1651
-		 * @since 3.31.5
1652
-		 * Create configuration endpoint for webapp to configure.
1653
-		 */
1654
-		new Config( $this->admin_setup, $this->key_validation_service, $this->configuration_service );
1655
-		/**
1656
-		 * @since 3.31.7
1657
-		 * Remove duplicate videoobject.
1658
-		 */
1659
-		new Videoobject_Duplicate_Remover();
1660
-		$synonym_loader = new \Wordlift\Synonym\Loader();
1661
-		$synonym_loader->init_feature();
1662
-		/**
1663
-		 * @since 3.32.0
1664
-		 * Create loader for vocabulary terms.
1665
-		 */
1666
-		$vocabulary_terms_loader = new Vocabulary_Terms_Loader( $this->entity_type_service, $property_getter );
1667
-		$vocabulary_terms_loader->init_feature();
1668
-
1669
-		new Entity_Type_Change_Handler(
1670
-			$this->entity_service,
1671
-			$this->entity_type_service
1672
-		);
1673
-
1674
-		new Entity_Type_Setter();
1675
-		$no_editor_analysis_loader = new \Wordlift\No_Editor_Analysis\Loader();
1676
-		$no_editor_analysis_loader->init_feature();
1677
-	}
1678
-
1679
-	/**
1680
-	 * Define the locale for this plugin for internationalization.
1681
-	 *
1682
-	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1683
-	 * with WordPress.
1684
-	 *
1685
-	 * @since    1.0.0
1686
-	 * @access   private
1687
-	 */
1688
-	private function set_locale() {
1689
-
1690
-		$plugin_i18n = new Wordlift_i18n();
1691
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1692
-
1693
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1694
-
1695
-	}
1696
-
1697
-	/**
1698
-	 * Register all of the hooks related to the admin area functionality
1699
-	 * of the plugin.
1700
-	 *
1701
-	 * @since    1.0.0
1702
-	 * @access   private
1703
-	 */
1704
-	private function define_admin_hooks() {
1705
-		$that         = $this;
1706
-		$plugin_admin = new Wordlift_Admin(
1707
-			$this->get_plugin_name(),
1708
-			$this->get_version(),
1709
-			$this->configuration_service,
1710
-			$this->notice_service,
1711
-			$this->user_service
1712
-		);
1713
-
1714
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1715
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 );
1716
-
1717
-		// Hook the init action to taxonomy services.
1718
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1719
-		$this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 );
1720
-
1721
-		// Hook the deleted_post_meta action to the Thumbnail service.
1722
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1723
-
1724
-		// Hook the added_post_meta action to the Thumbnail service.
1725
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1726
-
1727
-		// Hook the updated_post_meta action to the Thumbnail service.
1728
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1729
-
1730
-		// Hook the AJAX wl_timeline action to the Timeline service.
1731
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1732
-
1733
-		// Register custom allowed redirect hosts.
1734
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1735
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1736
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1737
-
1738
-		/*
1544
+        $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service );
1545
+        /**
1546
+         * @since 3.32.0
1547
+         * Initialize a local entity provider which acts as an abstraction layer
1548
+         * between the different types of objects in wordpress.
1549
+         */
1550
+        $entity_provider_registry = new Entity_Provider_Registry();
1551
+
1552
+        /**
1553
+         * @since 3.32.0
1554
+         * The post entity provider has the legacy code which provides the entity
1555
+         * if the object is post {@link \Wordlift\Object_Type_Enum::POST}
1556
+         */
1557
+        new Post_Entity_Provider( $this->entity_uri_service,
1558
+            $this->entity_type_service, $this->storage_factory->post_images() );
1559
+        /**
1560
+         * @since 3.32.0
1561
+         * The term entity provider provides the entity
1562
+         * if the object is term {@link \Wordlift\Object_Type_Enum::POST}
1563
+         */
1564
+        new Term_Entity_Provider();
1565
+
1566
+        new Analysis_Response_Ops_Factory(
1567
+            $this->entity_uri_service,
1568
+            $entity_helper,
1569
+            $entity_provider_registry
1570
+        );
1571
+
1572
+        /** WL Autocomplete. */
1573
+        $autocomplete_service       = new All_Autocomplete_Service( array(
1574
+            new Local_Autocomplete_Service(),
1575
+            new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ),
1576
+        ) );
1577
+        $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service );
1578
+
1579
+        /**
1580
+         * @since 3.27.2
1581
+         * Integrate the recipe maker jsonld & set recipe
1582
+         * as default entity type to the wprm_recipe CPT.
1583
+         */
1584
+        new Recipe_Maker_Post_Type_Hook();
1585
+        $recipe_maker_validation_service = new Recipe_Maker_Validation_Service();
1586
+        new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service );
1587
+        new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service );
1588
+        new Recipe_Maker_Warning( $recipe_maker_validation_service );
1589
+        new Yoast_Jsonld( $recipe_maker_validation_service );
1590
+
1591
+        /**
1592
+         * @since 3.27.4
1593
+         * Add the faq duplicate markup hook.
1594
+         */
1595
+        new Faq_Duplicate_Markup_Remover();
1596
+        /**
1597
+         * @since 3.33.1
1598
+         * Remove the duplicate HowTo Markup.
1599
+         */
1600
+        new How_To_Duplicate_Markup_Remover();
1601
+
1602
+        /**
1603
+         * @since 3.27.8
1604
+         * @see https://github.com/insideout10/wordlift-plugin/issues/1248
1605
+         */
1606
+        new Key_Validation_Notice( $this->key_validation_service, $this->configuration_service );
1607
+        /**
1608
+         * @since 3.28.0
1609
+         * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen
1610
+         */
1611
+        new Entity_No_Index_Flag();
1612
+
1613
+        /**
1614
+         * @since 3.29.0
1615
+         * @see https://github.com/insideout10/wordlift-plugin/issues/1304
1616
+         */
1617
+        new Entity_Rest_Service( $this->entity_type_service );
1618
+
1619
+        /**
1620
+         * Expand author in to references.
1621
+         * @since 3.30.0
1622
+         * @see https://github.com/insideout10/wordlift-plugin/issues/1318
1623
+         */
1624
+
1625
+        add_action( 'plugins_loaded', function () use ( $that ) {
1626
+
1627
+            if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) {
1628
+                new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter );
1629
+            }
1630
+
1631
+            if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) {
1632
+                $vocabulary_loader = new Vocabulary_Loader();
1633
+                $vocabulary_loader->init_vocabulary();
1634
+            }
1635
+
1636
+        } );
1637
+
1638
+        /**
1639
+         * @since 3.30.0
1640
+         * Add a checkbox to user option screen for wordlift admin.
1641
+         */
1642
+        $wordlift_admin_checkbox = new Admin_User_Option();
1643
+        $wordlift_admin_checkbox->connect_hook();
1644
+        /**
1645
+         * @since 3.31.0
1646
+         * Init loader class for videoobject.
1647
+         */
1648
+        $videoobject_loader = new Loader();
1649
+        $videoobject_loader->init_feature();
1650
+        /**
1651
+         * @since 3.31.5
1652
+         * Create configuration endpoint for webapp to configure.
1653
+         */
1654
+        new Config( $this->admin_setup, $this->key_validation_service, $this->configuration_service );
1655
+        /**
1656
+         * @since 3.31.7
1657
+         * Remove duplicate videoobject.
1658
+         */
1659
+        new Videoobject_Duplicate_Remover();
1660
+        $synonym_loader = new \Wordlift\Synonym\Loader();
1661
+        $synonym_loader->init_feature();
1662
+        /**
1663
+         * @since 3.32.0
1664
+         * Create loader for vocabulary terms.
1665
+         */
1666
+        $vocabulary_terms_loader = new Vocabulary_Terms_Loader( $this->entity_type_service, $property_getter );
1667
+        $vocabulary_terms_loader->init_feature();
1668
+
1669
+        new Entity_Type_Change_Handler(
1670
+            $this->entity_service,
1671
+            $this->entity_type_service
1672
+        );
1673
+
1674
+        new Entity_Type_Setter();
1675
+        $no_editor_analysis_loader = new \Wordlift\No_Editor_Analysis\Loader();
1676
+        $no_editor_analysis_loader->init_feature();
1677
+    }
1678
+
1679
+    /**
1680
+     * Define the locale for this plugin for internationalization.
1681
+     *
1682
+     * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1683
+     * with WordPress.
1684
+     *
1685
+     * @since    1.0.0
1686
+     * @access   private
1687
+     */
1688
+    private function set_locale() {
1689
+
1690
+        $plugin_i18n = new Wordlift_i18n();
1691
+        $plugin_i18n->set_domain( $this->get_plugin_name() );
1692
+
1693
+        $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1694
+
1695
+    }
1696
+
1697
+    /**
1698
+     * Register all of the hooks related to the admin area functionality
1699
+     * of the plugin.
1700
+     *
1701
+     * @since    1.0.0
1702
+     * @access   private
1703
+     */
1704
+    private function define_admin_hooks() {
1705
+        $that         = $this;
1706
+        $plugin_admin = new Wordlift_Admin(
1707
+            $this->get_plugin_name(),
1708
+            $this->get_version(),
1709
+            $this->configuration_service,
1710
+            $this->notice_service,
1711
+            $this->user_service
1712
+        );
1713
+
1714
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1715
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 );
1716
+
1717
+        // Hook the init action to taxonomy services.
1718
+        $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1719
+        $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 );
1720
+
1721
+        // Hook the deleted_post_meta action to the Thumbnail service.
1722
+        $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1723
+
1724
+        // Hook the added_post_meta action to the Thumbnail service.
1725
+        $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1726
+
1727
+        // Hook the updated_post_meta action to the Thumbnail service.
1728
+        $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1729
+
1730
+        // Hook the AJAX wl_timeline action to the Timeline service.
1731
+        $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1732
+
1733
+        // Register custom allowed redirect hosts.
1734
+        $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1735
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1736
+        $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1737
+
1738
+        /*
1739 1739
 		 * The old dashboard is replaced with dashboard v2.
1740 1740
 		 *
1741 1741
 		 * The old dashboard service is still loaded because its functions are used.
@@ -1744,391 +1744,391 @@  discard block
 block discarded – undo
1744 1744
 		 *
1745 1745
 		 * @since 3.20.0
1746 1746
 		 */
1747
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1748
-		// $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1749
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1750
-		// $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1751
-
1752
-		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1753
-		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1754
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1755
-		$this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1756
-
1757
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1758
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1759
-
1760
-		// Entity listing customization (wp-admin/edit.php)
1761
-		// Add custom columns.
1762
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1763
-		// no explicit entity as it prevents handling of other post types.
1764
-		$this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1765
-		// Add 4W selection.
1766
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1767
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1768
-		$this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1769
-		$this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1770
-
1771
-		/*
1747
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1748
+        // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1749
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1750
+        // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1751
+
1752
+        // Hook save_post to the entity service to update custom fields (such as alternate labels).
1753
+        // We have a priority of 9 because we want to be executed before data is sent to Redlink.
1754
+        $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1755
+        $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1756
+
1757
+        $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1758
+        $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1759
+
1760
+        // Entity listing customization (wp-admin/edit.php)
1761
+        // Add custom columns.
1762
+        $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1763
+        // no explicit entity as it prevents handling of other post types.
1764
+        $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1765
+        // Add 4W selection.
1766
+        $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1767
+        $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1768
+        $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1769
+        $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1770
+
1771
+        /*
1772 1772
 		 * If `All Entity Types` is disable, use the radio button Walker.
1773 1773
 		 *
1774 1774
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1775 1775
 		 */
1776
-		if ( ! WL_ALL_ENTITY_TYPES ) {
1777
-			$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1778
-		}
1779
-
1780
-		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1781
-		// entities.
1782
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1783
-
1784
-		// Filter imported post meta.
1785
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1786
-
1787
-		// Notify the import service when an import starts and ends.
1788
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1789
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1790
-
1791
-		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1792
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1793
-		$this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' );
1794
-
1795
-		/**
1796
-		 * Filter: wl_feature__enable__settings-download.
1797
-		 *
1798
-		 * @param bool whether the screens needed to be registered, defaults to true.
1799
-		 *
1800
-		 * @return bool
1801
-		 * @since 3.27.6
1802
-		 */
1803
-		$this->features_registry->register_feature_from_slug( 'settings-download', true, array(
1804
-			$this,
1805
-			'register_screens'
1806
-		) );
1807
-
1808
-
1809
-		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1810
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1811
-
1812
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1813
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1814
-		$this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' );
1815
-		$this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1816
-
1817
-		// Hook the AJAX wl_validate_key action to the Key Validation service.
1818
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1819
-
1820
-		// Hook the AJAX wl_update_country_options action to the countries.
1821
-		$this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' );
1822
-
1823
-		// Hook the `admin_init` function to the Admin Setup.
1824
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1825
-
1826
-		// Hook the admin_init to the settings page.
1827
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1828
-		$this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' );
1829
-
1830
-		$this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' );
1831
-
1832
-		// Hook the menu creation on the general wordlift menu creation.
1833
-		/**
1834
-		 * Filter: wl_feature__enable__screens.
1835
-		 *
1836
-		 * @param bool whether the screens needed to be registered, defaults to true.
1837
-		 *
1838
-		 * @return bool
1839
-		 * @since 3.27.6
1840
-		 *
1841
-		 * Since 3.30.0 this feature is registered using registry.
1842
-		 */
1843
-		add_action( 'plugins_loaded', function () use ( $that ) {
1844
-			if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) {
1845
-				add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 );
1846
-			}
1847
-		} );
1848
-
1849
-		// Hook key update.
1850
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1851
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1852
-
1853
-		// Add additional action links to the WordLift plugin in the plugins page.
1854
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1855
-
1856
-		/*
1776
+        if ( ! WL_ALL_ENTITY_TYPES ) {
1777
+            $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1778
+        }
1779
+
1780
+        // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1781
+        // entities.
1782
+        $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1783
+
1784
+        // Filter imported post meta.
1785
+        $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1786
+
1787
+        // Notify the import service when an import starts and ends.
1788
+        $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1789
+        $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1790
+
1791
+        // Hook the AJAX wl_rebuild action to the Rebuild Service.
1792
+        $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1793
+        $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' );
1794
+
1795
+        /**
1796
+         * Filter: wl_feature__enable__settings-download.
1797
+         *
1798
+         * @param bool whether the screens needed to be registered, defaults to true.
1799
+         *
1800
+         * @return bool
1801
+         * @since 3.27.6
1802
+         */
1803
+        $this->features_registry->register_feature_from_slug( 'settings-download', true, array(
1804
+            $this,
1805
+            'register_screens'
1806
+        ) );
1807
+
1808
+
1809
+        // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1810
+        $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1811
+
1812
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1813
+        $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1814
+        $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' );
1815
+        $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1816
+
1817
+        // Hook the AJAX wl_validate_key action to the Key Validation service.
1818
+        $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1819
+
1820
+        // Hook the AJAX wl_update_country_options action to the countries.
1821
+        $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' );
1822
+
1823
+        // Hook the `admin_init` function to the Admin Setup.
1824
+        $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1825
+
1826
+        // Hook the admin_init to the settings page.
1827
+        $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1828
+        $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' );
1829
+
1830
+        $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' );
1831
+
1832
+        // Hook the menu creation on the general wordlift menu creation.
1833
+        /**
1834
+         * Filter: wl_feature__enable__screens.
1835
+         *
1836
+         * @param bool whether the screens needed to be registered, defaults to true.
1837
+         *
1838
+         * @return bool
1839
+         * @since 3.27.6
1840
+         *
1841
+         * Since 3.30.0 this feature is registered using registry.
1842
+         */
1843
+        add_action( 'plugins_loaded', function () use ( $that ) {
1844
+            if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) {
1845
+                add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 );
1846
+            }
1847
+        } );
1848
+
1849
+        // Hook key update.
1850
+        $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1851
+        $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1852
+
1853
+        // Add additional action links to the WordLift plugin in the plugins page.
1854
+        $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1855
+
1856
+        /*
1857 1857
 		 * Remove the Analytics Settings link from the plugin page.
1858 1858
 		 *
1859 1859
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/932
1860 1860
 		 * @since 3.21.1
1861 1861
 		 */
1862
-		// $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 );
1863
-
1864
-		// Hook the AJAX `wl_publisher` action name.
1865
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1866
-
1867
-		// Hook row actions for the entity type list admin.
1868
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1869
-
1870
-		/** Ajax actions. */
1871
-		$this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1872
-
1873
-		// Hook capabilities manipulation to allow access to entity type admin
1874
-		// page  on WordPress versions before 4.7.
1875
-		global $wp_version;
1876
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1877
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1878
-		}
1879
-
1880
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1881
-
1882
-		/** Adapters. */
1883
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1884
-		/**
1885
-		 * Disabling Faq temporarily.
1886
-		 * Load the tinymce editor button on the tool bar.
1887
-		 * @since 3.26.0
1888
-		 */
1889
-		//$this->loader->add_filter( 'tiny_mce_before_init', $this->faq_tinymce_adapter, 'register_custom_tags' );
1890
-		//$this->loader->add_filter( 'mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 );
1891
-		//$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 );
1892
-
1893
-
1894
-		$this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1895
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1896
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1897
-		/**
1898
-		 * @since 3.26.0
1899
-		 */
1900
-		$excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter();
1901
-		$this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' );
1902
-		// Adding Rest route for the post excerpt
1903
-		Post_Excerpt_Rest_Controller::register_routes();
1904
-
1905
-		$this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 );
1906
-		$this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 );
1907
-
1908
-		// Handle the autocomplete request.
1909
-		add_action( 'wp_ajax_wl_autocomplete', array(
1910
-			$this->autocomplete_adapter,
1911
-			'wl_autocomplete',
1912
-		) );
1913
-		add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1914
-			$this->autocomplete_adapter,
1915
-			'wl_autocomplete',
1916
-		) );
1917
-
1918
-		// Hooks to restrict multisite super admin from manipulating entity types.
1919
-		if ( is_multisite() ) {
1920
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1921
-		}
1922
-
1923
-		$deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service );
1924
-
1925
-		add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) );
1926
-		add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) );
1927
-		add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) );
1928
-
1929
-		/**
1930
-		 * Always allow the `wordlift/classification` block.
1931
-		 *
1932
-		 * @since 3.23.0
1933
-		 */
1934
-		add_filter( 'allowed_block_types', function ( $value ) {
1935
-
1936
-			if ( true === $value ) {
1937
-				return $value;
1938
-			}
1939
-
1940
-			return array_merge( (array) $value, array( 'wordlift/classification' ) );
1941
-		}, PHP_INT_MAX );
1942
-
1943
-		/**
1944
-		 * @since 3.27.7
1945
-		 * @see https://github.com/insideout10/wordlift-plugin/issues/1214
1946
-		 */
1947
-		new Top_Entities();
1948
-	}
1949
-
1950
-	/**
1951
-	 * Register all of the hooks related to the public-facing functionality
1952
-	 * of the plugin.
1953
-	 *
1954
-	 * @since    1.0.0
1955
-	 * @access   private
1956
-	 */
1957
-	private function define_public_hooks() {
1958
-
1959
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1960
-
1961
-		// Register the entity post type.
1962
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1963
-
1964
-		// Bind the link generation and handling hooks to the entity link service.
1965
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1966
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1967
-		// $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 );
1968
-		// $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 );
1969
-
1970
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1971
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1972
-		$this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' );
1973
-
1974
-		// Registering Faq_Content_Filter service used for removing faq question and answer tags from the html.
1975
-		$this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' );
1976
-		// Hook the content filter service to add entity links.
1977
-		if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1978
-			$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1979
-		}
1980
-
1981
-		// Hook the AJAX wl_timeline action to the Timeline service.
1982
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1983
-
1984
-		// Hook the ShareThis service.
1985
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1986
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1987
-
1988
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1989
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1990
-
1991
-		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1992
-		// in order to tweak WP's `WP_Query` to include entities in queries related
1993
-		// to categories.
1994
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1995
-
1996
-		/*
1862
+        // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 );
1863
+
1864
+        // Hook the AJAX `wl_publisher` action name.
1865
+        $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1866
+
1867
+        // Hook row actions for the entity type list admin.
1868
+        $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1869
+
1870
+        /** Ajax actions. */
1871
+        $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1872
+
1873
+        // Hook capabilities manipulation to allow access to entity type admin
1874
+        // page  on WordPress versions before 4.7.
1875
+        global $wp_version;
1876
+        if ( version_compare( $wp_version, '4.7', '<' ) ) {
1877
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1878
+        }
1879
+
1880
+        $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1881
+
1882
+        /** Adapters. */
1883
+        $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1884
+        /**
1885
+         * Disabling Faq temporarily.
1886
+         * Load the tinymce editor button on the tool bar.
1887
+         * @since 3.26.0
1888
+         */
1889
+        //$this->loader->add_filter( 'tiny_mce_before_init', $this->faq_tinymce_adapter, 'register_custom_tags' );
1890
+        //$this->loader->add_filter( 'mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 );
1891
+        //$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 );
1892
+
1893
+
1894
+        $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1895
+        $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1896
+        $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1897
+        /**
1898
+         * @since 3.26.0
1899
+         */
1900
+        $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter();
1901
+        $this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' );
1902
+        // Adding Rest route for the post excerpt
1903
+        Post_Excerpt_Rest_Controller::register_routes();
1904
+
1905
+        $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 );
1906
+        $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 );
1907
+
1908
+        // Handle the autocomplete request.
1909
+        add_action( 'wp_ajax_wl_autocomplete', array(
1910
+            $this->autocomplete_adapter,
1911
+            'wl_autocomplete',
1912
+        ) );
1913
+        add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1914
+            $this->autocomplete_adapter,
1915
+            'wl_autocomplete',
1916
+        ) );
1917
+
1918
+        // Hooks to restrict multisite super admin from manipulating entity types.
1919
+        if ( is_multisite() ) {
1920
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1921
+        }
1922
+
1923
+        $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service );
1924
+
1925
+        add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) );
1926
+        add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) );
1927
+        add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) );
1928
+
1929
+        /**
1930
+         * Always allow the `wordlift/classification` block.
1931
+         *
1932
+         * @since 3.23.0
1933
+         */
1934
+        add_filter( 'allowed_block_types', function ( $value ) {
1935
+
1936
+            if ( true === $value ) {
1937
+                return $value;
1938
+            }
1939
+
1940
+            return array_merge( (array) $value, array( 'wordlift/classification' ) );
1941
+        }, PHP_INT_MAX );
1942
+
1943
+        /**
1944
+         * @since 3.27.7
1945
+         * @see https://github.com/insideout10/wordlift-plugin/issues/1214
1946
+         */
1947
+        new Top_Entities();
1948
+    }
1949
+
1950
+    /**
1951
+     * Register all of the hooks related to the public-facing functionality
1952
+     * of the plugin.
1953
+     *
1954
+     * @since    1.0.0
1955
+     * @access   private
1956
+     */
1957
+    private function define_public_hooks() {
1958
+
1959
+        $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1960
+
1961
+        // Register the entity post type.
1962
+        $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1963
+
1964
+        // Bind the link generation and handling hooks to the entity link service.
1965
+        $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1966
+        $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1967
+        // $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 );
1968
+        // $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 );
1969
+
1970
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1971
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1972
+        $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' );
1973
+
1974
+        // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html.
1975
+        $this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' );
1976
+        // Hook the content filter service to add entity links.
1977
+        if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1978
+            $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1979
+        }
1980
+
1981
+        // Hook the AJAX wl_timeline action to the Timeline service.
1982
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1983
+
1984
+        // Hook the ShareThis service.
1985
+        $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1986
+        $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1987
+
1988
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1989
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1990
+
1991
+        // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1992
+        // in order to tweak WP's `WP_Query` to include entities in queries related
1993
+        // to categories.
1994
+        $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1995
+
1996
+        /*
1997 1997
 		 * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service`
1998 1998
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1999 1999
 		 * order of start time.
2000 2000
 		 */
2001
-		$this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
2002
-
2003
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
2004
-
2005
-		// This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
2006
-		$this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
2007
-
2008
-		// Analytics Script Frontend.
2009
-		if ( apply_filters( 'wl_feature__enable__analytics', true ) && $this->configuration_service->is_analytics_enable() ) {
2010
-			$this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 );
2011
-		}
2012
-
2013
-	}
2014
-
2015
-	/**
2016
-	 * Run the loader to execute all of the hooks with WordPress.
2017
-	 *
2018
-	 * @since    1.0.0
2019
-	 */
2020
-	public function run() {
2021
-		$this->loader->run();
2022
-	}
2023
-
2024
-	/**
2025
-	 * The name of the plugin used to uniquely identify it within the context of
2026
-	 * WordPress and to define internationalization functionality.
2027
-	 *
2028
-	 * @return    string    The name of the plugin.
2029
-	 * @since     1.0.0
2030
-	 */
2031
-	public function get_plugin_name() {
2032
-		return $this->plugin_name;
2033
-	}
2034
-
2035
-	/**
2036
-	 * The reference to the class that orchestrates the hooks with the plugin.
2037
-	 *
2038
-	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
2039
-	 * @since     1.0.0
2040
-	 */
2041
-	public function get_loader() {
2042
-		return $this->loader;
2043
-	}
2044
-
2045
-	/**
2046
-	 * Retrieve the version number of the plugin.
2047
-	 *
2048
-	 * @return    string    The version number of the plugin.
2049
-	 * @since     1.0.0
2050
-	 */
2051
-	public function get_version() {
2052
-		return $this->version;
2053
-	}
2054
-
2055
-	/**
2056
-	 * Load dependencies for WP-CLI.
2057
-	 *
2058
-	 * @throws Exception
2059
-	 * @since 3.18.0
2060
-	 */
2061
-	private function load_cli_dependencies() {
2062
-
2063
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php';
2064
-
2065
-		$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 );
2066
-
2067
-		WP_CLI::add_command( 'wl references push', $push_reference_data_command );
2068
-
2069
-	}
2070
-
2071
-	/**
2072
-	 * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions.
2073
-	 *
2074
-	 * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance.
2075
-	 * @since 3.20.0
2076
-	 */
2077
-	public function get_dashboard_service() {
2078
-
2079
-		return $this->dashboard_service;
2080
-	}
2081
-
2082
-	public function add_wl_enabled_blocks() {
2083
-		/**
2084
-		 * Filter: wl_feature__enable__blocks.
2085
-		 *
2086
-		 * @param bool whether the blocks needed to be registered, defaults to true.
2087
-		 *
2088
-		 * @return bool
2089
-		 * @since 3.27.6
2090
-		 */
2091
-
2092
-		wp_register_script( 'wl_enabled_blocks', false );
2093
-
2094
-		$enabled_blocks = array();
2095
-
2096
-		/**
2097
-		 * Filter name: wl_feature__enable__product-navigator
2098
-		 * @since 3.32.3
2099
-		 */
2100
-		if ( apply_filters( 'wl_feature__enable__product-navigator', true ) ) {
2101
-			$enabled_blocks[] = 'wordlift/products-navigator';
2102
-		}
2103
-
2104
-		if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
2105
-			// To intimate JS
2106
-			$enabled_blocks = array_merge( $enabled_blocks, array(
2107
-				'wordlift/navigator',
2108
-				'wordlift/chord',
2109
-				'wordlift/geomap',
2110
-				'wordlift/timeline',
2111
-				'wordlift/cloud',
2112
-				'wordlift/vocabulary',
2113
-				'wordlift/faceted-search'
2114
-			) );
2115
-		}
2116
-
2117
-		wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks );
2118
-		wp_enqueue_script( 'wl_enabled_blocks' );
2119
-	}
2120
-
2121
-	/**
2122
-	 * Register screens based on the filter.
2123
-	 */
2124
-	public function register_screens() {
2125
-		// Hook the menu to the Download Your Data page.
2126
-		if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) {
2127
-			add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 );
2128
-		}
2129
-		add_action( 'admin_menu', array( $this->status_page, 'admin_menu' ), 100, 0 );
2130
-		add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 );
2131
-
2132
-	}
2001
+        $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
2002
+
2003
+        $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
2004
+
2005
+        // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
2006
+        $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
2007
+
2008
+        // Analytics Script Frontend.
2009
+        if ( apply_filters( 'wl_feature__enable__analytics', true ) && $this->configuration_service->is_analytics_enable() ) {
2010
+            $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 );
2011
+        }
2012
+
2013
+    }
2014
+
2015
+    /**
2016
+     * Run the loader to execute all of the hooks with WordPress.
2017
+     *
2018
+     * @since    1.0.0
2019
+     */
2020
+    public function run() {
2021
+        $this->loader->run();
2022
+    }
2023
+
2024
+    /**
2025
+     * The name of the plugin used to uniquely identify it within the context of
2026
+     * WordPress and to define internationalization functionality.
2027
+     *
2028
+     * @return    string    The name of the plugin.
2029
+     * @since     1.0.0
2030
+     */
2031
+    public function get_plugin_name() {
2032
+        return $this->plugin_name;
2033
+    }
2034
+
2035
+    /**
2036
+     * The reference to the class that orchestrates the hooks with the plugin.
2037
+     *
2038
+     * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
2039
+     * @since     1.0.0
2040
+     */
2041
+    public function get_loader() {
2042
+        return $this->loader;
2043
+    }
2044
+
2045
+    /**
2046
+     * Retrieve the version number of the plugin.
2047
+     *
2048
+     * @return    string    The version number of the plugin.
2049
+     * @since     1.0.0
2050
+     */
2051
+    public function get_version() {
2052
+        return $this->version;
2053
+    }
2054
+
2055
+    /**
2056
+     * Load dependencies for WP-CLI.
2057
+     *
2058
+     * @throws Exception
2059
+     * @since 3.18.0
2060
+     */
2061
+    private function load_cli_dependencies() {
2062
+
2063
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php';
2064
+
2065
+        $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 );
2066
+
2067
+        WP_CLI::add_command( 'wl references push', $push_reference_data_command );
2068
+
2069
+    }
2070
+
2071
+    /**
2072
+     * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions.
2073
+     *
2074
+     * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance.
2075
+     * @since 3.20.0
2076
+     */
2077
+    public function get_dashboard_service() {
2078
+
2079
+        return $this->dashboard_service;
2080
+    }
2081
+
2082
+    public function add_wl_enabled_blocks() {
2083
+        /**
2084
+         * Filter: wl_feature__enable__blocks.
2085
+         *
2086
+         * @param bool whether the blocks needed to be registered, defaults to true.
2087
+         *
2088
+         * @return bool
2089
+         * @since 3.27.6
2090
+         */
2091
+
2092
+        wp_register_script( 'wl_enabled_blocks', false );
2093
+
2094
+        $enabled_blocks = array();
2095
+
2096
+        /**
2097
+         * Filter name: wl_feature__enable__product-navigator
2098
+         * @since 3.32.3
2099
+         */
2100
+        if ( apply_filters( 'wl_feature__enable__product-navigator', true ) ) {
2101
+            $enabled_blocks[] = 'wordlift/products-navigator';
2102
+        }
2103
+
2104
+        if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
2105
+            // To intimate JS
2106
+            $enabled_blocks = array_merge( $enabled_blocks, array(
2107
+                'wordlift/navigator',
2108
+                'wordlift/chord',
2109
+                'wordlift/geomap',
2110
+                'wordlift/timeline',
2111
+                'wordlift/cloud',
2112
+                'wordlift/vocabulary',
2113
+                'wordlift/faceted-search'
2114
+            ) );
2115
+        }
2116
+
2117
+        wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks );
2118
+        wp_enqueue_script( 'wl_enabled_blocks' );
2119
+    }
2120
+
2121
+    /**
2122
+     * Register screens based on the filter.
2123
+     */
2124
+    public function register_screens() {
2125
+        // Hook the menu to the Download Your Data page.
2126
+        if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) {
2127
+            add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 );
2128
+        }
2129
+        add_action( 'admin_menu', array( $this->status_page, 'admin_menu' ), 100, 0 );
2130
+        add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 );
2131
+
2132
+    }
2133 2133
 
2134 2134
 }
Please login to merge, or discard this patch.
src/includes/class-wordlift-entity-service.php 2 patches
Indentation   +615 added lines, -615 removed lines patch added patch discarded remove patch
@@ -18,539 +18,539 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Entity_Service {
20 20
 
21
-	/**
22
-	 * The Log service.
23
-	 *
24
-	 * @since  3.2.0
25
-	 * @access private
26
-	 * @var \Wordlift_Log_Service $log The Log service.
27
-	 */
28
-	private $log;
29
-
30
-	/**
31
-	 * The UI service.
32
-	 *
33
-	 * @since  3.2.0
34
-	 * @access private
35
-	 * @var \Wordlift_UI_Service $ui_service The UI service.
36
-	 */
37
-	private $ui_service;
38
-
39
-	/**
40
-	 * The {@link Wordlift_Relation_Service} instance.
41
-	 *
42
-	 * @since  3.15.0
43
-	 * @access private
44
-	 * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
45
-	 */
46
-	private $relation_service;
47
-
48
-	/**
49
-	 * The {@link Wordlift_Entity_Uri_Service} instance.
50
-	 *
51
-	 * @since  3.16.3
52
-	 * @access private
53
-	 * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
54
-	 */
55
-	private $entity_uri_service;
56
-
57
-	/**
58
-	 * The entity post type name.
59
-	 *
60
-	 * @since 3.1.0
61
-	 */
62
-	const TYPE_NAME = 'entity';
63
-
64
-	/**
65
-	 * The alternative label meta key.
66
-	 *
67
-	 * @since 3.2.0
68
-	 */
69
-	const ALTERNATIVE_LABEL_META_KEY = '_wl_alt_label';
70
-
71
-	/**
72
-	 * The alternative label input template.
73
-	 *
74
-	 * @since 3.2.0
75
-	 */
76
-	// TODO: this should be moved to a class that deals with HTML code.
77
-	const ALTERNATIVE_LABEL_INPUT_TEMPLATE = '<div class="wl-alternative-label">
21
+    /**
22
+     * The Log service.
23
+     *
24
+     * @since  3.2.0
25
+     * @access private
26
+     * @var \Wordlift_Log_Service $log The Log service.
27
+     */
28
+    private $log;
29
+
30
+    /**
31
+     * The UI service.
32
+     *
33
+     * @since  3.2.0
34
+     * @access private
35
+     * @var \Wordlift_UI_Service $ui_service The UI service.
36
+     */
37
+    private $ui_service;
38
+
39
+    /**
40
+     * The {@link Wordlift_Relation_Service} instance.
41
+     *
42
+     * @since  3.15.0
43
+     * @access private
44
+     * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
45
+     */
46
+    private $relation_service;
47
+
48
+    /**
49
+     * The {@link Wordlift_Entity_Uri_Service} instance.
50
+     *
51
+     * @since  3.16.3
52
+     * @access private
53
+     * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
54
+     */
55
+    private $entity_uri_service;
56
+
57
+    /**
58
+     * The entity post type name.
59
+     *
60
+     * @since 3.1.0
61
+     */
62
+    const TYPE_NAME = 'entity';
63
+
64
+    /**
65
+     * The alternative label meta key.
66
+     *
67
+     * @since 3.2.0
68
+     */
69
+    const ALTERNATIVE_LABEL_META_KEY = '_wl_alt_label';
70
+
71
+    /**
72
+     * The alternative label input template.
73
+     *
74
+     * @since 3.2.0
75
+     */
76
+    // TODO: this should be moved to a class that deals with HTML code.
77
+    const ALTERNATIVE_LABEL_INPUT_TEMPLATE = '<div class="wl-alternative-label">
78 78
                 <label class="screen-reader-text" id="wl-alternative-label-prompt-text" for="wl-alternative-label">Enter alternative label here</label>
79 79
                 <input name="wl_alternative_label[]" size="30" value="%s" id="wl-alternative-label" type="text">
80 80
                 <button class="button wl-delete-button">%s</button>
81 81
                 </div>';
82 82
 
83
-	/**
84
-	 * A singleton instance of the Entity service.
85
-	 *
86
-	 * @since  3.2.0
87
-	 * @access private
88
-	 * @var \Wordlift_Entity_Service $instance A singleton instance of the Entity service.
89
-	 */
90
-	private static $instance;
91
-
92
-	/**
93
-	 * Create a Wordlift_Entity_Service instance.
94
-	 *
95
-	 * @param \Wordlift_UI_Service $ui_service The UI service.
96
-	 * @param \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
97
-	 * @param \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
98
-	 *
99
-	 * @since 3.2.0
100
-	 *
101
-	 */
102
-	public function __construct( $ui_service, $relation_service, $entity_uri_service ) {
103
-
104
-		$this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' );
105
-
106
-		$this->ui_service         = $ui_service;
107
-		$this->relation_service   = $relation_service;
108
-		$this->entity_uri_service = $entity_uri_service;
109
-
110
-		// Set the singleton instance.
111
-		self::$instance = $this;
112
-	}
113
-
114
-	/**
115
-	 * Get the singleton instance of the Entity service.
116
-	 *
117
-	 * @return \Wordlift_Entity_Service The singleton instance of the Entity service.
118
-	 * @since 3.2.0
119
-	 */
120
-	public static function get_instance() {
121
-
122
-		return self::$instance;
123
-	}
124
-
125
-	/**
126
-	 * Determines whether a post is an entity or not. Entity is in this context
127
-	 * something which is not an article.
128
-	 *
129
-	 * @param int $post_id A post id.
130
-	 *
131
-	 * @return bool Return true if the post is an entity otherwise false.
132
-	 * @since 3.1.0
133
-	 *
134
-	 */
135
-	public function is_entity( $post_id ) {
136
-
137
-		$terms = wp_get_object_terms( $post_id, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
138
-
139
-		if ( is_wp_error( $terms ) ) {
140
-			$this->log->error( "Cannot get the terms for post $post_id: " . $terms->get_error_message() );
141
-
142
-			return false;
143
-		}
144
-
145
-		if ( empty( $terms ) ) {
146
-			return false;
147
-		}
148
-
149
-		/*
83
+    /**
84
+     * A singleton instance of the Entity service.
85
+     *
86
+     * @since  3.2.0
87
+     * @access private
88
+     * @var \Wordlift_Entity_Service $instance A singleton instance of the Entity service.
89
+     */
90
+    private static $instance;
91
+
92
+    /**
93
+     * Create a Wordlift_Entity_Service instance.
94
+     *
95
+     * @param \Wordlift_UI_Service $ui_service The UI service.
96
+     * @param \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
97
+     * @param \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
98
+     *
99
+     * @since 3.2.0
100
+     *
101
+     */
102
+    public function __construct( $ui_service, $relation_service, $entity_uri_service ) {
103
+
104
+        $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' );
105
+
106
+        $this->ui_service         = $ui_service;
107
+        $this->relation_service   = $relation_service;
108
+        $this->entity_uri_service = $entity_uri_service;
109
+
110
+        // Set the singleton instance.
111
+        self::$instance = $this;
112
+    }
113
+
114
+    /**
115
+     * Get the singleton instance of the Entity service.
116
+     *
117
+     * @return \Wordlift_Entity_Service The singleton instance of the Entity service.
118
+     * @since 3.2.0
119
+     */
120
+    public static function get_instance() {
121
+
122
+        return self::$instance;
123
+    }
124
+
125
+    /**
126
+     * Determines whether a post is an entity or not. Entity is in this context
127
+     * something which is not an article.
128
+     *
129
+     * @param int $post_id A post id.
130
+     *
131
+     * @return bool Return true if the post is an entity otherwise false.
132
+     * @since 3.1.0
133
+     *
134
+     */
135
+    public function is_entity( $post_id ) {
136
+
137
+        $terms = wp_get_object_terms( $post_id, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
138
+
139
+        if ( is_wp_error( $terms ) ) {
140
+            $this->log->error( "Cannot get the terms for post $post_id: " . $terms->get_error_message() );
141
+
142
+            return false;
143
+        }
144
+
145
+        if ( empty( $terms ) ) {
146
+            return false;
147
+        }
148
+
149
+        /*
150 150
 		 * We don't consider an `article` to be an entity.
151 151
 		 *
152 152
 		 * @since 3.20.0 At least one associated mustn't be an `article`.
153 153
 		 *
154 154
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
155 155
 		 */
156
-		foreach ( $terms as $term ) {
157
-			if ( 1 !== preg_match( '~(^|-)article$~', $term->slug ) ) {
158
-				return true;
159
-			}
160
-		}
161
-
162
-		return false;
163
-	}
164
-
165
-	/**
166
-	 * Get the proper classification scope for a given entity post
167
-	 *
168
-	 * @param integer $post_id An entity post id.
169
-	 *
170
-	 * @param string $default The default classification scope, `what` if not
171
-	 *                         provided.
172
-	 *
173
-	 * @return string Returns a classification scope (e.g. 'what').
174
-	 * @since 3.5.0
175
-	 *
176
-	 */
177
-	public function get_classification_scope_for( $post_id, $default = WL_WHAT_RELATION ) {
178
-
179
-		if ( false === $this->is_entity( $post_id ) ) {
180
-			return $default;
181
-		}
182
-
183
-		// Retrieve the entity type
184
-		$entity_type_arr = Wordlift_Entity_Type_Service::get_instance()->get( $post_id );
185
-		$entity_type     = str_replace( 'wl-', '', $entity_type_arr['css_class'] );
186
-		// Retrieve classification boxes configuration
187
-		$classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES );
188
-		foreach ( $classification_boxes as $cb ) {
189
-			if ( in_array( $entity_type, $cb['registeredTypes'] ) ) {
190
-				return $cb['id'];
191
-			}
192
-		}
193
-
194
-		return $default;
195
-	}
196
-
197
-	/**
198
-	 * Check whether a {@link WP_Post} is used.
199
-	 *
200
-	 * @param int $post_id The {@link WP_Post}'s id.
201
-	 *
202
-	 * @return bool|null Null if it's not an entity, otherwise true if it's used.
203
-	 */
204
-	public function is_used( $post_id ) {
205
-
206
-		if ( false === $this->is_entity( $post_id ) ) {
207
-			return null;
208
-		}
209
-		// Retrieve the post
210
-		$entity = get_post( $post_id );
211
-
212
-		global $wpdb;
213
-		// Retrieve Wordlift relation instances table name
214
-		$table_name = wl_core_get_relation_instances_table_name();
215
-
216
-		// Check is it's referenced / related to another post / entity
217
-		$stmt = $wpdb->prepare(
218
-			"SELECT COUNT(*) FROM $table_name WHERE  object_id = %d",
219
-			$entity->ID
220
-		);
221
-
222
-		// Perform the query
223
-		$relation_instances = (int) $wpdb->get_var( $stmt );
224
-		// If there is at least one relation instance for the current entity, then it's used
225
-		if ( 0 < $relation_instances ) {
226
-			return true;
227
-		}
228
-
229
-		// Check if the entity uri is used as meta_value
230
-		$stmt = $wpdb->prepare(
231
-			"SELECT COUNT(*) FROM $wpdb->postmeta WHERE post_id != %d AND meta_value = %s",
232
-			$entity->ID,
233
-			wl_get_entity_uri( $entity->ID )
234
-		);
235
-		// Perform the query
236
-		$meta_instances = (int) $wpdb->get_var( $stmt );
237
-
238
-		// If there is at least one meta that refers the current entity uri, then current entity is used
239
-		if ( 0 < $meta_instances ) {
240
-			return true;
241
-		}
242
-
243
-		// If we are here, it means the current entity is not used at the moment
244
-		return false;
245
-	}
246
-
247
-	/**
248
-	 * Find entity posts by the entity URI. Entity as searched by their entity URI or same as.
249
-	 *
250
-	 * @param string $uri The entity URI.
251
-	 *
252
-	 * @return WP_Post|null A WP_Post instance or null if not found.
253
-	 * @deprecated in favor of Wordlift_Entity_Uri_Service->get_entity( $uri );
254
-	 *
255
-	 * @since      3.16.3 deprecated in favor of Wordlift_Entity_Uri_Service->get_entity( $uri );
256
-	 * @since      3.2.0
257
-	 *
258
-	 */
259
-	public function get_entity_post_by_uri( $uri ) {
260
-
261
-		return $this->entity_uri_service->get_entity( $uri );
262
-	}
263
-
264
-	/**
265
-	 * Fires once a post has been saved. This function uses the $_REQUEST, therefore
266
-	 * we check that the post we're saving is the current post.
267
-	 *
268
-	 * @see   https://github.com/insideout10/wordlift-plugin/issues/363
269
-	 *
270
-	 * @since 3.2.0
271
-	 *
272
-	 * @param int $post_id Post ID.
273
-	 * @param WP_Post $post Post object.
274
-	 * @param bool $update Whether this is an existing post being updated or not.
275
-	 */
276
-	public function save_post( $post_id, $post, $update ) {
277
-
278
-		// Avoid doing anything if post is autosave or a revision.
279
-		if ( wp_is_post_autosave( $post ) || wp_is_post_revision( $post ) ) {
280
-			return;
281
-		}
282
-
283
-		// We're setting the alternative label that have been provided via the UI
284
-		// (in fact we're using $_REQUEST), while save_post may be also called
285
-		// programmatically by some other function: we need to check therefore if
286
-		// the $post_id in the save_post call matches the post id set in the request.
287
-		//
288
-		// If this is not the current post being saved or if it's not an entity, return.
289
-		if ( ! isset( $_REQUEST['post_ID'] ) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity( $post_id ) ) {
290
-			return;
291
-		}
292
-
293
-		// Get the alt labels from the request (or empty array).
294
-		$alt_labels = isset( $_REQUEST['wl_alternative_label'] ) ? (array) $_REQUEST['wl_alternative_label'] : array();
295
-
296
-		if ( ( ! empty( $_POST['content'] ) && ! empty( $_POST['post_content'] ) ) || isset( $_REQUEST['wl_alternative_label'] ) ) {
297
-			// This is via classic editor, so set the alternative labels.
298
-			$this->set_alternative_labels( $post_id, $alt_labels );
299
-		}
300
-
301
-
302
-	}
303
-
304
-	/**
305
-	 * Set the alternative labels.
306
-	 *
307
-	 * @param int $post_id The post id.
308
-	 * @param array $alt_labels An array of labels.
309
-	 *
310
-	 * @since 3.2.0
311
-	 *
312
-	 */
313
-	public function set_alternative_labels( $post_id, $alt_labels ) {
314
-
315
-		// Bail out if post id is not numeric. We add this check as we found a WP install that was sending a WP_Error
316
-		// instead of post id.
317
-		if ( ! is_numeric( $post_id ) ) {
318
-			return;
319
-		}
320
-
321
-		// Force $alt_labels to be an array
322
-		if ( ! is_array( $alt_labels ) ) {
323
-			$alt_labels = array( $alt_labels );
324
-		}
325
-
326
-		$this->log->debug( "Setting alternative labels [ post id :: $post_id ][ alt labels :: " . implode( ',', $alt_labels ) . " ]" );
327
-
328
-		// Delete all the existing alternate labels.
329
-		delete_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
330
-
331
-		// Set the alternative labels.
332
-		foreach ( $alt_labels as $alt_label ) {
333
-
334
-			if ( ! preg_match('/^[\w\-, ]+$/', $alt_label )  ) {
335
-				continue;
336
-			}
337
-
338
-			if ( ! empty( $alt_label ) ) {
339
-				add_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY, (string) $alt_label );
340
-			}
341
-		}
342
-
343
-	}
344
-
345
-	/**
346
-	 * Retrieve the alternate labels.
347
-	 *
348
-	 * @param int $post_id Post id.
349
-	 *
350
-	 * @return mixed An array  of alternative labels.
351
-	 * @since 3.2.0
352
-	 *
353
-	 */
354
-	public function get_alternative_labels( $post_id ) {
355
-
356
-		return get_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
357
-	}
358
-
359
-	/**
360
-	 * Retrieve the labels for an entity, i.e. the title + the synonyms.
361
-	 *
362
-	 * @param int $post_id The entity {@link WP_Post} id.
363
-	 * @param int $object_type The object type {@link Object_Type_Enum}
364
-	 *
365
-	 * @return array An array with the entity title and labels.
366
-	 * @since 3.12.0
367
-	 */
368
-	public function get_labels( $post_id, $object_type = Object_Type_Enum::POST ) {
369
-		if ( $object_type === Object_Type_Enum::POST ) {
370
-			return array_merge( (array) get_the_title( $post_id ), $this->get_alternative_labels( $post_id ) );
371
-		}
372
-		// Term Reference dont have synonyms yet.
373
-		return array();
374
-	}
375
-
376
-	/**
377
-	 * Fires before the permalink field in the edit form (this event is available in WP from 4.1.0).
378
-	 *
379
-	 * @param WP_Post $post Post object.
380
-	 *
381
-	 * @since 3.2.0
382
-	 *
383
-	 */
384
-	public function edit_form_before_permalink( $post ) {
385
-
386
-		// If it's not an entity, return.
387
-		if ( ! $this->is_entity( $post->ID ) ) {
388
-			return;
389
-		}
390
-
391
-		// If disabled by filter, return.
392
-		if ( ! apply_filters( 'wl_feature__enable__add-synonyms', true ) ) {
393
-			return;
394
-		}
395
-
396
-		// Print the input template.
397
-		$this->ui_service->print_template( 'wl-tmpl-alternative-label-input', $this->get_alternative_label_input() );
398
-
399
-		// Print all the currently set alternative labels.
400
-		foreach ( $this->get_alternative_labels( $post->ID ) as $alt_label ) {
401
-
402
-			echo $this->get_alternative_label_input( $alt_label );
403
-
404
-		};
405
-
406
-		// Print the button.
407
-		$this->ui_service->print_button( 'wl-add-alternative-labels-button', __( 'Add more titles', 'wordlift' ) );
408
-
409
-	}
410
-
411
-	/**
412
-	 * Get the URI for the entity with the specified post id.
413
-	 *
414
-	 * @param int $post_id The entity post id.
415
-	 *
416
-	 * @return null|string The entity URI or NULL if not found or the dataset URI is not configured.
417
-	 * @since 3.6.0
418
-	 *
419
-	 */
420
-	private function get_uri_for_post( $post_id ) {
421
-
422
-		$log = Wordlift_Log_Service::get_logger( get_class() );
423
-
424
-		// If a null is given, nothing to do
425
-		if ( is_null( $post_id ) ) {
426
-			return null;
427
-		}
428
-
429
-		$dataset_uri = wl_configuration_get_redlink_dataset_uri();
430
-
431
-		if ( empty( $dataset_uri ) ) {
432
-			// Continue even if the dataset uri is not properly configured. It is handled in function wl_build_entity_uri()
433
-			$log->debug( 'Continuing, dataset uri not configured...' );
434
-		}
435
-
436
-		$uri = get_post_meta( $post_id, WL_ENTITY_URL_META_NAME, true );
437
-
438
-		/*
156
+        foreach ( $terms as $term ) {
157
+            if ( 1 !== preg_match( '~(^|-)article$~', $term->slug ) ) {
158
+                return true;
159
+            }
160
+        }
161
+
162
+        return false;
163
+    }
164
+
165
+    /**
166
+     * Get the proper classification scope for a given entity post
167
+     *
168
+     * @param integer $post_id An entity post id.
169
+     *
170
+     * @param string $default The default classification scope, `what` if not
171
+     *                         provided.
172
+     *
173
+     * @return string Returns a classification scope (e.g. 'what').
174
+     * @since 3.5.0
175
+     *
176
+     */
177
+    public function get_classification_scope_for( $post_id, $default = WL_WHAT_RELATION ) {
178
+
179
+        if ( false === $this->is_entity( $post_id ) ) {
180
+            return $default;
181
+        }
182
+
183
+        // Retrieve the entity type
184
+        $entity_type_arr = Wordlift_Entity_Type_Service::get_instance()->get( $post_id );
185
+        $entity_type     = str_replace( 'wl-', '', $entity_type_arr['css_class'] );
186
+        // Retrieve classification boxes configuration
187
+        $classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES );
188
+        foreach ( $classification_boxes as $cb ) {
189
+            if ( in_array( $entity_type, $cb['registeredTypes'] ) ) {
190
+                return $cb['id'];
191
+            }
192
+        }
193
+
194
+        return $default;
195
+    }
196
+
197
+    /**
198
+     * Check whether a {@link WP_Post} is used.
199
+     *
200
+     * @param int $post_id The {@link WP_Post}'s id.
201
+     *
202
+     * @return bool|null Null if it's not an entity, otherwise true if it's used.
203
+     */
204
+    public function is_used( $post_id ) {
205
+
206
+        if ( false === $this->is_entity( $post_id ) ) {
207
+            return null;
208
+        }
209
+        // Retrieve the post
210
+        $entity = get_post( $post_id );
211
+
212
+        global $wpdb;
213
+        // Retrieve Wordlift relation instances table name
214
+        $table_name = wl_core_get_relation_instances_table_name();
215
+
216
+        // Check is it's referenced / related to another post / entity
217
+        $stmt = $wpdb->prepare(
218
+            "SELECT COUNT(*) FROM $table_name WHERE  object_id = %d",
219
+            $entity->ID
220
+        );
221
+
222
+        // Perform the query
223
+        $relation_instances = (int) $wpdb->get_var( $stmt );
224
+        // If there is at least one relation instance for the current entity, then it's used
225
+        if ( 0 < $relation_instances ) {
226
+            return true;
227
+        }
228
+
229
+        // Check if the entity uri is used as meta_value
230
+        $stmt = $wpdb->prepare(
231
+            "SELECT COUNT(*) FROM $wpdb->postmeta WHERE post_id != %d AND meta_value = %s",
232
+            $entity->ID,
233
+            wl_get_entity_uri( $entity->ID )
234
+        );
235
+        // Perform the query
236
+        $meta_instances = (int) $wpdb->get_var( $stmt );
237
+
238
+        // If there is at least one meta that refers the current entity uri, then current entity is used
239
+        if ( 0 < $meta_instances ) {
240
+            return true;
241
+        }
242
+
243
+        // If we are here, it means the current entity is not used at the moment
244
+        return false;
245
+    }
246
+
247
+    /**
248
+     * Find entity posts by the entity URI. Entity as searched by their entity URI or same as.
249
+     *
250
+     * @param string $uri The entity URI.
251
+     *
252
+     * @return WP_Post|null A WP_Post instance or null if not found.
253
+     * @deprecated in favor of Wordlift_Entity_Uri_Service->get_entity( $uri );
254
+     *
255
+     * @since      3.16.3 deprecated in favor of Wordlift_Entity_Uri_Service->get_entity( $uri );
256
+     * @since      3.2.0
257
+     *
258
+     */
259
+    public function get_entity_post_by_uri( $uri ) {
260
+
261
+        return $this->entity_uri_service->get_entity( $uri );
262
+    }
263
+
264
+    /**
265
+     * Fires once a post has been saved. This function uses the $_REQUEST, therefore
266
+     * we check that the post we're saving is the current post.
267
+     *
268
+     * @see   https://github.com/insideout10/wordlift-plugin/issues/363
269
+     *
270
+     * @since 3.2.0
271
+     *
272
+     * @param int $post_id Post ID.
273
+     * @param WP_Post $post Post object.
274
+     * @param bool $update Whether this is an existing post being updated or not.
275
+     */
276
+    public function save_post( $post_id, $post, $update ) {
277
+
278
+        // Avoid doing anything if post is autosave or a revision.
279
+        if ( wp_is_post_autosave( $post ) || wp_is_post_revision( $post ) ) {
280
+            return;
281
+        }
282
+
283
+        // We're setting the alternative label that have been provided via the UI
284
+        // (in fact we're using $_REQUEST), while save_post may be also called
285
+        // programmatically by some other function: we need to check therefore if
286
+        // the $post_id in the save_post call matches the post id set in the request.
287
+        //
288
+        // If this is not the current post being saved or if it's not an entity, return.
289
+        if ( ! isset( $_REQUEST['post_ID'] ) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity( $post_id ) ) {
290
+            return;
291
+        }
292
+
293
+        // Get the alt labels from the request (or empty array).
294
+        $alt_labels = isset( $_REQUEST['wl_alternative_label'] ) ? (array) $_REQUEST['wl_alternative_label'] : array();
295
+
296
+        if ( ( ! empty( $_POST['content'] ) && ! empty( $_POST['post_content'] ) ) || isset( $_REQUEST['wl_alternative_label'] ) ) {
297
+            // This is via classic editor, so set the alternative labels.
298
+            $this->set_alternative_labels( $post_id, $alt_labels );
299
+        }
300
+
301
+
302
+    }
303
+
304
+    /**
305
+     * Set the alternative labels.
306
+     *
307
+     * @param int $post_id The post id.
308
+     * @param array $alt_labels An array of labels.
309
+     *
310
+     * @since 3.2.0
311
+     *
312
+     */
313
+    public function set_alternative_labels( $post_id, $alt_labels ) {
314
+
315
+        // Bail out if post id is not numeric. We add this check as we found a WP install that was sending a WP_Error
316
+        // instead of post id.
317
+        if ( ! is_numeric( $post_id ) ) {
318
+            return;
319
+        }
320
+
321
+        // Force $alt_labels to be an array
322
+        if ( ! is_array( $alt_labels ) ) {
323
+            $alt_labels = array( $alt_labels );
324
+        }
325
+
326
+        $this->log->debug( "Setting alternative labels [ post id :: $post_id ][ alt labels :: " . implode( ',', $alt_labels ) . " ]" );
327
+
328
+        // Delete all the existing alternate labels.
329
+        delete_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
330
+
331
+        // Set the alternative labels.
332
+        foreach ( $alt_labels as $alt_label ) {
333
+
334
+            if ( ! preg_match('/^[\w\-, ]+$/', $alt_label )  ) {
335
+                continue;
336
+            }
337
+
338
+            if ( ! empty( $alt_label ) ) {
339
+                add_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY, (string) $alt_label );
340
+            }
341
+        }
342
+
343
+    }
344
+
345
+    /**
346
+     * Retrieve the alternate labels.
347
+     *
348
+     * @param int $post_id Post id.
349
+     *
350
+     * @return mixed An array  of alternative labels.
351
+     * @since 3.2.0
352
+     *
353
+     */
354
+    public function get_alternative_labels( $post_id ) {
355
+
356
+        return get_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
357
+    }
358
+
359
+    /**
360
+     * Retrieve the labels for an entity, i.e. the title + the synonyms.
361
+     *
362
+     * @param int $post_id The entity {@link WP_Post} id.
363
+     * @param int $object_type The object type {@link Object_Type_Enum}
364
+     *
365
+     * @return array An array with the entity title and labels.
366
+     * @since 3.12.0
367
+     */
368
+    public function get_labels( $post_id, $object_type = Object_Type_Enum::POST ) {
369
+        if ( $object_type === Object_Type_Enum::POST ) {
370
+            return array_merge( (array) get_the_title( $post_id ), $this->get_alternative_labels( $post_id ) );
371
+        }
372
+        // Term Reference dont have synonyms yet.
373
+        return array();
374
+    }
375
+
376
+    /**
377
+     * Fires before the permalink field in the edit form (this event is available in WP from 4.1.0).
378
+     *
379
+     * @param WP_Post $post Post object.
380
+     *
381
+     * @since 3.2.0
382
+     *
383
+     */
384
+    public function edit_form_before_permalink( $post ) {
385
+
386
+        // If it's not an entity, return.
387
+        if ( ! $this->is_entity( $post->ID ) ) {
388
+            return;
389
+        }
390
+
391
+        // If disabled by filter, return.
392
+        if ( ! apply_filters( 'wl_feature__enable__add-synonyms', true ) ) {
393
+            return;
394
+        }
395
+
396
+        // Print the input template.
397
+        $this->ui_service->print_template( 'wl-tmpl-alternative-label-input', $this->get_alternative_label_input() );
398
+
399
+        // Print all the currently set alternative labels.
400
+        foreach ( $this->get_alternative_labels( $post->ID ) as $alt_label ) {
401
+
402
+            echo $this->get_alternative_label_input( $alt_label );
403
+
404
+        };
405
+
406
+        // Print the button.
407
+        $this->ui_service->print_button( 'wl-add-alternative-labels-button', __( 'Add more titles', 'wordlift' ) );
408
+
409
+    }
410
+
411
+    /**
412
+     * Get the URI for the entity with the specified post id.
413
+     *
414
+     * @param int $post_id The entity post id.
415
+     *
416
+     * @return null|string The entity URI or NULL if not found or the dataset URI is not configured.
417
+     * @since 3.6.0
418
+     *
419
+     */
420
+    private function get_uri_for_post( $post_id ) {
421
+
422
+        $log = Wordlift_Log_Service::get_logger( get_class() );
423
+
424
+        // If a null is given, nothing to do
425
+        if ( is_null( $post_id ) ) {
426
+            return null;
427
+        }
428
+
429
+        $dataset_uri = wl_configuration_get_redlink_dataset_uri();
430
+
431
+        if ( empty( $dataset_uri ) ) {
432
+            // Continue even if the dataset uri is not properly configured. It is handled in function wl_build_entity_uri()
433
+            $log->debug( 'Continuing, dataset uri not configured...' );
434
+        }
435
+
436
+        $uri = get_post_meta( $post_id, WL_ENTITY_URL_META_NAME, true );
437
+
438
+        /*
439 439
 		 * Consider the URI invalid if it doesn't start with the dataset URI.
440 440
 		 *
441 441
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/996
442 442
 		 */
443
-		if ( empty( $dataset_uri ) || 0 !== strpos( $uri, $dataset_uri ) ) {
444
-			$uri = null;
445
-		}
446
-
447
-		// Set the URI if it isn't set yet.
448
-		$post_status = get_post_status( $post_id );
449
-		if ( empty( $uri ) && 'auto-draft' !== $post_status && 'inherit' !== $post_status ) {
450
-			$uri = wl_build_entity_uri( $post_id );
451
-			wl_set_entity_uri( $post_id, $uri );
452
-		}
453
-
454
-		return $uri;
455
-	}
456
-
457
-	public function get_uri( $object_id, $type = Object_Type_Enum::POST ) {
458
-
459
-		if ( Object_Type_Enum::POST === $type ) {
460
-			return $this->get_uri_for_post( $object_id );
461
-		}
462
-
463
-		if ( Object_Type_Enum::USER === $type ) {
464
-			$uri = Wordlift_User_Service::get_instance()->get_uri( $object_id );
465
-
466
-			return ( false === $uri ? null : $uri );
467
-		}
468
-
469
-		if ( Object_Type_Enum::TERM === $type ) {
470
-			return wl_get_term_entity_uri( $object_id );
471
-		}
472
-
473
-		return null;
474
-	}
475
-
476
-	/**
477
-	 * Get the alternative label input HTML code.
478
-	 *
479
-	 * @param string $value The input value.
480
-	 *
481
-	 * @return string The input HTML code.
482
-	 * @since 3.2.0
483
-	 *
484
-	 */
485
-	private function get_alternative_label_input( $value = '' ) {
486
-
487
-		return sprintf( self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr( $value ), __( 'Delete', 'wordlift' ) );
488
-	}
489
-
490
-	/**
491
-	 * Get the number of entity posts published in this blog.
492
-	 *
493
-	 * @return int The number of published entity posts.
494
-	 * @since 3.6.0
495
-	 *
496
-	 */
497
-	public function count() {
498
-		global $wpdb;
499
-
500
-		// Try to get the count from the transient.
501
-		$count = get_transient( '_wl_entity_service__count' );
502
-		if ( false !== $count ) {
503
-			return $count;
504
-		}
505
-
506
-		// Query the count.
507
-		$count = $wpdb->get_var( $wpdb->prepare(
508
-			"SELECT COUNT( DISTINCT( tr.object_id ) )"
509
-			. " FROM {$wpdb->term_relationships} tr"
510
-			. " INNER JOIN {$wpdb->term_taxonomy} tt"
511
-			. "  ON tt.taxonomy = %s AND tt.term_taxonomy_id = tr.term_taxonomy_id"
512
-			. " INNER JOIN {$wpdb->terms} t"
513
-			. "  ON t.term_id = tt.term_id AND t.name != %s",
514
-			Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
515
-			'article'
516
-		) );
517
-
518
-		// Store the count in cache.
519
-		set_transient( '_wl_entity_service__count', $count, 900 );
520
-
521
-		return $count;
522
-	}
523
-
524
-	/**
525
-	 * Add the entity filtering criterias to the arguments for a `get_posts`
526
-	 * call.
527
-	 *
528
-	 * @param array $args The arguments for a `get_posts` call.
529
-	 *
530
-	 * @return array The arguments for a `get_posts` call.
531
-	 * @since 3.15.0
532
-	 *
533
-	 */
534
-	public static function add_criterias( $args ) {
535
-
536
-		// Build an optimal tax-query.
537
-		$tax_query = array(
538
-			'relation' => 'AND',
539
-			array(
540
-				'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
541
-				'operator' => 'EXISTS',
542
-			),
543
-			array(
544
-				'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
545
-				'field'    => 'slug',
546
-				'terms'    => 'article',
547
-				'operator' => 'NOT IN',
548
-			),
549
-		);
550
-
551
-		return $args + array(
552
-				'post_type' => Wordlift_Entity_Service::valid_entity_post_types(),
553
-				/*
443
+        if ( empty( $dataset_uri ) || 0 !== strpos( $uri, $dataset_uri ) ) {
444
+            $uri = null;
445
+        }
446
+
447
+        // Set the URI if it isn't set yet.
448
+        $post_status = get_post_status( $post_id );
449
+        if ( empty( $uri ) && 'auto-draft' !== $post_status && 'inherit' !== $post_status ) {
450
+            $uri = wl_build_entity_uri( $post_id );
451
+            wl_set_entity_uri( $post_id, $uri );
452
+        }
453
+
454
+        return $uri;
455
+    }
456
+
457
+    public function get_uri( $object_id, $type = Object_Type_Enum::POST ) {
458
+
459
+        if ( Object_Type_Enum::POST === $type ) {
460
+            return $this->get_uri_for_post( $object_id );
461
+        }
462
+
463
+        if ( Object_Type_Enum::USER === $type ) {
464
+            $uri = Wordlift_User_Service::get_instance()->get_uri( $object_id );
465
+
466
+            return ( false === $uri ? null : $uri );
467
+        }
468
+
469
+        if ( Object_Type_Enum::TERM === $type ) {
470
+            return wl_get_term_entity_uri( $object_id );
471
+        }
472
+
473
+        return null;
474
+    }
475
+
476
+    /**
477
+     * Get the alternative label input HTML code.
478
+     *
479
+     * @param string $value The input value.
480
+     *
481
+     * @return string The input HTML code.
482
+     * @since 3.2.0
483
+     *
484
+     */
485
+    private function get_alternative_label_input( $value = '' ) {
486
+
487
+        return sprintf( self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr( $value ), __( 'Delete', 'wordlift' ) );
488
+    }
489
+
490
+    /**
491
+     * Get the number of entity posts published in this blog.
492
+     *
493
+     * @return int The number of published entity posts.
494
+     * @since 3.6.0
495
+     *
496
+     */
497
+    public function count() {
498
+        global $wpdb;
499
+
500
+        // Try to get the count from the transient.
501
+        $count = get_transient( '_wl_entity_service__count' );
502
+        if ( false !== $count ) {
503
+            return $count;
504
+        }
505
+
506
+        // Query the count.
507
+        $count = $wpdb->get_var( $wpdb->prepare(
508
+            "SELECT COUNT( DISTINCT( tr.object_id ) )"
509
+            . " FROM {$wpdb->term_relationships} tr"
510
+            . " INNER JOIN {$wpdb->term_taxonomy} tt"
511
+            . "  ON tt.taxonomy = %s AND tt.term_taxonomy_id = tr.term_taxonomy_id"
512
+            . " INNER JOIN {$wpdb->terms} t"
513
+            . "  ON t.term_id = tt.term_id AND t.name != %s",
514
+            Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
515
+            'article'
516
+        ) );
517
+
518
+        // Store the count in cache.
519
+        set_transient( '_wl_entity_service__count', $count, 900 );
520
+
521
+        return $count;
522
+    }
523
+
524
+    /**
525
+     * Add the entity filtering criterias to the arguments for a `get_posts`
526
+     * call.
527
+     *
528
+     * @param array $args The arguments for a `get_posts` call.
529
+     *
530
+     * @return array The arguments for a `get_posts` call.
531
+     * @since 3.15.0
532
+     *
533
+     */
534
+    public static function add_criterias( $args ) {
535
+
536
+        // Build an optimal tax-query.
537
+        $tax_query = array(
538
+            'relation' => 'AND',
539
+            array(
540
+                'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
541
+                'operator' => 'EXISTS',
542
+            ),
543
+            array(
544
+                'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
545
+                'field'    => 'slug',
546
+                'terms'    => 'article',
547
+                'operator' => 'NOT IN',
548
+            ),
549
+        );
550
+
551
+        return $args + array(
552
+                'post_type' => Wordlift_Entity_Service::valid_entity_post_types(),
553
+                /*
554 554
 				 * Ensure compatibility with Polylang.
555 555
 				 *
556 556
 				 * @see https://github.com/insideout10/wordlift-plugin/issues/855.
@@ -558,102 +558,102 @@  discard block
 block discarded – undo
558 558
 				 *
559 559
 				 * @since 3.19.5
560 560
 				 */
561
-				'lang'      => '',
562
-				'tax_query' => $tax_query,
563
-			);
564
-	}
565
-
566
-	/**
567
-	 * Create a new entity.
568
-	 *
569
-	 * @param string $name The entity name.
570
-	 * @param string $type_uri The entity's type URI.
571
-	 * @param null $logo The entity logo id (or NULL if none).
572
-	 * @param string $status The post status, by default 'publish'.
573
-	 *
574
-	 * @return int|WP_Error The entity post id or a {@link WP_Error} in case the `wp_insert_post` call fails.
575
-	 * @since 3.9.0
576
-	 *
577
-	 */
578
-	public function create( $name, $type_uri, $logo = null, $status = 'publish' ) {
579
-
580
-		// Create an entity for the publisher.
581
-		$post_id = @wp_insert_post( array(
582
-			'post_type'    => self::TYPE_NAME,
583
-			'post_title'   => $name,
584
-			'post_status'  => $status,
585
-			'post_content' => '',
586
-		) );
587
-
588
-		// Return the error if any.
589
-		if ( is_wp_error( $post_id ) ) {
590
-			return $post_id;
591
-		}
592
-
593
-		// Set the entity logo.
594
-		if ( $logo && is_numeric( $logo ) ) {
595
-			set_post_thumbnail( $post_id, $logo );
596
-		}
597
-
598
-		// Set the entity type.
599
-		Wordlift_Entity_Type_Service::get_instance()->set( $post_id, $type_uri );
600
-
601
-		return $post_id;
602
-	}
603
-
604
-	/**
605
-	 * Get the entities related to the one with the specified id. By default only
606
-	 * published entities will be returned.
607
-	 *
608
-	 * @param int $id The post id.
609
-	 * @param string $post_status The target post status (default = publish).
610
-	 *
611
-	 * @return array An array of post ids.
612
-	 * @since 3.10.0
613
-	 *
614
-	 */
615
-	public function get_related_entities( $id, $post_status = 'publish' ) {
616
-
617
-		return $this->relation_service->get_objects( $id, 'ids', null, $post_status );
618
-	}
619
-
620
-	/**
621
-	 * Get the list of entities.
622
-	 *
623
-	 * @param array $params Custom parameters for WordPress' own {@link get_posts} function.
624
-	 *
625
-	 * @return array An array of entity posts.
626
-	 * @since 3.12.2
627
-	 *
628
-	 */
629
-	public function get( $params = array() ) {
630
-
631
-		// Set the defaults.
632
-		$defaults = array( 'post_type' => 'entity' );
633
-
634
-		// Merge the defaults with the provided parameters.
635
-		$args = wp_parse_args( $params, $defaults );
636
-
637
-		// Call the `get_posts` function.
638
-		return get_posts( $args );
639
-	}
640
-
641
-	/**
642
-	 * The list of post type names which can be used for entities
643
-	 *
644
-	 * Criteria is that the post type is public. The list of valid post types
645
-	 * can be overridden with a filter.
646
-	 *
647
-	 * @return array Array containing the names of the valid post types.
648
-	 * @since 3.15.0
649
-	 *
650
-	 */
651
-	static function valid_entity_post_types() {
652
-
653
-		// Ignore builtins in the call to avoid getting attachments.
654
-		$post_types = array( 'post', 'page', self::TYPE_NAME, 'product' );
655
-
656
-		return apply_filters( 'wl_valid_entity_post_types', $post_types );
657
-	}
561
+                'lang'      => '',
562
+                'tax_query' => $tax_query,
563
+            );
564
+    }
565
+
566
+    /**
567
+     * Create a new entity.
568
+     *
569
+     * @param string $name The entity name.
570
+     * @param string $type_uri The entity's type URI.
571
+     * @param null $logo The entity logo id (or NULL if none).
572
+     * @param string $status The post status, by default 'publish'.
573
+     *
574
+     * @return int|WP_Error The entity post id or a {@link WP_Error} in case the `wp_insert_post` call fails.
575
+     * @since 3.9.0
576
+     *
577
+     */
578
+    public function create( $name, $type_uri, $logo = null, $status = 'publish' ) {
579
+
580
+        // Create an entity for the publisher.
581
+        $post_id = @wp_insert_post( array(
582
+            'post_type'    => self::TYPE_NAME,
583
+            'post_title'   => $name,
584
+            'post_status'  => $status,
585
+            'post_content' => '',
586
+        ) );
587
+
588
+        // Return the error if any.
589
+        if ( is_wp_error( $post_id ) ) {
590
+            return $post_id;
591
+        }
592
+
593
+        // Set the entity logo.
594
+        if ( $logo && is_numeric( $logo ) ) {
595
+            set_post_thumbnail( $post_id, $logo );
596
+        }
597
+
598
+        // Set the entity type.
599
+        Wordlift_Entity_Type_Service::get_instance()->set( $post_id, $type_uri );
600
+
601
+        return $post_id;
602
+    }
603
+
604
+    /**
605
+     * Get the entities related to the one with the specified id. By default only
606
+     * published entities will be returned.
607
+     *
608
+     * @param int $id The post id.
609
+     * @param string $post_status The target post status (default = publish).
610
+     *
611
+     * @return array An array of post ids.
612
+     * @since 3.10.0
613
+     *
614
+     */
615
+    public function get_related_entities( $id, $post_status = 'publish' ) {
616
+
617
+        return $this->relation_service->get_objects( $id, 'ids', null, $post_status );
618
+    }
619
+
620
+    /**
621
+     * Get the list of entities.
622
+     *
623
+     * @param array $params Custom parameters for WordPress' own {@link get_posts} function.
624
+     *
625
+     * @return array An array of entity posts.
626
+     * @since 3.12.2
627
+     *
628
+     */
629
+    public function get( $params = array() ) {
630
+
631
+        // Set the defaults.
632
+        $defaults = array( 'post_type' => 'entity' );
633
+
634
+        // Merge the defaults with the provided parameters.
635
+        $args = wp_parse_args( $params, $defaults );
636
+
637
+        // Call the `get_posts` function.
638
+        return get_posts( $args );
639
+    }
640
+
641
+    /**
642
+     * The list of post type names which can be used for entities
643
+     *
644
+     * Criteria is that the post type is public. The list of valid post types
645
+     * can be overridden with a filter.
646
+     *
647
+     * @return array Array containing the names of the valid post types.
648
+     * @since 3.15.0
649
+     *
650
+     */
651
+    static function valid_entity_post_types() {
652
+
653
+        // Ignore builtins in the call to avoid getting attachments.
654
+        $post_types = array( 'post', 'page', self::TYPE_NAME, 'product' );
655
+
656
+        return apply_filters( 'wl_valid_entity_post_types', $post_types );
657
+    }
658 658
 
659 659
 }
Please login to merge, or discard this patch.
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 	 * @since 3.2.0
100 100
 	 *
101 101
 	 */
102
-	public function __construct( $ui_service, $relation_service, $entity_uri_service ) {
102
+	public function __construct($ui_service, $relation_service, $entity_uri_service) {
103 103
 
104
-		$this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' );
104
+		$this->log = Wordlift_Log_Service::get_logger('Wordlift_Entity_Service');
105 105
 
106 106
 		$this->ui_service         = $ui_service;
107 107
 		$this->relation_service   = $relation_service;
@@ -132,17 +132,17 @@  discard block
 block discarded – undo
132 132
 	 * @since 3.1.0
133 133
 	 *
134 134
 	 */
135
-	public function is_entity( $post_id ) {
135
+	public function is_entity($post_id) {
136 136
 
137
-		$terms = wp_get_object_terms( $post_id, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
137
+		$terms = wp_get_object_terms($post_id, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME);
138 138
 
139
-		if ( is_wp_error( $terms ) ) {
140
-			$this->log->error( "Cannot get the terms for post $post_id: " . $terms->get_error_message() );
139
+		if (is_wp_error($terms)) {
140
+			$this->log->error("Cannot get the terms for post $post_id: ".$terms->get_error_message());
141 141
 
142 142
 			return false;
143 143
 		}
144 144
 
145
-		if ( empty( $terms ) ) {
145
+		if (empty($terms)) {
146 146
 			return false;
147 147
 		}
148 148
 
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 		 *
154 154
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
155 155
 		 */
156
-		foreach ( $terms as $term ) {
157
-			if ( 1 !== preg_match( '~(^|-)article$~', $term->slug ) ) {
156
+		foreach ($terms as $term) {
157
+			if (1 !== preg_match('~(^|-)article$~', $term->slug)) {
158 158
 				return true;
159 159
 			}
160 160
 		}
@@ -174,19 +174,19 @@  discard block
 block discarded – undo
174 174
 	 * @since 3.5.0
175 175
 	 *
176 176
 	 */
177
-	public function get_classification_scope_for( $post_id, $default = WL_WHAT_RELATION ) {
177
+	public function get_classification_scope_for($post_id, $default = WL_WHAT_RELATION) {
178 178
 
179
-		if ( false === $this->is_entity( $post_id ) ) {
179
+		if (false === $this->is_entity($post_id)) {
180 180
 			return $default;
181 181
 		}
182 182
 
183 183
 		// Retrieve the entity type
184
-		$entity_type_arr = Wordlift_Entity_Type_Service::get_instance()->get( $post_id );
185
-		$entity_type     = str_replace( 'wl-', '', $entity_type_arr['css_class'] );
184
+		$entity_type_arr = Wordlift_Entity_Type_Service::get_instance()->get($post_id);
185
+		$entity_type     = str_replace('wl-', '', $entity_type_arr['css_class']);
186 186
 		// Retrieve classification boxes configuration
187
-		$classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES );
188
-		foreach ( $classification_boxes as $cb ) {
189
-			if ( in_array( $entity_type, $cb['registeredTypes'] ) ) {
187
+		$classification_boxes = unserialize(WL_CORE_POST_CLASSIFICATION_BOXES);
188
+		foreach ($classification_boxes as $cb) {
189
+			if (in_array($entity_type, $cb['registeredTypes'])) {
190 190
 				return $cb['id'];
191 191
 			}
192 192
 		}
@@ -201,13 +201,13 @@  discard block
 block discarded – undo
201 201
 	 *
202 202
 	 * @return bool|null Null if it's not an entity, otherwise true if it's used.
203 203
 	 */
204
-	public function is_used( $post_id ) {
204
+	public function is_used($post_id) {
205 205
 
206
-		if ( false === $this->is_entity( $post_id ) ) {
206
+		if (false === $this->is_entity($post_id)) {
207 207
 			return null;
208 208
 		}
209 209
 		// Retrieve the post
210
-		$entity = get_post( $post_id );
210
+		$entity = get_post($post_id);
211 211
 
212 212
 		global $wpdb;
213 213
 		// Retrieve Wordlift relation instances table name
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
 		);
221 221
 
222 222
 		// Perform the query
223
-		$relation_instances = (int) $wpdb->get_var( $stmt );
223
+		$relation_instances = (int) $wpdb->get_var($stmt);
224 224
 		// If there is at least one relation instance for the current entity, then it's used
225
-		if ( 0 < $relation_instances ) {
225
+		if (0 < $relation_instances) {
226 226
 			return true;
227 227
 		}
228 228
 
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
 		$stmt = $wpdb->prepare(
231 231
 			"SELECT COUNT(*) FROM $wpdb->postmeta WHERE post_id != %d AND meta_value = %s",
232 232
 			$entity->ID,
233
-			wl_get_entity_uri( $entity->ID )
233
+			wl_get_entity_uri($entity->ID)
234 234
 		);
235 235
 		// Perform the query
236
-		$meta_instances = (int) $wpdb->get_var( $stmt );
236
+		$meta_instances = (int) $wpdb->get_var($stmt);
237 237
 
238 238
 		// If there is at least one meta that refers the current entity uri, then current entity is used
239
-		if ( 0 < $meta_instances ) {
239
+		if (0 < $meta_instances) {
240 240
 			return true;
241 241
 		}
242 242
 
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
 	 * @since      3.2.0
257 257
 	 *
258 258
 	 */
259
-	public function get_entity_post_by_uri( $uri ) {
259
+	public function get_entity_post_by_uri($uri) {
260 260
 
261
-		return $this->entity_uri_service->get_entity( $uri );
261
+		return $this->entity_uri_service->get_entity($uri);
262 262
 	}
263 263
 
264 264
 	/**
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
 	 * @param WP_Post $post Post object.
274 274
 	 * @param bool $update Whether this is an existing post being updated or not.
275 275
 	 */
276
-	public function save_post( $post_id, $post, $update ) {
276
+	public function save_post($post_id, $post, $update) {
277 277
 
278 278
 		// Avoid doing anything if post is autosave or a revision.
279
-		if ( wp_is_post_autosave( $post ) || wp_is_post_revision( $post ) ) {
279
+		if (wp_is_post_autosave($post) || wp_is_post_revision($post)) {
280 280
 			return;
281 281
 		}
282 282
 
@@ -286,16 +286,16 @@  discard block
 block discarded – undo
286 286
 		// the $post_id in the save_post call matches the post id set in the request.
287 287
 		//
288 288
 		// If this is not the current post being saved or if it's not an entity, return.
289
-		if ( ! isset( $_REQUEST['post_ID'] ) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity( $post_id ) ) {
289
+		if ( ! isset($_REQUEST['post_ID']) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity($post_id)) {
290 290
 			return;
291 291
 		}
292 292
 
293 293
 		// Get the alt labels from the request (or empty array).
294
-		$alt_labels = isset( $_REQUEST['wl_alternative_label'] ) ? (array) $_REQUEST['wl_alternative_label'] : array();
294
+		$alt_labels = isset($_REQUEST['wl_alternative_label']) ? (array) $_REQUEST['wl_alternative_label'] : array();
295 295
 
296
-		if ( ( ! empty( $_POST['content'] ) && ! empty( $_POST['post_content'] ) ) || isset( $_REQUEST['wl_alternative_label'] ) ) {
296
+		if (( ! empty($_POST['content']) && ! empty($_POST['post_content'])) || isset($_REQUEST['wl_alternative_label'])) {
297 297
 			// This is via classic editor, so set the alternative labels.
298
-			$this->set_alternative_labels( $post_id, $alt_labels );
298
+			$this->set_alternative_labels($post_id, $alt_labels);
299 299
 		}
300 300
 
301 301
 
@@ -310,33 +310,33 @@  discard block
 block discarded – undo
310 310
 	 * @since 3.2.0
311 311
 	 *
312 312
 	 */
313
-	public function set_alternative_labels( $post_id, $alt_labels ) {
313
+	public function set_alternative_labels($post_id, $alt_labels) {
314 314
 
315 315
 		// Bail out if post id is not numeric. We add this check as we found a WP install that was sending a WP_Error
316 316
 		// instead of post id.
317
-		if ( ! is_numeric( $post_id ) ) {
317
+		if ( ! is_numeric($post_id)) {
318 318
 			return;
319 319
 		}
320 320
 
321 321
 		// Force $alt_labels to be an array
322
-		if ( ! is_array( $alt_labels ) ) {
323
-			$alt_labels = array( $alt_labels );
322
+		if ( ! is_array($alt_labels)) {
323
+			$alt_labels = array($alt_labels);
324 324
 		}
325 325
 
326
-		$this->log->debug( "Setting alternative labels [ post id :: $post_id ][ alt labels :: " . implode( ',', $alt_labels ) . " ]" );
326
+		$this->log->debug("Setting alternative labels [ post id :: $post_id ][ alt labels :: ".implode(',', $alt_labels)." ]");
327 327
 
328 328
 		// Delete all the existing alternate labels.
329
-		delete_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
329
+		delete_post_meta($post_id, self::ALTERNATIVE_LABEL_META_KEY);
330 330
 
331 331
 		// Set the alternative labels.
332
-		foreach ( $alt_labels as $alt_label ) {
332
+		foreach ($alt_labels as $alt_label) {
333 333
 
334
-			if ( ! preg_match('/^[\w\-, ]+$/', $alt_label )  ) {
334
+			if ( ! preg_match('/^[\w\-, ]+$/', $alt_label)) {
335 335
 				continue;
336 336
 			}
337 337
 
338
-			if ( ! empty( $alt_label ) ) {
339
-				add_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY, (string) $alt_label );
338
+			if ( ! empty($alt_label)) {
339
+				add_post_meta($post_id, self::ALTERNATIVE_LABEL_META_KEY, (string) $alt_label);
340 340
 			}
341 341
 		}
342 342
 
@@ -351,9 +351,9 @@  discard block
 block discarded – undo
351 351
 	 * @since 3.2.0
352 352
 	 *
353 353
 	 */
354
-	public function get_alternative_labels( $post_id ) {
354
+	public function get_alternative_labels($post_id) {
355 355
 
356
-		return get_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
356
+		return get_post_meta($post_id, self::ALTERNATIVE_LABEL_META_KEY);
357 357
 	}
358 358
 
359 359
 	/**
@@ -365,9 +365,9 @@  discard block
 block discarded – undo
365 365
 	 * @return array An array with the entity title and labels.
366 366
 	 * @since 3.12.0
367 367
 	 */
368
-	public function get_labels( $post_id, $object_type = Object_Type_Enum::POST ) {
369
-		if ( $object_type === Object_Type_Enum::POST ) {
370
-			return array_merge( (array) get_the_title( $post_id ), $this->get_alternative_labels( $post_id ) );
368
+	public function get_labels($post_id, $object_type = Object_Type_Enum::POST) {
369
+		if ($object_type === Object_Type_Enum::POST) {
370
+			return array_merge((array) get_the_title($post_id), $this->get_alternative_labels($post_id));
371 371
 		}
372 372
 		// Term Reference dont have synonyms yet.
373 373
 		return array();
@@ -381,30 +381,30 @@  discard block
 block discarded – undo
381 381
 	 * @since 3.2.0
382 382
 	 *
383 383
 	 */
384
-	public function edit_form_before_permalink( $post ) {
384
+	public function edit_form_before_permalink($post) {
385 385
 
386 386
 		// If it's not an entity, return.
387
-		if ( ! $this->is_entity( $post->ID ) ) {
387
+		if ( ! $this->is_entity($post->ID)) {
388 388
 			return;
389 389
 		}
390 390
 
391 391
 		// If disabled by filter, return.
392
-		if ( ! apply_filters( 'wl_feature__enable__add-synonyms', true ) ) {
392
+		if ( ! apply_filters('wl_feature__enable__add-synonyms', true)) {
393 393
 			return;
394 394
 		}
395 395
 
396 396
 		// Print the input template.
397
-		$this->ui_service->print_template( 'wl-tmpl-alternative-label-input', $this->get_alternative_label_input() );
397
+		$this->ui_service->print_template('wl-tmpl-alternative-label-input', $this->get_alternative_label_input());
398 398
 
399 399
 		// Print all the currently set alternative labels.
400
-		foreach ( $this->get_alternative_labels( $post->ID ) as $alt_label ) {
400
+		foreach ($this->get_alternative_labels($post->ID) as $alt_label) {
401 401
 
402
-			echo $this->get_alternative_label_input( $alt_label );
402
+			echo $this->get_alternative_label_input($alt_label);
403 403
 
404 404
 		};
405 405
 
406 406
 		// Print the button.
407
-		$this->ui_service->print_button( 'wl-add-alternative-labels-button', __( 'Add more titles', 'wordlift' ) );
407
+		$this->ui_service->print_button('wl-add-alternative-labels-button', __('Add more titles', 'wordlift'));
408 408
 
409 409
 	}
410 410
 
@@ -417,57 +417,57 @@  discard block
 block discarded – undo
417 417
 	 * @since 3.6.0
418 418
 	 *
419 419
 	 */
420
-	private function get_uri_for_post( $post_id ) {
420
+	private function get_uri_for_post($post_id) {
421 421
 
422
-		$log = Wordlift_Log_Service::get_logger( get_class() );
422
+		$log = Wordlift_Log_Service::get_logger(get_class());
423 423
 
424 424
 		// If a null is given, nothing to do
425
-		if ( is_null( $post_id ) ) {
425
+		if (is_null($post_id)) {
426 426
 			return null;
427 427
 		}
428 428
 
429 429
 		$dataset_uri = wl_configuration_get_redlink_dataset_uri();
430 430
 
431
-		if ( empty( $dataset_uri ) ) {
431
+		if (empty($dataset_uri)) {
432 432
 			// Continue even if the dataset uri is not properly configured. It is handled in function wl_build_entity_uri()
433
-			$log->debug( 'Continuing, dataset uri not configured...' );
433
+			$log->debug('Continuing, dataset uri not configured...');
434 434
 		}
435 435
 
436
-		$uri = get_post_meta( $post_id, WL_ENTITY_URL_META_NAME, true );
436
+		$uri = get_post_meta($post_id, WL_ENTITY_URL_META_NAME, true);
437 437
 
438 438
 		/*
439 439
 		 * Consider the URI invalid if it doesn't start with the dataset URI.
440 440
 		 *
441 441
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/996
442 442
 		 */
443
-		if ( empty( $dataset_uri ) || 0 !== strpos( $uri, $dataset_uri ) ) {
443
+		if (empty($dataset_uri) || 0 !== strpos($uri, $dataset_uri)) {
444 444
 			$uri = null;
445 445
 		}
446 446
 
447 447
 		// Set the URI if it isn't set yet.
448
-		$post_status = get_post_status( $post_id );
449
-		if ( empty( $uri ) && 'auto-draft' !== $post_status && 'inherit' !== $post_status ) {
450
-			$uri = wl_build_entity_uri( $post_id );
451
-			wl_set_entity_uri( $post_id, $uri );
448
+		$post_status = get_post_status($post_id);
449
+		if (empty($uri) && 'auto-draft' !== $post_status && 'inherit' !== $post_status) {
450
+			$uri = wl_build_entity_uri($post_id);
451
+			wl_set_entity_uri($post_id, $uri);
452 452
 		}
453 453
 
454 454
 		return $uri;
455 455
 	}
456 456
 
457
-	public function get_uri( $object_id, $type = Object_Type_Enum::POST ) {
457
+	public function get_uri($object_id, $type = Object_Type_Enum::POST) {
458 458
 
459
-		if ( Object_Type_Enum::POST === $type ) {
460
-			return $this->get_uri_for_post( $object_id );
459
+		if (Object_Type_Enum::POST === $type) {
460
+			return $this->get_uri_for_post($object_id);
461 461
 		}
462 462
 
463
-		if ( Object_Type_Enum::USER === $type ) {
464
-			$uri = Wordlift_User_Service::get_instance()->get_uri( $object_id );
463
+		if (Object_Type_Enum::USER === $type) {
464
+			$uri = Wordlift_User_Service::get_instance()->get_uri($object_id);
465 465
 
466
-			return ( false === $uri ? null : $uri );
466
+			return (false === $uri ? null : $uri);
467 467
 		}
468 468
 
469
-		if ( Object_Type_Enum::TERM === $type ) {
470
-			return wl_get_term_entity_uri( $object_id );
469
+		if (Object_Type_Enum::TERM === $type) {
470
+			return wl_get_term_entity_uri($object_id);
471 471
 		}
472 472
 
473 473
 		return null;
@@ -482,9 +482,9 @@  discard block
 block discarded – undo
482 482
 	 * @since 3.2.0
483 483
 	 *
484 484
 	 */
485
-	private function get_alternative_label_input( $value = '' ) {
485
+	private function get_alternative_label_input($value = '') {
486 486
 
487
-		return sprintf( self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr( $value ), __( 'Delete', 'wordlift' ) );
487
+		return sprintf(self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr($value), __('Delete', 'wordlift'));
488 488
 	}
489 489
 
490 490
 	/**
@@ -498,13 +498,13 @@  discard block
 block discarded – undo
498 498
 		global $wpdb;
499 499
 
500 500
 		// Try to get the count from the transient.
501
-		$count = get_transient( '_wl_entity_service__count' );
502
-		if ( false !== $count ) {
501
+		$count = get_transient('_wl_entity_service__count');
502
+		if (false !== $count) {
503 503
 			return $count;
504 504
 		}
505 505
 
506 506
 		// Query the count.
507
-		$count = $wpdb->get_var( $wpdb->prepare(
507
+		$count = $wpdb->get_var($wpdb->prepare(
508 508
 			"SELECT COUNT( DISTINCT( tr.object_id ) )"
509 509
 			. " FROM {$wpdb->term_relationships} tr"
510 510
 			. " INNER JOIN {$wpdb->term_taxonomy} tt"
@@ -513,10 +513,10 @@  discard block
 block discarded – undo
513 513
 			. "  ON t.term_id = tt.term_id AND t.name != %s",
514 514
 			Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
515 515
 			'article'
516
-		) );
516
+		));
517 517
 
518 518
 		// Store the count in cache.
519
-		set_transient( '_wl_entity_service__count', $count, 900 );
519
+		set_transient('_wl_entity_service__count', $count, 900);
520 520
 
521 521
 		return $count;
522 522
 	}
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 	 * @since 3.15.0
532 532
 	 *
533 533
 	 */
534
-	public static function add_criterias( $args ) {
534
+	public static function add_criterias($args) {
535 535
 
536 536
 		// Build an optimal tax-query.
537 537
 		$tax_query = array(
@@ -575,28 +575,28 @@  discard block
 block discarded – undo
575 575
 	 * @since 3.9.0
576 576
 	 *
577 577
 	 */
578
-	public function create( $name, $type_uri, $logo = null, $status = 'publish' ) {
578
+	public function create($name, $type_uri, $logo = null, $status = 'publish') {
579 579
 
580 580
 		// Create an entity for the publisher.
581
-		$post_id = @wp_insert_post( array(
581
+		$post_id = @wp_insert_post(array(
582 582
 			'post_type'    => self::TYPE_NAME,
583 583
 			'post_title'   => $name,
584 584
 			'post_status'  => $status,
585 585
 			'post_content' => '',
586
-		) );
586
+		));
587 587
 
588 588
 		// Return the error if any.
589
-		if ( is_wp_error( $post_id ) ) {
589
+		if (is_wp_error($post_id)) {
590 590
 			return $post_id;
591 591
 		}
592 592
 
593 593
 		// Set the entity logo.
594
-		if ( $logo && is_numeric( $logo ) ) {
595
-			set_post_thumbnail( $post_id, $logo );
594
+		if ($logo && is_numeric($logo)) {
595
+			set_post_thumbnail($post_id, $logo);
596 596
 		}
597 597
 
598 598
 		// Set the entity type.
599
-		Wordlift_Entity_Type_Service::get_instance()->set( $post_id, $type_uri );
599
+		Wordlift_Entity_Type_Service::get_instance()->set($post_id, $type_uri);
600 600
 
601 601
 		return $post_id;
602 602
 	}
@@ -612,9 +612,9 @@  discard block
 block discarded – undo
612 612
 	 * @since 3.10.0
613 613
 	 *
614 614
 	 */
615
-	public function get_related_entities( $id, $post_status = 'publish' ) {
615
+	public function get_related_entities($id, $post_status = 'publish') {
616 616
 
617
-		return $this->relation_service->get_objects( $id, 'ids', null, $post_status );
617
+		return $this->relation_service->get_objects($id, 'ids', null, $post_status);
618 618
 	}
619 619
 
620 620
 	/**
@@ -626,16 +626,16 @@  discard block
 block discarded – undo
626 626
 	 * @since 3.12.2
627 627
 	 *
628 628
 	 */
629
-	public function get( $params = array() ) {
629
+	public function get($params = array()) {
630 630
 
631 631
 		// Set the defaults.
632
-		$defaults = array( 'post_type' => 'entity' );
632
+		$defaults = array('post_type' => 'entity');
633 633
 
634 634
 		// Merge the defaults with the provided parameters.
635
-		$args = wp_parse_args( $params, $defaults );
635
+		$args = wp_parse_args($params, $defaults);
636 636
 
637 637
 		// Call the `get_posts` function.
638
-		return get_posts( $args );
638
+		return get_posts($args);
639 639
 	}
640 640
 
641 641
 	/**
@@ -651,9 +651,9 @@  discard block
 block discarded – undo
651 651
 	static function valid_entity_post_types() {
652 652
 
653 653
 		// Ignore builtins in the call to avoid getting attachments.
654
-		$post_types = array( 'post', 'page', self::TYPE_NAME, 'product' );
654
+		$post_types = array('post', 'page', self::TYPE_NAME, 'product');
655 655
 
656
-		return apply_filters( 'wl_valid_entity_post_types', $post_types );
656
+		return apply_filters('wl_valid_entity_post_types', $post_types);
657 657
 	}
658 658
 
659 659
 }
Please login to merge, or discard this patch.
src/admin/partials/admin-setup/step-5.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -9,29 +9,29 @@
 block discarded – undo
9 9
     </p>
10 10
 
11 11
 	<?php
12
-	// Get WP's locale.
13
-	$locale = get_locale();
12
+    // Get WP's locale.
13
+    $locale = get_locale();
14 14
 
15
-	// Get the language locale part.
16
-	$parts    = explode( '_', $locale );
17
-	$language = isset( $parts[0] ) ? $parts[0] : '';
18
-	$country  = isset( $parts[1] ) ? strtolower( $parts[1] ) : '';
19
-	?>
15
+    // Get the language locale part.
16
+    $parts    = explode( '_', $locale );
17
+    $language = isset( $parts[0] ) ? $parts[0] : '';
18
+    $country  = isset( $parts[1] ) ? strtolower( $parts[1] ) : '';
19
+    ?>
20 20
 
21 21
     <br>
22 22
 
23 23
 	<?php
24
-	// Render country select element.
25
-	$country_select->render(
26
-		array(
27
-			'id'     => 'wl-country-code',
28
-			'name'   => 'wl-country-code',
29
-			'lang'   => $language,
30
-			'value'  => $country,
31
-			'notice' => __( 'The selected language is not supported in this country.</br>Please choose another country or language.', 'wordlift' ),
32
-		)
33
-	);
34
-	?>
24
+    // Render country select element.
25
+    $country_select->render(
26
+        array(
27
+            'id'     => 'wl-country-code',
28
+            'name'   => 'wl-country-code',
29
+            'lang'   => $language,
30
+            'value'  => $country,
31
+            'notice' => __( 'The selected language is not supported in this country.</br>Please choose another country or language.', 'wordlift' ),
32
+        )
33
+    );
34
+    ?>
35 35
 
36 36
     <div class="btn-wrapper">
37 37
         <input
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <!-- Pane 5 content -->
2 2
 <script type="text/html" id="page-4">
3 3
     <h2 class="page-title">
4
-		<?php esc_html_e( 'Country', 'wordlift' ); ?>
4
+		<?php esc_html_e('Country', 'wordlift'); ?>
5 5
     </h2>
6 6
 
7 7
     <p class="page-txt">
8
-		<?php esc_html_e( 'Each WordLift key can be used only in one language.', 'wordlift' ); ?>
8
+		<?php esc_html_e('Each WordLift key can be used only in one language.', 'wordlift'); ?>
9 9
     </p>
10 10
 
11 11
 	<?php
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
 	$locale = get_locale();
14 14
 
15 15
 	// Get the language locale part.
16
-	$parts    = explode( '_', $locale );
17
-	$language = isset( $parts[0] ) ? $parts[0] : '';
18
-	$country  = isset( $parts[1] ) ? strtolower( $parts[1] ) : '';
16
+	$parts    = explode('_', $locale);
17
+	$language = isset($parts[0]) ? $parts[0] : '';
18
+	$country  = isset($parts[1]) ? strtolower($parts[1]) : '';
19 19
 	?>
20 20
 
21 21
     <br>
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 			'name'   => 'wl-country-code',
29 29
 			'lang'   => $language,
30 30
 			'value'  => $country,
31
-			'notice' => __( 'The selected language is not supported in this country.</br>Please choose another country or language.', 'wordlift' ),
31
+			'notice' => __('The selected language is not supported in this country.</br>Please choose another country or language.', 'wordlift'),
32 32
 		)
33 33
 	);
34 34
 	?>
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
                 type="button"
39 39
                 data-wl-next="wl-next"
40 40
                 class="wl-default-action"
41
-                value="<?php esc_attr_e( 'Next', 'wordlift' ); ?>"
41
+                value="<?php esc_attr_e('Next', 'wordlift'); ?>"
42 42
         >
43 43
     </div>
44 44
 </script>
Please login to merge, or discard this patch.
src/admin/class-wordlift-admin-settings-page.php 2 patches
Indentation   +431 added lines, -431 removed lines patch added patch discarded remove patch
@@ -18,436 +18,436 @@
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Admin_Settings_Page extends Wordlift_Admin_Page {
20 20
 
21
-	/**
22
-	 * A singleton instance of the Notice service.
23
-	 *
24
-	 * @since  3.2.0
25
-	 * @access private
26
-	 * @var \Wordlift_Notice_Service $instance A singleton instance of the Notice service.
27
-	 */
28
-	private static $instance;
29
-
30
-	/**
31
-	 * A {@link Wordlift_Entity_Service} instance.
32
-	 *
33
-	 * @since  3.11.0
34
-	 * @access private
35
-	 * @var \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance.
36
-	 */
37
-	private $entity_service;
38
-
39
-	/**
40
-	 * A {@link Wordlift_Configuration_Service} instance.
41
-	 *
42
-	 * @since  3.11.0
43
-	 * @access private
44
-	 * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
45
-	 */
46
-	private $configuration_service;
47
-
48
-	/**
49
-	 * A {@link Wordlift_Admin_Input_Element} element renderer.
50
-	 *
51
-	 * @since  3.11.0
52
-	 * @access private
53
-	 * @var \Wordlift_Admin_Input_Element $input_element An {@link Wordlift_Admin_Input_Element} element renderer.
54
-	 */
55
-	private $input_element;
56
-
57
-	/**
58
-	 * A {@link Wordlift_Admin_Radio_Input_Element} element renderer.
59
-	 *
60
-	 * @since  3.13.0
61
-	 * @access protected
62
-	 * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element A {@link Wordlift_Admin_Radio_Input_Element} element renderer.
63
-	 */
64
-	private $radio_input_element;
65
-
66
-	/**
67
-	 * A {@link Wordlift_Admin_Language_Select_Element} element renderer.
68
-	 *
69
-	 * @since  3.11.0
70
-	 * @access private
71
-	 * @var \Wordlift_Admin_Language_Select_Element $language_select_element A {@link Wordlift_Admin_Language_Select_Element} element renderer.
72
-	 */
73
-	private $language_select_element;
74
-
75
-	/**
76
-	 * A {@link Wordlift_Admin_Country_Select_Element} element renderer.
77
-	 *
78
-	 * @since  3.18.0
79
-	 * @access private
80
-	 * @var \Wordlift_Admin_Country_Select_Element $country_select_element A {@link Wordlift_Admin_Country_Select_Element} element renderer.
81
-	 */
82
-	private $country_select_element;
83
-
84
-	/**
85
-	 * A {@link Wordlift_Admin_Publisher_Element} element renderer.
86
-	 *
87
-	 * @since  3.11.0
88
-	 * @access private
89
-	 * @var \Wordlift_Admin_Publisher_Element $publisher_element A {@link Wordlift_Admin_Publisher_Element} element renderer.
90
-	 */
91
-	private $publisher_element;
92
-
93
-	/**
94
-	 * Create a {@link Wordlift_Admin_Settings_Page} instance.
95
-	 *
96
-	 * @param \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
97
-	 * @param \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance.
98
-	 * @param \Wordlift_Admin_Input_Element $input_element A {@link Wordlift_Admin_Input_Element} element renderer.
99
-	 * @param \Wordlift_Admin_Language_Select_Element $language_select_element A {@link Wordlift_Admin_Language_Select_Element} element renderer.
100
-	 * @param \Wordlift_Admin_Country_Select_Element $country_select_element A {@link Wordlift_Admin_Country_Select_Element} element renderer.
101
-	 * @param \Wordlift_Admin_Publisher_Element $publisher_element A {@link Wordlift_Admin_Publisher_Element} element renderer.
102
-	 * @param \Wordlift_Admin_Radio_Input_Element $radio_input_element A {@link Wordlift_Admin_Radio_Input_Element} element renderer.
103
-	 *
104
-	 * @since 3.11.0
105
-	 *
106
-	 */
107
-	function __construct( $configuration_service, $entity_service, $input_element, $language_select_element, $country_select_element, $publisher_element, $radio_input_element ) {
108
-
109
-		$this->configuration_service = $configuration_service;
110
-		$this->entity_service        = $entity_service;
111
-
112
-		// Set a reference to the UI elements.
113
-		$this->input_element           = $input_element;
114
-		$this->radio_input_element     = $radio_input_element;
115
-		$this->language_select_element = $language_select_element;
116
-		$this->country_select_element  = $country_select_element;
117
-		$this->publisher_element       = $publisher_element;
118
-
119
-		self::$instance = $this;
120
-
121
-	}
122
-
123
-	/**
124
-	 * Get the singleton instance of the Notice service.
125
-	 *
126
-	 * @return \Wordlift_Admin_Settings_Page The singleton instance of the settings page service.
127
-	 * @since 3.14.0
128
-	 */
129
-	public static function get_instance() {
130
-
131
-		return self::$instance;
132
-	}
133
-
134
-	/**
135
-	 * @inheritdoc
136
-	 */
137
-	function get_parent_slug() {
138
-
139
-		return 'wl_admin_menu';
140
-	}
141
-
142
-	/**
143
-	 * @inheritdoc
144
-	 */
145
-	function get_capability() {
146
-
147
-		return 'manage_options';
148
-	}
149
-
150
-	/**
151
-	 * @inheritdoc
152
-	 */
153
-	function get_page_title() {
154
-
155
-		return 'WordLift Settings';
156
-	}
157
-
158
-	/**
159
-	 * @inheritdoc
160
-	 */
161
-	function get_menu_title() {
162
-
163
-		return 'Settings';
164
-	}
165
-
166
-	/**
167
-	 * @inheritdoc
168
-	 */
169
-	function get_menu_slug() {
170
-
171
-		return 'wl_configuration_admin_menu';
172
-	}
173
-
174
-	/**
175
-	 * @inheritdoc
176
-	 */
177
-	function get_partial_name() {
178
-
179
-		return 'wordlift-admin-settings-page.php';
180
-	}
181
-
182
-	/**
183
-	 * @inheritdoc
184
-	 */
185
-	public function enqueue_scripts() {
186
-
187
-		// Enqueue the media scripts to be used for the publisher's logo selection.
188
-		wp_enqueue_media();
189
-
190
-		// JavaScript required for the settings page.
191
-		// @todo: try to move to the `wordlift-admin.bundle.js`.
192
-		wp_enqueue_script( 'wordlift-admin-settings-page', plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/1/settings.js', array( 'wp-util' ) );
193
-		wp_enqueue_style( 'wordlift-admin-settings-page', plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/1/settings.css' );
194
-
195
-	}
196
-
197
-	/**
198
-	 * Configure all the configuration parameters.
199
-	 *
200
-	 * Called by the *admin_init* hook.
201
-	 *
202
-	 * @since 3.11.0
203
-	 */
204
-	function admin_init() {
205
-		// Register WordLift's general settings, providing our own sanitize callback
206
-		// which will also check whether the user filled the WL Publisher form.
207
-		register_setting(
208
-			'wl_general_settings',
209
-			'wl_general_settings',
210
-			array( $this, 'sanitize_callback' )
211
-		);
212
-
213
-		// Add the general settings section.
214
-		add_settings_section(
215
-			'wl_general_settings_section', // ID used to identify this section and with which to register options.
216
-			'',                            // Section header.
217
-			'',                            // Callback used to render the description of the section.
218
-			'wl_general_settings'          // Page on which to add this section of options.
219
-		);
220
-
221
-		$key_args = array(
222
-			'id'          => 'wl-key',
223
-			'name'        => 'wl_general_settings[' . Wordlift_Configuration_Service::KEY . ']',
224
-			'value'       => $this->configuration_service->get_key(),
225
-			'description' => __( 'Insert the <a href="https://www.wordlift.io/blogger">WordLift Key</a> you received via email.', 'wordlift' )
226
-			                 . ' [' . get_option( 'home' ) . ']',
227
-		);
228
-
229
-		// Before we were used to validate the key beforehand, but this means
230
-		// an http call whenever a page is opened in the admin area. Therefore
231
-		// we now leave the input `untouched`, leaving to the client to update
232
-		// the `css_class`.
233
-		//
234
-		// See https://github.com/insideout10/wordlift-plugin/issues/669.
235
-		$key_args['css_class'] = 'untouched';
236
-
237
-		// Add the `key` field.
238
-		add_settings_field(
239
-			'wl-key',                                       // Element id used to identify the field throughout the theme.
240
-			__( 'WordLift Key', 'wordlift' ),               // The label to the left of the option interface element.
241
-			// The name of the function responsible for rendering the option interface.
242
-			array( $this->input_element, 'render' ),
243
-			'wl_general_settings',                          // The page on which this option will be displayed.
244
-			'wl_general_settings_section',                  // The name of the section to which this field belongs.
245
-			$key_args                                       // The array of arguments to pass to the callback. In this case, just a description.
246
-		);
247
-
248
-		// Entity Base Path input.
249
-		$entity_base_path_args = array(
250
-			// The array of arguments to pass to the callback. In this case, just a description.
251
-			'id'          => 'wl-entity-base-path',
252
-			'name'        => 'wl_general_settings[' . Wordlift_Configuration_Service::ENTITY_BASE_PATH_KEY . ']',
253
-			'value'       => $this->configuration_service->get_entity_base_path(),
254
-			/* translators: Placeholders: %s - a link to FAQ's page. */
255
-			'description' => sprintf( __( 'All new pages created with WordLift, will be stored inside your internal vocabulary. You can customize the url pattern of these pages in the field above. Check our <a href="%s">FAQs</a> if you need more info.', 'wordlift' ), 'https://wordlift.io/wordlift-user-faqs/#10-why-and-how-should-i-customize-the-url-of-the-entity-pages-created-in-my-vocabulary' ),
256
-		);
257
-
258
-		// The following call is very heavy on large web sites and is always run
259
-		// also when not needed:
260
-		// $entity_base_path_args['readonly'] = 0 < $this->entity_service->count();
261
-		//
262
-		// It is now replaced by a filter to add the `readonly` flag to the
263
-		// input element when this is actually rendered.
264
-		add_filter( 'wl_admin_input_element_params', array(
265
-			$this,
266
-			'entity_path_input_element_params',
267
-		) );
268
-
269
-		// Add the `wl_entity_base_path` field.
270
-		add_settings_field(
271
-			'wl-entity-base-path',                                // ID used to identify the field throughout the theme
272
-			__( 'Entity Base Path', 'wordlift' ),                 // The label to the left of the option interface element
273
-			// The name of the function responsible for rendering the option interface
274
-			array( $this->input_element, 'render', ),
275
-			'wl_general_settings',                                // The page on which this option will be displayed
276
-			'wl_general_settings_section',                        // The name of the section to which this field belongs
277
-			$entity_base_path_args
278
-		);
279
-
280
-
281
-		$language_name = Wordlift_Languages::get_language_name(
282
-			$this->configuration_service->get_language_code()
283
-		);
284
-
285
-		// Add the `language_name` field.
286
-		add_settings_field(
287
-			'wl-site-language',
288
-			__( 'Site Language', 'wordlift' ),
289
-			function () use ( $language_name ) {
290
-				echo sprintf( '<p><label>%s</label></p>', esc_html( $language_name ));
291
-				echo  sprintf( __( '<br/><p>WordLift uses the site language, You can change the language from <a href="%s">settings.</a></p>', 'wordlift' ),
292
-					admin_url('options-general.php#WPLANG')
293
-				);
294
-			},
295
-			'wl_general_settings',
296
-			'wl_general_settings_section'
297
-		);
298
-
299
-		// Add the `country_code` field.
300
-		add_settings_field(
301
-			'wl-country-code',
302
-			_x( 'Country', 'wordlift' ),
303
-			array( $this->country_select_element, 'render' ),
304
-			'wl_general_settings',
305
-			'wl_general_settings_section',
306
-			array(
307
-				'id'          => 'wl-country-code',
308
-				'name'        => 'wl_general_settings[' . Wordlift_Configuration_Service::COUNTRY_CODE . ']',
309
-				'value'       => $this->configuration_service->get_country_code(),
310
-				'description' => __( 'Please select a country.', 'wordlift' ),
311
-				'notice'      => __( 'The selected language is not supported in this country.</br>Please choose another country or language.', 'wordlift' ),
312
-			)
313
-		);
314
-
315
-		// Add the `publisher` field.
316
-		add_settings_field(
317
-			'wl-publisher-id',
318
-			__( 'Publisher', 'wordlift' ),
319
-			array( $this->publisher_element, 'render' ),
320
-			'wl_general_settings',
321
-			'wl_general_settings_section',
322
-			array(
323
-				'id'   => 'wl-publisher-id',
324
-				'name' => 'wl_general_settings[' . Wordlift_Configuration_Service::PUBLISHER_ID . ']',
325
-			)
326
-		);
327
-
328
-		// Add the `link by default` field.
329
-		add_settings_field(
330
-			'wl-link-by-default',
331
-			__( 'Link by Default', 'wordlift' ),
332
-			array( $this->radio_input_element, 'render' ),
333
-			'wl_general_settings',
334
-			'wl_general_settings_section',
335
-			array(
336
-				'id'          => 'wl-link-by-default',
337
-				'name'        => 'wl_general_settings[' . Wordlift_Configuration_Service::LINK_BY_DEFAULT . ']',
338
-				'value'       => $this->configuration_service->is_link_by_default() ? 'yes' : 'no',
339
-				'description' => __( 'Whether to link entities by default or not. This setting applies to all the entities.', 'wordlift' ),
340
-			)
341
-		);
342
-
343
-		// Add the `diagnostic data` field.
344
-		add_settings_field(
345
-			'wl-send-diagnostic',
346
-			__( 'Send Diagnostic Data', 'wordlift' ),
347
-			array( $this->radio_input_element, 'render' ),
348
-			'wl_general_settings',
349
-			'wl_general_settings_section',
350
-			array(
351
-				'id'          => 'wl-send-diagnostic',
352
-				'name'        => 'wl_general_settings[' . Wordlift_Configuration_Service::SEND_DIAGNOSTIC . ']',
353
-				'value'       => 'yes' === $this->configuration_service->get_diagnostic_preferences() ? 'yes' : 'no',
354
-				'description' => __( 'Whether to send diagnostic data or not.', 'wordlift' ),
355
-			)
356
-		);
357
-
358
-	}
359
-
360
-	/**
361
-	 * Filter the {@link Wordlift_Admin_Input_Element} in order to add the
362
-	 * `readonly` flag to the `wl-entity-base-path` input.
363
-	 *
364
-	 * @param array $args An array of {@link Wordlift_Admin_Input_Element} parameters.
365
-	 *
366
-	 * @return array The updated array.
367
-	 * @since 3.17.0
368
-	 *
369
-	 */
370
-	public function entity_path_input_element_params( $args ) {
371
-
372
-		// Bail out if it's not the `wl-entity-base-path`).
373
-		if ( 'wl-entity-base-path' !== $args['id'] ) {
374
-			return $args;
375
-		}
376
-
377
-		// Set the readonly flag according to the entities count.
378
-		$args['readonly'] = 0 < $this->entity_service->count();
379
-
380
-		// Return the updated args.
381
-		return $args;
382
-	}
383
-
384
-	/**
385
-	 * Sanitize the configuration settings to be stored.
386
-	 *
387
-	 * If a new entity is being created for the publisher, create it and set The
388
-	 * publisher setting.
389
-	 *
390
-	 * @param array $input The configuration settings array.
391
-	 *
392
-	 * @return array The sanitized input array.
393
-	 * @since 3.11.0
394
-	 *
395
-	 */
396
-	function sanitize_callback( $input ) {
397
-
398
-		// Validate the selected country.
399
-		$this->validate_country();
400
-
401
-		// Check whether a publisher name has been set.
402
-		if ( isset( $_POST['wl_publisher'] ) && ! empty( $_POST['wl_publisher']['name'] ) ) { // WPCS: CSRF, input var, sanitization ok.
403
-			$name         = isset( $_POST['wl_publisher']['name'] ) ? (string) $_POST['wl_publisher']['name'] : '';
404
-			$type         = isset( $_POST['wl_publisher']['type'] ) ? (string) $_POST['wl_publisher']['type'] : '';
405
-			$thumbnail_id = isset( $_POST['wl_publisher']['thumbnail_id'] ) ? $_POST['wl_publisher']['thumbnail_id'] : null; // WPCS: CSRF, input var, sanitization ok.
406
-
407
-			// Set the type URI, either http://schema.org/Person or http://schema.org/Organization.
408
-			$type_uri = sprintf( 'http://schema.org/%s', 'organization' === $type ? 'Organization' : 'Person' );
409
-
410
-			// Create an entity for the publisher and assign it to the input
411
-			// parameter which WordPress automatically saves into the settings.
412
-			$input['publisher_id'] = $this->entity_service->create( $name, $type_uri, $thumbnail_id, 'publish' );
413
-		}
414
-
415
-		return $input;
416
-	}
417
-
418
-	/**
419
-	 * Check whether the currently selected country supports the site language.
420
-	 *
421
-	 * @since 3.18.0
422
-	 */
423
-	private function validate_country() {
424
-
425
-		// Bail out if for some reason the country and language are not set.
426
-		if (
427
-			empty( $_POST['wl_general_settings']['site_language'] ) && // WPCS: CSRF, input var, sanitization ok.
428
-			empty( $_POST['wl_general_settings']['country_code'] ) // WPCS: CSRF, input var, sanitization ok.
429
-		) {
430
-			return;
431
-		}
432
-
433
-		// Get the values.
434
-		$language = $_POST['wl_general_settings']['site_language']; // WPCS: CSRF, input var, sanitization ok.
435
-		$country  = $_POST['wl_general_settings']['country_code']; // WPCS: CSRF, input var, sanitization ok.
436
-		$codes    = Wordlift_Countries::get_codes();
437
-
438
-		// Check whether the chosen country has language limitations
439
-		// and whether the chosen language is supported for that country.
440
-		if (
441
-			! empty( $codes[ $country ] ) &&
442
-			! in_array( $language, $codes[ $country ] )
443
-		) {
444
-			// Otherwise add an error.
445
-			add_settings_error(
446
-				'wl-country-code',
447
-				esc_attr( 'settings_updated' ),
448
-				_x( 'The selected language is not supported for the currently chosen country. Please choose another country or language.', 'wordlift' )
449
-			);
450
-		}
451
-	}
21
+    /**
22
+     * A singleton instance of the Notice service.
23
+     *
24
+     * @since  3.2.0
25
+     * @access private
26
+     * @var \Wordlift_Notice_Service $instance A singleton instance of the Notice service.
27
+     */
28
+    private static $instance;
29
+
30
+    /**
31
+     * A {@link Wordlift_Entity_Service} instance.
32
+     *
33
+     * @since  3.11.0
34
+     * @access private
35
+     * @var \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance.
36
+     */
37
+    private $entity_service;
38
+
39
+    /**
40
+     * A {@link Wordlift_Configuration_Service} instance.
41
+     *
42
+     * @since  3.11.0
43
+     * @access private
44
+     * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
45
+     */
46
+    private $configuration_service;
47
+
48
+    /**
49
+     * A {@link Wordlift_Admin_Input_Element} element renderer.
50
+     *
51
+     * @since  3.11.0
52
+     * @access private
53
+     * @var \Wordlift_Admin_Input_Element $input_element An {@link Wordlift_Admin_Input_Element} element renderer.
54
+     */
55
+    private $input_element;
56
+
57
+    /**
58
+     * A {@link Wordlift_Admin_Radio_Input_Element} element renderer.
59
+     *
60
+     * @since  3.13.0
61
+     * @access protected
62
+     * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element A {@link Wordlift_Admin_Radio_Input_Element} element renderer.
63
+     */
64
+    private $radio_input_element;
65
+
66
+    /**
67
+     * A {@link Wordlift_Admin_Language_Select_Element} element renderer.
68
+     *
69
+     * @since  3.11.0
70
+     * @access private
71
+     * @var \Wordlift_Admin_Language_Select_Element $language_select_element A {@link Wordlift_Admin_Language_Select_Element} element renderer.
72
+     */
73
+    private $language_select_element;
74
+
75
+    /**
76
+     * A {@link Wordlift_Admin_Country_Select_Element} element renderer.
77
+     *
78
+     * @since  3.18.0
79
+     * @access private
80
+     * @var \Wordlift_Admin_Country_Select_Element $country_select_element A {@link Wordlift_Admin_Country_Select_Element} element renderer.
81
+     */
82
+    private $country_select_element;
83
+
84
+    /**
85
+     * A {@link Wordlift_Admin_Publisher_Element} element renderer.
86
+     *
87
+     * @since  3.11.0
88
+     * @access private
89
+     * @var \Wordlift_Admin_Publisher_Element $publisher_element A {@link Wordlift_Admin_Publisher_Element} element renderer.
90
+     */
91
+    private $publisher_element;
92
+
93
+    /**
94
+     * Create a {@link Wordlift_Admin_Settings_Page} instance.
95
+     *
96
+     * @param \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
97
+     * @param \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance.
98
+     * @param \Wordlift_Admin_Input_Element $input_element A {@link Wordlift_Admin_Input_Element} element renderer.
99
+     * @param \Wordlift_Admin_Language_Select_Element $language_select_element A {@link Wordlift_Admin_Language_Select_Element} element renderer.
100
+     * @param \Wordlift_Admin_Country_Select_Element $country_select_element A {@link Wordlift_Admin_Country_Select_Element} element renderer.
101
+     * @param \Wordlift_Admin_Publisher_Element $publisher_element A {@link Wordlift_Admin_Publisher_Element} element renderer.
102
+     * @param \Wordlift_Admin_Radio_Input_Element $radio_input_element A {@link Wordlift_Admin_Radio_Input_Element} element renderer.
103
+     *
104
+     * @since 3.11.0
105
+     *
106
+     */
107
+    function __construct( $configuration_service, $entity_service, $input_element, $language_select_element, $country_select_element, $publisher_element, $radio_input_element ) {
108
+
109
+        $this->configuration_service = $configuration_service;
110
+        $this->entity_service        = $entity_service;
111
+
112
+        // Set a reference to the UI elements.
113
+        $this->input_element           = $input_element;
114
+        $this->radio_input_element     = $radio_input_element;
115
+        $this->language_select_element = $language_select_element;
116
+        $this->country_select_element  = $country_select_element;
117
+        $this->publisher_element       = $publisher_element;
118
+
119
+        self::$instance = $this;
120
+
121
+    }
122
+
123
+    /**
124
+     * Get the singleton instance of the Notice service.
125
+     *
126
+     * @return \Wordlift_Admin_Settings_Page The singleton instance of the settings page service.
127
+     * @since 3.14.0
128
+     */
129
+    public static function get_instance() {
130
+
131
+        return self::$instance;
132
+    }
133
+
134
+    /**
135
+     * @inheritdoc
136
+     */
137
+    function get_parent_slug() {
138
+
139
+        return 'wl_admin_menu';
140
+    }
141
+
142
+    /**
143
+     * @inheritdoc
144
+     */
145
+    function get_capability() {
146
+
147
+        return 'manage_options';
148
+    }
149
+
150
+    /**
151
+     * @inheritdoc
152
+     */
153
+    function get_page_title() {
154
+
155
+        return 'WordLift Settings';
156
+    }
157
+
158
+    /**
159
+     * @inheritdoc
160
+     */
161
+    function get_menu_title() {
162
+
163
+        return 'Settings';
164
+    }
165
+
166
+    /**
167
+     * @inheritdoc
168
+     */
169
+    function get_menu_slug() {
170
+
171
+        return 'wl_configuration_admin_menu';
172
+    }
173
+
174
+    /**
175
+     * @inheritdoc
176
+     */
177
+    function get_partial_name() {
178
+
179
+        return 'wordlift-admin-settings-page.php';
180
+    }
181
+
182
+    /**
183
+     * @inheritdoc
184
+     */
185
+    public function enqueue_scripts() {
186
+
187
+        // Enqueue the media scripts to be used for the publisher's logo selection.
188
+        wp_enqueue_media();
189
+
190
+        // JavaScript required for the settings page.
191
+        // @todo: try to move to the `wordlift-admin.bundle.js`.
192
+        wp_enqueue_script( 'wordlift-admin-settings-page', plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/1/settings.js', array( 'wp-util' ) );
193
+        wp_enqueue_style( 'wordlift-admin-settings-page', plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/1/settings.css' );
194
+
195
+    }
196
+
197
+    /**
198
+     * Configure all the configuration parameters.
199
+     *
200
+     * Called by the *admin_init* hook.
201
+     *
202
+     * @since 3.11.0
203
+     */
204
+    function admin_init() {
205
+        // Register WordLift's general settings, providing our own sanitize callback
206
+        // which will also check whether the user filled the WL Publisher form.
207
+        register_setting(
208
+            'wl_general_settings',
209
+            'wl_general_settings',
210
+            array( $this, 'sanitize_callback' )
211
+        );
212
+
213
+        // Add the general settings section.
214
+        add_settings_section(
215
+            'wl_general_settings_section', // ID used to identify this section and with which to register options.
216
+            '',                            // Section header.
217
+            '',                            // Callback used to render the description of the section.
218
+            'wl_general_settings'          // Page on which to add this section of options.
219
+        );
220
+
221
+        $key_args = array(
222
+            'id'          => 'wl-key',
223
+            'name'        => 'wl_general_settings[' . Wordlift_Configuration_Service::KEY . ']',
224
+            'value'       => $this->configuration_service->get_key(),
225
+            'description' => __( 'Insert the <a href="https://www.wordlift.io/blogger">WordLift Key</a> you received via email.', 'wordlift' )
226
+                                . ' [' . get_option( 'home' ) . ']',
227
+        );
228
+
229
+        // Before we were used to validate the key beforehand, but this means
230
+        // an http call whenever a page is opened in the admin area. Therefore
231
+        // we now leave the input `untouched`, leaving to the client to update
232
+        // the `css_class`.
233
+        //
234
+        // See https://github.com/insideout10/wordlift-plugin/issues/669.
235
+        $key_args['css_class'] = 'untouched';
236
+
237
+        // Add the `key` field.
238
+        add_settings_field(
239
+            'wl-key',                                       // Element id used to identify the field throughout the theme.
240
+            __( 'WordLift Key', 'wordlift' ),               // The label to the left of the option interface element.
241
+            // The name of the function responsible for rendering the option interface.
242
+            array( $this->input_element, 'render' ),
243
+            'wl_general_settings',                          // The page on which this option will be displayed.
244
+            'wl_general_settings_section',                  // The name of the section to which this field belongs.
245
+            $key_args                                       // The array of arguments to pass to the callback. In this case, just a description.
246
+        );
247
+
248
+        // Entity Base Path input.
249
+        $entity_base_path_args = array(
250
+            // The array of arguments to pass to the callback. In this case, just a description.
251
+            'id'          => 'wl-entity-base-path',
252
+            'name'        => 'wl_general_settings[' . Wordlift_Configuration_Service::ENTITY_BASE_PATH_KEY . ']',
253
+            'value'       => $this->configuration_service->get_entity_base_path(),
254
+            /* translators: Placeholders: %s - a link to FAQ's page. */
255
+            'description' => sprintf( __( 'All new pages created with WordLift, will be stored inside your internal vocabulary. You can customize the url pattern of these pages in the field above. Check our <a href="%s">FAQs</a> if you need more info.', 'wordlift' ), 'https://wordlift.io/wordlift-user-faqs/#10-why-and-how-should-i-customize-the-url-of-the-entity-pages-created-in-my-vocabulary' ),
256
+        );
257
+
258
+        // The following call is very heavy on large web sites and is always run
259
+        // also when not needed:
260
+        // $entity_base_path_args['readonly'] = 0 < $this->entity_service->count();
261
+        //
262
+        // It is now replaced by a filter to add the `readonly` flag to the
263
+        // input element when this is actually rendered.
264
+        add_filter( 'wl_admin_input_element_params', array(
265
+            $this,
266
+            'entity_path_input_element_params',
267
+        ) );
268
+
269
+        // Add the `wl_entity_base_path` field.
270
+        add_settings_field(
271
+            'wl-entity-base-path',                                // ID used to identify the field throughout the theme
272
+            __( 'Entity Base Path', 'wordlift' ),                 // The label to the left of the option interface element
273
+            // The name of the function responsible for rendering the option interface
274
+            array( $this->input_element, 'render', ),
275
+            'wl_general_settings',                                // The page on which this option will be displayed
276
+            'wl_general_settings_section',                        // The name of the section to which this field belongs
277
+            $entity_base_path_args
278
+        );
279
+
280
+
281
+        $language_name = Wordlift_Languages::get_language_name(
282
+            $this->configuration_service->get_language_code()
283
+        );
284
+
285
+        // Add the `language_name` field.
286
+        add_settings_field(
287
+            'wl-site-language',
288
+            __( 'Site Language', 'wordlift' ),
289
+            function () use ( $language_name ) {
290
+                echo sprintf( '<p><label>%s</label></p>', esc_html( $language_name ));
291
+                echo  sprintf( __( '<br/><p>WordLift uses the site language, You can change the language from <a href="%s">settings.</a></p>', 'wordlift' ),
292
+                    admin_url('options-general.php#WPLANG')
293
+                );
294
+            },
295
+            'wl_general_settings',
296
+            'wl_general_settings_section'
297
+        );
298
+
299
+        // Add the `country_code` field.
300
+        add_settings_field(
301
+            'wl-country-code',
302
+            _x( 'Country', 'wordlift' ),
303
+            array( $this->country_select_element, 'render' ),
304
+            'wl_general_settings',
305
+            'wl_general_settings_section',
306
+            array(
307
+                'id'          => 'wl-country-code',
308
+                'name'        => 'wl_general_settings[' . Wordlift_Configuration_Service::COUNTRY_CODE . ']',
309
+                'value'       => $this->configuration_service->get_country_code(),
310
+                'description' => __( 'Please select a country.', 'wordlift' ),
311
+                'notice'      => __( 'The selected language is not supported in this country.</br>Please choose another country or language.', 'wordlift' ),
312
+            )
313
+        );
314
+
315
+        // Add the `publisher` field.
316
+        add_settings_field(
317
+            'wl-publisher-id',
318
+            __( 'Publisher', 'wordlift' ),
319
+            array( $this->publisher_element, 'render' ),
320
+            'wl_general_settings',
321
+            'wl_general_settings_section',
322
+            array(
323
+                'id'   => 'wl-publisher-id',
324
+                'name' => 'wl_general_settings[' . Wordlift_Configuration_Service::PUBLISHER_ID . ']',
325
+            )
326
+        );
327
+
328
+        // Add the `link by default` field.
329
+        add_settings_field(
330
+            'wl-link-by-default',
331
+            __( 'Link by Default', 'wordlift' ),
332
+            array( $this->radio_input_element, 'render' ),
333
+            'wl_general_settings',
334
+            'wl_general_settings_section',
335
+            array(
336
+                'id'          => 'wl-link-by-default',
337
+                'name'        => 'wl_general_settings[' . Wordlift_Configuration_Service::LINK_BY_DEFAULT . ']',
338
+                'value'       => $this->configuration_service->is_link_by_default() ? 'yes' : 'no',
339
+                'description' => __( 'Whether to link entities by default or not. This setting applies to all the entities.', 'wordlift' ),
340
+            )
341
+        );
342
+
343
+        // Add the `diagnostic data` field.
344
+        add_settings_field(
345
+            'wl-send-diagnostic',
346
+            __( 'Send Diagnostic Data', 'wordlift' ),
347
+            array( $this->radio_input_element, 'render' ),
348
+            'wl_general_settings',
349
+            'wl_general_settings_section',
350
+            array(
351
+                'id'          => 'wl-send-diagnostic',
352
+                'name'        => 'wl_general_settings[' . Wordlift_Configuration_Service::SEND_DIAGNOSTIC . ']',
353
+                'value'       => 'yes' === $this->configuration_service->get_diagnostic_preferences() ? 'yes' : 'no',
354
+                'description' => __( 'Whether to send diagnostic data or not.', 'wordlift' ),
355
+            )
356
+        );
357
+
358
+    }
359
+
360
+    /**
361
+     * Filter the {@link Wordlift_Admin_Input_Element} in order to add the
362
+     * `readonly` flag to the `wl-entity-base-path` input.
363
+     *
364
+     * @param array $args An array of {@link Wordlift_Admin_Input_Element} parameters.
365
+     *
366
+     * @return array The updated array.
367
+     * @since 3.17.0
368
+     *
369
+     */
370
+    public function entity_path_input_element_params( $args ) {
371
+
372
+        // Bail out if it's not the `wl-entity-base-path`).
373
+        if ( 'wl-entity-base-path' !== $args['id'] ) {
374
+            return $args;
375
+        }
376
+
377
+        // Set the readonly flag according to the entities count.
378
+        $args['readonly'] = 0 < $this->entity_service->count();
379
+
380
+        // Return the updated args.
381
+        return $args;
382
+    }
383
+
384
+    /**
385
+     * Sanitize the configuration settings to be stored.
386
+     *
387
+     * If a new entity is being created for the publisher, create it and set The
388
+     * publisher setting.
389
+     *
390
+     * @param array $input The configuration settings array.
391
+     *
392
+     * @return array The sanitized input array.
393
+     * @since 3.11.0
394
+     *
395
+     */
396
+    function sanitize_callback( $input ) {
397
+
398
+        // Validate the selected country.
399
+        $this->validate_country();
400
+
401
+        // Check whether a publisher name has been set.
402
+        if ( isset( $_POST['wl_publisher'] ) && ! empty( $_POST['wl_publisher']['name'] ) ) { // WPCS: CSRF, input var, sanitization ok.
403
+            $name         = isset( $_POST['wl_publisher']['name'] ) ? (string) $_POST['wl_publisher']['name'] : '';
404
+            $type         = isset( $_POST['wl_publisher']['type'] ) ? (string) $_POST['wl_publisher']['type'] : '';
405
+            $thumbnail_id = isset( $_POST['wl_publisher']['thumbnail_id'] ) ? $_POST['wl_publisher']['thumbnail_id'] : null; // WPCS: CSRF, input var, sanitization ok.
406
+
407
+            // Set the type URI, either http://schema.org/Person or http://schema.org/Organization.
408
+            $type_uri = sprintf( 'http://schema.org/%s', 'organization' === $type ? 'Organization' : 'Person' );
409
+
410
+            // Create an entity for the publisher and assign it to the input
411
+            // parameter which WordPress automatically saves into the settings.
412
+            $input['publisher_id'] = $this->entity_service->create( $name, $type_uri, $thumbnail_id, 'publish' );
413
+        }
414
+
415
+        return $input;
416
+    }
417
+
418
+    /**
419
+     * Check whether the currently selected country supports the site language.
420
+     *
421
+     * @since 3.18.0
422
+     */
423
+    private function validate_country() {
424
+
425
+        // Bail out if for some reason the country and language are not set.
426
+        if (
427
+            empty( $_POST['wl_general_settings']['site_language'] ) && // WPCS: CSRF, input var, sanitization ok.
428
+            empty( $_POST['wl_general_settings']['country_code'] ) // WPCS: CSRF, input var, sanitization ok.
429
+        ) {
430
+            return;
431
+        }
432
+
433
+        // Get the values.
434
+        $language = $_POST['wl_general_settings']['site_language']; // WPCS: CSRF, input var, sanitization ok.
435
+        $country  = $_POST['wl_general_settings']['country_code']; // WPCS: CSRF, input var, sanitization ok.
436
+        $codes    = Wordlift_Countries::get_codes();
437
+
438
+        // Check whether the chosen country has language limitations
439
+        // and whether the chosen language is supported for that country.
440
+        if (
441
+            ! empty( $codes[ $country ] ) &&
442
+            ! in_array( $language, $codes[ $country ] )
443
+        ) {
444
+            // Otherwise add an error.
445
+            add_settings_error(
446
+                'wl-country-code',
447
+                esc_attr( 'settings_updated' ),
448
+                _x( 'The selected language is not supported for the currently chosen country. Please choose another country or language.', 'wordlift' )
449
+            );
450
+        }
451
+    }
452 452
 
453 453
 }
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 * @since 3.11.0
105 105
 	 *
106 106
 	 */
107
-	function __construct( $configuration_service, $entity_service, $input_element, $language_select_element, $country_select_element, $publisher_element, $radio_input_element ) {
107
+	function __construct($configuration_service, $entity_service, $input_element, $language_select_element, $country_select_element, $publisher_element, $radio_input_element) {
108 108
 
109 109
 		$this->configuration_service = $configuration_service;
110 110
 		$this->entity_service        = $entity_service;
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 
190 190
 		// JavaScript required for the settings page.
191 191
 		// @todo: try to move to the `wordlift-admin.bundle.js`.
192
-		wp_enqueue_script( 'wordlift-admin-settings-page', plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/1/settings.js', array( 'wp-util' ) );
193
-		wp_enqueue_style( 'wordlift-admin-settings-page', plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/1/settings.css' );
192
+		wp_enqueue_script('wordlift-admin-settings-page', plugin_dir_url(dirname(__FILE__)).'admin/js/1/settings.js', array('wp-util'));
193
+		wp_enqueue_style('wordlift-admin-settings-page', plugin_dir_url(dirname(__FILE__)).'admin/js/1/settings.css');
194 194
 
195 195
 	}
196 196
 
@@ -207,23 +207,23 @@  discard block
 block discarded – undo
207 207
 		register_setting(
208 208
 			'wl_general_settings',
209 209
 			'wl_general_settings',
210
-			array( $this, 'sanitize_callback' )
210
+			array($this, 'sanitize_callback')
211 211
 		);
212 212
 
213 213
 		// Add the general settings section.
214 214
 		add_settings_section(
215 215
 			'wl_general_settings_section', // ID used to identify this section and with which to register options.
216
-			'',                            // Section header.
217
-			'',                            // Callback used to render the description of the section.
216
+			'', // Section header.
217
+			'', // Callback used to render the description of the section.
218 218
 			'wl_general_settings'          // Page on which to add this section of options.
219 219
 		);
220 220
 
221 221
 		$key_args = array(
222 222
 			'id'          => 'wl-key',
223
-			'name'        => 'wl_general_settings[' . Wordlift_Configuration_Service::KEY . ']',
223
+			'name'        => 'wl_general_settings['.Wordlift_Configuration_Service::KEY.']',
224 224
 			'value'       => $this->configuration_service->get_key(),
225
-			'description' => __( 'Insert the <a href="https://www.wordlift.io/blogger">WordLift Key</a> you received via email.', 'wordlift' )
226
-			                 . ' [' . get_option( 'home' ) . ']',
225
+			'description' => __('Insert the <a href="https://www.wordlift.io/blogger">WordLift Key</a> you received via email.', 'wordlift')
226
+			                 . ' ['.get_option('home').']',
227 227
 		);
228 228
 
229 229
 		// Before we were used to validate the key beforehand, but this means
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
 
237 237
 		// Add the `key` field.
238 238
 		add_settings_field(
239
-			'wl-key',                                       // Element id used to identify the field throughout the theme.
240
-			__( 'WordLift Key', 'wordlift' ),               // The label to the left of the option interface element.
239
+			'wl-key', // Element id used to identify the field throughout the theme.
240
+			__('WordLift Key', 'wordlift'), // The label to the left of the option interface element.
241 241
 			// The name of the function responsible for rendering the option interface.
242
-			array( $this->input_element, 'render' ),
243
-			'wl_general_settings',                          // The page on which this option will be displayed.
244
-			'wl_general_settings_section',                  // The name of the section to which this field belongs.
242
+			array($this->input_element, 'render'),
243
+			'wl_general_settings', // The page on which this option will be displayed.
244
+			'wl_general_settings_section', // The name of the section to which this field belongs.
245 245
 			$key_args                                       // The array of arguments to pass to the callback. In this case, just a description.
246 246
 		);
247 247
 
@@ -249,10 +249,10 @@  discard block
 block discarded – undo
249 249
 		$entity_base_path_args = array(
250 250
 			// The array of arguments to pass to the callback. In this case, just a description.
251 251
 			'id'          => 'wl-entity-base-path',
252
-			'name'        => 'wl_general_settings[' . Wordlift_Configuration_Service::ENTITY_BASE_PATH_KEY . ']',
252
+			'name'        => 'wl_general_settings['.Wordlift_Configuration_Service::ENTITY_BASE_PATH_KEY.']',
253 253
 			'value'       => $this->configuration_service->get_entity_base_path(),
254 254
 			/* translators: Placeholders: %s - a link to FAQ's page. */
255
-			'description' => sprintf( __( 'All new pages created with WordLift, will be stored inside your internal vocabulary. You can customize the url pattern of these pages in the field above. Check our <a href="%s">FAQs</a> if you need more info.', 'wordlift' ), 'https://wordlift.io/wordlift-user-faqs/#10-why-and-how-should-i-customize-the-url-of-the-entity-pages-created-in-my-vocabulary' ),
255
+			'description' => sprintf(__('All new pages created with WordLift, will be stored inside your internal vocabulary. You can customize the url pattern of these pages in the field above. Check our <a href="%s">FAQs</a> if you need more info.', 'wordlift'), 'https://wordlift.io/wordlift-user-faqs/#10-why-and-how-should-i-customize-the-url-of-the-entity-pages-created-in-my-vocabulary'),
256 256
 		);
257 257
 
258 258
 		// The following call is very heavy on large web sites and is always run
@@ -261,19 +261,19 @@  discard block
 block discarded – undo
261 261
 		//
262 262
 		// It is now replaced by a filter to add the `readonly` flag to the
263 263
 		// input element when this is actually rendered.
264
-		add_filter( 'wl_admin_input_element_params', array(
264
+		add_filter('wl_admin_input_element_params', array(
265 265
 			$this,
266 266
 			'entity_path_input_element_params',
267
-		) );
267
+		));
268 268
 
269 269
 		// Add the `wl_entity_base_path` field.
270 270
 		add_settings_field(
271
-			'wl-entity-base-path',                                // ID used to identify the field throughout the theme
272
-			__( 'Entity Base Path', 'wordlift' ),                 // The label to the left of the option interface element
271
+			'wl-entity-base-path', // ID used to identify the field throughout the theme
272
+			__('Entity Base Path', 'wordlift'), // The label to the left of the option interface element
273 273
 			// The name of the function responsible for rendering the option interface
274
-			array( $this->input_element, 'render', ),
275
-			'wl_general_settings',                                // The page on which this option will be displayed
276
-			'wl_general_settings_section',                        // The name of the section to which this field belongs
274
+			array($this->input_element, 'render',),
275
+			'wl_general_settings', // The page on which this option will be displayed
276
+			'wl_general_settings_section', // The name of the section to which this field belongs
277 277
 			$entity_base_path_args
278 278
 		);
279 279
 
@@ -285,10 +285,10 @@  discard block
 block discarded – undo
285 285
 		// Add the `language_name` field.
286 286
 		add_settings_field(
287 287
 			'wl-site-language',
288
-			__( 'Site Language', 'wordlift' ),
289
-			function () use ( $language_name ) {
290
-				echo sprintf( '<p><label>%s</label></p>', esc_html( $language_name ));
291
-				echo  sprintf( __( '<br/><p>WordLift uses the site language, You can change the language from <a href="%s">settings.</a></p>', 'wordlift' ),
288
+			__('Site Language', 'wordlift'),
289
+			function() use ($language_name) {
290
+				echo sprintf('<p><label>%s</label></p>', esc_html($language_name));
291
+				echo  sprintf(__('<br/><p>WordLift uses the site language, You can change the language from <a href="%s">settings.</a></p>', 'wordlift'),
292 292
 					admin_url('options-general.php#WPLANG')
293 293
 				);
294 294
 			},
@@ -299,59 +299,59 @@  discard block
 block discarded – undo
299 299
 		// Add the `country_code` field.
300 300
 		add_settings_field(
301 301
 			'wl-country-code',
302
-			_x( 'Country', 'wordlift' ),
303
-			array( $this->country_select_element, 'render' ),
302
+			_x('Country', 'wordlift'),
303
+			array($this->country_select_element, 'render'),
304 304
 			'wl_general_settings',
305 305
 			'wl_general_settings_section',
306 306
 			array(
307 307
 				'id'          => 'wl-country-code',
308
-				'name'        => 'wl_general_settings[' . Wordlift_Configuration_Service::COUNTRY_CODE . ']',
308
+				'name'        => 'wl_general_settings['.Wordlift_Configuration_Service::COUNTRY_CODE.']',
309 309
 				'value'       => $this->configuration_service->get_country_code(),
310
-				'description' => __( 'Please select a country.', 'wordlift' ),
311
-				'notice'      => __( 'The selected language is not supported in this country.</br>Please choose another country or language.', 'wordlift' ),
310
+				'description' => __('Please select a country.', 'wordlift'),
311
+				'notice'      => __('The selected language is not supported in this country.</br>Please choose another country or language.', 'wordlift'),
312 312
 			)
313 313
 		);
314 314
 
315 315
 		// Add the `publisher` field.
316 316
 		add_settings_field(
317 317
 			'wl-publisher-id',
318
-			__( 'Publisher', 'wordlift' ),
319
-			array( $this->publisher_element, 'render' ),
318
+			__('Publisher', 'wordlift'),
319
+			array($this->publisher_element, 'render'),
320 320
 			'wl_general_settings',
321 321
 			'wl_general_settings_section',
322 322
 			array(
323 323
 				'id'   => 'wl-publisher-id',
324
-				'name' => 'wl_general_settings[' . Wordlift_Configuration_Service::PUBLISHER_ID . ']',
324
+				'name' => 'wl_general_settings['.Wordlift_Configuration_Service::PUBLISHER_ID.']',
325 325
 			)
326 326
 		);
327 327
 
328 328
 		// Add the `link by default` field.
329 329
 		add_settings_field(
330 330
 			'wl-link-by-default',
331
-			__( 'Link by Default', 'wordlift' ),
332
-			array( $this->radio_input_element, 'render' ),
331
+			__('Link by Default', 'wordlift'),
332
+			array($this->radio_input_element, 'render'),
333 333
 			'wl_general_settings',
334 334
 			'wl_general_settings_section',
335 335
 			array(
336 336
 				'id'          => 'wl-link-by-default',
337
-				'name'        => 'wl_general_settings[' . Wordlift_Configuration_Service::LINK_BY_DEFAULT . ']',
337
+				'name'        => 'wl_general_settings['.Wordlift_Configuration_Service::LINK_BY_DEFAULT.']',
338 338
 				'value'       => $this->configuration_service->is_link_by_default() ? 'yes' : 'no',
339
-				'description' => __( 'Whether to link entities by default or not. This setting applies to all the entities.', 'wordlift' ),
339
+				'description' => __('Whether to link entities by default or not. This setting applies to all the entities.', 'wordlift'),
340 340
 			)
341 341
 		);
342 342
 
343 343
 		// Add the `diagnostic data` field.
344 344
 		add_settings_field(
345 345
 			'wl-send-diagnostic',
346
-			__( 'Send Diagnostic Data', 'wordlift' ),
347
-			array( $this->radio_input_element, 'render' ),
346
+			__('Send Diagnostic Data', 'wordlift'),
347
+			array($this->radio_input_element, 'render'),
348 348
 			'wl_general_settings',
349 349
 			'wl_general_settings_section',
350 350
 			array(
351 351
 				'id'          => 'wl-send-diagnostic',
352
-				'name'        => 'wl_general_settings[' . Wordlift_Configuration_Service::SEND_DIAGNOSTIC . ']',
352
+				'name'        => 'wl_general_settings['.Wordlift_Configuration_Service::SEND_DIAGNOSTIC.']',
353 353
 				'value'       => 'yes' === $this->configuration_service->get_diagnostic_preferences() ? 'yes' : 'no',
354
-				'description' => __( 'Whether to send diagnostic data or not.', 'wordlift' ),
354
+				'description' => __('Whether to send diagnostic data or not.', 'wordlift'),
355 355
 			)
356 356
 		);
357 357
 
@@ -367,10 +367,10 @@  discard block
 block discarded – undo
367 367
 	 * @since 3.17.0
368 368
 	 *
369 369
 	 */
370
-	public function entity_path_input_element_params( $args ) {
370
+	public function entity_path_input_element_params($args) {
371 371
 
372 372
 		// Bail out if it's not the `wl-entity-base-path`).
373
-		if ( 'wl-entity-base-path' !== $args['id'] ) {
373
+		if ('wl-entity-base-path' !== $args['id']) {
374 374
 			return $args;
375 375
 		}
376 376
 
@@ -393,23 +393,23 @@  discard block
 block discarded – undo
393 393
 	 * @since 3.11.0
394 394
 	 *
395 395
 	 */
396
-	function sanitize_callback( $input ) {
396
+	function sanitize_callback($input) {
397 397
 
398 398
 		// Validate the selected country.
399 399
 		$this->validate_country();
400 400
 
401 401
 		// Check whether a publisher name has been set.
402
-		if ( isset( $_POST['wl_publisher'] ) && ! empty( $_POST['wl_publisher']['name'] ) ) { // WPCS: CSRF, input var, sanitization ok.
403
-			$name         = isset( $_POST['wl_publisher']['name'] ) ? (string) $_POST['wl_publisher']['name'] : '';
404
-			$type         = isset( $_POST['wl_publisher']['type'] ) ? (string) $_POST['wl_publisher']['type'] : '';
405
-			$thumbnail_id = isset( $_POST['wl_publisher']['thumbnail_id'] ) ? $_POST['wl_publisher']['thumbnail_id'] : null; // WPCS: CSRF, input var, sanitization ok.
402
+		if (isset($_POST['wl_publisher']) && ! empty($_POST['wl_publisher']['name'])) { // WPCS: CSRF, input var, sanitization ok.
403
+			$name         = isset($_POST['wl_publisher']['name']) ? (string) $_POST['wl_publisher']['name'] : '';
404
+			$type         = isset($_POST['wl_publisher']['type']) ? (string) $_POST['wl_publisher']['type'] : '';
405
+			$thumbnail_id = isset($_POST['wl_publisher']['thumbnail_id']) ? $_POST['wl_publisher']['thumbnail_id'] : null; // WPCS: CSRF, input var, sanitization ok.
406 406
 
407 407
 			// Set the type URI, either http://schema.org/Person or http://schema.org/Organization.
408
-			$type_uri = sprintf( 'http://schema.org/%s', 'organization' === $type ? 'Organization' : 'Person' );
408
+			$type_uri = sprintf('http://schema.org/%s', 'organization' === $type ? 'Organization' : 'Person');
409 409
 
410 410
 			// Create an entity for the publisher and assign it to the input
411 411
 			// parameter which WordPress automatically saves into the settings.
412
-			$input['publisher_id'] = $this->entity_service->create( $name, $type_uri, $thumbnail_id, 'publish' );
412
+			$input['publisher_id'] = $this->entity_service->create($name, $type_uri, $thumbnail_id, 'publish');
413 413
 		}
414 414
 
415 415
 		return $input;
@@ -424,8 +424,8 @@  discard block
 block discarded – undo
424 424
 
425 425
 		// Bail out if for some reason the country and language are not set.
426 426
 		if (
427
-			empty( $_POST['wl_general_settings']['site_language'] ) && // WPCS: CSRF, input var, sanitization ok.
428
-			empty( $_POST['wl_general_settings']['country_code'] ) // WPCS: CSRF, input var, sanitization ok.
427
+			empty($_POST['wl_general_settings']['site_language']) && // WPCS: CSRF, input var, sanitization ok.
428
+			empty($_POST['wl_general_settings']['country_code']) // WPCS: CSRF, input var, sanitization ok.
429 429
 		) {
430 430
 			return;
431 431
 		}
@@ -438,14 +438,14 @@  discard block
 block discarded – undo
438 438
 		// Check whether the chosen country has language limitations
439 439
 		// and whether the chosen language is supported for that country.
440 440
 		if (
441
-			! empty( $codes[ $country ] ) &&
442
-			! in_array( $language, $codes[ $country ] )
441
+			! empty($codes[$country]) &&
442
+			! in_array($language, $codes[$country])
443 443
 		) {
444 444
 			// Otherwise add an error.
445 445
 			add_settings_error(
446 446
 				'wl-country-code',
447
-				esc_attr( 'settings_updated' ),
448
-				_x( 'The selected language is not supported for the currently chosen country. Please choose another country or language.', 'wordlift' )
447
+				esc_attr('settings_updated'),
448
+				_x('The selected language is not supported for the currently chosen country. Please choose another country or language.', 'wordlift')
449 449
 			);
450 450
 		}
451 451
 	}
Please login to merge, or discard this patch.
src/wordlift/configuration/class-config.php 1 patch
Indentation   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -4,193 +4,193 @@
 block discarded – undo
4 4
 
5 5
 
6 6
 class Config {
7
-	/**
8
-	 * @var \Wordlift_Admin_Setup
9
-	 */
10
-	private $admin_setup;
11
-	/**
12
-	 * @var \Wordlift_Key_Validation_Service
13
-	 */
14
-	private $key_validation_service;
15
-	/**
16
-	 * @var \Wordlift_Configuration_Service
17
-	 */
18
-	private $configuration_service;
19
-
20
-	/**
21
-	 * Config constructor.
22
-	 *
23
-	 * @param $admin_setup \Wordlift_Admin_Setup
24
-	 * @param $key_validation_service \Wordlift_Key_Validation_Service
25
-	 * @param $configuration_service \Wordlift_Configuration_Service
26
-	 */
27
-	public function __construct( $admin_setup, $key_validation_service, $configuration_service ) {
28
-
29
-		$this->admin_setup            = $admin_setup;
30
-		$this->key_validation_service = $key_validation_service;
31
-		$this->configuration_service  = $configuration_service;
32
-		add_action( 'wp_ajax_nopriv_wl_config_plugin', array( $this, 'config' ) );
33
-
34
-	}
35
-
36
-	/**
37
-	 * Check if the key is valid and also not bound to any domain.
38
-	 *
39
-	 * @param $key string
40
-	 *
41
-	 * @return bool
42
-	 */
43
-	private function is_key_valid_and_not_bound_to_any_domain( $key ) {
44
-		$account_info = $this->key_validation_service->get_account_info( $key );
45
-
46
-		/**
47
-		 * we need to check if the key is not associated with any account
48
-		 * before setting it, we should check if the url is null.
49
-		 */
50
-		if ( is_wp_error( $account_info )
51
-		     || wp_remote_retrieve_response_code( $account_info ) !== 200 ) {
52
-			return false;
53
-		}
54
-
55
-		$account_info_json = $account_info['body'];
56
-
57
-		$account_info_data = json_decode( $account_info_json, true );
58
-
59
-		if ( ! $account_info_data ) {
60
-			// Invalid json returned by api.
61
-			return false;
62
-		}
63
-
64
-		$site_url = apply_filters( 'wl_production_site_url', untrailingslashit( get_option( 'home' ) ) );
65
-
66
-
67
-		if ( $account_info_data['url'] === null ) {
68
-			return true;
69
-		}
70
-
71
-		// Check if the key belongs to same site.
72
-		if ( $site_url !== untrailingslashit( $account_info_data['url'] ) ) {
73
-			// key already associated with another account.
74
-			return false;
75
-		}
76
-
77
-		// Return true if the key domain and site domain are the same.
78
-		return true;
79
-	}
80
-
81
-
82
-	public function config() {
83
-
84
-		// Perform validation check for all the parameters.
85
-		$required_fields = array(
86
-			'diagnostic',
87
-			'vocabulary',
7
+    /**
8
+     * @var \Wordlift_Admin_Setup
9
+     */
10
+    private $admin_setup;
11
+    /**
12
+     * @var \Wordlift_Key_Validation_Service
13
+     */
14
+    private $key_validation_service;
15
+    /**
16
+     * @var \Wordlift_Configuration_Service
17
+     */
18
+    private $configuration_service;
19
+
20
+    /**
21
+     * Config constructor.
22
+     *
23
+     * @param $admin_setup \Wordlift_Admin_Setup
24
+     * @param $key_validation_service \Wordlift_Key_Validation_Service
25
+     * @param $configuration_service \Wordlift_Configuration_Service
26
+     */
27
+    public function __construct( $admin_setup, $key_validation_service, $configuration_service ) {
28
+
29
+        $this->admin_setup            = $admin_setup;
30
+        $this->key_validation_service = $key_validation_service;
31
+        $this->configuration_service  = $configuration_service;
32
+        add_action( 'wp_ajax_nopriv_wl_config_plugin', array( $this, 'config' ) );
33
+
34
+    }
35
+
36
+    /**
37
+     * Check if the key is valid and also not bound to any domain.
38
+     *
39
+     * @param $key string
40
+     *
41
+     * @return bool
42
+     */
43
+    private function is_key_valid_and_not_bound_to_any_domain( $key ) {
44
+        $account_info = $this->key_validation_service->get_account_info( $key );
45
+
46
+        /**
47
+         * we need to check if the key is not associated with any account
48
+         * before setting it, we should check if the url is null.
49
+         */
50
+        if ( is_wp_error( $account_info )
51
+             || wp_remote_retrieve_response_code( $account_info ) !== 200 ) {
52
+            return false;
53
+        }
54
+
55
+        $account_info_json = $account_info['body'];
56
+
57
+        $account_info_data = json_decode( $account_info_json, true );
58
+
59
+        if ( ! $account_info_data ) {
60
+            // Invalid json returned by api.
61
+            return false;
62
+        }
63
+
64
+        $site_url = apply_filters( 'wl_production_site_url', untrailingslashit( get_option( 'home' ) ) );
65
+
66
+
67
+        if ( $account_info_data['url'] === null ) {
68
+            return true;
69
+        }
70
+
71
+        // Check if the key belongs to same site.
72
+        if ( $site_url !== untrailingslashit( $account_info_data['url'] ) ) {
73
+            // key already associated with another account.
74
+            return false;
75
+        }
76
+
77
+        // Return true if the key domain and site domain are the same.
78
+        return true;
79
+    }
80
+
81
+
82
+    public function config() {
83
+
84
+        // Perform validation check for all the parameters.
85
+        $required_fields = array(
86
+            'diagnostic',
87
+            'vocabulary',
88 88
 // Don't ask for language from webapp.
89 89
 //			'language',
90
-			'country',
91
-			'publisherName',
92
-			'publisher',
93
-			'license'
94
-		);
90
+            'country',
91
+            'publisherName',
92
+            'publisher',
93
+            'license'
94
+        );
95 95
 
96
-		header( 'Access-Control-Allow-Origin: *' );
96
+        header( 'Access-Control-Allow-Origin: *' );
97 97
 
98
-		// validate all the fields before processing
99
-		foreach ( $required_fields as $field ) {
100
-			if ( ! array_key_exists( $field, $_POST ) ) {
101
-				wp_send_json_error( sprintf( __( 'Field %s is required', 'wordlift' ), $field ), 422 );
98
+        // validate all the fields before processing
99
+        foreach ( $required_fields as $field ) {
100
+            if ( ! array_key_exists( $field, $_POST ) ) {
101
+                wp_send_json_error( sprintf( __( 'Field %s is required', 'wordlift' ), $field ), 422 );
102 102
 
103
-				return;
104
-			}
105
-		}
103
+                return;
104
+            }
105
+        }
106 106
 
107
-		$key = (string) $_POST['license'];
107
+        $key = (string) $_POST['license'];
108 108
 
109
-		if ( ! $this->is_key_valid_and_not_bound_to_any_domain( $key ) ) {
110
-			wp_send_json_error( __( 'Key is not valid or associated with other domain', 'wordlift' ), 403 );
109
+        if ( ! $this->is_key_valid_and_not_bound_to_any_domain( $key ) ) {
110
+            wp_send_json_error( __( 'Key is not valid or associated with other domain', 'wordlift' ), 403 );
111 111
 
112
-			// exit if not valid.
113
-			return;
114
-		}
112
+            // exit if not valid.
113
+            return;
114
+        }
115 115
 
116 116
 
117
-		// check if key is already configured, if yes then dont save settings.
118
-		if ( $this->configuration_service->get_key() ) {
119
-			wp_send_json_error( __( 'Key already configured.', 'wordlift' ), 403 );
117
+        // check if key is already configured, if yes then dont save settings.
118
+        if ( $this->configuration_service->get_key() ) {
119
+            wp_send_json_error( __( 'Key already configured.', 'wordlift' ), 403 );
120 120
 
121
-			// key already configured
122
-			return;
123
-		}
121
+            // key already configured
122
+            return;
123
+        }
124 124
 
125
-		$this->admin_setup->save_configuration( $this->get_params() );
125
+        $this->admin_setup->save_configuration( $this->get_params() );
126 126
 
127 127
 
128
-		wp_send_json_success( __( 'Configuration Saved', 'wordlift' ) );
129
-	}
128
+        wp_send_json_success( __( 'Configuration Saved', 'wordlift' ) );
129
+    }
130 130
 
131
-	/**
132
-	 *
133
-	 * @return array
134
-	 */
135
-	private function get_params() {
131
+    /**
132
+     *
133
+     * @return array
134
+     */
135
+    private function get_params() {
136 136
 
137
-		$attachment_id = $this->may_be_get_attachment_id();
137
+        $attachment_id = $this->may_be_get_attachment_id();
138 138
 
139
-		$params = array(
140
-			'key'              => isset( $_POST['license'] ) ? (string) $_POST['license'] : '',
141
-			'vocabulary'       => isset( $_POST['vocabulary'] ) ? (string) $_POST['vocabulary'] : '',
142
-			'wl-site-language' => isset( $_POST['language'] ) ? (string) $_POST['language'] : '',
143
-			'wl-country-code'  => isset( $_POST['country'] ) ? (string) $_POST['country'] : '',
144
-			'name'             => isset( $_POST['publisherName'] ) ? (string) $_POST['publisherName'] : '',
145
-			'user_type'        => isset( $_POST['publisher'] ) ? (string) $_POST['publisher'] : '',
146
-			'logo'             => $attachment_id
147
-		);
139
+        $params = array(
140
+            'key'              => isset( $_POST['license'] ) ? (string) $_POST['license'] : '',
141
+            'vocabulary'       => isset( $_POST['vocabulary'] ) ? (string) $_POST['vocabulary'] : '',
142
+            'wl-site-language' => isset( $_POST['language'] ) ? (string) $_POST['language'] : '',
143
+            'wl-country-code'  => isset( $_POST['country'] ) ? (string) $_POST['country'] : '',
144
+            'name'             => isset( $_POST['publisherName'] ) ? (string) $_POST['publisherName'] : '',
145
+            'user_type'        => isset( $_POST['publisher'] ) ? (string) $_POST['publisher'] : '',
146
+            'logo'             => $attachment_id
147
+        );
148 148
 
149
-		$diagnostic = isset( $_POST['diagnostic'] ) ? (bool) $_POST['diagnostic'] : false;
150
-		if ( $diagnostic ) {
151
-			$params['share-diagnostic'] = 'on';
152
-		}
149
+        $diagnostic = isset( $_POST['diagnostic'] ) ? (bool) $_POST['diagnostic'] : false;
150
+        if ( $diagnostic ) {
151
+            $params['share-diagnostic'] = 'on';
152
+        }
153 153
 
154
-		return $params;
155
-	}
154
+        return $params;
155
+    }
156 156
 
157
-	/**
158
-	 * @return int | bool
159
-	 */
160
-	private function may_be_get_attachment_id() {
157
+    /**
158
+     * @return int | bool
159
+     */
160
+    private function may_be_get_attachment_id() {
161 161
 
162
-		// if image or image extension not posted then return false.
163
-		if ( ! isset( $_POST['image'] ) || ! isset( $_POST['imageExtension'] ) ) {
164
-			return false;
165
-		}
162
+        // if image or image extension not posted then return false.
163
+        if ( ! isset( $_POST['image'] ) || ! isset( $_POST['imageExtension'] ) ) {
164
+            return false;
165
+        }
166 166
 
167
-		$allowed_extensions = array( 'png', 'jpeg', 'jpg' );
168
-		$image_string       = (string) $_POST['image'];
169
-		$image_ext          = (string) $_POST['imageExtension'];
167
+        $allowed_extensions = array( 'png', 'jpeg', 'jpg' );
168
+        $image_string       = (string) $_POST['image'];
169
+        $image_ext          = (string) $_POST['imageExtension'];
170 170
 
171
-		if ( ! in_array( $image_ext, $allowed_extensions ) ) {
172
-			return false;
173
-		}
171
+        if ( ! in_array( $image_ext, $allowed_extensions ) ) {
172
+            return false;
173
+        }
174 174
 
175
-		$image_decoded_string = base64_decode( $image_string );
175
+        $image_decoded_string = base64_decode( $image_string );
176 176
 
177
-		$upload_dir = wp_upload_dir();
177
+        $upload_dir = wp_upload_dir();
178 178
 
179
-		$file_path = $upload_dir['path'] . DIRECTORY_SEPARATOR . md5( $image_string ) . "." . $image_ext;
179
+        $file_path = $upload_dir['path'] . DIRECTORY_SEPARATOR . md5( $image_string ) . "." . $image_ext;
180 180
 
181
-		file_put_contents( $file_path, $image_decoded_string );
181
+        file_put_contents( $file_path, $image_decoded_string );
182 182
 
183
-		$attachment_id = wp_insert_attachment( array(
184
-			'post_status'    => 'inherit',
185
-			'post_mime_type' => "image/$image_ext"
186
-		), $file_path );
183
+        $attachment_id = wp_insert_attachment( array(
184
+            'post_status'    => 'inherit',
185
+            'post_mime_type' => "image/$image_ext"
186
+        ), $file_path );
187 187
 
188
-		// Generate the metadata for the attachment, and update the database record.
189
-		$attachment_data = wp_generate_attachment_metadata( $attachment_id, $file_path );
190
-		// Update the attachment metadata.
191
-		wp_update_attachment_metadata( $attachment_id, $attachment_data );
188
+        // Generate the metadata for the attachment, and update the database record.
189
+        $attachment_data = wp_generate_attachment_metadata( $attachment_id, $file_path );
190
+        // Update the attachment metadata.
191
+        wp_update_attachment_metadata( $attachment_id, $attachment_data );
192 192
 
193
-		return $attachment_id;
194
-	}
193
+        return $attachment_id;
194
+    }
195 195
 
196 196
 }
Please login to merge, or discard this patch.
src/wordlift/synonym/class-rest-field.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -6,64 +6,64 @@
 block discarded – undo
6 6
 
7 7
 class Rest_Field {
8 8
 
9
-	public function __construct() {
10
-		add_action( 'rest_api_init', array( $this, 'register_rest_field' ) );
11
-	}
9
+    public function __construct() {
10
+        add_action( 'rest_api_init', array( $this, 'register_rest_field' ) );
11
+    }
12 12
 
13
-	public function register_rest_field() {
13
+    public function register_rest_field() {
14 14
 
15
-		if ( ! function_exists( 'register_rest_field' ) ) {
16
-			return;
17
-		}
15
+        if ( ! function_exists( 'register_rest_field' ) ) {
16
+            return;
17
+        }
18 18
 
19 19
 
20
-		$post_types = Wordlift_Entity_Service::valid_entity_post_types();
20
+        $post_types = Wordlift_Entity_Service::valid_entity_post_types();
21 21
 
22
-		foreach ( $post_types as $post_type ) {
22
+        foreach ( $post_types as $post_type ) {
23 23
 
24
-			register_rest_field(
25
-				$post_type,
26
-				\Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY,
27
-				array(
28
-					'get_callback'    => array( $this, 'get_value' ),
29
-					'update_callback' => array( $this, 'update_value' )
30
-				)
31
-			);
24
+            register_rest_field(
25
+                $post_type,
26
+                \Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY,
27
+                array(
28
+                    'get_callback'    => array( $this, 'get_value' ),
29
+                    'update_callback' => array( $this, 'update_value' )
30
+                )
31
+            );
32 32
 
33
-		}
33
+        }
34 34
 
35 35
 
36
-	}
36
+    }
37 37
 
38
-	/**
39
-	 * @param $meta_values array
40
-	 * @param $post \WP_Post
41
-	 * @param $meta_key string
42
-	 */
43
-	public function update_value( $meta_values, $post, $meta_key ) {
38
+    /**
39
+     * @param $meta_values array
40
+     * @param $post \WP_Post
41
+     * @param $meta_key string
42
+     */
43
+    public function update_value( $meta_values, $post, $meta_key ) {
44 44
 
45
-		if ( ! is_array( $meta_values ) ) {
46
-			return;
47
-		}
45
+        if ( ! is_array( $meta_values ) ) {
46
+            return;
47
+        }
48 48
 
49
-		$entity_service = Wordlift_Entity_Service::get_instance();
49
+        $entity_service = Wordlift_Entity_Service::get_instance();
50 50
 
51
-		$entity_service->set_alternative_labels( $post->ID, $meta_values );
52
-	}
51
+        $entity_service->set_alternative_labels( $post->ID, $meta_values );
52
+    }
53 53
 
54
-	/**
55
-	 * @param $post array Post array.
56
-	 *
57
-	 * @return array|mixed
58
-	 */
59
-	public function get_value( $post ) {
60
-		$data = get_post_meta( (int) $post["id"], \Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY );
61
-		if ( ! is_array( $data ) ) {
62
-			return array();
63
-		}
54
+    /**
55
+     * @param $post array Post array.
56
+     *
57
+     * @return array|mixed
58
+     */
59
+    public function get_value( $post ) {
60
+        $data = get_post_meta( (int) $post["id"], \Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY );
61
+        if ( ! is_array( $data ) ) {
62
+            return array();
63
+        }
64 64
 
65
-		return $data;
66
-	}
65
+        return $data;
66
+    }
67 67
 
68 68
 
69 69
 }
70 70
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,26 +7,26 @@  discard block
 block discarded – undo
7 7
 class Rest_Field {
8 8
 
9 9
 	public function __construct() {
10
-		add_action( 'rest_api_init', array( $this, 'register_rest_field' ) );
10
+		add_action('rest_api_init', array($this, 'register_rest_field'));
11 11
 	}
12 12
 
13 13
 	public function register_rest_field() {
14 14
 
15
-		if ( ! function_exists( 'register_rest_field' ) ) {
15
+		if ( ! function_exists('register_rest_field')) {
16 16
 			return;
17 17
 		}
18 18
 
19 19
 
20 20
 		$post_types = Wordlift_Entity_Service::valid_entity_post_types();
21 21
 
22
-		foreach ( $post_types as $post_type ) {
22
+		foreach ($post_types as $post_type) {
23 23
 
24 24
 			register_rest_field(
25 25
 				$post_type,
26 26
 				\Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY,
27 27
 				array(
28
-					'get_callback'    => array( $this, 'get_value' ),
29
-					'update_callback' => array( $this, 'update_value' )
28
+					'get_callback'    => array($this, 'get_value'),
29
+					'update_callback' => array($this, 'update_value')
30 30
 				)
31 31
 			);
32 32
 
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
 	 * @param $post \WP_Post
41 41
 	 * @param $meta_key string
42 42
 	 */
43
-	public function update_value( $meta_values, $post, $meta_key ) {
43
+	public function update_value($meta_values, $post, $meta_key) {
44 44
 
45
-		if ( ! is_array( $meta_values ) ) {
45
+		if ( ! is_array($meta_values)) {
46 46
 			return;
47 47
 		}
48 48
 
49 49
 		$entity_service = Wordlift_Entity_Service::get_instance();
50 50
 
51
-		$entity_service->set_alternative_labels( $post->ID, $meta_values );
51
+		$entity_service->set_alternative_labels($post->ID, $meta_values);
52 52
 	}
53 53
 
54 54
 	/**
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 	 *
57 57
 	 * @return array|mixed
58 58
 	 */
59
-	public function get_value( $post ) {
60
-		$data = get_post_meta( (int) $post["id"], \Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY );
61
-		if ( ! is_array( $data ) ) {
59
+	public function get_value($post) {
60
+		$data = get_post_meta((int) $post["id"], \Wordlift_Entity_Service::ALTERNATIVE_LABEL_META_KEY);
61
+		if ( ! is_array($data)) {
62 62
 			return array();
63 63
 		}
64 64
 
Please login to merge, or discard this patch.
src/wordlift/metabox/class-wl-abstract-metabox.php 2 patches
Indentation   +352 added lines, -352 removed lines patch added patch discarded remove patch
@@ -18,371 +18,371 @@
 block discarded – undo
18 18
  * @subpackage Wordlift/admin/WL_Metabox
19 19
  */
20 20
 class Wl_Abstract_Metabox {
21
-	/**
22
-	 * The metabox custom fields for the current {@link WP_Post}.
23
-	 *
24
-	 * @since  3.1.0
25
-	 * @access public
26
-	 * @var array $fields The metabox custom fields.
27
-	 */
28
-	public $fields;
29
-
30
-	/**
31
-	 * A {@link Wordlift_Log_Service} instance.
32
-	 *
33
-	 * @since 3.15.4
34
-	 *
35
-	 * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
36
-	 */
37
-	private $log;
38
-
39
-	/**
40
-	 * WL_Metabox constructor.
41
-	 *
42
-	 * @since 3.1.0
43
-	 */
44
-	public function __construct() {
45
-
46
-		$this->log = Wordlift_Log_Service::get_logger( get_class() );
47
-	}
48
-
49
-	/**
50
-	 * Add a callback to print the metabox in page.
51
-	 * Wordpress will fire the $this->html() callback at the right time.
52
-	 */
53
-	public function add_main_metabox() {
54
-
55
-		// Build the fields we need to print.
56
-		$this->instantiate_fields( get_the_ID(), Object_Type_Enum::POST );
57
-
58
-		// Bailout if there are no actual fields, we do not need a metabox in that case.
59
-		if ( empty( $this->fields ) ) {
60
-			return;
61
-		}
62
-
63
-		// Add main metabox (will print also the inner fields).
64
-		$id    = uniqid( 'wl-metabox-' );
65
-		$title = get_the_title() . ' ' . __( 'properties', 'wordlift' );
66
-
67
-		// WordPress 4.2 do not accept an array of screens as parameter, have to do be explicit.
68
-		foreach ( Wordlift_Entity_Service::valid_entity_post_types() as $screen ) {
69
-			add_meta_box( $id, $title, array(
70
-				$this,
71
-				'html',
72
-			), $screen, 'normal', 'high' );
73
-		}
74
-
75
-		// Add filter to change the metabox CSS class.
76
-		//
77
-		// @since 3.20.0 Since we support post types other than `entity` for entities, we need to set the `screen`
78
-		//  dynamically according to the `get_current_screen()` function.
79
-		$current_screen = get_current_screen();
80
-		$screen         = $current_screen ? $current_screen->post_type : 'entity';
81
-		add_filter( "postbox_classes_{$screen}_$id", 'wl_admin_metaboxes_add_css_class' );
82
-
83
-	}
84
-
85
-	/**
86
-	 * Render the metabox html.
87
-	 *
88
-	 * @since 3.1.0
89
-	 *
90
-	 */
91
-	public function html() {
92
-
93
-		// Loop over the fields.
94
-		foreach ( $this->fields as $field ) {
95
-
96
-			// load data from DB (values will be available in $field->data).
97
-			$field->get_data();
98
-
99
-			// print field HTML (nonce included).
100
-			echo $field->html();
101
-		}
102
-
103
-	}
104
-
105
-	/**
106
-	 * Read the WL <-> Schema mapping and build the Fields for the entity being edited.
107
-	 *
108
-	 * Note: the first function that calls this method will instantiate the fields.
109
-	 * Why it isn't called from the constructor? Because we need to hook this process as late as possible.
110
-	 *
111
-	 * @param int $id | $term_id The post id or term id.
112
-	 *
113
-	 * @param $type int Post or Term
114
-	 *
115
-	 * @since 3.1.0
116
-	 */
117
-	public function instantiate_fields( $id, $type ) {
118
-
119
-		$this->log->trace( "Instantiating fields for entity post $id..." );
120
-
121
-		// This function must be called only once. Not called from the constructor because WP hooks have a rococo ordering.
122
-		if ( isset( $this->fields ) ) {
123
-			return;
124
-		}
125
-		if ( $type === Object_Type_Enum::POST ) {
126
-			$entity_type = wl_entity_taxonomy_get_custom_fields( $id );
127
-		} else if ( $type === Object_Type_Enum::TERM ) {
128
-			$term_entity_types = get_term_meta( $id, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
129
-			$term_entity_types = array_map( function ( $term ) {
130
-				return get_term_by(
131
-					'slug',
132
-					$term,
133
-					Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME
134
-				);
135
-			}, $term_entity_types );
136
-			$entity_type       = wl_get_custom_fields_by_entity_type( $term_entity_types );
137
-		}
138
-		if ( isset( $entity_type ) ) {
139
-
140
-			/*
21
+    /**
22
+     * The metabox custom fields for the current {@link WP_Post}.
23
+     *
24
+     * @since  3.1.0
25
+     * @access public
26
+     * @var array $fields The metabox custom fields.
27
+     */
28
+    public $fields;
29
+
30
+    /**
31
+     * A {@link Wordlift_Log_Service} instance.
32
+     *
33
+     * @since 3.15.4
34
+     *
35
+     * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
36
+     */
37
+    private $log;
38
+
39
+    /**
40
+     * WL_Metabox constructor.
41
+     *
42
+     * @since 3.1.0
43
+     */
44
+    public function __construct() {
45
+
46
+        $this->log = Wordlift_Log_Service::get_logger( get_class() );
47
+    }
48
+
49
+    /**
50
+     * Add a callback to print the metabox in page.
51
+     * Wordpress will fire the $this->html() callback at the right time.
52
+     */
53
+    public function add_main_metabox() {
54
+
55
+        // Build the fields we need to print.
56
+        $this->instantiate_fields( get_the_ID(), Object_Type_Enum::POST );
57
+
58
+        // Bailout if there are no actual fields, we do not need a metabox in that case.
59
+        if ( empty( $this->fields ) ) {
60
+            return;
61
+        }
62
+
63
+        // Add main metabox (will print also the inner fields).
64
+        $id    = uniqid( 'wl-metabox-' );
65
+        $title = get_the_title() . ' ' . __( 'properties', 'wordlift' );
66
+
67
+        // WordPress 4.2 do not accept an array of screens as parameter, have to do be explicit.
68
+        foreach ( Wordlift_Entity_Service::valid_entity_post_types() as $screen ) {
69
+            add_meta_box( $id, $title, array(
70
+                $this,
71
+                'html',
72
+            ), $screen, 'normal', 'high' );
73
+        }
74
+
75
+        // Add filter to change the metabox CSS class.
76
+        //
77
+        // @since 3.20.0 Since we support post types other than `entity` for entities, we need to set the `screen`
78
+        //  dynamically according to the `get_current_screen()` function.
79
+        $current_screen = get_current_screen();
80
+        $screen         = $current_screen ? $current_screen->post_type : 'entity';
81
+        add_filter( "postbox_classes_{$screen}_$id", 'wl_admin_metaboxes_add_css_class' );
82
+
83
+    }
84
+
85
+    /**
86
+     * Render the metabox html.
87
+     *
88
+     * @since 3.1.0
89
+     *
90
+     */
91
+    public function html() {
92
+
93
+        // Loop over the fields.
94
+        foreach ( $this->fields as $field ) {
95
+
96
+            // load data from DB (values will be available in $field->data).
97
+            $field->get_data();
98
+
99
+            // print field HTML (nonce included).
100
+            echo $field->html();
101
+        }
102
+
103
+    }
104
+
105
+    /**
106
+     * Read the WL <-> Schema mapping and build the Fields for the entity being edited.
107
+     *
108
+     * Note: the first function that calls this method will instantiate the fields.
109
+     * Why it isn't called from the constructor? Because we need to hook this process as late as possible.
110
+     *
111
+     * @param int $id | $term_id The post id or term id.
112
+     *
113
+     * @param $type int Post or Term
114
+     *
115
+     * @since 3.1.0
116
+     */
117
+    public function instantiate_fields( $id, $type ) {
118
+
119
+        $this->log->trace( "Instantiating fields for entity post $id..." );
120
+
121
+        // This function must be called only once. Not called from the constructor because WP hooks have a rococo ordering.
122
+        if ( isset( $this->fields ) ) {
123
+            return;
124
+        }
125
+        if ( $type === Object_Type_Enum::POST ) {
126
+            $entity_type = wl_entity_taxonomy_get_custom_fields( $id );
127
+        } else if ( $type === Object_Type_Enum::TERM ) {
128
+            $term_entity_types = get_term_meta( $id, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
129
+            $term_entity_types = array_map( function ( $term ) {
130
+                return get_term_by(
131
+                    'slug',
132
+                    $term,
133
+                    Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME
134
+                );
135
+            }, $term_entity_types );
136
+            $entity_type       = wl_get_custom_fields_by_entity_type( $term_entity_types );
137
+        }
138
+        if ( isset( $entity_type ) ) {
139
+
140
+            /*
141 141
 			 * Might not have any relevant meta box field, for example for articles,
142 142
 			 * therefor make sure fields are at least an empty array to help the considered
143 143
 			 * in other functions using it.
144 144
 			 */
145
-			$this->fields = array();
145
+            $this->fields = array();
146 146
 
147
-			/**
148
-			 * In some special case, properties must be grouped in one field (e.g. coordinates) or dealed with custom methods.
149
-			 * We must divide fields in two groups:
150
-			 * - simple: accept values for one property
151
-			 * - grouped: accept values for more properties, or for one property that needs a specific metabox.
152
-			 */
153
-			$metaboxes         = $this->group_properties_by_input_field( $entity_type );
154
-			$simple_metaboxes  = $metaboxes[0];
155
-			$grouped_metaboxes = $metaboxes[1];
156
-
157
-			// Loop over simple entity properties.
158
-			foreach ( $simple_metaboxes as $key => $property ) {
159
-
160
-				// Info passed to the metabox.
161
-				$info         = array();
162
-				$info[ $key ] = $property;
163
-
164
-				// Build the requested field as WL_Metabox_Field_ object.
165
-				$this->add_field( $info, false, $type, $id );
166
-
167
-			}
168
-
169
-			// Loop over grouped properties.
170
-			foreach ( $grouped_metaboxes as $key => $property ) {
147
+            /**
148
+             * In some special case, properties must be grouped in one field (e.g. coordinates) or dealed with custom methods.
149
+             * We must divide fields in two groups:
150
+             * - simple: accept values for one property
151
+             * - grouped: accept values for more properties, or for one property that needs a specific metabox.
152
+             */
153
+            $metaboxes         = $this->group_properties_by_input_field( $entity_type );
154
+            $simple_metaboxes  = $metaboxes[0];
155
+            $grouped_metaboxes = $metaboxes[1];
171 156
 
172
-				// Info passed to the metabox.
173
-				$info         = array();
174
-				$info[ $key ] = $property;
157
+            // Loop over simple entity properties.
158
+            foreach ( $simple_metaboxes as $key => $property ) {
175 159
 
176
-				// Build the requested field group as WL_Metabox_Field_ object.
177
-				$this->add_field( $info, true, $type, $id );
160
+                // Info passed to the metabox.
161
+                $info         = array();
162
+                $info[ $key ] = $property;
178 163
 
179
-			}
180
-		}
164
+                // Build the requested field as WL_Metabox_Field_ object.
165
+                $this->add_field( $info, false, $type, $id );
181 166
 
182
-	}
167
+            }
183 168
 
184
-	/**
185
-	 * Separates metaboxes in simple and grouped.
186
-	 *
187
-	 * @param array $custom_fields Information on the entity type.
188
-	 *
189
-	 * @return array
190
-	 */
191
-	public function group_properties_by_input_field( $custom_fields ) {
169
+            // Loop over grouped properties.
170
+            foreach ( $grouped_metaboxes as $key => $property ) {
192 171
 
193
-		$simple_properties  = array();
194
-		$grouped_properties = array();
172
+                // Info passed to the metabox.
173
+                $info         = array();
174
+                $info[ $key ] = $property;
195 175
 
196
-		// Loop over possible entity properties.
197
-		foreach ( $custom_fields as $key => $property ) {
198
-
199
-			// Check presence of predicate and type.
200
-			if ( isset( $property['predicate'] ) && isset( $property['type'] ) ) {
201
-
202
-				// Check if input_field is defined.
203
-				if ( isset( $property['input_field'] ) && '' !== $property['input_field'] ) {
204
-
205
-					$grouped_key = $property['input_field'];
206
-
207
-					// Update list of grouped properties.
208
-					$grouped_properties[ $grouped_key ][ $key ] = $property;
209
-
210
-				} else {
211
-
212
-					// input_field not defined, add simple metabox.
213
-					$simple_properties[ $key ] = $property;
214
-				}
215
-			}
216
-		}
217
-
218
-		return array( $simple_properties, $grouped_properties );
219
-	}
220
-
221
-	/**
222
-	 * Add a Field to the current Metabox, based on the description of the Field.
223
-	 * This method is a rude factory for Field objects.
224
-	 *
225
-	 * @param array $args The field's information.
226
-	 * @param bool $grouped Flag to distinguish between simple and grouped fields.
227
-	 * @param int $type Post or Term, based on the correct decorator would be selected.
228
-	 * @param int $id Identifier for the type.
229
-	 */
230
-	public function add_field( $args, $grouped, $type, $id ) {
176
+                // Build the requested field group as WL_Metabox_Field_ object.
177
+                $this->add_field( $info, true, $type, $id );
231 178
 
232
-		if ( $grouped ) {
179
+            }
180
+        }
181
+
182
+    }
233 183
 
234
-			// Special fields (sameas, coordinates, etc.).
235
-			//
236
-			// Build Field with a custom class (e.g. WL_Metabox_Field_date).
237
-			$field_class = 'Wl_Metabox_Field_' . key( $args );
184
+    /**
185
+     * Separates metaboxes in simple and grouped.
186
+     *
187
+     * @param array $custom_fields Information on the entity type.
188
+     *
189
+     * @return array
190
+     */
191
+    public function group_properties_by_input_field( $custom_fields ) {
192
+
193
+        $simple_properties  = array();
194
+        $grouped_properties = array();
195
+
196
+        // Loop over possible entity properties.
197
+        foreach ( $custom_fields as $key => $property ) {
198
+
199
+            // Check presence of predicate and type.
200
+            if ( isset( $property['predicate'] ) && isset( $property['type'] ) ) {
201
+
202
+                // Check if input_field is defined.
203
+                if ( isset( $property['input_field'] ) && '' !== $property['input_field'] ) {
204
+
205
+                    $grouped_key = $property['input_field'];
206
+
207
+                    // Update list of grouped properties.
208
+                    $grouped_properties[ $grouped_key ][ $key ] = $property;
209
+
210
+                } else {
211
+
212
+                    // input_field not defined, add simple metabox.
213
+                    $simple_properties[ $key ] = $property;
214
+                }
215
+            }
216
+        }
217
+
218
+        return array( $simple_properties, $grouped_properties );
219
+    }
220
+
221
+    /**
222
+     * Add a Field to the current Metabox, based on the description of the Field.
223
+     * This method is a rude factory for Field objects.
224
+     *
225
+     * @param array $args The field's information.
226
+     * @param bool $grouped Flag to distinguish between simple and grouped fields.
227
+     * @param int $type Post or Term, based on the correct decorator would be selected.
228
+     * @param int $id Identifier for the type.
229
+     */
230
+    public function add_field( $args, $grouped, $type, $id ) {
238 231
 
239
-		} else {
240
-
241
-			// Simple fields (string, uri, boolean, etc.).
242
-			//
243
-			// Which field? We want to use the class that is specific for the field.
244
-			$meta      = key( $args );
245
-			$this_meta = $args[ $meta ];
246
-
247
-			// If the field declares what metabox it wants, use that one.
248
-			if ( isset( $this_meta['metabox']['class'] ) ) {
249
-
250
-				$field_class = $this_meta['metabox']['class'];
251
-
252
-			} elseif ( ! isset( $this_meta['type'] ) || Wordlift_Schema_Service::DATA_TYPE_STRING === $this_meta['type'] ) {
253
-
254
-				// TODO: all fields should explicitly declare the required WL_Metabox.
255
-				// When they will remove this.
256
-				//
257
-				// Use default Wl_Metabox_Field (manages strings).
258
-				$field_class = 'Wl_Metabox_Field';
259
-
260
-			} else {
261
-
262
-				// TODO: all fields should explicitly declare the required WL_Metabox.
263
-				// When they will remove this.
264
-				//
265
-				// Build Field with a custom class (e.g. Wl_Metabox_Field_date).
266
-				$field_class = 'Wl_Metabox_Field_' . $this_meta['type'];
267
-
268
-			}
269
-
270
-		}
271
-		/**
272
-		 * @since 3.31.6
273
-		 * Add namespace to initialize class.
274
-		 */
275
-		/**
276
-		 * @since 3.31.6
277
-		 * Add namespace to initialize class.
278
-		 */
279
-		if ( substr( $field_class, 0, 1 ) !== '\\' ) {
280
-			$field_class = 'Wordlift\Metabox\Field\\' . $field_class;
281
-			// End if().
282
-		}
283
-
284
-		if ( class_exists( $field_class ) ) {
285
-			// Get decorator and use it as wrapper for save_data and get_data methods.
286
-			$instance = new $field_class( $args, $id, $type );
287
-			// Call apropriate constructor (e.g. Wl_Metabox_Field... ).
288
-			$this->fields[] = $instance;
289
-		}
290
-
291
-	}
292
-
293
-	/**
294
-	 * Save the form data for the specified entity {@link WP_Post}'s id.
295
-	 *
296
-	 * @param int $id The entity's {@link WP_Post}'s id.
297
-	 *
298
-	 * @param $type int Post or term
299
-	 *
300
-	 * @since 3.5.4
301
-	 */
302
-	public function save_form_data( $id, $type ) {
303
-
304
-		$this->log->trace( "Saving form data for entity post $id..." );
305
-
306
-		// Skip saving if the save is called for a different post.
307
-		if ( isset( $_POST['post_ID'] ) && (int) $_POST['post_ID'] !== $id  && $type === Object_Type_Enum::POST ) {
308
-			$this->log->debug( "`wl_metaboxes`, skipping because the post id from request doesnt match the id from filter." );
309
-			return;
310
-		}
311
-
312
-
313
-		// Build Field objects.
314
-		$this->instantiate_fields( $id, $type );
315
-
316
-		// Check if WL metabox form was posted.
317
-		if ( ! isset( $_POST['wl_metaboxes'] ) ) {
318
-			$this->log->debug( "`wl_metaboxes`, skipping..." );
319
-
320
-			return;
321
-		}
322
-
323
-		$posted_data = $_POST['wl_metaboxes'];
324
-
325
-		foreach ( $this->fields as $field ) {
326
-
327
-			// Verify nonce.
328
-			$valid_nonce = $field->verify_nonce();
329
-
330
-			if ( $valid_nonce ) {
331
-				$field_name = $field->meta_name;
332
-				// Each Filed only deals with its values.
333
-				if ( isset( $posted_data[ $field_name ] ) ) {
334
-
335
-					$values = $posted_data[ $field_name ];
336
-					if ( ! is_array( $values ) ) {
337
-						$values = array( $values );
338
-					}
339
-					// Save data permanently
340
-					$field->save_data( $values );
341
-				}
342
-			}
343
-		}
344
-
345
-		/**
346
-		 * Filter: 'wl_save_form_pre_push_entity' - Allow to hook right
347
-		 * before the triples are pushed to the linked dataset.
348
-		 *
349
-		 * @param int $id The entity id.
350
-		 * @param int $id The post data.
351
-		 *
352
-		 * @since  3.18.2
353
-		 *
354
-		 */
355
-		do_action( 'wl_save_form_pre_push_entity', $id, $_POST );
356
-
357
-		do_action( 'wl_legacy_linked_data__push', $id );
358
-
359
-	}
360
-
361
-	/**
362
-	 * Enqueue scripts and styles.
363
-	 *
364
-	 * @since 3.0.0
365
-	 */
366
-	public function enqueue_scripts_and_styles() {
367
-
368
-		// Use the minified version if PW_DEBUG isn't set.
369
-		$min = ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ? '.min' : '';
370
-
371
-		// Load the jquery-ui-timepicker-addon library.
372
-		wp_enqueue_style( 'wl-flatpickr', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . "/admin/js/flatpickr/flatpickr$min.css", array(), '3.0.6' );
373
-		wp_enqueue_script( 'wl-flatpickr', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . "/admin/js/flatpickr/flatpickr$min.js", array( 'jquery' ), '3.0.6', true );
374
-
375
-		// Leaflet.
376
-		wp_enqueue_style( 'wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.css', array(), '1.6.0' );
377
-		wp_enqueue_script( 'wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.js', array(), '1.6.0' );
378
-
379
-		// Add AJAX autocomplete to facilitate metabox editing.
380
-		wp_enqueue_script( 'wl-entity-metabox-utility', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/admin/js/wl_entity_metabox_utilities.js' );
381
-		wp_localize_script( 'wl-entity-metabox-utility', 'wlEntityMetaboxParams', array(
382
-				'ajax_url' => admin_url( 'admin-ajax.php' ),
383
-				'action'   => 'entity_by_title',
384
-			)
385
-		);
386
-
387
-	}
232
+        if ( $grouped ) {
233
+
234
+            // Special fields (sameas, coordinates, etc.).
235
+            //
236
+            // Build Field with a custom class (e.g. WL_Metabox_Field_date).
237
+            $field_class = 'Wl_Metabox_Field_' . key( $args );
238
+
239
+        } else {
240
+
241
+            // Simple fields (string, uri, boolean, etc.).
242
+            //
243
+            // Which field? We want to use the class that is specific for the field.
244
+            $meta      = key( $args );
245
+            $this_meta = $args[ $meta ];
246
+
247
+            // If the field declares what metabox it wants, use that one.
248
+            if ( isset( $this_meta['metabox']['class'] ) ) {
249
+
250
+                $field_class = $this_meta['metabox']['class'];
251
+
252
+            } elseif ( ! isset( $this_meta['type'] ) || Wordlift_Schema_Service::DATA_TYPE_STRING === $this_meta['type'] ) {
253
+
254
+                // TODO: all fields should explicitly declare the required WL_Metabox.
255
+                // When they will remove this.
256
+                //
257
+                // Use default Wl_Metabox_Field (manages strings).
258
+                $field_class = 'Wl_Metabox_Field';
259
+
260
+            } else {
261
+
262
+                // TODO: all fields should explicitly declare the required WL_Metabox.
263
+                // When they will remove this.
264
+                //
265
+                // Build Field with a custom class (e.g. Wl_Metabox_Field_date).
266
+                $field_class = 'Wl_Metabox_Field_' . $this_meta['type'];
267
+
268
+            }
269
+
270
+        }
271
+        /**
272
+         * @since 3.31.6
273
+         * Add namespace to initialize class.
274
+         */
275
+        /**
276
+         * @since 3.31.6
277
+         * Add namespace to initialize class.
278
+         */
279
+        if ( substr( $field_class, 0, 1 ) !== '\\' ) {
280
+            $field_class = 'Wordlift\Metabox\Field\\' . $field_class;
281
+            // End if().
282
+        }
283
+
284
+        if ( class_exists( $field_class ) ) {
285
+            // Get decorator and use it as wrapper for save_data and get_data methods.
286
+            $instance = new $field_class( $args, $id, $type );
287
+            // Call apropriate constructor (e.g. Wl_Metabox_Field... ).
288
+            $this->fields[] = $instance;
289
+        }
290
+
291
+    }
292
+
293
+    /**
294
+     * Save the form data for the specified entity {@link WP_Post}'s id.
295
+     *
296
+     * @param int $id The entity's {@link WP_Post}'s id.
297
+     *
298
+     * @param $type int Post or term
299
+     *
300
+     * @since 3.5.4
301
+     */
302
+    public function save_form_data( $id, $type ) {
303
+
304
+        $this->log->trace( "Saving form data for entity post $id..." );
305
+
306
+        // Skip saving if the save is called for a different post.
307
+        if ( isset( $_POST['post_ID'] ) && (int) $_POST['post_ID'] !== $id  && $type === Object_Type_Enum::POST ) {
308
+            $this->log->debug( "`wl_metaboxes`, skipping because the post id from request doesnt match the id from filter." );
309
+            return;
310
+        }
311
+
312
+
313
+        // Build Field objects.
314
+        $this->instantiate_fields( $id, $type );
315
+
316
+        // Check if WL metabox form was posted.
317
+        if ( ! isset( $_POST['wl_metaboxes'] ) ) {
318
+            $this->log->debug( "`wl_metaboxes`, skipping..." );
319
+
320
+            return;
321
+        }
322
+
323
+        $posted_data = $_POST['wl_metaboxes'];
324
+
325
+        foreach ( $this->fields as $field ) {
326
+
327
+            // Verify nonce.
328
+            $valid_nonce = $field->verify_nonce();
329
+
330
+            if ( $valid_nonce ) {
331
+                $field_name = $field->meta_name;
332
+                // Each Filed only deals with its values.
333
+                if ( isset( $posted_data[ $field_name ] ) ) {
334
+
335
+                    $values = $posted_data[ $field_name ];
336
+                    if ( ! is_array( $values ) ) {
337
+                        $values = array( $values );
338
+                    }
339
+                    // Save data permanently
340
+                    $field->save_data( $values );
341
+                }
342
+            }
343
+        }
344
+
345
+        /**
346
+         * Filter: 'wl_save_form_pre_push_entity' - Allow to hook right
347
+         * before the triples are pushed to the linked dataset.
348
+         *
349
+         * @param int $id The entity id.
350
+         * @param int $id The post data.
351
+         *
352
+         * @since  3.18.2
353
+         *
354
+         */
355
+        do_action( 'wl_save_form_pre_push_entity', $id, $_POST );
356
+
357
+        do_action( 'wl_legacy_linked_data__push', $id );
358
+
359
+    }
360
+
361
+    /**
362
+     * Enqueue scripts and styles.
363
+     *
364
+     * @since 3.0.0
365
+     */
366
+    public function enqueue_scripts_and_styles() {
367
+
368
+        // Use the minified version if PW_DEBUG isn't set.
369
+        $min = ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ? '.min' : '';
370
+
371
+        // Load the jquery-ui-timepicker-addon library.
372
+        wp_enqueue_style( 'wl-flatpickr', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . "/admin/js/flatpickr/flatpickr$min.css", array(), '3.0.6' );
373
+        wp_enqueue_script( 'wl-flatpickr', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . "/admin/js/flatpickr/flatpickr$min.js", array( 'jquery' ), '3.0.6', true );
374
+
375
+        // Leaflet.
376
+        wp_enqueue_style( 'wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.css', array(), '1.6.0' );
377
+        wp_enqueue_script( 'wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.js', array(), '1.6.0' );
378
+
379
+        // Add AJAX autocomplete to facilitate metabox editing.
380
+        wp_enqueue_script( 'wl-entity-metabox-utility', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/admin/js/wl_entity_metabox_utilities.js' );
381
+        wp_localize_script( 'wl-entity-metabox-utility', 'wlEntityMetaboxParams', array(
382
+                'ajax_url' => admin_url( 'admin-ajax.php' ),
383
+                'action'   => 'entity_by_title',
384
+            )
385
+        );
386
+
387
+    }
388 388
 }
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function __construct() {
45 45
 
46
-		$this->log = Wordlift_Log_Service::get_logger( get_class() );
46
+		$this->log = Wordlift_Log_Service::get_logger(get_class());
47 47
 	}
48 48
 
49 49
 	/**
@@ -53,23 +53,23 @@  discard block
 block discarded – undo
53 53
 	public function add_main_metabox() {
54 54
 
55 55
 		// Build the fields we need to print.
56
-		$this->instantiate_fields( get_the_ID(), Object_Type_Enum::POST );
56
+		$this->instantiate_fields(get_the_ID(), Object_Type_Enum::POST);
57 57
 
58 58
 		// Bailout if there are no actual fields, we do not need a metabox in that case.
59
-		if ( empty( $this->fields ) ) {
59
+		if (empty($this->fields)) {
60 60
 			return;
61 61
 		}
62 62
 
63 63
 		// Add main metabox (will print also the inner fields).
64
-		$id    = uniqid( 'wl-metabox-' );
65
-		$title = get_the_title() . ' ' . __( 'properties', 'wordlift' );
64
+		$id    = uniqid('wl-metabox-');
65
+		$title = get_the_title().' '.__('properties', 'wordlift');
66 66
 
67 67
 		// WordPress 4.2 do not accept an array of screens as parameter, have to do be explicit.
68
-		foreach ( Wordlift_Entity_Service::valid_entity_post_types() as $screen ) {
69
-			add_meta_box( $id, $title, array(
68
+		foreach (Wordlift_Entity_Service::valid_entity_post_types() as $screen) {
69
+			add_meta_box($id, $title, array(
70 70
 				$this,
71 71
 				'html',
72
-			), $screen, 'normal', 'high' );
72
+			), $screen, 'normal', 'high');
73 73
 		}
74 74
 
75 75
 		// Add filter to change the metabox CSS class.
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		//  dynamically according to the `get_current_screen()` function.
79 79
 		$current_screen = get_current_screen();
80 80
 		$screen         = $current_screen ? $current_screen->post_type : 'entity';
81
-		add_filter( "postbox_classes_{$screen}_$id", 'wl_admin_metaboxes_add_css_class' );
81
+		add_filter("postbox_classes_{$screen}_$id", 'wl_admin_metaboxes_add_css_class');
82 82
 
83 83
 	}
84 84
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	public function html() {
92 92
 
93 93
 		// Loop over the fields.
94
-		foreach ( $this->fields as $field ) {
94
+		foreach ($this->fields as $field) {
95 95
 
96 96
 			// load data from DB (values will be available in $field->data).
97 97
 			$field->get_data();
@@ -114,28 +114,28 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @since 3.1.0
116 116
 	 */
117
-	public function instantiate_fields( $id, $type ) {
117
+	public function instantiate_fields($id, $type) {
118 118
 
119
-		$this->log->trace( "Instantiating fields for entity post $id..." );
119
+		$this->log->trace("Instantiating fields for entity post $id...");
120 120
 
121 121
 		// This function must be called only once. Not called from the constructor because WP hooks have a rococo ordering.
122
-		if ( isset( $this->fields ) ) {
122
+		if (isset($this->fields)) {
123 123
 			return;
124 124
 		}
125
-		if ( $type === Object_Type_Enum::POST ) {
126
-			$entity_type = wl_entity_taxonomy_get_custom_fields( $id );
127
-		} else if ( $type === Object_Type_Enum::TERM ) {
128
-			$term_entity_types = get_term_meta( $id, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
129
-			$term_entity_types = array_map( function ( $term ) {
125
+		if ($type === Object_Type_Enum::POST) {
126
+			$entity_type = wl_entity_taxonomy_get_custom_fields($id);
127
+		} else if ($type === Object_Type_Enum::TERM) {
128
+			$term_entity_types = get_term_meta($id, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME);
129
+			$term_entity_types = array_map(function($term) {
130 130
 				return get_term_by(
131 131
 					'slug',
132 132
 					$term,
133 133
 					Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME
134 134
 				);
135
-			}, $term_entity_types );
136
-			$entity_type       = wl_get_custom_fields_by_entity_type( $term_entity_types );
135
+			}, $term_entity_types);
136
+			$entity_type = wl_get_custom_fields_by_entity_type($term_entity_types);
137 137
 		}
138
-		if ( isset( $entity_type ) ) {
138
+		if (isset($entity_type)) {
139 139
 
140 140
 			/*
141 141
 			 * Might not have any relevant meta box field, for example for articles,
@@ -150,31 +150,31 @@  discard block
 block discarded – undo
150 150
 			 * - simple: accept values for one property
151 151
 			 * - grouped: accept values for more properties, or for one property that needs a specific metabox.
152 152
 			 */
153
-			$metaboxes         = $this->group_properties_by_input_field( $entity_type );
153
+			$metaboxes         = $this->group_properties_by_input_field($entity_type);
154 154
 			$simple_metaboxes  = $metaboxes[0];
155 155
 			$grouped_metaboxes = $metaboxes[1];
156 156
 
157 157
 			// Loop over simple entity properties.
158
-			foreach ( $simple_metaboxes as $key => $property ) {
158
+			foreach ($simple_metaboxes as $key => $property) {
159 159
 
160 160
 				// Info passed to the metabox.
161 161
 				$info         = array();
162
-				$info[ $key ] = $property;
162
+				$info[$key] = $property;
163 163
 
164 164
 				// Build the requested field as WL_Metabox_Field_ object.
165
-				$this->add_field( $info, false, $type, $id );
165
+				$this->add_field($info, false, $type, $id);
166 166
 
167 167
 			}
168 168
 
169 169
 			// Loop over grouped properties.
170
-			foreach ( $grouped_metaboxes as $key => $property ) {
170
+			foreach ($grouped_metaboxes as $key => $property) {
171 171
 
172 172
 				// Info passed to the metabox.
173 173
 				$info         = array();
174
-				$info[ $key ] = $property;
174
+				$info[$key] = $property;
175 175
 
176 176
 				// Build the requested field group as WL_Metabox_Field_ object.
177
-				$this->add_field( $info, true, $type, $id );
177
+				$this->add_field($info, true, $type, $id);
178 178
 
179 179
 			}
180 180
 		}
@@ -188,34 +188,34 @@  discard block
 block discarded – undo
188 188
 	 *
189 189
 	 * @return array
190 190
 	 */
191
-	public function group_properties_by_input_field( $custom_fields ) {
191
+	public function group_properties_by_input_field($custom_fields) {
192 192
 
193 193
 		$simple_properties  = array();
194 194
 		$grouped_properties = array();
195 195
 
196 196
 		// Loop over possible entity properties.
197
-		foreach ( $custom_fields as $key => $property ) {
197
+		foreach ($custom_fields as $key => $property) {
198 198
 
199 199
 			// Check presence of predicate and type.
200
-			if ( isset( $property['predicate'] ) && isset( $property['type'] ) ) {
200
+			if (isset($property['predicate']) && isset($property['type'])) {
201 201
 
202 202
 				// Check if input_field is defined.
203
-				if ( isset( $property['input_field'] ) && '' !== $property['input_field'] ) {
203
+				if (isset($property['input_field']) && '' !== $property['input_field']) {
204 204
 
205 205
 					$grouped_key = $property['input_field'];
206 206
 
207 207
 					// Update list of grouped properties.
208
-					$grouped_properties[ $grouped_key ][ $key ] = $property;
208
+					$grouped_properties[$grouped_key][$key] = $property;
209 209
 
210 210
 				} else {
211 211
 
212 212
 					// input_field not defined, add simple metabox.
213
-					$simple_properties[ $key ] = $property;
213
+					$simple_properties[$key] = $property;
214 214
 				}
215 215
 			}
216 216
 		}
217 217
 
218
-		return array( $simple_properties, $grouped_properties );
218
+		return array($simple_properties, $grouped_properties);
219 219
 	}
220 220
 
221 221
 	/**
@@ -227,29 +227,29 @@  discard block
 block discarded – undo
227 227
 	 * @param int $type Post or Term, based on the correct decorator would be selected.
228 228
 	 * @param int $id Identifier for the type.
229 229
 	 */
230
-	public function add_field( $args, $grouped, $type, $id ) {
230
+	public function add_field($args, $grouped, $type, $id) {
231 231
 
232
-		if ( $grouped ) {
232
+		if ($grouped) {
233 233
 
234 234
 			// Special fields (sameas, coordinates, etc.).
235 235
 			//
236 236
 			// Build Field with a custom class (e.g. WL_Metabox_Field_date).
237
-			$field_class = 'Wl_Metabox_Field_' . key( $args );
237
+			$field_class = 'Wl_Metabox_Field_'.key($args);
238 238
 
239 239
 		} else {
240 240
 
241 241
 			// Simple fields (string, uri, boolean, etc.).
242 242
 			//
243 243
 			// Which field? We want to use the class that is specific for the field.
244
-			$meta      = key( $args );
245
-			$this_meta = $args[ $meta ];
244
+			$meta      = key($args);
245
+			$this_meta = $args[$meta];
246 246
 
247 247
 			// If the field declares what metabox it wants, use that one.
248
-			if ( isset( $this_meta['metabox']['class'] ) ) {
248
+			if (isset($this_meta['metabox']['class'])) {
249 249
 
250 250
 				$field_class = $this_meta['metabox']['class'];
251 251
 
252
-			} elseif ( ! isset( $this_meta['type'] ) || Wordlift_Schema_Service::DATA_TYPE_STRING === $this_meta['type'] ) {
252
+			} elseif ( ! isset($this_meta['type']) || Wordlift_Schema_Service::DATA_TYPE_STRING === $this_meta['type']) {
253 253
 
254 254
 				// TODO: all fields should explicitly declare the required WL_Metabox.
255 255
 				// When they will remove this.
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 				// When they will remove this.
264 264
 				//
265 265
 				// Build Field with a custom class (e.g. Wl_Metabox_Field_date).
266
-				$field_class = 'Wl_Metabox_Field_' . $this_meta['type'];
266
+				$field_class = 'Wl_Metabox_Field_'.$this_meta['type'];
267 267
 
268 268
 			}
269 269
 
@@ -276,14 +276,14 @@  discard block
 block discarded – undo
276 276
 		 * @since 3.31.6
277 277
 		 * Add namespace to initialize class.
278 278
 		 */
279
-		if ( substr( $field_class, 0, 1 ) !== '\\' ) {
280
-			$field_class = 'Wordlift\Metabox\Field\\' . $field_class;
279
+		if (substr($field_class, 0, 1) !== '\\') {
280
+			$field_class = 'Wordlift\Metabox\Field\\'.$field_class;
281 281
 			// End if().
282 282
 		}
283 283
 
284
-		if ( class_exists( $field_class ) ) {
284
+		if (class_exists($field_class)) {
285 285
 			// Get decorator and use it as wrapper for save_data and get_data methods.
286
-			$instance = new $field_class( $args, $id, $type );
286
+			$instance = new $field_class($args, $id, $type);
287 287
 			// Call apropriate constructor (e.g. Wl_Metabox_Field... ).
288 288
 			$this->fields[] = $instance;
289 289
 		}
@@ -299,45 +299,45 @@  discard block
 block discarded – undo
299 299
 	 *
300 300
 	 * @since 3.5.4
301 301
 	 */
302
-	public function save_form_data( $id, $type ) {
302
+	public function save_form_data($id, $type) {
303 303
 
304
-		$this->log->trace( "Saving form data for entity post $id..." );
304
+		$this->log->trace("Saving form data for entity post $id...");
305 305
 
306 306
 		// Skip saving if the save is called for a different post.
307
-		if ( isset( $_POST['post_ID'] ) && (int) $_POST['post_ID'] !== $id  && $type === Object_Type_Enum::POST ) {
308
-			$this->log->debug( "`wl_metaboxes`, skipping because the post id from request doesnt match the id from filter." );
307
+		if (isset($_POST['post_ID']) && (int) $_POST['post_ID'] !== $id && $type === Object_Type_Enum::POST) {
308
+			$this->log->debug("`wl_metaboxes`, skipping because the post id from request doesnt match the id from filter.");
309 309
 			return;
310 310
 		}
311 311
 
312 312
 
313 313
 		// Build Field objects.
314
-		$this->instantiate_fields( $id, $type );
314
+		$this->instantiate_fields($id, $type);
315 315
 
316 316
 		// Check if WL metabox form was posted.
317
-		if ( ! isset( $_POST['wl_metaboxes'] ) ) {
318
-			$this->log->debug( "`wl_metaboxes`, skipping..." );
317
+		if ( ! isset($_POST['wl_metaboxes'])) {
318
+			$this->log->debug("`wl_metaboxes`, skipping...");
319 319
 
320 320
 			return;
321 321
 		}
322 322
 
323 323
 		$posted_data = $_POST['wl_metaboxes'];
324 324
 
325
-		foreach ( $this->fields as $field ) {
325
+		foreach ($this->fields as $field) {
326 326
 
327 327
 			// Verify nonce.
328 328
 			$valid_nonce = $field->verify_nonce();
329 329
 
330
-			if ( $valid_nonce ) {
330
+			if ($valid_nonce) {
331 331
 				$field_name = $field->meta_name;
332 332
 				// Each Filed only deals with its values.
333
-				if ( isset( $posted_data[ $field_name ] ) ) {
333
+				if (isset($posted_data[$field_name])) {
334 334
 
335
-					$values = $posted_data[ $field_name ];
336
-					if ( ! is_array( $values ) ) {
337
-						$values = array( $values );
335
+					$values = $posted_data[$field_name];
336
+					if ( ! is_array($values)) {
337
+						$values = array($values);
338 338
 					}
339 339
 					// Save data permanently
340
-					$field->save_data( $values );
340
+					$field->save_data($values);
341 341
 				}
342 342
 			}
343 343
 		}
@@ -352,9 +352,9 @@  discard block
 block discarded – undo
352 352
 		 * @since  3.18.2
353 353
 		 *
354 354
 		 */
355
-		do_action( 'wl_save_form_pre_push_entity', $id, $_POST );
355
+		do_action('wl_save_form_pre_push_entity', $id, $_POST);
356 356
 
357
-		do_action( 'wl_legacy_linked_data__push', $id );
357
+		do_action('wl_legacy_linked_data__push', $id);
358 358
 
359 359
 	}
360 360
 
@@ -366,20 +366,20 @@  discard block
 block discarded – undo
366 366
 	public function enqueue_scripts_and_styles() {
367 367
 
368 368
 		// Use the minified version if PW_DEBUG isn't set.
369
-		$min = ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ? '.min' : '';
369
+		$min = ! defined('WP_DEBUG') || ! WP_DEBUG ? '.min' : '';
370 370
 
371 371
 		// Load the jquery-ui-timepicker-addon library.
372
-		wp_enqueue_style( 'wl-flatpickr', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . "/admin/js/flatpickr/flatpickr$min.css", array(), '3.0.6' );
373
-		wp_enqueue_script( 'wl-flatpickr', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . "/admin/js/flatpickr/flatpickr$min.js", array( 'jquery' ), '3.0.6', true );
372
+		wp_enqueue_style('wl-flatpickr', dirname(dirname(plugin_dir_url(__FILE__)))."/admin/js/flatpickr/flatpickr$min.css", array(), '3.0.6');
373
+		wp_enqueue_script('wl-flatpickr', dirname(dirname(plugin_dir_url(__FILE__)))."/admin/js/flatpickr/flatpickr$min.js", array('jquery'), '3.0.6', true);
374 374
 
375 375
 		// Leaflet.
376
-		wp_enqueue_style( 'wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.css', array(), '1.6.0' );
377
-		wp_enqueue_script( 'wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.js', array(), '1.6.0' );
376
+		wp_enqueue_style('wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.css', array(), '1.6.0');
377
+		wp_enqueue_script('wl-leaflet', 'https://unpkg.com/[email protected]/dist/leaflet.js', array(), '1.6.0');
378 378
 
379 379
 		// Add AJAX autocomplete to facilitate metabox editing.
380
-		wp_enqueue_script( 'wl-entity-metabox-utility', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/admin/js/wl_entity_metabox_utilities.js' );
381
-		wp_localize_script( 'wl-entity-metabox-utility', 'wlEntityMetaboxParams', array(
382
-				'ajax_url' => admin_url( 'admin-ajax.php' ),
380
+		wp_enqueue_script('wl-entity-metabox-utility', dirname(dirname(plugin_dir_url(__FILE__))).'/admin/js/wl_entity_metabox_utilities.js');
381
+		wp_localize_script('wl-entity-metabox-utility', 'wlEntityMetaboxParams', array(
382
+				'ajax_url' => admin_url('admin-ajax.php'),
383 383
 				'action'   => 'entity_by_title',
384 384
 			)
385 385
 		);
Please login to merge, or discard this patch.