Completed
Push — develop ( 2fc574...aa8228 )
by David
02:45
created
src/includes/class-wordlift-user-service.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -346,7 +346,7 @@
 block discarded – undo
346 346
 	 *
347 347
 	 * @param int $user_id The {@link WP_User} `id`.
348 348
 	 *
349
-	 * @return int bool True if editing is denied otherwise false.
349
+	 * @return boolean bool True if editing is denied otherwise false.
350 350
 	 */
351 351
 	public function is_deny_editor_entity_create( $user_id ) {
352 352
 
Please login to merge, or discard this patch.
Indentation   +416 added lines, -416 removed lines patch added patch discarded remove patch
@@ -10,424 +10,424 @@
 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 user meta key where the deny entity edit flag is stored.
22
-	 *
23
-	 * @since 3.14.0
24
-	 */
25
-	const DENY_ENTITY_CREATE_META_KEY = '_wl_deny_entity_create';
26
-
27
-	/**
28
-	 * The meta key holding the entity id representing a {@link WP_User}.
29
-	 *
30
-	 * @since 3.14.0
31
-	 */
32
-	const ENTITY_META_KEY = '_wl_entity';
33
-
34
-	/**
35
-	 * The Log service.
36
-	 *
37
-	 * @since  3.1.7
38
-	 * @access private
39
-	 * @var \Wordlift_Log_Service $log_service The Log service.
40
-	 */
41
-	private $log_service;
42
-
43
-	/**
44
-	 * The singleton instance of the User service.
45
-	 *
46
-	 * @since  3.1.7
47
-	 * @access private
48
-	 * @var \Wordlift_User_Service $user_service The singleton instance of the User service.
49
-	 */
50
-	private static $instance;
51
-
52
-	/**
53
-	 * Create an instance of the User service.
54
-	 *
55
-	 * @since 3.1.7
56
-	 */
57
-	public function __construct() {
58
-
59
-		$this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_User_Service' );
60
-
61
-		self::$instance = $this;
62
-
63
-		add_filter( 'user_has_cap', array( $this, 'has_cap' ), 10, 3 );
64
-	}
65
-
66
-	/**
67
-	 * Get the singleton instance of the User service.
68
-	 *
69
-	 * @since 3.1.7
70
-	 * @return \Wordlift_User_Service The singleton instance of the User service.
71
-	 */
72
-	public static function get_instance() {
73
-
74
-		return self::$instance;
75
-	}
76
-
77
-	/**
78
-	 * Get the URI for a user.
79
-	 *
80
-	 * @since 3.1.7
81
-	 *
82
-	 * @param int $user_id The user id
83
-	 *
84
-	 * @return false|string The user's URI or false in case of failure.
85
-	 */
86
-	public function get_uri( $user_id ) {
87
-
88
-		// Try to get the URI stored in the user's meta and return it if available.
89
-		if ( false !== ( $user_uri = $this->_get_uri( $user_id ) ) ) {
90
-			return $user_uri;
91
-		}
92
-
93
-		// Try to build an URI, return false in case of failure.
94
-		if ( false === ( $user_uri = $this->_build_uri( $user_id ) ) ) {
95
-			return false;
96
-		}
97
-
98
-		// Store the URI for future requests (we need a "permanent" URI).
99
-		$this->_set_uri( $user_id, $user_uri );
100
-
101
-		return $user_uri;
102
-	}
103
-
104
-	/**
105
-	 * Receives wp_insert_post events.
106
-	 *
107
-	 * @since 3.1.7
108
-	 *
109
-	 * @param int     $post_id Post ID.
110
-	 * @param WP_Post $post    Post object.
111
-	 * @param bool    $update  Whether this is an existing post being updated or not.
112
-	 */
113
-	public function wp_insert_post( $post_id, $post, $update ) {
114
-
115
-		// If the post is not published, return.
116
-		if ( 'publish' !== get_post_status( $post_id ) ) {
117
-			return;
118
-		}
119
-
120
-		// We expect a numeric author id.
121
-		if ( ! is_numeric( $post->post_author ) ) {
122
-			return;
123
-		}
124
-
125
-		// Get the delete query,or return in case of failure.
126
-		if ( false === ( $delete = $this->get_delete_query( $post->post_author ) ) ) {
127
-			return;
128
-		}
129
-
130
-		// Get the insert query,or return in case of failure.
131
-		if ( false === ( $insert = $this->get_insert_query( $post->post_author ) ) ) {
132
-			return;
133
-		}
134
-
135
-		// Send the query to the triple store.
136
-		rl_execute_sparql_update_query( $delete . $insert );
137
-
138
-	}
139
-
140
-	/**
141
-	 * Set the `id` of the entity representing a {@link WP_User}.
142
-	 *
143
-	 * If the `id` is set to 0 (or less) then the meta is deleted.
144
-	 *
145
-	 * @since 3.14.0
146
-	 *
147
-	 * @param int $user_id The {@link WP_User}.
148
-	 * @param int $value   The entity {@link WP_Post} `id`.
149
-	 *
150
-	 * @return bool|int  Meta ID if the key didn't exist, true on successful update, false on failure.
151
-	 */
152
-	public function set_entity( $user_id, $value ) {
153
-
154
-		return 0 < $value
155
-			? update_user_meta( $user_id, self::ENTITY_META_KEY, $value )
156
-			: delete_user_meta( $user_id, self::ENTITY_META_KEY );
157
-	}
158
-
159
-	/**
160
-	 * Get the {@link WP_Post} `id` of the entity representing a {@link WP_User}.
161
-	 *
162
-	 * @since 3.14.0
163
-	 *
164
-	 * @param int $user_id The {@link WP_User}'s `id`.
165
-	 *
166
-	 * @return string The entity {@link WP_Post} `id` or an empty string if not set.
167
-	 */
168
-	public function get_entity( $user_id ) {
169
-
170
-		return get_user_meta( $user_id, self::ENTITY_META_KEY, true );
171
-	}
172
-
173
-	/**
174
-	 * Get the user's URI stored in the user's meta.
175
-	 *
176
-	 * @since 3.1.7
177
-	 *
178
-	 * @param int $user_id The user id.
179
-	 *
180
-	 * @return false|string The user's URI or false if not found.
181
-	 */
182
-	private function _get_uri( $user_id ) {
183
-
184
-		$user_uri = get_user_meta( $user_id, self::URI_META_KEY, true );
185
-
186
-		if ( empty( $user_uri ) ) {
187
-			return false;
188
-		}
189
-
190
-		return $user_uri;
191
-	}
192
-
193
-	/**
194
-	 * Build an URI for a user.
195
-	 *
196
-	 * @since 3.1.7
197
-	 *
198
-	 * @param int $user_id The user's id.
199
-	 *
200
-	 * @return false|string The user's URI or false in case of failure.
201
-	 */
202
-	private function _build_uri( $user_id ) {
203
-
204
-		// Get the user, return false in case of failure.
205
-		if ( false === ( $user = get_userdata( $user_id ) ) ) {
206
-			return false;
207
-		};
208
-
209
-		// If the nicename is not set, return a failure.
210
-		if ( empty( $user->user_nicename ) ) {
211
-			return false;
212
-		}
213
-
214
-		return wl_configuration_get_redlink_dataset_uri() . "/user/$user->user_nicename";
215
-	}
216
-
217
-	/**
218
-	 * Store the URI in user's meta.
219
-	 *
220
-	 * @since 3.1.7
221
-	 *
222
-	 * @param int    $user_id  The user's id.
223
-	 * @param string $user_uri The user's uri.
224
-	 *
225
-	 * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
226
-	 */
227
-	private function _set_uri( $user_id, $user_uri ) {
228
-
229
-		return update_user_meta( $user_id, self::URI_META_KEY, $user_uri );
230
-	}
231
-
232
-	/**
233
-	 * Get the delete query.
234
-	 *
235
-	 * @since 3.1.7
236
-	 *
237
-	 * @param int $user_id The user id.
238
-	 *
239
-	 * @return false|string The delete query or false in case of failure.
240
-	 */
241
-	private function get_delete_query( $user_id ) {
242
-
243
-		// Get the URI, return if there's none.
244
-		if ( false === ( $user_uri = $this->get_uri( $user_id ) ) ) {
245
-			return false;
246
-		}
247
-
248
-		// Build the delete query.
249
-		$query = Wordlift_Query_Builder::new_instance()->delete()
250
-		                               ->statement( $user_uri, Wordlift_Query_Builder::RDFS_TYPE_URI, '?o' )
251
-		                               ->build()
252
-		         . Wordlift_Query_Builder::new_instance()->delete()
253
-		                                 ->statement( $user_uri, Wordlift_Query_Builder::RDFS_LABEL_URI, '?o' )
254
-		                                 ->build()
255
-		         . Wordlift_Query_Builder::new_instance()->delete()
256
-		                                 ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_GIVEN_NAME_URI, '?o' )
257
-		                                 ->build()
258
-		         . Wordlift_Query_Builder::new_instance()->delete()
259
-		                                 ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_FAMILY_NAME_URI, '?o' )
260
-		                                 ->build()
261
-		         . Wordlift_Query_Builder::new_instance()->delete()
262
-		                                 ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_URL_URI, '?o' )
263
-		                                 ->build();
264
-
265
-		return $query;
266
-	}
267
-
268
-	/**
269
-	 * Get the insert query.
270
-	 *
271
-	 * @since 3.1.7
272
-	 *
273
-	 * @param int $user_id The user id.
274
-	 *
275
-	 * @return false|string The insert query or false in case of failure.
276
-	 */
277
-	private function get_insert_query( $user_id ) {
278
-
279
-		// Get the URI, return if there's none.
280
-		if ( false === ( $user_uri = $this->get_uri( $user_id ) ) ) {
281
-			return false;
282
-		}
283
-
284
-		// Try to get the user data, in case of failure return false.
285
-		if ( false === ( $user = get_userdata( $user_id ) ) ) {
286
-			return false;
287
-		};
288
-
289
-		// Build the insert query.
290
-		$query = Wordlift_Query_Builder::new_instance()
291
-		                               ->insert()
292
-		                               ->statement( $user_uri, Wordlift_Query_Builder::RDFS_TYPE_URI, Wordlift_Query_Builder::SCHEMA_PERSON_URI )
293
-		                               ->statement( $user_uri, Wordlift_Query_Builder::RDFS_LABEL_URI, $user->display_name )
294
-		                               ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_GIVEN_NAME_URI, $user->user_firstname )
295
-		                               ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_FAMILY_NAME_URI, $user->user_lastname )
296
-		                               ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_URL_URI, ( ! empty( $user->user_url ) ? $user->user_url : get_author_posts_url( $user_id ) ) )
297
-		                               ->build();
298
-
299
-		return $query;
300
-	}
301
-
302
-	/**
303
-	 * Mark an editor user as denied from editing entities.
304
-	 * Does nothing if the user is not an editor
305
-	 *
306
-	 * @since 3.14.0
307
-	 *
308
-	 * @param integer $user_id The ID of the user
309
-	 */
310
-	public function deny_editor_entity_create( $user_id ) {
311
-
312
-		// Bail out if the user is not an editor.
313
-		if ( ! $this->is_editor( $user_id ) ) {
314
-			return;
315
-		}
316
-
317
-		// The user explicitly do not have the capability.
318
-		update_user_meta( $user_id, self::DENY_ENTITY_CREATE_META_KEY, 'yes' );
319
-
320
-	}
321
-
322
-	/**
323
-	 * Remove the "deny entity editing" mark from an editor user.
324
-	 * Does nothing if the user is not an editor
325
-	 *
326
-	 * @since 3.14.0
327
-	 *
328
-	 * @param integer $user_id The ID of the user
329
-	 */
330
-	public function allow_editor_entity_create( $user_id ) {
331
-
332
-		// Bail out if the user is not an editor.
333
-		if ( ! $this->is_editor( $user_id ) ) {
334
-			return;
335
-		}
336
-
337
-		// The user explicitly do not have the capability.
338
-		delete_user_meta( $user_id, self::DENY_ENTITY_CREATE_META_KEY );
339
-
340
-	}
341
-
342
-	/**
343
-	 * Get whether the 'deny editor entity editing' flag is set.
344
-	 *
345
-	 * @since 3.14.0
346
-	 *
347
-	 * @param int $user_id The {@link WP_User} `id`.
348
-	 *
349
-	 * @return int bool True if editing is denied otherwise false.
350
-	 */
351
-	public function is_deny_editor_entity_create( $user_id ) {
352
-
353
-		return 'yes' === get_user_meta( $user_id, self::DENY_ENTITY_CREATE_META_KEY, true );
354
-	}
355
-
356
-	/**
357
-	 * Check whether the {@link WP_User} with the specified `id` is an editor,
358
-	 * i.e. has the `editor` role.
359
-	 *
360
-	 * @since 3.14.0
361
-	 *
362
-	 * @param int $user_id The {@link WP_User} `id`.
363
-	 *
364
-	 * @return bool True if the {@link WP_User} is an editor otherwise false.
365
-	 */
366
-	public function is_editor( $user_id ) {
367
-
368
-		// Get the user.
369
-		$user = get_user_by( 'id', $user_id );
370
-
371
-		// Return true, if the user is found and has the `editor` role.
372
-		return is_a( $user, 'WP_User' ) && in_array( 'editor', (array) $user->roles );
373
-	}
374
-
375
-	/**
376
-	 * Check if an editor can create entities.
377
-	 *
378
-	 * @since 3.14.0
379
-	 *
380
-	 * @param int $user_id The user id of the user being checked.
381
-	 *
382
-	 * @return bool    false if it is an editor that is denied from edit entities, true otherwise.
383
-	 */
384
-	public function editor_can_create_entities( $user_id ) {
385
-
386
-		// Return true if not an editor.
387
-		if ( ! $this->is_editor( $user_id ) ) {
388
-			return true;
389
-		}
390
-
391
-		// Check if the user explicitly denied.
392
-		return ! $this->is_deny_editor_entity_create( $user_id );
393
-	}
394
-
395
-	/**
396
-	 * Filter capabilities of user.
397
-	 *
398
-	 * Deny the capability of managing and editing entities for some users.
399
-	 *
400
-	 * @since 3.14.0
401
-	 *
402
-	 * @param array $allcaps All the capabilities of the user
403
-	 * @param array $cap     [0] Required capability
404
-	 * @param array $args    [0] Requested capability
405
-	 *                       [1] User ID
406
-	 *                       [2] Associated object ID
407
-	 *
408
-	 * @return array The capabilities array.
409
-	 */
410
-	public function has_cap( $allcaps, $cap, $args ) {
411
-		/*
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 user meta key where the deny entity edit flag is stored.
22
+     *
23
+     * @since 3.14.0
24
+     */
25
+    const DENY_ENTITY_CREATE_META_KEY = '_wl_deny_entity_create';
26
+
27
+    /**
28
+     * The meta key holding the entity id representing a {@link WP_User}.
29
+     *
30
+     * @since 3.14.0
31
+     */
32
+    const ENTITY_META_KEY = '_wl_entity';
33
+
34
+    /**
35
+     * The Log service.
36
+     *
37
+     * @since  3.1.7
38
+     * @access private
39
+     * @var \Wordlift_Log_Service $log_service The Log service.
40
+     */
41
+    private $log_service;
42
+
43
+    /**
44
+     * The singleton instance of the User service.
45
+     *
46
+     * @since  3.1.7
47
+     * @access private
48
+     * @var \Wordlift_User_Service $user_service The singleton instance of the User service.
49
+     */
50
+    private static $instance;
51
+
52
+    /**
53
+     * Create an instance of the User service.
54
+     *
55
+     * @since 3.1.7
56
+     */
57
+    public function __construct() {
58
+
59
+        $this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_User_Service' );
60
+
61
+        self::$instance = $this;
62
+
63
+        add_filter( 'user_has_cap', array( $this, 'has_cap' ), 10, 3 );
64
+    }
65
+
66
+    /**
67
+     * Get the singleton instance of the User service.
68
+     *
69
+     * @since 3.1.7
70
+     * @return \Wordlift_User_Service The singleton instance of the User service.
71
+     */
72
+    public static function get_instance() {
73
+
74
+        return self::$instance;
75
+    }
76
+
77
+    /**
78
+     * Get the URI for a user.
79
+     *
80
+     * @since 3.1.7
81
+     *
82
+     * @param int $user_id The user id
83
+     *
84
+     * @return false|string The user's URI or false in case of failure.
85
+     */
86
+    public function get_uri( $user_id ) {
87
+
88
+        // Try to get the URI stored in the user's meta and return it if available.
89
+        if ( false !== ( $user_uri = $this->_get_uri( $user_id ) ) ) {
90
+            return $user_uri;
91
+        }
92
+
93
+        // Try to build an URI, return false in case of failure.
94
+        if ( false === ( $user_uri = $this->_build_uri( $user_id ) ) ) {
95
+            return false;
96
+        }
97
+
98
+        // Store the URI for future requests (we need a "permanent" URI).
99
+        $this->_set_uri( $user_id, $user_uri );
100
+
101
+        return $user_uri;
102
+    }
103
+
104
+    /**
105
+     * Receives wp_insert_post events.
106
+     *
107
+     * @since 3.1.7
108
+     *
109
+     * @param int     $post_id Post ID.
110
+     * @param WP_Post $post    Post object.
111
+     * @param bool    $update  Whether this is an existing post being updated or not.
112
+     */
113
+    public function wp_insert_post( $post_id, $post, $update ) {
114
+
115
+        // If the post is not published, return.
116
+        if ( 'publish' !== get_post_status( $post_id ) ) {
117
+            return;
118
+        }
119
+
120
+        // We expect a numeric author id.
121
+        if ( ! is_numeric( $post->post_author ) ) {
122
+            return;
123
+        }
124
+
125
+        // Get the delete query,or return in case of failure.
126
+        if ( false === ( $delete = $this->get_delete_query( $post->post_author ) ) ) {
127
+            return;
128
+        }
129
+
130
+        // Get the insert query,or return in case of failure.
131
+        if ( false === ( $insert = $this->get_insert_query( $post->post_author ) ) ) {
132
+            return;
133
+        }
134
+
135
+        // Send the query to the triple store.
136
+        rl_execute_sparql_update_query( $delete . $insert );
137
+
138
+    }
139
+
140
+    /**
141
+     * Set the `id` of the entity representing a {@link WP_User}.
142
+     *
143
+     * If the `id` is set to 0 (or less) then the meta is deleted.
144
+     *
145
+     * @since 3.14.0
146
+     *
147
+     * @param int $user_id The {@link WP_User}.
148
+     * @param int $value   The entity {@link WP_Post} `id`.
149
+     *
150
+     * @return bool|int  Meta ID if the key didn't exist, true on successful update, false on failure.
151
+     */
152
+    public function set_entity( $user_id, $value ) {
153
+
154
+        return 0 < $value
155
+            ? update_user_meta( $user_id, self::ENTITY_META_KEY, $value )
156
+            : delete_user_meta( $user_id, self::ENTITY_META_KEY );
157
+    }
158
+
159
+    /**
160
+     * Get the {@link WP_Post} `id` of the entity representing a {@link WP_User}.
161
+     *
162
+     * @since 3.14.0
163
+     *
164
+     * @param int $user_id The {@link WP_User}'s `id`.
165
+     *
166
+     * @return string The entity {@link WP_Post} `id` or an empty string if not set.
167
+     */
168
+    public function get_entity( $user_id ) {
169
+
170
+        return get_user_meta( $user_id, self::ENTITY_META_KEY, true );
171
+    }
172
+
173
+    /**
174
+     * Get the user's URI stored in the user's meta.
175
+     *
176
+     * @since 3.1.7
177
+     *
178
+     * @param int $user_id The user id.
179
+     *
180
+     * @return false|string The user's URI or false if not found.
181
+     */
182
+    private function _get_uri( $user_id ) {
183
+
184
+        $user_uri = get_user_meta( $user_id, self::URI_META_KEY, true );
185
+
186
+        if ( empty( $user_uri ) ) {
187
+            return false;
188
+        }
189
+
190
+        return $user_uri;
191
+    }
192
+
193
+    /**
194
+     * Build an URI for a user.
195
+     *
196
+     * @since 3.1.7
197
+     *
198
+     * @param int $user_id The user's id.
199
+     *
200
+     * @return false|string The user's URI or false in case of failure.
201
+     */
202
+    private function _build_uri( $user_id ) {
203
+
204
+        // Get the user, return false in case of failure.
205
+        if ( false === ( $user = get_userdata( $user_id ) ) ) {
206
+            return false;
207
+        };
208
+
209
+        // If the nicename is not set, return a failure.
210
+        if ( empty( $user->user_nicename ) ) {
211
+            return false;
212
+        }
213
+
214
+        return wl_configuration_get_redlink_dataset_uri() . "/user/$user->user_nicename";
215
+    }
216
+
217
+    /**
218
+     * Store the URI in user's meta.
219
+     *
220
+     * @since 3.1.7
221
+     *
222
+     * @param int    $user_id  The user's id.
223
+     * @param string $user_uri The user's uri.
224
+     *
225
+     * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
226
+     */
227
+    private function _set_uri( $user_id, $user_uri ) {
228
+
229
+        return update_user_meta( $user_id, self::URI_META_KEY, $user_uri );
230
+    }
231
+
232
+    /**
233
+     * Get the delete query.
234
+     *
235
+     * @since 3.1.7
236
+     *
237
+     * @param int $user_id The user id.
238
+     *
239
+     * @return false|string The delete query or false in case of failure.
240
+     */
241
+    private function get_delete_query( $user_id ) {
242
+
243
+        // Get the URI, return if there's none.
244
+        if ( false === ( $user_uri = $this->get_uri( $user_id ) ) ) {
245
+            return false;
246
+        }
247
+
248
+        // Build the delete query.
249
+        $query = Wordlift_Query_Builder::new_instance()->delete()
250
+                                        ->statement( $user_uri, Wordlift_Query_Builder::RDFS_TYPE_URI, '?o' )
251
+                                        ->build()
252
+                    . Wordlift_Query_Builder::new_instance()->delete()
253
+                                            ->statement( $user_uri, Wordlift_Query_Builder::RDFS_LABEL_URI, '?o' )
254
+                                            ->build()
255
+                    . Wordlift_Query_Builder::new_instance()->delete()
256
+                                            ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_GIVEN_NAME_URI, '?o' )
257
+                                            ->build()
258
+                    . Wordlift_Query_Builder::new_instance()->delete()
259
+                                            ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_FAMILY_NAME_URI, '?o' )
260
+                                            ->build()
261
+                    . Wordlift_Query_Builder::new_instance()->delete()
262
+                                            ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_URL_URI, '?o' )
263
+                                            ->build();
264
+
265
+        return $query;
266
+    }
267
+
268
+    /**
269
+     * Get the insert query.
270
+     *
271
+     * @since 3.1.7
272
+     *
273
+     * @param int $user_id The user id.
274
+     *
275
+     * @return false|string The insert query or false in case of failure.
276
+     */
277
+    private function get_insert_query( $user_id ) {
278
+
279
+        // Get the URI, return if there's none.
280
+        if ( false === ( $user_uri = $this->get_uri( $user_id ) ) ) {
281
+            return false;
282
+        }
283
+
284
+        // Try to get the user data, in case of failure return false.
285
+        if ( false === ( $user = get_userdata( $user_id ) ) ) {
286
+            return false;
287
+        };
288
+
289
+        // Build the insert query.
290
+        $query = Wordlift_Query_Builder::new_instance()
291
+                                        ->insert()
292
+                                        ->statement( $user_uri, Wordlift_Query_Builder::RDFS_TYPE_URI, Wordlift_Query_Builder::SCHEMA_PERSON_URI )
293
+                                        ->statement( $user_uri, Wordlift_Query_Builder::RDFS_LABEL_URI, $user->display_name )
294
+                                        ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_GIVEN_NAME_URI, $user->user_firstname )
295
+                                        ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_FAMILY_NAME_URI, $user->user_lastname )
296
+                                        ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_URL_URI, ( ! empty( $user->user_url ) ? $user->user_url : get_author_posts_url( $user_id ) ) )
297
+                                        ->build();
298
+
299
+        return $query;
300
+    }
301
+
302
+    /**
303
+     * Mark an editor user as denied from editing entities.
304
+     * Does nothing if the user is not an editor
305
+     *
306
+     * @since 3.14.0
307
+     *
308
+     * @param integer $user_id The ID of the user
309
+     */
310
+    public function deny_editor_entity_create( $user_id ) {
311
+
312
+        // Bail out if the user is not an editor.
313
+        if ( ! $this->is_editor( $user_id ) ) {
314
+            return;
315
+        }
316
+
317
+        // The user explicitly do not have the capability.
318
+        update_user_meta( $user_id, self::DENY_ENTITY_CREATE_META_KEY, 'yes' );
319
+
320
+    }
321
+
322
+    /**
323
+     * Remove the "deny entity editing" mark from an editor user.
324
+     * Does nothing if the user is not an editor
325
+     *
326
+     * @since 3.14.0
327
+     *
328
+     * @param integer $user_id The ID of the user
329
+     */
330
+    public function allow_editor_entity_create( $user_id ) {
331
+
332
+        // Bail out if the user is not an editor.
333
+        if ( ! $this->is_editor( $user_id ) ) {
334
+            return;
335
+        }
336
+
337
+        // The user explicitly do not have the capability.
338
+        delete_user_meta( $user_id, self::DENY_ENTITY_CREATE_META_KEY );
339
+
340
+    }
341
+
342
+    /**
343
+     * Get whether the 'deny editor entity editing' flag is set.
344
+     *
345
+     * @since 3.14.0
346
+     *
347
+     * @param int $user_id The {@link WP_User} `id`.
348
+     *
349
+     * @return int bool True if editing is denied otherwise false.
350
+     */
351
+    public function is_deny_editor_entity_create( $user_id ) {
352
+
353
+        return 'yes' === get_user_meta( $user_id, self::DENY_ENTITY_CREATE_META_KEY, true );
354
+    }
355
+
356
+    /**
357
+     * Check whether the {@link WP_User} with the specified `id` is an editor,
358
+     * i.e. has the `editor` role.
359
+     *
360
+     * @since 3.14.0
361
+     *
362
+     * @param int $user_id The {@link WP_User} `id`.
363
+     *
364
+     * @return bool True if the {@link WP_User} is an editor otherwise false.
365
+     */
366
+    public function is_editor( $user_id ) {
367
+
368
+        // Get the user.
369
+        $user = get_user_by( 'id', $user_id );
370
+
371
+        // Return true, if the user is found and has the `editor` role.
372
+        return is_a( $user, 'WP_User' ) && in_array( 'editor', (array) $user->roles );
373
+    }
374
+
375
+    /**
376
+     * Check if an editor can create entities.
377
+     *
378
+     * @since 3.14.0
379
+     *
380
+     * @param int $user_id The user id of the user being checked.
381
+     *
382
+     * @return bool    false if it is an editor that is denied from edit entities, true otherwise.
383
+     */
384
+    public function editor_can_create_entities( $user_id ) {
385
+
386
+        // Return true if not an editor.
387
+        if ( ! $this->is_editor( $user_id ) ) {
388
+            return true;
389
+        }
390
+
391
+        // Check if the user explicitly denied.
392
+        return ! $this->is_deny_editor_entity_create( $user_id );
393
+    }
394
+
395
+    /**
396
+     * Filter capabilities of user.
397
+     *
398
+     * Deny the capability of managing and editing entities for some users.
399
+     *
400
+     * @since 3.14.0
401
+     *
402
+     * @param array $allcaps All the capabilities of the user
403
+     * @param array $cap     [0] Required capability
404
+     * @param array $args    [0] Requested capability
405
+     *                       [1] User ID
406
+     *                       [2] Associated object ID
407
+     *
408
+     * @return array The capabilities array.
409
+     */
410
+    public function has_cap( $allcaps, $cap, $args ) {
411
+        /*
412 412
 		 * For entity management/editing related capabilities
413 413
 		 * check that an editor was not explicitly denied (in user profile)
414 414
 		 * the capability.
415 415
 		 */
416
-		if (
417
-			( 'edit_wordlift_entity' == $cap[0] ) ||
418
-			( 'edit_wordlift_entities' == $cap[0] ) ||
419
-			( 'edit_others_wordlift_entities' == $cap[0] ) ||
420
-			( 'publish_wordlift_entities' == $cap[0] ) ||
421
-			( 'read_private_wordlift_entities' == $cap[0] ) ||
422
-			( 'delete_wordlift_entity' == $cap[0] )
423
-		) {
424
-			$user_id = $args[1];
425
-
426
-			if ( ! $this->editor_can_create_entities( $user_id ) ) {
427
-				$allcaps[ $cap[0] ] = false;
428
-			}
429
-		}
430
-
431
-		return $allcaps;
432
-	}
416
+        if (
417
+            ( 'edit_wordlift_entity' == $cap[0] ) ||
418
+            ( 'edit_wordlift_entities' == $cap[0] ) ||
419
+            ( 'edit_others_wordlift_entities' == $cap[0] ) ||
420
+            ( 'publish_wordlift_entities' == $cap[0] ) ||
421
+            ( 'read_private_wordlift_entities' == $cap[0] ) ||
422
+            ( 'delete_wordlift_entity' == $cap[0] )
423
+        ) {
424
+            $user_id = $args[1];
425
+
426
+            if ( ! $this->editor_can_create_entities( $user_id ) ) {
427
+                $allcaps[ $cap[0] ] = false;
428
+            }
429
+        }
430
+
431
+        return $allcaps;
432
+    }
433 433
 }
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -56,11 +56,11 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	public function __construct() {
58 58
 
59
-		$this->log_service = Wordlift_Log_Service::get_logger( 'Wordlift_User_Service' );
59
+		$this->log_service = Wordlift_Log_Service::get_logger('Wordlift_User_Service');
60 60
 
61 61
 		self::$instance = $this;
62 62
 
63
-		add_filter( 'user_has_cap', array( $this, 'has_cap' ), 10, 3 );
63
+		add_filter('user_has_cap', array($this, 'has_cap'), 10, 3);
64 64
 	}
65 65
 
66 66
 	/**
@@ -83,20 +83,20 @@  discard block
 block discarded – undo
83 83
 	 *
84 84
 	 * @return false|string The user's URI or false in case of failure.
85 85
 	 */
86
-	public function get_uri( $user_id ) {
86
+	public function get_uri($user_id) {
87 87
 
88 88
 		// Try to get the URI stored in the user's meta and return it if available.
89
-		if ( false !== ( $user_uri = $this->_get_uri( $user_id ) ) ) {
89
+		if (false !== ($user_uri = $this->_get_uri($user_id))) {
90 90
 			return $user_uri;
91 91
 		}
92 92
 
93 93
 		// Try to build an URI, return false in case of failure.
94
-		if ( false === ( $user_uri = $this->_build_uri( $user_id ) ) ) {
94
+		if (false === ($user_uri = $this->_build_uri($user_id))) {
95 95
 			return false;
96 96
 		}
97 97
 
98 98
 		// Store the URI for future requests (we need a "permanent" URI).
99
-		$this->_set_uri( $user_id, $user_uri );
99
+		$this->_set_uri($user_id, $user_uri);
100 100
 
101 101
 		return $user_uri;
102 102
 	}
@@ -110,30 +110,30 @@  discard block
 block discarded – undo
110 110
 	 * @param WP_Post $post    Post object.
111 111
 	 * @param bool    $update  Whether this is an existing post being updated or not.
112 112
 	 */
113
-	public function wp_insert_post( $post_id, $post, $update ) {
113
+	public function wp_insert_post($post_id, $post, $update) {
114 114
 
115 115
 		// If the post is not published, return.
116
-		if ( 'publish' !== get_post_status( $post_id ) ) {
116
+		if ('publish' !== get_post_status($post_id)) {
117 117
 			return;
118 118
 		}
119 119
 
120 120
 		// We expect a numeric author id.
121
-		if ( ! is_numeric( $post->post_author ) ) {
121
+		if ( ! is_numeric($post->post_author)) {
122 122
 			return;
123 123
 		}
124 124
 
125 125
 		// Get the delete query,or return in case of failure.
126
-		if ( false === ( $delete = $this->get_delete_query( $post->post_author ) ) ) {
126
+		if (false === ($delete = $this->get_delete_query($post->post_author))) {
127 127
 			return;
128 128
 		}
129 129
 
130 130
 		// Get the insert query,or return in case of failure.
131
-		if ( false === ( $insert = $this->get_insert_query( $post->post_author ) ) ) {
131
+		if (false === ($insert = $this->get_insert_query($post->post_author))) {
132 132
 			return;
133 133
 		}
134 134
 
135 135
 		// Send the query to the triple store.
136
-		rl_execute_sparql_update_query( $delete . $insert );
136
+		rl_execute_sparql_update_query($delete.$insert);
137 137
 
138 138
 	}
139 139
 
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
 	 *
150 150
 	 * @return bool|int  Meta ID if the key didn't exist, true on successful update, false on failure.
151 151
 	 */
152
-	public function set_entity( $user_id, $value ) {
152
+	public function set_entity($user_id, $value) {
153 153
 
154 154
 		return 0 < $value
155
-			? update_user_meta( $user_id, self::ENTITY_META_KEY, $value )
156
-			: delete_user_meta( $user_id, self::ENTITY_META_KEY );
155
+			? update_user_meta($user_id, self::ENTITY_META_KEY, $value)
156
+			: delete_user_meta($user_id, self::ENTITY_META_KEY);
157 157
 	}
158 158
 
159 159
 	/**
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 	 *
166 166
 	 * @return string The entity {@link WP_Post} `id` or an empty string if not set.
167 167
 	 */
168
-	public function get_entity( $user_id ) {
168
+	public function get_entity($user_id) {
169 169
 
170
-		return get_user_meta( $user_id, self::ENTITY_META_KEY, true );
170
+		return get_user_meta($user_id, self::ENTITY_META_KEY, true);
171 171
 	}
172 172
 
173 173
 	/**
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
 	 *
180 180
 	 * @return false|string The user's URI or false if not found.
181 181
 	 */
182
-	private function _get_uri( $user_id ) {
182
+	private function _get_uri($user_id) {
183 183
 
184
-		$user_uri = get_user_meta( $user_id, self::URI_META_KEY, true );
184
+		$user_uri = get_user_meta($user_id, self::URI_META_KEY, true);
185 185
 
186
-		if ( empty( $user_uri ) ) {
186
+		if (empty($user_uri)) {
187 187
 			return false;
188 188
 		}
189 189
 
@@ -199,19 +199,19 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return false|string The user's URI or false in case of failure.
201 201
 	 */
202
-	private function _build_uri( $user_id ) {
202
+	private function _build_uri($user_id) {
203 203
 
204 204
 		// Get the user, return false in case of failure.
205
-		if ( false === ( $user = get_userdata( $user_id ) ) ) {
205
+		if (false === ($user = get_userdata($user_id))) {
206 206
 			return false;
207 207
 		};
208 208
 
209 209
 		// If the nicename is not set, return a failure.
210
-		if ( empty( $user->user_nicename ) ) {
210
+		if (empty($user->user_nicename)) {
211 211
 			return false;
212 212
 		}
213 213
 
214
-		return wl_configuration_get_redlink_dataset_uri() . "/user/$user->user_nicename";
214
+		return wl_configuration_get_redlink_dataset_uri()."/user/$user->user_nicename";
215 215
 	}
216 216
 
217 217
 	/**
@@ -224,9 +224,9 @@  discard block
 block discarded – undo
224 224
 	 *
225 225
 	 * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
226 226
 	 */
227
-	private function _set_uri( $user_id, $user_uri ) {
227
+	private function _set_uri($user_id, $user_uri) {
228 228
 
229
-		return update_user_meta( $user_id, self::URI_META_KEY, $user_uri );
229
+		return update_user_meta($user_id, self::URI_META_KEY, $user_uri);
230 230
 	}
231 231
 
232 232
 	/**
@@ -238,28 +238,28 @@  discard block
 block discarded – undo
238 238
 	 *
239 239
 	 * @return false|string The delete query or false in case of failure.
240 240
 	 */
241
-	private function get_delete_query( $user_id ) {
241
+	private function get_delete_query($user_id) {
242 242
 
243 243
 		// Get the URI, return if there's none.
244
-		if ( false === ( $user_uri = $this->get_uri( $user_id ) ) ) {
244
+		if (false === ($user_uri = $this->get_uri($user_id))) {
245 245
 			return false;
246 246
 		}
247 247
 
248 248
 		// Build the delete query.
249 249
 		$query = Wordlift_Query_Builder::new_instance()->delete()
250
-		                               ->statement( $user_uri, Wordlift_Query_Builder::RDFS_TYPE_URI, '?o' )
250
+		                               ->statement($user_uri, Wordlift_Query_Builder::RDFS_TYPE_URI, '?o')
251 251
 		                               ->build()
252 252
 		         . Wordlift_Query_Builder::new_instance()->delete()
253
-		                                 ->statement( $user_uri, Wordlift_Query_Builder::RDFS_LABEL_URI, '?o' )
253
+		                                 ->statement($user_uri, Wordlift_Query_Builder::RDFS_LABEL_URI, '?o')
254 254
 		                                 ->build()
255 255
 		         . Wordlift_Query_Builder::new_instance()->delete()
256
-		                                 ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_GIVEN_NAME_URI, '?o' )
256
+		                                 ->statement($user_uri, Wordlift_Query_Builder::SCHEMA_GIVEN_NAME_URI, '?o')
257 257
 		                                 ->build()
258 258
 		         . Wordlift_Query_Builder::new_instance()->delete()
259
-		                                 ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_FAMILY_NAME_URI, '?o' )
259
+		                                 ->statement($user_uri, Wordlift_Query_Builder::SCHEMA_FAMILY_NAME_URI, '?o')
260 260
 		                                 ->build()
261 261
 		         . Wordlift_Query_Builder::new_instance()->delete()
262
-		                                 ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_URL_URI, '?o' )
262
+		                                 ->statement($user_uri, Wordlift_Query_Builder::SCHEMA_URL_URI, '?o')
263 263
 		                                 ->build();
264 264
 
265 265
 		return $query;
@@ -274,26 +274,26 @@  discard block
 block discarded – undo
274 274
 	 *
275 275
 	 * @return false|string The insert query or false in case of failure.
276 276
 	 */
277
-	private function get_insert_query( $user_id ) {
277
+	private function get_insert_query($user_id) {
278 278
 
279 279
 		// Get the URI, return if there's none.
280
-		if ( false === ( $user_uri = $this->get_uri( $user_id ) ) ) {
280
+		if (false === ($user_uri = $this->get_uri($user_id))) {
281 281
 			return false;
282 282
 		}
283 283
 
284 284
 		// Try to get the user data, in case of failure return false.
285
-		if ( false === ( $user = get_userdata( $user_id ) ) ) {
285
+		if (false === ($user = get_userdata($user_id))) {
286 286
 			return false;
287 287
 		};
288 288
 
289 289
 		// Build the insert query.
290 290
 		$query = Wordlift_Query_Builder::new_instance()
291 291
 		                               ->insert()
292
-		                               ->statement( $user_uri, Wordlift_Query_Builder::RDFS_TYPE_URI, Wordlift_Query_Builder::SCHEMA_PERSON_URI )
293
-		                               ->statement( $user_uri, Wordlift_Query_Builder::RDFS_LABEL_URI, $user->display_name )
294
-		                               ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_GIVEN_NAME_URI, $user->user_firstname )
295
-		                               ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_FAMILY_NAME_URI, $user->user_lastname )
296
-		                               ->statement( $user_uri, Wordlift_Query_Builder::SCHEMA_URL_URI, ( ! empty( $user->user_url ) ? $user->user_url : get_author_posts_url( $user_id ) ) )
292
+		                               ->statement($user_uri, Wordlift_Query_Builder::RDFS_TYPE_URI, Wordlift_Query_Builder::SCHEMA_PERSON_URI)
293
+		                               ->statement($user_uri, Wordlift_Query_Builder::RDFS_LABEL_URI, $user->display_name)
294
+		                               ->statement($user_uri, Wordlift_Query_Builder::SCHEMA_GIVEN_NAME_URI, $user->user_firstname)
295
+		                               ->statement($user_uri, Wordlift_Query_Builder::SCHEMA_FAMILY_NAME_URI, $user->user_lastname)
296
+		                               ->statement($user_uri, Wordlift_Query_Builder::SCHEMA_URL_URI, ( ! empty($user->user_url) ? $user->user_url : get_author_posts_url($user_id)))
297 297
 		                               ->build();
298 298
 
299 299
 		return $query;
@@ -307,15 +307,15 @@  discard block
 block discarded – undo
307 307
 	 *
308 308
 	 * @param integer $user_id The ID of the user
309 309
 	 */
310
-	public function deny_editor_entity_create( $user_id ) {
310
+	public function deny_editor_entity_create($user_id) {
311 311
 
312 312
 		// Bail out if the user is not an editor.
313
-		if ( ! $this->is_editor( $user_id ) ) {
313
+		if ( ! $this->is_editor($user_id)) {
314 314
 			return;
315 315
 		}
316 316
 
317 317
 		// The user explicitly do not have the capability.
318
-		update_user_meta( $user_id, self::DENY_ENTITY_CREATE_META_KEY, 'yes' );
318
+		update_user_meta($user_id, self::DENY_ENTITY_CREATE_META_KEY, 'yes');
319 319
 
320 320
 	}
321 321
 
@@ -327,15 +327,15 @@  discard block
 block discarded – undo
327 327
 	 *
328 328
 	 * @param integer $user_id The ID of the user
329 329
 	 */
330
-	public function allow_editor_entity_create( $user_id ) {
330
+	public function allow_editor_entity_create($user_id) {
331 331
 
332 332
 		// Bail out if the user is not an editor.
333
-		if ( ! $this->is_editor( $user_id ) ) {
333
+		if ( ! $this->is_editor($user_id)) {
334 334
 			return;
335 335
 		}
336 336
 
337 337
 		// The user explicitly do not have the capability.
338
-		delete_user_meta( $user_id, self::DENY_ENTITY_CREATE_META_KEY );
338
+		delete_user_meta($user_id, self::DENY_ENTITY_CREATE_META_KEY);
339 339
 
340 340
 	}
341 341
 
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
 	 *
349 349
 	 * @return int bool True if editing is denied otherwise false.
350 350
 	 */
351
-	public function is_deny_editor_entity_create( $user_id ) {
351
+	public function is_deny_editor_entity_create($user_id) {
352 352
 
353
-		return 'yes' === get_user_meta( $user_id, self::DENY_ENTITY_CREATE_META_KEY, true );
353
+		return 'yes' === get_user_meta($user_id, self::DENY_ENTITY_CREATE_META_KEY, true);
354 354
 	}
355 355
 
356 356
 	/**
@@ -363,13 +363,13 @@  discard block
 block discarded – undo
363 363
 	 *
364 364
 	 * @return bool True if the {@link WP_User} is an editor otherwise false.
365 365
 	 */
366
-	public function is_editor( $user_id ) {
366
+	public function is_editor($user_id) {
367 367
 
368 368
 		// Get the user.
369
-		$user = get_user_by( 'id', $user_id );
369
+		$user = get_user_by('id', $user_id);
370 370
 
371 371
 		// Return true, if the user is found and has the `editor` role.
372
-		return is_a( $user, 'WP_User' ) && in_array( 'editor', (array) $user->roles );
372
+		return is_a($user, 'WP_User') && in_array('editor', (array) $user->roles);
373 373
 	}
374 374
 
375 375
 	/**
@@ -381,15 +381,15 @@  discard block
 block discarded – undo
381 381
 	 *
382 382
 	 * @return bool    false if it is an editor that is denied from edit entities, true otherwise.
383 383
 	 */
384
-	public function editor_can_create_entities( $user_id ) {
384
+	public function editor_can_create_entities($user_id) {
385 385
 
386 386
 		// Return true if not an editor.
387
-		if ( ! $this->is_editor( $user_id ) ) {
387
+		if ( ! $this->is_editor($user_id)) {
388 388
 			return true;
389 389
 		}
390 390
 
391 391
 		// Check if the user explicitly denied.
392
-		return ! $this->is_deny_editor_entity_create( $user_id );
392
+		return ! $this->is_deny_editor_entity_create($user_id);
393 393
 	}
394 394
 
395 395
 	/**
@@ -407,24 +407,24 @@  discard block
 block discarded – undo
407 407
 	 *
408 408
 	 * @return array The capabilities array.
409 409
 	 */
410
-	public function has_cap( $allcaps, $cap, $args ) {
410
+	public function has_cap($allcaps, $cap, $args) {
411 411
 		/*
412 412
 		 * For entity management/editing related capabilities
413 413
 		 * check that an editor was not explicitly denied (in user profile)
414 414
 		 * the capability.
415 415
 		 */
416 416
 		if (
417
-			( 'edit_wordlift_entity' == $cap[0] ) ||
418
-			( 'edit_wordlift_entities' == $cap[0] ) ||
419
-			( 'edit_others_wordlift_entities' == $cap[0] ) ||
420
-			( 'publish_wordlift_entities' == $cap[0] ) ||
421
-			( 'read_private_wordlift_entities' == $cap[0] ) ||
422
-			( 'delete_wordlift_entity' == $cap[0] )
417
+			('edit_wordlift_entity' == $cap[0]) ||
418
+			('edit_wordlift_entities' == $cap[0]) ||
419
+			('edit_others_wordlift_entities' == $cap[0]) ||
420
+			('publish_wordlift_entities' == $cap[0]) ||
421
+			('read_private_wordlift_entities' == $cap[0]) ||
422
+			('delete_wordlift_entity' == $cap[0])
423 423
 		) {
424 424
 			$user_id = $args[1];
425 425
 
426
-			if ( ! $this->editor_can_create_entities( $user_id ) ) {
427
-				$allcaps[ $cap[0] ] = false;
426
+			if ( ! $this->editor_can_create_entities($user_id)) {
427
+				$allcaps[$cap[0]] = false;
428 428
 			}
429 429
 		}
430 430
 
Please login to merge, or discard this patch.
src/modules/core/wordlift_core_install.php 2 patches
Indentation   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -11,95 +11,95 @@  discard block
 block discarded – undo
11 11
  */
12 12
 function wl_core_install_entity_type_data() {
13 13
 
14
-	// Ensure the custom type and the taxonomy are registered.
15
-	Wordlift_Entity_Post_Type_Service::get_instance()->register();
16
-
17
-	wl_entity_type_taxonomy_register();
18
-
19
-	// Ensure the custom taxonomy for dbpedia topics is registered
20
-	Wordlift_Topic_Taxonomy_Service::get_instance()->init();
21
-
22
-	// Set the taxonomy data.
23
-	// Note: parent types must be defined before child types.
24
-	$terms = array(
25
-		'thing'         => array(
26
-			'label'       => 'Thing',
27
-			'description' => 'A generic thing (something that doesn\'t fit in the previous definitions.',
28
-		),
29
-		'creative-work' => array(
30
-			'label'       => 'CreativeWork',
31
-			'description' => 'A creative work (or a Music Album).',
32
-		),
33
-		'event'         => array(
34
-			'label'       => 'Event',
35
-			'description' => 'An event.',
36
-		),
37
-		'organization'  => array(
38
-			'label'       => 'Organization',
39
-			'description' => 'An organization, including a government or a newspaper.',
40
-		),
41
-		'person'        => array(
42
-			'label'       => 'Person',
43
-			'description' => 'A person (or a music artist).',
44
-		),
45
-		'place'         => array(
46
-			'label'       => 'Place',
47
-			'description' => 'A place.',
48
-		),
49
-		'localbusiness' => array(
50
-			'label'       => 'LocalBusiness',
51
-			'description' => 'A local business.',
52
-		),
53
-	);
54
-
55
-	foreach ( $terms as $slug => $term ) {
56
-
57
-		// Create the term if it does not exist, then get its ID
58
-		$term_id = term_exists( $slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
59
-
60
-		if ( 0 == $term_id || is_null( $term_id ) ) {
61
-			$result = wp_insert_term( $slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
62
-		} else {
63
-			$term_id = $term_id['term_id'];
64
-			$result  = get_term( $term_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, ARRAY_A );
65
-		}
66
-
67
-		// Check for errors.
68
-		if ( is_wp_error( $result ) ) {
69
-			wl_write_log( 'wl_install_entity_type_data [ ' . $result->get_error_message() . ' ]' );
70
-			continue;
71
-		}
72
-
73
-		// Check if 'parent' corresponds to an actual term and get its ID.
74
-		if ( ! isset( $term['parents'] ) ) {
75
-			$term['parents'] = array();
76
-		}
77
-
78
-		$parent_ids = array();
79
-		foreach ( $term['parents'] as $parent_slug ) {
80
-			$parent_id    = get_term_by( 'slug', $parent_slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
81
-			$parent_ids[] = intval( $parent_id->term_id );  // Note: int casting is suggested by Codex: http://codex.wordpress.org/Function_Reference/get_term_by
82
-		}
83
-
84
-		// Define a parent in the WP taxonomy style (not important for WL)
85
-		if ( empty( $parent_ids ) ) {
86
-			// No parent
87
-			$parent_id = 0;
88
-		} else {
89
-			// Get first parent
90
-			$parent_id = $parent_ids[0];
91
-		}
92
-
93
-		// Update term with description, slug and parent
94
-		wp_update_term( $result['term_id'], Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, array(
95
-			'name'        => $term['label'],
96
-			'slug'        => $slug,
97
-			'description' => $term['description'],
98
-			// We give to WP taxonomy just one parent. TODO: see if can give more than one
99
-			'parent'      => $parent_id,
100
-		) );
101
-
102
-	}
14
+    // Ensure the custom type and the taxonomy are registered.
15
+    Wordlift_Entity_Post_Type_Service::get_instance()->register();
16
+
17
+    wl_entity_type_taxonomy_register();
18
+
19
+    // Ensure the custom taxonomy for dbpedia topics is registered
20
+    Wordlift_Topic_Taxonomy_Service::get_instance()->init();
21
+
22
+    // Set the taxonomy data.
23
+    // Note: parent types must be defined before child types.
24
+    $terms = array(
25
+        'thing'         => array(
26
+            'label'       => 'Thing',
27
+            'description' => 'A generic thing (something that doesn\'t fit in the previous definitions.',
28
+        ),
29
+        'creative-work' => array(
30
+            'label'       => 'CreativeWork',
31
+            'description' => 'A creative work (or a Music Album).',
32
+        ),
33
+        'event'         => array(
34
+            'label'       => 'Event',
35
+            'description' => 'An event.',
36
+        ),
37
+        'organization'  => array(
38
+            'label'       => 'Organization',
39
+            'description' => 'An organization, including a government or a newspaper.',
40
+        ),
41
+        'person'        => array(
42
+            'label'       => 'Person',
43
+            'description' => 'A person (or a music artist).',
44
+        ),
45
+        'place'         => array(
46
+            'label'       => 'Place',
47
+            'description' => 'A place.',
48
+        ),
49
+        'localbusiness' => array(
50
+            'label'       => 'LocalBusiness',
51
+            'description' => 'A local business.',
52
+        ),
53
+    );
54
+
55
+    foreach ( $terms as $slug => $term ) {
56
+
57
+        // Create the term if it does not exist, then get its ID
58
+        $term_id = term_exists( $slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
59
+
60
+        if ( 0 == $term_id || is_null( $term_id ) ) {
61
+            $result = wp_insert_term( $slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
62
+        } else {
63
+            $term_id = $term_id['term_id'];
64
+            $result  = get_term( $term_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, ARRAY_A );
65
+        }
66
+
67
+        // Check for errors.
68
+        if ( is_wp_error( $result ) ) {
69
+            wl_write_log( 'wl_install_entity_type_data [ ' . $result->get_error_message() . ' ]' );
70
+            continue;
71
+        }
72
+
73
+        // Check if 'parent' corresponds to an actual term and get its ID.
74
+        if ( ! isset( $term['parents'] ) ) {
75
+            $term['parents'] = array();
76
+        }
77
+
78
+        $parent_ids = array();
79
+        foreach ( $term['parents'] as $parent_slug ) {
80
+            $parent_id    = get_term_by( 'slug', $parent_slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
81
+            $parent_ids[] = intval( $parent_id->term_id );  // Note: int casting is suggested by Codex: http://codex.wordpress.org/Function_Reference/get_term_by
82
+        }
83
+
84
+        // Define a parent in the WP taxonomy style (not important for WL)
85
+        if ( empty( $parent_ids ) ) {
86
+            // No parent
87
+            $parent_id = 0;
88
+        } else {
89
+            // Get first parent
90
+            $parent_id = $parent_ids[0];
91
+        }
92
+
93
+        // Update term with description, slug and parent
94
+        wp_update_term( $result['term_id'], Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, array(
95
+            'name'        => $term['label'],
96
+            'slug'        => $slug,
97
+            'description' => $term['description'],
98
+            // We give to WP taxonomy just one parent. TODO: see if can give more than one
99
+            'parent'      => $parent_id,
100
+        ) );
101
+
102
+    }
103 103
 
104 104
 }
105 105
 
@@ -108,16 +108,16 @@  discard block
 block discarded – undo
108 108
  */
109 109
 function wl_core_install_create_relation_instance_table() {
110 110
 
111
-	global $wpdb;
112
-	// global $wl_db_version;
113
-	$installed_version = get_option( 'wl_db_version' );
111
+    global $wpdb;
112
+    // global $wl_db_version;
113
+    $installed_version = get_option( 'wl_db_version' );
114 114
 
115
-	if ( WL_DB_VERSION != $installed_version ) {
116
-		$table_name      = $wpdb->prefix . WL_DB_RELATION_INSTANCES_TABLE_NAME;
117
-		$charset_collate = $wpdb->get_charset_collate();
115
+    if ( WL_DB_VERSION != $installed_version ) {
116
+        $table_name      = $wpdb->prefix . WL_DB_RELATION_INSTANCES_TABLE_NAME;
117
+        $charset_collate = $wpdb->get_charset_collate();
118 118
 
119
-		// Sql statement for the relation instances custom table
120
-		$sql = <<<EOF
119
+        // Sql statement for the relation instances custom table
120
+        $sql = <<<EOF
121 121
 			CREATE TABLE $table_name (
122 122
   				id int(11) NOT NULL AUTO_INCREMENT,
123 123
   				subject_id int(11) NOT NULL,
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
 			) $charset_collate;
130 130
 EOF;
131 131
 
132
-		// @see: https://codex.wordpress.org/Creating_Tables_with_Plugins
133
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
134
-		$results = dbDelta( $sql );
132
+        // @see: https://codex.wordpress.org/Creating_Tables_with_Plugins
133
+        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
134
+        $results = dbDelta( $sql );
135 135
 
136
-		wl_write_log( $results );
136
+        wl_write_log( $results );
137 137
 
138
-		update_option( 'wl_db_version', WL_DB_VERSION );
139
-	}
138
+        update_option( 'wl_db_version', WL_DB_VERSION );
139
+    }
140 140
 }
141 141
 
142 142
 /**
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
  */
148 148
 function wl_core_upgrade_db_to_1_0() {
149 149
 
150
-	if ( ! get_option( 'wl_db_version' ) ) {
151
-		wl_core_install_entity_type_data();
152
-		wl_core_install_create_relation_instance_table();
153
-	}
150
+    if ( ! get_option( 'wl_db_version' ) ) {
151
+        wl_core_install_entity_type_data();
152
+        wl_core_install_create_relation_instance_table();
153
+    }
154 154
 
155 155
 }
156 156
 
@@ -163,31 +163,31 @@  discard block
 block discarded – undo
163 163
  */
164 164
 function wl_core_upgrade_db_1_0_to_3_10() {
165 165
 
166
-	// If the DB version is less than 3.10, than flatten the txonomy.
167
-	if ( version_compare( get_option( 'wl_db_version' ), '3.9', '<=' ) ) {
166
+    // If the DB version is less than 3.10, than flatten the txonomy.
167
+    if ( version_compare( get_option( 'wl_db_version' ), '3.9', '<=' ) ) {
168 168
 
169
-		$term_slugs = array(
170
-			'thing',
171
-			'creative-work',
172
-			'event',
173
-			'organization',
174
-			'person',
175
-			'place',
176
-			'localbusiness',
177
-		);
169
+        $term_slugs = array(
170
+            'thing',
171
+            'creative-work',
172
+            'event',
173
+            'organization',
174
+            'person',
175
+            'place',
176
+            'localbusiness',
177
+        );
178 178
 
179
-		foreach ( $term_slugs as $slug ) {
179
+        foreach ( $term_slugs as $slug ) {
180 180
 
181
-			$term = get_term_by( 'slug', $slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
181
+            $term = get_term_by( 'slug', $slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
182 182
 
183
-			// Set the term's parent to 0.
184
-			if ( $term ) {
185
-				wp_update_term( $term->term_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, array(
186
-					'parent' => 0,
187
-				) );
188
-			}
189
-		}
190
-	}
183
+            // Set the term's parent to 0.
184
+            if ( $term ) {
185
+                wp_update_term( $term->term_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, array(
186
+                    'parent' => 0,
187
+                ) );
188
+            }
189
+        }
190
+    }
191 191
 
192 192
 }
193 193
 
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
  * @since 3.12.0
201 201
  */
202 202
 function wl_core_upgrade_db_3_10_3_12() {
203
-	/*
203
+    /*
204 204
 	 * As this upgrade functionality runs on the init hook, and the AMP plugin
205 205
 	 * initialization does the same, avoid possible race conditions by
206 206
 	 * deferring the actual flush to a later hook.
207 207
 	 */
208
-	add_action( 'wp_loaded', function () {
209
-		flush_rewrite_rules();
210
-	} );
208
+    add_action( 'wp_loaded', function () {
209
+        flush_rewrite_rules();
210
+    } );
211 211
 }
212 212
 
213 213
 /**
@@ -219,39 +219,39 @@  discard block
 block discarded – undo
219 219
  */
220 220
 function wl_core_upgrade_db_3_12_3_14() {
221 221
 
222
-	// Assign capabilities to manipulate entities to admins.
223
-	$admins = get_role( 'administrator' );
224
-
225
-	$admins->add_cap( 'edit_wordlift_entity' );
226
-	$admins->add_cap( 'edit_wordlift_entities' );
227
-	$admins->add_cap( 'edit_others_wordlift_entities' );
228
-	$admins->add_cap( 'publish_wordlift_entities' );
229
-	$admins->add_cap( 'read_private_wordlift_entities' );
230
-	$admins->add_cap( 'delete_wordlift_entity' );
231
-
232
-	// Assign capabilities to manipulate entities to editors.
233
-	$editors = get_role( 'editor' );
234
-
235
-	$editors->add_cap( 'edit_wordlift_entity' );
236
-	$editors->add_cap( 'edit_wordlift_entities' );
237
-	$editors->add_cap( 'edit_others_wordlift_entities' );
238
-	$editors->add_cap( 'publish_wordlift_entities' );
239
-	$editors->add_cap( 'read_private_wordlift_entities' );
240
-	$editors->add_cap( 'delete_wordlift_entity' );
222
+    // Assign capabilities to manipulate entities to admins.
223
+    $admins = get_role( 'administrator' );
224
+
225
+    $admins->add_cap( 'edit_wordlift_entity' );
226
+    $admins->add_cap( 'edit_wordlift_entities' );
227
+    $admins->add_cap( 'edit_others_wordlift_entities' );
228
+    $admins->add_cap( 'publish_wordlift_entities' );
229
+    $admins->add_cap( 'read_private_wordlift_entities' );
230
+    $admins->add_cap( 'delete_wordlift_entity' );
231
+
232
+    // Assign capabilities to manipulate entities to editors.
233
+    $editors = get_role( 'editor' );
234
+
235
+    $editors->add_cap( 'edit_wordlift_entity' );
236
+    $editors->add_cap( 'edit_wordlift_entities' );
237
+    $editors->add_cap( 'edit_others_wordlift_entities' );
238
+    $editors->add_cap( 'publish_wordlift_entities' );
239
+    $editors->add_cap( 'read_private_wordlift_entities' );
240
+    $editors->add_cap( 'delete_wordlift_entity' );
241 241
 }
242 242
 
243 243
 // Check db status on automated plugins updates
244 244
 function wl_core_update_db_check() {
245 245
 
246
-	if ( get_option( 'wl_db_version' ) != WL_DB_VERSION ) {
246
+    if ( get_option( 'wl_db_version' ) != WL_DB_VERSION ) {
247 247
 
248
-		wl_core_upgrade_db_to_1_0();
249
-		wl_core_upgrade_db_1_0_to_3_10();
250
-		wl_core_upgrade_db_3_10_3_12();
251
-		wl_core_upgrade_db_3_12_3_14();
252
-		update_option( 'wl_db_version', WL_DB_VERSION );
248
+        wl_core_upgrade_db_to_1_0();
249
+        wl_core_upgrade_db_1_0_to_3_10();
250
+        wl_core_upgrade_db_3_10_3_12();
251
+        wl_core_upgrade_db_3_12_3_14();
252
+        update_option( 'wl_db_version', WL_DB_VERSION );
253 253
 
254
-	}
254
+    }
255 255
 
256 256
 }
257 257
 
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -52,37 +52,37 @@  discard block
 block discarded – undo
52 52
 		),
53 53
 	);
54 54
 
55
-	foreach ( $terms as $slug => $term ) {
55
+	foreach ($terms as $slug => $term) {
56 56
 
57 57
 		// Create the term if it does not exist, then get its ID
58
-		$term_id = term_exists( $slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
58
+		$term_id = term_exists($slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME);
59 59
 
60
-		if ( 0 == $term_id || is_null( $term_id ) ) {
61
-			$result = wp_insert_term( $slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
60
+		if (0 == $term_id || is_null($term_id)) {
61
+			$result = wp_insert_term($slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME);
62 62
 		} else {
63 63
 			$term_id = $term_id['term_id'];
64
-			$result  = get_term( $term_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, ARRAY_A );
64
+			$result  = get_term($term_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, ARRAY_A);
65 65
 		}
66 66
 
67 67
 		// Check for errors.
68
-		if ( is_wp_error( $result ) ) {
69
-			wl_write_log( 'wl_install_entity_type_data [ ' . $result->get_error_message() . ' ]' );
68
+		if (is_wp_error($result)) {
69
+			wl_write_log('wl_install_entity_type_data [ '.$result->get_error_message().' ]');
70 70
 			continue;
71 71
 		}
72 72
 
73 73
 		// Check if 'parent' corresponds to an actual term and get its ID.
74
-		if ( ! isset( $term['parents'] ) ) {
74
+		if ( ! isset($term['parents'])) {
75 75
 			$term['parents'] = array();
76 76
 		}
77 77
 
78 78
 		$parent_ids = array();
79
-		foreach ( $term['parents'] as $parent_slug ) {
80
-			$parent_id    = get_term_by( 'slug', $parent_slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
81
-			$parent_ids[] = intval( $parent_id->term_id );  // Note: int casting is suggested by Codex: http://codex.wordpress.org/Function_Reference/get_term_by
79
+		foreach ($term['parents'] as $parent_slug) {
80
+			$parent_id    = get_term_by('slug', $parent_slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME);
81
+			$parent_ids[] = intval($parent_id->term_id); // Note: int casting is suggested by Codex: http://codex.wordpress.org/Function_Reference/get_term_by
82 82
 		}
83 83
 
84 84
 		// Define a parent in the WP taxonomy style (not important for WL)
85
-		if ( empty( $parent_ids ) ) {
85
+		if (empty($parent_ids)) {
86 86
 			// No parent
87 87
 			$parent_id = 0;
88 88
 		} else {
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 		}
92 92
 
93 93
 		// Update term with description, slug and parent
94
-		wp_update_term( $result['term_id'], Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, array(
94
+		wp_update_term($result['term_id'], Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, array(
95 95
 			'name'        => $term['label'],
96 96
 			'slug'        => $slug,
97 97
 			'description' => $term['description'],
98 98
 			// We give to WP taxonomy just one parent. TODO: see if can give more than one
99 99
 			'parent'      => $parent_id,
100
-		) );
100
+		));
101 101
 
102 102
 	}
103 103
 
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 
111 111
 	global $wpdb;
112 112
 	// global $wl_db_version;
113
-	$installed_version = get_option( 'wl_db_version' );
113
+	$installed_version = get_option('wl_db_version');
114 114
 
115
-	if ( WL_DB_VERSION != $installed_version ) {
116
-		$table_name      = $wpdb->prefix . WL_DB_RELATION_INSTANCES_TABLE_NAME;
115
+	if (WL_DB_VERSION != $installed_version) {
116
+		$table_name      = $wpdb->prefix.WL_DB_RELATION_INSTANCES_TABLE_NAME;
117 117
 		$charset_collate = $wpdb->get_charset_collate();
118 118
 
119 119
 		// Sql statement for the relation instances custom table
@@ -130,12 +130,12 @@  discard block
 block discarded – undo
130 130
 EOF;
131 131
 
132 132
 		// @see: https://codex.wordpress.org/Creating_Tables_with_Plugins
133
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
134
-		$results = dbDelta( $sql );
133
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
134
+		$results = dbDelta($sql);
135 135
 
136
-		wl_write_log( $results );
136
+		wl_write_log($results);
137 137
 
138
-		update_option( 'wl_db_version', WL_DB_VERSION );
138
+		update_option('wl_db_version', WL_DB_VERSION);
139 139
 	}
140 140
 }
141 141
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
  */
148 148
 function wl_core_upgrade_db_to_1_0() {
149 149
 
150
-	if ( ! get_option( 'wl_db_version' ) ) {
150
+	if ( ! get_option('wl_db_version')) {
151 151
 		wl_core_install_entity_type_data();
152 152
 		wl_core_install_create_relation_instance_table();
153 153
 	}
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 function wl_core_upgrade_db_1_0_to_3_10() {
165 165
 
166 166
 	// If the DB version is less than 3.10, than flatten the txonomy.
167
-	if ( version_compare( get_option( 'wl_db_version' ), '3.9', '<=' ) ) {
167
+	if (version_compare(get_option('wl_db_version'), '3.9', '<=')) {
168 168
 
169 169
 		$term_slugs = array(
170 170
 			'thing',
@@ -176,15 +176,15 @@  discard block
 block discarded – undo
176 176
 			'localbusiness',
177 177
 		);
178 178
 
179
-		foreach ( $term_slugs as $slug ) {
179
+		foreach ($term_slugs as $slug) {
180 180
 
181
-			$term = get_term_by( 'slug', $slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
181
+			$term = get_term_by('slug', $slug, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME);
182 182
 
183 183
 			// Set the term's parent to 0.
184
-			if ( $term ) {
185
-				wp_update_term( $term->term_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, array(
184
+			if ($term) {
185
+				wp_update_term($term->term_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME, array(
186 186
 					'parent' => 0,
187
-				) );
187
+				));
188 188
 			}
189 189
 		}
190 190
 	}
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	 * initialization does the same, avoid possible race conditions by
206 206
 	 * deferring the actual flush to a later hook.
207 207
 	 */
208
-	add_action( 'wp_loaded', function () {
208
+	add_action('wp_loaded', function() {
209 209
 		flush_rewrite_rules();
210 210
 	} );
211 211
 }
@@ -220,39 +220,39 @@  discard block
 block discarded – undo
220 220
 function wl_core_upgrade_db_3_12_3_14() {
221 221
 
222 222
 	// Assign capabilities to manipulate entities to admins.
223
-	$admins = get_role( 'administrator' );
223
+	$admins = get_role('administrator');
224 224
 
225
-	$admins->add_cap( 'edit_wordlift_entity' );
226
-	$admins->add_cap( 'edit_wordlift_entities' );
227
-	$admins->add_cap( 'edit_others_wordlift_entities' );
228
-	$admins->add_cap( 'publish_wordlift_entities' );
229
-	$admins->add_cap( 'read_private_wordlift_entities' );
230
-	$admins->add_cap( 'delete_wordlift_entity' );
225
+	$admins->add_cap('edit_wordlift_entity');
226
+	$admins->add_cap('edit_wordlift_entities');
227
+	$admins->add_cap('edit_others_wordlift_entities');
228
+	$admins->add_cap('publish_wordlift_entities');
229
+	$admins->add_cap('read_private_wordlift_entities');
230
+	$admins->add_cap('delete_wordlift_entity');
231 231
 
232 232
 	// Assign capabilities to manipulate entities to editors.
233
-	$editors = get_role( 'editor' );
234
-
235
-	$editors->add_cap( 'edit_wordlift_entity' );
236
-	$editors->add_cap( 'edit_wordlift_entities' );
237
-	$editors->add_cap( 'edit_others_wordlift_entities' );
238
-	$editors->add_cap( 'publish_wordlift_entities' );
239
-	$editors->add_cap( 'read_private_wordlift_entities' );
240
-	$editors->add_cap( 'delete_wordlift_entity' );
233
+	$editors = get_role('editor');
234
+
235
+	$editors->add_cap('edit_wordlift_entity');
236
+	$editors->add_cap('edit_wordlift_entities');
237
+	$editors->add_cap('edit_others_wordlift_entities');
238
+	$editors->add_cap('publish_wordlift_entities');
239
+	$editors->add_cap('read_private_wordlift_entities');
240
+	$editors->add_cap('delete_wordlift_entity');
241 241
 }
242 242
 
243 243
 // Check db status on automated plugins updates
244 244
 function wl_core_update_db_check() {
245 245
 
246
-	if ( get_option( 'wl_db_version' ) != WL_DB_VERSION ) {
246
+	if (get_option('wl_db_version') != WL_DB_VERSION) {
247 247
 
248 248
 		wl_core_upgrade_db_to_1_0();
249 249
 		wl_core_upgrade_db_1_0_to_3_10();
250 250
 		wl_core_upgrade_db_3_10_3_12();
251 251
 		wl_core_upgrade_db_3_12_3_14();
252
-		update_option( 'wl_db_version', WL_DB_VERSION );
252
+		update_option('wl_db_version', WL_DB_VERSION);
253 253
 
254 254
 	}
255 255
 
256 256
 }
257 257
 
258
-add_action( 'init', 'wl_core_update_db_check', 11 ); // need taxonomies and post type to be defined first
258
+add_action('init', 'wl_core_update_db_check', 11); // need taxonomies and post type to be defined first
Please login to merge, or discard this patch.
src/modules/core/wordlift_core_constants.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,54 +1,54 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-define( 'WL_DEFAULT_THUMBNAIL_PATH', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/public/images/missing-image-150x150.png' );
4
-define( 'WL_DEFAULT_PATH', dirname( dirname( plugin_dir_url( __FILE__ ) ) ) . '/' );
3
+define('WL_DEFAULT_THUMBNAIL_PATH', dirname(dirname(plugin_dir_url(__FILE__))).'/public/images/missing-image-150x150.png');
4
+define('WL_DEFAULT_PATH', dirname(dirname(plugin_dir_url(__FILE__))).'/');
5 5
 
6 6
 // Database version
7
-define( 'WL_DB_VERSION', '3.14' );
7
+define('WL_DB_VERSION', '3.14');
8 8
 // Custom table name
9
-define( 'WL_DB_RELATION_INSTANCES_TABLE_NAME', 'wl_relation_instances' );
9
+define('WL_DB_RELATION_INSTANCES_TABLE_NAME', 'wl_relation_instances');
10 10
 
11
-define( 'WL_WHAT_RELATION', 'what' );
12
-define( 'WL_WHO_RELATION', 'who' );
13
-define( 'WL_WHERE_RELATION', 'where' );
14
-define( 'WL_WHEN_RELATION', 'when' );
11
+define('WL_WHAT_RELATION', 'what');
12
+define('WL_WHO_RELATION', 'who');
13
+define('WL_WHERE_RELATION', 'where');
14
+define('WL_WHEN_RELATION', 'when');
15 15
 
16 16
 // Mapping options / validations rules used by wl_core_get_posts to perform validation on args
17 17
 // The array is serialized because array constants are only from php 5.6 on.
18
-define( 'WL_CORE_GET_POSTS_VALIDATION_RULES', serialize( array(
19
-	'get'            => array( 'posts', 'post_ids' ),
20
-	'as'             => array( 'object', 'subject' ),
21
-	'post_type'      => array( 'post', 'entity' ),
22
-	'post_status'    => array( 'draft', 'trash', 'publish' ),
23
-	'with_predicate' => array( WL_WHAT_RELATION, WL_WHEN_RELATION, WL_WHERE_RELATION, WL_WHO_RELATION ),
24
-) ) );
18
+define('WL_CORE_GET_POSTS_VALIDATION_RULES', serialize(array(
19
+	'get'            => array('posts', 'post_ids'),
20
+	'as'             => array('object', 'subject'),
21
+	'post_type'      => array('post', 'entity'),
22
+	'post_status'    => array('draft', 'trash', 'publish'),
23
+	'with_predicate' => array(WL_WHAT_RELATION, WL_WHEN_RELATION, WL_WHERE_RELATION, WL_WHO_RELATION),
24
+)));
25 25
 
26 26
 // Classification boxes configuration for angularjs edit-post widget
27 27
 // The array is serialized because array constants are only from php 5.6 on.
28 28
 
29
-define( 'WL_CORE_POST_CLASSIFICATION_BOXES', serialize( array(
29
+define('WL_CORE_POST_CLASSIFICATION_BOXES', serialize(array(
30 30
 	array(
31 31
 		'id'               => WL_WHAT_RELATION,
32 32
 		'label'            => 'What',
33
-		'registeredTypes'  => array( 'thing', 'creative-work' ),
33
+		'registeredTypes'  => array('thing', 'creative-work'),
34 34
 		'selectedEntities' => array(),
35 35
 	),
36 36
 	array(
37 37
 		'id'               => WL_WHO_RELATION,
38 38
 		'label'            => 'Who',
39
-		'registeredTypes'  => array( 'organization', 'person', 'local-business' ),
39
+		'registeredTypes'  => array('organization', 'person', 'local-business'),
40 40
 		'selectedEntities' => array(),
41 41
 	),
42 42
 	array(
43 43
 		'id'               => WL_WHERE_RELATION,
44 44
 		'label'            => 'Where',
45
-		'registeredTypes'  => array( 'place' ),
45
+		'registeredTypes'  => array('place'),
46 46
 		'selectedEntities' => array(),
47 47
 	),
48 48
 	array(
49 49
 		'id'               => WL_WHEN_RELATION,
50 50
 		'label'            => 'When',
51
-		'registeredTypes'  => array( 'event' ),
51
+		'registeredTypes'  => array('event'),
52 52
 		'selectedEntities' => array(),
53 53
 	),
54
-) ) );
54
+)));
Please login to merge, or discard this patch.
src/admin/class-wordlift-admin-user-profile-page.php 2 patches
Indentation   +119 added lines, -119 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,12 +96,12 @@  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>
@@ -119,54 +119,54 @@  discard block
 block discarded – undo
119 119
 				<?php } ?>
120 120
 		</table>
121 121
 		<?php
122
-	}
123
-
124
-	/**
125
-	 * Handle storing the person entity associated with the user.
126
-	 *
127
-	 * @since 3.14.0
128
-	 *
129
-	 * @param int $user_id The user id of the user being saved.
130
-	 */
131
-	public function edit_user_profile_update( $user_id ) {
132
-
133
-		// In case it is a user editing his own profile, make sure he has admin
134
-		// like capabilities.
135
-		if ( ! current_user_can( 'edit_users' ) ) {
136
-			return;
137
-		}
138
-
139
-		// Link an entity to the user.
140
-		$this->link_entity( $user_id, $_POST );
141
-
142
-		// Deny and enable the edit entity capability
143
-		if ( isset( $_POST['wl_can_create_entities'] ) ) {
144
-			// User has capability so remove the deny indication if present.
145
-			$this->user_service->allow_editor_entity_create( $user_id );
146
-		} else {
147
-			$this->user_service->deny_editor_entity_create( $user_id );
148
-		}
149
-
150
-	}
151
-
152
-	/**
153
-	 * Link an entity (specified in the `$_POST` array) to the {@link WP_User}
154
-	 * with the specified `id`.
155
-	 *
156
-	 * @since 3.14.0
157
-	 *
158
-	 * @param int   $user_id The {@link WP_User} `id`.
159
-	 * @param array $post    The `$_POST` array.
160
-	 */
161
-	private function link_entity( $user_id, $post ) {
162
-
163
-		// Bail out if the `wl_person` parameter isn't set.
164
-		if ( ! isset( $post['wl_person'] ) || ! is_numeric( $post['wl_person'] ) ) {
165
-			return;
166
-		}
167
-
168
-		$this->user_service->set_entity( $user_id, intval( $post['wl_person'] ) );
169
-
170
-	}
122
+    }
123
+
124
+    /**
125
+     * Handle storing the person entity associated with the user.
126
+     *
127
+     * @since 3.14.0
128
+     *
129
+     * @param int $user_id The user id of the user being saved.
130
+     */
131
+    public function edit_user_profile_update( $user_id ) {
132
+
133
+        // In case it is a user editing his own profile, make sure he has admin
134
+        // like capabilities.
135
+        if ( ! current_user_can( 'edit_users' ) ) {
136
+            return;
137
+        }
138
+
139
+        // Link an entity to the user.
140
+        $this->link_entity( $user_id, $_POST );
141
+
142
+        // Deny and enable the edit entity capability
143
+        if ( isset( $_POST['wl_can_create_entities'] ) ) {
144
+            // User has capability so remove the deny indication if present.
145
+            $this->user_service->allow_editor_entity_create( $user_id );
146
+        } else {
147
+            $this->user_service->deny_editor_entity_create( $user_id );
148
+        }
149
+
150
+    }
151
+
152
+    /**
153
+     * Link an entity (specified in the `$_POST` array) to the {@link WP_User}
154
+     * with the specified `id`.
155
+     *
156
+     * @since 3.14.0
157
+     *
158
+     * @param int   $user_id The {@link WP_User} `id`.
159
+     * @param array $post    The `$_POST` array.
160
+     */
161
+    private function link_entity( $user_id, $post ) {
162
+
163
+        // Bail out if the `wl_person` parameter isn't set.
164
+        if ( ! isset( $post['wl_person'] ) || ! is_numeric( $post['wl_person'] ) ) {
165
+            return;
166
+        }
167
+
168
+        $this->user_service->set_entity( $user_id, intval( $post['wl_person'] ) );
169
+
170
+    }
171 171
 
172 172
 }
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 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,43 +78,43 @@  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
-			<?php if ( $this->user_service->is_editor( $user->ID ) ) { ?>
108
+			<?php if ($this->user_service->is_editor($user->ID)) { ?>
109 109
 			<tr>
110 110
 				<th>
111 111
 					<label
112
-						for="wl_can_create_entities"><?php esc_html_e( 'Can create new entities', 'wordlift' ) ?></label>
112
+						for="wl_can_create_entities"><?php esc_html_e('Can create new entities', 'wordlift') ?></label>
113 113
 				</th>
114 114
 				<td>
115 115
 					<input id="wl_can_create_entities"
116 116
 					       name="wl_can_create_entities"
117
-					       type="checkbox" <?php checked( $this->user_service->editor_can_create_entities( $user->ID ) ) ?>
117
+					       type="checkbox" <?php checked($this->user_service->editor_can_create_entities($user->ID)) ?>
118 118
 				</td>
119 119
 				<?php } ?>
120 120
 		</table>
@@ -128,23 +128,23 @@  discard block
 block discarded – undo
128 128
 	 *
129 129
 	 * @param int $user_id The user id of the user being saved.
130 130
 	 */
131
-	public function edit_user_profile_update( $user_id ) {
131
+	public function edit_user_profile_update($user_id) {
132 132
 
133 133
 		// In case it is a user editing his own profile, make sure he has admin
134 134
 		// like capabilities.
135
-		if ( ! current_user_can( 'edit_users' ) ) {
135
+		if ( ! current_user_can('edit_users')) {
136 136
 			return;
137 137
 		}
138 138
 
139 139
 		// Link an entity to the user.
140
-		$this->link_entity( $user_id, $_POST );
140
+		$this->link_entity($user_id, $_POST);
141 141
 
142 142
 		// Deny and enable the edit entity capability
143
-		if ( isset( $_POST['wl_can_create_entities'] ) ) {
143
+		if (isset($_POST['wl_can_create_entities'])) {
144 144
 			// User has capability so remove the deny indication if present.
145
-			$this->user_service->allow_editor_entity_create( $user_id );
145
+			$this->user_service->allow_editor_entity_create($user_id);
146 146
 		} else {
147
-			$this->user_service->deny_editor_entity_create( $user_id );
147
+			$this->user_service->deny_editor_entity_create($user_id);
148 148
 		}
149 149
 
150 150
 	}
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
 	 * @param int   $user_id The {@link WP_User} `id`.
159 159
 	 * @param array $post    The `$_POST` array.
160 160
 	 */
161
-	private function link_entity( $user_id, $post ) {
161
+	private function link_entity($user_id, $post) {
162 162
 
163 163
 		// Bail out if the `wl_person` parameter isn't set.
164
-		if ( ! isset( $post['wl_person'] ) || ! is_numeric( $post['wl_person'] ) ) {
164
+		if ( ! isset($post['wl_person']) || ! is_numeric($post['wl_person'])) {
165 165
 			return;
166 166
 		}
167 167
 
168
-		$this->user_service->set_entity( $user_id, intval( $post['wl_person'] ) );
168
+		$this->user_service->set_entity($user_id, intval($post['wl_person']));
169 169
 
170 170
 	}
171 171
 
Please login to merge, or discard this patch.
src/admin/class-wordlift-admin.php 2 patches
Indentation   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -22,161 +22,161 @@
 block discarded – undo
22 22
  */
23 23
 class Wordlift_Admin {
24 24
 
25
-	/**
26
-	 * The ID of this plugin.
27
-	 *
28
-	 * @since    1.0.0
29
-	 * @access   private
30
-	 * @var      string $plugin_name The ID of this plugin.
31
-	 */
32
-	private $plugin_name;
33
-
34
-	/**
35
-	 * The version of this plugin.
36
-	 *
37
-	 * @since    1.0.0
38
-	 * @access   private
39
-	 * @var      string $version The current version of this plugin.
40
-	 */
41
-	private $version;
42
-
43
-	/**
44
-	 * The {@link Wordlift_Configuration_Service} instance.
45
-	 *
46
-	 * @since  3.14.0
47
-	 * @access private
48
-	 * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
49
-	 */
50
-	private $configuration_service;
51
-
52
-	/**
53
-	 * The {@link Wordlift_User_Service} instance.
54
-	 *
55
-	 * @since  3.14.0
56
-	 * @access private
57
-	 * @var \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance.
58
-	 */
59
-	private $user_service;
60
-
61
-	/**
62
-	 * Initialize the class and set its properties.
63
-	 *
64
-	 * @since  1.0.0
65
-	 *
66
-	 * @param string                          $plugin_name           The name of this plugin.
67
-	 * @param string                          $version               The version of this plugin.
68
-	 * @param \Wordlift_Configuration_Service $configuration_service The configuration service.
69
-	 * @param \Wordlift_Notice_Service        $notice_service        The notice service.
70
-	 * @param \Wordlift_User_Service          $user_service          The {@link Wordlift_User_Service} instance.
71
-	 */
72
-	public function __construct( $plugin_name, $version, $configuration_service, $notice_service, $user_service ) {
73
-
74
-		$this->plugin_name = $plugin_name;
75
-		$this->version     = $version;
76
-
77
-		$this->configuration_service = $configuration_service;
78
-		$this->user_service          = $user_service;
79
-
80
-		$dataset_uri = $configuration_service->get_dataset_uri();
81
-		$key         = $configuration_service->get_key();
82
-
83
-		if ( empty( $dataset_uri ) ) {
84
-			$settings_page = Wordlift_Admin_Settings_Page::get_instance();
85
-			if ( empty( $key ) ) {
86
-				$error = sprintf( esc_html__( "WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' );
87
-			} else {
88
-				$error = sprintf( esc_html__( "WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' );
89
-			}
90
-			$notice_service->add_error( $error );
91
-		}
92
-
93
-	}
94
-
95
-	/**
96
-	 * Register the stylesheets for the admin area.
97
-	 *
98
-	 * @since    1.0.0
99
-	 */
100
-	public function enqueue_styles() {
101
-
102
-		/**
103
-		 * This function is provided for demonstration purposes only.
104
-		 *
105
-		 * An instance of this class should be passed to the run() function
106
-		 * defined in Wordlift_Loader as all of the hooks are defined
107
-		 * in that particular class.
108
-		 *
109
-		 * The Wordlift_Loader will then create the relationship
110
-		 * between the defined hooks and the functions defined in this
111
-		 * class.
112
-		 */
113
-
114
-		wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' );
115
-
116
-	}
117
-
118
-	/**
119
-	 * Register the JavaScript for the admin area.
120
-	 *
121
-	 * @since    1.0.0
122
-	 */
123
-	public function enqueue_scripts() {
124
-
125
-		/**
126
-		 * This function is provided for demonstration purposes only.
127
-		 *
128
-		 * An instance of this class should be passed to the run() function
129
-		 * defined in Wordlift_Loader as all of the hooks are defined
130
-		 * in that particular class.
131
-		 *
132
-		 * The Wordlift_Loader will then create the relationship
133
-		 * between the defined hooks and the functions defined in this
134
-		 * class.
135
-		 */
136
-
137
-		// Enqueue the admin scripts.
138
-		wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wordlift-admin.bundle.js', array(
139
-			'jquery',
140
-			'underscore',
141
-			'backbone',
142
-		), $this->version, false );
143
-
144
-		// Set the basic params.
145
-		$params = array(
146
-			// @todo scripts in admin should use wp.post.
147
-			'ajax_url'            => admin_url( 'admin-ajax.php' ),
148
-			// @todo remove specific actions from settings.
149
-			'action'              => 'entity_by_title',
150
-			'datasetUri'          => $this->configuration_service->get_dataset_uri(),
151
-			'language'            => $this->configuration_service->get_language_code(),
152
-			'link_by_default'     => $this->configuration_service->is_link_by_default(),
153
-			// Whether the current user is allowed to create new entities.
154
-			//
155
-			// @see https://github.com/insideout10/wordlift-plugin/issues/561
156
-			'can_create_entities' => $this->user_service->editor_can_create_entities( get_current_user_id() ) ? 'yes' : 'no',
157
-			'l10n'                => array(
158
-				'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ),
159
-				'logo_selection_title'                               => __( 'WordLift Choose Logo', 'wordlift' ),
160
-				'logo_selection_button'                              => array( 'text' => __( 'Choose Logo', 'wordlift' ) ),
161
-			),
162
-		);
163
-
164
-		// Set post-related values if there's a current post.
165
-		if ( null !== $post = $entity_being_edited = get_post() ) {
166
-
167
-			$params['post_id']           = $entity_being_edited->ID;
168
-			$params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && Wordlift_Entity_Service::TYPE_NAME == $entity_being_edited->post_type && is_numeric( get_the_ID() );
169
-			// We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it
170
-			// from the results, since we don't want the current entity to be discovered by the analysis.
171
-			//
172
-			// See https://github.com/insideout10/wordlift-plugin/issues/345
173
-			$params['itemId'] = Wordlift_Entity_Service::get_instance()->get_uri( $entity_being_edited->ID );
174
-
175
-		}
176
-
177
-		// Finally output the params as `wlSettings` for JavaScript code.
178
-		wp_localize_script( $this->plugin_name, 'wlSettings', $params );
179
-
180
-	}
25
+    /**
26
+     * The ID of this plugin.
27
+     *
28
+     * @since    1.0.0
29
+     * @access   private
30
+     * @var      string $plugin_name The ID of this plugin.
31
+     */
32
+    private $plugin_name;
33
+
34
+    /**
35
+     * The version of this plugin.
36
+     *
37
+     * @since    1.0.0
38
+     * @access   private
39
+     * @var      string $version The current version of this plugin.
40
+     */
41
+    private $version;
42
+
43
+    /**
44
+     * The {@link Wordlift_Configuration_Service} instance.
45
+     *
46
+     * @since  3.14.0
47
+     * @access private
48
+     * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
49
+     */
50
+    private $configuration_service;
51
+
52
+    /**
53
+     * The {@link Wordlift_User_Service} instance.
54
+     *
55
+     * @since  3.14.0
56
+     * @access private
57
+     * @var \Wordlift_User_Service $user_service The {@link Wordlift_User_Service} instance.
58
+     */
59
+    private $user_service;
60
+
61
+    /**
62
+     * Initialize the class and set its properties.
63
+     *
64
+     * @since  1.0.0
65
+     *
66
+     * @param string                          $plugin_name           The name of this plugin.
67
+     * @param string                          $version               The version of this plugin.
68
+     * @param \Wordlift_Configuration_Service $configuration_service The configuration service.
69
+     * @param \Wordlift_Notice_Service        $notice_service        The notice service.
70
+     * @param \Wordlift_User_Service          $user_service          The {@link Wordlift_User_Service} instance.
71
+     */
72
+    public function __construct( $plugin_name, $version, $configuration_service, $notice_service, $user_service ) {
73
+
74
+        $this->plugin_name = $plugin_name;
75
+        $this->version     = $version;
76
+
77
+        $this->configuration_service = $configuration_service;
78
+        $this->user_service          = $user_service;
79
+
80
+        $dataset_uri = $configuration_service->get_dataset_uri();
81
+        $key         = $configuration_service->get_key();
82
+
83
+        if ( empty( $dataset_uri ) ) {
84
+            $settings_page = Wordlift_Admin_Settings_Page::get_instance();
85
+            if ( empty( $key ) ) {
86
+                $error = sprintf( esc_html__( "WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' );
87
+            } else {
88
+                $error = sprintf( esc_html__( "WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' );
89
+            }
90
+            $notice_service->add_error( $error );
91
+        }
92
+
93
+    }
94
+
95
+    /**
96
+     * Register the stylesheets for the admin area.
97
+     *
98
+     * @since    1.0.0
99
+     */
100
+    public function enqueue_styles() {
101
+
102
+        /**
103
+         * This function is provided for demonstration purposes only.
104
+         *
105
+         * An instance of this class should be passed to the run() function
106
+         * defined in Wordlift_Loader as all of the hooks are defined
107
+         * in that particular class.
108
+         *
109
+         * The Wordlift_Loader will then create the relationship
110
+         * between the defined hooks and the functions defined in this
111
+         * class.
112
+         */
113
+
114
+        wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' );
115
+
116
+    }
117
+
118
+    /**
119
+     * Register the JavaScript for the admin area.
120
+     *
121
+     * @since    1.0.0
122
+     */
123
+    public function enqueue_scripts() {
124
+
125
+        /**
126
+         * This function is provided for demonstration purposes only.
127
+         *
128
+         * An instance of this class should be passed to the run() function
129
+         * defined in Wordlift_Loader as all of the hooks are defined
130
+         * in that particular class.
131
+         *
132
+         * The Wordlift_Loader will then create the relationship
133
+         * between the defined hooks and the functions defined in this
134
+         * class.
135
+         */
136
+
137
+        // Enqueue the admin scripts.
138
+        wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wordlift-admin.bundle.js', array(
139
+            'jquery',
140
+            'underscore',
141
+            'backbone',
142
+        ), $this->version, false );
143
+
144
+        // Set the basic params.
145
+        $params = array(
146
+            // @todo scripts in admin should use wp.post.
147
+            'ajax_url'            => admin_url( 'admin-ajax.php' ),
148
+            // @todo remove specific actions from settings.
149
+            'action'              => 'entity_by_title',
150
+            'datasetUri'          => $this->configuration_service->get_dataset_uri(),
151
+            'language'            => $this->configuration_service->get_language_code(),
152
+            'link_by_default'     => $this->configuration_service->is_link_by_default(),
153
+            // Whether the current user is allowed to create new entities.
154
+            //
155
+            // @see https://github.com/insideout10/wordlift-plugin/issues/561
156
+            'can_create_entities' => $this->user_service->editor_can_create_entities( get_current_user_id() ) ? 'yes' : 'no',
157
+            'l10n'                => array(
158
+                'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ),
159
+                'logo_selection_title'                               => __( 'WordLift Choose Logo', 'wordlift' ),
160
+                'logo_selection_button'                              => array( 'text' => __( 'Choose Logo', 'wordlift' ) ),
161
+            ),
162
+        );
163
+
164
+        // Set post-related values if there's a current post.
165
+        if ( null !== $post = $entity_being_edited = get_post() ) {
166
+
167
+            $params['post_id']           = $entity_being_edited->ID;
168
+            $params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && Wordlift_Entity_Service::TYPE_NAME == $entity_being_edited->post_type && is_numeric( get_the_ID() );
169
+            // We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it
170
+            // from the results, since we don't want the current entity to be discovered by the analysis.
171
+            //
172
+            // See https://github.com/insideout10/wordlift-plugin/issues/345
173
+            $params['itemId'] = Wordlift_Entity_Service::get_instance()->get_uri( $entity_being_edited->ID );
174
+
175
+        }
176
+
177
+        // Finally output the params as `wlSettings` for JavaScript code.
178
+        wp_localize_script( $this->plugin_name, 'wlSettings', $params );
179
+
180
+    }
181 181
 
182 182
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @param \Wordlift_Notice_Service        $notice_service        The notice service.
70 70
 	 * @param \Wordlift_User_Service          $user_service          The {@link Wordlift_User_Service} instance.
71 71
 	 */
72
-	public function __construct( $plugin_name, $version, $configuration_service, $notice_service, $user_service ) {
72
+	public function __construct($plugin_name, $version, $configuration_service, $notice_service, $user_service) {
73 73
 
74 74
 		$this->plugin_name = $plugin_name;
75 75
 		$this->version     = $version;
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 		$dataset_uri = $configuration_service->get_dataset_uri();
81 81
 		$key         = $configuration_service->get_key();
82 82
 
83
-		if ( empty( $dataset_uri ) ) {
83
+		if (empty($dataset_uri)) {
84 84
 			$settings_page = Wordlift_Admin_Settings_Page::get_instance();
85
-			if ( empty( $key ) ) {
86
-				$error = sprintf( esc_html__( "WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' );
85
+			if (empty($key)) {
86
+				$error = sprintf(esc_html__("WordLift's key isn't set, please open the %s to set WordLift's key.", 'wordlift'), '<a href="'.$settings_page->get_url().'">'.esc_html__('settings page', 'wordlift').'</a>');
87 87
 			} else {
88
-				$error = sprintf( esc_html__( "WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift' ), '<a href="' . $settings_page->get_url() . '">' . esc_html__( 'settings page', 'wordlift' ) . '</a>' );
88
+				$error = sprintf(esc_html__("WordLift's dataset URI is not configured: please open the %s to set WordLift's key again.", 'wordlift'), '<a href="'.$settings_page->get_url().'">'.esc_html__('settings page', 'wordlift').'</a>');
89 89
 			}
90
-			$notice_service->add_error( $error );
90
+			$notice_service->add_error($error);
91 91
 		}
92 92
 
93 93
 	}
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		 * class.
112 112
 		 */
113 113
 
114
-		wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-admin.css', array(), $this->version, 'all' );
114
+		wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__).'css/wordlift-admin.css', array(), $this->version, 'all');
115 115
 
116 116
 	}
117 117
 
@@ -135,16 +135,16 @@  discard block
 block discarded – undo
135 135
 		 */
136 136
 
137 137
 		// Enqueue the admin scripts.
138
-		wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wordlift-admin.bundle.js', array(
138
+		wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__).'js/wordlift-admin.bundle.js', array(
139 139
 			'jquery',
140 140
 			'underscore',
141 141
 			'backbone',
142
-		), $this->version, false );
142
+		), $this->version, false);
143 143
 
144 144
 		// Set the basic params.
145 145
 		$params = array(
146 146
 			// @todo scripts in admin should use wp.post.
147
-			'ajax_url'            => admin_url( 'admin-ajax.php' ),
147
+			'ajax_url'            => admin_url('admin-ajax.php'),
148 148
 			// @todo remove specific actions from settings.
149 149
 			'action'              => 'entity_by_title',
150 150
 			'datasetUri'          => $this->configuration_service->get_dataset_uri(),
@@ -153,29 +153,29 @@  discard block
 block discarded – undo
153 153
 			// Whether the current user is allowed to create new entities.
154 154
 			//
155 155
 			// @see https://github.com/insideout10/wordlift-plugin/issues/561
156
-			'can_create_entities' => $this->user_service->editor_can_create_entities( get_current_user_id() ) ? 'yes' : 'no',
156
+			'can_create_entities' => $this->user_service->editor_can_create_entities(get_current_user_id()) ? 'yes' : 'no',
157 157
 			'l10n'                => array(
158
-				'You already published an entity with the same name' => __( 'You already published an entity with the same name: ', 'wordlift' ),
159
-				'logo_selection_title'                               => __( 'WordLift Choose Logo', 'wordlift' ),
160
-				'logo_selection_button'                              => array( 'text' => __( 'Choose Logo', 'wordlift' ) ),
158
+				'You already published an entity with the same name' => __('You already published an entity with the same name: ', 'wordlift'),
159
+				'logo_selection_title'                               => __('WordLift Choose Logo', 'wordlift'),
160
+				'logo_selection_button'                              => array('text' => __('Choose Logo', 'wordlift')),
161 161
 			),
162 162
 		);
163 163
 
164 164
 		// Set post-related values if there's a current post.
165
-		if ( null !== $post = $entity_being_edited = get_post() ) {
165
+		if (null !== $post = $entity_being_edited = get_post()) {
166 166
 
167 167
 			$params['post_id']           = $entity_being_edited->ID;
168
-			$params['entityBeingEdited'] = isset( $entity_being_edited->post_type ) && Wordlift_Entity_Service::TYPE_NAME == $entity_being_edited->post_type && is_numeric( get_the_ID() );
168
+			$params['entityBeingEdited'] = isset($entity_being_edited->post_type) && Wordlift_Entity_Service::TYPE_NAME == $entity_being_edited->post_type && is_numeric(get_the_ID());
169 169
 			// We add the `itemId` here to give a chance to the analysis to use it in order to tell WLS to exclude it
170 170
 			// from the results, since we don't want the current entity to be discovered by the analysis.
171 171
 			//
172 172
 			// See https://github.com/insideout10/wordlift-plugin/issues/345
173
-			$params['itemId'] = Wordlift_Entity_Service::get_instance()->get_uri( $entity_being_edited->ID );
173
+			$params['itemId'] = Wordlift_Entity_Service::get_instance()->get_uri($entity_being_edited->ID);
174 174
 
175 175
 		}
176 176
 
177 177
 		// Finally output the params as `wlSettings` for JavaScript code.
178
-		wp_localize_script( $this->plugin_name, 'wlSettings', $params );
178
+		wp_localize_script($this->plugin_name, 'wlSettings', $params);
179 179
 
180 180
 	}
181 181
 
Please login to merge, or discard this patch.
src/includes/class-wordlift-entity-service.php 1 patch
Indentation   +496 added lines, -496 removed lines patch added patch discarded remove patch
@@ -7,506 +7,506 @@
 block discarded – undo
7 7
  */
8 8
 class Wordlift_Entity_Service {
9 9
 
10
-	/**
11
-	 * The Log service.
12
-	 *
13
-	 * @since  3.2.0
14
-	 * @access private
15
-	 * @var \Wordlift_Log_Service $log The Log service.
16
-	 */
17
-	private $log;
18
-
19
-	/**
20
-	 * The UI service.
21
-	 *
22
-	 * @since  3.2.0
23
-	 * @access private
24
-	 * @var \Wordlift_UI_Service $ui_service The UI service.
25
-	 */
26
-	private $ui_service;
27
-
28
-	/**
29
-	 * The entity post type name.
30
-	 *
31
-	 * @since 3.1.0
32
-	 */
33
-	const TYPE_NAME = 'entity';
34
-
35
-	/**
36
-	 * The alternative label meta key.
37
-	 *
38
-	 * @since 3.2.0
39
-	 */
40
-	const ALTERNATIVE_LABEL_META_KEY = '_wl_alt_label';
41
-
42
-	/**
43
-	 * The alternative label input template.
44
-	 *
45
-	 * @since 3.2.0
46
-	 */
47
-	// TODO: this should be moved to a class that deals with HTML code.
48
-	const ALTERNATIVE_LABEL_INPUT_TEMPLATE = '<div class="wl-alternative-label">
10
+    /**
11
+     * The Log service.
12
+     *
13
+     * @since  3.2.0
14
+     * @access private
15
+     * @var \Wordlift_Log_Service $log The Log service.
16
+     */
17
+    private $log;
18
+
19
+    /**
20
+     * The UI service.
21
+     *
22
+     * @since  3.2.0
23
+     * @access private
24
+     * @var \Wordlift_UI_Service $ui_service The UI service.
25
+     */
26
+    private $ui_service;
27
+
28
+    /**
29
+     * The entity post type name.
30
+     *
31
+     * @since 3.1.0
32
+     */
33
+    const TYPE_NAME = 'entity';
34
+
35
+    /**
36
+     * The alternative label meta key.
37
+     *
38
+     * @since 3.2.0
39
+     */
40
+    const ALTERNATIVE_LABEL_META_KEY = '_wl_alt_label';
41
+
42
+    /**
43
+     * The alternative label input template.
44
+     *
45
+     * @since 3.2.0
46
+     */
47
+    // TODO: this should be moved to a class that deals with HTML code.
48
+    const ALTERNATIVE_LABEL_INPUT_TEMPLATE = '<div class="wl-alternative-label">
49 49
                 <label class="screen-reader-text" id="wl-alternative-label-prompt-text" for="wl-alternative-label">Enter alternative label here</label>
50 50
                 <input name="wl_alternative_label[]" size="30" value="%s" id="wl-alternative-label" type="text">
51 51
                 <button class="button wl-delete-button">%s</button>
52 52
                 </div>';
53 53
 
54
-	/**
55
-	 * A singleton instance of the Entity service.
56
-	 *
57
-	 * @since  3.2.0
58
-	 * @access private
59
-	 * @var \Wordlift_Entity_Service $instance A singleton instance of the Entity service.
60
-	 */
61
-	private static $instance;
62
-
63
-	/**
64
-	 * Create a Wordlift_Entity_Service instance.
65
-	 *
66
-	 * @since 3.2.0
67
-	 *
68
-	 * @param \Wordlift_UI_Service $ui_service The UI service.
69
-	 */
70
-	public function __construct( $ui_service ) {
71
-
72
-		$this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' );
73
-
74
-		// Set the UI service.
75
-		$this->ui_service = $ui_service;
76
-
77
-		// Set the singleton instance.
78
-		self::$instance = $this;
79
-
80
-	}
81
-
82
-	/**
83
-	 * Get the singleton instance of the Entity service.
84
-	 *
85
-	 * @since 3.2.0
86
-	 * @return \Wordlift_Entity_Service The singleton instance of the Entity service.
87
-	 */
88
-	public static function get_instance() {
89
-
90
-		return self::$instance;
91
-	}
92
-
93
-	/**
94
-	 * Determines whether a post is an entity or not.
95
-	 *
96
-	 * @since 3.1.0
97
-	 *
98
-	 * @param int $post_id A post id.
99
-	 *
100
-	 * @return bool Return true if the post is an entity otherwise false.
101
-	 */
102
-	public function is_entity( $post_id ) {
103
-
104
-		return ( self::TYPE_NAME === get_post_type( $post_id ) );
105
-	}
106
-
107
-	/**
108
-	 * Get the proper classification scope for a given entity post
109
-	 *
110
-	 * @since 3.5.0
111
-	 *
112
-	 * @param integer $post_id An entity post id.
113
-	 *
114
-	 * @return string Returns an uri.
115
-	 */
116
-	public function get_classification_scope_for( $post_id ) {
117
-
118
-		if ( false === $this->is_entity( $post_id ) ) {
119
-			return null;
120
-		}
121
-		// Retrieve the entity type
122
-		$entity_type_arr = wl_entity_type_taxonomy_get_type( $post_id );
123
-		$entity_type     = str_replace( 'wl-', '', $entity_type_arr['css_class'] );
124
-		// Retrieve classification boxes configuration
125
-		$classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES );
126
-		foreach ( $classification_boxes as $cb ) {
127
-			if ( in_array( $entity_type, $cb['registeredTypes'] ) ) {
128
-				return $cb['id'];
129
-			}
130
-		}
131
-
132
-		// or null
133
-		return null;
134
-
135
-	}
136
-
137
-
138
-	public function is_used( $post_id ) {
139
-
140
-		if ( false === $this->is_entity( $post_id ) ) {
141
-			return null;
142
-		}
143
-		// Retrieve the post
144
-		$entity = get_post( $post_id );
145
-
146
-		global $wpdb;
147
-		// Retrieve Wordlift relation instances table name
148
-		$table_name = wl_core_get_relation_instances_table_name();
149
-
150
-		// Check is it's referenced / related to another post / entity
151
-		$stmt = $wpdb->prepare(
152
-			"SELECT COUNT(*) FROM $table_name WHERE  object_id = %d",
153
-			$entity->ID
154
-		);
155
-
156
-		// Perform the query
157
-		$relation_instances = (int) $wpdb->get_var( $stmt );
158
-		// If there is at least one relation instance for the current entity, then it's used
159
-		if ( 0 < $relation_instances ) {
160
-			return true;
161
-		}
162
-
163
-		// Check if the entity uri is used as meta_value
164
-		$stmt = $wpdb->prepare(
165
-			"SELECT COUNT(*) FROM $wpdb->postmeta WHERE post_id != %d AND meta_value = %s",
166
-			$entity->ID,
167
-			wl_get_entity_uri( $entity->ID )
168
-		);
169
-		// Perform the query
170
-		$meta_instances = (int) $wpdb->get_var( $stmt );
171
-
172
-		// If there is at least one meta that refers the current entity uri, then current entity is used
173
-		if ( 0 < $meta_instances ) {
174
-			return true;
175
-		}
176
-
177
-		// If we are here, it means the current entity is not used at the moment
178
-		return false;
179
-	}
180
-
181
-	/**
182
-	 * Determines whether a given uri is an internal uri or not.
183
-	 *
184
-	 * @since 3.3.2
185
-	 *
186
-	 * @param int $uri An uri.
187
-	 *
188
-	 * @return true if the uri internal to the current dataset otherwise false.
189
-	 */
190
-	public function is_internal_uri( $uri ) {
191
-
192
-		return ( 0 === strrpos( $uri, wl_configuration_get_redlink_dataset_uri() ) );
193
-	}
194
-
195
-	/**
196
-	 * Find entity posts by the entity URI. Entity as searched by their entity URI or same as.
197
-	 *
198
-	 * @since 3.2.0
199
-	 *
200
-	 * @param string $uri The entity URI.
201
-	 *
202
-	 * @return WP_Post|null A WP_Post instance or null if not found.
203
-	 */
204
-	public function get_entity_post_by_uri( $uri ) {
205
-
206
-		// Check if we've been provided with a value otherwise return null.
207
-		if ( empty( $uri ) ) {
208
-			return null;
209
-		}
210
-
211
-		$query_args = array(
212
-			'posts_per_page' => 1,
213
-			'post_status'    => 'any',
214
-			'post_type'      => self::TYPE_NAME,
215
-			'meta_query'     => array(
216
-				array(
217
-					'key'     => WL_ENTITY_URL_META_NAME,
218
-					'value'   => $uri,
219
-					'compare' => '=',
220
-				),
221
-			),
222
-		);
223
-
224
-		// Only if the current uri is not an internal uri, entity search is
225
-		// performed also looking at sameAs values.
226
-		//
227
-		// This solve issues like https://github.com/insideout10/wordlift-plugin/issues/237
228
-		if ( ! $this->is_internal_uri( $uri ) ) {
229
-
230
-			$query_args['meta_query']['relation'] = 'OR';
231
-			$query_args['meta_query'][]           = array(
232
-				'key'     => Wordlift_Schema_Service::FIELD_SAME_AS,
233
-				'value'   => $uri,
234
-				'compare' => '=',
235
-			);
236
-		}
237
-
238
-		$query = new WP_Query( $query_args );
239
-
240
-		// Get the matching entity posts.
241
-		$posts = $query->get_posts();
242
-
243
-		// Return null if no post is found.
244
-		if ( 0 === count( $posts ) ) {
245
-			return null;
246
-		}
247
-
248
-		// Return the found post.
249
-		return $posts[0];
250
-	}
251
-
252
-	/**
253
-	 * Fires once a post has been saved. This function uses the $_REQUEST, therefore
254
-	 * we check that the post we're saving is the current post.
255
-	 *
256
-	 * @see   https://github.com/insideout10/wordlift-plugin/issues/363
257
-	 *
258
-	 * @since 3.2.0
259
-	 *
260
-	 * @param int     $post_id Post ID.
261
-	 * @param WP_Post $post    Post object.
262
-	 * @param bool    $update  Whether this is an existing post being updated or not.
263
-	 */
264
-	public function save_post( $post_id, $post, $update ) {
265
-
266
-		// Avoid doing anything if post is autosave or a revision.
267
-		if ( wp_is_post_autosave( $post ) || wp_is_post_revision( $post ) ) {
268
-			return;
269
-		}
270
-
271
-		// We're setting the alternative label that have been provided via the UI
272
-		// (in fact we're using $_REQUEST), while save_post may be also called
273
-		// programmatically by some other function: we need to check therefore if
274
-		// the $post_id in the save_post call matches the post id set in the request.
275
-		//
276
-		// If this is not the current post being saved or if it's not an entity, return.
277
-		if ( ! isset( $_REQUEST['post_ID'] ) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity( $post_id ) ) {
278
-			return;
279
-		}
280
-
281
-		// Get the alt labels from the request (or empty array).
282
-		$alt_labels = isset( $_REQUEST['wl_alternative_label'] ) ? $_REQUEST['wl_alternative_label'] : array();
283
-
284
-		// Set the alternative labels.
285
-		$this->set_alternative_labels( $post_id, $alt_labels );
286
-
287
-	}
288
-
289
-	/**
290
-	 * Set the alternative labels.
291
-	 *
292
-	 * @since 3.2.0
293
-	 *
294
-	 * @param int   $post_id    The post id.
295
-	 * @param array $alt_labels An array of labels.
296
-	 */
297
-	public function set_alternative_labels( $post_id, $alt_labels ) {
298
-
299
-		// Force $alt_labels to be an array
300
-		if ( ! is_array( $alt_labels ) ) {
301
-			$alt_labels = array( $alt_labels );
302
-		}
303
-
304
-		$this->log->debug( "Setting alternative labels [ post id :: $post_id ][ alt labels :: " . implode( ',', $alt_labels ) . " ]" );
305
-
306
-		// Delete all the existing alternate labels.
307
-		delete_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
308
-
309
-		// Set the alternative labels.
310
-		foreach ( $alt_labels as $alt_label ) {
311
-			if ( ! empty( $alt_label ) ) {
312
-				add_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label );
313
-			}
314
-		}
315
-
316
-	}
317
-
318
-	/**
319
-	 * Retrieve the alternate labels.
320
-	 *
321
-	 * @since 3.2.0
322
-	 *
323
-	 * @param int $post_id Post id.
324
-	 *
325
-	 * @return mixed An array  of alternative labels.
326
-	 */
327
-	public function get_alternative_labels( $post_id ) {
328
-
329
-		return get_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
330
-	}
331
-
332
-	/**
333
-	 * Retrieve the labels for an entity, i.e. the title + the synonyms.
334
-	 *
335
-	 * @since 3.12.0
336
-	 *
337
-	 * @param int $post_id The entity {@link WP_Post} id.
338
-	 *
339
-	 * @return array An array with the entity title and labels.
340
-	 */
341
-	public function get_labels( $post_id ) {
342
-
343
-		return array_merge( (array) get_the_title( $post_id ), $this->get_alternative_labels( $post_id ) );
344
-	}
345
-
346
-	/**
347
-	 * Fires before the permalink field in the edit form (this event is available in WP from 4.1.0).
348
-	 *
349
-	 * @since 3.2.0
350
-	 *
351
-	 * @param WP_Post $post Post object.
352
-	 */
353
-	public function edit_form_before_permalink( $post ) {
354
-
355
-		// If it's not an entity, return.
356
-		if ( ! $this->is_entity( $post->ID ) ) {
357
-			return;
358
-		}
359
-
360
-		// Print the input template.
361
-		$this->ui_service->print_template( 'wl-tmpl-alternative-label-input', $this->get_alternative_label_input() );
362
-
363
-		// Print all the currently set alternative labels.
364
-		foreach ( $this->get_alternative_labels( $post->ID ) as $alt_label ) {
365
-
366
-			echo $this->get_alternative_label_input( $alt_label );
367
-
368
-		};
369
-
370
-		// Print the button.
371
-		$this->ui_service->print_button( 'wl-add-alternative-labels-button', __( 'Add more titles', 'wordlift' ) );
372
-
373
-	}
374
-
375
-	/**
376
-	 * Get the URI for the entity with the specified post id.
377
-	 *
378
-	 * @since 3.6.0
379
-	 *
380
-	 * @param int $post_id The entity post id.
381
-	 *
382
-	 * @return null|string The entity URI or NULL if not found or the dataset URI is not configured.
383
-	 */
384
-	public function get_uri( $post_id ) {
385
-
386
-		// If a null is given, nothing to do
387
-		if ( null == $post_id ) {
388
-			return null;
389
-		}
390
-
391
-		$uri = get_post_meta( $post_id, WL_ENTITY_URL_META_NAME, true );
392
-
393
-		// If the dataset uri is not properly configured, null is returned
394
-		if ( '' === wl_configuration_get_redlink_dataset_uri() ) {
395
-			return null;
396
-		}
397
-
398
-		// Set the URI if it isn't set yet.
399
-		$post_status = get_post_status( $post_id );
400
-		if ( empty( $uri ) && 'auto-draft' !== $post_status && 'revision' !== $post_status ) {
401
-			$uri = wl_build_entity_uri( $post_id );
402
-			wl_set_entity_uri( $post_id, $uri );
403
-		}
404
-
405
-		return $uri;
406
-	}
407
-
408
-
409
-	/**
410
-	 * Get the alternative label input HTML code.
411
-	 *
412
-	 * @since 3.2.0
413
-	 *
414
-	 * @param string $value The input value.
415
-	 *
416
-	 * @return string The input HTML code.
417
-	 */
418
-	private function get_alternative_label_input( $value = '' ) {
419
-
420
-		return sprintf( self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr( $value ), __( 'Delete', 'wordlift' ) );
421
-	}
422
-
423
-	/**
424
-	 * Get the number of entity posts published in this blog.
425
-	 *
426
-	 * @since 3.6.0
427
-	 *
428
-	 * @return int The number of published entity posts.
429
-	 */
430
-	public function count() {
431
-
432
-		$count = wp_count_posts( self::TYPE_NAME );
433
-
434
-		return $count->publish;
435
-	}
436
-
437
-	/**
438
-	 * Create a new entity.
439
-	 *
440
-	 * @since 3.9.0
441
-	 *
442
-	 * @param string $name     The entity name.
443
-	 * @param string $type_uri The entity's type URI.
444
-	 * @param null   $logo     The entity logo id (or NULL if none).
445
-	 * @param string $status   The post status, by default 'publish'.
446
-	 *
447
-	 * @return int|WP_Error The entity post id or a {@link WP_Error} in case the `wp_insert_post` call fails.
448
-	 */
449
-	public function create( $name, $type_uri, $logo = null, $status = 'publish' ) {
450
-
451
-		// Create an entity for the publisher.
452
-		$post_id = wp_insert_post( array(
453
-			'post_type'    => self::TYPE_NAME,
454
-			'post_title'   => $name,
455
-			'post_status'  => $status,
456
-			'post_content' => '',
457
-		) );
458
-
459
-		// Return the error if any.
460
-		if ( is_wp_error( $post_id ) ) {
461
-			return $post_id;
462
-		}
463
-
464
-		// Set the entity logo.
465
-		if ( $logo && is_numeric( $logo ) ) {
466
-			set_post_thumbnail( $post_id, $logo );
467
-		}
468
-
469
-		// Set the entity type.
470
-		Wordlift_Entity_Type_Service::get_instance()->set( $post_id, $type_uri );
471
-
472
-		return $post_id;
473
-	}
474
-
475
-	/**
476
-	 * Get the entities related to the one with the specified id. By default only
477
-	 * published entities will be returned.
478
-	 *
479
-	 * @since 3.10.0
480
-	 *
481
-	 * @param int    $id          The post id.
482
-	 * @param string $post_status The target post status (default = publish).
483
-	 *
484
-	 * @return array An array of post ids.
485
-	 */
486
-	public function get_related_entities( $id, $post_status = 'publish' ) {
487
-
488
-		return wl_core_inner_get_related_entities( 'post_ids', $id, null, $post_status );
489
-	}
490
-
491
-	/**
492
-	 * Get the list of entities.
493
-	 *
494
-	 * @since 3.12.2
495
-	 *
496
-	 * @param array $params Custom parameters for WordPress' own {@link get_posts} function.
497
-	 *
498
-	 * @return array An array of entity posts.
499
-	 */
500
-	public function get( $params = array() ) {
501
-
502
-		// Set the defaults.
503
-		$defaults = array( 'post_type' => 'entity' );
504
-
505
-		// Merge the defaults with the provided parameters.
506
-		$args = wp_parse_args( $params, $defaults );
507
-
508
-		// Call the `get_posts` function.
509
-		return get_posts( $args );
510
-	}
54
+    /**
55
+     * A singleton instance of the Entity service.
56
+     *
57
+     * @since  3.2.0
58
+     * @access private
59
+     * @var \Wordlift_Entity_Service $instance A singleton instance of the Entity service.
60
+     */
61
+    private static $instance;
62
+
63
+    /**
64
+     * Create a Wordlift_Entity_Service instance.
65
+     *
66
+     * @since 3.2.0
67
+     *
68
+     * @param \Wordlift_UI_Service $ui_service The UI service.
69
+     */
70
+    public function __construct( $ui_service ) {
71
+
72
+        $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' );
73
+
74
+        // Set the UI service.
75
+        $this->ui_service = $ui_service;
76
+
77
+        // Set the singleton instance.
78
+        self::$instance = $this;
79
+
80
+    }
81
+
82
+    /**
83
+     * Get the singleton instance of the Entity service.
84
+     *
85
+     * @since 3.2.0
86
+     * @return \Wordlift_Entity_Service The singleton instance of the Entity service.
87
+     */
88
+    public static function get_instance() {
89
+
90
+        return self::$instance;
91
+    }
92
+
93
+    /**
94
+     * Determines whether a post is an entity or not.
95
+     *
96
+     * @since 3.1.0
97
+     *
98
+     * @param int $post_id A post id.
99
+     *
100
+     * @return bool Return true if the post is an entity otherwise false.
101
+     */
102
+    public function is_entity( $post_id ) {
103
+
104
+        return ( self::TYPE_NAME === get_post_type( $post_id ) );
105
+    }
106
+
107
+    /**
108
+     * Get the proper classification scope for a given entity post
109
+     *
110
+     * @since 3.5.0
111
+     *
112
+     * @param integer $post_id An entity post id.
113
+     *
114
+     * @return string Returns an uri.
115
+     */
116
+    public function get_classification_scope_for( $post_id ) {
117
+
118
+        if ( false === $this->is_entity( $post_id ) ) {
119
+            return null;
120
+        }
121
+        // Retrieve the entity type
122
+        $entity_type_arr = wl_entity_type_taxonomy_get_type( $post_id );
123
+        $entity_type     = str_replace( 'wl-', '', $entity_type_arr['css_class'] );
124
+        // Retrieve classification boxes configuration
125
+        $classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES );
126
+        foreach ( $classification_boxes as $cb ) {
127
+            if ( in_array( $entity_type, $cb['registeredTypes'] ) ) {
128
+                return $cb['id'];
129
+            }
130
+        }
131
+
132
+        // or null
133
+        return null;
134
+
135
+    }
136
+
137
+
138
+    public function is_used( $post_id ) {
139
+
140
+        if ( false === $this->is_entity( $post_id ) ) {
141
+            return null;
142
+        }
143
+        // Retrieve the post
144
+        $entity = get_post( $post_id );
145
+
146
+        global $wpdb;
147
+        // Retrieve Wordlift relation instances table name
148
+        $table_name = wl_core_get_relation_instances_table_name();
149
+
150
+        // Check is it's referenced / related to another post / entity
151
+        $stmt = $wpdb->prepare(
152
+            "SELECT COUNT(*) FROM $table_name WHERE  object_id = %d",
153
+            $entity->ID
154
+        );
155
+
156
+        // Perform the query
157
+        $relation_instances = (int) $wpdb->get_var( $stmt );
158
+        // If there is at least one relation instance for the current entity, then it's used
159
+        if ( 0 < $relation_instances ) {
160
+            return true;
161
+        }
162
+
163
+        // Check if the entity uri is used as meta_value
164
+        $stmt = $wpdb->prepare(
165
+            "SELECT COUNT(*) FROM $wpdb->postmeta WHERE post_id != %d AND meta_value = %s",
166
+            $entity->ID,
167
+            wl_get_entity_uri( $entity->ID )
168
+        );
169
+        // Perform the query
170
+        $meta_instances = (int) $wpdb->get_var( $stmt );
171
+
172
+        // If there is at least one meta that refers the current entity uri, then current entity is used
173
+        if ( 0 < $meta_instances ) {
174
+            return true;
175
+        }
176
+
177
+        // If we are here, it means the current entity is not used at the moment
178
+        return false;
179
+    }
180
+
181
+    /**
182
+     * Determines whether a given uri is an internal uri or not.
183
+     *
184
+     * @since 3.3.2
185
+     *
186
+     * @param int $uri An uri.
187
+     *
188
+     * @return true if the uri internal to the current dataset otherwise false.
189
+     */
190
+    public function is_internal_uri( $uri ) {
191
+
192
+        return ( 0 === strrpos( $uri, wl_configuration_get_redlink_dataset_uri() ) );
193
+    }
194
+
195
+    /**
196
+     * Find entity posts by the entity URI. Entity as searched by their entity URI or same as.
197
+     *
198
+     * @since 3.2.0
199
+     *
200
+     * @param string $uri The entity URI.
201
+     *
202
+     * @return WP_Post|null A WP_Post instance or null if not found.
203
+     */
204
+    public function get_entity_post_by_uri( $uri ) {
205
+
206
+        // Check if we've been provided with a value otherwise return null.
207
+        if ( empty( $uri ) ) {
208
+            return null;
209
+        }
210
+
211
+        $query_args = array(
212
+            'posts_per_page' => 1,
213
+            'post_status'    => 'any',
214
+            'post_type'      => self::TYPE_NAME,
215
+            'meta_query'     => array(
216
+                array(
217
+                    'key'     => WL_ENTITY_URL_META_NAME,
218
+                    'value'   => $uri,
219
+                    'compare' => '=',
220
+                ),
221
+            ),
222
+        );
223
+
224
+        // Only if the current uri is not an internal uri, entity search is
225
+        // performed also looking at sameAs values.
226
+        //
227
+        // This solve issues like https://github.com/insideout10/wordlift-plugin/issues/237
228
+        if ( ! $this->is_internal_uri( $uri ) ) {
229
+
230
+            $query_args['meta_query']['relation'] = 'OR';
231
+            $query_args['meta_query'][]           = array(
232
+                'key'     => Wordlift_Schema_Service::FIELD_SAME_AS,
233
+                'value'   => $uri,
234
+                'compare' => '=',
235
+            );
236
+        }
237
+
238
+        $query = new WP_Query( $query_args );
239
+
240
+        // Get the matching entity posts.
241
+        $posts = $query->get_posts();
242
+
243
+        // Return null if no post is found.
244
+        if ( 0 === count( $posts ) ) {
245
+            return null;
246
+        }
247
+
248
+        // Return the found post.
249
+        return $posts[0];
250
+    }
251
+
252
+    /**
253
+     * Fires once a post has been saved. This function uses the $_REQUEST, therefore
254
+     * we check that the post we're saving is the current post.
255
+     *
256
+     * @see   https://github.com/insideout10/wordlift-plugin/issues/363
257
+     *
258
+     * @since 3.2.0
259
+     *
260
+     * @param int     $post_id Post ID.
261
+     * @param WP_Post $post    Post object.
262
+     * @param bool    $update  Whether this is an existing post being updated or not.
263
+     */
264
+    public function save_post( $post_id, $post, $update ) {
265
+
266
+        // Avoid doing anything if post is autosave or a revision.
267
+        if ( wp_is_post_autosave( $post ) || wp_is_post_revision( $post ) ) {
268
+            return;
269
+        }
270
+
271
+        // We're setting the alternative label that have been provided via the UI
272
+        // (in fact we're using $_REQUEST), while save_post may be also called
273
+        // programmatically by some other function: we need to check therefore if
274
+        // the $post_id in the save_post call matches the post id set in the request.
275
+        //
276
+        // If this is not the current post being saved or if it's not an entity, return.
277
+        if ( ! isset( $_REQUEST['post_ID'] ) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity( $post_id ) ) {
278
+            return;
279
+        }
280
+
281
+        // Get the alt labels from the request (or empty array).
282
+        $alt_labels = isset( $_REQUEST['wl_alternative_label'] ) ? $_REQUEST['wl_alternative_label'] : array();
283
+
284
+        // Set the alternative labels.
285
+        $this->set_alternative_labels( $post_id, $alt_labels );
286
+
287
+    }
288
+
289
+    /**
290
+     * Set the alternative labels.
291
+     *
292
+     * @since 3.2.0
293
+     *
294
+     * @param int   $post_id    The post id.
295
+     * @param array $alt_labels An array of labels.
296
+     */
297
+    public function set_alternative_labels( $post_id, $alt_labels ) {
298
+
299
+        // Force $alt_labels to be an array
300
+        if ( ! is_array( $alt_labels ) ) {
301
+            $alt_labels = array( $alt_labels );
302
+        }
303
+
304
+        $this->log->debug( "Setting alternative labels [ post id :: $post_id ][ alt labels :: " . implode( ',', $alt_labels ) . " ]" );
305
+
306
+        // Delete all the existing alternate labels.
307
+        delete_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
308
+
309
+        // Set the alternative labels.
310
+        foreach ( $alt_labels as $alt_label ) {
311
+            if ( ! empty( $alt_label ) ) {
312
+                add_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label );
313
+            }
314
+        }
315
+
316
+    }
317
+
318
+    /**
319
+     * Retrieve the alternate labels.
320
+     *
321
+     * @since 3.2.0
322
+     *
323
+     * @param int $post_id Post id.
324
+     *
325
+     * @return mixed An array  of alternative labels.
326
+     */
327
+    public function get_alternative_labels( $post_id ) {
328
+
329
+        return get_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
330
+    }
331
+
332
+    /**
333
+     * Retrieve the labels for an entity, i.e. the title + the synonyms.
334
+     *
335
+     * @since 3.12.0
336
+     *
337
+     * @param int $post_id The entity {@link WP_Post} id.
338
+     *
339
+     * @return array An array with the entity title and labels.
340
+     */
341
+    public function get_labels( $post_id ) {
342
+
343
+        return array_merge( (array) get_the_title( $post_id ), $this->get_alternative_labels( $post_id ) );
344
+    }
345
+
346
+    /**
347
+     * Fires before the permalink field in the edit form (this event is available in WP from 4.1.0).
348
+     *
349
+     * @since 3.2.0
350
+     *
351
+     * @param WP_Post $post Post object.
352
+     */
353
+    public function edit_form_before_permalink( $post ) {
354
+
355
+        // If it's not an entity, return.
356
+        if ( ! $this->is_entity( $post->ID ) ) {
357
+            return;
358
+        }
359
+
360
+        // Print the input template.
361
+        $this->ui_service->print_template( 'wl-tmpl-alternative-label-input', $this->get_alternative_label_input() );
362
+
363
+        // Print all the currently set alternative labels.
364
+        foreach ( $this->get_alternative_labels( $post->ID ) as $alt_label ) {
365
+
366
+            echo $this->get_alternative_label_input( $alt_label );
367
+
368
+        };
369
+
370
+        // Print the button.
371
+        $this->ui_service->print_button( 'wl-add-alternative-labels-button', __( 'Add more titles', 'wordlift' ) );
372
+
373
+    }
374
+
375
+    /**
376
+     * Get the URI for the entity with the specified post id.
377
+     *
378
+     * @since 3.6.0
379
+     *
380
+     * @param int $post_id The entity post id.
381
+     *
382
+     * @return null|string The entity URI or NULL if not found or the dataset URI is not configured.
383
+     */
384
+    public function get_uri( $post_id ) {
385
+
386
+        // If a null is given, nothing to do
387
+        if ( null == $post_id ) {
388
+            return null;
389
+        }
390
+
391
+        $uri = get_post_meta( $post_id, WL_ENTITY_URL_META_NAME, true );
392
+
393
+        // If the dataset uri is not properly configured, null is returned
394
+        if ( '' === wl_configuration_get_redlink_dataset_uri() ) {
395
+            return null;
396
+        }
397
+
398
+        // Set the URI if it isn't set yet.
399
+        $post_status = get_post_status( $post_id );
400
+        if ( empty( $uri ) && 'auto-draft' !== $post_status && 'revision' !== $post_status ) {
401
+            $uri = wl_build_entity_uri( $post_id );
402
+            wl_set_entity_uri( $post_id, $uri );
403
+        }
404
+
405
+        return $uri;
406
+    }
407
+
408
+
409
+    /**
410
+     * Get the alternative label input HTML code.
411
+     *
412
+     * @since 3.2.0
413
+     *
414
+     * @param string $value The input value.
415
+     *
416
+     * @return string The input HTML code.
417
+     */
418
+    private function get_alternative_label_input( $value = '' ) {
419
+
420
+        return sprintf( self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr( $value ), __( 'Delete', 'wordlift' ) );
421
+    }
422
+
423
+    /**
424
+     * Get the number of entity posts published in this blog.
425
+     *
426
+     * @since 3.6.0
427
+     *
428
+     * @return int The number of published entity posts.
429
+     */
430
+    public function count() {
431
+
432
+        $count = wp_count_posts( self::TYPE_NAME );
433
+
434
+        return $count->publish;
435
+    }
436
+
437
+    /**
438
+     * Create a new entity.
439
+     *
440
+     * @since 3.9.0
441
+     *
442
+     * @param string $name     The entity name.
443
+     * @param string $type_uri The entity's type URI.
444
+     * @param null   $logo     The entity logo id (or NULL if none).
445
+     * @param string $status   The post status, by default 'publish'.
446
+     *
447
+     * @return int|WP_Error The entity post id or a {@link WP_Error} in case the `wp_insert_post` call fails.
448
+     */
449
+    public function create( $name, $type_uri, $logo = null, $status = 'publish' ) {
450
+
451
+        // Create an entity for the publisher.
452
+        $post_id = wp_insert_post( array(
453
+            'post_type'    => self::TYPE_NAME,
454
+            'post_title'   => $name,
455
+            'post_status'  => $status,
456
+            'post_content' => '',
457
+        ) );
458
+
459
+        // Return the error if any.
460
+        if ( is_wp_error( $post_id ) ) {
461
+            return $post_id;
462
+        }
463
+
464
+        // Set the entity logo.
465
+        if ( $logo && is_numeric( $logo ) ) {
466
+            set_post_thumbnail( $post_id, $logo );
467
+        }
468
+
469
+        // Set the entity type.
470
+        Wordlift_Entity_Type_Service::get_instance()->set( $post_id, $type_uri );
471
+
472
+        return $post_id;
473
+    }
474
+
475
+    /**
476
+     * Get the entities related to the one with the specified id. By default only
477
+     * published entities will be returned.
478
+     *
479
+     * @since 3.10.0
480
+     *
481
+     * @param int    $id          The post id.
482
+     * @param string $post_status The target post status (default = publish).
483
+     *
484
+     * @return array An array of post ids.
485
+     */
486
+    public function get_related_entities( $id, $post_status = 'publish' ) {
487
+
488
+        return wl_core_inner_get_related_entities( 'post_ids', $id, null, $post_status );
489
+    }
490
+
491
+    /**
492
+     * Get the list of entities.
493
+     *
494
+     * @since 3.12.2
495
+     *
496
+     * @param array $params Custom parameters for WordPress' own {@link get_posts} function.
497
+     *
498
+     * @return array An array of entity posts.
499
+     */
500
+    public function get( $params = array() ) {
501
+
502
+        // Set the defaults.
503
+        $defaults = array( 'post_type' => 'entity' );
504
+
505
+        // Merge the defaults with the provided parameters.
506
+        $args = wp_parse_args( $params, $defaults );
507
+
508
+        // Call the `get_posts` function.
509
+        return get_posts( $args );
510
+    }
511 511
 
512 512
 }
Please login to merge, or discard this patch.
src/includes/class-wordlift-entity-post-type-service.php 2 patches
Indentation   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -16,149 +16,149 @@
 block discarded – undo
16 16
  */
17 17
 class Wordlift_Entity_Post_Type_Service {
18 18
 
19
-	/**
20
-	 * The entity post type.
21
-	 *
22
-	 * @since  3.6.0
23
-	 * @access private
24
-	 * @var string $post_type The entity post type.
25
-	 */
26
-	private $post_type;
27
-
28
-	/**
29
-	 * The entity type slug.
30
-	 *
31
-	 * @since  3.6.0
32
-	 * @access private
33
-	 * @var string $slug The entity type slug.
34
-	 */
35
-	private $slug;
36
-
37
-	/**
38
-	 * A singleton instance of the entity type service.
39
-	 *
40
-	 * @since  3.6.0
41
-	 * @access private
42
-	 * @var Wordlift_Entity_Post_Type_Service
43
-	 */
44
-	private static $instance;
45
-
46
-	/**
47
-	 * Create an entity type service instance.
48
-	 *
49
-	 * @since 3.6.0
50
-	 *
51
-	 * @param string $post_type The post type, e.g. entity.
52
-	 * @param string $slug      The entity type slug, if the slug is empty, the default slug will be used.
53
-	 */
54
-	public function __construct( $post_type, $slug ) {
55
-
56
-		$this->post_type = $post_type;
57
-
58
-		// We cannot assign an empty slug to the register_post_type function, therefore if the slug is empty we default
59
-		// to the type name.
60
-		$this->slug = $slug ?: $post_type;
61
-
62
-		self::$instance = $this;
63
-
64
-	}
65
-
66
-	/**
67
-	 * Get the entity type service singleton instance.
68
-	 *
69
-	 * @since 3.6.0
70
-	 *
71
-	 * @return Wordlift_Entity_Post_Type_Service The entity type service singleton instance.
72
-	 */
73
-	public static function get_instance() {
74
-
75
-		return self::$instance;
76
-	}
77
-
78
-	/**
79
-	 * Get the entity type slug.
80
-	 *
81
-	 * @since 3.6.0
82
-	 *
83
-	 * @return string The entity type slug.
84
-	 */
85
-	public function get_slug() {
86
-
87
-		return $this->slug;
88
-	}
89
-
90
-	/**
91
-	 * Get the entity post type name.
92
-	 *
93
-	 * @since 3.6.0
94
-	 *
95
-	 * @return string The entity post type.
96
-	 */
97
-	public function get_post_type() {
98
-
99
-		return $this->post_type;
100
-	}
101
-
102
-
103
-	/**
104
-	 * Register the WordLift entity post type. This method is hooked to WordPress' init action.
105
-	 *
106
-	 * @since 3.6.0
107
-	 */
108
-	public function register() {
109
-
110
-		$labels = array(
111
-			'name'               => _x( 'Vocabulary', 'post type general name', 'wordlift' ),
112
-			'singular_name'      => _x( 'Entity', 'post type singular name', 'wordlift' ),
113
-			'add_new'            => _x( 'Add New Entity', 'entity', 'wordlift' ),
114
-			'add_new_item'       => __( 'Add New Entity', 'wordlift' ),
115
-			'edit_item'          => __( 'Edit Entity', 'wordlift' ),
116
-			'new_item'           => __( 'New Entity', 'wordlift' ),
117
-			'all_items'          => __( 'All Entities', 'wordlift' ),
118
-			'view_item'          => __( 'View Entity', 'wordlift' ),
119
-			'search_items'       => __( 'Search in Vocabulary', 'wordlift' ),
120
-			'not_found'          => __( 'No entities found', 'wordlift' ),
121
-			'not_found_in_trash' => __( 'No entities found in the Trash', 'wordlift' ),
122
-			'parent_item_colon'  => '',
123
-			'menu_name'          => __( 'Vocabulary', 'wordlift' ),
124
-		);
125
-
126
-		$args = array(
127
-			'labels'        => $labels,
128
-			'description'   => 'Holds our vocabulary (set of entities) and entity specific data',
129
-			'public'        => true,
130
-			'menu_position' => 20,
131
-			// after the pages menu.
132
-			// Add support for 'authors' and 'revisions':
133
-			// * see https://github.com/insideout10/wordlift-plugin/issues/395
134
-			// * see https://github.com/insideout10/wordlift-plugin/issues/376
135
-			'supports'      => array(
136
-				'title',
137
-				'editor',
138
-				'thumbnail',
139
-				'excerpt',
140
-				'comments',
141
-				'author',
142
-				'revisions',
143
-			),
144
-			'has_archive'   => true,
145
-			'menu_icon'     => WP_CONTENT_URL . '/plugins/wordlift/images/svg/wl-vocabulary-icon.svg',
146
-			// Although we define our slug here, we further manage linking to entities using the Wordlift_Entity_Link_Service.
147
-			'rewrite'       => array( 'slug' => $this->slug ),
148
-			'capability_type'	=> array( 'wordlift_entity', 'wordlift_entities' ),
149
-		);
150
-
151
-		register_post_type( $this->post_type, $args );
152
-
153
-		// Enable WP's standard `category` taxonomy for entities.
154
-		//
155
-		// While this enables editors to bind entities to the WP posts' category
156
-		// taxonomy, in Wordlift_Category_Taxonomy_Service we also need to alter
157
-		// WP's main category query to include the `entity` post type.
158
-		//
159
-		// See https://github.com/insideout10/wordlift-plugin/issues/442
160
-		register_taxonomy_for_object_type( 'category', $this->post_type );
161
-
162
-	}
19
+    /**
20
+     * The entity post type.
21
+     *
22
+     * @since  3.6.0
23
+     * @access private
24
+     * @var string $post_type The entity post type.
25
+     */
26
+    private $post_type;
27
+
28
+    /**
29
+     * The entity type slug.
30
+     *
31
+     * @since  3.6.0
32
+     * @access private
33
+     * @var string $slug The entity type slug.
34
+     */
35
+    private $slug;
36
+
37
+    /**
38
+     * A singleton instance of the entity type service.
39
+     *
40
+     * @since  3.6.0
41
+     * @access private
42
+     * @var Wordlift_Entity_Post_Type_Service
43
+     */
44
+    private static $instance;
45
+
46
+    /**
47
+     * Create an entity type service instance.
48
+     *
49
+     * @since 3.6.0
50
+     *
51
+     * @param string $post_type The post type, e.g. entity.
52
+     * @param string $slug      The entity type slug, if the slug is empty, the default slug will be used.
53
+     */
54
+    public function __construct( $post_type, $slug ) {
55
+
56
+        $this->post_type = $post_type;
57
+
58
+        // We cannot assign an empty slug to the register_post_type function, therefore if the slug is empty we default
59
+        // to the type name.
60
+        $this->slug = $slug ?: $post_type;
61
+
62
+        self::$instance = $this;
63
+
64
+    }
65
+
66
+    /**
67
+     * Get the entity type service singleton instance.
68
+     *
69
+     * @since 3.6.0
70
+     *
71
+     * @return Wordlift_Entity_Post_Type_Service The entity type service singleton instance.
72
+     */
73
+    public static function get_instance() {
74
+
75
+        return self::$instance;
76
+    }
77
+
78
+    /**
79
+     * Get the entity type slug.
80
+     *
81
+     * @since 3.6.0
82
+     *
83
+     * @return string The entity type slug.
84
+     */
85
+    public function get_slug() {
86
+
87
+        return $this->slug;
88
+    }
89
+
90
+    /**
91
+     * Get the entity post type name.
92
+     *
93
+     * @since 3.6.0
94
+     *
95
+     * @return string The entity post type.
96
+     */
97
+    public function get_post_type() {
98
+
99
+        return $this->post_type;
100
+    }
101
+
102
+
103
+    /**
104
+     * Register the WordLift entity post type. This method is hooked to WordPress' init action.
105
+     *
106
+     * @since 3.6.0
107
+     */
108
+    public function register() {
109
+
110
+        $labels = array(
111
+            'name'               => _x( 'Vocabulary', 'post type general name', 'wordlift' ),
112
+            'singular_name'      => _x( 'Entity', 'post type singular name', 'wordlift' ),
113
+            'add_new'            => _x( 'Add New Entity', 'entity', 'wordlift' ),
114
+            'add_new_item'       => __( 'Add New Entity', 'wordlift' ),
115
+            'edit_item'          => __( 'Edit Entity', 'wordlift' ),
116
+            'new_item'           => __( 'New Entity', 'wordlift' ),
117
+            'all_items'          => __( 'All Entities', 'wordlift' ),
118
+            'view_item'          => __( 'View Entity', 'wordlift' ),
119
+            'search_items'       => __( 'Search in Vocabulary', 'wordlift' ),
120
+            'not_found'          => __( 'No entities found', 'wordlift' ),
121
+            'not_found_in_trash' => __( 'No entities found in the Trash', 'wordlift' ),
122
+            'parent_item_colon'  => '',
123
+            'menu_name'          => __( 'Vocabulary', 'wordlift' ),
124
+        );
125
+
126
+        $args = array(
127
+            'labels'        => $labels,
128
+            'description'   => 'Holds our vocabulary (set of entities) and entity specific data',
129
+            'public'        => true,
130
+            'menu_position' => 20,
131
+            // after the pages menu.
132
+            // Add support for 'authors' and 'revisions':
133
+            // * see https://github.com/insideout10/wordlift-plugin/issues/395
134
+            // * see https://github.com/insideout10/wordlift-plugin/issues/376
135
+            'supports'      => array(
136
+                'title',
137
+                'editor',
138
+                'thumbnail',
139
+                'excerpt',
140
+                'comments',
141
+                'author',
142
+                'revisions',
143
+            ),
144
+            'has_archive'   => true,
145
+            'menu_icon'     => WP_CONTENT_URL . '/plugins/wordlift/images/svg/wl-vocabulary-icon.svg',
146
+            // Although we define our slug here, we further manage linking to entities using the Wordlift_Entity_Link_Service.
147
+            'rewrite'       => array( 'slug' => $this->slug ),
148
+            'capability_type'	=> array( 'wordlift_entity', 'wordlift_entities' ),
149
+        );
150
+
151
+        register_post_type( $this->post_type, $args );
152
+
153
+        // Enable WP's standard `category` taxonomy for entities.
154
+        //
155
+        // While this enables editors to bind entities to the WP posts' category
156
+        // taxonomy, in Wordlift_Category_Taxonomy_Service we also need to alter
157
+        // WP's main category query to include the `entity` post type.
158
+        //
159
+        // See https://github.com/insideout10/wordlift-plugin/issues/442
160
+        register_taxonomy_for_object_type( 'category', $this->post_type );
161
+
162
+    }
163 163
 
164 164
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * @param string $post_type The post type, e.g. entity.
52 52
 	 * @param string $slug      The entity type slug, if the slug is empty, the default slug will be used.
53 53
 	 */
54
-	public function __construct( $post_type, $slug ) {
54
+	public function __construct($post_type, $slug) {
55 55
 
56 56
 		$this->post_type = $post_type;
57 57
 
@@ -108,19 +108,19 @@  discard block
 block discarded – undo
108 108
 	public function register() {
109 109
 
110 110
 		$labels = array(
111
-			'name'               => _x( 'Vocabulary', 'post type general name', 'wordlift' ),
112
-			'singular_name'      => _x( 'Entity', 'post type singular name', 'wordlift' ),
113
-			'add_new'            => _x( 'Add New Entity', 'entity', 'wordlift' ),
114
-			'add_new_item'       => __( 'Add New Entity', 'wordlift' ),
115
-			'edit_item'          => __( 'Edit Entity', 'wordlift' ),
116
-			'new_item'           => __( 'New Entity', 'wordlift' ),
117
-			'all_items'          => __( 'All Entities', 'wordlift' ),
118
-			'view_item'          => __( 'View Entity', 'wordlift' ),
119
-			'search_items'       => __( 'Search in Vocabulary', 'wordlift' ),
120
-			'not_found'          => __( 'No entities found', 'wordlift' ),
121
-			'not_found_in_trash' => __( 'No entities found in the Trash', 'wordlift' ),
111
+			'name'               => _x('Vocabulary', 'post type general name', 'wordlift'),
112
+			'singular_name'      => _x('Entity', 'post type singular name', 'wordlift'),
113
+			'add_new'            => _x('Add New Entity', 'entity', 'wordlift'),
114
+			'add_new_item'       => __('Add New Entity', 'wordlift'),
115
+			'edit_item'          => __('Edit Entity', 'wordlift'),
116
+			'new_item'           => __('New Entity', 'wordlift'),
117
+			'all_items'          => __('All Entities', 'wordlift'),
118
+			'view_item'          => __('View Entity', 'wordlift'),
119
+			'search_items'       => __('Search in Vocabulary', 'wordlift'),
120
+			'not_found'          => __('No entities found', 'wordlift'),
121
+			'not_found_in_trash' => __('No entities found in the Trash', 'wordlift'),
122 122
 			'parent_item_colon'  => '',
123
-			'menu_name'          => __( 'Vocabulary', 'wordlift' ),
123
+			'menu_name'          => __('Vocabulary', 'wordlift'),
124 124
 		);
125 125
 
126 126
 		$args = array(
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
 				'revisions',
143 143
 			),
144 144
 			'has_archive'   => true,
145
-			'menu_icon'     => WP_CONTENT_URL . '/plugins/wordlift/images/svg/wl-vocabulary-icon.svg',
145
+			'menu_icon'     => WP_CONTENT_URL.'/plugins/wordlift/images/svg/wl-vocabulary-icon.svg',
146 146
 			// Although we define our slug here, we further manage linking to entities using the Wordlift_Entity_Link_Service.
147
-			'rewrite'       => array( 'slug' => $this->slug ),
148
-			'capability_type'	=> array( 'wordlift_entity', 'wordlift_entities' ),
147
+			'rewrite'       => array('slug' => $this->slug),
148
+			'capability_type'	=> array('wordlift_entity', 'wordlift_entities'),
149 149
 		);
150 150
 
151
-		register_post_type( $this->post_type, $args );
151
+		register_post_type($this->post_type, $args);
152 152
 
153 153
 		// Enable WP's standard `category` taxonomy for entities.
154 154
 		//
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 		// WP's main category query to include the `entity` post type.
158 158
 		//
159 159
 		// See https://github.com/insideout10/wordlift-plugin/issues/442
160
-		register_taxonomy_for_object_type( 'category', $this->post_type );
160
+		register_taxonomy_for_object_type('category', $this->post_type);
161 161
 
162 162
 	}
163 163
 
Please login to merge, or discard this patch.
src/includes/class-wordlift.php 2 patches
Indentation   +1128 added lines, -1128 removed lines patch added patch discarded remove patch
@@ -29,1237 +29,1237 @@
 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
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
711
-
712
-		/**
713
-		 * Load the WordLift key validation service.
714
-		 */
715
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
716
-
717
-		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
718
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
719
-
720
-		// Load the `Wordlift_Event_Entity_Page_Service` class definition.
721
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-event-entity-page-service.php';
722
-
723
-		/** Adapters. */
724
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
725
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
726
-
727
-		/** Async Tasks. */
728
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/wp-async-task.php';
729
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
730
-
731
-		/**
732
-		 * The class responsible for defining all actions that occur in the admin area.
733
-		 */
734
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
735
-
736
-		/**
737
-		 * The class to customize the entity list admin page.
738
-		 */
739
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
740
-
741
-		/**
742
-		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
743
-		 */
744
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
745
-
746
-		/**
747
-		 * The Notice service.
748
-		 */
749
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
750
-
751
-		/**
752
-		 * The PrimaShop adapter.
753
-		 */
754
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
755
-
756
-		/**
757
-		 * The WordLift Dashboard service.
758
-		 */
759
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
760
-
761
-		/**
762
-		 * The admin 'Install wizard' page.
763
-		 */
764
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
765
-
766
-		/**
767
-		 * The WordLift entity type list admin page controller.
768
-		 */
769
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
770
-
771
-		/**
772
-		 * The WordLift entity type settings admin page controller.
773
-		 */
774
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
775
-
776
-		/**
777
-		 * The admin 'Download Your Data' page.
778
-		 */
779
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
780
-
781
-		/**
782
-		 * The admin 'Download Your Data' page.
783
-		 */
784
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
785
-
786
-		/**
787
-		 * The admin 'WordLift Settings' page.
788
-		 */
789
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
790
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
791
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
792
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
793
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
794
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
795
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
796
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
797
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
798
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
799
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
800
-
801
-		/** Admin Pages */
802
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
803
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
804
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
805
-
806
-		/**
807
-		 * The class responsible for defining all actions that occur in the public-facing
808
-		 * side of the site.
809
-		 */
810
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
811
-
812
-		/**
813
-		 * The shortcode abstract class.
814
-		 */
815
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
816
-
817
-		/**
818
-		 * The Timeline shortcode.
819
-		 */
820
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.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
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
711
+
712
+        /**
713
+         * Load the WordLift key validation service.
714
+         */
715
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
716
+
717
+        // Load the `Wordlift_Category_Taxonomy_Service` class definition.
718
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
719
+
720
+        // Load the `Wordlift_Event_Entity_Page_Service` class definition.
721
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-event-entity-page-service.php';
722
+
723
+        /** Adapters. */
724
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
725
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
726
+
727
+        /** Async Tasks. */
728
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/wp-async-task.php';
729
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
730
+
731
+        /**
732
+         * The class responsible for defining all actions that occur in the admin area.
733
+         */
734
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
735
+
736
+        /**
737
+         * The class to customize the entity list admin page.
738
+         */
739
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
740
+
741
+        /**
742
+         * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
743
+         */
744
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
745
+
746
+        /**
747
+         * The Notice service.
748
+         */
749
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
750
+
751
+        /**
752
+         * The PrimaShop adapter.
753
+         */
754
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
755
+
756
+        /**
757
+         * The WordLift Dashboard service.
758
+         */
759
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
760
+
761
+        /**
762
+         * The admin 'Install wizard' page.
763
+         */
764
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
765
+
766
+        /**
767
+         * The WordLift entity type list admin page controller.
768
+         */
769
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
770
+
771
+        /**
772
+         * The WordLift entity type settings admin page controller.
773
+         */
774
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
775
+
776
+        /**
777
+         * The admin 'Download Your Data' page.
778
+         */
779
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
780
+
781
+        /**
782
+         * The admin 'Download Your Data' page.
783
+         */
784
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
785
+
786
+        /**
787
+         * The admin 'WordLift Settings' page.
788
+         */
789
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
790
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
791
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
792
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
793
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
794
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
795
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
796
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
797
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
798
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
799
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
800
+
801
+        /** Admin Pages */
802
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
803
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
804
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
805
+
806
+        /**
807
+         * The class responsible for defining all actions that occur in the public-facing
808
+         * side of the site.
809
+         */
810
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
811
+
812
+        /**
813
+         * The shortcode abstract class.
814
+         */
815
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
816
+
817
+        /**
818
+         * The Timeline shortcode.
819
+         */
820
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
821
+
822
+        /**
823
+         * The Navigator shortcode.
824
+         */
825
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
826
+
827
+        /**
828
+         * The chord shortcode.
829
+         */
830
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
831
+
832
+        /**
833
+         * The geomap shortcode.
834
+         */
835
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
836
+
837
+        /**
838
+         * The entity cloud shortcode.
839
+         */
840
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
841
+
842
+        /**
843
+         * The ShareThis service.
844
+         */
845
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
846
+
847
+        /**
848
+         * The SEO service.
849
+         */
850
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
821 851
 
822
-		/**
823
-		 * The Navigator shortcode.
824
-		 */
825
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
826
-
827
-		/**
828
-		 * The chord shortcode.
829
-		 */
830
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
831
-
832
-		/**
833
-		 * The geomap shortcode.
834
-		 */
835
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
836
-
837
-		/**
838
-		 * The entity cloud shortcode.
839
-		 */
840
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
841
-
842
-		/**
843
-		 * The ShareThis service.
844
-		 */
845
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
846
-
847
-		/**
848
-		 * The SEO service.
849
-		 */
850
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
851
-
852
-		/**
853
-		 * The AMP service.
854
-		 */
855
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
852
+        /**
853
+         * The AMP service.
854
+         */
855
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
856 856
 
857
-		/** Widgets */
858
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
859
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
857
+        /** Widgets */
858
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
859
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
860 860
 
861
-		$this->loader = new Wordlift_Loader();
861
+        $this->loader = new Wordlift_Loader();
862 862
 
863
-		// Instantiate a global logger.
864
-		global $wl_logger;
865
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
863
+        // Instantiate a global logger.
864
+        global $wl_logger;
865
+        $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
866 866
 
867
-		// Create the configuration service.
868
-		$this->configuration_service = new Wordlift_Configuration_Service();
867
+        // Create the configuration service.
868
+        $this->configuration_service = new Wordlift_Configuration_Service();
869 869
 
870
-		// Create an entity type service instance. It'll be later bound to the init action.
871
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
870
+        // Create an entity type service instance. It'll be later bound to the init action.
871
+        $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
872 872
 
873
-		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
874
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
873
+        // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
874
+        $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
875 875
 
876
-		// Create an instance of the UI service.
877
-		$this->ui_service = new Wordlift_UI_Service();
876
+        // Create an instance of the UI service.
877
+        $this->ui_service = new Wordlift_UI_Service();
878 878
 
879
-		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
880
-		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
879
+        // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
880
+        $this->thumbnail_service = new Wordlift_Thumbnail_Service();
881 881
 
882
-		$this->sparql_service = new Wordlift_Sparql_Service();
882
+        $this->sparql_service = new Wordlift_Sparql_Service();
883 883
 
884
-		// Create an instance of the Schema service.
885
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
886
-		$this->schema_service        = new Wordlift_Schema_Service();
884
+        // Create an instance of the Schema service.
885
+        $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
886
+        $this->schema_service        = new Wordlift_Schema_Service();
887 887
 
888
-		// Create an instance of the Notice service.
889
-		$this->notice_service = new Wordlift_Notice_Service();
888
+        // Create an instance of the Notice service.
889
+        $this->notice_service = new Wordlift_Notice_Service();
890 890
 
891
-		// Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page.
892
-		$this->entity_service = new Wordlift_Entity_Service( $this->ui_service );
891
+        // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page.
892
+        $this->entity_service = new Wordlift_Entity_Service( $this->ui_service );
893 893
 
894
-		// Create an instance of the User service.
895
-		$this->user_service = new Wordlift_User_Service();
894
+        // Create an instance of the User service.
895
+        $this->user_service = new Wordlift_User_Service();
896 896
 
897
-		// Create a new instance of the Timeline service and Timeline shortcode.
898
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
897
+        // Create a new instance of the Timeline service and Timeline shortcode.
898
+        $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
899 899
 
900
-		// Create a new instance of the Redirect service.
901
-		$this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service );
900
+        // Create a new instance of the Redirect service.
901
+        $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service );
902 902
 
903
-		// Initialize the shortcodes.
904
-		new Wordlift_Navigator_Shortcode();
905
-		new Wordlift_Chord_Shortcode();
906
-		new Wordlift_Geomap_Shortcode();
907
-		new Wordlift_Timeline_Shortcode();
908
-		new Wordlift_Related_Entities_Cloud_Shortcode();
903
+        // Initialize the shortcodes.
904
+        new Wordlift_Navigator_Shortcode();
905
+        new Wordlift_Chord_Shortcode();
906
+        new Wordlift_Geomap_Shortcode();
907
+        new Wordlift_Timeline_Shortcode();
908
+        new Wordlift_Related_Entities_Cloud_Shortcode();
909 909
 
910
-		// Initialize the SEO service.
911
-		new Wordlift_Seo_Service();
910
+        // Initialize the SEO service.
911
+        new Wordlift_Seo_Service();
912 912
 
913
-		// Initialize the AMP service.
914
-		new Wordlift_AMP_Service();
913
+        // Initialize the AMP service.
914
+        new Wordlift_AMP_Service();
915 915
 
916
-		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
916
+        $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
917 917
 
918
-		$this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service();
918
+        $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service();
919 919
 
920
-		// Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
921
-		$this->sharethis_service = new Wordlift_ShareThis_Service();
920
+        // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
921
+        $this->sharethis_service = new Wordlift_ShareThis_Service();
922 922
 
923
-		// Create an instance of the PrimaShop adapter.
924
-		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
923
+        // Create an instance of the PrimaShop adapter.
924
+        $this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
925 925
 
926
-		// Create an import service instance to hook later to WP's import function.
927
-		$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
+        // Create an import service instance to hook later to WP's import function.
927
+        $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() );
928 928
 
929
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
929
+        $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
930 930
 
931
-		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
932
-		$this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service );
931
+        // Create a Rebuild Service instance, which we'll later bound to an ajax call.
932
+        $this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service );
933 933
 
934
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
934
+        $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
935 935
 
936
-		// Create the entity rating service.
937
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
936
+        // Create the entity rating service.
937
+        $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
938 938
 
939
-		// Create entity list customization (wp-admin/edit.php)
940
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
939
+        // Create entity list customization (wp-admin/edit.php)
940
+        $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
941 941
 
942
-		// Create a new instance of the Redirect service.
943
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service );
942
+        // Create a new instance of the Redirect service.
943
+        $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service );
944 944
 
945
-		$this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service );
946
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
945
+        $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service );
946
+        $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
947 947
 
948
-		$attachment_service = new Wordlift_Attachment_Service();
948
+        $attachment_service = new Wordlift_Attachment_Service();
949 949
 
950
-		// Instantiate the JSON-LD service.
951
-		$property_getter                       = Wordlift_Property_Getter_Factory::create( $this->entity_service );
952
-		$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 );
953
-		$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 );
954
-		$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 );
955
-		$this->jsonld_service                  = new Wordlift_Jsonld_Service( $this->entity_service, $this->postid_to_jsonld_converter );
950
+        // Instantiate the JSON-LD service.
951
+        $property_getter                       = Wordlift_Property_Getter_Factory::create( $this->entity_service );
952
+        $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 );
953
+        $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 );
954
+        $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 );
955
+        $this->jsonld_service                  = new Wordlift_Jsonld_Service( $this->entity_service, $this->postid_to_jsonld_converter );
956 956
 
957
-		// Create an instance of the Key Validation service. This service is later hooked to provide an AJAX call (only for admins).
958
-		$this->key_validation_service = new Wordlift_Key_Validation_Service();
957
+        // Create an instance of the Key Validation service. This service is later hooked to provide an AJAX call (only for admins).
958
+        $this->key_validation_service = new Wordlift_Key_Validation_Service();
959 959
 
960
-		// Create an instance of the Publisher Service and the AJAX Adapter.
961
-		$publisher_service            = new Wordlift_Publisher_Service();
962
-		$this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $publisher_service );
960
+        // Create an instance of the Publisher Service and the AJAX Adapter.
961
+        $publisher_service            = new Wordlift_Publisher_Service();
962
+        $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $publisher_service );
963 963
 
964
-		/** Adapters. */
965
-		$this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this );
964
+        /** Adapters. */
965
+        $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this );
966 966
 
967
-		/** Async Tasks. */
968
-		new Wordlift_Sparql_Query_Async_Task();
967
+        /** Async Tasks. */
968
+        new Wordlift_Sparql_Query_Async_Task();
969 969
 
970
-		/** WordPress Admin UI. */
970
+        /** WordPress Admin UI. */
971 971
 
972
-		// UI elements.
973
-		$this->input_element           = new Wordlift_Admin_Input_Element();
974
-		$this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
975
-		$this->select2_element         = new Wordlift_Admin_Select2_Element();
976
-		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
977
-		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
978
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element );
979
-		$this->author_element          = new Wordlift_Admin_Author_Element( $publisher_service, $this->select2_element );
972
+        // UI elements.
973
+        $this->input_element           = new Wordlift_Admin_Input_Element();
974
+        $this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
975
+        $this->select2_element         = new Wordlift_Admin_Select2_Element();
976
+        $this->language_select_element = new Wordlift_Admin_Language_Select_Element();
977
+        $tabs_element                  = new Wordlift_Admin_Tabs_Element();
978
+        $this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element );
979
+        $this->author_element          = new Wordlift_Admin_Author_Element( $publisher_service, $this->select2_element );
980 980
 
981
-		$this->download_your_data_page   = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
982
-		$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 );
983
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
981
+        $this->download_your_data_page   = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
982
+        $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 );
983
+        $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
984 984
 
985
-		// Pages.
986
-		new Wordlift_Admin_Post_Edit_Page( $this );
985
+        // Pages.
986
+        new Wordlift_Admin_Post_Edit_Page( $this );
987 987
 
988
-		// create an instance of the entity type list admin page controller.
989
-		$this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
988
+        // create an instance of the entity type list admin page controller.
989
+        $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
990 990
 
991
-		// create an instance of the entity type etting admin page controller.
992
-		$this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
991
+        // create an instance of the entity type etting admin page controller.
992
+        $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
993 993
 
994
-		/** Widgets */
995
-		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
994
+        /** Widgets */
995
+        $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
996 996
 
997
-		//** WordPress Admin */
998
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
999
-		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
997
+        //** WordPress Admin */
998
+        $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
999
+        $this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1000 1000
 
1001
-		// Create an instance of the install wizard.
1002
-		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1001
+        // Create an instance of the install wizard.
1002
+        $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1003 1003
 
1004
-		// Create an instance of the content filter service.
1005
-		$this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service );
1004
+        // Create an instance of the content filter service.
1005
+        $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service );
1006 1006
 
1007
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1007
+        $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1008 1008
 
1009
-		// User Profile.
1010
-		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1009
+        // User Profile.
1010
+        new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1011 1011
 
1012
-		$this->event_entity_page_service = new Wordlift_Event_Entity_Page_Service();
1012
+        $this->event_entity_page_service = new Wordlift_Event_Entity_Page_Service();
1013 1013
 
1014
-		// Load the debug service if WP is in debug mode.
1015
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1016
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1017
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1018
-		}
1014
+        // Load the debug service if WP is in debug mode.
1015
+        if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1016
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1017
+            new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1018
+        }
1019 1019
 
1020
-	}
1020
+    }
1021 1021
 
1022
-	/**
1023
-	 * Define the locale for this plugin for internationalization.
1024
-	 *
1025
-	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1026
-	 * with WordPress.
1027
-	 *
1028
-	 * @since    1.0.0
1029
-	 * @access   private
1030
-	 */
1031
-	private function set_locale() {
1022
+    /**
1023
+     * Define the locale for this plugin for internationalization.
1024
+     *
1025
+     * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1026
+     * with WordPress.
1027
+     *
1028
+     * @since    1.0.0
1029
+     * @access   private
1030
+     */
1031
+    private function set_locale() {
1032 1032
 
1033
-		$plugin_i18n = new Wordlift_i18n();
1034
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1033
+        $plugin_i18n = new Wordlift_i18n();
1034
+        $plugin_i18n->set_domain( $this->get_plugin_name() );
1035 1035
 
1036
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1036
+        $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1037 1037
 
1038
-	}
1038
+    }
1039 1039
 
1040
-	/**
1041
-	 * Register all of the hooks related to the admin area functionality
1042
-	 * of the plugin.
1043
-	 *
1044
-	 * @since    1.0.0
1045
-	 * @access   private
1046
-	 */
1047
-	private function define_admin_hooks() {
1040
+    /**
1041
+     * Register all of the hooks related to the admin area functionality
1042
+     * of the plugin.
1043
+     *
1044
+     * @since    1.0.0
1045
+     * @access   private
1046
+     */
1047
+    private function define_admin_hooks() {
1048 1048
 
1049
-		$plugin_admin = new Wordlift_Admin(
1050
-			$this->get_plugin_name(),
1051
-			$this->get_version(),
1052
-			$this->configuration_service,
1053
-			$this->notice_service,
1054
-			$this->user_service
1055
-		);
1049
+        $plugin_admin = new Wordlift_Admin(
1050
+            $this->get_plugin_name(),
1051
+            $this->get_version(),
1052
+            $this->configuration_service,
1053
+            $this->notice_service,
1054
+            $this->user_service
1055
+        );
1056 1056
 
1057
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1058
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1057
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1058
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1059 1059
 
1060
-		// Hook the init action to the Topic Taxonomy service.
1061
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1060
+        // Hook the init action to the Topic Taxonomy service.
1061
+        $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1062 1062
 
1063
-		// Hook the deleted_post_meta action to the Thumbnail service.
1064
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1063
+        // Hook the deleted_post_meta action to the Thumbnail service.
1064
+        $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1065 1065
 
1066
-		// Hook the added_post_meta action to the Thumbnail service.
1067
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1066
+        // Hook the added_post_meta action to the Thumbnail service.
1067
+        $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1068 1068
 
1069
-		// Hook the updated_post_meta action to the Thumbnail service.
1070
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1069
+        // Hook the updated_post_meta action to the Thumbnail service.
1070
+        $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1071 1071
 
1072
-		// Hook posts inserts (or updates) to the user service.
1073
-		$this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
1072
+        // Hook posts inserts (or updates) to the user service.
1073
+        $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
1074 1074
 
1075
-		// Hook the AJAX wl_timeline action to the Timeline service.
1076
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1075
+        // Hook the AJAX wl_timeline action to the Timeline service.
1076
+        $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1077 1077
 
1078
-		// Register custom allowed redirect hosts.
1079
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1080
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1081
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1082
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1083
-		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1084
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1085
-		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1078
+        // Register custom allowed redirect hosts.
1079
+        $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1080
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1081
+        $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1082
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1083
+        $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1084
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1085
+        $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1086 1086
 
1087
-		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1088
-		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1089
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1090
-		$this->loader->add_action( 'save_post_entity', $this->rating_service, 'set_rating_for', 10, 1 );
1087
+        // Hook save_post to the entity service to update custom fields (such as alternate labels).
1088
+        // We have a priority of 9 because we want to be executed before data is sent to Redlink.
1089
+        $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1090
+        $this->loader->add_action( 'save_post_entity', $this->rating_service, 'set_rating_for', 10, 1 );
1091 1091
 
1092
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1093
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1092
+        $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1093
+        $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1094 1094
 
1095
-		// Entity listing customization (wp-admin/edit.php)
1096
-		// Add custom columns
1097
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1098
-		$this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1099
-		// Add 4W selection
1100
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1101
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1095
+        // Entity listing customization (wp-admin/edit.php)
1096
+        // Add custom columns
1097
+        $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1098
+        $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1099
+        // Add 4W selection
1100
+        $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1101
+        $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1102 1102
 
1103
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1103
+        $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1104 1104
 
1105
-		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1106
-		// entities.
1107
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1105
+        // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1106
+        // entities.
1107
+        $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1108 1108
 
1109
-		// Filter imported post meta.
1110
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1109
+        // Filter imported post meta.
1110
+        $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1111 1111
 
1112
-		// Notify the import service when an import starts and ends.
1113
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1114
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1115
-
1116
-		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1117
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1112
+        // Notify the import service when an import starts and ends.
1113
+        $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1114
+        $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1115
+
1116
+        // Hook the AJAX wl_rebuild action to the Rebuild Service.
1117
+        $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1118 1118
 
1119
-		// Hook the menu to the Download Your Data page.
1120
-		$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1121
-		$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1122
-		$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1123
-
1124
-		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1125
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1119
+        // Hook the menu to the Download Your Data page.
1120
+        $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1121
+        $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1122
+        $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1123
+
1124
+        // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1125
+        $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1126 1126
 
1127
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1128
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1127
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1128
+        $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1129 1129
 
1130
-		// Hook the AJAX wl_validate_key action to the Key Validation service.
1131
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1130
+        // Hook the AJAX wl_validate_key action to the Key Validation service.
1131
+        $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1132 1132
 
1133
-		// Hook the `admin_init` function to the Admin Setup.
1134
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1133
+        // Hook the `admin_init` function to the Admin Setup.
1134
+        $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1135 1135
 
1136
-		// Hook the admin_init to the settings page.
1137
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1136
+        // Hook the admin_init to the settings page.
1137
+        $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1138 1138
 
1139
-		// Hook the menu creation on the general wordlift menu creation
1140
-		$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1139
+        // Hook the menu creation on the general wordlift menu creation
1140
+        $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1141 1141
 
1142
-		// Hook key update.
1143
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1144
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1142
+        // Hook key update.
1143
+        $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1144
+        $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1145 1145
 
1146
-		// Add additional action links to the WordLift plugin in the plugins page.
1147
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1146
+        // Add additional action links to the WordLift plugin in the plugins page.
1147
+        $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1148 1148
 
1149
-		// Hook the AJAX `wl_publisher` action name.
1150
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1149
+        // Hook the AJAX `wl_publisher` action name.
1150
+        $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1151 1151
 
1152
-		// Hook row actions for the entity type list admin.
1153
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1152
+        // Hook row actions for the entity type list admin.
1153
+        $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1154 1154
 
1155
-		// Hook capabilities manipulation to allow access to entity type admin
1156
-		// page  on wordpress versions before 4.7.
1157
-		global $wp_version;
1158
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1159
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1160
-		}
1155
+        // Hook capabilities manipulation to allow access to entity type admin
1156
+        // page  on wordpress versions before 4.7.
1157
+        global $wp_version;
1158
+        if ( version_compare( $wp_version, '4.7', '<' ) ) {
1159
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1160
+        }
1161 1161
 
1162
-		/** Adapters. */
1163
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1162
+        /** Adapters. */
1163
+        $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1164 1164
 
1165
-		$this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1165
+        $this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1166 1166
 
1167
-		// Hooks to restrict multisite super admin from manipulating entity types.
1168
-		if ( is_multisite() ) {
1169
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1170
-		}
1171
-	}
1167
+        // Hooks to restrict multisite super admin from manipulating entity types.
1168
+        if ( is_multisite() ) {
1169
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1170
+        }
1171
+    }
1172 1172
 
1173
-	/**
1174
-	 * Register all of the hooks related to the public-facing functionality
1175
-	 * of the plugin.
1176
-	 *
1177
-	 * @since    1.0.0
1178
-	 * @access   private
1179
-	 */
1180
-	private function define_public_hooks() {
1173
+    /**
1174
+     * Register all of the hooks related to the public-facing functionality
1175
+     * of the plugin.
1176
+     *
1177
+     * @since    1.0.0
1178
+     * @access   private
1179
+     */
1180
+    private function define_public_hooks() {
1181 1181
 
1182
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1182
+        $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1183 1183
 
1184
-		// Register the entity post type.
1185
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1184
+        // Register the entity post type.
1185
+        $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1186 1186
 
1187
-		// Bind the link generation and handling hooks to the entity link service.
1188
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1189
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1190
-		$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 );
1191
-		$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 );
1187
+        // Bind the link generation and handling hooks to the entity link service.
1188
+        $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1189
+        $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1190
+        $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 );
1191
+        $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 );
1192 1192
 
1193
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1194
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1193
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1194
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1195 1195
 
1196
-		// Hook the content filter service to add entity links.
1197
-		$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1196
+        // Hook the content filter service to add entity links.
1197
+        $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1198 1198
 
1199
-		// Hook the AJAX wl_timeline action to the Timeline service.
1200
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1199
+        // Hook the AJAX wl_timeline action to the Timeline service.
1200
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1201 1201
 
1202
-		// Hook the ShareThis service.
1203
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1204
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1202
+        // Hook the ShareThis service.
1203
+        $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1204
+        $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1205 1205
 
1206
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1207
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1206
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1207
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1208 1208
 
1209
-		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1210
-		// in order to tweak WP's `WP_Query` to include entities in queries related
1211
-		// to categories.
1212
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1209
+        // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1210
+        // in order to tweak WP's `WP_Query` to include entities in queries related
1211
+        // to categories.
1212
+        $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1213 1213
 
1214
-		/*
1214
+        /*
1215 1215
 		 * Hook the `pre_get_posts` action to the `Wordlift_Event_Entity_Page_Service`
1216 1216
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1217 1217
 		 * order of start time.
1218 1218
 		 */
1219
-		$this->loader->add_action( 'pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1 );
1220
-
1221
-		$this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1222
-
1223
-	}
1224
-
1225
-	/**
1226
-	 * Run the loader to execute all of the hooks with WordPress.
1227
-	 *
1228
-	 * @since    1.0.0
1229
-	 */
1230
-	public function run() {
1231
-		$this->loader->run();
1232
-	}
1233
-
1234
-	/**
1235
-	 * The name of the plugin used to uniquely identify it within the context of
1236
-	 * WordPress and to define internationalization functionality.
1237
-	 *
1238
-	 * @since     1.0.0
1239
-	 * @return    string    The name of the plugin.
1240
-	 */
1241
-	public function get_plugin_name() {
1242
-		return $this->plugin_name;
1243
-	}
1244
-
1245
-	/**
1246
-	 * The reference to the class that orchestrates the hooks with the plugin.
1247
-	 *
1248
-	 * @since     1.0.0
1249
-	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1250
-	 */
1251
-	public function get_loader() {
1252
-		return $this->loader;
1253
-	}
1254
-
1255
-	/**
1256
-	 * Retrieve the version number of the plugin.
1257
-	 *
1258
-	 * @since     1.0.0
1259
-	 * @return    string    The version number of the plugin.
1260
-	 */
1261
-	public function get_version() {
1262
-		return $this->version;
1263
-	}
1219
+        $this->loader->add_action( 'pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1 );
1220
+
1221
+        $this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1222
+
1223
+    }
1224
+
1225
+    /**
1226
+     * Run the loader to execute all of the hooks with WordPress.
1227
+     *
1228
+     * @since    1.0.0
1229
+     */
1230
+    public function run() {
1231
+        $this->loader->run();
1232
+    }
1233
+
1234
+    /**
1235
+     * The name of the plugin used to uniquely identify it within the context of
1236
+     * WordPress and to define internationalization functionality.
1237
+     *
1238
+     * @since     1.0.0
1239
+     * @return    string    The name of the plugin.
1240
+     */
1241
+    public function get_plugin_name() {
1242
+        return $this->plugin_name;
1243
+    }
1244
+
1245
+    /**
1246
+     * The reference to the class that orchestrates the hooks with the plugin.
1247
+     *
1248
+     * @since     1.0.0
1249
+     * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1250
+     */
1251
+    public function get_loader() {
1252
+        return $this->loader;
1253
+    }
1254
+
1255
+    /**
1256
+     * Retrieve the version number of the plugin.
1257
+     *
1258
+     * @since     1.0.0
1259
+     * @return    string    The version number of the plugin.
1260
+     */
1261
+    public function get_version() {
1262
+        return $this->version;
1263
+    }
1264 1264
 
1265 1265
 }
Please login to merge, or discard this patch.
Spacing   +187 added lines, -187 removed lines patch added patch discarded remove patch
@@ -547,331 +547,331 @@  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
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
710
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-adapter.php';
711 711
 
712 712
 		/**
713 713
 		 * Load the WordLift key validation service.
714 714
 		 */
715
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
715
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php';
716 716
 
717 717
 		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
718
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
718
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php';
719 719
 
720 720
 		// Load the `Wordlift_Event_Entity_Page_Service` class definition.
721
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-event-entity-page-service.php';
721
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-event-entity-page-service.php';
722 722
 
723 723
 		/** Adapters. */
724
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
725
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
724
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php';
725
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-newrelic-adapter.php';
726 726
 
727 727
 		/** Async Tasks. */
728
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/wp-async-task.php';
729
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
728
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/wp-async-task.php';
729
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
730 730
 
731 731
 		/**
732 732
 		 * The class responsible for defining all actions that occur in the admin area.
733 733
 		 */
734
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
734
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php';
735 735
 
736 736
 		/**
737 737
 		 * The class to customize the entity list admin page.
738 738
 		 */
739
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
739
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php';
740 740
 
741 741
 		/**
742 742
 		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
743 743
 		 */
744
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
744
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php';
745 745
 
746 746
 		/**
747 747
 		 * The Notice service.
748 748
 		 */
749
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
749
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php';
750 750
 
751 751
 		/**
752 752
 		 * The PrimaShop adapter.
753 753
 		 */
754
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
754
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php';
755 755
 
756 756
 		/**
757 757
 		 * The WordLift Dashboard service.
758 758
 		 */
759
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
759
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php';
760 760
 
761 761
 		/**
762 762
 		 * The admin 'Install wizard' page.
763 763
 		 */
764
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
764
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php';
765 765
 
766 766
 		/**
767 767
 		 * The WordLift entity type list admin page controller.
768 768
 		 */
769
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
769
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
770 770
 
771 771
 		/**
772 772
 		 * The WordLift entity type settings admin page controller.
773 773
 		 */
774
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
774
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php';
775 775
 
776 776
 		/**
777 777
 		 * The admin 'Download Your Data' page.
778 778
 		 */
779
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
779
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php';
780 780
 
781 781
 		/**
782 782
 		 * The admin 'Download Your Data' page.
783 783
 		 */
784
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
784
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php';
785 785
 
786 786
 		/**
787 787
 		 * The admin 'WordLift Settings' page.
788 788
 		 */
789
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
790
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
791
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
792
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
793
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
794
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
795
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
796
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
797
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
798
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
799
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
789
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/intf-wordlift-admin-element.php';
790
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-input-element.php';
791
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-input-radio-element.php';
792
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-select2-element.php';
793
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-language-select-element.php';
794
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-tabs-element.php';
795
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-author-element.php';
796
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-publisher-element.php';
797
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php';
798
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php';
799
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php';
800 800
 
801 801
 		/** Admin Pages */
802
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
803
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
804
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
802
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php';
803
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-user-profile-page.php';
804
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-status-page.php';
805 805
 
806 806
 		/**
807 807
 		 * The class responsible for defining all actions that occur in the public-facing
808 808
 		 * side of the site.
809 809
 		 */
810
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
810
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php';
811 811
 
812 812
 		/**
813 813
 		 * The shortcode abstract class.
814 814
 		 */
815
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
815
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php';
816 816
 
817 817
 		/**
818 818
 		 * The Timeline shortcode.
819 819
 		 */
820
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
820
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php';
821 821
 
822 822
 		/**
823 823
 		 * The Navigator shortcode.
824 824
 		 */
825
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
825
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php';
826 826
 
827 827
 		/**
828 828
 		 * The chord shortcode.
829 829
 		 */
830
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
830
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php';
831 831
 
832 832
 		/**
833 833
 		 * The geomap shortcode.
834 834
 		 */
835
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
835
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php';
836 836
 
837 837
 		/**
838 838
 		 * The entity cloud shortcode.
839 839
 		 */
840
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
840
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php';
841 841
 
842 842
 		/**
843 843
 		 * The ShareThis service.
844 844
 		 */
845
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
845
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php';
846 846
 
847 847
 		/**
848 848
 		 * The SEO service.
849 849
 		 */
850
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
850
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php';
851 851
 
852 852
 		/**
853 853
 		 * The AMP service.
854 854
 		 */
855
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
855
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-amp-service.php';
856 856
 
857 857
 		/** Widgets */
858
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
859
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
858
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php';
859
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php';
860 860
 
861 861
 		$this->loader = new Wordlift_Loader();
862 862
 
863 863
 		// Instantiate a global logger.
864 864
 		global $wl_logger;
865
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
865
+		$wl_logger = Wordlift_Log_Service::get_logger('WordLift');
866 866
 
867 867
 		// Create the configuration service.
868 868
 		$this->configuration_service = new Wordlift_Configuration_Service();
869 869
 
870 870
 		// Create an entity type service instance. It'll be later bound to the init action.
871
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
871
+		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path());
872 872
 
873 873
 		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
874
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
874
+		$this->entity_link_service = new Wordlift_Entity_Link_Service($this->entity_post_type_service, $this->configuration_service->get_entity_base_path());
875 875
 
876 876
 		// Create an instance of the UI service.
877 877
 		$this->ui_service = new Wordlift_UI_Service();
@@ -882,23 +882,23 @@  discard block
 block discarded – undo
882 882
 		$this->sparql_service = new Wordlift_Sparql_Service();
883 883
 
884 884
 		// Create an instance of the Schema service.
885
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
885
+		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service($this->sparql_service);
886 886
 		$this->schema_service        = new Wordlift_Schema_Service();
887 887
 
888 888
 		// Create an instance of the Notice service.
889 889
 		$this->notice_service = new Wordlift_Notice_Service();
890 890
 
891 891
 		// Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page.
892
-		$this->entity_service = new Wordlift_Entity_Service( $this->ui_service );
892
+		$this->entity_service = new Wordlift_Entity_Service($this->ui_service);
893 893
 
894 894
 		// Create an instance of the User service.
895 895
 		$this->user_service = new Wordlift_User_Service();
896 896
 
897 897
 		// Create a new instance of the Timeline service and Timeline shortcode.
898
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
898
+		$this->timeline_service = new Wordlift_Timeline_Service($this->entity_service);
899 899
 
900 900
 		// Create a new instance of the Redirect service.
901
-		$this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service );
901
+		$this->redirect_service = new Wordlift_Redirect_Service($this->entity_service);
902 902
 
903 903
 		// Initialize the shortcodes.
904 904
 		new Wordlift_Navigator_Shortcode();
@@ -924,45 +924,45 @@  discard block
 block discarded – undo
924 924
 		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
925 925
 
926 926
 		// Create an import service instance to hook later to WP's import function.
927
-		$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() );
927
+		$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());
928 928
 
929
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
929
+		$uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']);
930 930
 
931 931
 		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
932
-		$this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service );
932
+		$this->rebuild_service = new Wordlift_Rebuild_Service($this->sparql_service, $uri_service);
933 933
 
934
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
934
+		$this->entity_type_service = new Wordlift_Entity_Type_Service($this->schema_service);
935 935
 
936 936
 		// Create the entity rating service.
937
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
937
+		$this->rating_service = new Wordlift_Rating_Service($this->entity_service, $this->entity_type_service, $this->notice_service);
938 938
 
939 939
 		// Create entity list customization (wp-admin/edit.php)
940
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
940
+		$this->entity_list_service = new Wordlift_Entity_List_Service($this->rating_service);
941 941
 
942 942
 		// Create a new instance of the Redirect service.
943
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service );
943
+		$this->dashboard_service = new Wordlift_Dashboard_Service($this->rating_service);
944 944
 
945
-		$this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service );
946
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
945
+		$this->property_factory = new Wordlift_Property_Factory($schema_url_property_service);
946
+		$this->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service);
947 947
 
948 948
 		$attachment_service = new Wordlift_Attachment_Service();
949 949
 
950 950
 		// Instantiate the JSON-LD service.
951
-		$property_getter                       = Wordlift_Property_Getter_Factory::create( $this->entity_service );
952
-		$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 );
953
-		$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 );
954
-		$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 );
955
-		$this->jsonld_service                  = new Wordlift_Jsonld_Service( $this->entity_service, $this->postid_to_jsonld_converter );
951
+		$property_getter                       = Wordlift_Property_Getter_Factory::create($this->entity_service);
952
+		$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);
953
+		$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);
954
+		$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);
955
+		$this->jsonld_service                  = new Wordlift_Jsonld_Service($this->entity_service, $this->postid_to_jsonld_converter);
956 956
 
957 957
 		// Create an instance of the Key Validation service. This service is later hooked to provide an AJAX call (only for admins).
958 958
 		$this->key_validation_service = new Wordlift_Key_Validation_Service();
959 959
 
960 960
 		// Create an instance of the Publisher Service and the AJAX Adapter.
961 961
 		$publisher_service            = new Wordlift_Publisher_Service();
962
-		$this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $publisher_service );
962
+		$this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter($publisher_service);
963 963
 
964 964
 		/** Adapters. */
965
-		$this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this );
965
+		$this->tinymce_adapter = new Wordlift_Tinymce_Adapter($this);
966 966
 
967 967
 		/** Async Tasks. */
968 968
 		new Wordlift_Sparql_Query_Async_Task();
@@ -975,15 +975,15 @@  discard block
 block discarded – undo
975 975
 		$this->select2_element         = new Wordlift_Admin_Select2_Element();
976 976
 		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
977 977
 		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
978
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element );
979
-		$this->author_element          = new Wordlift_Admin_Author_Element( $publisher_service, $this->select2_element );
978
+		$this->publisher_element       = new Wordlift_Admin_Publisher_Element($this->configuration_service, $publisher_service, $tabs_element, $this->select2_element);
979
+		$this->author_element          = new Wordlift_Admin_Author_Element($publisher_service, $this->select2_element);
980 980
 
981
-		$this->download_your_data_page   = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
982
-		$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 );
983
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
981
+		$this->download_your_data_page   = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service);
982
+		$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);
983
+		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($this->settings_page);
984 984
 
985 985
 		// Pages.
986
-		new Wordlift_Admin_Post_Edit_Page( $this );
986
+		new Wordlift_Admin_Post_Edit_Page($this);
987 987
 
988 988
 		// create an instance of the entity type list admin page controller.
989 989
 		$this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
@@ -995,26 +995,26 @@  discard block
 block discarded – undo
995 995
 		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
996 996
 
997 997
 		//** WordPress Admin */
998
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
999
-		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
998
+		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service);
999
+		$this->status_page             = new Wordlift_Admin_Status_Page($this->entity_service, $this->sparql_service);
1000 1000
 
1001 1001
 		// Create an instance of the install wizard.
1002
-		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1002
+		$this->admin_setup = new Wordlift_Admin_Setup($this->configuration_service, $this->key_validation_service, $this->entity_service);
1003 1003
 
1004 1004
 		// Create an instance of the content filter service.
1005
-		$this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service );
1005
+		$this->content_filter_service = new Wordlift_Content_Filter_Service($this->entity_service, $this->configuration_service);
1006 1006
 
1007
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1007
+		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($this->entity_post_type_service);
1008 1008
 
1009 1009
 		// User Profile.
1010
-		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1010
+		new Wordlift_Admin_User_Profile_Page($this->author_element, $this->user_service);
1011 1011
 
1012 1012
 		$this->event_entity_page_service = new Wordlift_Event_Entity_Page_Service();
1013 1013
 
1014 1014
 		// Load the debug service if WP is in debug mode.
1015
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1016
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1017
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1015
+		if (defined('WP_DEBUG') && WP_DEBUG) {
1016
+			require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php';
1017
+			new Wordlift_Debug_Service($this->entity_service, $uri_service);
1018 1018
 		}
1019 1019
 
1020 1020
 	}
@@ -1031,9 +1031,9 @@  discard block
 block discarded – undo
1031 1031
 	private function set_locale() {
1032 1032
 
1033 1033
 		$plugin_i18n = new Wordlift_i18n();
1034
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1034
+		$plugin_i18n->set_domain($this->get_plugin_name());
1035 1035
 
1036
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1036
+		$this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain');
1037 1037
 
1038 1038
 	}
1039 1039
 
@@ -1054,119 +1054,119 @@  discard block
 block discarded – undo
1054 1054
 			$this->user_service
1055 1055
 		);
1056 1056
 
1057
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1058
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1057
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles');
1058
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts');
1059 1059
 
1060 1060
 		// Hook the init action to the Topic Taxonomy service.
1061
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1061
+		$this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0);
1062 1062
 
1063 1063
 		// Hook the deleted_post_meta action to the Thumbnail service.
1064
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1064
+		$this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4);
1065 1065
 
1066 1066
 		// Hook the added_post_meta action to the Thumbnail service.
1067
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1067
+		$this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4);
1068 1068
 
1069 1069
 		// Hook the updated_post_meta action to the Thumbnail service.
1070
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1070
+		$this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4);
1071 1071
 
1072 1072
 		// Hook posts inserts (or updates) to the user service.
1073
-		$this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
1073
+		$this->loader->add_action('wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3);
1074 1074
 
1075 1075
 		// Hook the AJAX wl_timeline action to the Timeline service.
1076
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1076
+		$this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline');
1077 1077
 
1078 1078
 		// Register custom allowed redirect hosts.
1079
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1079
+		$this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts');
1080 1080
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1081
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1081
+		$this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect');
1082 1082
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1083
-		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1083
+		$this->loader->add_action('wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats');
1084 1084
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1085
-		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1085
+		$this->loader->add_action('wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets');
1086 1086
 
1087 1087
 		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1088 1088
 		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1089
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1090
-		$this->loader->add_action( 'save_post_entity', $this->rating_service, 'set_rating_for', 10, 1 );
1089
+		$this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3);
1090
+		$this->loader->add_action('save_post_entity', $this->rating_service, 'set_rating_for', 10, 1);
1091 1091
 
1092
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1093
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1092
+		$this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1);
1093
+		$this->loader->add_action('in_admin_header', $this->rating_service, 'in_admin_header');
1094 1094
 
1095 1095
 		// Entity listing customization (wp-admin/edit.php)
1096 1096
 		// Add custom columns
1097
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1098
-		$this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1097
+		$this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns');
1098
+		$this->loader->add_filter('manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2);
1099 1099
 		// Add 4W selection
1100
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1101
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1100
+		$this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope');
1101
+		$this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope');
1102 1102
 
1103
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1103
+		$this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args');
1104 1104
 
1105 1105
 		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1106 1106
 		// entities.
1107
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1107
+		$this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2);
1108 1108
 
1109 1109
 		// Filter imported post meta.
1110
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1110
+		$this->loader->add_filter('wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3);
1111 1111
 
1112 1112
 		// Notify the import service when an import starts and ends.
1113
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1114
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1113
+		$this->loader->add_action('import_start', $this->import_service, 'import_start', 10, 0);
1114
+		$this->loader->add_action('import_end', $this->import_service, 'import_end', 10, 0);
1115 1115
 
1116 1116
 		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1117
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1117
+		$this->loader->add_action('wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild');
1118 1118
 
1119 1119
 		// Hook the menu to the Download Your Data page.
1120
-		$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1121
-		$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1122
-		$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1120
+		$this->loader->add_action('admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0);
1121
+		$this->loader->add_action('admin_menu', $this->status_page, 'admin_menu', 100, 0);
1122
+		$this->loader->add_action('admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0);
1123 1123
 
1124 1124
 		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1125
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1125
+		$this->loader->add_action('wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10);
1126 1126
 
1127 1127
 		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1128
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1128
+		$this->loader->add_action('wp_ajax_wl_jsonld', $this->jsonld_service, 'get');
1129 1129
 
1130 1130
 		// Hook the AJAX wl_validate_key action to the Key Validation service.
1131
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1131
+		$this->loader->add_action('wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key');
1132 1132
 
1133 1133
 		// Hook the `admin_init` function to the Admin Setup.
1134
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1134
+		$this->loader->add_action('admin_init', $this->admin_setup, 'admin_init');
1135 1135
 
1136 1136
 		// Hook the admin_init to the settings page.
1137
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1137
+		$this->loader->add_action('admin_init', $this->settings_page, 'admin_init');
1138 1138
 
1139 1139
 		// Hook the menu creation on the general wordlift menu creation
1140
-		$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1140
+		$this->loader->add_action('wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2);
1141 1141
 
1142 1142
 		// Hook key update.
1143
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1144
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1143
+		$this->loader->add_action('pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2);
1144
+		$this->loader->add_action('update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2);
1145 1145
 
1146 1146
 		// Add additional action links to the WordLift plugin in the plugins page.
1147
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1147
+		$this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1);
1148 1148
 
1149 1149
 		// Hook the AJAX `wl_publisher` action name.
1150
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1150
+		$this->loader->add_action('wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher');
1151 1151
 
1152 1152
 		// Hook row actions for the entity type list admin.
1153
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1153
+		$this->loader->add_filter('wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2);
1154 1154
 
1155 1155
 		// Hook capabilities manipulation to allow access to entity type admin
1156 1156
 		// page  on wordpress versions before 4.7.
1157 1157
 		global $wp_version;
1158
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1159
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1158
+		if (version_compare($wp_version, '4.7', '<')) {
1159
+			$this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4);
1160 1160
 		}
1161 1161
 
1162 1162
 		/** Adapters. */
1163
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1163
+		$this->loader->add_filter('mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1);
1164 1164
 
1165
-		$this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1165
+		$this->loader->add_action('wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1);
1166 1166
 
1167 1167
 		// Hooks to restrict multisite super admin from manipulating entity types.
1168
-		if ( is_multisite() ) {
1169
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1168
+		if (is_multisite()) {
1169
+			$this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4);
1170 1170
 		}
1171 1171
 	}
1172 1172
 
@@ -1179,46 +1179,46 @@  discard block
 block discarded – undo
1179 1179
 	 */
1180 1180
 	private function define_public_hooks() {
1181 1181
 
1182
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1182
+		$plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version());
1183 1183
 
1184 1184
 		// Register the entity post type.
1185
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1185
+		$this->loader->add_action('init', $this->entity_post_type_service, 'register');
1186 1186
 
1187 1187
 		// Bind the link generation and handling hooks to the entity link service.
1188
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1189
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1190
-		$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 );
1191
-		$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 );
1188
+		$this->loader->add_filter('post_type_link', $this->entity_link_service, 'post_type_link', 10, 4);
1189
+		$this->loader->add_action('pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1);
1190
+		$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);
1191
+		$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);
1192 1192
 
1193
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1194
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1193
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles');
1194
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts');
1195 1195
 
1196 1196
 		// Hook the content filter service to add entity links.
1197
-		$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1197
+		$this->loader->add_filter('the_content', $this->content_filter_service, 'the_content');
1198 1198
 
1199 1199
 		// Hook the AJAX wl_timeline action to the Timeline service.
1200
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1200
+		$this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline');
1201 1201
 
1202 1202
 		// Hook the ShareThis service.
1203
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1204
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1203
+		$this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99);
1204
+		$this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99);
1205 1205
 
1206 1206
 		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1207
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1207
+		$this->loader->add_action('wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get');
1208 1208
 
1209 1209
 		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1210 1210
 		// in order to tweak WP's `WP_Query` to include entities in queries related
1211 1211
 		// to categories.
1212
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1212
+		$this->loader->add_action('pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1);
1213 1213
 
1214 1214
 		/*
1215 1215
 		 * Hook the `pre_get_posts` action to the `Wordlift_Event_Entity_Page_Service`
1216 1216
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1217 1217
 		 * order of start time.
1218 1218
 		 */
1219
-		$this->loader->add_action( 'pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1 );
1219
+		$this->loader->add_action('pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1);
1220 1220
 
1221
-		$this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1221
+		$this->loader->add_action('wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1);
1222 1222
 
1223 1223
 	}
1224 1224
 
Please login to merge, or discard this patch.