Completed
Push — master ( b9bf14...1716ca )
by David
05:36
created
src/includes/class-wordlift.php 1 patch
Indentation   +647 added lines, -647 removed lines patch added patch discarded remove patch
@@ -29,702 +29,702 @@
 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 Thumbnail service.
62
-	 *
63
-	 * @since 3.1.5
64
-	 * @access private
65
-	 * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
66
-	 */
67
-	private $thumbnail_service;
68
-
69
-	/**
70
-	 * The UI service.
71
-	 *
72
-	 * @since 3.2.0
73
-	 * @access private
74
-	 * @var \Wordlift_UI_Service $ui_service The UI service.
75
-	 */
76
-	private $ui_service;
77
-
78
-	/**
79
-	 * The Schema service.
80
-	 *
81
-	 * @since 3.3.0
82
-	 * @access private
83
-	 * @var \Wordlift_Schema_Service $schema_service The Schema service.
84
-	 */
85
-	private $schema_service;
86
-
87
-	/**
88
-	 * The Entity service.
89
-	 *
90
-	 * @since 3.1.0
91
-	 * @access private
92
-	 * @var \Wordlift_Entity_Service $entity_service The Entity service.
93
-	 */
94
-	private $entity_service;
95
-
96
-	/**
97
-	 * The Topic Taxonomy service.
98
-	 *
99
-	 * @since 3.5.0
100
-	 * @access private
101
-	 * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
102
-	 */
103
-	private $topic_taxonomy_service;
104
-
105
-	/**
106
-	 * The User service.
107
-	 *
108
-	 * @since 3.1.7
109
-	 * @access private
110
-	 * @var \Wordlift_User_Service $user_service The User service.
111
-	 */
112
-	private $user_service;
113
-
114
-	/**
115
-	 * The Timeline service.
116
-	 *
117
-	 * @since 3.1.0
118
-	 * @access private
119
-	 * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
120
-	 */
121
-	private $timeline_service;
122
-
123
-	/**
124
-	 * The Redirect service.
125
-	 *
126
-	 * @since 3.2.0
127
-	 * @access private
128
-	 * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
129
-	 */
130
-	private $redirect_service;
131
-
132
-	/**
133
-	 * The Notice service.
134
-	 *
135
-	 * @since 3.3.0
136
-	 * @access private
137
-	 * @var \Wordlift_Notice_Service $notice_service The Notice service.
138
-	 */
139
-	private $notice_service;
140
-
141
-	/**
142
-	 * The Entity list customization.
143
-	 *
144
-	 * @since 3.3.0
145
-	 * @access private
146
-	 * @var \Wordlift_List_Service $entity_list_service The Entity list service.
147
-	 */
148
-	private $entity_list_service;
149
-
150
-	/**
151
-	 * The Entity Types Taxonomy Walker.
152
-	 *
153
-	 * @since 3.1.0
154
-	 * @access private
155
-	 * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
156
-	 */
157
-	private $entity_types_taxonomy_walker;
158
-
159
-	/**
160
-	 * The ShareThis service.
161
-	 *
162
-	 * @since 3.2.0
163
-	 * @access private
164
-	 * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
165
-	 */
166
-	private $sharethis_service;
167
-
168
-	/**
169
-	 * The PrimaShop adapter.
170
-	 *
171
-	 * @since 3.2.3
172
-	 * @access private
173
-	 * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
174
-	 */
175
-	private $primashop_adapter;
176
-
177
-	/**
178
-	 * The WordLift Dashboard adapter.
179
-	 *
180
-	 * @since 3.4.0
181
-	 * @access private
182
-	 * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
183
-	 */
184
-	private $dashboard_service;
185
-
186
-	/**
187
-	 * The entity type service.
188
-	 *
189
-	 * @since 3.6.0
190
-	 * @access private
191
-	 * @var \Wordlift_Entity_Type_Service
192
-	 */
193
-	private $entity_type_service;
194
-
195
-	/**
196
-	 * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
197
-	 *
198
-	 * @since 3.6.0
199
-	 * @access private
200
-	 * @var \Wordlift_Entity_Link_Service
201
-	 */
202
-	private $entity_link_service;
203
-
204
-	/**
205
-	 * The page service instance which processes the page output in order to insert schema.org microdata to export the
206
-	 * correct page title to Google+.
207
-	 *
208
-	 * @since 3.5.3
209
-	 * @access private
210
-	 * @var \Wordlift_Page_Service
211
-	 */
212
-	private $page_service;
213
-
214
-	/**
215
-	 * A {@link Wordlift_Sparql_Service} instance.
216
-	 *
217
-	 * @var 3.6.0
218
-	 * @access private
219
-	 * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
220
-	 */
221
-	private $sparql_service;
222
-
223
-	/**
224
-	 * A {@link Wordlift_Import_Service} instance.
225
-	 *
226
-	 * @since 3.6.0
227
-	 * @access private
228
-	 * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
229
-	 */
230
-	private $import_service;
231
-
232
-	/**
233
-	 * A {@link Wordlift_Rebuild_Service} instance.
234
-	 *
235
-	 * @since 3.6.0
236
-	 * @access private
237
-	 * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
238
-	 */
239
-	private $rebuild_service;
240
-
241
-	/**
242
-	 * The 'Download Your Data' page.
243
-	 *
244
-	 * @since 3.6.0
245
-	 * @access private
246
-	 * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
247
-	 */
248
-	private $download_your_data_page;
249
-
250
-	/**
251
-	 * Define the core functionality of the plugin.
252
-	 *
253
-	 * Set the plugin name and the plugin version that can be used throughout the plugin.
254
-	 * Load the dependencies, define the locale, and set the hooks for the admin area and
255
-	 * the public-facing side of the site.
256
-	 *
257
-	 * @since    1.0.0
258
-	 */
259
-	public function __construct() {
260
-
261
-		$this->plugin_name = 'wordlift';
262
-		$this->version     = '3.7.1-dev';
263
-		$this->load_dependencies();
264
-		$this->set_locale();
265
-		$this->define_admin_hooks();
266
-		$this->define_public_hooks();
267
-
268
-	}
269
-
270
-	/**
271
-	 * Load the required dependencies for this plugin.
272
-	 *
273
-	 * Include the following files that make up the plugin:
274
-	 *
275
-	 * - Wordlift_Loader. Orchestrates the hooks of the plugin.
276
-	 * - Wordlift_i18n. Defines internationalization functionality.
277
-	 * - Wordlift_Admin. Defines all hooks for the admin area.
278
-	 * - Wordlift_Public. Defines all hooks for the public side of the site.
279
-	 *
280
-	 * Create an instance of the loader which will be used to register the hooks
281
-	 * with WordPress.
282
-	 *
283
-	 * @since    1.0.0
284
-	 * @access   private
285
-	 */
286
-	private function load_dependencies() {
287
-
288
-		/**
289
-		 * The class responsible for orchestrating the actions and filters of the
290
-		 * core plugin.
291
-		 */
292
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
293
-
294
-		/**
295
-		 * The class responsible for defining internationalization functionality
296
-		 * of the plugin.
297
-		 */
298
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
299
-
300
-		/**
301
-		 * Provide support functions to sanitize data.
302
-		 */
303
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
304
-
305
-		/**
306
-		 * The Redirect service.
307
-		 */
308
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
309
-
310
-		/**
311
-		 * The Log service.
312
-		 */
313
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
314
-
315
-		/**
316
-		 * The configuration service.
317
-		 */
318
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
319
-
320
-		/**
321
-		 * The entity post type service.
322
-		 */
323
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
324
-
325
-		/**
326
-		 * The entity link service.
327
-		 */
328
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
329
-
330
-		/**
331
-		 * The Query builder.
332
-		 */
333
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
334
-
335
-		/**
336
-		 * The Schema service.
337
-		 */
338
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
339
-
340
-		/**
341
-		 * The schema:url property service.
342
-		 */
343
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
344
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
345
-
346
-		/**
347
-		 * The UI service.
348
-		 */
349
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
350
-
351
-		/**
352
-		 * The Thumbnail service.
353
-		 */
354
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
355
-
356
-		/**
357
-		 * The Entity Types Taxonomy service.
358
-		 */
359
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
360
-
361
-		/**
362
-		 * The Entity service.
363
-		 */
364
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
365
-
366
-		/**
367
-		 * The User service.
368
-		 */
369
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
370
-
371
-		/**
372
-		 * The Timeline service.
373
-		 */
374
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
375
-
376
-		/**
377
-		 * The Topic Taxonomy service.
378
-		 */
379
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
380
-
381
-
382
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-page-service.php';
383
-
384
-		/**
385
-		 * The SPARQL service.
386
-		 */
387
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
388
-
389
-		/**
390
-		 * The WordLift import service.
391
-		 */
392
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
393
-
394
-		/**
395
-		 * The WordLift URI service.
396
-		 */
397
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
398
-
399
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php';
400
-
401
-		/**
402
-		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
403
-		 */
404
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php';
405
-
406
-		/**
407
-		 * The class responsible for defining all actions that occur in the admin area.
408
-		 */
409
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
410
-
411
-		/**
412
-		 * The class to customize the entity list admin page.
413
-		 */
414
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
415
-
416
-		/**
417
-		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
418
-		 */
419
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
420
-
421
-		/**
422
-		 * The Notice service.
423
-		 */
424
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
425
-
426
-		/**
427
-		 * The PrimaShop adapter.
428
-		 */
429
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
430
-
431
-		/**
432
-		 * The WordLift Dashboard service.
433
-		 */
434
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
435
-
436
-		/**
437
-		 * The admin 'Download Your Data' page.
438
-		 */
439
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
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 Thumbnail service.
62
+     *
63
+     * @since 3.1.5
64
+     * @access private
65
+     * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
66
+     */
67
+    private $thumbnail_service;
68
+
69
+    /**
70
+     * The UI service.
71
+     *
72
+     * @since 3.2.0
73
+     * @access private
74
+     * @var \Wordlift_UI_Service $ui_service The UI service.
75
+     */
76
+    private $ui_service;
77
+
78
+    /**
79
+     * The Schema service.
80
+     *
81
+     * @since 3.3.0
82
+     * @access private
83
+     * @var \Wordlift_Schema_Service $schema_service The Schema service.
84
+     */
85
+    private $schema_service;
86
+
87
+    /**
88
+     * The Entity service.
89
+     *
90
+     * @since 3.1.0
91
+     * @access private
92
+     * @var \Wordlift_Entity_Service $entity_service The Entity service.
93
+     */
94
+    private $entity_service;
95
+
96
+    /**
97
+     * The Topic Taxonomy service.
98
+     *
99
+     * @since 3.5.0
100
+     * @access private
101
+     * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
102
+     */
103
+    private $topic_taxonomy_service;
104
+
105
+    /**
106
+     * The User service.
107
+     *
108
+     * @since 3.1.7
109
+     * @access private
110
+     * @var \Wordlift_User_Service $user_service The User service.
111
+     */
112
+    private $user_service;
113
+
114
+    /**
115
+     * The Timeline service.
116
+     *
117
+     * @since 3.1.0
118
+     * @access private
119
+     * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
120
+     */
121
+    private $timeline_service;
122
+
123
+    /**
124
+     * The Redirect service.
125
+     *
126
+     * @since 3.2.0
127
+     * @access private
128
+     * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
129
+     */
130
+    private $redirect_service;
131
+
132
+    /**
133
+     * The Notice service.
134
+     *
135
+     * @since 3.3.0
136
+     * @access private
137
+     * @var \Wordlift_Notice_Service $notice_service The Notice service.
138
+     */
139
+    private $notice_service;
140
+
141
+    /**
142
+     * The Entity list customization.
143
+     *
144
+     * @since 3.3.0
145
+     * @access private
146
+     * @var \Wordlift_List_Service $entity_list_service The Entity list service.
147
+     */
148
+    private $entity_list_service;
149
+
150
+    /**
151
+     * The Entity Types Taxonomy Walker.
152
+     *
153
+     * @since 3.1.0
154
+     * @access private
155
+     * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
156
+     */
157
+    private $entity_types_taxonomy_walker;
158
+
159
+    /**
160
+     * The ShareThis service.
161
+     *
162
+     * @since 3.2.0
163
+     * @access private
164
+     * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
165
+     */
166
+    private $sharethis_service;
167
+
168
+    /**
169
+     * The PrimaShop adapter.
170
+     *
171
+     * @since 3.2.3
172
+     * @access private
173
+     * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
174
+     */
175
+    private $primashop_adapter;
176
+
177
+    /**
178
+     * The WordLift Dashboard adapter.
179
+     *
180
+     * @since 3.4.0
181
+     * @access private
182
+     * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
183
+     */
184
+    private $dashboard_service;
185
+
186
+    /**
187
+     * The entity type service.
188
+     *
189
+     * @since 3.6.0
190
+     * @access private
191
+     * @var \Wordlift_Entity_Type_Service
192
+     */
193
+    private $entity_type_service;
194
+
195
+    /**
196
+     * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
197
+     *
198
+     * @since 3.6.0
199
+     * @access private
200
+     * @var \Wordlift_Entity_Link_Service
201
+     */
202
+    private $entity_link_service;
203
+
204
+    /**
205
+     * The page service instance which processes the page output in order to insert schema.org microdata to export the
206
+     * correct page title to Google+.
207
+     *
208
+     * @since 3.5.3
209
+     * @access private
210
+     * @var \Wordlift_Page_Service
211
+     */
212
+    private $page_service;
213
+
214
+    /**
215
+     * A {@link Wordlift_Sparql_Service} instance.
216
+     *
217
+     * @var 3.6.0
218
+     * @access private
219
+     * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
220
+     */
221
+    private $sparql_service;
222
+
223
+    /**
224
+     * A {@link Wordlift_Import_Service} instance.
225
+     *
226
+     * @since 3.6.0
227
+     * @access private
228
+     * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
229
+     */
230
+    private $import_service;
231
+
232
+    /**
233
+     * A {@link Wordlift_Rebuild_Service} instance.
234
+     *
235
+     * @since 3.6.0
236
+     * @access private
237
+     * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
238
+     */
239
+    private $rebuild_service;
240
+
241
+    /**
242
+     * The 'Download Your Data' page.
243
+     *
244
+     * @since 3.6.0
245
+     * @access private
246
+     * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
247
+     */
248
+    private $download_your_data_page;
249
+
250
+    /**
251
+     * Define the core functionality of the plugin.
252
+     *
253
+     * Set the plugin name and the plugin version that can be used throughout the plugin.
254
+     * Load the dependencies, define the locale, and set the hooks for the admin area and
255
+     * the public-facing side of the site.
256
+     *
257
+     * @since    1.0.0
258
+     */
259
+    public function __construct() {
260
+
261
+        $this->plugin_name = 'wordlift';
262
+        $this->version     = '3.7.1-dev';
263
+        $this->load_dependencies();
264
+        $this->set_locale();
265
+        $this->define_admin_hooks();
266
+        $this->define_public_hooks();
267
+
268
+    }
269
+
270
+    /**
271
+     * Load the required dependencies for this plugin.
272
+     *
273
+     * Include the following files that make up the plugin:
274
+     *
275
+     * - Wordlift_Loader. Orchestrates the hooks of the plugin.
276
+     * - Wordlift_i18n. Defines internationalization functionality.
277
+     * - Wordlift_Admin. Defines all hooks for the admin area.
278
+     * - Wordlift_Public. Defines all hooks for the public side of the site.
279
+     *
280
+     * Create an instance of the loader which will be used to register the hooks
281
+     * with WordPress.
282
+     *
283
+     * @since    1.0.0
284
+     * @access   private
285
+     */
286
+    private function load_dependencies() {
287
+
288
+        /**
289
+         * The class responsible for orchestrating the actions and filters of the
290
+         * core plugin.
291
+         */
292
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
293
+
294
+        /**
295
+         * The class responsible for defining internationalization functionality
296
+         * of the plugin.
297
+         */
298
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
299
+
300
+        /**
301
+         * Provide support functions to sanitize data.
302
+         */
303
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
304
+
305
+        /**
306
+         * The Redirect service.
307
+         */
308
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
309
+
310
+        /**
311
+         * The Log service.
312
+         */
313
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
314
+
315
+        /**
316
+         * The configuration service.
317
+         */
318
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
319
+
320
+        /**
321
+         * The entity post type service.
322
+         */
323
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
324
+
325
+        /**
326
+         * The entity link service.
327
+         */
328
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
329
+
330
+        /**
331
+         * The Query builder.
332
+         */
333
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
334
+
335
+        /**
336
+         * The Schema service.
337
+         */
338
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
339
+
340
+        /**
341
+         * The schema:url property service.
342
+         */
343
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
344
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
345
+
346
+        /**
347
+         * The UI service.
348
+         */
349
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
350
+
351
+        /**
352
+         * The Thumbnail service.
353
+         */
354
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
355
+
356
+        /**
357
+         * The Entity Types Taxonomy service.
358
+         */
359
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
360
+
361
+        /**
362
+         * The Entity service.
363
+         */
364
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
365
+
366
+        /**
367
+         * The User service.
368
+         */
369
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
370
+
371
+        /**
372
+         * The Timeline service.
373
+         */
374
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
375
+
376
+        /**
377
+         * The Topic Taxonomy service.
378
+         */
379
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
380
+
381
+
382
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-page-service.php';
383
+
384
+        /**
385
+         * The SPARQL service.
386
+         */
387
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
388
+
389
+        /**
390
+         * The WordLift import service.
391
+         */
392
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
393
+
394
+        /**
395
+         * The WordLift URI service.
396
+         */
397
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
398
+
399
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php';
400
+
401
+        /**
402
+         * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
403
+         */
404
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php';
405
+
406
+        /**
407
+         * The class responsible for defining all actions that occur in the admin area.
408
+         */
409
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
410
+
411
+        /**
412
+         * The class to customize the entity list admin page.
413
+         */
414
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
415
+
416
+        /**
417
+         * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
418
+         */
419
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
420
+
421
+        /**
422
+         * The Notice service.
423
+         */
424
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
425
+
426
+        /**
427
+         * The PrimaShop adapter.
428
+         */
429
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
430
+
431
+        /**
432
+         * The WordLift Dashboard service.
433
+         */
434
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
435
+
436
+        /**
437
+         * The admin 'Download Your Data' page.
438
+         */
439
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
440 440
 
441
-		/**
442
-		 * The class responsible for defining all actions that occur in the public-facing
443
-		 * side of the site.
444
-		 */
445
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
441
+        /**
442
+         * The class responsible for defining all actions that occur in the public-facing
443
+         * side of the site.
444
+         */
445
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
446 446
 
447
-		/**
448
-		 * The shortcode abstract class.
449
-		 */
450
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
447
+        /**
448
+         * The shortcode abstract class.
449
+         */
450
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
451 451
 
452
-		/**
453
-		 * The Timeline shortcode.
454
-		 */
455
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
452
+        /**
453
+         * The Timeline shortcode.
454
+         */
455
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
456 456
 
457
-		/**
458
-		 * The Navigator shortcode.
459
-		 */
460
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
457
+        /**
458
+         * The Navigator shortcode.
459
+         */
460
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
461 461
 
462
-		/**
463
-		 * The chord shortcode.
464
-		 */
465
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
462
+        /**
463
+         * The chord shortcode.
464
+         */
465
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
466 466
 
467
-		/**
468
-		 * The geomap shortcode.
469
-		 */
470
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
467
+        /**
468
+         * The geomap shortcode.
469
+         */
470
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
471 471
 
472
-		/**
473
-		 * The ShareThis service.
474
-		 */
475
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
472
+        /**
473
+         * The ShareThis service.
474
+         */
475
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
476 476
 
477
-		$this->loader = new Wordlift_Loader();
477
+        $this->loader = new Wordlift_Loader();
478 478
 
479
-		// Instantiate a global logger.
480
-		global $wl_logger;
481
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
479
+        // Instantiate a global logger.
480
+        global $wl_logger;
481
+        $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
482 482
 
483
-		// Create the configuration service.
484
-		$configuration_service = new Wordlift_Configuration_Service();
483
+        // Create the configuration service.
484
+        $configuration_service = new Wordlift_Configuration_Service();
485 485
 
486
-		// Create an entity type service instance. It'll be later bound to the init action.
487
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $configuration_service->get_entity_base_path() );
486
+        // Create an entity type service instance. It'll be later bound to the init action.
487
+        $this->entity_type_service = new Wordlift_Entity_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $configuration_service->get_entity_base_path() );
488 488
 
489
-		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
490
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_type_service, $configuration_service->get_entity_base_path() );
489
+        // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
490
+        $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_type_service, $configuration_service->get_entity_base_path() );
491 491
 
492
-		// Create an instance of the UI service.
493
-		$this->ui_service = new Wordlift_UI_Service();
492
+        // Create an instance of the UI service.
493
+        $this->ui_service = new Wordlift_UI_Service();
494 494
 
495
-		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
496
-		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
495
+        // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
496
+        $this->thumbnail_service = new Wordlift_Thumbnail_Service();
497 497
 
498
-		$this->sparql_service = new Wordlift_Sparql_Service();
498
+        $this->sparql_service = new Wordlift_Sparql_Service();
499 499
 
500
-		// Create an instance of the Schema service.
501
-		new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
502
-		$this->schema_service = new Wordlift_Schema_Service();
500
+        // Create an instance of the Schema service.
501
+        new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
502
+        $this->schema_service = new Wordlift_Schema_Service();
503 503
 
504
-		// Create an instance of the Notice service.
505
-		$this->notice_service = new Wordlift_Notice_Service();
504
+        // Create an instance of the Notice service.
505
+        $this->notice_service = new Wordlift_Notice_Service();
506 506
 
507
-		// Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page.
508
-		$this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->schema_service, $this->notice_service );
507
+        // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page.
508
+        $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->schema_service, $this->notice_service );
509 509
 
510
-		// Create an instance of the User service.
511
-		$this->user_service = new Wordlift_User_Service();
510
+        // Create an instance of the User service.
511
+        $this->user_service = new Wordlift_User_Service();
512 512
 
513
-		// Create a new instance of the Timeline service and Timeline shortcode.
514
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
513
+        // Create a new instance of the Timeline service and Timeline shortcode.
514
+        $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
515 515
 
516
-		// Create a new instance of the Redirect service.
517
-		$this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service );
516
+        // Create a new instance of the Redirect service.
517
+        $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service );
518 518
 
519
-		// Create a new instance of the Redirect service.
520
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->entity_service );
519
+        // Create a new instance of the Redirect service.
520
+        $this->dashboard_service = new Wordlift_Dashboard_Service( $this->entity_service );
521 521
 
522
-		// Initialize the shortcodes.
523
-		new Wordlift_Navigator_Shortcode();
524
-		new Wordlift_Chord_Shortcode();
525
-		new Wordlift_Geomap_Shortcode();
526
-		new Wordlift_Timeline_Shortcode();
522
+        // Initialize the shortcodes.
523
+        new Wordlift_Navigator_Shortcode();
524
+        new Wordlift_Chord_Shortcode();
525
+        new Wordlift_Geomap_Shortcode();
526
+        new Wordlift_Timeline_Shortcode();
527 527
 
528
-		// Create entity list customization (wp-admin/edit.php)
529
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->entity_service );
528
+        // Create entity list customization (wp-admin/edit.php)
529
+        $this->entity_list_service = new Wordlift_Entity_List_Service( $this->entity_service );
530 530
 
531
-		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
531
+        $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
532 532
 
533
-		$this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service();
533
+        $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service();
534 534
 
535
-		// Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
536
-		$this->sharethis_service = new Wordlift_ShareThis_Service();
535
+        // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
536
+        $this->sharethis_service = new Wordlift_ShareThis_Service();
537 537
 
538
-		// Create an instance of the PrimaShop adapter.
539
-		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
538
+        // Create an instance of the PrimaShop adapter.
539
+        $this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
540 540
 
541
-		$this->page_service = new Wordlift_Page_Service();
541
+        $this->page_service = new Wordlift_Page_Service();
542 542
 
543
-		// Create an import service instance to hook later to WP's import function.
544
-		$this->import_service = new Wordlift_Import_Service( $this->entity_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, wl_configuration_get_redlink_dataset_uri() );
543
+        // Create an import service instance to hook later to WP's import function.
544
+        $this->import_service = new Wordlift_Import_Service( $this->entity_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, wl_configuration_get_redlink_dataset_uri() );
545 545
 
546
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
546
+        $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
547 547
 
548
-		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
549
-		$this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service );
548
+        // Create a Rebuild Service instance, which we'll later bound to an ajax call.
549
+        $this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service );
550 550
 
551
-		//** WordPress Admin */
552
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page();
551
+        //** WordPress Admin */
552
+        $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page();
553 553
 
554
-	}
554
+    }
555 555
 
556
-	/**
557
-	 * Define the locale for this plugin for internationalization.
558
-	 *
559
-	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
560
-	 * with WordPress.
561
-	 *
562
-	 * @since    1.0.0
563
-	 * @access   private
564
-	 */
565
-	private function set_locale() {
556
+    /**
557
+     * Define the locale for this plugin for internationalization.
558
+     *
559
+     * Uses the Wordlift_i18n class in order to set the domain and to register the hook
560
+     * with WordPress.
561
+     *
562
+     * @since    1.0.0
563
+     * @access   private
564
+     */
565
+    private function set_locale() {
566 566
 
567
-		$plugin_i18n = new Wordlift_i18n();
568
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
567
+        $plugin_i18n = new Wordlift_i18n();
568
+        $plugin_i18n->set_domain( $this->get_plugin_name() );
569 569
 
570
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
570
+        $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
571 571
 
572
-	}
572
+    }
573 573
 
574
-	/**
575
-	 * Register all of the hooks related to the admin area functionality
576
-	 * of the plugin.
577
-	 *
578
-	 * @since    1.0.0
579
-	 * @access   private
580
-	 */
581
-	private function define_admin_hooks() {
574
+    /**
575
+     * Register all of the hooks related to the admin area functionality
576
+     * of the plugin.
577
+     *
578
+     * @since    1.0.0
579
+     * @access   private
580
+     */
581
+    private function define_admin_hooks() {
582 582
 
583
-		$plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() );
583
+        $plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() );
584 584
 
585
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
586
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
585
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
586
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
587 587
 
588
-		// Hook the init action to the Topic Taxonomy service.
589
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
588
+        // Hook the init action to the Topic Taxonomy service.
589
+        $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
590 590
 
591
-		// Hook the deleted_post_meta action to the Thumbnail service.
592
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
591
+        // Hook the deleted_post_meta action to the Thumbnail service.
592
+        $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
593 593
 
594
-		// Hook the added_post_meta action to the Thumbnail service.
595
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
594
+        // Hook the added_post_meta action to the Thumbnail service.
595
+        $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
596 596
 
597
-		// Hook the updated_post_meta action to the Thumbnail service.
598
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
597
+        // Hook the updated_post_meta action to the Thumbnail service.
598
+        $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
599 599
 
600
-		// Hook posts inserts (or updates) to the user service.
601
-		$this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
600
+        // Hook posts inserts (or updates) to the user service.
601
+        $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
602 602
 
603
-		// Hook the AJAX wl_timeline action to the Timeline service.
604
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
603
+        // Hook the AJAX wl_timeline action to the Timeline service.
604
+        $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
605 605
 
606
-		// Register custom allowed redirect hosts.
607
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
608
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
609
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
610
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
611
-		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
612
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
613
-		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
606
+        // Register custom allowed redirect hosts.
607
+        $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
608
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
609
+        $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
610
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
611
+        $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
612
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
613
+        $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
614 614
 
615
-		// Hook save_post to the entity service to update custom fields (such as alternate labels).
616
-		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
617
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
618
-		$this->loader->add_action( 'save_post_entity', $this->entity_service, 'set_rating_for', 10, 1 );
615
+        // Hook save_post to the entity service to update custom fields (such as alternate labels).
616
+        // We have a priority of 9 because we want to be executed before data is sent to Redlink.
617
+        $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
618
+        $this->loader->add_action( 'save_post_entity', $this->entity_service, 'set_rating_for', 10, 1 );
619 619
 
620
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
621
-		$this->loader->add_action( 'in_admin_header', $this->entity_service, 'in_admin_header' );
622
-
623
-		// Entity listing customization (wp-admin/edit.php)
624
-		// Add custom columns
625
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
626
-		$this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
627
-		// Add 4W selection
628
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
629
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
630
-
631
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
632
-
633
-		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
634
-		// entities.
635
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
636
-
637
-		// Filter imported post meta.
638
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
639
-
640
-		// Notify the import service when an import starts and ends.
641
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
642
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
643
-
644
-		// Hook the AJAX wl_rebuild action to the Rebuild Service.
645
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
646
-
647
-		// Hook the menu to the Download Your Data page.
648
-		$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
649
-
650
-		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
651
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
652
-
653
-	}
654
-
655
-	/**
656
-	 * Register all of the hooks related to the public-facing functionality
657
-	 * of the plugin.
658
-	 *
659
-	 * @since    1.0.0
660
-	 * @access   private
661
-	 */
662
-	private function define_public_hooks() {
663
-
664
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
665
-
666
-		// Register the entity post type.
667
-		$this->loader->add_action( 'init', $this->entity_type_service, 'register' );
668
-
669
-		// Bind the link generation and handling hooks to the entity link service.
670
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
671
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', 10, 1 );
672
-		$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 );
673
-		$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 );
674
-
675
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
676
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
677
-
678
-		// Hook the AJAX wl_timeline action to the Timeline service.
679
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
680
-
681
-		// Hook the ShareThis service.
682
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
683
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
684
-
685
-		$this->loader->add_action( 'wp_head', $this->page_service, 'wp_head', PHP_INT_MAX );
686
-		$this->loader->add_action( 'wp_footer', $this->page_service, 'wp_head', - PHP_INT_MAX );
687
-
688
-	}
689
-
690
-	/**
691
-	 * Run the loader to execute all of the hooks with WordPress.
692
-	 *
693
-	 * @since    1.0.0
694
-	 */
695
-	public function run() {
696
-		$this->loader->run();
697
-	}
698
-
699
-	/**
700
-	 * The name of the plugin used to uniquely identify it within the context of
701
-	 * WordPress and to define internationalization functionality.
702
-	 *
703
-	 * @since     1.0.0
704
-	 * @return    string    The name of the plugin.
705
-	 */
706
-	public function get_plugin_name() {
707
-		return $this->plugin_name;
708
-	}
709
-
710
-	/**
711
-	 * The reference to the class that orchestrates the hooks with the plugin.
712
-	 *
713
-	 * @since     1.0.0
714
-	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
715
-	 */
716
-	public function get_loader() {
717
-		return $this->loader;
718
-	}
719
-
720
-	/**
721
-	 * Retrieve the version number of the plugin.
722
-	 *
723
-	 * @since     1.0.0
724
-	 * @return    string    The version number of the plugin.
725
-	 */
726
-	public function get_version() {
727
-		return $this->version;
728
-	}
620
+        $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
621
+        $this->loader->add_action( 'in_admin_header', $this->entity_service, 'in_admin_header' );
622
+
623
+        // Entity listing customization (wp-admin/edit.php)
624
+        // Add custom columns
625
+        $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
626
+        $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
627
+        // Add 4W selection
628
+        $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
629
+        $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
630
+
631
+        $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
632
+
633
+        // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
634
+        // entities.
635
+        $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
636
+
637
+        // Filter imported post meta.
638
+        $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
639
+
640
+        // Notify the import service when an import starts and ends.
641
+        $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
642
+        $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
643
+
644
+        // Hook the AJAX wl_rebuild action to the Rebuild Service.
645
+        $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
646
+
647
+        // Hook the menu to the Download Your Data page.
648
+        $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
649
+
650
+        // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
651
+        $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
652
+
653
+    }
654
+
655
+    /**
656
+     * Register all of the hooks related to the public-facing functionality
657
+     * of the plugin.
658
+     *
659
+     * @since    1.0.0
660
+     * @access   private
661
+     */
662
+    private function define_public_hooks() {
663
+
664
+        $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
665
+
666
+        // Register the entity post type.
667
+        $this->loader->add_action( 'init', $this->entity_type_service, 'register' );
668
+
669
+        // Bind the link generation and handling hooks to the entity link service.
670
+        $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
671
+        $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', 10, 1 );
672
+        $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 );
673
+        $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 );
674
+
675
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
676
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
677
+
678
+        // Hook the AJAX wl_timeline action to the Timeline service.
679
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
680
+
681
+        // Hook the ShareThis service.
682
+        $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
683
+        $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
684
+
685
+        $this->loader->add_action( 'wp_head', $this->page_service, 'wp_head', PHP_INT_MAX );
686
+        $this->loader->add_action( 'wp_footer', $this->page_service, 'wp_head', - PHP_INT_MAX );
687
+
688
+    }
689
+
690
+    /**
691
+     * Run the loader to execute all of the hooks with WordPress.
692
+     *
693
+     * @since    1.0.0
694
+     */
695
+    public function run() {
696
+        $this->loader->run();
697
+    }
698
+
699
+    /**
700
+     * The name of the plugin used to uniquely identify it within the context of
701
+     * WordPress and to define internationalization functionality.
702
+     *
703
+     * @since     1.0.0
704
+     * @return    string    The name of the plugin.
705
+     */
706
+    public function get_plugin_name() {
707
+        return $this->plugin_name;
708
+    }
709
+
710
+    /**
711
+     * The reference to the class that orchestrates the hooks with the plugin.
712
+     *
713
+     * @since     1.0.0
714
+     * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
715
+     */
716
+    public function get_loader() {
717
+        return $this->loader;
718
+    }
719
+
720
+    /**
721
+     * Retrieve the version number of the plugin.
722
+     *
723
+     * @since     1.0.0
724
+     * @return    string    The version number of the plugin.
725
+     */
726
+    public function get_version() {
727
+        return $this->version;
728
+    }
729 729
 
730 730
 }
Please login to merge, or discard this patch.
src/wordlift.php 1 patch
Indentation   +255 added lines, -255 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
 // If this file is called directly, abort.
28 28
 if ( ! defined( 'WPINC' ) ) {
29
-	die;
29
+    die;
30 30
 }
31 31
 
32 32
 // Include WordLift constants.
@@ -47,18 +47,18 @@  discard block
 block discarded – undo
47 47
  */
48 48
 function wl_write_log( $log ) {
49 49
 
50
-	$handler = apply_filters( 'wl_write_log_handler', NULL );
50
+    $handler = apply_filters( 'wl_write_log_handler', NULL );
51 51
 
52
-	$callers         = debug_backtrace();
53
-	$caller_function = $callers[1]['function'];
52
+    $callers         = debug_backtrace();
53
+    $caller_function = $callers[1]['function'];
54 54
 
55
-	if ( is_null( $handler ) ) {
56
-		wl_write_log_handler( $log, $caller_function );
55
+    if ( is_null( $handler ) ) {
56
+        wl_write_log_handler( $log, $caller_function );
57 57
 
58
-		return;
59
-	}
58
+        return;
59
+    }
60 60
 
61
-	call_user_func( $handler, $log, $caller_function );
61
+    call_user_func( $handler, $log, $caller_function );
62 62
 }
63 63
 
64 64
 /**
@@ -71,20 +71,20 @@  discard block
 block discarded – undo
71 71
  */
72 72
 function wl_write_log_handler( $log, $caller = NULL ) {
73 73
 
74
-	global $wl_logger;
74
+    global $wl_logger;
75 75
 
76
-	if ( TRUE === WP_DEBUG ) {
76
+    if ( TRUE === WP_DEBUG ) {
77 77
 
78
-		$message = ( isset( $caller ) ? sprintf( '[%-40.40s] ', $caller ) : '' ) .
79
-		           ( is_array( $log ) || is_object( $log ) ? print_r( $log, TRUE ) : wl_write_log_hide_key( $log ) );
78
+        $message = ( isset( $caller ) ? sprintf( '[%-40.40s] ', $caller ) : '' ) .
79
+                    ( is_array( $log ) || is_object( $log ) ? print_r( $log, TRUE ) : wl_write_log_hide_key( $log ) );
80 80
 
81
-		if ( isset( $wl_logger ) ) {
82
-			$wl_logger->info( $message );
83
-		} else {
84
-			error_log( $message );
85
-		}
81
+        if ( isset( $wl_logger ) ) {
82
+            $wl_logger->info( $message );
83
+        } else {
84
+            error_log( $message );
85
+        }
86 86
 
87
-	}
87
+    }
88 88
 
89 89
 }
90 90
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
  */
100 100
 function wl_write_log_hide_key( $text ) {
101 101
 
102
-	return str_ireplace( wl_configuration_get_key(), '<hidden>', $text );
102
+    return str_ireplace( wl_configuration_get_key(), '<hidden>', $text );
103 103
 }
104 104
 
105 105
 /**
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
  */
112 112
 function wl_queue_sparql_update_query( $query ) {
113 113
 
114
-	$filename = WL_TEMP_DIR . WL_REQUEST_ID . '.sparql';
115
-	file_put_contents( $filename, $query . "\n", FILE_APPEND );
114
+    $filename = WL_TEMP_DIR . WL_REQUEST_ID . '.sparql';
115
+    file_put_contents( $filename, $query . "\n", FILE_APPEND );
116 116
 
117
-	wl_write_log( "wl_queue_sparql_update_query [ filename :: $filename ]" );
117
+    wl_write_log( "wl_queue_sparql_update_query [ filename :: $filename ]" );
118 118
 }
119 119
 
120 120
 /**
@@ -124,28 +124,28 @@  discard block
 block discarded – undo
124 124
  */
125 125
 function wl_execute_saved_sparql_update_query( $request_id ) {
126 126
 
127
-	$filename = WL_TEMP_DIR . $request_id . '.sparql';
127
+    $filename = WL_TEMP_DIR . $request_id . '.sparql';
128 128
 
129
-	// If the file doesn't exist, exit.
130
-	if ( ! file_exists( $filename ) ) {
131
-		wl_write_log( "wl_execute_saved_sparql_update_query : file doesn't exist [ filename :: $filename ]" );
129
+    // If the file doesn't exist, exit.
130
+    if ( ! file_exists( $filename ) ) {
131
+        wl_write_log( "wl_execute_saved_sparql_update_query : file doesn't exist [ filename :: $filename ]" );
132 132
 
133
-		return;
134
-	}
133
+        return;
134
+    }
135 135
 
136
-	wl_write_log( "wl_execute_saved_sparql_update_query [ filename :: $filename ]" );
136
+    wl_write_log( "wl_execute_saved_sparql_update_query [ filename :: $filename ]" );
137 137
 
138
-	// Get the query saved in the file.
139
-	$query = file_get_contents( $filename );
138
+    // Get the query saved in the file.
139
+    $query = file_get_contents( $filename );
140 140
 
141
-	// Execute the SPARQL query.
142
-	rl_execute_sparql_update_query( $query, FALSE );
141
+    // Execute the SPARQL query.
142
+    rl_execute_sparql_update_query( $query, FALSE );
143 143
 
144
-	// Reindex the triple store.
145
-	wordlift_reindex_triple_store();
144
+    // Reindex the triple store.
145
+    wordlift_reindex_triple_store();
146 146
 
147
-	// Delete the temporary file.
148
-	unlink( $filename );
147
+    // Delete the temporary file.
148
+    unlink( $filename );
149 149
 }
150 150
 
151 151
 add_action( 'wl_execute_saved_sparql_update_query', 'wl_execute_saved_sparql_update_query', 10, 1 );
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
  */
156 156
 function wordlift_buttonhooks() {
157 157
 
158
-	// Only add hooks when the current user has permissions AND is in Rich Text editor mode
159
-	if ( ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) && get_user_option( 'rich_editing' ) ) {
160
-		add_filter( 'mce_external_plugins', 'wordlift_register_tinymce_javascript' );
161
-	}
158
+    // Only add hooks when the current user has permissions AND is in Rich Text editor mode
159
+    if ( ( current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' ) ) && get_user_option( 'rich_editing' ) ) {
160
+        add_filter( 'mce_external_plugins', 'wordlift_register_tinymce_javascript' );
161
+    }
162 162
 }
163 163
 
164 164
 /**
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
  */
171 171
 function wordlift_register_tinymce_javascript( $plugin_array ) {
172 172
 
173
-	// add the wordlift plugin.
174
-	// We can't use the minified version here.
175
-	$plugin_array['wordlift'] = plugin_dir_url( __FILE__ ) . 'js/wordlift-reloaded.js';
173
+    // add the wordlift plugin.
174
+    // We can't use the minified version here.
175
+    $plugin_array['wordlift'] = plugin_dir_url( __FILE__ ) . 'js/wordlift-reloaded.js';
176 176
 
177
-	return $plugin_array;
177
+    return $plugin_array;
178 178
 }
179 179
 
180 180
 /**
@@ -182,21 +182,21 @@  discard block
 block discarded – undo
182 182
  * see http://vip.wordpress.com/documentation/register-additional-html-attributes-for-tinymce-and-wp-kses/
183 183
  */
184 184
 function wordlift_allowed_post_tags() {
185
-	global $allowedposttags;
186
-
187
-	$tags           = array( 'span' );
188
-	$new_attributes = array(
189
-		'itemscope' => array(),
190
-		'itemtype'  => array(),
191
-		'itemprop'  => array(),
192
-		'itemid'    => array()
193
-	);
194
-
195
-	foreach ( $tags as $tag ) {
196
-		if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) {
197
-			$allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes );
198
-		}
199
-	}
185
+    global $allowedposttags;
186
+
187
+    $tags           = array( 'span' );
188
+    $new_attributes = array(
189
+        'itemscope' => array(),
190
+        'itemtype'  => array(),
191
+        'itemprop'  => array(),
192
+        'itemid'    => array()
193
+    );
194
+
195
+    foreach ( $tags as $tag ) {
196
+        if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) {
197
+            $allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes );
198
+        }
199
+    }
200 200
 }
201 201
 
202 202
 // init process for button control
@@ -210,28 +210,28 @@  discard block
 block discarded – undo
210 210
  */
211 211
 function wordlift_admin_enqueue_scripts() {
212 212
 
213
-	// Added for compatibility with WordPress 3.9 (see http://make.wordpress.org/core/2014/04/16/jquery-ui-and-wpdialogs-in-wordpress-3-9/)
214
-	wp_enqueue_script( 'wpdialogs' );
215
-	wp_enqueue_style( 'wp-jquery-ui-dialog' );
213
+    // Added for compatibility with WordPress 3.9 (see http://make.wordpress.org/core/2014/04/16/jquery-ui-and-wpdialogs-in-wordpress-3-9/)
214
+    wp_enqueue_script( 'wpdialogs' );
215
+    wp_enqueue_style( 'wp-jquery-ui-dialog' );
216 216
 
217
-	wp_enqueue_style( 'wordlift-reloaded', plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css' );
217
+    wp_enqueue_style( 'wordlift-reloaded', plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css' );
218 218
 
219
-	wp_enqueue_script( 'jquery-ui-autocomplete' );
220
-	wp_enqueue_script( 'angularjs', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js' );
221
-	wp_enqueue_script( 'angularjs-geolocation', plugin_dir_url( __FILE__ ) . '/bower_components/angularjs-geolocation/dist/angularjs-geolocation.min.js' );
222
-	wp_enqueue_script( 'angularjs-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js' );
223
-	wp_enqueue_script( 'angularjs-animate', 'https://code.angularjs.org/1.3.11/angular-animate.min.js' );
219
+    wp_enqueue_script( 'jquery-ui-autocomplete' );
220
+    wp_enqueue_script( 'angularjs', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js' );
221
+    wp_enqueue_script( 'angularjs-geolocation', plugin_dir_url( __FILE__ ) . '/bower_components/angularjs-geolocation/dist/angularjs-geolocation.min.js' );
222
+    wp_enqueue_script( 'angularjs-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js' );
223
+    wp_enqueue_script( 'angularjs-animate', 'https://code.angularjs.org/1.3.11/angular-animate.min.js' );
224 224
 
225
-	// Disable auto-save for custom entity posts only
226
-	if ( Wordlift_Entity_Service::TYPE_NAME === get_post_type() ) {
227
-		wp_dequeue_script( 'autosave' );
228
-	}
225
+    // Disable auto-save for custom entity posts only
226
+    if ( Wordlift_Entity_Service::TYPE_NAME === get_post_type() ) {
227
+        wp_dequeue_script( 'autosave' );
228
+    }
229 229
 }
230 230
 
231 231
 add_action( 'admin_enqueue_scripts', 'wordlift_admin_enqueue_scripts' );
232 232
 
233 233
 function wl_enqueue_scripts() {
234
-	wp_enqueue_style( 'wordlift-ui', plugin_dir_url( __FILE__ ) . 'css/wordlift-ui.min.css' );
234
+    wp_enqueue_style( 'wordlift-ui', plugin_dir_url( __FILE__ ) . 'css/wordlift-ui.min.css' );
235 235
 }
236 236
 
237 237
 add_action( 'wp_enqueue_scripts', 'wl_enqueue_scripts' );
@@ -246,18 +246,18 @@  discard block
 block discarded – undo
246 246
  */
247 247
 function wordlift_allowed_html( $allowedtags, $context ) {
248 248
 
249
-	if ( 'post' !== $context ) {
250
-		return $allowedtags;
251
-	}
252
-
253
-	return array_merge_recursive( $allowedtags, array(
254
-		'span' => array(
255
-			'itemscope' => TRUE,
256
-			'itemtype'  => TRUE,
257
-			'itemid'    => TRUE,
258
-			'itemprop'  => TRUE
259
-		)
260
-	) );
249
+    if ( 'post' !== $context ) {
250
+        return $allowedtags;
251
+    }
252
+
253
+    return array_merge_recursive( $allowedtags, array(
254
+        'span' => array(
255
+            'itemscope' => TRUE,
256
+            'itemtype'  => TRUE,
257
+            'itemid'    => TRUE,
258
+            'itemprop'  => TRUE
259
+        )
260
+    ) );
261 261
 }
262 262
 
263 263
 add_filter( 'wp_kses_allowed_html', 'wordlift_allowed_html', 10, 2 );
@@ -271,15 +271,15 @@  discard block
 block discarded – undo
271 271
  */
272 272
 function wl_get_coordinates( $post_id ) {
273 273
 
274
-	$latitude  = wl_schema_get_value( $post_id, 'latitude' );
275
-	$longitude = wl_schema_get_value( $post_id, 'longitude' );
274
+    $latitude  = wl_schema_get_value( $post_id, 'latitude' );
275
+    $longitude = wl_schema_get_value( $post_id, 'longitude' );
276 276
 
277
-	// DO NOT set latitude/longitude to 0/0 as default values. It's a specific place on the globe:
278
-	// "The zero/zero point of this system is located in the Gulf of Guinea about 625 km (390 mi) south of Tema, Ghana."
279
-	return array(
280
-		'latitude'  => isset( $latitude[0] ) && is_numeric( $latitude[0] ) ? $latitude[0] : '',
281
-		'longitude' => isset( $longitude[0] ) && is_numeric( $longitude[0] ) ? $longitude[0] : ''
282
-	);
277
+    // DO NOT set latitude/longitude to 0/0 as default values. It's a specific place on the globe:
278
+    // "The zero/zero point of this system is located in the Gulf of Guinea about 625 km (390 mi) south of Tema, Ghana."
279
+    return array(
280
+        'latitude'  => isset( $latitude[0] ) && is_numeric( $latitude[0] ) ? $latitude[0] : '',
281
+        'longitude' => isset( $longitude[0] ) && is_numeric( $longitude[0] ) ? $longitude[0] : ''
282
+    );
283 283
 }
284 284
 
285 285
 /**
@@ -291,13 +291,13 @@  discard block
 block discarded – undo
291 291
  */
292 292
 function wl_get_post_modified_time( $post ) {
293 293
 
294
-	$date_modified = get_post_modified_time( 'c', TRUE, $post );
294
+    $date_modified = get_post_modified_time( 'c', TRUE, $post );
295 295
 
296
-	if ( '-' === substr( $date_modified, 0, 1 ) ) {
297
-		return get_the_time( 'c', $post );
298
-	}
296
+    if ( '-' === substr( $date_modified, 0, 1 ) ) {
297
+        return get_the_time( 'c', $post );
298
+    }
299 299
 
300
-	return $date_modified;
300
+    return $date_modified;
301 301
 }
302 302
 
303 303
 /**
@@ -310,42 +310,42 @@  discard block
 block discarded – undo
310 310
 function wl_get_image_urls( $post_id ) {
311 311
 
312 312
 
313
-	// If there is a featured image it has the priority
314
-	$featured_image_id = get_post_thumbnail_id( $post_id );
315
-	if ( is_numeric( $featured_image_id ) ) {
316
-		$image_url = wp_get_attachment_url( $featured_image_id );
313
+    // If there is a featured image it has the priority
314
+    $featured_image_id = get_post_thumbnail_id( $post_id );
315
+    if ( is_numeric( $featured_image_id ) ) {
316
+        $image_url = wp_get_attachment_url( $featured_image_id );
317 317
 
318
-		return array( $image_url );
319
-	}
318
+        return array( $image_url );
319
+    }
320 320
 
321
-	// wl_write_log( "wl_get_image_urls [ post id :: $post_id ]" );
321
+    // wl_write_log( "wl_get_image_urls [ post id :: $post_id ]" );
322 322
 
323
-	$images = get_children( array(
324
-		'post_parent'    => $post_id,
325
-		'post_type'      => 'attachment',
326
-		'post_mime_type' => 'image'
327
-	) );
323
+    $images = get_children( array(
324
+        'post_parent'    => $post_id,
325
+        'post_type'      => 'attachment',
326
+        'post_mime_type' => 'image'
327
+    ) );
328 328
 
329
-	// Return an empty array if no image is found.
330
-	if ( empty( $images ) ) {
331
-		return array();
332
-	}
329
+    // Return an empty array if no image is found.
330
+    if ( empty( $images ) ) {
331
+        return array();
332
+    }
333 333
 
334
-	// Prepare the return array.
335
-	$image_urls = array();
334
+    // Prepare the return array.
335
+    $image_urls = array();
336 336
 
337
-	// Collect the URLs.
338
-	foreach ( $images as $attachment_id => $attachment ) {
339
-		$image_url = wp_get_attachment_url( $attachment_id );
340
-		// Ensure the URL isn't collected already.
341
-		if ( ! in_array( $image_url, $image_urls ) ) {
342
-			array_push( $image_urls, $image_url );
343
-		}
344
-	}
337
+    // Collect the URLs.
338
+    foreach ( $images as $attachment_id => $attachment ) {
339
+        $image_url = wp_get_attachment_url( $attachment_id );
340
+        // Ensure the URL isn't collected already.
341
+        if ( ! in_array( $image_url, $image_urls ) ) {
342
+            array_push( $image_urls, $image_url );
343
+        }
344
+    }
345 345
 
346
-	// wl_write_log( "wl_get_image_urls [ post id :: $post_id ][ image urls count :: " . count( $image_urls ) . " ]" );
346
+    // wl_write_log( "wl_get_image_urls [ post id :: $post_id ][ image urls count :: " . count( $image_urls ) . " ]" );
347 347
 
348
-	return $image_urls;
348
+    return $image_urls;
349 349
 }
350 350
 
351 351
 /**
@@ -358,19 +358,19 @@  discard block
 block discarded – undo
358 358
  */
359 359
 function wl_get_sparql_images( $uri, $post_id ) {
360 360
 
361
-	$sparql = '';
361
+    $sparql = '';
362 362
 
363
-	// Get the escaped URI.
364
-	$uri_e = esc_html( $uri );
363
+    // Get the escaped URI.
364
+    $uri_e = esc_html( $uri );
365 365
 
366
-	// Add SPARQL stmts to write the schema:image.
367
-	$image_urls = wl_get_image_urls( $post_id );
368
-	foreach ( $image_urls as $image_url ) {
369
-		$image_url_esc = wl_sparql_escape_uri( $image_url );
370
-		$sparql .= " <$uri_e> schema:image <$image_url_esc> . \n";
371
-	}
366
+    // Add SPARQL stmts to write the schema:image.
367
+    $image_urls = wl_get_image_urls( $post_id );
368
+    foreach ( $image_urls as $image_url ) {
369
+        $image_url_esc = wl_sparql_escape_uri( $image_url );
370
+        $sparql .= " <$uri_e> schema:image <$image_url_esc> . \n";
371
+    }
372 372
 
373
-	return $sparql;
373
+    return $sparql;
374 374
 }
375 375
 
376 376
 /**
@@ -383,24 +383,24 @@  discard block
 block discarded – undo
383 383
  */
384 384
 function wl_get_attachment_for_source_url( $parent_post_id, $source_url ) {
385 385
 
386
-	// wl_write_log( "wl_get_attachment_for_source_url [ parent post id :: $parent_post_id ][ source url :: $source_url ]" );
386
+    // wl_write_log( "wl_get_attachment_for_source_url [ parent post id :: $parent_post_id ][ source url :: $source_url ]" );
387 387
 
388
-	$posts = get_posts( array(
389
-		'post_type'      => 'attachment',
390
-		'posts_per_page' => 1,
391
-		'post_status'    => 'any',
392
-		'post_parent'    => $parent_post_id,
393
-		'meta_key'       => 'wl_source_url',
394
-		'meta_value'     => $source_url
395
-	) );
388
+    $posts = get_posts( array(
389
+        'post_type'      => 'attachment',
390
+        'posts_per_page' => 1,
391
+        'post_status'    => 'any',
392
+        'post_parent'    => $parent_post_id,
393
+        'meta_key'       => 'wl_source_url',
394
+        'meta_value'     => $source_url
395
+    ) );
396 396
 
397
-	// Return the found post.
398
-	if ( 1 === count( $posts ) ) {
399
-		return $posts[0];
400
-	}
397
+    // Return the found post.
398
+    if ( 1 === count( $posts ) ) {
399
+        return $posts[0];
400
+    }
401 401
 
402
-	// Return null.
403
-	return NULL;
402
+    // Return null.
403
+    return NULL;
404 404
 }
405 405
 
406 406
 /**
@@ -411,8 +411,8 @@  discard block
 block discarded – undo
411 411
  */
412 412
 function wl_set_source_url( $post_id, $source_url ) {
413 413
 
414
-	delete_post_meta( $post_id, 'wl_source_url' );
415
-	add_post_meta( $post_id, 'wl_source_url', $source_url );
414
+    delete_post_meta( $post_id, 'wl_source_url' );
415
+    add_post_meta( $post_id, 'wl_source_url', $source_url );
416 416
 }
417 417
 
418 418
 
@@ -430,61 +430,61 @@  discard block
 block discarded – undo
430 430
  */
431 431
 function wl_flush_rewrite_rules_hard( $hard ) {
432 432
 
433
-	// If WL is not yet configured, we cannot perform any update, so we exit.
434
-	if ( '' === wl_configuration_get_key() ) {
435
-		return;
436
-	}
433
+    // If WL is not yet configured, we cannot perform any update, so we exit.
434
+    if ( '' === wl_configuration_get_key() ) {
435
+        return;
436
+    }
437 437
 
438
-	// Set the initial offset and limit each call to 100 posts to avoid memory errors.
439
-	$offset = 0;
440
-	$limit  = 100;
438
+    // Set the initial offset and limit each call to 100 posts to avoid memory errors.
439
+    $offset = 0;
440
+    $limit  = 100;
441 441
 
442
-	// Get more posts if the number of returned posts matches the limit.
443
-	while ( $limit === ( $posts = get_posts( array(
444
-			'offset'      => $offset,
445
-			'numberposts' => $limit,
446
-			'orderby'     => 'ID',
447
-			'post_type'   => 'any',
448
-			'post_status' => 'publish'
449
-		) ) ) ) {
442
+    // Get more posts if the number of returned posts matches the limit.
443
+    while ( $limit === ( $posts = get_posts( array(
444
+            'offset'      => $offset,
445
+            'numberposts' => $limit,
446
+            'orderby'     => 'ID',
447
+            'post_type'   => 'any',
448
+            'post_status' => 'publish'
449
+        ) ) ) ) {
450 450
 
451
-		// Holds the delete part of the query.
452
-		$delete_query = rl_sparql_prefixes();
451
+        // Holds the delete part of the query.
452
+        $delete_query = rl_sparql_prefixes();
453 453
 
454
-		// Holds the insert part of the query.
455
-		$insert_query = '';
454
+        // Holds the insert part of the query.
455
+        $insert_query = '';
456 456
 
457
-		// Cycle in each post to build the query.
458
-		foreach ( $posts as $post ) {
457
+        // Cycle in each post to build the query.
458
+        foreach ( $posts as $post ) {
459 459
 
460
-			// Ignore revisions.
461
-			if ( wp_is_post_revision( $post->ID ) ) {
462
-				continue;
463
-			}
460
+            // Ignore revisions.
461
+            if ( wp_is_post_revision( $post->ID ) ) {
462
+                continue;
463
+            }
464 464
 
465
-			// Get the entity URI.
466
-			$s = Wordlift_Sparql_Service::escape_uri( Wordlift_Entity_Service::get_instance()
467
-			                                                                 ->get_uri( $post->ID ) );
465
+            // Get the entity URI.
466
+            $s = Wordlift_Sparql_Service::escape_uri( Wordlift_Entity_Service::get_instance()
467
+                                                                                ->get_uri( $post->ID ) );
468 468
 
469
-			// Get the post URL.
470
-			// $url = wl_sparql_escape_uri( get_permalink( $post->ID ) );
469
+            // Get the post URL.
470
+            // $url = wl_sparql_escape_uri( get_permalink( $post->ID ) );
471 471
 
472
-			// Prepare the DELETE and INSERT commands.
473
-			$delete_query .= "DELETE { <$s> schema:url ?u . } WHERE  { <$s> schema:url ?u . };\n";
472
+            // Prepare the DELETE and INSERT commands.
473
+            $delete_query .= "DELETE { <$s> schema:url ?u . } WHERE  { <$s> schema:url ?u . };\n";
474 474
 
475
-			$insert_query .= Wordlift_Schema_Url_Property_Service::get_instance()
476
-			                                                     ->get_insert_query( $s, $post->ID );
475
+            $insert_query .= Wordlift_Schema_Url_Property_Service::get_instance()
476
+                                                                    ->get_insert_query( $s, $post->ID );
477 477
 
478
-		}
478
+        }
479 479
 
480 480
 
481
-		// Execute the query.
482
-		rl_execute_sparql_update_query( $delete_query . $insert_query );
481
+        // Execute the query.
482
+        rl_execute_sparql_update_query( $delete_query . $insert_query );
483 483
 
484
-		// Advance to the next posts.
485
-		$offset += $limit;
484
+        // Advance to the next posts.
485
+        $offset += $limit;
486 486
 
487
-	}
487
+    }
488 488
 
489 489
 //	// Get all published posts.
490 490
 //	$posts = get_posts( array(
@@ -509,15 +509,15 @@  discard block
 block discarded – undo
509 509
  */
510 510
 function wl_sanitize_uri_path( $path, $char = '_' ) {
511 511
 
512
-	// wl_write_log( "wl_sanitize_uri_path [ path :: $path ][ char :: $char ]" );
512
+    // wl_write_log( "wl_sanitize_uri_path [ path :: $path ][ char :: $char ]" );
513 513
 
514
-	// According to RFC2396 (http://www.ietf.org/rfc/rfc2396.txt) these characters are reserved:
515
-	// ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
516
-	// "$" | ","
517
-	// Plus the ' ' (space).
518
-	// TODO: We shall use the same regex used by MediaWiki (http://stackoverflow.com/questions/23114983/mediawiki-wikipedia-url-sanitization-regex)
514
+    // According to RFC2396 (http://www.ietf.org/rfc/rfc2396.txt) these characters are reserved:
515
+    // ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
516
+    // "$" | ","
517
+    // Plus the ' ' (space).
518
+    // TODO: We shall use the same regex used by MediaWiki (http://stackoverflow.com/questions/23114983/mediawiki-wikipedia-url-sanitization-regex)
519 519
 
520
-	return sanitize_title( preg_replace( '/[;\/?:@&=+$,\s]/', $char, stripslashes( $path ) ) );
520
+    return sanitize_title( preg_replace( '/[;\/?:@&=+$,\s]/', $char, stripslashes( $path ) ) );
521 521
 }
522 522
 
523 523
 /**
@@ -529,11 +529,11 @@  discard block
 block discarded – undo
529 529
  */
530 530
 function wl_force_to_array( $value ) {
531 531
 
532
-	if ( ! is_array( $value ) ) {
533
-		return array( $value );
534
-	}
532
+    if ( ! is_array( $value ) ) {
533
+        return array( $value );
534
+    }
535 535
 
536
-	return $value;
536
+    return $value;
537 537
 }
538 538
 
539 539
 /**
@@ -541,26 +541,26 @@  discard block
 block discarded – undo
541 541
  */
542 542
 function wl_shutdown() {
543 543
 
544
-	// Get the filename to the temporary SPARQL file.
545
-	$filename = WL_TEMP_DIR . WL_REQUEST_ID . '.sparql';
544
+    // Get the filename to the temporary SPARQL file.
545
+    $filename = WL_TEMP_DIR . WL_REQUEST_ID . '.sparql';
546 546
 
547
-	// If WordLift is buffering SPARQL queries, we're admins and a buffer exists, then schedule it.
548
-	if ( WL_ENABLE_SPARQL_UPDATE_QUERIES_BUFFERING && is_admin() && file_exists( $filename ) ) {
547
+    // If WordLift is buffering SPARQL queries, we're admins and a buffer exists, then schedule it.
548
+    if ( WL_ENABLE_SPARQL_UPDATE_QUERIES_BUFFERING && is_admin() && file_exists( $filename ) ) {
549 549
 
550
-		// The request ID.
551
-		$args = array( WL_REQUEST_ID );
550
+        // The request ID.
551
+        $args = array( WL_REQUEST_ID );
552 552
 
553
-		// Schedule the execution of the SPARQL query with the request ID.
554
-		wp_schedule_single_event( time(), 'wl_execute_saved_sparql_update_query', $args );
553
+        // Schedule the execution of the SPARQL query with the request ID.
554
+        wp_schedule_single_event( time(), 'wl_execute_saved_sparql_update_query', $args );
555 555
 
556
-		// Check that the request is scheduled.
557
-		$timestamp = wp_next_scheduled( 'wl_execute_saved_sparql_update_query', $args );
556
+        // Check that the request is scheduled.
557
+        $timestamp = wp_next_scheduled( 'wl_execute_saved_sparql_update_query', $args );
558 558
 
559
-		// Spawn the cron.
560
-		spawn_cron();
559
+        // Spawn the cron.
560
+        spawn_cron();
561 561
 
562
-		wl_write_log( "wl_shutdown [ request id :: " . WL_REQUEST_ID . " ][ timestamp :: $timestamp ]" );
563
-	}
562
+        wl_write_log( "wl_shutdown [ request id :: " . WL_REQUEST_ID . " ][ timestamp :: $timestamp ]" );
563
+    }
564 564
 }
565 565
 
566 566
 add_action( 'shutdown', 'wl_shutdown' );
@@ -574,46 +574,46 @@  discard block
 block discarded – undo
574 574
  */
575 575
 function wl_replace_item_id_with_uri( $content ) {
576 576
 
577
-	// wl_write_log( "wl_replace_item_id_with_uri" );
577
+    // wl_write_log( "wl_replace_item_id_with_uri" );
578 578
 
579
-	// Strip slashes, see https://core.trac.wordpress.org/ticket/21767
580
-	$content = stripslashes( $content );
579
+    // Strip slashes, see https://core.trac.wordpress.org/ticket/21767
580
+    $content = stripslashes( $content );
581 581
 
582
-	// If any match are found.
583
-	$matches = array();
584
-	if ( 0 < preg_match_all( '/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER ) ) {
582
+    // If any match are found.
583
+    $matches = array();
584
+    if ( 0 < preg_match_all( '/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER ) ) {
585 585
 
586
-		foreach ( $matches as $match ) {
586
+        foreach ( $matches as $match ) {
587 587
 
588
-			// Get the item ID.
589
-			$item_id = $match[1];
588
+            // Get the item ID.
589
+            $item_id = $match[1];
590 590
 
591
-			// Get the post bound to that item ID (looking both in the 'official' URI and in the 'same-as' .
592
-			$post = Wordlift_Entity_Service::get_instance()
593
-			                               ->get_entity_post_by_uri( $item_id );
591
+            // Get the post bound to that item ID (looking both in the 'official' URI and in the 'same-as' .
592
+            $post = Wordlift_Entity_Service::get_instance()
593
+                                            ->get_entity_post_by_uri( $item_id );
594 594
 
595
-			// If no entity is found, continue to the next one.
596
-			if ( NULL === $post ) {
597
-				continue;
598
-			}
595
+            // If no entity is found, continue to the next one.
596
+            if ( NULL === $post ) {
597
+                continue;
598
+            }
599 599
 
600
-			// Get the URI for that post.
601
-			$uri = wl_get_entity_uri( $post->ID );
600
+            // Get the URI for that post.
601
+            $uri = wl_get_entity_uri( $post->ID );
602 602
 
603
-			// wl_write_log( "wl_replace_item_id_with_uri [ item id :: $item_id ][ uri :: $uri ]" );
603
+            // wl_write_log( "wl_replace_item_id_with_uri [ item id :: $item_id ][ uri :: $uri ]" );
604 604
 
605
-			// If the item ID and the URI differ, replace the item ID with the URI saved in WordPress.
606
-			if ( $item_id !== $uri ) {
607
-				$uri_e   = esc_html( $uri );
608
-				$content = str_replace( " itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content );
609
-			}
610
-		}
611
-	}
605
+            // If the item ID and the URI differ, replace the item ID with the URI saved in WordPress.
606
+            if ( $item_id !== $uri ) {
607
+                $uri_e   = esc_html( $uri );
608
+                $content = str_replace( " itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content );
609
+            }
610
+        }
611
+    }
612 612
 
613
-	// Reapply slashes.
614
-	$content = addslashes( $content );
613
+    // Reapply slashes.
614
+    $content = addslashes( $content );
615 615
 
616
-	return $content;
616
+    return $content;
617 617
 }
618 618
 
619 619
 add_filter( 'content_save_pre', 'wl_replace_item_id_with_uri', 1, 1 );
@@ -688,8 +688,8 @@  discard block
 block discarded – undo
688 688
  * This action is documented in includes/class-wordlift-activator.php
689 689
  */
690 690
 function activate_wordlift() {
691
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php';
692
-	Wordlift_Activator::activate();
691
+    require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php';
692
+    Wordlift_Activator::activate();
693 693
 }
694 694
 
695 695
 /**
@@ -697,8 +697,8 @@  discard block
 block discarded – undo
697 697
  * This action is documented in includes/class-wordlift-deactivator.php
698 698
  */
699 699
 function deactivate_wordlift() {
700
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php';
701
-	Wordlift_Deactivator::deactivate();
700
+    require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php';
701
+    Wordlift_Deactivator::deactivate();
702 702
 }
703 703
 
704 704
 register_activation_hook( __FILE__, 'activate_wordlift' );
@@ -721,8 +721,8 @@  discard block
 block discarded – undo
721 721
  */
722 722
 function run_wordlift() {
723 723
 
724
-	$plugin = new Wordlift();
725
-	$plugin->run();
724
+    $plugin = new Wordlift();
725
+    $plugin->run();
726 726
 
727 727
 }
728 728
 
Please login to merge, or discard this patch.