Completed
Push — develop ( d4ea35...6805d7 )
by David
10:37
created
src/includes/class-wordlift.php 2 patches
Indentation   +1125 added lines, -1125 removed lines patch added patch discarded remove patch
@@ -29,1234 +29,1234 @@
 block discarded – undo
29 29
  */
30 30
 class Wordlift {
31 31
 
32
-	/**
33
-	 * The loader that's responsible for maintaining and registering all hooks that power
34
-	 * the plugin.
35
-	 *
36
-	 * @since    1.0.0
37
-	 * @access   protected
38
-	 * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
39
-	 */
40
-	protected $loader;
41
-
42
-	/**
43
-	 * The unique identifier of this plugin.
44
-	 *
45
-	 * @since    1.0.0
46
-	 * @access   protected
47
-	 * @var      string $plugin_name The string used to uniquely identify this plugin.
48
-	 */
49
-	protected $plugin_name;
50
-
51
-	/**
52
-	 * The current version of the plugin.
53
-	 *
54
-	 * @since    1.0.0
55
-	 * @access   protected
56
-	 * @var      string $version The current version of the plugin.
57
-	 */
58
-	protected $version;
59
-
60
-	/**
61
-	 * The {@link Wordlift_Tinymce_Adapter} instance.
62
-	 *
63
-	 * @since  3.12.0
64
-	 * @access protected
65
-	 * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
66
-	 */
67
-	protected $tinymce_adapter;
68
-
69
-	/**
70
-	 * The Thumbnail service.
71
-	 *
72
-	 * @since  3.1.5
73
-	 * @access private
74
-	 * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
75
-	 */
76
-	private $thumbnail_service;
77
-
78
-	/**
79
-	 * The UI service.
80
-	 *
81
-	 * @since  3.2.0
82
-	 * @access private
83
-	 * @var \Wordlift_UI_Service $ui_service The UI service.
84
-	 */
85
-	private $ui_service;
86
-
87
-	/**
88
-	 * The Schema service.
89
-	 *
90
-	 * @since  3.3.0
91
-	 * @access private
92
-	 * @var \Wordlift_Schema_Service $schema_service The Schema service.
93
-	 */
94
-	private $schema_service;
95
-
96
-	/**
97
-	 * The Entity service.
98
-	 *
99
-	 * @since  3.1.0
100
-	 * @access protected
101
-	 * @var \Wordlift_Entity_Service $entity_service The Entity service.
102
-	 */
103
-	protected $entity_service;
104
-
105
-	/**
106
-	 * The Topic Taxonomy service.
107
-	 *
108
-	 * @since  3.5.0
109
-	 * @access private
110
-	 * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
111
-	 */
112
-	private $topic_taxonomy_service;
113
-
114
-	/**
115
-	 * The User service.
116
-	 *
117
-	 * @since  3.1.7
118
-	 * @access protected
119
-	 * @var \Wordlift_User_Service $user_service The User service.
120
-	 */
121
-	protected $user_service;
122
-
123
-	/**
124
-	 * The Timeline service.
125
-	 *
126
-	 * @since  3.1.0
127
-	 * @access private
128
-	 * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
129
-	 */
130
-	private $timeline_service;
131
-
132
-	/**
133
-	 * The Redirect service.
134
-	 *
135
-	 * @since  3.2.0
136
-	 * @access private
137
-	 * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
138
-	 */
139
-	private $redirect_service;
140
-
141
-	/**
142
-	 * The Notice service.
143
-	 *
144
-	 * @since  3.3.0
145
-	 * @access private
146
-	 * @var \Wordlift_Notice_Service $notice_service The Notice service.
147
-	 */
148
-	private $notice_service;
149
-
150
-	/**
151
-	 * The Entity list customization.
152
-	 *
153
-	 * @since  3.3.0
154
-	 * @access private
155
-	 * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
156
-	 */
157
-	private $entity_list_service;
158
-
159
-	/**
160
-	 * The Entity Types Taxonomy Walker.
161
-	 *
162
-	 * @since  3.1.0
163
-	 * @access private
164
-	 * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
165
-	 */
166
-	private $entity_types_taxonomy_walker;
167
-
168
-	/**
169
-	 * The ShareThis service.
170
-	 *
171
-	 * @since  3.2.0
172
-	 * @access private
173
-	 * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
174
-	 */
175
-	private $sharethis_service;
176
-
177
-	/**
178
-	 * The PrimaShop adapter.
179
-	 *
180
-	 * @since  3.2.3
181
-	 * @access private
182
-	 * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
183
-	 */
184
-	private $primashop_adapter;
185
-
186
-	/**
187
-	 * The WordLift Dashboard adapter.
188
-	 *
189
-	 * @since  3.4.0
190
-	 * @access private
191
-	 * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
192
-	 */
193
-	private $dashboard_service;
194
-
195
-	/**
196
-	 * The entity type service.
197
-	 *
198
-	 * @since  3.6.0
199
-	 * @access private
200
-	 * @var \Wordlift_Entity_Post_Type_Service
201
-	 */
202
-	private $entity_post_type_service;
203
-
204
-	/**
205
-	 * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
206
-	 *
207
-	 * @since  3.6.0
208
-	 * @access private
209
-	 * @var \Wordlift_Entity_Link_Service
210
-	 */
211
-	private $entity_link_service;
212
-
213
-	/**
214
-	 * A {@link Wordlift_Sparql_Service} instance.
215
-	 *
216
-	 * @var    3.6.0
217
-	 * @access protected
218
-	 * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
219
-	 */
220
-	protected $sparql_service;
221
-
222
-	/**
223
-	 * A {@link Wordlift_Import_Service} instance.
224
-	 *
225
-	 * @since  3.6.0
226
-	 * @access private
227
-	 * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
228
-	 */
229
-	private $import_service;
230
-
231
-	/**
232
-	 * A {@link Wordlift_Rebuild_Service} instance.
233
-	 *
234
-	 * @since  3.6.0
235
-	 * @access private
236
-	 * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
237
-	 */
238
-	private $rebuild_service;
239
-
240
-	/**
241
-	 * A {@link Wordlift_Jsonld_Service} instance.
242
-	 *
243
-	 * @since  3.7.0
244
-	 * @access protected
245
-	 * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
246
-	 */
247
-	protected $jsonld_service;
248
-
249
-	/**
250
-	 *
251
-	 * @since  3.7.0
252
-	 * @access private
253
-	 * @var \Wordlift_Property_Factory $property_factory
254
-	 */
255
-	private $property_factory;
256
-
257
-	/**
258
-	 * The 'Download Your Data' page.
259
-	 *
260
-	 * @since  3.6.0
261
-	 * @access private
262
-	 * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
263
-	 */
264
-	private $download_your_data_page;
265
-
266
-	/**
267
-	 * The 'WordLift Settings' page.
268
-	 *
269
-	 * @since  3.11.0
270
-	 * @access protected
271
-	 * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
272
-	 */
273
-	protected $settings_page;
274
-
275
-	/**
276
-	 * The install wizard page.
277
-	 *
278
-	 * @since  3.9.0
279
-	 * @access private
280
-	 * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
281
-	 */
282
-	private $admin_setup;
283
-
284
-	/**
285
-	 * The Content Filter Service hooks up to the 'the_content' filter and provides
286
-	 * linking of entities to their pages.
287
-	 *
288
-	 * @since  3.8.0
289
-	 * @access private
290
-	 * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
291
-	 */
292
-	private $content_filter_service;
293
-
294
-	/**
295
-	 * A {@link Wordlift_Key_Validation_Service} instance.
296
-	 *
297
-	 * @since  3.9.0
298
-	 * @access private
299
-	 * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
300
-	 */
301
-	private $key_validation_service;
302
-
303
-	/**
304
-	 * A {@link Wordlift_Rating_Service} instance.
305
-	 *
306
-	 * @since  3.10.0
307
-	 * @access private
308
-	 * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
309
-	 */
310
-	private $rating_service;
311
-
312
-	/**
313
-	 * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
314
-	 *
315
-	 * @since  3.10.0
316
-	 * @access protected
317
-	 * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
318
-	 */
319
-	protected $post_to_jsonld_converter;
320
-
321
-	/**
322
-	 * A {@link Wordlift_Configuration_Service} instance.
323
-	 *
324
-	 * @since  3.10.0
325
-	 * @access protected
326
-	 * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
327
-	 */
328
-	protected $configuration_service;
329
-
330
-	/**
331
-	 * A {@link Wordlift_Entity_Type_Service} instance.
332
-	 *
333
-	 * @since  3.10.0
334
-	 * @access protected
335
-	 * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
336
-	 */
337
-	protected $entity_type_service;
338
-
339
-	/**
340
-	 * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
341
-	 *
342
-	 * @since  3.10.0
343
-	 * @access protected
344
-	 * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
345
-	 */
346
-	protected $entity_post_to_jsonld_converter;
347
-
348
-	/**
349
-	 * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
350
-	 *
351
-	 * @since  3.10.0
352
-	 * @access protected
353
-	 * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
354
-	 */
355
-	protected $postid_to_jsonld_converter;
356
-
357
-	/**
358
-	 * The {@link Wordlift_Admin_Status_Page} class.
359
-	 *
360
-	 * @since  3.9.8
361
-	 * @access private
362
-	 * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
363
-	 */
364
-	private $status_page;
365
-
366
-	/**
367
-	 * The {@link Wordlift_Category_Taxonomy_Service} instance.
368
-	 *
369
-	 * @since  3.11.0
370
-	 * @access protected
371
-	 * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
372
-	 */
373
-	protected $category_taxonomy_service;
374
-
375
-	/**
376
-	 * The {@link Wordlift_Event_Entity_Page_Service} instance.
377
-	 *
378
-	 * @since  3.11.0
379
-	 * @access protected
380
-	 * @var \Wordlift_Event_Entity_Page_Service $event_entity_page_service The {@link Wordlift_Event_Entity_Page_Service} instance.
381
-	 */
382
-	protected $event_entity_page_service;
383
-
384
-	/**
385
-	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
386
-	 *
387
-	 * @since  3.11.0
388
-	 * @access protected
389
-	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
390
-	 */
391
-	protected $settings_page_action_link;
392
-
393
-	/**
394
-	 * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
395
-	 *
396
-	 * @since  3.11.0
397
-	 * @access protected
398
-	 * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
399
-	 */
400
-	protected $publisher_ajax_adapter;
401
-
402
-	/**
403
-	 * The {@link Wordlift_Admin_Input_Element} element renderer.
404
-	 *
405
-	 * @since  3.11.0
406
-	 * @access protected
407
-	 * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
408
-	 */
409
-	protected $input_element;
410
-
411
-	/**
412
-	 * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
413
-	 *
414
-	 * @since  3.13.0
415
-	 * @access protected
416
-	 * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
417
-	 */
418
-	protected $radio_input_element;
419
-
420
-	/**
421
-	 * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
422
-	 *
423
-	 * @since  3.11.0
424
-	 * @access protected
425
-	 * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
426
-	 */
427
-	protected $language_select_element;
428
-
429
-	/**
430
-	 * The {@link Wordlift_Admin_Publisher_Element} element renderer.
431
-	 *
432
-	 * @since  3.11.0
433
-	 * @access protected
434
-	 * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
435
-	 */
436
-	protected $publisher_element;
437
-
438
-	/**
439
-	 * The {@link Wordlift_Admin_Select2_Element} element renderer.
440
-	 *
441
-	 * @since  3.11.0
442
-	 * @access protected
443
-	 * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
444
-	 */
445
-	protected $select2_element;
446
-
447
-	/**
448
-	 * The controller for the entity type list admin page
449
-	 *
450
-	 * @since  3.11.0
451
-	 * @access private
452
-	 * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
453
-	 */
454
-	private $entity_type_admin_page;
455
-
456
-	/**
457
-	 * The controller for the entity type settings admin page
458
-	 *
459
-	 * @since  3.11.0
460
-	 * @access private
461
-	 * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
462
-	 */
463
-	private $entity_type_settings_admin_page;
464
-
465
-	/**
466
-	 * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
467
-	 *
468
-	 * @since  3.11.0
469
-	 * @access protected
470
-	 * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
471
-	 */
472
-	protected $related_entities_cloud_widget;
473
-
474
-	/**
475
-	 * The {@link Wordlift_Admin_Author_Element} instance.
476
-	 *
477
-	 * @since  3.14.0
478
-	 * @access protected
479
-	 * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
480
-	 */
481
-	protected $author_element;
482
-
483
-	/**
484
-	 * {@link Wordlift}'s singleton instance.
485
-	 *
486
-	 * @since  3.11.2
487
-	 *
488
-	 * @since  3.11.2
489
-	 * @access private
490
-	 * @var Wordlift $instance {@link Wordlift}'s singleton instance.
491
-	 */
492
-	private static $instance;
493
-
494
-	/**
495
-	 * Define the core functionality of the plugin.
496
-	 *
497
-	 * Set the plugin name and the plugin version that can be used throughout the plugin.
498
-	 * Load the dependencies, define the locale, and set the hooks for the admin area and
499
-	 * the public-facing side of the site.
500
-	 *
501
-	 * @since    1.0.0
502
-	 */
503
-	public function __construct() {
504
-
505
-		$this->plugin_name = 'wordlift';
506
-		$this->version     = '3.14.0-dev';
507
-		$this->load_dependencies();
508
-		$this->set_locale();
509
-		$this->define_admin_hooks();
510
-		$this->define_public_hooks();
511
-
512
-		self::$instance = $this;
513
-
514
-	}
515
-
516
-	/**
517
-	 * Get the singleton instance.
518
-	 *
519
-	 * @since 3.11.2
520
-	 *
521
-	 * @return Wordlift The {@link Wordlift} singleton instance.
522
-	 */
523
-	public static function get_instance() {
524
-
525
-		return self::$instance;
526
-	}
527
-
528
-	/**
529
-	 * Load the required dependencies for this plugin.
530
-	 *
531
-	 * Include the following files that make up the plugin:
532
-	 *
533
-	 * - Wordlift_Loader. Orchestrates the hooks of the plugin.
534
-	 * - Wordlift_i18n. Defines internationalization functionality.
535
-	 * - Wordlift_Admin. Defines all hooks for the admin area.
536
-	 * - Wordlift_Public. Defines all hooks for the public side of the site.
537
-	 *
538
-	 * Create an instance of the loader which will be used to register the hooks
539
-	 * with WordPress.
540
-	 *
541
-	 * @since    1.0.0
542
-	 * @access   private
543
-	 */
544
-	private function load_dependencies() {
545
-
546
-		/**
547
-		 * The class responsible for orchestrating the actions and filters of the
548
-		 * core plugin.
549
-		 */
550
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
551
-
552
-		/**
553
-		 * The class responsible for defining internationalization functionality
554
-		 * of the plugin.
555
-		 */
556
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
557
-
558
-		/**
559
-		 * WordLift's supported languages.
560
-		 */
561
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
562
-
563
-		/**
564
-		 * Provide support functions to sanitize data.
565
-		 */
566
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
567
-
568
-		/**
569
-		 * The Redirect service.
570
-		 */
571
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
572
-
573
-		/**
574
-		 * The Log service.
575
-		 */
576
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
577
-
578
-		/**
579
-		 * The configuration service.
580
-		 */
581
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
582
-
583
-		/**
584
-		 * The entity post type service (this is the WordPress post type, not the entity schema type).
585
-		 */
586
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
587
-
588
-		/**
589
-		 * The entity type service (i.e. the schema type).
590
-		 */
591
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
592
-
593
-		/**
594
-		 * The entity link service.
595
-		 */
596
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
597
-
598
-		/**
599
-		 * The Query builder.
600
-		 */
601
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
602
-
603
-		/**
604
-		 * The Schema service.
605
-		 */
606
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
607
-
608
-		/**
609
-		 * The schema:url property service.
610
-		 */
611
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
612
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
613
-
614
-		/**
615
-		 * The UI service.
616
-		 */
617
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
618
-
619
-		/**
620
-		 * The Thumbnail service.
621
-		 */
622
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
623
-
624
-		/**
625
-		 * The Entity Types Taxonomy service.
626
-		 */
627
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
628
-
629
-		/**
630
-		 * The Entity service.
631
-		 */
632
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
633
-
634
-		// Add the entity rating service.
635
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
636
-
637
-		/**
638
-		 * The User service.
639
-		 */
640
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
641
-
642
-		/**
643
-		 * The Timeline service.
644
-		 */
645
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
646
-
647
-		/**
648
-		 * The Topic Taxonomy service.
649
-		 */
650
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
651
-
652
-		/**
653
-		 * The SPARQL service.
654
-		 */
655
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
656
-
657
-		/**
658
-		 * The WordLift import service.
659
-		 */
660
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
661
-
662
-		/**
663
-		 * The WordLift URI service.
664
-		 */
665
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
666
-
667
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php';
668
-
669
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
670
-
671
-		/**
672
-		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
673
-		 */
674
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php';
675
-
676
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
677
-
678
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
679
-
680
-		/**
681
-		 * Load the converters.
682
-		 */
683
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
684
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
685
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
686
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
687
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
688
-
689
-		/**
690
-		 * Load the content filter.
691
-		 */
692
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
693
-
694
-		/*
32
+    /**
33
+     * The loader that's responsible for maintaining and registering all hooks that power
34
+     * the plugin.
35
+     *
36
+     * @since    1.0.0
37
+     * @access   protected
38
+     * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
39
+     */
40
+    protected $loader;
41
+
42
+    /**
43
+     * The unique identifier of this plugin.
44
+     *
45
+     * @since    1.0.0
46
+     * @access   protected
47
+     * @var      string $plugin_name The string used to uniquely identify this plugin.
48
+     */
49
+    protected $plugin_name;
50
+
51
+    /**
52
+     * The current version of the plugin.
53
+     *
54
+     * @since    1.0.0
55
+     * @access   protected
56
+     * @var      string $version The current version of the plugin.
57
+     */
58
+    protected $version;
59
+
60
+    /**
61
+     * The {@link Wordlift_Tinymce_Adapter} instance.
62
+     *
63
+     * @since  3.12.0
64
+     * @access protected
65
+     * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
66
+     */
67
+    protected $tinymce_adapter;
68
+
69
+    /**
70
+     * The Thumbnail service.
71
+     *
72
+     * @since  3.1.5
73
+     * @access private
74
+     * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
75
+     */
76
+    private $thumbnail_service;
77
+
78
+    /**
79
+     * The UI service.
80
+     *
81
+     * @since  3.2.0
82
+     * @access private
83
+     * @var \Wordlift_UI_Service $ui_service The UI service.
84
+     */
85
+    private $ui_service;
86
+
87
+    /**
88
+     * The Schema service.
89
+     *
90
+     * @since  3.3.0
91
+     * @access private
92
+     * @var \Wordlift_Schema_Service $schema_service The Schema service.
93
+     */
94
+    private $schema_service;
95
+
96
+    /**
97
+     * The Entity service.
98
+     *
99
+     * @since  3.1.0
100
+     * @access protected
101
+     * @var \Wordlift_Entity_Service $entity_service The Entity service.
102
+     */
103
+    protected $entity_service;
104
+
105
+    /**
106
+     * The Topic Taxonomy service.
107
+     *
108
+     * @since  3.5.0
109
+     * @access private
110
+     * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
111
+     */
112
+    private $topic_taxonomy_service;
113
+
114
+    /**
115
+     * The User service.
116
+     *
117
+     * @since  3.1.7
118
+     * @access protected
119
+     * @var \Wordlift_User_Service $user_service The User service.
120
+     */
121
+    protected $user_service;
122
+
123
+    /**
124
+     * The Timeline service.
125
+     *
126
+     * @since  3.1.0
127
+     * @access private
128
+     * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
129
+     */
130
+    private $timeline_service;
131
+
132
+    /**
133
+     * The Redirect service.
134
+     *
135
+     * @since  3.2.0
136
+     * @access private
137
+     * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
138
+     */
139
+    private $redirect_service;
140
+
141
+    /**
142
+     * The Notice service.
143
+     *
144
+     * @since  3.3.0
145
+     * @access private
146
+     * @var \Wordlift_Notice_Service $notice_service The Notice service.
147
+     */
148
+    private $notice_service;
149
+
150
+    /**
151
+     * The Entity list customization.
152
+     *
153
+     * @since  3.3.0
154
+     * @access private
155
+     * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
156
+     */
157
+    private $entity_list_service;
158
+
159
+    /**
160
+     * The Entity Types Taxonomy Walker.
161
+     *
162
+     * @since  3.1.0
163
+     * @access private
164
+     * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
165
+     */
166
+    private $entity_types_taxonomy_walker;
167
+
168
+    /**
169
+     * The ShareThis service.
170
+     *
171
+     * @since  3.2.0
172
+     * @access private
173
+     * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
174
+     */
175
+    private $sharethis_service;
176
+
177
+    /**
178
+     * The PrimaShop adapter.
179
+     *
180
+     * @since  3.2.3
181
+     * @access private
182
+     * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
183
+     */
184
+    private $primashop_adapter;
185
+
186
+    /**
187
+     * The WordLift Dashboard adapter.
188
+     *
189
+     * @since  3.4.0
190
+     * @access private
191
+     * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
192
+     */
193
+    private $dashboard_service;
194
+
195
+    /**
196
+     * The entity type service.
197
+     *
198
+     * @since  3.6.0
199
+     * @access private
200
+     * @var \Wordlift_Entity_Post_Type_Service
201
+     */
202
+    private $entity_post_type_service;
203
+
204
+    /**
205
+     * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
206
+     *
207
+     * @since  3.6.0
208
+     * @access private
209
+     * @var \Wordlift_Entity_Link_Service
210
+     */
211
+    private $entity_link_service;
212
+
213
+    /**
214
+     * A {@link Wordlift_Sparql_Service} instance.
215
+     *
216
+     * @var    3.6.0
217
+     * @access protected
218
+     * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
219
+     */
220
+    protected $sparql_service;
221
+
222
+    /**
223
+     * A {@link Wordlift_Import_Service} instance.
224
+     *
225
+     * @since  3.6.0
226
+     * @access private
227
+     * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
228
+     */
229
+    private $import_service;
230
+
231
+    /**
232
+     * A {@link Wordlift_Rebuild_Service} instance.
233
+     *
234
+     * @since  3.6.0
235
+     * @access private
236
+     * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
237
+     */
238
+    private $rebuild_service;
239
+
240
+    /**
241
+     * A {@link Wordlift_Jsonld_Service} instance.
242
+     *
243
+     * @since  3.7.0
244
+     * @access protected
245
+     * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
246
+     */
247
+    protected $jsonld_service;
248
+
249
+    /**
250
+     *
251
+     * @since  3.7.0
252
+     * @access private
253
+     * @var \Wordlift_Property_Factory $property_factory
254
+     */
255
+    private $property_factory;
256
+
257
+    /**
258
+     * The 'Download Your Data' page.
259
+     *
260
+     * @since  3.6.0
261
+     * @access private
262
+     * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
263
+     */
264
+    private $download_your_data_page;
265
+
266
+    /**
267
+     * The 'WordLift Settings' page.
268
+     *
269
+     * @since  3.11.0
270
+     * @access protected
271
+     * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
272
+     */
273
+    protected $settings_page;
274
+
275
+    /**
276
+     * The install wizard page.
277
+     *
278
+     * @since  3.9.0
279
+     * @access private
280
+     * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
281
+     */
282
+    private $admin_setup;
283
+
284
+    /**
285
+     * The Content Filter Service hooks up to the 'the_content' filter and provides
286
+     * linking of entities to their pages.
287
+     *
288
+     * @since  3.8.0
289
+     * @access private
290
+     * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
291
+     */
292
+    private $content_filter_service;
293
+
294
+    /**
295
+     * A {@link Wordlift_Key_Validation_Service} instance.
296
+     *
297
+     * @since  3.9.0
298
+     * @access private
299
+     * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
300
+     */
301
+    private $key_validation_service;
302
+
303
+    /**
304
+     * A {@link Wordlift_Rating_Service} instance.
305
+     *
306
+     * @since  3.10.0
307
+     * @access private
308
+     * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
309
+     */
310
+    private $rating_service;
311
+
312
+    /**
313
+     * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
314
+     *
315
+     * @since  3.10.0
316
+     * @access protected
317
+     * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
318
+     */
319
+    protected $post_to_jsonld_converter;
320
+
321
+    /**
322
+     * A {@link Wordlift_Configuration_Service} instance.
323
+     *
324
+     * @since  3.10.0
325
+     * @access protected
326
+     * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
327
+     */
328
+    protected $configuration_service;
329
+
330
+    /**
331
+     * A {@link Wordlift_Entity_Type_Service} instance.
332
+     *
333
+     * @since  3.10.0
334
+     * @access protected
335
+     * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
336
+     */
337
+    protected $entity_type_service;
338
+
339
+    /**
340
+     * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
341
+     *
342
+     * @since  3.10.0
343
+     * @access protected
344
+     * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
345
+     */
346
+    protected $entity_post_to_jsonld_converter;
347
+
348
+    /**
349
+     * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
350
+     *
351
+     * @since  3.10.0
352
+     * @access protected
353
+     * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
354
+     */
355
+    protected $postid_to_jsonld_converter;
356
+
357
+    /**
358
+     * The {@link Wordlift_Admin_Status_Page} class.
359
+     *
360
+     * @since  3.9.8
361
+     * @access private
362
+     * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
363
+     */
364
+    private $status_page;
365
+
366
+    /**
367
+     * The {@link Wordlift_Category_Taxonomy_Service} instance.
368
+     *
369
+     * @since  3.11.0
370
+     * @access protected
371
+     * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
372
+     */
373
+    protected $category_taxonomy_service;
374
+
375
+    /**
376
+     * The {@link Wordlift_Event_Entity_Page_Service} instance.
377
+     *
378
+     * @since  3.11.0
379
+     * @access protected
380
+     * @var \Wordlift_Event_Entity_Page_Service $event_entity_page_service The {@link Wordlift_Event_Entity_Page_Service} instance.
381
+     */
382
+    protected $event_entity_page_service;
383
+
384
+    /**
385
+     * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
386
+     *
387
+     * @since  3.11.0
388
+     * @access protected
389
+     * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
390
+     */
391
+    protected $settings_page_action_link;
392
+
393
+    /**
394
+     * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
395
+     *
396
+     * @since  3.11.0
397
+     * @access protected
398
+     * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
399
+     */
400
+    protected $publisher_ajax_adapter;
401
+
402
+    /**
403
+     * The {@link Wordlift_Admin_Input_Element} element renderer.
404
+     *
405
+     * @since  3.11.0
406
+     * @access protected
407
+     * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
408
+     */
409
+    protected $input_element;
410
+
411
+    /**
412
+     * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
413
+     *
414
+     * @since  3.13.0
415
+     * @access protected
416
+     * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
417
+     */
418
+    protected $radio_input_element;
419
+
420
+    /**
421
+     * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
422
+     *
423
+     * @since  3.11.0
424
+     * @access protected
425
+     * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
426
+     */
427
+    protected $language_select_element;
428
+
429
+    /**
430
+     * The {@link Wordlift_Admin_Publisher_Element} element renderer.
431
+     *
432
+     * @since  3.11.0
433
+     * @access protected
434
+     * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
435
+     */
436
+    protected $publisher_element;
437
+
438
+    /**
439
+     * The {@link Wordlift_Admin_Select2_Element} element renderer.
440
+     *
441
+     * @since  3.11.0
442
+     * @access protected
443
+     * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
444
+     */
445
+    protected $select2_element;
446
+
447
+    /**
448
+     * The controller for the entity type list admin page
449
+     *
450
+     * @since  3.11.0
451
+     * @access private
452
+     * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
453
+     */
454
+    private $entity_type_admin_page;
455
+
456
+    /**
457
+     * The controller for the entity type settings admin page
458
+     *
459
+     * @since  3.11.0
460
+     * @access private
461
+     * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
462
+     */
463
+    private $entity_type_settings_admin_page;
464
+
465
+    /**
466
+     * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
467
+     *
468
+     * @since  3.11.0
469
+     * @access protected
470
+     * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
471
+     */
472
+    protected $related_entities_cloud_widget;
473
+
474
+    /**
475
+     * The {@link Wordlift_Admin_Author_Element} instance.
476
+     *
477
+     * @since  3.14.0
478
+     * @access protected
479
+     * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
480
+     */
481
+    protected $author_element;
482
+
483
+    /**
484
+     * {@link Wordlift}'s singleton instance.
485
+     *
486
+     * @since  3.11.2
487
+     *
488
+     * @since  3.11.2
489
+     * @access private
490
+     * @var Wordlift $instance {@link Wordlift}'s singleton instance.
491
+     */
492
+    private static $instance;
493
+
494
+    /**
495
+     * Define the core functionality of the plugin.
496
+     *
497
+     * Set the plugin name and the plugin version that can be used throughout the plugin.
498
+     * Load the dependencies, define the locale, and set the hooks for the admin area and
499
+     * the public-facing side of the site.
500
+     *
501
+     * @since    1.0.0
502
+     */
503
+    public function __construct() {
504
+
505
+        $this->plugin_name = 'wordlift';
506
+        $this->version     = '3.14.0-dev';
507
+        $this->load_dependencies();
508
+        $this->set_locale();
509
+        $this->define_admin_hooks();
510
+        $this->define_public_hooks();
511
+
512
+        self::$instance = $this;
513
+
514
+    }
515
+
516
+    /**
517
+     * Get the singleton instance.
518
+     *
519
+     * @since 3.11.2
520
+     *
521
+     * @return Wordlift The {@link Wordlift} singleton instance.
522
+     */
523
+    public static function get_instance() {
524
+
525
+        return self::$instance;
526
+    }
527
+
528
+    /**
529
+     * Load the required dependencies for this plugin.
530
+     *
531
+     * Include the following files that make up the plugin:
532
+     *
533
+     * - Wordlift_Loader. Orchestrates the hooks of the plugin.
534
+     * - Wordlift_i18n. Defines internationalization functionality.
535
+     * - Wordlift_Admin. Defines all hooks for the admin area.
536
+     * - Wordlift_Public. Defines all hooks for the public side of the site.
537
+     *
538
+     * Create an instance of the loader which will be used to register the hooks
539
+     * with WordPress.
540
+     *
541
+     * @since    1.0.0
542
+     * @access   private
543
+     */
544
+    private function load_dependencies() {
545
+
546
+        /**
547
+         * The class responsible for orchestrating the actions and filters of the
548
+         * core plugin.
549
+         */
550
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
551
+
552
+        /**
553
+         * The class responsible for defining internationalization functionality
554
+         * of the plugin.
555
+         */
556
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
557
+
558
+        /**
559
+         * WordLift's supported languages.
560
+         */
561
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
562
+
563
+        /**
564
+         * Provide support functions to sanitize data.
565
+         */
566
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
567
+
568
+        /**
569
+         * The Redirect service.
570
+         */
571
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
572
+
573
+        /**
574
+         * The Log service.
575
+         */
576
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
577
+
578
+        /**
579
+         * The configuration service.
580
+         */
581
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
582
+
583
+        /**
584
+         * The entity post type service (this is the WordPress post type, not the entity schema type).
585
+         */
586
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
587
+
588
+        /**
589
+         * The entity type service (i.e. the schema type).
590
+         */
591
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
592
+
593
+        /**
594
+         * The entity link service.
595
+         */
596
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
597
+
598
+        /**
599
+         * The Query builder.
600
+         */
601
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
602
+
603
+        /**
604
+         * The Schema service.
605
+         */
606
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
607
+
608
+        /**
609
+         * The schema:url property service.
610
+         */
611
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
612
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
613
+
614
+        /**
615
+         * The UI service.
616
+         */
617
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
618
+
619
+        /**
620
+         * The Thumbnail service.
621
+         */
622
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
623
+
624
+        /**
625
+         * The Entity Types Taxonomy service.
626
+         */
627
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
628
+
629
+        /**
630
+         * The Entity service.
631
+         */
632
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
633
+
634
+        // Add the entity rating service.
635
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
636
+
637
+        /**
638
+         * The User service.
639
+         */
640
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
641
+
642
+        /**
643
+         * The Timeline service.
644
+         */
645
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
646
+
647
+        /**
648
+         * The Topic Taxonomy service.
649
+         */
650
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
651
+
652
+        /**
653
+         * The SPARQL service.
654
+         */
655
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
656
+
657
+        /**
658
+         * The WordLift import service.
659
+         */
660
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
661
+
662
+        /**
663
+         * The WordLift URI service.
664
+         */
665
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
666
+
667
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php';
668
+
669
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
670
+
671
+        /**
672
+         * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
673
+         */
674
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php';
675
+
676
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
677
+
678
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
679
+
680
+        /**
681
+         * Load the converters.
682
+         */
683
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
684
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
685
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
686
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
687
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
688
+
689
+        /**
690
+         * Load the content filter.
691
+         */
692
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
693
+
694
+        /*
695 695
 		 * Load the excerpt helper.
696 696
 		 */
697
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
698
-
699
-		/**
700
-		 * Load the JSON-LD service to publish entities using JSON-LD.s
701
-		 *
702
-		 * @since 3.8.0
703
-		 */
704
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
705
-
706
-		// The Publisher Service and the AJAX adapter.
707
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
708
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
709
-
710
-		/**
711
-		 * Load the WordLift key validation service.
712
-		 */
713
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
714
-
715
-		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
716
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
717
-
718
-		// Load the `Wordlift_Event_Entity_Page_Service` class definition.
719
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-event-entity-page-service.php';
720
-
721
-		/** Adapters. */
722
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
723
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
724
-
725
-		/** Async Tasks. */
726
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/wp-async-task.php';
727
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
728
-
729
-		/**
730
-		 * The class responsible for defining all actions that occur in the admin area.
731
-		 */
732
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
733
-
734
-		/**
735
-		 * The class to customize the entity list admin page.
736
-		 */
737
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
738
-
739
-		/**
740
-		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
741
-		 */
742
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
743
-
744
-		/**
745
-		 * The Notice service.
746
-		 */
747
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
748
-
749
-		/**
750
-		 * The PrimaShop adapter.
751
-		 */
752
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
753
-
754
-		/**
755
-		 * The WordLift Dashboard service.
756
-		 */
757
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
758
-
759
-		/**
760
-		 * The admin 'Install wizard' page.
761
-		 */
762
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
763
-
764
-		/**
765
-		 * The WordLift entity type list admin page controller.
766
-		 */
767
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
697
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
698
+
699
+        /**
700
+         * Load the JSON-LD service to publish entities using JSON-LD.s
701
+         *
702
+         * @since 3.8.0
703
+         */
704
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
705
+
706
+        // The Publisher Service and the AJAX adapter.
707
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
708
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
709
+
710
+        /**
711
+         * Load the WordLift key validation service.
712
+         */
713
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
714
+
715
+        // Load the `Wordlift_Category_Taxonomy_Service` class definition.
716
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
717
+
718
+        // Load the `Wordlift_Event_Entity_Page_Service` class definition.
719
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-event-entity-page-service.php';
720
+
721
+        /** Adapters. */
722
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
723
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
724
+
725
+        /** Async Tasks. */
726
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/wp-async-task.php';
727
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
728
+
729
+        /**
730
+         * The class responsible for defining all actions that occur in the admin area.
731
+         */
732
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
733
+
734
+        /**
735
+         * The class to customize the entity list admin page.
736
+         */
737
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
738
+
739
+        /**
740
+         * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
741
+         */
742
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
743
+
744
+        /**
745
+         * The Notice service.
746
+         */
747
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
748
+
749
+        /**
750
+         * The PrimaShop adapter.
751
+         */
752
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
753
+
754
+        /**
755
+         * The WordLift Dashboard service.
756
+         */
757
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
758
+
759
+        /**
760
+         * The admin 'Install wizard' page.
761
+         */
762
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
763
+
764
+        /**
765
+         * The WordLift entity type list admin page controller.
766
+         */
767
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
768
+
769
+        /**
770
+         * The WordLift entity type settings admin page controller.
771
+         */
772
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
773
+
774
+        /**
775
+         * The admin 'Download Your Data' page.
776
+         */
777
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
778
+
779
+        /**
780
+         * The admin 'Download Your Data' page.
781
+         */
782
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
783
+
784
+        /**
785
+         * The admin 'WordLift Settings' page.
786
+         */
787
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
788
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
789
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
790
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
791
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
792
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
793
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
794
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
795
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
796
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
797
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
798
+
799
+        /** Admin Pages */
800
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
801
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
802
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
803
+
804
+        /**
805
+         * The class responsible for defining all actions that occur in the public-facing
806
+         * side of the site.
807
+         */
808
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
809
+
810
+        /**
811
+         * The shortcode abstract class.
812
+         */
813
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
814
+
815
+        /**
816
+         * The Timeline shortcode.
817
+         */
818
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
819
+
820
+        /**
821
+         * The Navigator shortcode.
822
+         */
823
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
824
+
825
+        /**
826
+         * The chord shortcode.
827
+         */
828
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
829
+
830
+        /**
831
+         * The geomap shortcode.
832
+         */
833
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
834
+
835
+        /**
836
+         * The entity cloud shortcode.
837
+         */
838
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
839
+
840
+        /**
841
+         * The ShareThis service.
842
+         */
843
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
844
+
845
+        /**
846
+         * The SEO service.
847
+         */
848
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
768 849
 
769
-		/**
770
-		 * The WordLift entity type settings admin page controller.
771
-		 */
772
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
773
-
774
-		/**
775
-		 * The admin 'Download Your Data' page.
776
-		 */
777
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
778
-
779
-		/**
780
-		 * The admin 'Download Your Data' page.
781
-		 */
782
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
783
-
784
-		/**
785
-		 * The admin 'WordLift Settings' page.
786
-		 */
787
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
788
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
789
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
790
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
791
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
792
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
793
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
794
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
795
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
796
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
797
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
798
-
799
-		/** Admin Pages */
800
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
801
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
802
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
803
-
804
-		/**
805
-		 * The class responsible for defining all actions that occur in the public-facing
806
-		 * side of the site.
807
-		 */
808
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
809
-
810
-		/**
811
-		 * The shortcode abstract class.
812
-		 */
813
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
814
-
815
-		/**
816
-		 * The Timeline shortcode.
817
-		 */
818
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
819
-
820
-		/**
821
-		 * The Navigator shortcode.
822
-		 */
823
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
824
-
825
-		/**
826
-		 * The chord shortcode.
827
-		 */
828
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
829
-
830
-		/**
831
-		 * The geomap shortcode.
832
-		 */
833
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
834
-
835
-		/**
836
-		 * The entity cloud shortcode.
837
-		 */
838
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
839
-
840
-		/**
841
-		 * The ShareThis service.
842
-		 */
843
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
844
-
845
-		/**
846
-		 * The SEO service.
847
-		 */
848
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
849
-
850
-		/**
851
-		 * The AMP service.
852
-		 */
853
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
850
+        /**
851
+         * The AMP service.
852
+         */
853
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
854 854
 
855
-		/** Widgets */
856
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
857
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
855
+        /** Widgets */
856
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
857
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
858 858
 
859
-		$this->loader = new Wordlift_Loader();
859
+        $this->loader = new Wordlift_Loader();
860 860
 
861
-		// Instantiate a global logger.
862
-		global $wl_logger;
863
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
861
+        // Instantiate a global logger.
862
+        global $wl_logger;
863
+        $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
864 864
 
865
-		// Create the configuration service.
866
-		$this->configuration_service = new Wordlift_Configuration_Service();
865
+        // Create the configuration service.
866
+        $this->configuration_service = new Wordlift_Configuration_Service();
867 867
 
868
-		// Create an entity type service instance. It'll be later bound to the init action.
869
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
868
+        // Create an entity type service instance. It'll be later bound to the init action.
869
+        $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
870 870
 
871
-		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
872
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
871
+        // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
872
+        $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
873 873
 
874
-		// Create an instance of the UI service.
875
-		$this->ui_service = new Wordlift_UI_Service();
874
+        // Create an instance of the UI service.
875
+        $this->ui_service = new Wordlift_UI_Service();
876 876
 
877
-		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
878
-		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
877
+        // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
878
+        $this->thumbnail_service = new Wordlift_Thumbnail_Service();
879 879
 
880
-		$this->sparql_service = new Wordlift_Sparql_Service();
880
+        $this->sparql_service = new Wordlift_Sparql_Service();
881 881
 
882
-		// Create an instance of the Schema service.
883
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
884
-		$this->schema_service        = new Wordlift_Schema_Service();
882
+        // Create an instance of the Schema service.
883
+        $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
884
+        $this->schema_service        = new Wordlift_Schema_Service();
885 885
 
886
-		// Create an instance of the Notice service.
887
-		$this->notice_service = new Wordlift_Notice_Service();
886
+        // Create an instance of the Notice service.
887
+        $this->notice_service = new Wordlift_Notice_Service();
888 888
 
889
-		// Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page.
890
-		$this->entity_service = new Wordlift_Entity_Service( $this->ui_service );
889
+        // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page.
890
+        $this->entity_service = new Wordlift_Entity_Service( $this->ui_service );
891 891
 
892
-		// Create an instance of the User service.
893
-		$this->user_service = new Wordlift_User_Service();
892
+        // Create an instance of the User service.
893
+        $this->user_service = new Wordlift_User_Service();
894 894
 
895
-		// Create a new instance of the Timeline service and Timeline shortcode.
896
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
895
+        // Create a new instance of the Timeline service and Timeline shortcode.
896
+        $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
897 897
 
898
-		// Create a new instance of the Redirect service.
899
-		$this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service );
898
+        // Create a new instance of the Redirect service.
899
+        $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service );
900 900
 
901
-		// Initialize the shortcodes.
902
-		new Wordlift_Navigator_Shortcode();
903
-		new Wordlift_Chord_Shortcode();
904
-		new Wordlift_Geomap_Shortcode();
905
-		new Wordlift_Timeline_Shortcode();
906
-		new Wordlift_Related_Entities_Cloud_Shortcode();
901
+        // Initialize the shortcodes.
902
+        new Wordlift_Navigator_Shortcode();
903
+        new Wordlift_Chord_Shortcode();
904
+        new Wordlift_Geomap_Shortcode();
905
+        new Wordlift_Timeline_Shortcode();
906
+        new Wordlift_Related_Entities_Cloud_Shortcode();
907 907
 
908
-		// Initialize the SEO service.
909
-		new Wordlift_Seo_Service();
908
+        // Initialize the SEO service.
909
+        new Wordlift_Seo_Service();
910 910
 
911
-		// Initialize the AMP service.
912
-		new Wordlift_AMP_Service();
911
+        // Initialize the AMP service.
912
+        new Wordlift_AMP_Service();
913 913
 
914
-		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
914
+        $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
915 915
 
916
-		$this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service();
916
+        $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service();
917 917
 
918
-		// Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
919
-		$this->sharethis_service = new Wordlift_ShareThis_Service();
918
+        // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
919
+        $this->sharethis_service = new Wordlift_ShareThis_Service();
920 920
 
921
-		// Create an instance of the PrimaShop adapter.
922
-		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
921
+        // Create an instance of the PrimaShop adapter.
922
+        $this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
923 923
 
924
-		// Create an import service instance to hook later to WP's import function.
925
-		$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() );
924
+        // Create an import service instance to hook later to WP's import function.
925
+        $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() );
926 926
 
927
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
927
+        $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
928 928
 
929
-		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
930
-		$this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service );
929
+        // Create a Rebuild Service instance, which we'll later bound to an ajax call.
930
+        $this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service );
931 931
 
932
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
932
+        $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
933 933
 
934
-		// Create the entity rating service.
935
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
934
+        // Create the entity rating service.
935
+        $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
936 936
 
937
-		// Create entity list customization (wp-admin/edit.php)
938
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
937
+        // Create entity list customization (wp-admin/edit.php)
938
+        $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
939 939
 
940
-		// Create a new instance of the Redirect service.
941
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service );
940
+        // Create a new instance of the Redirect service.
941
+        $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service );
942 942
 
943
-		$this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service );
944
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
943
+        $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service );
944
+        $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
945 945
 
946
-		$attachment_service = new Wordlift_Attachment_Service();
946
+        $attachment_service = new Wordlift_Attachment_Service();
947 947
 
948
-		// Instantiate the JSON-LD service.
949
-		$property_getter                       = Wordlift_Property_Getter_Factory::create( $this->entity_service );
950
-		$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 );
951
-		$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, $this->entity_post_to_jsonld_converter );
952
-		$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 );
953
-		$this->jsonld_service                  = new Wordlift_Jsonld_Service( $this->entity_service, $this->postid_to_jsonld_converter );
948
+        // Instantiate the JSON-LD service.
949
+        $property_getter                       = Wordlift_Property_Getter_Factory::create( $this->entity_service );
950
+        $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 );
951
+        $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, $this->entity_post_to_jsonld_converter );
952
+        $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 );
953
+        $this->jsonld_service                  = new Wordlift_Jsonld_Service( $this->entity_service, $this->postid_to_jsonld_converter );
954 954
 
955
-		// Create an instance of the Key Validation service. This service is later hooked to provide an AJAX call (only for admins).
956
-		$this->key_validation_service = new Wordlift_Key_Validation_Service();
955
+        // Create an instance of the Key Validation service. This service is later hooked to provide an AJAX call (only for admins).
956
+        $this->key_validation_service = new Wordlift_Key_Validation_Service();
957 957
 
958
-		// Create an instance of the Publisher Service and the AJAX Adapter.
959
-		$publisher_service            = new Wordlift_Publisher_Service();
960
-		$this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $publisher_service );
958
+        // Create an instance of the Publisher Service and the AJAX Adapter.
959
+        $publisher_service            = new Wordlift_Publisher_Service();
960
+        $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $publisher_service );
961 961
 
962
-		/** Adapters. */
963
-		$this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this );
962
+        /** Adapters. */
963
+        $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this );
964 964
 
965
-		/** Async Tasks. */
966
-		new Wordlift_Sparql_Query_Async_Task();
965
+        /** Async Tasks. */
966
+        new Wordlift_Sparql_Query_Async_Task();
967 967
 
968
-		/** WordPress Admin UI. */
968
+        /** WordPress Admin UI. */
969 969
 
970
-		// UI elements.
971
-		$this->input_element           = new Wordlift_Admin_Input_Element();
972
-		$this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
973
-		$this->select2_element         = new Wordlift_Admin_Select2_Element();
974
-		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
975
-		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
976
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element );
977
-		$this->author_element          = new Wordlift_Admin_Author_Element( $publisher_service, $this->select2_element );
970
+        // UI elements.
971
+        $this->input_element           = new Wordlift_Admin_Input_Element();
972
+        $this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
973
+        $this->select2_element         = new Wordlift_Admin_Select2_Element();
974
+        $this->language_select_element = new Wordlift_Admin_Language_Select_Element();
975
+        $tabs_element                  = new Wordlift_Admin_Tabs_Element();
976
+        $this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element );
977
+        $this->author_element          = new Wordlift_Admin_Author_Element( $publisher_service, $this->select2_element );
978 978
 
979
-		$this->download_your_data_page   = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
980
-		$this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element );
981
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
979
+        $this->download_your_data_page   = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
980
+        $this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element );
981
+        $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
982 982
 
983
-		// Pages.
984
-		new Wordlift_Admin_Post_Edit_Page( $this );
983
+        // Pages.
984
+        new Wordlift_Admin_Post_Edit_Page( $this );
985 985
 
986
-		// create an instance of the entity type list admin page controller.
987
-		$this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
986
+        // create an instance of the entity type list admin page controller.
987
+        $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
988 988
 
989
-		// create an instance of the entity type etting admin page controller.
990
-		$this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
989
+        // create an instance of the entity type etting admin page controller.
990
+        $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
991 991
 
992
-		/** Widgets */
993
-		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
992
+        /** Widgets */
993
+        $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
994 994
 
995
-		//** WordPress Admin */
996
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
997
-		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
995
+        //** WordPress Admin */
996
+        $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
997
+        $this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
998 998
 
999
-		// Create an instance of the install wizard.
1000
-		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
999
+        // Create an instance of the install wizard.
1000
+        $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1001 1001
 
1002
-		// Create an instance of the content filter service.
1003
-		$this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service );
1002
+        // Create an instance of the content filter service.
1003
+        $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service );
1004 1004
 
1005
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1005
+        $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1006 1006
 
1007
-		// User Profile.
1008
-		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1007
+        // User Profile.
1008
+        new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1009 1009
 
1010
-		$this->event_entity_page_service = new Wordlift_Event_Entity_Page_Service();
1010
+        $this->event_entity_page_service = new Wordlift_Event_Entity_Page_Service();
1011 1011
 
1012
-		// Load the debug service if WP is in debug mode.
1013
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1014
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1015
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1016
-		}
1012
+        // Load the debug service if WP is in debug mode.
1013
+        if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1014
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1015
+            new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1016
+        }
1017 1017
 
1018
-	}
1018
+    }
1019 1019
 
1020
-	/**
1021
-	 * Define the locale for this plugin for internationalization.
1022
-	 *
1023
-	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1024
-	 * with WordPress.
1025
-	 *
1026
-	 * @since    1.0.0
1027
-	 * @access   private
1028
-	 */
1029
-	private function set_locale() {
1020
+    /**
1021
+     * Define the locale for this plugin for internationalization.
1022
+     *
1023
+     * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1024
+     * with WordPress.
1025
+     *
1026
+     * @since    1.0.0
1027
+     * @access   private
1028
+     */
1029
+    private function set_locale() {
1030 1030
 
1031
-		$plugin_i18n = new Wordlift_i18n();
1032
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1031
+        $plugin_i18n = new Wordlift_i18n();
1032
+        $plugin_i18n->set_domain( $this->get_plugin_name() );
1033 1033
 
1034
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1034
+        $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1035 1035
 
1036
-	}
1036
+    }
1037 1037
 
1038
-	/**
1039
-	 * Register all of the hooks related to the admin area functionality
1040
-	 * of the plugin.
1041
-	 *
1042
-	 * @since    1.0.0
1043
-	 * @access   private
1044
-	 */
1045
-	private function define_admin_hooks() {
1038
+    /**
1039
+     * Register all of the hooks related to the admin area functionality
1040
+     * of the plugin.
1041
+     *
1042
+     * @since    1.0.0
1043
+     * @access   private
1044
+     */
1045
+    private function define_admin_hooks() {
1046 1046
 
1047
-		$plugin_admin = new Wordlift_Admin(
1048
-			$this->get_plugin_name(),
1049
-			$this->get_version(),
1050
-			$this->configuration_service,
1051
-			$this->notice_service
1052
-		);
1047
+        $plugin_admin = new Wordlift_Admin(
1048
+            $this->get_plugin_name(),
1049
+            $this->get_version(),
1050
+            $this->configuration_service,
1051
+            $this->notice_service
1052
+        );
1053 1053
 
1054
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1055
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1054
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1055
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1056 1056
 
1057
-		// Hook the init action to the Topic Taxonomy service.
1058
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1057
+        // Hook the init action to the Topic Taxonomy service.
1058
+        $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1059 1059
 
1060
-		// Hook the deleted_post_meta action to the Thumbnail service.
1061
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1060
+        // Hook the deleted_post_meta action to the Thumbnail service.
1061
+        $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1062 1062
 
1063
-		// Hook the added_post_meta action to the Thumbnail service.
1064
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1063
+        // Hook the added_post_meta action to the Thumbnail service.
1064
+        $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1065 1065
 
1066
-		// Hook the updated_post_meta action to the Thumbnail service.
1067
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1066
+        // Hook the updated_post_meta action to the Thumbnail service.
1067
+        $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1068 1068
 
1069
-		// Hook posts inserts (or updates) to the user service.
1070
-		$this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
1069
+        // Hook posts inserts (or updates) to the user service.
1070
+        $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
1071 1071
 
1072
-		// Hook the AJAX wl_timeline action to the Timeline service.
1073
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1072
+        // Hook the AJAX wl_timeline action to the Timeline service.
1073
+        $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1074 1074
 
1075
-		// Register custom allowed redirect hosts.
1076
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1077
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1078
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1079
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1080
-		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1081
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1082
-		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1075
+        // Register custom allowed redirect hosts.
1076
+        $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1077
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1078
+        $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1079
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1080
+        $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1081
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1082
+        $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1083 1083
 
1084
-		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1085
-		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1086
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1087
-		$this->loader->add_action( 'save_post_entity', $this->rating_service, 'set_rating_for', 10, 1 );
1084
+        // Hook save_post to the entity service to update custom fields (such as alternate labels).
1085
+        // We have a priority of 9 because we want to be executed before data is sent to Redlink.
1086
+        $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1087
+        $this->loader->add_action( 'save_post_entity', $this->rating_service, 'set_rating_for', 10, 1 );
1088 1088
 
1089
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1090
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1089
+        $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1090
+        $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1091 1091
 
1092
-		// Entity listing customization (wp-admin/edit.php)
1093
-		// Add custom columns
1094
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1095
-		$this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1096
-		// Add 4W selection
1097
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1098
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1092
+        // Entity listing customization (wp-admin/edit.php)
1093
+        // Add custom columns
1094
+        $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1095
+        $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1096
+        // Add 4W selection
1097
+        $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1098
+        $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1099 1099
 
1100
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1100
+        $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1101 1101
 
1102
-		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1103
-		// entities.
1104
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1102
+        // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1103
+        // entities.
1104
+        $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1105 1105
 
1106
-		// Filter imported post meta.
1107
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1106
+        // Filter imported post meta.
1107
+        $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1108 1108
 
1109
-		// Notify the import service when an import starts and ends.
1110
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1111
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1112
-
1113
-		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1114
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1109
+        // Notify the import service when an import starts and ends.
1110
+        $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1111
+        $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1112
+
1113
+        // Hook the AJAX wl_rebuild action to the Rebuild Service.
1114
+        $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1115 1115
 
1116
-		// Hook the menu to the Download Your Data page.
1117
-		$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1118
-		$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1119
-		$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1120
-
1121
-		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1122
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1116
+        // Hook the menu to the Download Your Data page.
1117
+        $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1118
+        $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1119
+        $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1120
+
1121
+        // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1122
+        $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1123 1123
 
1124
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1125
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1124
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1125
+        $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1126 1126
 
1127
-		// Hook the AJAX wl_validate_key action to the Key Validation service.
1128
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1127
+        // Hook the AJAX wl_validate_key action to the Key Validation service.
1128
+        $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1129 1129
 
1130
-		// Hook the `admin_init` function to the Admin Setup.
1131
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1130
+        // Hook the `admin_init` function to the Admin Setup.
1131
+        $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1132 1132
 
1133
-		// Hook the admin_init to the settings page.
1134
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1133
+        // Hook the admin_init to the settings page.
1134
+        $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1135 1135
 
1136
-		// Hook the menu creation on the general wordlift menu creation
1137
-		$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1136
+        // Hook the menu creation on the general wordlift menu creation
1137
+        $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1138 1138
 
1139
-		// Hook key update.
1140
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1141
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1139
+        // Hook key update.
1140
+        $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1141
+        $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1142 1142
 
1143
-		// Add additional action links to the WordLift plugin in the plugins page.
1144
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1143
+        // Add additional action links to the WordLift plugin in the plugins page.
1144
+        $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1145 1145
 
1146
-		// Hook the AJAX `wl_publisher` action name.
1147
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1146
+        // Hook the AJAX `wl_publisher` action name.
1147
+        $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1148 1148
 
1149
-		// Hook row actions for the entity type list admin.
1150
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1149
+        // Hook row actions for the entity type list admin.
1150
+        $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1151 1151
 
1152
-		// Hook capabilities manipulation to allow access to entity type admin
1153
-		// page  on wordpress versions before 4.7.
1154
-		global $wp_version;
1155
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1156
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1157
-		}
1152
+        // Hook capabilities manipulation to allow access to entity type admin
1153
+        // page  on wordpress versions before 4.7.
1154
+        global $wp_version;
1155
+        if ( version_compare( $wp_version, '4.7', '<' ) ) {
1156
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1157
+        }
1158 1158
 
1159
-		/** Adapters. */
1160
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1159
+        /** Adapters. */
1160
+        $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1161 1161
 
1162
-		$this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1162
+        $this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1163 1163
 
1164
-		// Hooks to restrict multisite super admin from manipulating entity types.
1165
-		if ( is_multisite() ) {
1166
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1167
-		}
1168
-	}
1164
+        // Hooks to restrict multisite super admin from manipulating entity types.
1165
+        if ( is_multisite() ) {
1166
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1167
+        }
1168
+    }
1169 1169
 
1170
-	/**
1171
-	 * Register all of the hooks related to the public-facing functionality
1172
-	 * of the plugin.
1173
-	 *
1174
-	 * @since    1.0.0
1175
-	 * @access   private
1176
-	 */
1177
-	private function define_public_hooks() {
1170
+    /**
1171
+     * Register all of the hooks related to the public-facing functionality
1172
+     * of the plugin.
1173
+     *
1174
+     * @since    1.0.0
1175
+     * @access   private
1176
+     */
1177
+    private function define_public_hooks() {
1178 1178
 
1179
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1179
+        $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1180 1180
 
1181
-		// Register the entity post type.
1182
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1181
+        // Register the entity post type.
1182
+        $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1183 1183
 
1184
-		// Bind the link generation and handling hooks to the entity link service.
1185
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1186
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1187
-		$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 );
1188
-		$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 );
1184
+        // Bind the link generation and handling hooks to the entity link service.
1185
+        $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1186
+        $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1187
+        $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 );
1188
+        $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 );
1189 1189
 
1190
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1191
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1190
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1191
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1192 1192
 
1193
-		// Hook the content filter service to add entity links.
1194
-		$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1193
+        // Hook the content filter service to add entity links.
1194
+        $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1195 1195
 
1196
-		// Hook the AJAX wl_timeline action to the Timeline service.
1197
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1196
+        // Hook the AJAX wl_timeline action to the Timeline service.
1197
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1198 1198
 
1199
-		// Hook the ShareThis service.
1200
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1201
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1199
+        // Hook the ShareThis service.
1200
+        $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1201
+        $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1202 1202
 
1203
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1204
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1203
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1204
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1205 1205
 
1206
-		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1207
-		// in order to tweak WP's `WP_Query` to include entities in queries related
1208
-		// to categories.
1209
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1206
+        // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1207
+        // in order to tweak WP's `WP_Query` to include entities in queries related
1208
+        // to categories.
1209
+        $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1210 1210
 
1211
-		/*
1211
+        /*
1212 1212
 		 * Hook the `pre_get_posts` action to the `Wordlift_Event_Entity_Page_Service`
1213 1213
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1214 1214
 		 * order of start time.
1215 1215
 		 */
1216
-		$this->loader->add_action( 'pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1 );
1217
-
1218
-		$this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1219
-
1220
-	}
1221
-
1222
-	/**
1223
-	 * Run the loader to execute all of the hooks with WordPress.
1224
-	 *
1225
-	 * @since    1.0.0
1226
-	 */
1227
-	public function run() {
1228
-		$this->loader->run();
1229
-	}
1230
-
1231
-	/**
1232
-	 * The name of the plugin used to uniquely identify it within the context of
1233
-	 * WordPress and to define internationalization functionality.
1234
-	 *
1235
-	 * @since     1.0.0
1236
-	 * @return    string    The name of the plugin.
1237
-	 */
1238
-	public function get_plugin_name() {
1239
-		return $this->plugin_name;
1240
-	}
1241
-
1242
-	/**
1243
-	 * The reference to the class that orchestrates the hooks with the plugin.
1244
-	 *
1245
-	 * @since     1.0.0
1246
-	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1247
-	 */
1248
-	public function get_loader() {
1249
-		return $this->loader;
1250
-	}
1251
-
1252
-	/**
1253
-	 * Retrieve the version number of the plugin.
1254
-	 *
1255
-	 * @since     1.0.0
1256
-	 * @return    string    The version number of the plugin.
1257
-	 */
1258
-	public function get_version() {
1259
-		return $this->version;
1260
-	}
1216
+        $this->loader->add_action( 'pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1 );
1217
+
1218
+        $this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1219
+
1220
+    }
1221
+
1222
+    /**
1223
+     * Run the loader to execute all of the hooks with WordPress.
1224
+     *
1225
+     * @since    1.0.0
1226
+     */
1227
+    public function run() {
1228
+        $this->loader->run();
1229
+    }
1230
+
1231
+    /**
1232
+     * The name of the plugin used to uniquely identify it within the context of
1233
+     * WordPress and to define internationalization functionality.
1234
+     *
1235
+     * @since     1.0.0
1236
+     * @return    string    The name of the plugin.
1237
+     */
1238
+    public function get_plugin_name() {
1239
+        return $this->plugin_name;
1240
+    }
1241
+
1242
+    /**
1243
+     * The reference to the class that orchestrates the hooks with the plugin.
1244
+     *
1245
+     * @since     1.0.0
1246
+     * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1247
+     */
1248
+    public function get_loader() {
1249
+        return $this->loader;
1250
+    }
1251
+
1252
+    /**
1253
+     * Retrieve the version number of the plugin.
1254
+     *
1255
+     * @since     1.0.0
1256
+     * @return    string    The version number of the plugin.
1257
+     */
1258
+    public function get_version() {
1259
+        return $this->version;
1260
+    }
1261 1261
 
1262 1262
 }
Please login to merge, or discard this patch.
Spacing   +186 added lines, -186 removed lines patch added patch discarded remove patch
@@ -547,329 +547,329 @@  discard block
 block discarded – undo
547 547
 		 * The class responsible for orchestrating the actions and filters of the
548 548
 		 * core plugin.
549 549
 		 */
550
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
550
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php';
551 551
 
552 552
 		/**
553 553
 		 * The class responsible for defining internationalization functionality
554 554
 		 * of the plugin.
555 555
 		 */
556
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
556
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php';
557 557
 
558 558
 		/**
559 559
 		 * WordLift's supported languages.
560 560
 		 */
561
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
561
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-languages.php';
562 562
 
563 563
 		/**
564 564
 		 * Provide support functions to sanitize data.
565 565
 		 */
566
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
566
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php';
567 567
 
568 568
 		/**
569 569
 		 * The Redirect service.
570 570
 		 */
571
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
571
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php';
572 572
 
573 573
 		/**
574 574
 		 * The Log service.
575 575
 		 */
576
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
576
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php';
577 577
 
578 578
 		/**
579 579
 		 * The configuration service.
580 580
 		 */
581
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
581
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php';
582 582
 
583 583
 		/**
584 584
 		 * The entity post type service (this is the WordPress post type, not the entity schema type).
585 585
 		 */
586
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
586
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-type-service.php';
587 587
 
588 588
 		/**
589 589
 		 * The entity type service (i.e. the schema type).
590 590
 		 */
591
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
591
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php';
592 592
 
593 593
 		/**
594 594
 		 * The entity link service.
595 595
 		 */
596
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
596
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php';
597 597
 
598 598
 		/**
599 599
 		 * The Query builder.
600 600
 		 */
601
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
601
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php';
602 602
 
603 603
 		/**
604 604
 		 * The Schema service.
605 605
 		 */
606
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
606
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php';
607 607
 
608 608
 		/**
609 609
 		 * The schema:url property service.
610 610
 		 */
611
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
612
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
611
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php';
612
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php';
613 613
 
614 614
 		/**
615 615
 		 * The UI service.
616 616
 		 */
617
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
617
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php';
618 618
 
619 619
 		/**
620 620
 		 * The Thumbnail service.
621 621
 		 */
622
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
622
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php';
623 623
 
624 624
 		/**
625 625
 		 * The Entity Types Taxonomy service.
626 626
 		 */
627
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
627
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-types-taxonomy-service.php';
628 628
 
629 629
 		/**
630 630
 		 * The Entity service.
631 631
 		 */
632
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
632
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php';
633 633
 
634 634
 		// Add the entity rating service.
635
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
635
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rating-service.php';
636 636
 
637 637
 		/**
638 638
 		 * The User service.
639 639
 		 */
640
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
640
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php';
641 641
 
642 642
 		/**
643 643
 		 * The Timeline service.
644 644
 		 */
645
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
645
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php';
646 646
 
647 647
 		/**
648 648
 		 * The Topic Taxonomy service.
649 649
 		 */
650
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
650
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php';
651 651
 
652 652
 		/**
653 653
 		 * The SPARQL service.
654 654
 		 */
655
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
655
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sparql-service.php';
656 656
 
657 657
 		/**
658 658
 		 * The WordLift import service.
659 659
 		 */
660
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
660
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-import-service.php';
661 661
 
662 662
 		/**
663 663
 		 * The WordLift URI service.
664 664
 		 */
665
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
665
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php';
666 666
 
667
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php';
667
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-listable.php';
668 668
 
669
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
669
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-factory.php';
670 670
 
671 671
 		/**
672 672
 		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
673 673
 		 */
674
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php';
674
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rebuild-service.php';
675 675
 
676
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
676
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/properties/class-wordlift-property-getter-factory.php';
677 677
 
678
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
678
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-attachment-service.php';
679 679
 
680 680
 		/**
681 681
 		 * Load the converters.
682 682
 		 */
683
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
684
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
685
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
686
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
687
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
683
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/intf-wordlift-post-converter.php';
684
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
685
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-postid-to-jsonld-converter.php';
686
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-to-jsonld-converter.php';
687
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-to-jsonld-converter.php';
688 688
 
689 689
 		/**
690 690
 		 * Load the content filter.
691 691
 		 */
692
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
692
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-content-filter-service.php';
693 693
 
694 694
 		/*
695 695
 		 * Load the excerpt helper.
696 696
 		 */
697
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
697
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-excerpt-helper.php';
698 698
 
699 699
 		/**
700 700
 		 * Load the JSON-LD service to publish entities using JSON-LD.s
701 701
 		 *
702 702
 		 * @since 3.8.0
703 703
 		 */
704
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
704
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-service.php';
705 705
 
706 706
 		// The Publisher Service and the AJAX adapter.
707
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
708
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
707
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-service.php';
708
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-ajax-adapter.php';
709 709
 
710 710
 		/**
711 711
 		 * Load the WordLift key validation service.
712 712
 		 */
713
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
713
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php';
714 714
 
715 715
 		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
716
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
716
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php';
717 717
 
718 718
 		// Load the `Wordlift_Event_Entity_Page_Service` class definition.
719
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-event-entity-page-service.php';
719
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-event-entity-page-service.php';
720 720
 
721 721
 		/** Adapters. */
722
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
723
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
722
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php';
723
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-newrelic-adapter.php';
724 724
 
725 725
 		/** Async Tasks. */
726
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/wp-async-task.php';
727
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
726
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/wp-async-task.php';
727
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
728 728
 
729 729
 		/**
730 730
 		 * The class responsible for defining all actions that occur in the admin area.
731 731
 		 */
732
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
732
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php';
733 733
 
734 734
 		/**
735 735
 		 * The class to customize the entity list admin page.
736 736
 		 */
737
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
737
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php';
738 738
 
739 739
 		/**
740 740
 		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
741 741
 		 */
742
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
742
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php';
743 743
 
744 744
 		/**
745 745
 		 * The Notice service.
746 746
 		 */
747
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
747
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php';
748 748
 
749 749
 		/**
750 750
 		 * The PrimaShop adapter.
751 751
 		 */
752
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
752
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php';
753 753
 
754 754
 		/**
755 755
 		 * The WordLift Dashboard service.
756 756
 		 */
757
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
757
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php';
758 758
 
759 759
 		/**
760 760
 		 * The admin 'Install wizard' page.
761 761
 		 */
762
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
762
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php';
763 763
 
764 764
 		/**
765 765
 		 * The WordLift entity type list admin page controller.
766 766
 		 */
767
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
767
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
768 768
 
769 769
 		/**
770 770
 		 * The WordLift entity type settings admin page controller.
771 771
 		 */
772
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
772
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php';
773 773
 
774 774
 		/**
775 775
 		 * The admin 'Download Your Data' page.
776 776
 		 */
777
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
777
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php';
778 778
 
779 779
 		/**
780 780
 		 * The admin 'Download Your Data' page.
781 781
 		 */
782
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
782
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php';
783 783
 
784 784
 		/**
785 785
 		 * The admin 'WordLift Settings' page.
786 786
 		 */
787
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
788
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
789
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
790
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
791
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
792
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
793
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
794
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
795
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
796
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
797
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
787
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/intf-wordlift-admin-element.php';
788
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-input-element.php';
789
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-input-radio-element.php';
790
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-select2-element.php';
791
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-language-select-element.php';
792
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-tabs-element.php';
793
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-author-element.php';
794
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-publisher-element.php';
795
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php';
796
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php';
797
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php';
798 798
 
799 799
 		/** Admin Pages */
800
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
801
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
802
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
800
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php';
801
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-user-profile-page.php';
802
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-status-page.php';
803 803
 
804 804
 		/**
805 805
 		 * The class responsible for defining all actions that occur in the public-facing
806 806
 		 * side of the site.
807 807
 		 */
808
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
808
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php';
809 809
 
810 810
 		/**
811 811
 		 * The shortcode abstract class.
812 812
 		 */
813
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
813
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php';
814 814
 
815 815
 		/**
816 816
 		 * The Timeline shortcode.
817 817
 		 */
818
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
818
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php';
819 819
 
820 820
 		/**
821 821
 		 * The Navigator shortcode.
822 822
 		 */
823
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
823
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php';
824 824
 
825 825
 		/**
826 826
 		 * The chord shortcode.
827 827
 		 */
828
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
828
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php';
829 829
 
830 830
 		/**
831 831
 		 * The geomap shortcode.
832 832
 		 */
833
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
833
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php';
834 834
 
835 835
 		/**
836 836
 		 * The entity cloud shortcode.
837 837
 		 */
838
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
838
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php';
839 839
 
840 840
 		/**
841 841
 		 * The ShareThis service.
842 842
 		 */
843
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
843
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php';
844 844
 
845 845
 		/**
846 846
 		 * The SEO service.
847 847
 		 */
848
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
848
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php';
849 849
 
850 850
 		/**
851 851
 		 * The AMP service.
852 852
 		 */
853
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
853
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-amp-service.php';
854 854
 
855 855
 		/** Widgets */
856
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
857
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
856
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php';
857
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php';
858 858
 
859 859
 		$this->loader = new Wordlift_Loader();
860 860
 
861 861
 		// Instantiate a global logger.
862 862
 		global $wl_logger;
863
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
863
+		$wl_logger = Wordlift_Log_Service::get_logger('WordLift');
864 864
 
865 865
 		// Create the configuration service.
866 866
 		$this->configuration_service = new Wordlift_Configuration_Service();
867 867
 
868 868
 		// Create an entity type service instance. It'll be later bound to the init action.
869
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
869
+		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path());
870 870
 
871 871
 		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
872
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
872
+		$this->entity_link_service = new Wordlift_Entity_Link_Service($this->entity_post_type_service, $this->configuration_service->get_entity_base_path());
873 873
 
874 874
 		// Create an instance of the UI service.
875 875
 		$this->ui_service = new Wordlift_UI_Service();
@@ -880,23 +880,23 @@  discard block
 block discarded – undo
880 880
 		$this->sparql_service = new Wordlift_Sparql_Service();
881 881
 
882 882
 		// Create an instance of the Schema service.
883
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
883
+		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service($this->sparql_service);
884 884
 		$this->schema_service        = new Wordlift_Schema_Service();
885 885
 
886 886
 		// Create an instance of the Notice service.
887 887
 		$this->notice_service = new Wordlift_Notice_Service();
888 888
 
889 889
 		// Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page.
890
-		$this->entity_service = new Wordlift_Entity_Service( $this->ui_service );
890
+		$this->entity_service = new Wordlift_Entity_Service($this->ui_service);
891 891
 
892 892
 		// Create an instance of the User service.
893 893
 		$this->user_service = new Wordlift_User_Service();
894 894
 
895 895
 		// Create a new instance of the Timeline service and Timeline shortcode.
896
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
896
+		$this->timeline_service = new Wordlift_Timeline_Service($this->entity_service);
897 897
 
898 898
 		// Create a new instance of the Redirect service.
899
-		$this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service );
899
+		$this->redirect_service = new Wordlift_Redirect_Service($this->entity_service);
900 900
 
901 901
 		// Initialize the shortcodes.
902 902
 		new Wordlift_Navigator_Shortcode();
@@ -922,45 +922,45 @@  discard block
 block discarded – undo
922 922
 		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
923 923
 
924 924
 		// Create an import service instance to hook later to WP's import function.
925
-		$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() );
925
+		$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());
926 926
 
927
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
927
+		$uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']);
928 928
 
929 929
 		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
930
-		$this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service );
930
+		$this->rebuild_service = new Wordlift_Rebuild_Service($this->sparql_service, $uri_service);
931 931
 
932
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
932
+		$this->entity_type_service = new Wordlift_Entity_Type_Service($this->schema_service);
933 933
 
934 934
 		// Create the entity rating service.
935
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
935
+		$this->rating_service = new Wordlift_Rating_Service($this->entity_service, $this->entity_type_service, $this->notice_service);
936 936
 
937 937
 		// Create entity list customization (wp-admin/edit.php)
938
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
938
+		$this->entity_list_service = new Wordlift_Entity_List_Service($this->rating_service);
939 939
 
940 940
 		// Create a new instance of the Redirect service.
941
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service );
941
+		$this->dashboard_service = new Wordlift_Dashboard_Service($this->rating_service);
942 942
 
943
-		$this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service );
944
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
943
+		$this->property_factory = new Wordlift_Property_Factory($schema_url_property_service);
944
+		$this->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service);
945 945
 
946 946
 		$attachment_service = new Wordlift_Attachment_Service();
947 947
 
948 948
 		// Instantiate the JSON-LD service.
949
-		$property_getter                       = Wordlift_Property_Getter_Factory::create( $this->entity_service );
950
-		$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 );
951
-		$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, $this->entity_post_to_jsonld_converter );
952
-		$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 );
953
-		$this->jsonld_service                  = new Wordlift_Jsonld_Service( $this->entity_service, $this->postid_to_jsonld_converter );
949
+		$property_getter                       = Wordlift_Property_Getter_Factory::create($this->entity_service);
950
+		$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);
951
+		$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, $this->entity_post_to_jsonld_converter);
952
+		$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);
953
+		$this->jsonld_service                  = new Wordlift_Jsonld_Service($this->entity_service, $this->postid_to_jsonld_converter);
954 954
 
955 955
 		// Create an instance of the Key Validation service. This service is later hooked to provide an AJAX call (only for admins).
956 956
 		$this->key_validation_service = new Wordlift_Key_Validation_Service();
957 957
 
958 958
 		// Create an instance of the Publisher Service and the AJAX Adapter.
959 959
 		$publisher_service            = new Wordlift_Publisher_Service();
960
-		$this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $publisher_service );
960
+		$this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter($publisher_service);
961 961
 
962 962
 		/** Adapters. */
963
-		$this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this );
963
+		$this->tinymce_adapter = new Wordlift_Tinymce_Adapter($this);
964 964
 
965 965
 		/** Async Tasks. */
966 966
 		new Wordlift_Sparql_Query_Async_Task();
@@ -973,15 +973,15 @@  discard block
 block discarded – undo
973 973
 		$this->select2_element         = new Wordlift_Admin_Select2_Element();
974 974
 		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
975 975
 		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
976
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element );
977
-		$this->author_element          = new Wordlift_Admin_Author_Element( $publisher_service, $this->select2_element );
976
+		$this->publisher_element       = new Wordlift_Admin_Publisher_Element($this->configuration_service, $publisher_service, $tabs_element, $this->select2_element);
977
+		$this->author_element          = new Wordlift_Admin_Author_Element($publisher_service, $this->select2_element);
978 978
 
979
-		$this->download_your_data_page   = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
980
-		$this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element );
981
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
979
+		$this->download_your_data_page   = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service);
980
+		$this->settings_page             = new Wordlift_Admin_Settings_Page($this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element);
981
+		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($this->settings_page);
982 982
 
983 983
 		// Pages.
984
-		new Wordlift_Admin_Post_Edit_Page( $this );
984
+		new Wordlift_Admin_Post_Edit_Page($this);
985 985
 
986 986
 		// create an instance of the entity type list admin page controller.
987 987
 		$this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
@@ -993,26 +993,26 @@  discard block
 block discarded – undo
993 993
 		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
994 994
 
995 995
 		//** WordPress Admin */
996
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
997
-		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
996
+		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service);
997
+		$this->status_page             = new Wordlift_Admin_Status_Page($this->entity_service, $this->sparql_service);
998 998
 
999 999
 		// Create an instance of the install wizard.
1000
-		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1000
+		$this->admin_setup = new Wordlift_Admin_Setup($this->configuration_service, $this->key_validation_service, $this->entity_service);
1001 1001
 
1002 1002
 		// Create an instance of the content filter service.
1003
-		$this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service );
1003
+		$this->content_filter_service = new Wordlift_Content_Filter_Service($this->entity_service, $this->configuration_service);
1004 1004
 
1005
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1005
+		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($this->entity_post_type_service);
1006 1006
 
1007 1007
 		// User Profile.
1008
-		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1008
+		new Wordlift_Admin_User_Profile_Page($this->author_element, $this->user_service);
1009 1009
 
1010 1010
 		$this->event_entity_page_service = new Wordlift_Event_Entity_Page_Service();
1011 1011
 
1012 1012
 		// Load the debug service if WP is in debug mode.
1013
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1014
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1015
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1013
+		if (defined('WP_DEBUG') && WP_DEBUG) {
1014
+			require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php';
1015
+			new Wordlift_Debug_Service($this->entity_service, $uri_service);
1016 1016
 		}
1017 1017
 
1018 1018
 	}
@@ -1029,9 +1029,9 @@  discard block
 block discarded – undo
1029 1029
 	private function set_locale() {
1030 1030
 
1031 1031
 		$plugin_i18n = new Wordlift_i18n();
1032
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1032
+		$plugin_i18n->set_domain($this->get_plugin_name());
1033 1033
 
1034
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1034
+		$this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain');
1035 1035
 
1036 1036
 	}
1037 1037
 
@@ -1051,119 +1051,119 @@  discard block
 block discarded – undo
1051 1051
 			$this->notice_service
1052 1052
 		);
1053 1053
 
1054
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1055
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1054
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles');
1055
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts');
1056 1056
 
1057 1057
 		// Hook the init action to the Topic Taxonomy service.
1058
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1058
+		$this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0);
1059 1059
 
1060 1060
 		// Hook the deleted_post_meta action to the Thumbnail service.
1061
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1061
+		$this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4);
1062 1062
 
1063 1063
 		// Hook the added_post_meta action to the Thumbnail service.
1064
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1064
+		$this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4);
1065 1065
 
1066 1066
 		// Hook the updated_post_meta action to the Thumbnail service.
1067
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1067
+		$this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4);
1068 1068
 
1069 1069
 		// Hook posts inserts (or updates) to the user service.
1070
-		$this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
1070
+		$this->loader->add_action('wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3);
1071 1071
 
1072 1072
 		// Hook the AJAX wl_timeline action to the Timeline service.
1073
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1073
+		$this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline');
1074 1074
 
1075 1075
 		// Register custom allowed redirect hosts.
1076
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1076
+		$this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts');
1077 1077
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1078
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1078
+		$this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect');
1079 1079
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1080
-		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1080
+		$this->loader->add_action('wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats');
1081 1081
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1082
-		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1082
+		$this->loader->add_action('wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets');
1083 1083
 
1084 1084
 		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1085 1085
 		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1086
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1087
-		$this->loader->add_action( 'save_post_entity', $this->rating_service, 'set_rating_for', 10, 1 );
1086
+		$this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3);
1087
+		$this->loader->add_action('save_post_entity', $this->rating_service, 'set_rating_for', 10, 1);
1088 1088
 
1089
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1090
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1089
+		$this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1);
1090
+		$this->loader->add_action('in_admin_header', $this->rating_service, 'in_admin_header');
1091 1091
 
1092 1092
 		// Entity listing customization (wp-admin/edit.php)
1093 1093
 		// Add custom columns
1094
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1095
-		$this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1094
+		$this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns');
1095
+		$this->loader->add_filter('manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2);
1096 1096
 		// Add 4W selection
1097
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1098
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1097
+		$this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope');
1098
+		$this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope');
1099 1099
 
1100
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1100
+		$this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args');
1101 1101
 
1102 1102
 		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1103 1103
 		// entities.
1104
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1104
+		$this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2);
1105 1105
 
1106 1106
 		// Filter imported post meta.
1107
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1107
+		$this->loader->add_filter('wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3);
1108 1108
 
1109 1109
 		// Notify the import service when an import starts and ends.
1110
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1111
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1110
+		$this->loader->add_action('import_start', $this->import_service, 'import_start', 10, 0);
1111
+		$this->loader->add_action('import_end', $this->import_service, 'import_end', 10, 0);
1112 1112
 
1113 1113
 		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1114
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1114
+		$this->loader->add_action('wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild');
1115 1115
 
1116 1116
 		// Hook the menu to the Download Your Data page.
1117
-		$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1118
-		$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1119
-		$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1117
+		$this->loader->add_action('admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0);
1118
+		$this->loader->add_action('admin_menu', $this->status_page, 'admin_menu', 100, 0);
1119
+		$this->loader->add_action('admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0);
1120 1120
 
1121 1121
 		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1122
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1122
+		$this->loader->add_action('wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10);
1123 1123
 
1124 1124
 		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1125
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1125
+		$this->loader->add_action('wp_ajax_wl_jsonld', $this->jsonld_service, 'get');
1126 1126
 
1127 1127
 		// Hook the AJAX wl_validate_key action to the Key Validation service.
1128
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1128
+		$this->loader->add_action('wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key');
1129 1129
 
1130 1130
 		// Hook the `admin_init` function to the Admin Setup.
1131
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1131
+		$this->loader->add_action('admin_init', $this->admin_setup, 'admin_init');
1132 1132
 
1133 1133
 		// Hook the admin_init to the settings page.
1134
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1134
+		$this->loader->add_action('admin_init', $this->settings_page, 'admin_init');
1135 1135
 
1136 1136
 		// Hook the menu creation on the general wordlift menu creation
1137
-		$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1137
+		$this->loader->add_action('wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2);
1138 1138
 
1139 1139
 		// Hook key update.
1140
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1141
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1140
+		$this->loader->add_action('pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2);
1141
+		$this->loader->add_action('update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2);
1142 1142
 
1143 1143
 		// Add additional action links to the WordLift plugin in the plugins page.
1144
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1144
+		$this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1);
1145 1145
 
1146 1146
 		// Hook the AJAX `wl_publisher` action name.
1147
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1147
+		$this->loader->add_action('wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher');
1148 1148
 
1149 1149
 		// Hook row actions for the entity type list admin.
1150
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1150
+		$this->loader->add_filter('wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2);
1151 1151
 
1152 1152
 		// Hook capabilities manipulation to allow access to entity type admin
1153 1153
 		// page  on wordpress versions before 4.7.
1154 1154
 		global $wp_version;
1155
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1156
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1155
+		if (version_compare($wp_version, '4.7', '<')) {
1156
+			$this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4);
1157 1157
 		}
1158 1158
 
1159 1159
 		/** Adapters. */
1160
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1160
+		$this->loader->add_filter('mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1);
1161 1161
 
1162
-		$this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1162
+		$this->loader->add_action('wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1);
1163 1163
 
1164 1164
 		// Hooks to restrict multisite super admin from manipulating entity types.
1165
-		if ( is_multisite() ) {
1166
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1165
+		if (is_multisite()) {
1166
+			$this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4);
1167 1167
 		}
1168 1168
 	}
1169 1169
 
@@ -1176,46 +1176,46 @@  discard block
 block discarded – undo
1176 1176
 	 */
1177 1177
 	private function define_public_hooks() {
1178 1178
 
1179
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1179
+		$plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version());
1180 1180
 
1181 1181
 		// Register the entity post type.
1182
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1182
+		$this->loader->add_action('init', $this->entity_post_type_service, 'register');
1183 1183
 
1184 1184
 		// Bind the link generation and handling hooks to the entity link service.
1185
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1186
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1187
-		$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 );
1188
-		$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 );
1185
+		$this->loader->add_filter('post_type_link', $this->entity_link_service, 'post_type_link', 10, 4);
1186
+		$this->loader->add_action('pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1);
1187
+		$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);
1188
+		$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);
1189 1189
 
1190
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1191
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1190
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles');
1191
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts');
1192 1192
 
1193 1193
 		// Hook the content filter service to add entity links.
1194
-		$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1194
+		$this->loader->add_filter('the_content', $this->content_filter_service, 'the_content');
1195 1195
 
1196 1196
 		// Hook the AJAX wl_timeline action to the Timeline service.
1197
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1197
+		$this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline');
1198 1198
 
1199 1199
 		// Hook the ShareThis service.
1200
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1201
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1200
+		$this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99);
1201
+		$this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99);
1202 1202
 
1203 1203
 		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1204
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1204
+		$this->loader->add_action('wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get');
1205 1205
 
1206 1206
 		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1207 1207
 		// in order to tweak WP's `WP_Query` to include entities in queries related
1208 1208
 		// to categories.
1209
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1209
+		$this->loader->add_action('pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1);
1210 1210
 
1211 1211
 		/*
1212 1212
 		 * Hook the `pre_get_posts` action to the `Wordlift_Event_Entity_Page_Service`
1213 1213
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1214 1214
 		 * order of start time.
1215 1215
 		 */
1216
-		$this->loader->add_action( 'pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1 );
1216
+		$this->loader->add_action('pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1);
1217 1217
 
1218
-		$this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1218
+		$this->loader->add_action('wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1);
1219 1219
 
1220 1220
 	}
1221 1221
 
Please login to merge, or discard this patch.
src/includes/class-wordlift-user-service.php 2 patches
Indentation   +280 added lines, -280 removed lines patch added patch discarded remove patch
@@ -10,285 +10,285 @@
 block discarded – undo
10 10
  */
11 11
 class Wordlift_User_Service {
12 12
 
13
-	/**
14
-	 * The meta key where the user's URI is stored.
15
-	 *
16
-	 * @since 3.1.7
17
-	 */
18
-	const URI_META_KEY = '_wl_uri';
19
-
20
-	/**
21
-	 * The meta key holding the entity id representing a {@link WP_User}.
22
-	 *
23
-	 * @since 3.14.0
24
-	 */
25
-	const ENTITY_META_KEY = '_wl_entity';
26
-
27
-	/**
28
-	 * The Log service.
29
-	 *
30
-	 * @since  3.1.7
31
-	 * @access private
32
-	 * @var \Wordlift_Log_Service $log_service The Log service.
33
-	 */
34
-	private $log_service;
35
-
36
-	/**
37
-	 * The singleton instance of the User service.
38
-	 *
39
-	 * @since  3.1.7
40
-	 * @access private
41
-	 * @var \Wordlift_User_Service $user_service The singleton instance of the User service.
42
-	 */
43
-	private static $instance;
44
-
45
-	/**
46
-	 * Create an instance of the User service.
47
-	 *
48
-	 * @since 3.1.7
49
-	 */
50
-	public function __construct() {
51
-
52
-		$this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_User_Service' );
53
-
54
-		self::$instance = $this;
55
-
56
-	}
57
-
58
-	/**
59
-	 * Get the singleton instance of the User service.
60
-	 *
61
-	 * @since 3.1.7
62
-	 * @return \Wordlift_User_Service The singleton instance of the User service.
63
-	 */
64
-	public static function get_instance() {
65
-
66
-		return self::$instance;
67
-	}
68
-
69
-	/**
70
-	 * Get the URI for a user.
71
-	 *
72
-	 * @since 3.1.7
73
-	 *
74
-	 * @param int $user_id The user id
75
-	 *
76
-	 * @return false|string The user's URI or false in case of failure.
77
-	 */
78
-	public function get_uri( $user_id ) {
79
-
80
-		// Try to get the URI stored in the user's meta and return it if available.
81
-		if ( false !== ( $user_uri = $this->_get_uri( $user_id ) ) ) {
82
-			return $user_uri;
83
-		}
84
-
85
-		// Try to build an URI, return false in case of failure.
86
-		if ( false === ( $user_uri = $this->_build_uri( $user_id ) ) ) {
87
-			return false;
88
-		}
89
-
90
-		// Store the URI for future requests (we need a "permanent" URI).
91
-		$this->_set_uri( $user_id, $user_uri );
92
-
93
-		return $user_uri;
94
-	}
95
-
96
-	/**
97
-	 * Receives wp_insert_post events.
98
-	 *
99
-	 * @since 3.1.7
100
-	 *
101
-	 * @param int     $post_id Post ID.
102
-	 * @param WP_Post $post    Post object.
103
-	 * @param bool    $update  Whether this is an existing post being updated or not.
104
-	 */
105
-	public function wp_insert_post( $post_id, $post, $update ) {
106
-
107
-		// If the post is not published, return.
108
-		if ( 'publish' !== get_post_status( $post_id ) ) {
109
-			return;
110
-		}
111
-
112
-		// We expect a numeric author id.
113
-		if ( ! is_numeric( $post->post_author ) ) {
114
-			return;
115
-		}
116
-
117
-		// Get the delete query,or return in case of failure.
118
-		if ( false === ( $delete = $this->get_delete_query( $post->post_author ) ) ) {
119
-			return;
120
-		}
121
-
122
-		// Get the insert query,or return in case of failure.
123
-		if ( false === ( $insert = $this->get_insert_query( $post->post_author ) ) ) {
124
-			return;
125
-		}
126
-
127
-		// Send the query to the triple store.
128
-		rl_execute_sparql_update_query( $delete . $insert );
129
-
130
-	}
131
-
132
-	/**
133
-	 * Set the `id` of the entity representing a {@link WP_User}.
134
-	 *
135
-	 * If the `id` is set to 0 (or less) then the meta is deleted.
136
-	 *
137
-	 * @since 3.14.0
138
-	 *
139
-	 * @param int $user_id The {@link WP_User}.
140
-	 * @param int $value   The entity {@link WP_Post} `id`.
141
-	 *
142
-	 * @return bool|int  Meta ID if the key didn't exist, true on successful update, false on failure.
143
-	 */
144
-	public function set_entity( $user_id, $value ) {
145
-
146
-		return 0 < $value
147
-			? update_user_meta( $user_id, self::ENTITY_META_KEY, $value )
148
-			: delete_user_meta( $user_id, self::ENTITY_META_KEY );
149
-	}
150
-
151
-	/**
152
-	 * Get the {@link WP_Post} `id` of the entity representing a {@link WP_User}.
153
-	 *
154
-	 * @since 3.14.0
155
-	 *
156
-	 * @param int $user_id The {@link WP_User}'s `id`.
157
-	 *
158
-	 * @return string The entity {@link WP_Post} `id` or an empty string if not set.
159
-	 */
160
-	public function get_entity( $user_id ) {
161
-
162
-		return get_user_meta( $user_id, self::ENTITY_META_KEY, true );
163
-	}
164
-
165
-	/**
166
-	 * Get the user's URI stored in the user's meta.
167
-	 *
168
-	 * @since 3.1.7
169
-	 *
170
-	 * @param int $user_id The user id.
171
-	 *
172
-	 * @return false|string The user's URI or false if not found.
173
-	 */
174
-	private function _get_uri( $user_id ) {
175
-
176
-		$user_uri = get_user_meta( $user_id, self::URI_META_KEY, true );
177
-
178
-		if ( empty( $user_uri ) ) {
179
-			return false;
180
-		}
181
-
182
-		return $user_uri;
183
-	}
184
-
185
-	/**
186
-	 * Build an URI for a user.
187
-	 *
188
-	 * @since 3.1.7
189
-	 *
190
-	 * @param int $user_id The user's id.
191
-	 *
192
-	 * @return false|string The user's URI or false in case of failure.
193
-	 */
194
-	private function _build_uri( $user_id ) {
195
-
196
-		// Get the user, return false in case of failure.
197
-		if ( false === ( $user = get_userdata( $user_id ) ) ) {
198
-			return false;
199
-		};
200
-
201
-		// If the nicename is not set, return a failure.
202
-		if ( empty( $user->user_nicename ) ) {
203
-			return false;
204
-		}
205
-
206
-		return wl_configuration_get_redlink_dataset_uri() . "/user/$user->user_nicename";
207
-	}
208
-
209
-	/**
210
-	 * Store the URI in user's meta.
211
-	 *
212
-	 * @since 3.1.7
213
-	 *
214
-	 * @param int    $user_id  The user's id.
215
-	 * @param string $user_uri The user's uri.
216
-	 *
217
-	 * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
218
-	 */
219
-	private function _set_uri( $user_id, $user_uri ) {
220
-
221
-		return update_user_meta( $user_id, self::URI_META_KEY, $user_uri );
222
-	}
223
-
224
-	/**
225
-	 * Get the delete query.
226
-	 *
227
-	 * @since 3.1.7
228
-	 *
229
-	 * @param int $user_id The user id.
230
-	 *
231
-	 * @return false|string The delete query or false in case of failure.
232
-	 */
233
-	private function get_delete_query( $user_id ) {
234
-
235
-		// Get the URI, return if there's none.
236
-		if ( false === ( $user_uri = $this->get_uri( $user_id ) ) ) {
237
-			return false;
238
-		}
239
-
240
-		// Build the delete query.
241
-		$query = Wordlift_Query_Builder::new_instance()->delete()
242
-		                               ->statement( $user_uri, Wordlift_Query_Builder::RDFS_TYPE_URI, '?o' )
243
-		                               ->build()
244
-		         . Wordlift_Query_Builder::new_instance()->delete()
245
-		                                 ->statement( $user_uri, Wordlift_Query_Builder::RDFS_LABEL_URI, '?o' )
246
-		                                 ->build()
247
-		         . Wordlift_Query_Builder::new_instance()->delete()
248
-		                                 ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_GIVEN_NAME_URI, '?o' )
249
-		                                 ->build()
250
-		         . Wordlift_Query_Builder::new_instance()->delete()
251
-		                                 ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_FAMILY_NAME_URI, '?o' )
252
-		                                 ->build()
253
-		         . Wordlift_Query_Builder::new_instance()->delete()
254
-		                                 ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_URL_URI, '?o' )
255
-		                                 ->build();
256
-
257
-		return $query;
258
-	}
259
-
260
-	/**
261
-	 * Get the insert query.
262
-	 *
263
-	 * @since 3.1.7
264
-	 *
265
-	 * @param int $user_id The user id.
266
-	 *
267
-	 * @return false|string The insert query or false in case of failure.
268
-	 */
269
-	private function get_insert_query( $user_id ) {
270
-
271
-		// Get the URI, return if there's none.
272
-		if ( false === ( $user_uri = $this->get_uri( $user_id ) ) ) {
273
-			return false;
274
-		}
275
-
276
-		// Try to get the user data, in case of failure return false.
277
-		if ( false === ( $user = get_userdata( $user_id ) ) ) {
278
-			return false;
279
-		};
280
-
281
-		// Build the insert query.
282
-		$query = Wordlift_Query_Builder::new_instance()
283
-		                               ->insert()
284
-		                               ->statement( $user_uri, Wordlift_Query_Builder::RDFS_TYPE_URI, Wordlift_Query_Builder::SCHEMA_PERSON_URI )
285
-		                               ->statement( $user_uri, Wordlift_Query_Builder::RDFS_LABEL_URI, $user->display_name )
286
-		                               ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_GIVEN_NAME_URI, $user->user_firstname )
287
-		                               ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_FAMILY_NAME_URI, $user->user_lastname )
288
-		                               ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_URL_URI, ( ! empty( $user->user_url ) ? $user->user_url : get_author_posts_url( $user_id ) ) )
289
-		                               ->build();
290
-
291
-		return $query;
292
-	}
13
+    /**
14
+     * The meta key where the user's URI is stored.
15
+     *
16
+     * @since 3.1.7
17
+     */
18
+    const URI_META_KEY = '_wl_uri';
19
+
20
+    /**
21
+     * The meta key holding the entity id representing a {@link WP_User}.
22
+     *
23
+     * @since 3.14.0
24
+     */
25
+    const ENTITY_META_KEY = '_wl_entity';
26
+
27
+    /**
28
+     * The Log service.
29
+     *
30
+     * @since  3.1.7
31
+     * @access private
32
+     * @var \Wordlift_Log_Service $log_service The Log service.
33
+     */
34
+    private $log_service;
35
+
36
+    /**
37
+     * The singleton instance of the User service.
38
+     *
39
+     * @since  3.1.7
40
+     * @access private
41
+     * @var \Wordlift_User_Service $user_service The singleton instance of the User service.
42
+     */
43
+    private static $instance;
44
+
45
+    /**
46
+     * Create an instance of the User service.
47
+     *
48
+     * @since 3.1.7
49
+     */
50
+    public function __construct() {
51
+
52
+        $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_User_Service' );
53
+
54
+        self::$instance = $this;
55
+
56
+    }
57
+
58
+    /**
59
+     * Get the singleton instance of the User service.
60
+     *
61
+     * @since 3.1.7
62
+     * @return \Wordlift_User_Service The singleton instance of the User service.
63
+     */
64
+    public static function get_instance() {
65
+
66
+        return self::$instance;
67
+    }
68
+
69
+    /**
70
+     * Get the URI for a user.
71
+     *
72
+     * @since 3.1.7
73
+     *
74
+     * @param int $user_id The user id
75
+     *
76
+     * @return false|string The user's URI or false in case of failure.
77
+     */
78
+    public function get_uri( $user_id ) {
79
+
80
+        // Try to get the URI stored in the user's meta and return it if available.
81
+        if ( false !== ( $user_uri = $this->_get_uri( $user_id ) ) ) {
82
+            return $user_uri;
83
+        }
84
+
85
+        // Try to build an URI, return false in case of failure.
86
+        if ( false === ( $user_uri = $this->_build_uri( $user_id ) ) ) {
87
+            return false;
88
+        }
89
+
90
+        // Store the URI for future requests (we need a "permanent" URI).
91
+        $this->_set_uri( $user_id, $user_uri );
92
+
93
+        return $user_uri;
94
+    }
95
+
96
+    /**
97
+     * Receives wp_insert_post events.
98
+     *
99
+     * @since 3.1.7
100
+     *
101
+     * @param int     $post_id Post ID.
102
+     * @param WP_Post $post    Post object.
103
+     * @param bool    $update  Whether this is an existing post being updated or not.
104
+     */
105
+    public function wp_insert_post( $post_id, $post, $update ) {
106
+
107
+        // If the post is not published, return.
108
+        if ( 'publish' !== get_post_status( $post_id ) ) {
109
+            return;
110
+        }
111
+
112
+        // We expect a numeric author id.
113
+        if ( ! is_numeric( $post->post_author ) ) {
114
+            return;
115
+        }
116
+
117
+        // Get the delete query,or return in case of failure.
118
+        if ( false === ( $delete = $this->get_delete_query( $post->post_author ) ) ) {
119
+            return;
120
+        }
121
+
122
+        // Get the insert query,or return in case of failure.
123
+        if ( false === ( $insert = $this->get_insert_query( $post->post_author ) ) ) {
124
+            return;
125
+        }
126
+
127
+        // Send the query to the triple store.
128
+        rl_execute_sparql_update_query( $delete . $insert );
129
+
130
+    }
131
+
132
+    /**
133
+     * Set the `id` of the entity representing a {@link WP_User}.
134
+     *
135
+     * If the `id` is set to 0 (or less) then the meta is deleted.
136
+     *
137
+     * @since 3.14.0
138
+     *
139
+     * @param int $user_id The {@link WP_User}.
140
+     * @param int $value   The entity {@link WP_Post} `id`.
141
+     *
142
+     * @return bool|int  Meta ID if the key didn't exist, true on successful update, false on failure.
143
+     */
144
+    public function set_entity( $user_id, $value ) {
145
+
146
+        return 0 < $value
147
+            ? update_user_meta( $user_id, self::ENTITY_META_KEY, $value )
148
+            : delete_user_meta( $user_id, self::ENTITY_META_KEY );
149
+    }
150
+
151
+    /**
152
+     * Get the {@link WP_Post} `id` of the entity representing a {@link WP_User}.
153
+     *
154
+     * @since 3.14.0
155
+     *
156
+     * @param int $user_id The {@link WP_User}'s `id`.
157
+     *
158
+     * @return string The entity {@link WP_Post} `id` or an empty string if not set.
159
+     */
160
+    public function get_entity( $user_id ) {
161
+
162
+        return get_user_meta( $user_id, self::ENTITY_META_KEY, true );
163
+    }
164
+
165
+    /**
166
+     * Get the user's URI stored in the user's meta.
167
+     *
168
+     * @since 3.1.7
169
+     *
170
+     * @param int $user_id The user id.
171
+     *
172
+     * @return false|string The user's URI or false if not found.
173
+     */
174
+    private function _get_uri( $user_id ) {
175
+
176
+        $user_uri = get_user_meta( $user_id, self::URI_META_KEY, true );
177
+
178
+        if ( empty( $user_uri ) ) {
179
+            return false;
180
+        }
181
+
182
+        return $user_uri;
183
+    }
184
+
185
+    /**
186
+     * Build an URI for a user.
187
+     *
188
+     * @since 3.1.7
189
+     *
190
+     * @param int $user_id The user's id.
191
+     *
192
+     * @return false|string The user's URI or false in case of failure.
193
+     */
194
+    private function _build_uri( $user_id ) {
195
+
196
+        // Get the user, return false in case of failure.
197
+        if ( false === ( $user = get_userdata( $user_id ) ) ) {
198
+            return false;
199
+        };
200
+
201
+        // If the nicename is not set, return a failure.
202
+        if ( empty( $user->user_nicename ) ) {
203
+            return false;
204
+        }
205
+
206
+        return wl_configuration_get_redlink_dataset_uri() . "/user/$user->user_nicename";
207
+    }
208
+
209
+    /**
210
+     * Store the URI in user's meta.
211
+     *
212
+     * @since 3.1.7
213
+     *
214
+     * @param int    $user_id  The user's id.
215
+     * @param string $user_uri The user's uri.
216
+     *
217
+     * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
218
+     */
219
+    private function _set_uri( $user_id, $user_uri ) {
220
+
221
+        return update_user_meta( $user_id, self::URI_META_KEY, $user_uri );
222
+    }
223
+
224
+    /**
225
+     * Get the delete query.
226
+     *
227
+     * @since 3.1.7
228
+     *
229
+     * @param int $user_id The user id.
230
+     *
231
+     * @return false|string The delete query or false in case of failure.
232
+     */
233
+    private function get_delete_query( $user_id ) {
234
+
235
+        // Get the URI, return if there's none.
236
+        if ( false === ( $user_uri = $this->get_uri( $user_id ) ) ) {
237
+            return false;
238
+        }
239
+
240
+        // Build the delete query.
241
+        $query = Wordlift_Query_Builder::new_instance()->delete()
242
+                                        ->statement( $user_uri, Wordlift_Query_Builder::RDFS_TYPE_URI, '?o' )
243
+                                        ->build()
244
+                    . Wordlift_Query_Builder::new_instance()->delete()
245
+                                            ->statement( $user_uri, Wordlift_Query_Builder::RDFS_LABEL_URI, '?o' )
246
+                                            ->build()
247
+                    . Wordlift_Query_Builder::new_instance()->delete()
248
+                                            ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_GIVEN_NAME_URI, '?o' )
249
+                                            ->build()
250
+                    . Wordlift_Query_Builder::new_instance()->delete()
251
+                                            ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_FAMILY_NAME_URI, '?o' )
252
+                                            ->build()
253
+                    . Wordlift_Query_Builder::new_instance()->delete()
254
+                                            ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_URL_URI, '?o' )
255
+                                            ->build();
256
+
257
+        return $query;
258
+    }
259
+
260
+    /**
261
+     * Get the insert query.
262
+     *
263
+     * @since 3.1.7
264
+     *
265
+     * @param int $user_id The user id.
266
+     *
267
+     * @return false|string The insert query or false in case of failure.
268
+     */
269
+    private function get_insert_query( $user_id ) {
270
+
271
+        // Get the URI, return if there's none.
272
+        if ( false === ( $user_uri = $this->get_uri( $user_id ) ) ) {
273
+            return false;
274
+        }
275
+
276
+        // Try to get the user data, in case of failure return false.
277
+        if ( false === ( $user = get_userdata( $user_id ) ) ) {
278
+            return false;
279
+        };
280
+
281
+        // Build the insert query.
282
+        $query = Wordlift_Query_Builder::new_instance()
283
+                                        ->insert()
284
+                                        ->statement( $user_uri, Wordlift_Query_Builder::RDFS_TYPE_URI, Wordlift_Query_Builder::SCHEMA_PERSON_URI )
285
+                                        ->statement( $user_uri, Wordlift_Query_Builder::RDFS_LABEL_URI, $user->display_name )
286
+                                        ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_GIVEN_NAME_URI, $user->user_firstname )
287
+                                        ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_FAMILY_NAME_URI, $user->user_lastname )
288
+                                        ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_URL_URI, ( ! empty( $user->user_url ) ? $user->user_url : get_author_posts_url( $user_id ) ) )
289
+                                        ->build();
290
+
291
+        return $query;
292
+    }
293 293
 
294 294
 }
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function __construct() {
51 51
 
52
-		$this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_User_Service' );
52
+		$this->log_service = Wordlift_Log_Service::get_logger('Wordlift_User_Service');
53 53
 
54 54
 		self::$instance = $this;
55 55
 
@@ -75,20 +75,20 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @return false|string The user's URI or false in case of failure.
77 77
 	 */
78
-	public function get_uri( $user_id ) {
78
+	public function get_uri($user_id) {
79 79
 
80 80
 		// Try to get the URI stored in the user's meta and return it if available.
81
-		if ( false !== ( $user_uri = $this->_get_uri( $user_id ) ) ) {
81
+		if (false !== ($user_uri = $this->_get_uri($user_id))) {
82 82
 			return $user_uri;
83 83
 		}
84 84
 
85 85
 		// Try to build an URI, return false in case of failure.
86
-		if ( false === ( $user_uri = $this->_build_uri( $user_id ) ) ) {
86
+		if (false === ($user_uri = $this->_build_uri($user_id))) {
87 87
 			return false;
88 88
 		}
89 89
 
90 90
 		// Store the URI for future requests (we need a "permanent" URI).
91
-		$this->_set_uri( $user_id, $user_uri );
91
+		$this->_set_uri($user_id, $user_uri);
92 92
 
93 93
 		return $user_uri;
94 94
 	}
@@ -102,30 +102,30 @@  discard block
 block discarded – undo
102 102
 	 * @param WP_Post $post    Post object.
103 103
 	 * @param bool    $update  Whether this is an existing post being updated or not.
104 104
 	 */
105
-	public function wp_insert_post( $post_id, $post, $update ) {
105
+	public function wp_insert_post($post_id, $post, $update) {
106 106
 
107 107
 		// If the post is not published, return.
108
-		if ( 'publish' !== get_post_status( $post_id ) ) {
108
+		if ('publish' !== get_post_status($post_id)) {
109 109
 			return;
110 110
 		}
111 111
 
112 112
 		// We expect a numeric author id.
113
-		if ( ! is_numeric( $post->post_author ) ) {
113
+		if ( ! is_numeric($post->post_author)) {
114 114
 			return;
115 115
 		}
116 116
 
117 117
 		// Get the delete query,or return in case of failure.
118
-		if ( false === ( $delete = $this->get_delete_query( $post->post_author ) ) ) {
118
+		if (false === ($delete = $this->get_delete_query($post->post_author))) {
119 119
 			return;
120 120
 		}
121 121
 
122 122
 		// Get the insert query,or return in case of failure.
123
-		if ( false === ( $insert = $this->get_insert_query( $post->post_author ) ) ) {
123
+		if (false === ($insert = $this->get_insert_query($post->post_author))) {
124 124
 			return;
125 125
 		}
126 126
 
127 127
 		// Send the query to the triple store.
128
-		rl_execute_sparql_update_query( $delete . $insert );
128
+		rl_execute_sparql_update_query($delete.$insert);
129 129
 
130 130
 	}
131 131
 
@@ -141,11 +141,11 @@  discard block
 block discarded – undo
141 141
 	 *
142 142
 	 * @return bool|int  Meta ID if the key didn't exist, true on successful update, false on failure.
143 143
 	 */
144
-	public function set_entity( $user_id, $value ) {
144
+	public function set_entity($user_id, $value) {
145 145
 
146 146
 		return 0 < $value
147
-			? update_user_meta( $user_id, self::ENTITY_META_KEY, $value )
148
-			: delete_user_meta( $user_id, self::ENTITY_META_KEY );
147
+			? update_user_meta($user_id, self::ENTITY_META_KEY, $value)
148
+			: delete_user_meta($user_id, self::ENTITY_META_KEY);
149 149
 	}
150 150
 
151 151
 	/**
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @return string The entity {@link WP_Post} `id` or an empty string if not set.
159 159
 	 */
160
-	public function get_entity( $user_id ) {
160
+	public function get_entity($user_id) {
161 161
 
162
-		return get_user_meta( $user_id, self::ENTITY_META_KEY, true );
162
+		return get_user_meta($user_id, self::ENTITY_META_KEY, true);
163 163
 	}
164 164
 
165 165
 	/**
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 	 *
172 172
 	 * @return false|string The user's URI or false if not found.
173 173
 	 */
174
-	private function _get_uri( $user_id ) {
174
+	private function _get_uri($user_id) {
175 175
 
176
-		$user_uri = get_user_meta( $user_id, self::URI_META_KEY, true );
176
+		$user_uri = get_user_meta($user_id, self::URI_META_KEY, true);
177 177
 
178
-		if ( empty( $user_uri ) ) {
178
+		if (empty($user_uri)) {
179 179
 			return false;
180 180
 		}
181 181
 
@@ -191,19 +191,19 @@  discard block
 block discarded – undo
191 191
 	 *
192 192
 	 * @return false|string The user's URI or false in case of failure.
193 193
 	 */
194
-	private function _build_uri( $user_id ) {
194
+	private function _build_uri($user_id) {
195 195
 
196 196
 		// Get the user, return false in case of failure.
197
-		if ( false === ( $user = get_userdata( $user_id ) ) ) {
197
+		if (false === ($user = get_userdata($user_id))) {
198 198
 			return false;
199 199
 		};
200 200
 
201 201
 		// If the nicename is not set, return a failure.
202
-		if ( empty( $user->user_nicename ) ) {
202
+		if (empty($user->user_nicename)) {
203 203
 			return false;
204 204
 		}
205 205
 
206
-		return wl_configuration_get_redlink_dataset_uri() . "/user/$user->user_nicename";
206
+		return wl_configuration_get_redlink_dataset_uri()."/user/$user->user_nicename";
207 207
 	}
208 208
 
209 209
 	/**
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 	 *
217 217
 	 * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
218 218
 	 */
219
-	private function _set_uri( $user_id, $user_uri ) {
219
+	private function _set_uri($user_id, $user_uri) {
220 220
 
221
-		return update_user_meta( $user_id, self::URI_META_KEY, $user_uri );
221
+		return update_user_meta($user_id, self::URI_META_KEY, $user_uri);
222 222
 	}
223 223
 
224 224
 	/**
@@ -230,28 +230,28 @@  discard block
 block discarded – undo
230 230
 	 *
231 231
 	 * @return false|string The delete query or false in case of failure.
232 232
 	 */
233
-	private function get_delete_query( $user_id ) {
233
+	private function get_delete_query($user_id) {
234 234
 
235 235
 		// Get the URI, return if there's none.
236
-		if ( false === ( $user_uri = $this->get_uri( $user_id ) ) ) {
236
+		if (false === ($user_uri = $this->get_uri($user_id))) {
237 237
 			return false;
238 238
 		}
239 239
 
240 240
 		// Build the delete query.
241 241
 		$query = Wordlift_Query_Builder::new_instance()->delete()
242
-		                               ->statement( $user_uri, Wordlift_Query_Builder::RDFS_TYPE_URI, '?o' )
242
+		                               ->statement($user_uri, Wordlift_Query_Builder::RDFS_TYPE_URI, '?o')
243 243
 		                               ->build()
244 244
 		         . Wordlift_Query_Builder::new_instance()->delete()
245
-		                                 ->statement( $user_uri, Wordlift_Query_Builder::RDFS_LABEL_URI, '?o' )
245
+		                                 ->statement($user_uri, Wordlift_Query_Builder::RDFS_LABEL_URI, '?o')
246 246
 		                                 ->build()
247 247
 		         . Wordlift_Query_Builder::new_instance()->delete()
248
-		                                 ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_GIVEN_NAME_URI, '?o' )
248
+		                                 ->statement($user_uri, Wordlift_Query_Builder::SCHEMA_GIVEN_NAME_URI, '?o')
249 249
 		                                 ->build()
250 250
 		         . Wordlift_Query_Builder::new_instance()->delete()
251
-		                                 ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_FAMILY_NAME_URI, '?o' )
251
+		                                 ->statement($user_uri, Wordlift_Query_Builder::SCHEMA_FAMILY_NAME_URI, '?o')
252 252
 		                                 ->build()
253 253
 		         . Wordlift_Query_Builder::new_instance()->delete()
254
-		                                 ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_URL_URI, '?o' )
254
+		                                 ->statement($user_uri, Wordlift_Query_Builder::SCHEMA_URL_URI, '?o')
255 255
 		                                 ->build();
256 256
 
257 257
 		return $query;
@@ -266,26 +266,26 @@  discard block
 block discarded – undo
266 266
 	 *
267 267
 	 * @return false|string The insert query or false in case of failure.
268 268
 	 */
269
-	private function get_insert_query( $user_id ) {
269
+	private function get_insert_query($user_id) {
270 270
 
271 271
 		// Get the URI, return if there's none.
272
-		if ( false === ( $user_uri = $this->get_uri( $user_id ) ) ) {
272
+		if (false === ($user_uri = $this->get_uri($user_id))) {
273 273
 			return false;
274 274
 		}
275 275
 
276 276
 		// Try to get the user data, in case of failure return false.
277
-		if ( false === ( $user = get_userdata( $user_id ) ) ) {
277
+		if (false === ($user = get_userdata($user_id))) {
278 278
 			return false;
279 279
 		};
280 280
 
281 281
 		// Build the insert query.
282 282
 		$query = Wordlift_Query_Builder::new_instance()
283 283
 		                               ->insert()
284
-		                               ->statement( $user_uri, Wordlift_Query_Builder::RDFS_TYPE_URI, Wordlift_Query_Builder::SCHEMA_PERSON_URI )
285
-		                               ->statement( $user_uri, Wordlift_Query_Builder::RDFS_LABEL_URI, $user->display_name )
286
-		                               ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_GIVEN_NAME_URI, $user->user_firstname )
287
-		                               ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_FAMILY_NAME_URI, $user->user_lastname )
288
-		                               ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_URL_URI, ( ! empty( $user->user_url ) ? $user->user_url : get_author_posts_url( $user_id ) ) )
284
+		                               ->statement($user_uri, Wordlift_Query_Builder::RDFS_TYPE_URI, Wordlift_Query_Builder::SCHEMA_PERSON_URI)
285
+		                               ->statement($user_uri, Wordlift_Query_Builder::RDFS_LABEL_URI, $user->display_name)
286
+		                               ->statement($user_uri, Wordlift_Query_Builder::SCHEMA_GIVEN_NAME_URI, $user->user_firstname)
287
+		                               ->statement($user_uri, Wordlift_Query_Builder::SCHEMA_FAMILY_NAME_URI, $user->user_lastname)
288
+		                               ->statement($user_uri, Wordlift_Query_Builder::SCHEMA_URL_URI, ( ! empty($user->user_url) ? $user->user_url : get_author_posts_url($user_id)))
289 289
 		                               ->build();
290 290
 
291 291
 		return $query;
Please login to merge, or discard this patch.
src/includes/class-wordlift-post-to-jsonld-converter.php 2 patches
Indentation   +223 added lines, -223 removed lines patch added patch discarded remove patch
@@ -15,228 +15,228 @@
 block discarded – undo
15 15
  */
16 16
 class Wordlift_Post_To_Jsonld_Converter extends Wordlift_Abstract_Post_To_Jsonld_Converter {
17 17
 
18
-	/**
19
-	 * A {@link Wordlift_Configuration_Service} instance.
20
-	 *
21
-	 * @since  3.10.0
22
-	 * @access private
23
-	 * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
24
-	 */
25
-	private $configuration_service;
26
-
27
-	/**
28
-	 * @var Wordlift_Entity_Post_To_Jsonld_Converter
29
-	 */
30
-	private $entity_post_to_jsonld_converter;
31
-
32
-	/**
33
-	 * A {@link Wordlift_Log_Service} instance.
34
-	 *
35
-	 * @since  3.10.0
36
-	 * @access private
37
-	 * @var Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
38
-	 */
39
-	private $log;
40
-
41
-	/**
42
-	 * Wordlift_Post_To_Jsonld_Converter constructor.
43
-	 *
44
-	 * @since 3.10.0
45
-	 *
46
-	 * @param \Wordlift_Entity_Type_Service              $entity_type_service   A {@link Wordlift_Entity_Type_Service} instance.
47
-	 * @param \Wordlift_Entity_Service                   $entity_service        A {@link Wordlift_Entity_Service} instance.
48
-	 * @param \Wordlift_User_Service                     $user_service          A {@link Wordlift_User_Service} instance.
49
-	 * @param \Wordlift_Attachment_Service               $attachment_service    A {@link Wordlift_Attachment_Service} instance.
50
-	 * @param \Wordlift_Configuration_Service            $configuration_service A {@link Wordlift_Configuration_Service} instance.
51
-	 * @param  \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter
52
-	 */
53
-	public function __construct( $entity_type_service, $entity_service, $user_service, $attachment_service, $configuration_service, $entity_post_to_jsonld_converter ) {
54
-		parent::__construct( $entity_type_service, $entity_service, $user_service, $attachment_service );
55
-
56
-		$this->configuration_service           = $configuration_service;
57
-		$this->entity_post_to_jsonld_converter = $entity_post_to_jsonld_converter;
58
-
59
-		// Set a reference to the logger.
60
-		$this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Post_To_Jsonld_Converter' );
61
-	}
62
-
63
-	/**
64
-	 * Convert the provided {@link WP_Post} to a JSON-LD array. Any entity reference
65
-	 * found while processing the post is set in the $references array.
66
-	 *
67
-	 * @since 3.10.0
68
-	 *
69
-	 *
70
-	 * @param int   $post_id    The post id.
71
-	 * @param array $references An array of entity references.
72
-	 *
73
-	 * @return array A JSON-LD array.
74
-	 */
75
-	public function convert( $post_id, &$references = array() ) {
76
-
77
-		// Get the post instance.
78
-		if ( null === $post = get_post( $post_id ) ) {
79
-			// Post not found.
80
-			return null;
81
-		}
82
-
83
-		// Get the base JSON-LD and the list of entities referenced by this entity.
84
-		$jsonld = parent::convert( $post_id, $references );
85
-
86
-		// Get the entity name.
87
-		$jsonld['headline'] = $post->post_title;
88
-
89
-		// Get the author.
90
-		$jsonld['author'] = $this->get_author( $post->post_author );
91
-
92
-		// Set the published and modified dates.
93
-		$jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i', true, $post, false );
94
-		$jsonld['dateModified']  = get_post_modified_time( 'Y-m-d\TH:i', true, $post, false );
95
-
96
-		// Set the publisher.
97
-		$this->set_publisher( $jsonld );
98
-
99
-		// Process the references if any.
100
-		if ( 0 < sizeof( $references ) ) {
101
-
102
-			// Prepare the `about` and `mentions` array.
103
-			$about = $mentions = array();
104
-
105
-			// If the entity is in the title, then it should be an `about`.
106
-			foreach ( $references as $reference ) {
107
-
108
-				// Get the entity labels.
109
-				$labels = $this->entity_service->get_labels( $reference );
110
-
111
-				// Get the entity URI.
112
-				$item = array( '@id' => $this->entity_service->get_uri( $reference ) );
113
-
114
-				// Check if the labels match any part of the title.
115
-				$matches = 1 === preg_match( '/' . implode( '|', $labels ) . '/', $post->post_title );
116
-
117
-				// If the title matches, assign the entity to the about, otherwise to the mentions.
118
-				if ( $matches ) {
119
-					$about[] = $item;
120
-				} else {
121
-					$mentions[] = $item;
122
-				}
123
-			}
124
-
125
-			// If we have abouts, assign them to the JSON-LD.
126
-			if ( 0 < sizeof( $about ) ) {
127
-				$jsonld['about'] = $about;
128
-			}
129
-
130
-			// If we have mentions, assign them to the JSON-LD.
131
-			if ( 0 < sizeof( $mentions ) ) {
132
-				$jsonld['mentions'] = $mentions;
133
-			}
134
-
135
-		}
136
-
137
-		return $jsonld;
138
-	}
139
-
140
-	/**
141
-	 * Get the author's JSON-LD fragment.
142
-	 *
143
-	 * The JSON-LD fragment is generated using the {@link WP_User}'s data or
144
-	 * the referenced entity if configured for the {@link WP_User}.
145
-	 *
146
-	 * @since 3.14.0
147
-	 *
148
-	 * @param int $author_id The author {@link WP_User}'s `id`.
149
-	 *
150
-	 * @return array A JSON-LD structure.
151
-	 */
152
-	private function get_author( $author_id ) {
153
-
154
-		// Get the entity bound to this user.
155
-		$entity_id = $this->user_service->get_entity( $author_id );
156
-
157
-		// If there's no entity bound return a simple author structure.
158
-		if ( empty( $entity_id ) ) {
159
-
160
-			$author     = get_the_author_meta( 'display_name', $author_id );
161
-			$author_uri = $this->user_service->get_uri( $author_id );
162
-
163
-			return array(
164
-				'@type' => 'Person',
165
-				'@id'   => $author_uri,
166
-				'name'  => $author,
167
-			);
168
-		}
169
-
170
-		// Return the JSON-LD for the referenced entity.
171
-		return $this->entity_post_to_jsonld_converter->convert( $entity_id );
172
-	}
173
-
174
-	/**
175
-	 * Enrich the provided params array with publisher data, if available.
176
-	 *
177
-	 * @since 3.10.0
178
-	 *
179
-	 * @param array $params The parameters array.
180
-	 */
181
-	private function set_publisher( &$params ) {
182
-
183
-		// If the publisher id isn't set don't do anything.
184
-		if ( null === $publisher_id = $this->configuration_service->get_publisher_id() ) {
185
-			return;
186
-		}
187
-
188
-		// Get the post instance.
189
-		if ( null === $post = get_post( $publisher_id ) ) {
190
-			// Publisher not found.
191
-			return;
192
-		}
193
-
194
-		// Get the item id
195
-		$id = $this->entity_service->get_uri( $publisher_id );
196
-
197
-		// Get the type.
198
-		$type = $this->entity_type_service->get( $publisher_id );
199
-
200
-		// Get the name.
201
-		$name = $post->post_title;
202
-
203
-		// Set the publisher data.
204
-		$params['publisher'] = array(
205
-			'@type' => $this->relative_to_context( $type['uri'] ),
206
-			'@id'   => $id,
207
-			'name'  => $name,
208
-		);
209
-
210
-		// Set the logo, only for http://schema.org/Organization as Person doesn't
211
-		// support the logo property.
212
-		//
213
-		// See http://schema.org/logo
214
-		if ( 'http://schema.org/Organization' !== $type['uri'] ) {
215
-			return;
216
-		}
217
-
218
-		// Get the logo, WP < 4.4 way: only post ID accepted here.
219
-		if ( '' === $thumbnail_id = get_post_thumbnail_id( $post->ID ) ) {
220
-			return;
221
-		}
222
-
223
-		// Get the image URL.
224
-		if ( false === $attachment = wp_get_attachment_image_src( $thumbnail_id, 'full' ) ) {
225
-			return;
226
-		}
227
-
228
-		// Copy over some useful properties.
229
-		//
230
-		// See https://developers.google.com/search/docs/data-types/articles
231
-		$params['publisher']['logo']['@type'] = 'ImageObject';
232
-		$params['publisher']['logo']['url']   = $attachment[0];
233
-		// If you specify a "width" or "height" value you should leave out
234
-		// 'px'. For example: "width":"4608px" should be "width":"4608".
235
-		//
236
-		// See https://github.com/insideout10/wordlift-plugin/issues/451
237
-		$params['publisher']['logo']['width']  = $attachment[1];
238
-		$params['publisher']['logo']['height'] = $attachment[2];
239
-
240
-	}
18
+    /**
19
+     * A {@link Wordlift_Configuration_Service} instance.
20
+     *
21
+     * @since  3.10.0
22
+     * @access private
23
+     * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
24
+     */
25
+    private $configuration_service;
26
+
27
+    /**
28
+     * @var Wordlift_Entity_Post_To_Jsonld_Converter
29
+     */
30
+    private $entity_post_to_jsonld_converter;
31
+
32
+    /**
33
+     * A {@link Wordlift_Log_Service} instance.
34
+     *
35
+     * @since  3.10.0
36
+     * @access private
37
+     * @var Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
38
+     */
39
+    private $log;
40
+
41
+    /**
42
+     * Wordlift_Post_To_Jsonld_Converter constructor.
43
+     *
44
+     * @since 3.10.0
45
+     *
46
+     * @param \Wordlift_Entity_Type_Service              $entity_type_service   A {@link Wordlift_Entity_Type_Service} instance.
47
+     * @param \Wordlift_Entity_Service                   $entity_service        A {@link Wordlift_Entity_Service} instance.
48
+     * @param \Wordlift_User_Service                     $user_service          A {@link Wordlift_User_Service} instance.
49
+     * @param \Wordlift_Attachment_Service               $attachment_service    A {@link Wordlift_Attachment_Service} instance.
50
+     * @param \Wordlift_Configuration_Service            $configuration_service A {@link Wordlift_Configuration_Service} instance.
51
+     * @param  \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter
52
+     */
53
+    public function __construct( $entity_type_service, $entity_service, $user_service, $attachment_service, $configuration_service, $entity_post_to_jsonld_converter ) {
54
+        parent::__construct( $entity_type_service, $entity_service, $user_service, $attachment_service );
55
+
56
+        $this->configuration_service           = $configuration_service;
57
+        $this->entity_post_to_jsonld_converter = $entity_post_to_jsonld_converter;
58
+
59
+        // Set a reference to the logger.
60
+        $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Post_To_Jsonld_Converter' );
61
+    }
62
+
63
+    /**
64
+     * Convert the provided {@link WP_Post} to a JSON-LD array. Any entity reference
65
+     * found while processing the post is set in the $references array.
66
+     *
67
+     * @since 3.10.0
68
+     *
69
+     *
70
+     * @param int   $post_id    The post id.
71
+     * @param array $references An array of entity references.
72
+     *
73
+     * @return array A JSON-LD array.
74
+     */
75
+    public function convert( $post_id, &$references = array() ) {
76
+
77
+        // Get the post instance.
78
+        if ( null === $post = get_post( $post_id ) ) {
79
+            // Post not found.
80
+            return null;
81
+        }
82
+
83
+        // Get the base JSON-LD and the list of entities referenced by this entity.
84
+        $jsonld = parent::convert( $post_id, $references );
85
+
86
+        // Get the entity name.
87
+        $jsonld['headline'] = $post->post_title;
88
+
89
+        // Get the author.
90
+        $jsonld['author'] = $this->get_author( $post->post_author );
91
+
92
+        // Set the published and modified dates.
93
+        $jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i', true, $post, false );
94
+        $jsonld['dateModified']  = get_post_modified_time( 'Y-m-d\TH:i', true, $post, false );
95
+
96
+        // Set the publisher.
97
+        $this->set_publisher( $jsonld );
98
+
99
+        // Process the references if any.
100
+        if ( 0 < sizeof( $references ) ) {
101
+
102
+            // Prepare the `about` and `mentions` array.
103
+            $about = $mentions = array();
104
+
105
+            // If the entity is in the title, then it should be an `about`.
106
+            foreach ( $references as $reference ) {
107
+
108
+                // Get the entity labels.
109
+                $labels = $this->entity_service->get_labels( $reference );
110
+
111
+                // Get the entity URI.
112
+                $item = array( '@id' => $this->entity_service->get_uri( $reference ) );
113
+
114
+                // Check if the labels match any part of the title.
115
+                $matches = 1 === preg_match( '/' . implode( '|', $labels ) . '/', $post->post_title );
116
+
117
+                // If the title matches, assign the entity to the about, otherwise to the mentions.
118
+                if ( $matches ) {
119
+                    $about[] = $item;
120
+                } else {
121
+                    $mentions[] = $item;
122
+                }
123
+            }
124
+
125
+            // If we have abouts, assign them to the JSON-LD.
126
+            if ( 0 < sizeof( $about ) ) {
127
+                $jsonld['about'] = $about;
128
+            }
129
+
130
+            // If we have mentions, assign them to the JSON-LD.
131
+            if ( 0 < sizeof( $mentions ) ) {
132
+                $jsonld['mentions'] = $mentions;
133
+            }
134
+
135
+        }
136
+
137
+        return $jsonld;
138
+    }
139
+
140
+    /**
141
+     * Get the author's JSON-LD fragment.
142
+     *
143
+     * The JSON-LD fragment is generated using the {@link WP_User}'s data or
144
+     * the referenced entity if configured for the {@link WP_User}.
145
+     *
146
+     * @since 3.14.0
147
+     *
148
+     * @param int $author_id The author {@link WP_User}'s `id`.
149
+     *
150
+     * @return array A JSON-LD structure.
151
+     */
152
+    private function get_author( $author_id ) {
153
+
154
+        // Get the entity bound to this user.
155
+        $entity_id = $this->user_service->get_entity( $author_id );
156
+
157
+        // If there's no entity bound return a simple author structure.
158
+        if ( empty( $entity_id ) ) {
159
+
160
+            $author     = get_the_author_meta( 'display_name', $author_id );
161
+            $author_uri = $this->user_service->get_uri( $author_id );
162
+
163
+            return array(
164
+                '@type' => 'Person',
165
+                '@id'   => $author_uri,
166
+                'name'  => $author,
167
+            );
168
+        }
169
+
170
+        // Return the JSON-LD for the referenced entity.
171
+        return $this->entity_post_to_jsonld_converter->convert( $entity_id );
172
+    }
173
+
174
+    /**
175
+     * Enrich the provided params array with publisher data, if available.
176
+     *
177
+     * @since 3.10.0
178
+     *
179
+     * @param array $params The parameters array.
180
+     */
181
+    private function set_publisher( &$params ) {
182
+
183
+        // If the publisher id isn't set don't do anything.
184
+        if ( null === $publisher_id = $this->configuration_service->get_publisher_id() ) {
185
+            return;
186
+        }
187
+
188
+        // Get the post instance.
189
+        if ( null === $post = get_post( $publisher_id ) ) {
190
+            // Publisher not found.
191
+            return;
192
+        }
193
+
194
+        // Get the item id
195
+        $id = $this->entity_service->get_uri( $publisher_id );
196
+
197
+        // Get the type.
198
+        $type = $this->entity_type_service->get( $publisher_id );
199
+
200
+        // Get the name.
201
+        $name = $post->post_title;
202
+
203
+        // Set the publisher data.
204
+        $params['publisher'] = array(
205
+            '@type' => $this->relative_to_context( $type['uri'] ),
206
+            '@id'   => $id,
207
+            'name'  => $name,
208
+        );
209
+
210
+        // Set the logo, only for http://schema.org/Organization as Person doesn't
211
+        // support the logo property.
212
+        //
213
+        // See http://schema.org/logo
214
+        if ( 'http://schema.org/Organization' !== $type['uri'] ) {
215
+            return;
216
+        }
217
+
218
+        // Get the logo, WP < 4.4 way: only post ID accepted here.
219
+        if ( '' === $thumbnail_id = get_post_thumbnail_id( $post->ID ) ) {
220
+            return;
221
+        }
222
+
223
+        // Get the image URL.
224
+        if ( false === $attachment = wp_get_attachment_image_src( $thumbnail_id, 'full' ) ) {
225
+            return;
226
+        }
227
+
228
+        // Copy over some useful properties.
229
+        //
230
+        // See https://developers.google.com/search/docs/data-types/articles
231
+        $params['publisher']['logo']['@type'] = 'ImageObject';
232
+        $params['publisher']['logo']['url']   = $attachment[0];
233
+        // If you specify a "width" or "height" value you should leave out
234
+        // 'px'. For example: "width":"4608px" should be "width":"4608".
235
+        //
236
+        // See https://github.com/insideout10/wordlift-plugin/issues/451
237
+        $params['publisher']['logo']['width']  = $attachment[1];
238
+        $params['publisher']['logo']['height'] = $attachment[2];
239
+
240
+    }
241 241
 
242 242
 }
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
 	 * @param \Wordlift_Configuration_Service            $configuration_service A {@link Wordlift_Configuration_Service} instance.
51 51
 	 * @param  \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter
52 52
 	 */
53
-	public function __construct( $entity_type_service, $entity_service, $user_service, $attachment_service, $configuration_service, $entity_post_to_jsonld_converter ) {
54
-		parent::__construct( $entity_type_service, $entity_service, $user_service, $attachment_service );
53
+	public function __construct($entity_type_service, $entity_service, $user_service, $attachment_service, $configuration_service, $entity_post_to_jsonld_converter) {
54
+		parent::__construct($entity_type_service, $entity_service, $user_service, $attachment_service);
55 55
 
56 56
 		$this->configuration_service           = $configuration_service;
57 57
 		$this->entity_post_to_jsonld_converter = $entity_post_to_jsonld_converter;
58 58
 
59 59
 		// Set a reference to the logger.
60
-		$this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Post_To_Jsonld_Converter' );
60
+		$this->log = Wordlift_Log_Service::get_logger('Wordlift_Post_To_Jsonld_Converter');
61 61
 	}
62 62
 
63 63
 	/**
@@ -72,50 +72,50 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @return array A JSON-LD array.
74 74
 	 */
75
-	public function convert( $post_id, &$references = array() ) {
75
+	public function convert($post_id, &$references = array()) {
76 76
 
77 77
 		// Get the post instance.
78
-		if ( null === $post = get_post( $post_id ) ) {
78
+		if (null === $post = get_post($post_id)) {
79 79
 			// Post not found.
80 80
 			return null;
81 81
 		}
82 82
 
83 83
 		// Get the base JSON-LD and the list of entities referenced by this entity.
84
-		$jsonld = parent::convert( $post_id, $references );
84
+		$jsonld = parent::convert($post_id, $references);
85 85
 
86 86
 		// Get the entity name.
87 87
 		$jsonld['headline'] = $post->post_title;
88 88
 
89 89
 		// Get the author.
90
-		$jsonld['author'] = $this->get_author( $post->post_author );
90
+		$jsonld['author'] = $this->get_author($post->post_author);
91 91
 
92 92
 		// Set the published and modified dates.
93
-		$jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i', true, $post, false );
94
-		$jsonld['dateModified']  = get_post_modified_time( 'Y-m-d\TH:i', true, $post, false );
93
+		$jsonld['datePublished'] = get_post_time('Y-m-d\TH:i', true, $post, false);
94
+		$jsonld['dateModified']  = get_post_modified_time('Y-m-d\TH:i', true, $post, false);
95 95
 
96 96
 		// Set the publisher.
97
-		$this->set_publisher( $jsonld );
97
+		$this->set_publisher($jsonld);
98 98
 
99 99
 		// Process the references if any.
100
-		if ( 0 < sizeof( $references ) ) {
100
+		if (0 < sizeof($references)) {
101 101
 
102 102
 			// Prepare the `about` and `mentions` array.
103 103
 			$about = $mentions = array();
104 104
 
105 105
 			// If the entity is in the title, then it should be an `about`.
106
-			foreach ( $references as $reference ) {
106
+			foreach ($references as $reference) {
107 107
 
108 108
 				// Get the entity labels.
109
-				$labels = $this->entity_service->get_labels( $reference );
109
+				$labels = $this->entity_service->get_labels($reference);
110 110
 
111 111
 				// Get the entity URI.
112
-				$item = array( '@id' => $this->entity_service->get_uri( $reference ) );
112
+				$item = array('@id' => $this->entity_service->get_uri($reference));
113 113
 
114 114
 				// Check if the labels match any part of the title.
115
-				$matches = 1 === preg_match( '/' . implode( '|', $labels ) . '/', $post->post_title );
115
+				$matches = 1 === preg_match('/'.implode('|', $labels).'/', $post->post_title);
116 116
 
117 117
 				// If the title matches, assign the entity to the about, otherwise to the mentions.
118
-				if ( $matches ) {
118
+				if ($matches) {
119 119
 					$about[] = $item;
120 120
 				} else {
121 121
 					$mentions[] = $item;
@@ -123,12 +123,12 @@  discard block
 block discarded – undo
123 123
 			}
124 124
 
125 125
 			// If we have abouts, assign them to the JSON-LD.
126
-			if ( 0 < sizeof( $about ) ) {
126
+			if (0 < sizeof($about)) {
127 127
 				$jsonld['about'] = $about;
128 128
 			}
129 129
 
130 130
 			// If we have mentions, assign them to the JSON-LD.
131
-			if ( 0 < sizeof( $mentions ) ) {
131
+			if (0 < sizeof($mentions)) {
132 132
 				$jsonld['mentions'] = $mentions;
133 133
 			}
134 134
 
@@ -149,16 +149,16 @@  discard block
 block discarded – undo
149 149
 	 *
150 150
 	 * @return array A JSON-LD structure.
151 151
 	 */
152
-	private function get_author( $author_id ) {
152
+	private function get_author($author_id) {
153 153
 
154 154
 		// Get the entity bound to this user.
155
-		$entity_id = $this->user_service->get_entity( $author_id );
155
+		$entity_id = $this->user_service->get_entity($author_id);
156 156
 
157 157
 		// If there's no entity bound return a simple author structure.
158
-		if ( empty( $entity_id ) ) {
158
+		if (empty($entity_id)) {
159 159
 
160
-			$author     = get_the_author_meta( 'display_name', $author_id );
161
-			$author_uri = $this->user_service->get_uri( $author_id );
160
+			$author     = get_the_author_meta('display_name', $author_id);
161
+			$author_uri = $this->user_service->get_uri($author_id);
162 162
 
163 163
 			return array(
164 164
 				'@type' => 'Person',
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 		}
169 169
 
170 170
 		// Return the JSON-LD for the referenced entity.
171
-		return $this->entity_post_to_jsonld_converter->convert( $entity_id );
171
+		return $this->entity_post_to_jsonld_converter->convert($entity_id);
172 172
 	}
173 173
 
174 174
 	/**
@@ -178,31 +178,31 @@  discard block
 block discarded – undo
178 178
 	 *
179 179
 	 * @param array $params The parameters array.
180 180
 	 */
181
-	private function set_publisher( &$params ) {
181
+	private function set_publisher(&$params) {
182 182
 
183 183
 		// If the publisher id isn't set don't do anything.
184
-		if ( null === $publisher_id = $this->configuration_service->get_publisher_id() ) {
184
+		if (null === $publisher_id = $this->configuration_service->get_publisher_id()) {
185 185
 			return;
186 186
 		}
187 187
 
188 188
 		// Get the post instance.
189
-		if ( null === $post = get_post( $publisher_id ) ) {
189
+		if (null === $post = get_post($publisher_id)) {
190 190
 			// Publisher not found.
191 191
 			return;
192 192
 		}
193 193
 
194 194
 		// Get the item id
195
-		$id = $this->entity_service->get_uri( $publisher_id );
195
+		$id = $this->entity_service->get_uri($publisher_id);
196 196
 
197 197
 		// Get the type.
198
-		$type = $this->entity_type_service->get( $publisher_id );
198
+		$type = $this->entity_type_service->get($publisher_id);
199 199
 
200 200
 		// Get the name.
201 201
 		$name = $post->post_title;
202 202
 
203 203
 		// Set the publisher data.
204 204
 		$params['publisher'] = array(
205
-			'@type' => $this->relative_to_context( $type['uri'] ),
205
+			'@type' => $this->relative_to_context($type['uri']),
206 206
 			'@id'   => $id,
207 207
 			'name'  => $name,
208 208
 		);
@@ -211,17 +211,17 @@  discard block
 block discarded – undo
211 211
 		// support the logo property.
212 212
 		//
213 213
 		// See http://schema.org/logo
214
-		if ( 'http://schema.org/Organization' !== $type['uri'] ) {
214
+		if ('http://schema.org/Organization' !== $type['uri']) {
215 215
 			return;
216 216
 		}
217 217
 
218 218
 		// Get the logo, WP < 4.4 way: only post ID accepted here.
219
-		if ( '' === $thumbnail_id = get_post_thumbnail_id( $post->ID ) ) {
219
+		if ('' === $thumbnail_id = get_post_thumbnail_id($post->ID)) {
220 220
 			return;
221 221
 		}
222 222
 
223 223
 		// Get the image URL.
224
-		if ( false === $attachment = wp_get_attachment_image_src( $thumbnail_id, 'full' ) ) {
224
+		if (false === $attachment = wp_get_attachment_image_src($thumbnail_id, 'full')) {
225 225
 			return;
226 226
 		}
227 227
 
Please login to merge, or discard this patch.
src/admin/class-wordlift-admin-publisher-element.php 2 patches
Indentation   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -19,116 +19,116 @@  discard block
 block discarded – undo
19 19
  */
20 20
 class Wordlift_Admin_Publisher_Element extends Wordlift_Admin_Author_Element {
21 21
 
22
-	/**
23
-	 * The {@link Wordlift_Configuration_Service} instance.
24
-	 *
25
-	 * @since  3.11.0
26
-	 * @access private
27
-	 * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
28
-	 */
29
-	private $configuration_service;
30
-
31
-	/**
32
-	 * The {@link Wordlift_Publisher_Service} instance.
33
-	 *
34
-	 * @since  3.11.0
35
-	 * @access private
36
-	 * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
37
-	 */
38
-	private $publisher_service;
39
-
40
-	/**
41
-	 * @var Wordlift_Admin_Tabs_Element
42
-	 */
43
-	private $tabs_element;
44
-
45
-	/**
46
-	 * Create a {@link Wordlift_Admin_Publisher_Element} instance.
47
-	 *
48
-	 * @since 3.11.0
49
-	 *
50
-	 * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
51
-	 * @param \Wordlift_Publisher_Service     $publisher_service     The {@link Wordlift_Publisher_Service} instance.
52
-	 * @param \Wordlift_Admin_Tabs_Element    $tabs_element          The {@link Wordlift_Admin_Tabs_Element} instance.
53
-	 * @param \Wordlift_Admin_Select2_Element $select_element        The {@link Wordlift_Admin_Select_Element} instance.
54
-	 */
55
-	function __construct( $configuration_service, $publisher_service, $tabs_element, $select_element ) {
56
-		parent::__construct($publisher_service, $select_element);
57
-
58
-		$this->configuration_service = $configuration_service;
59
-		$this->publisher_service     = $publisher_service;
60
-
61
-		// Child elements.
62
-		$this->tabs_element   = $tabs_element;
63
-
64
-	}
65
-
66
-	/**
67
-	 * @inheritdoc
68
-	 */
69
-	public function render( $args ) {
70
-
71
-		// Parse the arguments and merge with default values.
72
-		$params = wp_parse_args( $args, array(
73
-			'id'   => uniqid( 'wl-input-' ),
74
-			'name' => uniqid( 'wl-input-' ),
75
-		) );
76
-
77
-		// Get the number of potential candidates as publishers.
78
-		$count = $this->publisher_service->count();
79
-
80
-		$this->tabs_element->render( array(
81
-			'tabs'   => array(
82
-				array(
83
-					'label'    => __( 'Select an Existing Publisher', 'wordlift' ),
84
-					'callback' => array( $this, 'select' ),
85
-					'args'     => $params,
86
-				),
87
-				array(
88
-					'label'    => __( 'Create a New Publisher', 'wordlift' ),
89
-					'callback' => array( $this, 'create' ),
90
-					'args'     => $params,
91
-				),
92
-			),
93
-			// Set the default tab according to the number of potential publishers
94
-			// configured in WP: 0 = select, 1 = create.
95
-			'active' => 0 === $count ? 1 : 0,
96
-		) );
97
-
98
-		// Finally return the element instance.
99
-		return $this;
100
-	}
101
-
102
-	/**
103
-	 * Render the publisher's select.
104
-	 *
105
-	 * @since 3.11.0
106
-	 *
107
-	 * @param array $params An array of parameters.
108
-	 */
109
-	public function select( $params ) {
110
-
111
-		// Get the configured publisher id. In case a publisher id is already configured
112
-		// this must be pre-loaded in the options.
113
-		$publisher_id = $this->configuration_service->get_publisher_id();
114
-
115
-		// Get the publisher data.
116
-		$data = $this->publisher_service->query();
117
-
118
-		// Call the select internal render.
119
-		$this->do_render( $params, $publisher_id, $data );
120
-
121
-	}
122
-
123
-	/**
124
-	 * Render the 'create publisher' form.
125
-	 *
126
-	 * @since 3.11.0
127
-	 *
128
-	 * @param array $params An array of parameters.
129
-	 */
130
-	public function create( $params ) {
131
-		?>
22
+    /**
23
+     * The {@link Wordlift_Configuration_Service} instance.
24
+     *
25
+     * @since  3.11.0
26
+     * @access private
27
+     * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
28
+     */
29
+    private $configuration_service;
30
+
31
+    /**
32
+     * The {@link Wordlift_Publisher_Service} instance.
33
+     *
34
+     * @since  3.11.0
35
+     * @access private
36
+     * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
37
+     */
38
+    private $publisher_service;
39
+
40
+    /**
41
+     * @var Wordlift_Admin_Tabs_Element
42
+     */
43
+    private $tabs_element;
44
+
45
+    /**
46
+     * Create a {@link Wordlift_Admin_Publisher_Element} instance.
47
+     *
48
+     * @since 3.11.0
49
+     *
50
+     * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
51
+     * @param \Wordlift_Publisher_Service     $publisher_service     The {@link Wordlift_Publisher_Service} instance.
52
+     * @param \Wordlift_Admin_Tabs_Element    $tabs_element          The {@link Wordlift_Admin_Tabs_Element} instance.
53
+     * @param \Wordlift_Admin_Select2_Element $select_element        The {@link Wordlift_Admin_Select_Element} instance.
54
+     */
55
+    function __construct( $configuration_service, $publisher_service, $tabs_element, $select_element ) {
56
+        parent::__construct($publisher_service, $select_element);
57
+
58
+        $this->configuration_service = $configuration_service;
59
+        $this->publisher_service     = $publisher_service;
60
+
61
+        // Child elements.
62
+        $this->tabs_element   = $tabs_element;
63
+
64
+    }
65
+
66
+    /**
67
+     * @inheritdoc
68
+     */
69
+    public function render( $args ) {
70
+
71
+        // Parse the arguments and merge with default values.
72
+        $params = wp_parse_args( $args, array(
73
+            'id'   => uniqid( 'wl-input-' ),
74
+            'name' => uniqid( 'wl-input-' ),
75
+        ) );
76
+
77
+        // Get the number of potential candidates as publishers.
78
+        $count = $this->publisher_service->count();
79
+
80
+        $this->tabs_element->render( array(
81
+            'tabs'   => array(
82
+                array(
83
+                    'label'    => __( 'Select an Existing Publisher', 'wordlift' ),
84
+                    'callback' => array( $this, 'select' ),
85
+                    'args'     => $params,
86
+                ),
87
+                array(
88
+                    'label'    => __( 'Create a New Publisher', 'wordlift' ),
89
+                    'callback' => array( $this, 'create' ),
90
+                    'args'     => $params,
91
+                ),
92
+            ),
93
+            // Set the default tab according to the number of potential publishers
94
+            // configured in WP: 0 = select, 1 = create.
95
+            'active' => 0 === $count ? 1 : 0,
96
+        ) );
97
+
98
+        // Finally return the element instance.
99
+        return $this;
100
+    }
101
+
102
+    /**
103
+     * Render the publisher's select.
104
+     *
105
+     * @since 3.11.0
106
+     *
107
+     * @param array $params An array of parameters.
108
+     */
109
+    public function select( $params ) {
110
+
111
+        // Get the configured publisher id. In case a publisher id is already configured
112
+        // this must be pre-loaded in the options.
113
+        $publisher_id = $this->configuration_service->get_publisher_id();
114
+
115
+        // Get the publisher data.
116
+        $data = $this->publisher_service->query();
117
+
118
+        // Call the select internal render.
119
+        $this->do_render( $params, $publisher_id, $data );
120
+
121
+    }
122
+
123
+    /**
124
+     * Render the 'create publisher' form.
125
+     *
126
+     * @since 3.11.0
127
+     *
128
+     * @param array $params An array of parameters.
129
+     */
130
+    public function create( $params ) {
131
+        ?>
132 132
 		<p>
133 133
 			<strong><?php esc_html_e( 'Are you publishing as an individual or as a company?', 'wordlift' ) ?></strong>
134 134
 		</p>
@@ -138,13 +138,13 @@  discard block
 block discarded – undo
138 138
 				       name="wl_publisher[type]" value="person"
139 139
 				       checked="checked">
140 140
 				<label for="wl-publisher-person"><?php
141
-					esc_html_e( 'Person', 'wordlift' ) ?></label>
141
+                    esc_html_e( 'Person', 'wordlift' ) ?></label>
142 142
 			</span>
143 143
 			<span>
144 144
 				<input id="wl-publisher-company" type="radio"
145 145
 				       name="wl_publisher[type]" value="organization"">
146 146
 				<label for="wl-publisher-company"><?php
147
-					esc_html_e( 'Company', 'wordlift' ) ?></label>
147
+                    esc_html_e( 'Company', 'wordlift' ) ?></label>
148 148
 			</span>
149 149
 		</p>
150 150
 		<p id="wl-publisher-name">
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 				<img id="wl-publisher-media-uploader-preview" />
162 162
 				<button type="button" class="button"
163 163
 				        id="wl-publisher-media-uploader"><?php
164
-					esc_html_e( 'Select an existing image or upload a new one', 'wordlift' ); ?></button>
164
+                    esc_html_e( 'Select an existing image or upload a new one', 'wordlift' ); ?></button>
165 165
 			</p>
166 166
 		</div>
167 167
 		<?php
168
-	}
168
+    }
169 169
 
170 170
 }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -52,48 +52,48 @@  discard block
 block discarded – undo
52 52
 	 * @param \Wordlift_Admin_Tabs_Element    $tabs_element          The {@link Wordlift_Admin_Tabs_Element} instance.
53 53
 	 * @param \Wordlift_Admin_Select2_Element $select_element        The {@link Wordlift_Admin_Select_Element} instance.
54 54
 	 */
55
-	function __construct( $configuration_service, $publisher_service, $tabs_element, $select_element ) {
55
+	function __construct($configuration_service, $publisher_service, $tabs_element, $select_element) {
56 56
 		parent::__construct($publisher_service, $select_element);
57 57
 
58 58
 		$this->configuration_service = $configuration_service;
59 59
 		$this->publisher_service     = $publisher_service;
60 60
 
61 61
 		// Child elements.
62
-		$this->tabs_element   = $tabs_element;
62
+		$this->tabs_element = $tabs_element;
63 63
 
64 64
 	}
65 65
 
66 66
 	/**
67 67
 	 * @inheritdoc
68 68
 	 */
69
-	public function render( $args ) {
69
+	public function render($args) {
70 70
 
71 71
 		// Parse the arguments and merge with default values.
72
-		$params = wp_parse_args( $args, array(
73
-			'id'   => uniqid( 'wl-input-' ),
74
-			'name' => uniqid( 'wl-input-' ),
75
-		) );
72
+		$params = wp_parse_args($args, array(
73
+			'id'   => uniqid('wl-input-'),
74
+			'name' => uniqid('wl-input-'),
75
+		));
76 76
 
77 77
 		// Get the number of potential candidates as publishers.
78 78
 		$count = $this->publisher_service->count();
79 79
 
80
-		$this->tabs_element->render( array(
80
+		$this->tabs_element->render(array(
81 81
 			'tabs'   => array(
82 82
 				array(
83
-					'label'    => __( 'Select an Existing Publisher', 'wordlift' ),
84
-					'callback' => array( $this, 'select' ),
83
+					'label'    => __('Select an Existing Publisher', 'wordlift'),
84
+					'callback' => array($this, 'select'),
85 85
 					'args'     => $params,
86 86
 				),
87 87
 				array(
88
-					'label'    => __( 'Create a New Publisher', 'wordlift' ),
89
-					'callback' => array( $this, 'create' ),
88
+					'label'    => __('Create a New Publisher', 'wordlift'),
89
+					'callback' => array($this, 'create'),
90 90
 					'args'     => $params,
91 91
 				),
92 92
 			),
93 93
 			// Set the default tab according to the number of potential publishers
94 94
 			// configured in WP: 0 = select, 1 = create.
95 95
 			'active' => 0 === $count ? 1 : 0,
96
-		) );
96
+		));
97 97
 
98 98
 		// Finally return the element instance.
99 99
 		return $this;
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 *
107 107
 	 * @param array $params An array of parameters.
108 108
 	 */
109
-	public function select( $params ) {
109
+	public function select($params) {
110 110
 
111 111
 		// Get the configured publisher id. In case a publisher id is already configured
112 112
 		// this must be pre-loaded in the options.
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		$data = $this->publisher_service->query();
117 117
 
118 118
 		// Call the select internal render.
119
-		$this->do_render( $params, $publisher_id, $data );
119
+		$this->do_render($params, $publisher_id, $data);
120 120
 
121 121
 	}
122 122
 
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
 	 *
128 128
 	 * @param array $params An array of parameters.
129 129
 	 */
130
-	public function create( $params ) {
130
+	public function create($params) {
131 131
 		?>
132 132
 		<p>
133
-			<strong><?php esc_html_e( 'Are you publishing as an individual or as a company?', 'wordlift' ) ?></strong>
133
+			<strong><?php esc_html_e('Are you publishing as an individual or as a company?', 'wordlift') ?></strong>
134 134
 		</p>
135 135
 		<p id="wl-publisher-type">
136 136
 			<span>
@@ -138,30 +138,30 @@  discard block
 block discarded – undo
138 138
 				       name="wl_publisher[type]" value="person"
139 139
 				       checked="checked">
140 140
 				<label for="wl-publisher-person"><?php
141
-					esc_html_e( 'Person', 'wordlift' ) ?></label>
141
+					esc_html_e('Person', 'wordlift') ?></label>
142 142
 			</span>
143 143
 			<span>
144 144
 				<input id="wl-publisher-company" type="radio"
145 145
 				       name="wl_publisher[type]" value="organization"">
146 146
 				<label for="wl-publisher-company"><?php
147
-					esc_html_e( 'Company', 'wordlift' ) ?></label>
147
+					esc_html_e('Company', 'wordlift') ?></label>
148 148
 			</span>
149 149
 		</p>
150 150
 		<p id="wl-publisher-name">
151 151
 			<input type="text" name="wl_publisher[name]"
152
-			       placeholder="<?php echo esc_attr__( "What's your name?", 'wordlift' ) ?>">
152
+			       placeholder="<?php echo esc_attr__("What's your name?", 'wordlift') ?>">
153 153
 		</p>
154 154
 		<div id="wl-publisher-logo">
155 155
 			<input type="hidden" id="wl-publisher-media-uploader-id"
156 156
 			       name="wl_publisher[thumbnail_id]" />
157 157
 			<p>
158
-				<b><?php esc_html_e( "Choose the publisher's Logo", 'wordlift' ) ?></b>
158
+				<b><?php esc_html_e("Choose the publisher's Logo", 'wordlift') ?></b>
159 159
 			</p>
160 160
 			<p>
161 161
 				<img id="wl-publisher-media-uploader-preview" />
162 162
 				<button type="button" class="button"
163 163
 				        id="wl-publisher-media-uploader"><?php
164
-					esc_html_e( 'Select an existing image or upload a new one', 'wordlift' ); ?></button>
164
+					esc_html_e('Select an existing image or upload a new one', 'wordlift'); ?></button>
165 165
 			</p>
166 166
 		</div>
167 167
 		<?php
Please login to merge, or discard this patch.
src/admin/class-wordlift-admin-author-element.php 2 patches
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -19,112 +19,112 @@
 block discarded – undo
19 19
  */
20 20
 class Wordlift_Admin_Author_Element implements Wordlift_Admin_Element {
21 21
 
22
-	/**
23
-	 * The {@link Wordlift_Publisher_Service} instance.
24
-	 *
25
-	 * @since  3.14.0
26
-	 * @access private
27
-	 * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
28
-	 */
29
-	private $publisher_service;
30
-
31
-	/**
32
-	 * A {@link Wordlift_Admin_Select2_Element} instance.
33
-	 *
34
-	 * @since  3.14.0
35
-	 * @access private
36
-	 * @var \Wordlift_Admin_Select2_Element $select_element A {@link Wordlift_Admin_Select2_Element} instance.
37
-	 */
38
-	private $select_element;
39
-
40
-	/**
41
-	 * Create a {@link Wordlift_Admin_Person_Element} instance.
42
-	 *
43
-	 * @since 3.14.0
44
-	 *
45
-	 * @param \Wordlift_Publisher_Service     $publisher_service The {@link Wordlift_Publisher_Service} instance.
46
-	 * @param \Wordlift_Admin_Select2_Element $select_element    The {@link Wordlift_Admin_Select_Element} instance.
47
-	 */
48
-	function __construct( $publisher_service, $select_element ) {
49
-
50
-		$this->publisher_service = $publisher_service;
51
-
52
-		// Child elements.
53
-		$this->select_element = $select_element;
54
-
55
-	}
56
-
57
-	/**
58
-	 * @inheritdoc
59
-	 */
60
-	public function render( $args ) {
61
-
62
-		// Parse the arguments and merge with default values.
63
-		$params = wp_parse_args( $args, array(
64
-			'id'             => uniqid( 'wl-input-' ),
65
-			'name'           => uniqid( 'wl-input-' ),
66
-			'current_entity' => 0,
67
-		) );
68
-
69
-		$current_entity_id = $params['current_entity'];
70
-		$data              = $this->publisher_service->query();
71
-
72
-		// Set a default to show when no entity is associated and a way to unassign.
73
-		array_unshift( $data, array(
74
-			'id'            => '0',
75
-			'text'          => __( '<em>(none)</em>', 'wordlift' ),
76
-			'type'          => '',
77
-			'thumbnail_url' => plugin_dir_url( dirname( __FILE__ ) ) . 'images/pixel.png',
78
-		) );
79
-
80
-		// Finally do the render, passing along also the current selected entity
81
-		// id and the options data.
82
-		return $this->do_render( $params, $current_entity_id, $data );
83
-	}
84
-
85
-	/**
86
-	 * Render the `select` using the provided parameters.
87
-	 *
88
-	 * @since 3.14.0
89
-	 *
90
-	 * @param array $params          The array of parameters from the `render` function.
91
-	 * @param int   $current_post_id The currently selected {@link WP_Post} `id`.
92
-	 * @param array $data            An array of Select2 options.
93
-	 *
94
-	 * @return \Wordlift_Admin_Author_Element $this Return this element.
95
-	 */
96
-	protected function do_render( $params, $current_post_id, $data ) {
97
-
98
-		// Queue the script which will initialize the select and style it.
99
-		wp_enqueue_script( 'wl-author-element', plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/wordlift-author-element.bundle.js', array( 'wordlift-select2' ) );
100
-
101
-		// Prepare the URLs for entities which don't have logos.
102
-		$person_thumbnail_url       = plugin_dir_url( dirname( __FILE__ ) ) . 'images/person.png';
103
-		$organization_thumbnail_url = plugin_dir_url( dirname( __FILE__ ) ) . 'images/organization.png';
104
-
105
-		// Get the current post.
106
-		$current_post = $current_post_id ? get_post( $current_post_id ) : null;
107
-
108
-		// Finally render the Select.
109
-		$this->select_element->render( array(
110
-			// Id.
111
-			'id'                 => $params['id'],
112
-			// Name.
113
-			'name'               => $params['name'],
114
-			// The selected id.
115
-			'value'              => $current_post_id,
116
-			// The selected item (must be in the options for Select2 to display it).
117
-			'options'            => $current_post ? array( $current_post->ID => $current_post->post_title ) : array(),
118
-			// The list of available options.
119
-			'data'               => $data,
120
-			// The HTML template for each option.
121
-			'template-result'    => "<div class='wl-select2-result'><span class='wl-select2-thumbnail' style='background-image: url( <%= obj.thumbnail_url || ( 'Organization' === obj.type ? '$organization_thumbnail_url' : '$person_thumbnail_url' ) %> );'>&nbsp;</span><span class='wl-select2'><%= obj.text %></span><span class='wl-select2-type'><%= obj.type %></span></div>",
122
-			// The HTML template for the selected option.
123
-			'template-selection' => "<div class='wl-select2-selection'><span class='wl-select2-thumbnail' style='background-image: url( <%= obj.thumbnail_url || ( 'Organization' === obj.type ? '$organization_thumbnail_url' : '$person_thumbnail_url' ) %> );'>&nbsp;</span><span class='wl-select2'><%= obj.text %></span><span class='wl-select2-type'><%= obj.type %></span></div>",
124
-		) );
125
-
126
-		// Finally return the element instance.
127
-		return $this;
128
-	}
22
+    /**
23
+     * The {@link Wordlift_Publisher_Service} instance.
24
+     *
25
+     * @since  3.14.0
26
+     * @access private
27
+     * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
28
+     */
29
+    private $publisher_service;
30
+
31
+    /**
32
+     * A {@link Wordlift_Admin_Select2_Element} instance.
33
+     *
34
+     * @since  3.14.0
35
+     * @access private
36
+     * @var \Wordlift_Admin_Select2_Element $select_element A {@link Wordlift_Admin_Select2_Element} instance.
37
+     */
38
+    private $select_element;
39
+
40
+    /**
41
+     * Create a {@link Wordlift_Admin_Person_Element} instance.
42
+     *
43
+     * @since 3.14.0
44
+     *
45
+     * @param \Wordlift_Publisher_Service     $publisher_service The {@link Wordlift_Publisher_Service} instance.
46
+     * @param \Wordlift_Admin_Select2_Element $select_element    The {@link Wordlift_Admin_Select_Element} instance.
47
+     */
48
+    function __construct( $publisher_service, $select_element ) {
49
+
50
+        $this->publisher_service = $publisher_service;
51
+
52
+        // Child elements.
53
+        $this->select_element = $select_element;
54
+
55
+    }
56
+
57
+    /**
58
+     * @inheritdoc
59
+     */
60
+    public function render( $args ) {
61
+
62
+        // Parse the arguments and merge with default values.
63
+        $params = wp_parse_args( $args, array(
64
+            'id'             => uniqid( 'wl-input-' ),
65
+            'name'           => uniqid( 'wl-input-' ),
66
+            'current_entity' => 0,
67
+        ) );
68
+
69
+        $current_entity_id = $params['current_entity'];
70
+        $data              = $this->publisher_service->query();
71
+
72
+        // Set a default to show when no entity is associated and a way to unassign.
73
+        array_unshift( $data, array(
74
+            'id'            => '0',
75
+            'text'          => __( '<em>(none)</em>', 'wordlift' ),
76
+            'type'          => '',
77
+            'thumbnail_url' => plugin_dir_url( dirname( __FILE__ ) ) . 'images/pixel.png',
78
+        ) );
79
+
80
+        // Finally do the render, passing along also the current selected entity
81
+        // id and the options data.
82
+        return $this->do_render( $params, $current_entity_id, $data );
83
+    }
84
+
85
+    /**
86
+     * Render the `select` using the provided parameters.
87
+     *
88
+     * @since 3.14.0
89
+     *
90
+     * @param array $params          The array of parameters from the `render` function.
91
+     * @param int   $current_post_id The currently selected {@link WP_Post} `id`.
92
+     * @param array $data            An array of Select2 options.
93
+     *
94
+     * @return \Wordlift_Admin_Author_Element $this Return this element.
95
+     */
96
+    protected function do_render( $params, $current_post_id, $data ) {
97
+
98
+        // Queue the script which will initialize the select and style it.
99
+        wp_enqueue_script( 'wl-author-element', plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/wordlift-author-element.bundle.js', array( 'wordlift-select2' ) );
100
+
101
+        // Prepare the URLs for entities which don't have logos.
102
+        $person_thumbnail_url       = plugin_dir_url( dirname( __FILE__ ) ) . 'images/person.png';
103
+        $organization_thumbnail_url = plugin_dir_url( dirname( __FILE__ ) ) . 'images/organization.png';
104
+
105
+        // Get the current post.
106
+        $current_post = $current_post_id ? get_post( $current_post_id ) : null;
107
+
108
+        // Finally render the Select.
109
+        $this->select_element->render( array(
110
+            // Id.
111
+            'id'                 => $params['id'],
112
+            // Name.
113
+            'name'               => $params['name'],
114
+            // The selected id.
115
+            'value'              => $current_post_id,
116
+            // The selected item (must be in the options for Select2 to display it).
117
+            'options'            => $current_post ? array( $current_post->ID => $current_post->post_title ) : array(),
118
+            // The list of available options.
119
+            'data'               => $data,
120
+            // The HTML template for each option.
121
+            'template-result'    => "<div class='wl-select2-result'><span class='wl-select2-thumbnail' style='background-image: url( <%= obj.thumbnail_url || ( 'Organization' === obj.type ? '$organization_thumbnail_url' : '$person_thumbnail_url' ) %> );'>&nbsp;</span><span class='wl-select2'><%= obj.text %></span><span class='wl-select2-type'><%= obj.type %></span></div>",
122
+            // The HTML template for the selected option.
123
+            'template-selection' => "<div class='wl-select2-selection'><span class='wl-select2-thumbnail' style='background-image: url( <%= obj.thumbnail_url || ( 'Organization' === obj.type ? '$organization_thumbnail_url' : '$person_thumbnail_url' ) %> );'>&nbsp;</span><span class='wl-select2'><%= obj.text %></span><span class='wl-select2-type'><%= obj.type %></span></div>",
124
+        ) );
125
+
126
+        // Finally return the element instance.
127
+        return $this;
128
+    }
129 129
 
130 130
 }
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * @param \Wordlift_Publisher_Service     $publisher_service The {@link Wordlift_Publisher_Service} instance.
46 46
 	 * @param \Wordlift_Admin_Select2_Element $select_element    The {@link Wordlift_Admin_Select_Element} instance.
47 47
 	 */
48
-	function __construct( $publisher_service, $select_element ) {
48
+	function __construct($publisher_service, $select_element) {
49 49
 
50 50
 		$this->publisher_service = $publisher_service;
51 51
 
@@ -57,29 +57,29 @@  discard block
 block discarded – undo
57 57
 	/**
58 58
 	 * @inheritdoc
59 59
 	 */
60
-	public function render( $args ) {
60
+	public function render($args) {
61 61
 
62 62
 		// Parse the arguments and merge with default values.
63
-		$params = wp_parse_args( $args, array(
64
-			'id'             => uniqid( 'wl-input-' ),
65
-			'name'           => uniqid( 'wl-input-' ),
63
+		$params = wp_parse_args($args, array(
64
+			'id'             => uniqid('wl-input-'),
65
+			'name'           => uniqid('wl-input-'),
66 66
 			'current_entity' => 0,
67
-		) );
67
+		));
68 68
 
69 69
 		$current_entity_id = $params['current_entity'];
70 70
 		$data              = $this->publisher_service->query();
71 71
 
72 72
 		// Set a default to show when no entity is associated and a way to unassign.
73
-		array_unshift( $data, array(
73
+		array_unshift($data, array(
74 74
 			'id'            => '0',
75
-			'text'          => __( '<em>(none)</em>', 'wordlift' ),
75
+			'text'          => __('<em>(none)</em>', 'wordlift'),
76 76
 			'type'          => '',
77
-			'thumbnail_url' => plugin_dir_url( dirname( __FILE__ ) ) . 'images/pixel.png',
78
-		) );
77
+			'thumbnail_url' => plugin_dir_url(dirname(__FILE__)).'images/pixel.png',
78
+		));
79 79
 
80 80
 		// Finally do the render, passing along also the current selected entity
81 81
 		// id and the options data.
82
-		return $this->do_render( $params, $current_entity_id, $data );
82
+		return $this->do_render($params, $current_entity_id, $data);
83 83
 	}
84 84
 
85 85
 	/**
@@ -93,20 +93,20 @@  discard block
 block discarded – undo
93 93
 	 *
94 94
 	 * @return \Wordlift_Admin_Author_Element $this Return this element.
95 95
 	 */
96
-	protected function do_render( $params, $current_post_id, $data ) {
96
+	protected function do_render($params, $current_post_id, $data) {
97 97
 
98 98
 		// Queue the script which will initialize the select and style it.
99
-		wp_enqueue_script( 'wl-author-element', plugin_dir_url( dirname( __FILE__ ) ) . 'admin/js/wordlift-author-element.bundle.js', array( 'wordlift-select2' ) );
99
+		wp_enqueue_script('wl-author-element', plugin_dir_url(dirname(__FILE__)).'admin/js/wordlift-author-element.bundle.js', array('wordlift-select2'));
100 100
 
101 101
 		// Prepare the URLs for entities which don't have logos.
102
-		$person_thumbnail_url       = plugin_dir_url( dirname( __FILE__ ) ) . 'images/person.png';
103
-		$organization_thumbnail_url = plugin_dir_url( dirname( __FILE__ ) ) . 'images/organization.png';
102
+		$person_thumbnail_url       = plugin_dir_url(dirname(__FILE__)).'images/person.png';
103
+		$organization_thumbnail_url = plugin_dir_url(dirname(__FILE__)).'images/organization.png';
104 104
 
105 105
 		// Get the current post.
106
-		$current_post = $current_post_id ? get_post( $current_post_id ) : null;
106
+		$current_post = $current_post_id ? get_post($current_post_id) : null;
107 107
 
108 108
 		// Finally render the Select.
109
-		$this->select_element->render( array(
109
+		$this->select_element->render(array(
110 110
 			// Id.
111 111
 			'id'                 => $params['id'],
112 112
 			// Name.
@@ -114,14 +114,14 @@  discard block
 block discarded – undo
114 114
 			// The selected id.
115 115
 			'value'              => $current_post_id,
116 116
 			// The selected item (must be in the options for Select2 to display it).
117
-			'options'            => $current_post ? array( $current_post->ID => $current_post->post_title ) : array(),
117
+			'options'            => $current_post ? array($current_post->ID => $current_post->post_title) : array(),
118 118
 			// The list of available options.
119 119
 			'data'               => $data,
120 120
 			// The HTML template for each option.
121 121
 			'template-result'    => "<div class='wl-select2-result'><span class='wl-select2-thumbnail' style='background-image: url( <%= obj.thumbnail_url || ( 'Organization' === obj.type ? '$organization_thumbnail_url' : '$person_thumbnail_url' ) %> );'>&nbsp;</span><span class='wl-select2'><%= obj.text %></span><span class='wl-select2-type'><%= obj.type %></span></div>",
122 122
 			// The HTML template for the selected option.
123 123
 			'template-selection' => "<div class='wl-select2-selection'><span class='wl-select2-thumbnail' style='background-image: url( <%= obj.thumbnail_url || ( 'Organization' === obj.type ? '$organization_thumbnail_url' : '$person_thumbnail_url' ) %> );'>&nbsp;</span><span class='wl-select2'><%= obj.text %></span><span class='wl-select2-type'><%= obj.type %></span></div>",
124
-		) );
124
+		));
125 125
 
126 126
 		// Finally return the element instance.
127 127
 		return $this;
Please login to merge, or discard this patch.
src/admin/class-wordlift-admin-user-profile-page.php 2 patches
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -18,75 +18,75 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Admin_User_Profile_Page {
20 20
 
21
-	/**
22
-	 * The {@link Wordlift_Admin_Person_Element} instance.
23
-	 *
24
-	 * @since  3.14.0
25
-	 * @access private
26
-	 * @var \Wordlift_Admin_Author_Element $plugin The person entity
27
-	 *                selection element rendering the possible persons.
28
-	 */
29
-	private $author_element;
30
-
31
-	/**
32
-	 * The {@link Wordlift_User_Service} instance.
33
-	 *
34
-	 * @since  3.14.0
35
-	 * @access private
36
-	 * @var \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance.
37
-	 */
38
-	private $user_service;
39
-
40
-	/**
41
-	 * Create the {@link Wordlift_Admin_User_Profile_Page} instance.
42
-	 *
43
-	 * @since 3.14.0
44
-	 *
45
-	 * @param \Wordlift_Admin_Author_Element $author_element The person entity selection
46
-	 *                                                       element rendering the possible persons.
47
-	 * @param \Wordlift_User_Service         $user_service   The {@link Wordlift_User_Service} instance.
48
-	 */
49
-	function __construct( $author_element, $user_service ) {
50
-
51
-		$this->author_element = $author_element;
52
-		$this->user_service   = $user_service;
53
-
54
-		/*
21
+    /**
22
+     * The {@link Wordlift_Admin_Person_Element} instance.
23
+     *
24
+     * @since  3.14.0
25
+     * @access private
26
+     * @var \Wordlift_Admin_Author_Element $plugin The person entity
27
+     *                selection element rendering the possible persons.
28
+     */
29
+    private $author_element;
30
+
31
+    /**
32
+     * The {@link Wordlift_User_Service} instance.
33
+     *
34
+     * @since  3.14.0
35
+     * @access private
36
+     * @var \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance.
37
+     */
38
+    private $user_service;
39
+
40
+    /**
41
+     * Create the {@link Wordlift_Admin_User_Profile_Page} instance.
42
+     *
43
+     * @since 3.14.0
44
+     *
45
+     * @param \Wordlift_Admin_Author_Element $author_element The person entity selection
46
+     *                                                       element rendering the possible persons.
47
+     * @param \Wordlift_User_Service         $user_service   The {@link Wordlift_User_Service} instance.
48
+     */
49
+    function __construct( $author_element, $user_service ) {
50
+
51
+        $this->author_element = $author_element;
52
+        $this->user_service   = $user_service;
53
+
54
+        /*
55 55
 		 * When an admin (or similar permissions) edits his own profile a
56 56
 		 * different action than the usual is being triggered.
57 57
 		 * It is too early in the wordpress boot to do user capabilities filtering
58 58
 		 * here and it is deferred to the handler.
59 59
 		 */
60
-		add_action( 'show_user_profile', array( $this, 'edit_user_profile' ) );
61
-		add_action( 'edit_user_profile', array( $this, 'edit_user_profile' ) );
62
-		add_action( 'edit_user_profile_update', array(
63
-			$this,
64
-			'edit_user_profile_update',
65
-		) );
66
-		add_action( 'personal_options_update', array(
67
-			$this,
68
-			'edit_user_profile_update',
69
-		) );
70
-
71
-	}
72
-
73
-	/**
74
-	 * Add a WordLift section in the user profile which lets
75
-	 * the admin to associate a wordpress user with a person entity.
76
-	 *
77
-	 * @since 3.14.0
78
-	 *
79
-	 * @param WP_User $user The current WP_User object of the user being edited.
80
-	 */
81
-	public function edit_user_profile( $user ) {
82
-
83
-		// In case it is a user editing his own profile, make sure he has admin
84
-		// like capabilities.
85
-		if ( ! current_user_can( 'edit_users' ) ) {
86
-			return;
87
-		}
88
-
89
-		?>
60
+        add_action( 'show_user_profile', array( $this, 'edit_user_profile' ) );
61
+        add_action( 'edit_user_profile', array( $this, 'edit_user_profile' ) );
62
+        add_action( 'edit_user_profile_update', array(
63
+            $this,
64
+            'edit_user_profile_update',
65
+        ) );
66
+        add_action( 'personal_options_update', array(
67
+            $this,
68
+            'edit_user_profile_update',
69
+        ) );
70
+
71
+    }
72
+
73
+    /**
74
+     * Add a WordLift section in the user profile which lets
75
+     * the admin to associate a wordpress user with a person entity.
76
+     *
77
+     * @since 3.14.0
78
+     *
79
+     * @param WP_User $user The current WP_User object of the user being edited.
80
+     */
81
+    public function edit_user_profile( $user ) {
82
+
83
+        // In case it is a user editing his own profile, make sure he has admin
84
+        // like capabilities.
85
+        if ( ! current_user_can( 'edit_users' ) ) {
86
+            return;
87
+        }
88
+
89
+        ?>
90 90
 		<h2><?php esc_html_e( 'WordLift', 'wordlift' ); ?></h2>
91 91
 
92 92
 		<table class="form-table">
@@ -96,41 +96,41 @@  discard block
 block discarded – undo
96 96
 				</th>
97 97
 				<td>
98 98
 					<?php
99
-					$this->author_element->render( array(
100
-						'id'             => 'wl_person',
101
-						'name'           => 'wl_person',
102
-						'current_entity' => $this->user_service->get_entity( $user->ID ),
103
-					) );
104
-					?>
99
+                    $this->author_element->render( array(
100
+                        'id'             => 'wl_person',
101
+                        'name'           => 'wl_person',
102
+                        'current_entity' => $this->user_service->get_entity( $user->ID ),
103
+                    ) );
104
+                    ?>
105 105
 					<p class="description"><?php _e( 'The entity, person or organization, from the vocabulary to associate with this author.', 'wordlift' ); ?></p>
106 106
 				</td>
107 107
 			</tr>
108 108
 		</table>
109 109
 		<?php
110
-	}
111
-
112
-	/**
113
-	 * Handle storing the person entity associated with the user.
114
-	 *
115
-	 * @since 3.14.0
116
-	 *
117
-	 * @param int $user_id The user id of the user being saved.
118
-	 */
119
-	public function edit_user_profile_update( $user_id ) {
120
-
121
-		// In case it is a user editing his own profile, make sure he has admin
122
-		// like capabilities.
123
-		if ( ! current_user_can( 'edit_users' ) ) {
124
-			return;
125
-		}
126
-
127
-		// Bail out if the `wl_person` parameter isn't set.
128
-		if ( ! isset( $_POST['wl_person'] ) || ! is_numeric( $_POST['wl_person'] ) ) {
129
-			return;
130
-		}
131
-
132
-		$this->user_service->set_entity( $user_id, intval( $_POST['wl_person'] ) );
133
-
134
-	}
110
+    }
111
+
112
+    /**
113
+     * Handle storing the person entity associated with the user.
114
+     *
115
+     * @since 3.14.0
116
+     *
117
+     * @param int $user_id The user id of the user being saved.
118
+     */
119
+    public function edit_user_profile_update( $user_id ) {
120
+
121
+        // In case it is a user editing his own profile, make sure he has admin
122
+        // like capabilities.
123
+        if ( ! current_user_can( 'edit_users' ) ) {
124
+            return;
125
+        }
126
+
127
+        // Bail out if the `wl_person` parameter isn't set.
128
+        if ( ! isset( $_POST['wl_person'] ) || ! is_numeric( $_POST['wl_person'] ) ) {
129
+            return;
130
+        }
131
+
132
+        $this->user_service->set_entity( $user_id, intval( $_POST['wl_person'] ) );
133
+
134
+    }
135 135
 
136 136
 }
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 *                                                       element rendering the possible persons.
47 47
 	 * @param \Wordlift_User_Service         $user_service   The {@link Wordlift_User_Service} instance.
48 48
 	 */
49
-	function __construct( $author_element, $user_service ) {
49
+	function __construct($author_element, $user_service) {
50 50
 
51 51
 		$this->author_element = $author_element;
52 52
 		$this->user_service   = $user_service;
@@ -57,16 +57,16 @@  discard block
 block discarded – undo
57 57
 		 * It is too early in the wordpress boot to do user capabilities filtering
58 58
 		 * here and it is deferred to the handler.
59 59
 		 */
60
-		add_action( 'show_user_profile', array( $this, 'edit_user_profile' ) );
61
-		add_action( 'edit_user_profile', array( $this, 'edit_user_profile' ) );
62
-		add_action( 'edit_user_profile_update', array(
60
+		add_action('show_user_profile', array($this, 'edit_user_profile'));
61
+		add_action('edit_user_profile', array($this, 'edit_user_profile'));
62
+		add_action('edit_user_profile_update', array(
63 63
 			$this,
64 64
 			'edit_user_profile_update',
65
-		) );
66
-		add_action( 'personal_options_update', array(
65
+		));
66
+		add_action('personal_options_update', array(
67 67
 			$this,
68 68
 			'edit_user_profile_update',
69
-		) );
69
+		));
70 70
 
71 71
 	}
72 72
 
@@ -78,31 +78,31 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @param WP_User $user The current WP_User object of the user being edited.
80 80
 	 */
81
-	public function edit_user_profile( $user ) {
81
+	public function edit_user_profile($user) {
82 82
 
83 83
 		// In case it is a user editing his own profile, make sure he has admin
84 84
 		// like capabilities.
85
-		if ( ! current_user_can( 'edit_users' ) ) {
85
+		if ( ! current_user_can('edit_users')) {
86 86
 			return;
87 87
 		}
88 88
 
89 89
 		?>
90
-		<h2><?php esc_html_e( 'WordLift', 'wordlift' ); ?></h2>
90
+		<h2><?php esc_html_e('WordLift', 'wordlift'); ?></h2>
91 91
 
92 92
 		<table class="form-table">
93 93
 			<tr class="user-description-wrap">
94 94
 				<th><label
95
-						for="wl_person"><?php _e( 'Author from the vocabulary', 'wordlift' ); ?></label>
95
+						for="wl_person"><?php _e('Author from the vocabulary', 'wordlift'); ?></label>
96 96
 				</th>
97 97
 				<td>
98 98
 					<?php
99
-					$this->author_element->render( array(
99
+					$this->author_element->render(array(
100 100
 						'id'             => 'wl_person',
101 101
 						'name'           => 'wl_person',
102
-						'current_entity' => $this->user_service->get_entity( $user->ID ),
103
-					) );
102
+						'current_entity' => $this->user_service->get_entity($user->ID),
103
+					));
104 104
 					?>
105
-					<p class="description"><?php _e( 'The entity, person or organization, from the vocabulary to associate with this author.', 'wordlift' ); ?></p>
105
+					<p class="description"><?php _e('The entity, person or organization, from the vocabulary to associate with this author.', 'wordlift'); ?></p>
106 106
 				</td>
107 107
 			</tr>
108 108
 		</table>
@@ -116,20 +116,20 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @param int $user_id The user id of the user being saved.
118 118
 	 */
119
-	public function edit_user_profile_update( $user_id ) {
119
+	public function edit_user_profile_update($user_id) {
120 120
 
121 121
 		// In case it is a user editing his own profile, make sure he has admin
122 122
 		// like capabilities.
123
-		if ( ! current_user_can( 'edit_users' ) ) {
123
+		if ( ! current_user_can('edit_users')) {
124 124
 			return;
125 125
 		}
126 126
 
127 127
 		// Bail out if the `wl_person` parameter isn't set.
128
-		if ( ! isset( $_POST['wl_person'] ) || ! is_numeric( $_POST['wl_person'] ) ) {
128
+		if ( ! isset($_POST['wl_person']) || ! is_numeric($_POST['wl_person'])) {
129 129
 			return;
130 130
 		}
131 131
 
132
-		$this->user_service->set_entity( $user_id, intval( $_POST['wl_person'] ) );
132
+		$this->user_service->set_entity($user_id, intval($_POST['wl_person']));
133 133
 
134 134
 	}
135 135
 
Please login to merge, or discard this patch.