Completed
Push — develop ( 96c351...9a5c66 )
by
unknown
79:26 queued 71:18
created
src/shortcodes/wordlift_shortcode_navigator.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -407,6 +407,9 @@
 block discarded – undo
407 407
 
408 408
 }
409 409
 
410
+/**
411
+ * @param integer $filler_count
412
+ */
410 413
 function wl_shortcode_navigator_filler_posts( $filler_count, $current_post_id, $referencing_post_ids ) {
411 414
 
412 415
 	$filler_posts = array();
Please login to merge, or discard this patch.
Indentation   +339 added lines, -339 removed lines patch added patch discarded remove patch
@@ -16,29 +16,29 @@  discard block
 block discarded – undo
16 16
  */
17 17
 function wl_shortcode_navigator_data() {
18 18
 
19
-	// Create the cache key.
20
-	$cache_key_params = $_REQUEST;
21
-	unset( $cache_key_params['uniqid'] );
22
-	$cache_key = array( 'request_params' => $cache_key_params );
19
+    // Create the cache key.
20
+    $cache_key_params = $_REQUEST;
21
+    unset( $cache_key_params['uniqid'] );
22
+    $cache_key = array( 'request_params' => $cache_key_params );
23 23
 
24
-	// Create the TTL cache and try to get the results.
25
-	$cache         = new Ttl_Cache( "navigator", 8 * 60 * 60 ); // 8 hours.
26
-	$cache_results = $cache->get( $cache_key );
24
+    // Create the TTL cache and try to get the results.
25
+    $cache         = new Ttl_Cache( "navigator", 8 * 60 * 60 ); // 8 hours.
26
+    $cache_results = $cache->get( $cache_key );
27 27
 
28
-	if ( isset( $cache_results ) ) {
29
-		header( 'X-WordLift-Cache: HIT' );
28
+    if ( isset( $cache_results ) ) {
29
+        header( 'X-WordLift-Cache: HIT' );
30 30
 
31
-		return $cache_results;
32
-	}
31
+        return $cache_results;
32
+    }
33 33
 
34
-	header( 'X-WordLift-Cache: MISS' );
34
+    header( 'X-WordLift-Cache: MISS' );
35 35
 
36
-	$results = _wl_navigator_get_data();
36
+    $results = _wl_navigator_get_data();
37 37
 
38
-	// Put the result before sending the json to the client, since sending the json will terminate us.
39
-	$cache->put( $cache_key, $results );
38
+    // Put the result before sending the json to the client, since sending the json will terminate us.
39
+    $cache->put( $cache_key, $results );
40 40
 
41
-	return $results;
41
+    return $results;
42 42
 }
43 43
 
44 44
 /**
@@ -53,217 +53,217 @@  discard block
 block discarded – undo
53 53
  */
54 54
 function wl_network_navigator_wp_json( $request ) {
55 55
 
56
-	// Create the cache key.
57
-	$cache_key_params = $_REQUEST;
58
-	unset( $cache_key_params['uniqid'] );
59
-	$cache_key = array( 'request_params' => $cache_key_params );
56
+    // Create the cache key.
57
+    $cache_key_params = $_REQUEST;
58
+    unset( $cache_key_params['uniqid'] );
59
+    $cache_key = array( 'request_params' => $cache_key_params );
60 60
 
61
-	// Create the TTL cache and try to get the results.
62
-	$cache         = new Ttl_Cache( "network-navigator", 8 * 60 * 60 ); // 8 hours.
63
-	$cache_results = $cache->get( $cache_key );
61
+    // Create the TTL cache and try to get the results.
62
+    $cache         = new Ttl_Cache( "network-navigator", 8 * 60 * 60 ); // 8 hours.
63
+    $cache_results = $cache->get( $cache_key );
64 64
 
65
-	if ( isset( $cache_results ) ) {
66
-		header( 'X-WordLift-Cache: HIT' );
65
+    if ( isset( $cache_results ) ) {
66
+        header( 'X-WordLift-Cache: HIT' );
67 67
 
68
-		return $cache_results;
69
-	}
68
+        return $cache_results;
69
+    }
70 70
 
71
-	header( 'X-WordLift-Cache: MISS' );
71
+    header( 'X-WordLift-Cache: MISS' );
72 72
 
73
-	$results = _wl_network_navigator_get_data( $request );
73
+    $results = _wl_network_navigator_get_data( $request );
74 74
 
75
-	// Put the result before sending the json to the client, since sending the json will terminate us.
76
-	$cache->put( $cache_key, $results );
75
+    // Put the result before sending the json to the client, since sending the json will terminate us.
76
+    $cache->put( $cache_key, $results );
77 77
 
78
-	return $results;
78
+    return $results;
79 79
 
80 80
 }
81 81
 
82 82
 function _wl_navigator_get_data() {
83 83
 
84
-	// Post ID must be defined
85
-	if ( ! isset( $_GET['post_id'] ) ) {
86
-		wp_send_json_error( 'No post_id given' );
87
-
88
-		return array();
89
-	}
90
-
91
-	// Post ID must be defined
92
-	if ( ! isset( $_GET['uniqid'] ) ) {
93
-		wp_send_json_error( 'No uniqid given' );
94
-
95
-		return array();
96
-	}
97
-
98
-	// Limit the results (defaults to 4)
99
-	$navigator_length = isset( $_GET['limit'] ) ? intval( $_GET['limit'] ) : 4;
100
-	$navigator_offset = isset( $_GET['offset'] ) ? intval( $_GET['offset'] ) : 0;
101
-	$order_by         = isset( $_GET['sort'] ) ? sanitize_sql_orderby( $_GET['sort'] ) : 'ID DESC';
102
-
103
-	$current_post_id = $_GET['post_id'];
104
-	$current_post    = get_post( $current_post_id );
105
-
106
-	$navigator_id = $_GET['uniqid'];
107
-
108
-	// Post ID has to match an existing item
109
-	if ( null === $current_post ) {
110
-		wp_send_json_error( 'No valid post_id given' );
111
-
112
-		return array();
113
-	}
114
-
115
-	// Determine navigator type and call respective _get_results
116
-	if ( get_post_type( $current_post_id ) === Wordlift_Entity_Service::TYPE_NAME ) {
117
-		$referencing_posts = _wl_entity_navigator_get_results( $current_post_id, array(
118
-			'ID',
119
-			'post_title',
120
-		), $order_by, $navigator_length, $navigator_offset );
121
-	} else {
122
-		$referencing_posts = _wl_navigator_get_results( $current_post_id, array(
123
-			'ID',
124
-			'post_title',
125
-		), $order_by, $navigator_length, $navigator_offset );
126
-	}
127
-
128
-	// loop over them and take the first one which is not already in the $related_posts
129
-	$results = array();
130
-	foreach ( $referencing_posts as $referencing_post ) {
131
-		$serialized_entity = wl_serialize_entity( $referencing_post->entity_id );
132
-
133
-		/**
134
-		 * Use the thumbnail.
135
-		 *
136
-		 * @see https://github.com/insideout10/wordlift-plugin/issues/825 related issue.
137
-		 * @see https://github.com/insideout10/wordlift-plugin/issues/837
138
-		 *
139
-		 * @since 3.19.3 We're using the medium size image.
140
-		 */
141
-		$thumbnail = get_the_post_thumbnail_url( $referencing_post, 'medium' );
142
-
143
-		$result = array(
144
-			'post'   => array(
145
-				'id'        => $referencing_post->ID,
146
-				'permalink' => get_permalink( $referencing_post->ID ),
147
-				'title'     => $referencing_post->post_title,
148
-				'thumbnail' => $thumbnail,
149
-			),
150
-			'entity' => array(
151
-				'id'        => $referencing_post->entity_id,
152
-				'label'     => $serialized_entity['label'],
153
-				'mainType'  => $serialized_entity['mainType'],
154
-				'permalink' => get_permalink( $referencing_post->entity_id ),
155
-			),
156
-		);
157
-
158
-		$results[] = $result;
159
-	}
160
-
161
-	if ( count( $results ) < $navigator_length ) {
162
-		$results = apply_filters( 'wl_navigator_data_placeholder', $results, $navigator_id, $navigator_offset, $navigator_length );
163
-	}
164
-
165
-	// Add filler posts if needed
166
-	$filler_count = $navigator_length - count( $results );
167
-	if ( $filler_count > 0 ) {
168
-		$referencing_post_ids = array_map( function ( $p ) {
169
-			return $p->ID;
170
-		}, $referencing_posts );
171
-		$filler_posts         = wl_shortcode_navigator_filler_posts( $filler_count, $current_post_id, $referencing_post_ids );
172
-		$results              = array_merge( $results, $filler_posts );
173
-	}
174
-
175
-	// Apply filters after fillers are added
176
-	foreach ( $results as $result_index => $result ) {
177
-		$results[ $result_index ]['post']   = apply_filters( 'wl_navigator_data_post', $result['post'], intval( $result['post']['id'] ), $navigator_id );
178
-		$results[ $result_index ]['entity'] = apply_filters( 'wl_navigator_data_entity', $result['entity'], intval( $result['entity']['id'] ), $navigator_id );
179
-	}
180
-
181
-	return $results;
84
+    // Post ID must be defined
85
+    if ( ! isset( $_GET['post_id'] ) ) {
86
+        wp_send_json_error( 'No post_id given' );
87
+
88
+        return array();
89
+    }
90
+
91
+    // Post ID must be defined
92
+    if ( ! isset( $_GET['uniqid'] ) ) {
93
+        wp_send_json_error( 'No uniqid given' );
94
+
95
+        return array();
96
+    }
97
+
98
+    // Limit the results (defaults to 4)
99
+    $navigator_length = isset( $_GET['limit'] ) ? intval( $_GET['limit'] ) : 4;
100
+    $navigator_offset = isset( $_GET['offset'] ) ? intval( $_GET['offset'] ) : 0;
101
+    $order_by         = isset( $_GET['sort'] ) ? sanitize_sql_orderby( $_GET['sort'] ) : 'ID DESC';
102
+
103
+    $current_post_id = $_GET['post_id'];
104
+    $current_post    = get_post( $current_post_id );
105
+
106
+    $navigator_id = $_GET['uniqid'];
107
+
108
+    // Post ID has to match an existing item
109
+    if ( null === $current_post ) {
110
+        wp_send_json_error( 'No valid post_id given' );
111
+
112
+        return array();
113
+    }
114
+
115
+    // Determine navigator type and call respective _get_results
116
+    if ( get_post_type( $current_post_id ) === Wordlift_Entity_Service::TYPE_NAME ) {
117
+        $referencing_posts = _wl_entity_navigator_get_results( $current_post_id, array(
118
+            'ID',
119
+            'post_title',
120
+        ), $order_by, $navigator_length, $navigator_offset );
121
+    } else {
122
+        $referencing_posts = _wl_navigator_get_results( $current_post_id, array(
123
+            'ID',
124
+            'post_title',
125
+        ), $order_by, $navigator_length, $navigator_offset );
126
+    }
127
+
128
+    // loop over them and take the first one which is not already in the $related_posts
129
+    $results = array();
130
+    foreach ( $referencing_posts as $referencing_post ) {
131
+        $serialized_entity = wl_serialize_entity( $referencing_post->entity_id );
132
+
133
+        /**
134
+         * Use the thumbnail.
135
+         *
136
+         * @see https://github.com/insideout10/wordlift-plugin/issues/825 related issue.
137
+         * @see https://github.com/insideout10/wordlift-plugin/issues/837
138
+         *
139
+         * @since 3.19.3 We're using the medium size image.
140
+         */
141
+        $thumbnail = get_the_post_thumbnail_url( $referencing_post, 'medium' );
142
+
143
+        $result = array(
144
+            'post'   => array(
145
+                'id'        => $referencing_post->ID,
146
+                'permalink' => get_permalink( $referencing_post->ID ),
147
+                'title'     => $referencing_post->post_title,
148
+                'thumbnail' => $thumbnail,
149
+            ),
150
+            'entity' => array(
151
+                'id'        => $referencing_post->entity_id,
152
+                'label'     => $serialized_entity['label'],
153
+                'mainType'  => $serialized_entity['mainType'],
154
+                'permalink' => get_permalink( $referencing_post->entity_id ),
155
+            ),
156
+        );
157
+
158
+        $results[] = $result;
159
+    }
160
+
161
+    if ( count( $results ) < $navigator_length ) {
162
+        $results = apply_filters( 'wl_navigator_data_placeholder', $results, $navigator_id, $navigator_offset, $navigator_length );
163
+    }
164
+
165
+    // Add filler posts if needed
166
+    $filler_count = $navigator_length - count( $results );
167
+    if ( $filler_count > 0 ) {
168
+        $referencing_post_ids = array_map( function ( $p ) {
169
+            return $p->ID;
170
+        }, $referencing_posts );
171
+        $filler_posts         = wl_shortcode_navigator_filler_posts( $filler_count, $current_post_id, $referencing_post_ids );
172
+        $results              = array_merge( $results, $filler_posts );
173
+    }
174
+
175
+    // Apply filters after fillers are added
176
+    foreach ( $results as $result_index => $result ) {
177
+        $results[ $result_index ]['post']   = apply_filters( 'wl_navigator_data_post', $result['post'], intval( $result['post']['id'] ), $navigator_id );
178
+        $results[ $result_index ]['entity'] = apply_filters( 'wl_navigator_data_entity', $result['entity'], intval( $result['entity']['id'] ), $navigator_id );
179
+    }
180
+
181
+    return $results;
182 182
 }
183 183
 
184 184
 function _wl_network_navigator_get_data( $request ) {
185 185
 
186
-	// Limit the results (defaults to 4)
187
-	$navigator_length = isset( $request['limit'] ) ? intval( $request['limit'] ) : 4;
188
-	$navigator_offset = isset( $request['offset'] ) ? intval( $request['offset'] ) : 0;
189
-	$navigator_id     = $request['uniqid'];
190
-	$order_by         = isset( $_GET['sort'] ) ? sanitize_sql_orderby( $_GET['sort'] ) : 'ID DESC';
191
-
192
-	$entities = $request['entities'];
193
-
194
-	// Post ID has to match an existing item
195
-	if ( ! isset( $entities ) || empty( $entities ) ) {
196
-		wp_send_json_error( 'No valid entities provided' );
197
-	}
198
-
199
-	$referencing_posts = _wl_network_navigator_get_results( $entities, array(
200
-		'ID',
201
-		'post_title',
202
-	), $order_by, $navigator_length, $navigator_offset );
203
-
204
-	// loop over them and take the first one which is not already in the $related_posts
205
-	$results = array();
206
-	foreach ( $referencing_posts as $referencing_post ) {
207
-		$serialized_entity = wl_serialize_entity( $referencing_post->entity_id );
208
-
209
-		/**
210
-		 * Use the thumbnail.
211
-		 *
212
-		 * @see https://github.com/insideout10/wordlift-plugin/issues/825 related issue.
213
-		 * @see https://github.com/insideout10/wordlift-plugin/issues/837
214
-		 *
215
-		 * @since 3.19.3 We're using the medium size image.
216
-		 */
217
-		$thumbnail = get_the_post_thumbnail_url( $referencing_post, 'medium' );
218
-
219
-		$result = array(
220
-			'post'   => array(
221
-				'permalink' => get_permalink( $referencing_post->ID ),
222
-				'title'     => $referencing_post->post_title,
223
-				'thumbnail' => $thumbnail,
224
-			),
225
-			'entity' => array(
226
-				'label'     => $serialized_entity['label'],
227
-				'mainType'  => $serialized_entity['mainType'],
228
-				'permalink' => get_permalink( $referencing_post->entity_id ),
229
-			),
230
-		);
231
-
232
-		$result['post']   = apply_filters( 'wl_network_navigator_data_post', $result['post'], intval( $referencing_post->ID ), $navigator_id );
233
-		$result['entity'] = apply_filters( 'wl_network_navigator_data_entity', $result['entity'], intval( $referencing_post->entity_id ), $navigator_id );
234
-
235
-		$results[] = $result;
236
-
237
-	}
238
-
239
-	if ( count( $results ) < $navigator_length ) {
240
-		$results = apply_filters( 'wl_network_navigator_data_placeholder', $results, $navigator_id, $navigator_offset, $navigator_length );
241
-	}
242
-
243
-	return $results;
186
+    // Limit the results (defaults to 4)
187
+    $navigator_length = isset( $request['limit'] ) ? intval( $request['limit'] ) : 4;
188
+    $navigator_offset = isset( $request['offset'] ) ? intval( $request['offset'] ) : 0;
189
+    $navigator_id     = $request['uniqid'];
190
+    $order_by         = isset( $_GET['sort'] ) ? sanitize_sql_orderby( $_GET['sort'] ) : 'ID DESC';
191
+
192
+    $entities = $request['entities'];
193
+
194
+    // Post ID has to match an existing item
195
+    if ( ! isset( $entities ) || empty( $entities ) ) {
196
+        wp_send_json_error( 'No valid entities provided' );
197
+    }
198
+
199
+    $referencing_posts = _wl_network_navigator_get_results( $entities, array(
200
+        'ID',
201
+        'post_title',
202
+    ), $order_by, $navigator_length, $navigator_offset );
203
+
204
+    // loop over them and take the first one which is not already in the $related_posts
205
+    $results = array();
206
+    foreach ( $referencing_posts as $referencing_post ) {
207
+        $serialized_entity = wl_serialize_entity( $referencing_post->entity_id );
208
+
209
+        /**
210
+         * Use the thumbnail.
211
+         *
212
+         * @see https://github.com/insideout10/wordlift-plugin/issues/825 related issue.
213
+         * @see https://github.com/insideout10/wordlift-plugin/issues/837
214
+         *
215
+         * @since 3.19.3 We're using the medium size image.
216
+         */
217
+        $thumbnail = get_the_post_thumbnail_url( $referencing_post, 'medium' );
218
+
219
+        $result = array(
220
+            'post'   => array(
221
+                'permalink' => get_permalink( $referencing_post->ID ),
222
+                'title'     => $referencing_post->post_title,
223
+                'thumbnail' => $thumbnail,
224
+            ),
225
+            'entity' => array(
226
+                'label'     => $serialized_entity['label'],
227
+                'mainType'  => $serialized_entity['mainType'],
228
+                'permalink' => get_permalink( $referencing_post->entity_id ),
229
+            ),
230
+        );
231
+
232
+        $result['post']   = apply_filters( 'wl_network_navigator_data_post', $result['post'], intval( $referencing_post->ID ), $navigator_id );
233
+        $result['entity'] = apply_filters( 'wl_network_navigator_data_entity', $result['entity'], intval( $referencing_post->entity_id ), $navigator_id );
234
+
235
+        $results[] = $result;
236
+
237
+    }
238
+
239
+    if ( count( $results ) < $navigator_length ) {
240
+        $results = apply_filters( 'wl_network_navigator_data_placeholder', $results, $navigator_id, $navigator_offset, $navigator_length );
241
+    }
242
+
243
+    return $results;
244 244
 
245 245
 }
246 246
 
247 247
 
248 248
 function _wl_navigator_get_results(
249
-	$post_id, $fields = array(
250
-	'ID',
251
-	'post_title',
249
+    $post_id, $fields = array(
250
+    'ID',
251
+    'post_title',
252 252
 ), $order_by = 'ID DESC', $limit = 10, $offset = 0
253 253
 ) {
254
-	global $wpdb;
254
+    global $wpdb;
255 255
 
256
-	$select = implode( ', ', array_map( function ( $item ) {
257
-		return "p.$item AS $item";
258
-	}, (array) $fields ) );
256
+    $select = implode( ', ', array_map( function ( $item ) {
257
+        return "p.$item AS $item";
258
+    }, (array) $fields ) );
259 259
 
260
-	$order_by = implode( ', ', array_map( function ( $item ) {
261
-		return "p.$item";
262
-	}, (array) $order_by ) );
260
+    $order_by = implode( ', ', array_map( function ( $item ) {
261
+        return "p.$item";
262
+    }, (array) $order_by ) );
263 263
 
264
-	/** @noinspection SqlNoDataSourceInspection */
265
-	return $wpdb->get_results(
266
-		$wpdb->prepare( <<<EOF
264
+    /** @noinspection SqlNoDataSourceInspection */
265
+    return $wpdb->get_results(
266
+        $wpdb->prepare( <<<EOF
267 267
 SELECT %4\$s, p2.ID as entity_id
268 268
  FROM {$wpdb->prefix}wl_relation_instances r1
269 269
     INNER JOIN {$wpdb->prefix}wl_relation_instances r2
@@ -295,30 +295,30 @@  discard block
 block discarded – undo
295 295
  LIMIT %2\$d
296 296
  OFFSET %3\$d
297 297
 EOF
298
-			, $post_id, $limit, $offset, $select, $order_by )
299
-	);
298
+            , $post_id, $limit, $offset, $select, $order_by )
299
+    );
300 300
 
301 301
 }
302 302
 
303 303
 function _wl_entity_navigator_get_results(
304
-	$post_id, $fields = array(
305
-	'ID',
306
-	'post_title',
304
+    $post_id, $fields = array(
305
+    'ID',
306
+    'post_title',
307 307
 ), $order_by = 'ID DESC', $limit = 10, $offset = 0
308 308
 ) {
309
-	global $wpdb;
309
+    global $wpdb;
310 310
 
311
-	$select = implode( ', ', array_map( function ( $item ) {
312
-		return "p.$item AS $item";
313
-	}, (array) $fields ) );
311
+    $select = implode( ', ', array_map( function ( $item ) {
312
+        return "p.$item AS $item";
313
+    }, (array) $fields ) );
314 314
 
315
-	$order_by = implode( ', ', array_map( function ( $item ) {
316
-		return "p.$item";
317
-	}, (array) $order_by ) );
315
+    $order_by = implode( ', ', array_map( function ( $item ) {
316
+        return "p.$item";
317
+    }, (array) $order_by ) );
318 318
 
319
-	/** @noinspection SqlNoDataSourceInspection */
320
-	return $wpdb->get_results(
321
-		$wpdb->prepare( <<<EOF
319
+    /** @noinspection SqlNoDataSourceInspection */
320
+    return $wpdb->get_results(
321
+        $wpdb->prepare( <<<EOF
322 322
 SELECT %4\$s, p2.ID as entity_id
323 323
  FROM {$wpdb->prefix}wl_relation_instances r1
324 324
 	-- get the ID of the post entity in common between the object and the subject 2. 
@@ -347,36 +347,36 @@  discard block
 block discarded – undo
347 347
  LIMIT %2\$d
348 348
  OFFSET %3\$d
349 349
 EOF
350
-			, $post_id, $limit, $offset, $select, $order_by )
351
-	);
350
+            , $post_id, $limit, $offset, $select, $order_by )
351
+    );
352 352
 }
353 353
 
354 354
 function _wl_network_navigator_get_results(
355
-	$entities, $fields = array(
356
-	'ID',
357
-	'post_title',
355
+    $entities, $fields = array(
356
+    'ID',
357
+    'post_title',
358 358
 ), $order_by = 'ID DESC', $limit = 10, $offset = 0
359 359
 ) {
360
-	global $wpdb;
361
-
362
-	$select = implode( ', ', array_map( function ( $item ) {
363
-		return "p.$item AS $item";
364
-	}, (array) $fields ) );
365
-
366
-	$order_by = implode( ', ', array_map( function ( $item ) {
367
-		return "p.$item";
368
-	}, (array) $order_by ) );
369
-
370
-	$entities_in = implode( ',', array_map( function ( $item ) {
371
-		$entity = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( urldecode( $item ) );
372
-		if ( isset( $entity ) ) {
373
-			return $entity->ID;
374
-		}
375
-	}, $entities ) );
376
-
377
-	/** @noinspection SqlNoDataSourceInspection */
378
-	return $wpdb->get_results(
379
-		$wpdb->prepare( <<<EOF
360
+    global $wpdb;
361
+
362
+    $select = implode( ', ', array_map( function ( $item ) {
363
+        return "p.$item AS $item";
364
+    }, (array) $fields ) );
365
+
366
+    $order_by = implode( ', ', array_map( function ( $item ) {
367
+        return "p.$item";
368
+    }, (array) $order_by ) );
369
+
370
+    $entities_in = implode( ',', array_map( function ( $item ) {
371
+        $entity = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( urldecode( $item ) );
372
+        if ( isset( $entity ) ) {
373
+            return $entity->ID;
374
+        }
375
+    }, $entities ) );
376
+
377
+    /** @noinspection SqlNoDataSourceInspection */
378
+    return $wpdb->get_results(
379
+        $wpdb->prepare( <<<EOF
380 380
 SELECT %3\$s, p2.ID as entity_id
381 381
  FROM {$wpdb->prefix}wl_relation_instances r1
382 382
 	-- get the ID of the post entity in common between the object and the subject 2. 
@@ -402,76 +402,76 @@  discard block
 block discarded – undo
402 402
  LIMIT %1\$d
403 403
  OFFSET %2\$d
404 404
 EOF
405
-			, $limit, $offset, $select, $order_by )
406
-	);
405
+            , $limit, $offset, $select, $order_by )
406
+    );
407 407
 
408 408
 }
409 409
 
410 410
 function wl_shortcode_navigator_filler_posts( $filler_count, $current_post_id, $referencing_post_ids ) {
411 411
 
412
-	$filler_posts = array();
413
-
414
-	// First add latest posts from same categories as the current post
415
-	if ( $filler_count > 0 ) {
416
-
417
-		$current_post_categories = wp_get_post_categories( $current_post_id );
418
-
419
-		$args = array(
420
-			'meta_query'          => array(
421
-				array(
422
-					'key' => '_thumbnail_id'
423
-				)
424
-			),
425
-			'category__in'        => $current_post_categories,
426
-			'numberposts'         => $filler_count,
427
-			'post__not_in'        => array_merge( array( $current_post_id ), $referencing_post_ids ),
428
-			'ignore_sticky_posts' => 1
429
-		);
430
-
431
-		$filler_posts = get_posts( $args );
432
-	}
433
-
434
-	$filler_count    = $filler_count - count( $filler_posts );
435
-	$filler_post_ids = array_map( function ( $post ) {
436
-		return $post->ID;
437
-	}, $filler_posts );
438
-
439
-	// If that does not fill, add latest posts irrespective of category
440
-	if ( $filler_count > 0 ) {
441
-
442
-		$args = array(
443
-			'meta_query'          => array(
444
-				array(
445
-					'key' => '_thumbnail_id'
446
-				)
447
-			),
448
-			'numberposts'         => $filler_count,
449
-			'post__not_in'        => array_merge( array( $current_post_id ), $filler_post_ids, $referencing_post_ids ),
450
-			'ignore_sticky_posts' => 1
451
-		);
452
-
453
-		$filler_posts = array_merge( $filler_posts, get_posts( $args ) );
454
-
455
-	}
456
-
457
-	// Add thumbnail and permalink to filler posts
458
-	$filler_response = array();
459
-	foreach ( $filler_posts as $post_obj ) {
460
-		$thumbnail         = get_the_post_thumbnail_url( $post_obj, 'medium' );
461
-		$filler_response[] = array(
462
-			'post'   => array(
463
-				'id'        => $post_obj->ID,
464
-				'permalink' => get_permalink( $post_obj->ID ),
465
-				'thumbnail' => ( $thumbnail ) ? $thumbnail : WL_DEFAULT_THUMBNAIL_PATH,
466
-				'title'     => get_the_title( $post_obj->ID )
467
-			),
468
-			'entity' => array(
469
-				'id' => 0
470
-			)
471
-		);
472
-	}
473
-
474
-	return $filler_response;
412
+    $filler_posts = array();
413
+
414
+    // First add latest posts from same categories as the current post
415
+    if ( $filler_count > 0 ) {
416
+
417
+        $current_post_categories = wp_get_post_categories( $current_post_id );
418
+
419
+        $args = array(
420
+            'meta_query'          => array(
421
+                array(
422
+                    'key' => '_thumbnail_id'
423
+                )
424
+            ),
425
+            'category__in'        => $current_post_categories,
426
+            'numberposts'         => $filler_count,
427
+            'post__not_in'        => array_merge( array( $current_post_id ), $referencing_post_ids ),
428
+            'ignore_sticky_posts' => 1
429
+        );
430
+
431
+        $filler_posts = get_posts( $args );
432
+    }
433
+
434
+    $filler_count    = $filler_count - count( $filler_posts );
435
+    $filler_post_ids = array_map( function ( $post ) {
436
+        return $post->ID;
437
+    }, $filler_posts );
438
+
439
+    // If that does not fill, add latest posts irrespective of category
440
+    if ( $filler_count > 0 ) {
441
+
442
+        $args = array(
443
+            'meta_query'          => array(
444
+                array(
445
+                    'key' => '_thumbnail_id'
446
+                )
447
+            ),
448
+            'numberposts'         => $filler_count,
449
+            'post__not_in'        => array_merge( array( $current_post_id ), $filler_post_ids, $referencing_post_ids ),
450
+            'ignore_sticky_posts' => 1
451
+        );
452
+
453
+        $filler_posts = array_merge( $filler_posts, get_posts( $args ) );
454
+
455
+    }
456
+
457
+    // Add thumbnail and permalink to filler posts
458
+    $filler_response = array();
459
+    foreach ( $filler_posts as $post_obj ) {
460
+        $thumbnail         = get_the_post_thumbnail_url( $post_obj, 'medium' );
461
+        $filler_response[] = array(
462
+            'post'   => array(
463
+                'id'        => $post_obj->ID,
464
+                'permalink' => get_permalink( $post_obj->ID ),
465
+                'thumbnail' => ( $thumbnail ) ? $thumbnail : WL_DEFAULT_THUMBNAIL_PATH,
466
+                'title'     => get_the_title( $post_obj->ID )
467
+            ),
468
+            'entity' => array(
469
+                'id' => 0
470
+            )
471
+        );
472
+    }
473
+
474
+    return $filler_response;
475 475
 
476 476
 }
477 477
 
@@ -482,9 +482,9 @@  discard block
 block discarded – undo
482 482
  */
483 483
 function wl_shortcode_navigator_ajax() {
484 484
 
485
-	// Temporary blocking the Navigator.
486
-	$results = wl_shortcode_navigator_data();
487
-	wl_core_send_json( $results );
485
+    // Temporary blocking the Navigator.
486
+    $results = wl_shortcode_navigator_data();
487
+    wl_core_send_json( $results );
488 488
 
489 489
 }
490 490
 
@@ -496,16 +496,16 @@  discard block
 block discarded – undo
496 496
  */
497 497
 function wl_shortcode_navigator_wp_json() {
498 498
 
499
-	$results = wl_shortcode_navigator_data();
500
-	if ( ob_get_contents() ) {
501
-		ob_clean();
502
-	}
499
+    $results = wl_shortcode_navigator_data();
500
+    if ( ob_get_contents() ) {
501
+        ob_clean();
502
+    }
503 503
 
504
-	return array(
505
-		'items' => array(
506
-			array( 'values' => $results ),
507
-		),
508
-	);
504
+    return array(
505
+        'items' => array(
506
+            array( 'values' => $results ),
507
+        ),
508
+    );
509 509
 
510 510
 }
511 511
 
@@ -513,22 +513,22 @@  discard block
 block discarded – undo
513 513
  * Adding `rest_api_init` action for amp backend of navigator
514 514
  */
515 515
 add_action( 'rest_api_init', function () {
516
-	register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, '/navigator', array(
517
-		'methods'             => 'GET',
518
-		'permission_callback' => '__return_true',
519
-		'callback'            => 'wl_shortcode_navigator_wp_json'
520
-	) );
516
+    register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, '/navigator', array(
517
+        'methods'             => 'GET',
518
+        'permission_callback' => '__return_true',
519
+        'callback'            => 'wl_shortcode_navigator_wp_json'
520
+    ) );
521 521
 } );
522 522
 
523 523
 /**
524 524
  * Adding `rest_api_init` action for backend of network navigator
525 525
  */
526 526
 add_action( 'rest_api_init', function () {
527
-	register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, '/network-navigator', array(
528
-		'methods'             => 'GET',
529
-		'callback'            => 'wl_network_navigator_wp_json',
530
-		'permission_callback' => '__return_true',
531
-	) );
527
+    register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, '/network-navigator', array(
528
+        'methods'             => 'GET',
529
+        'callback'            => 'wl_network_navigator_wp_json',
530
+        'permission_callback' => '__return_true',
531
+    ) );
532 532
 } );
533 533
 
534 534
 /**
@@ -538,22 +538,22 @@  discard block
 block discarded – undo
538 538
  */
539 539
 add_action( 'plugins_loaded', function () {
540 540
 
541
-	if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || 'wl_navigator' !== $_REQUEST['action'] ) {
542
-		return;
543
-	}
541
+    if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || 'wl_navigator' !== $_REQUEST['action'] ) {
542
+        return;
543
+    }
544 544
 
545
-	remove_action( 'plugins_loaded', 'rocket_init' );
546
-	remove_action( 'plugins_loaded', 'wpseo_premium_init', 14 );
547
-	remove_action( 'plugins_loaded', 'wpseo_init', 14 );
545
+    remove_action( 'plugins_loaded', 'rocket_init' );
546
+    remove_action( 'plugins_loaded', 'wpseo_premium_init', 14 );
547
+    remove_action( 'plugins_loaded', 'wpseo_init', 14 );
548 548
 }, 0 );
549 549
 
550 550
 add_action( 'init', function () {
551 551
 
552
-	if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || 'wl_navigator' !== $_REQUEST['action'] ) {
553
-		return;
554
-	}
552
+    if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || 'wl_navigator' !== $_REQUEST['action'] ) {
553
+        return;
554
+    }
555 555
 
556
-	remove_action( 'init', 'wp_widgets_init', 1 );
557
-	remove_action( 'init', 'gglcptch_init' );
556
+    remove_action( 'init', 'wp_widgets_init', 1 );
557
+    remove_action( 'init', 'gglcptch_init' );
558 558
 }, 0 );
559 559
 
Please login to merge, or discard this patch.
Spacing   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -18,25 +18,25 @@  discard block
 block discarded – undo
18 18
 
19 19
 	// Create the cache key.
20 20
 	$cache_key_params = $_REQUEST;
21
-	unset( $cache_key_params['uniqid'] );
22
-	$cache_key = array( 'request_params' => $cache_key_params );
21
+	unset($cache_key_params['uniqid']);
22
+	$cache_key = array('request_params' => $cache_key_params);
23 23
 
24 24
 	// Create the TTL cache and try to get the results.
25
-	$cache         = new Ttl_Cache( "navigator", 8 * 60 * 60 ); // 8 hours.
26
-	$cache_results = $cache->get( $cache_key );
25
+	$cache         = new Ttl_Cache("navigator", 8 * 60 * 60); // 8 hours.
26
+	$cache_results = $cache->get($cache_key);
27 27
 
28
-	if ( isset( $cache_results ) ) {
29
-		header( 'X-WordLift-Cache: HIT' );
28
+	if (isset($cache_results)) {
29
+		header('X-WordLift-Cache: HIT');
30 30
 
31 31
 		return $cache_results;
32 32
 	}
33 33
 
34
-	header( 'X-WordLift-Cache: MISS' );
34
+	header('X-WordLift-Cache: MISS');
35 35
 
36 36
 	$results = _wl_navigator_get_data();
37 37
 
38 38
 	// Put the result before sending the json to the client, since sending the json will terminate us.
39
-	$cache->put( $cache_key, $results );
39
+	$cache->put($cache_key, $results);
40 40
 
41 41
 	return $results;
42 42
 }
@@ -51,29 +51,29 @@  discard block
 block discarded – undo
51 51
  * @since 3.22.6
52 52
  *
53 53
  */
54
-function wl_network_navigator_wp_json( $request ) {
54
+function wl_network_navigator_wp_json($request) {
55 55
 
56 56
 	// Create the cache key.
57 57
 	$cache_key_params = $_REQUEST;
58
-	unset( $cache_key_params['uniqid'] );
59
-	$cache_key = array( 'request_params' => $cache_key_params );
58
+	unset($cache_key_params['uniqid']);
59
+	$cache_key = array('request_params' => $cache_key_params);
60 60
 
61 61
 	// Create the TTL cache and try to get the results.
62
-	$cache         = new Ttl_Cache( "network-navigator", 8 * 60 * 60 ); // 8 hours.
63
-	$cache_results = $cache->get( $cache_key );
62
+	$cache         = new Ttl_Cache("network-navigator", 8 * 60 * 60); // 8 hours.
63
+	$cache_results = $cache->get($cache_key);
64 64
 
65
-	if ( isset( $cache_results ) ) {
66
-		header( 'X-WordLift-Cache: HIT' );
65
+	if (isset($cache_results)) {
66
+		header('X-WordLift-Cache: HIT');
67 67
 
68 68
 		return $cache_results;
69 69
 	}
70 70
 
71
-	header( 'X-WordLift-Cache: MISS' );
71
+	header('X-WordLift-Cache: MISS');
72 72
 
73
-	$results = _wl_network_navigator_get_data( $request );
73
+	$results = _wl_network_navigator_get_data($request);
74 74
 
75 75
 	// Put the result before sending the json to the client, since sending the json will terminate us.
76
-	$cache->put( $cache_key, $results );
76
+	$cache->put($cache_key, $results);
77 77
 
78 78
 	return $results;
79 79
 
@@ -82,53 +82,53 @@  discard block
 block discarded – undo
82 82
 function _wl_navigator_get_data() {
83 83
 
84 84
 	// Post ID must be defined
85
-	if ( ! isset( $_GET['post_id'] ) ) {
86
-		wp_send_json_error( 'No post_id given' );
85
+	if ( ! isset($_GET['post_id'])) {
86
+		wp_send_json_error('No post_id given');
87 87
 
88 88
 		return array();
89 89
 	}
90 90
 
91 91
 	// Post ID must be defined
92
-	if ( ! isset( $_GET['uniqid'] ) ) {
93
-		wp_send_json_error( 'No uniqid given' );
92
+	if ( ! isset($_GET['uniqid'])) {
93
+		wp_send_json_error('No uniqid given');
94 94
 
95 95
 		return array();
96 96
 	}
97 97
 
98 98
 	// Limit the results (defaults to 4)
99
-	$navigator_length = isset( $_GET['limit'] ) ? intval( $_GET['limit'] ) : 4;
100
-	$navigator_offset = isset( $_GET['offset'] ) ? intval( $_GET['offset'] ) : 0;
101
-	$order_by         = isset( $_GET['sort'] ) ? sanitize_sql_orderby( $_GET['sort'] ) : 'ID DESC';
99
+	$navigator_length = isset($_GET['limit']) ? intval($_GET['limit']) : 4;
100
+	$navigator_offset = isset($_GET['offset']) ? intval($_GET['offset']) : 0;
101
+	$order_by         = isset($_GET['sort']) ? sanitize_sql_orderby($_GET['sort']) : 'ID DESC';
102 102
 
103 103
 	$current_post_id = $_GET['post_id'];
104
-	$current_post    = get_post( $current_post_id );
104
+	$current_post    = get_post($current_post_id);
105 105
 
106 106
 	$navigator_id = $_GET['uniqid'];
107 107
 
108 108
 	// Post ID has to match an existing item
109
-	if ( null === $current_post ) {
110
-		wp_send_json_error( 'No valid post_id given' );
109
+	if (null === $current_post) {
110
+		wp_send_json_error('No valid post_id given');
111 111
 
112 112
 		return array();
113 113
 	}
114 114
 
115 115
 	// Determine navigator type and call respective _get_results
116
-	if ( get_post_type( $current_post_id ) === Wordlift_Entity_Service::TYPE_NAME ) {
117
-		$referencing_posts = _wl_entity_navigator_get_results( $current_post_id, array(
116
+	if (get_post_type($current_post_id) === Wordlift_Entity_Service::TYPE_NAME) {
117
+		$referencing_posts = _wl_entity_navigator_get_results($current_post_id, array(
118 118
 			'ID',
119 119
 			'post_title',
120
-		), $order_by, $navigator_length, $navigator_offset );
120
+		), $order_by, $navigator_length, $navigator_offset);
121 121
 	} else {
122
-		$referencing_posts = _wl_navigator_get_results( $current_post_id, array(
122
+		$referencing_posts = _wl_navigator_get_results($current_post_id, array(
123 123
 			'ID',
124 124
 			'post_title',
125
-		), $order_by, $navigator_length, $navigator_offset );
125
+		), $order_by, $navigator_length, $navigator_offset);
126 126
 	}
127 127
 
128 128
 	// loop over them and take the first one which is not already in the $related_posts
129 129
 	$results = array();
130
-	foreach ( $referencing_posts as $referencing_post ) {
131
-		$serialized_entity = wl_serialize_entity( $referencing_post->entity_id );
130
+	foreach ($referencing_posts as $referencing_post) {
131
+		$serialized_entity = wl_serialize_entity($referencing_post->entity_id);
132 132
 
133 133
 		/**
134 134
 		 * Use the thumbnail.
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
 		 *
139 139
 		 * @since 3.19.3 We're using the medium size image.
140 140
 		 */
141
-		$thumbnail = get_the_post_thumbnail_url( $referencing_post, 'medium' );
141
+		$thumbnail = get_the_post_thumbnail_url($referencing_post, 'medium');
142 142
 
143 143
 		$result = array(
144 144
 			'post'   => array(
145 145
 				'id'        => $referencing_post->ID,
146
-				'permalink' => get_permalink( $referencing_post->ID ),
146
+				'permalink' => get_permalink($referencing_post->ID),
147 147
 				'title'     => $referencing_post->post_title,
148 148
 				'thumbnail' => $thumbnail,
149 149
 			),
@@ -151,60 +151,60 @@  discard block
 block discarded – undo
151 151
 				'id'        => $referencing_post->entity_id,
152 152
 				'label'     => $serialized_entity['label'],
153 153
 				'mainType'  => $serialized_entity['mainType'],
154
-				'permalink' => get_permalink( $referencing_post->entity_id ),
154
+				'permalink' => get_permalink($referencing_post->entity_id),
155 155
 			),
156 156
 		);
157 157
 
158 158
 		$results[] = $result;
159 159
 	}
160 160
 
161
-	if ( count( $results ) < $navigator_length ) {
162
-		$results = apply_filters( 'wl_navigator_data_placeholder', $results, $navigator_id, $navigator_offset, $navigator_length );
161
+	if (count($results) < $navigator_length) {
162
+		$results = apply_filters('wl_navigator_data_placeholder', $results, $navigator_id, $navigator_offset, $navigator_length);
163 163
 	}
164 164
 
165 165
 	// Add filler posts if needed
166
-	$filler_count = $navigator_length - count( $results );
167
-	if ( $filler_count > 0 ) {
168
-		$referencing_post_ids = array_map( function ( $p ) {
166
+	$filler_count = $navigator_length - count($results);
167
+	if ($filler_count > 0) {
168
+		$referencing_post_ids = array_map(function($p) {
169 169
 			return $p->ID;
170
-		}, $referencing_posts );
171
-		$filler_posts         = wl_shortcode_navigator_filler_posts( $filler_count, $current_post_id, $referencing_post_ids );
172
-		$results              = array_merge( $results, $filler_posts );
170
+		}, $referencing_posts);
171
+		$filler_posts         = wl_shortcode_navigator_filler_posts($filler_count, $current_post_id, $referencing_post_ids);
172
+		$results              = array_merge($results, $filler_posts);
173 173
 	}
174 174
 
175 175
 	// Apply filters after fillers are added
176
-	foreach ( $results as $result_index => $result ) {
177
-		$results[ $result_index ]['post']   = apply_filters( 'wl_navigator_data_post', $result['post'], intval( $result['post']['id'] ), $navigator_id );
178
-		$results[ $result_index ]['entity'] = apply_filters( 'wl_navigator_data_entity', $result['entity'], intval( $result['entity']['id'] ), $navigator_id );
176
+	foreach ($results as $result_index => $result) {
177
+		$results[$result_index]['post']   = apply_filters('wl_navigator_data_post', $result['post'], intval($result['post']['id']), $navigator_id);
178
+		$results[$result_index]['entity'] = apply_filters('wl_navigator_data_entity', $result['entity'], intval($result['entity']['id']), $navigator_id);
179 179
 	}
180 180
 
181 181
 	return $results;
182 182
 }
183 183
 
184
-function _wl_network_navigator_get_data( $request ) {
184
+function _wl_network_navigator_get_data($request) {
185 185
 
186 186
 	// Limit the results (defaults to 4)
187
-	$navigator_length = isset( $request['limit'] ) ? intval( $request['limit'] ) : 4;
188
-	$navigator_offset = isset( $request['offset'] ) ? intval( $request['offset'] ) : 0;
187
+	$navigator_length = isset($request['limit']) ? intval($request['limit']) : 4;
188
+	$navigator_offset = isset($request['offset']) ? intval($request['offset']) : 0;
189 189
 	$navigator_id     = $request['uniqid'];
190
-	$order_by         = isset( $_GET['sort'] ) ? sanitize_sql_orderby( $_GET['sort'] ) : 'ID DESC';
190
+	$order_by         = isset($_GET['sort']) ? sanitize_sql_orderby($_GET['sort']) : 'ID DESC';
191 191
 
192 192
 	$entities = $request['entities'];
193 193
 
194 194
 	// Post ID has to match an existing item
195
-	if ( ! isset( $entities ) || empty( $entities ) ) {
196
-		wp_send_json_error( 'No valid entities provided' );
195
+	if ( ! isset($entities) || empty($entities)) {
196
+		wp_send_json_error('No valid entities provided');
197 197
 	}
198 198
 
199
-	$referencing_posts = _wl_network_navigator_get_results( $entities, array(
199
+	$referencing_posts = _wl_network_navigator_get_results($entities, array(
200 200
 		'ID',
201 201
 		'post_title',
202
-	), $order_by, $navigator_length, $navigator_offset );
202
+	), $order_by, $navigator_length, $navigator_offset);
203 203
 
204 204
 	// loop over them and take the first one which is not already in the $related_posts
205 205
 	$results = array();
206
-	foreach ( $referencing_posts as $referencing_post ) {
207
-		$serialized_entity = wl_serialize_entity( $referencing_post->entity_id );
206
+	foreach ($referencing_posts as $referencing_post) {
207
+		$serialized_entity = wl_serialize_entity($referencing_post->entity_id);
208 208
 
209 209
 		/**
210 210
 		 * Use the thumbnail.
@@ -214,30 +214,30 @@  discard block
 block discarded – undo
214 214
 		 *
215 215
 		 * @since 3.19.3 We're using the medium size image.
216 216
 		 */
217
-		$thumbnail = get_the_post_thumbnail_url( $referencing_post, 'medium' );
217
+		$thumbnail = get_the_post_thumbnail_url($referencing_post, 'medium');
218 218
 
219 219
 		$result = array(
220 220
 			'post'   => array(
221
-				'permalink' => get_permalink( $referencing_post->ID ),
221
+				'permalink' => get_permalink($referencing_post->ID),
222 222
 				'title'     => $referencing_post->post_title,
223 223
 				'thumbnail' => $thumbnail,
224 224
 			),
225 225
 			'entity' => array(
226 226
 				'label'     => $serialized_entity['label'],
227 227
 				'mainType'  => $serialized_entity['mainType'],
228
-				'permalink' => get_permalink( $referencing_post->entity_id ),
228
+				'permalink' => get_permalink($referencing_post->entity_id),
229 229
 			),
230 230
 		);
231 231
 
232
-		$result['post']   = apply_filters( 'wl_network_navigator_data_post', $result['post'], intval( $referencing_post->ID ), $navigator_id );
233
-		$result['entity'] = apply_filters( 'wl_network_navigator_data_entity', $result['entity'], intval( $referencing_post->entity_id ), $navigator_id );
232
+		$result['post']   = apply_filters('wl_network_navigator_data_post', $result['post'], intval($referencing_post->ID), $navigator_id);
233
+		$result['entity'] = apply_filters('wl_network_navigator_data_entity', $result['entity'], intval($referencing_post->entity_id), $navigator_id);
234 234
 
235 235
 		$results[] = $result;
236 236
 
237 237
 	}
238 238
 
239
-	if ( count( $results ) < $navigator_length ) {
240
-		$results = apply_filters( 'wl_network_navigator_data_placeholder', $results, $navigator_id, $navigator_offset, $navigator_length );
239
+	if (count($results) < $navigator_length) {
240
+		$results = apply_filters('wl_network_navigator_data_placeholder', $results, $navigator_id, $navigator_offset, $navigator_length);
241 241
 	}
242 242
 
243 243
 	return $results;
@@ -253,17 +253,17 @@  discard block
 block discarded – undo
253 253
 ) {
254 254
 	global $wpdb;
255 255
 
256
-	$select = implode( ', ', array_map( function ( $item ) {
256
+	$select = implode(', ', array_map(function($item) {
257 257
 		return "p.$item AS $item";
258
-	}, (array) $fields ) );
258
+	}, (array) $fields));
259 259
 
260
-	$order_by = implode( ', ', array_map( function ( $item ) {
260
+	$order_by = implode(', ', array_map(function($item) {
261 261
 		return "p.$item";
262
-	}, (array) $order_by ) );
262
+	}, (array) $order_by));
263 263
 
264 264
 	/** @noinspection SqlNoDataSourceInspection */
265 265
 	return $wpdb->get_results(
266
-		$wpdb->prepare( <<<EOF
266
+		$wpdb->prepare(<<<EOF
267 267
 SELECT %4\$s, p2.ID as entity_id
268 268
  FROM {$wpdb->prefix}wl_relation_instances r1
269 269
     INNER JOIN {$wpdb->prefix}wl_relation_instances r2
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
  LIMIT %2\$d
296 296
  OFFSET %3\$d
297 297
 EOF
298
-			, $post_id, $limit, $offset, $select, $order_by )
298
+			, $post_id, $limit, $offset, $select, $order_by)
299 299
 	);
300 300
 
301 301
 }
@@ -308,17 +308,17 @@  discard block
 block discarded – undo
308 308
 ) {
309 309
 	global $wpdb;
310 310
 
311
-	$select = implode( ', ', array_map( function ( $item ) {
311
+	$select = implode(', ', array_map(function($item) {
312 312
 		return "p.$item AS $item";
313
-	}, (array) $fields ) );
313
+	}, (array) $fields));
314 314
 
315
-	$order_by = implode( ', ', array_map( function ( $item ) {
315
+	$order_by = implode(', ', array_map(function($item) {
316 316
 		return "p.$item";
317
-	}, (array) $order_by ) );
317
+	}, (array) $order_by));
318 318
 
319 319
 	/** @noinspection SqlNoDataSourceInspection */
320 320
 	return $wpdb->get_results(
321
-		$wpdb->prepare( <<<EOF
321
+		$wpdb->prepare(<<<EOF
322 322
 SELECT %4\$s, p2.ID as entity_id
323 323
  FROM {$wpdb->prefix}wl_relation_instances r1
324 324
 	-- get the ID of the post entity in common between the object and the subject 2. 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
  LIMIT %2\$d
348 348
  OFFSET %3\$d
349 349
 EOF
350
-			, $post_id, $limit, $offset, $select, $order_by )
350
+			, $post_id, $limit, $offset, $select, $order_by)
351 351
 	);
352 352
 }
353 353
 
@@ -359,24 +359,24 @@  discard block
 block discarded – undo
359 359
 ) {
360 360
 	global $wpdb;
361 361
 
362
-	$select = implode( ', ', array_map( function ( $item ) {
362
+	$select = implode(', ', array_map(function($item) {
363 363
 		return "p.$item AS $item";
364
-	}, (array) $fields ) );
364
+	}, (array) $fields));
365 365
 
366
-	$order_by = implode( ', ', array_map( function ( $item ) {
366
+	$order_by = implode(', ', array_map(function($item) {
367 367
 		return "p.$item";
368
-	}, (array) $order_by ) );
368
+	}, (array) $order_by));
369 369
 
370
-	$entities_in = implode( ',', array_map( function ( $item ) {
371
-		$entity = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( urldecode( $item ) );
372
-		if ( isset( $entity ) ) {
370
+	$entities_in = implode(',', array_map(function($item) {
371
+		$entity = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri(urldecode($item));
372
+		if (isset($entity)) {
373 373
 			return $entity->ID;
374 374
 		}
375
-	}, $entities ) );
375
+	}, $entities));
376 376
 
377 377
 	/** @noinspection SqlNoDataSourceInspection */
378 378
 	return $wpdb->get_results(
379
-		$wpdb->prepare( <<<EOF
379
+		$wpdb->prepare(<<<EOF
380 380
 SELECT %3\$s, p2.ID as entity_id
381 381
  FROM {$wpdb->prefix}wl_relation_instances r1
382 382
 	-- get the ID of the post entity in common between the object and the subject 2. 
@@ -402,19 +402,19 @@  discard block
 block discarded – undo
402 402
  LIMIT %1\$d
403 403
  OFFSET %2\$d
404 404
 EOF
405
-			, $limit, $offset, $select, $order_by )
405
+			, $limit, $offset, $select, $order_by)
406 406
 	);
407 407
 
408 408
 }
409 409
 
410
-function wl_shortcode_navigator_filler_posts( $filler_count, $current_post_id, $referencing_post_ids ) {
410
+function wl_shortcode_navigator_filler_posts($filler_count, $current_post_id, $referencing_post_ids) {
411 411
 
412 412
 	$filler_posts = array();
413 413
 
414 414
 	// First add latest posts from same categories as the current post
415
-	if ( $filler_count > 0 ) {
415
+	if ($filler_count > 0) {
416 416
 
417
-		$current_post_categories = wp_get_post_categories( $current_post_id );
417
+		$current_post_categories = wp_get_post_categories($current_post_id);
418 418
 
419 419
 		$args = array(
420 420
 			'meta_query'          => array(
@@ -424,20 +424,20 @@  discard block
 block discarded – undo
424 424
 			),
425 425
 			'category__in'        => $current_post_categories,
426 426
 			'numberposts'         => $filler_count,
427
-			'post__not_in'        => array_merge( array( $current_post_id ), $referencing_post_ids ),
427
+			'post__not_in'        => array_merge(array($current_post_id), $referencing_post_ids),
428 428
 			'ignore_sticky_posts' => 1
429 429
 		);
430 430
 
431
-		$filler_posts = get_posts( $args );
431
+		$filler_posts = get_posts($args);
432 432
 	}
433 433
 
434
-	$filler_count    = $filler_count - count( $filler_posts );
435
-	$filler_post_ids = array_map( function ( $post ) {
434
+	$filler_count    = $filler_count - count($filler_posts);
435
+	$filler_post_ids = array_map(function($post) {
436 436
 		return $post->ID;
437
-	}, $filler_posts );
437
+	}, $filler_posts);
438 438
 
439 439
 	// If that does not fill, add latest posts irrespective of category
440
-	if ( $filler_count > 0 ) {
440
+	if ($filler_count > 0) {
441 441
 
442 442
 		$args = array(
443 443
 			'meta_query'          => array(
@@ -446,24 +446,24 @@  discard block
 block discarded – undo
446 446
 				)
447 447
 			),
448 448
 			'numberposts'         => $filler_count,
449
-			'post__not_in'        => array_merge( array( $current_post_id ), $filler_post_ids, $referencing_post_ids ),
449
+			'post__not_in'        => array_merge(array($current_post_id), $filler_post_ids, $referencing_post_ids),
450 450
 			'ignore_sticky_posts' => 1
451 451
 		);
452 452
 
453
-		$filler_posts = array_merge( $filler_posts, get_posts( $args ) );
453
+		$filler_posts = array_merge($filler_posts, get_posts($args));
454 454
 
455 455
 	}
456 456
 
457 457
 	// Add thumbnail and permalink to filler posts
458 458
 	$filler_response = array();
459
-	foreach ( $filler_posts as $post_obj ) {
460
-		$thumbnail         = get_the_post_thumbnail_url( $post_obj, 'medium' );
459
+	foreach ($filler_posts as $post_obj) {
460
+		$thumbnail         = get_the_post_thumbnail_url($post_obj, 'medium');
461 461
 		$filler_response[] = array(
462 462
 			'post'   => array(
463 463
 				'id'        => $post_obj->ID,
464
-				'permalink' => get_permalink( $post_obj->ID ),
465
-				'thumbnail' => ( $thumbnail ) ? $thumbnail : WL_DEFAULT_THUMBNAIL_PATH,
466
-				'title'     => get_the_title( $post_obj->ID )
464
+				'permalink' => get_permalink($post_obj->ID),
465
+				'thumbnail' => ($thumbnail) ? $thumbnail : WL_DEFAULT_THUMBNAIL_PATH,
466
+				'title'     => get_the_title($post_obj->ID)
467 467
 			),
468 468
 			'entity' => array(
469 469
 				'id' => 0
@@ -484,12 +484,12 @@  discard block
 block discarded – undo
484 484
 
485 485
 	// Temporary blocking the Navigator.
486 486
 	$results = wl_shortcode_navigator_data();
487
-	wl_core_send_json( $results );
487
+	wl_core_send_json($results);
488 488
 
489 489
 }
490 490
 
491
-add_action( 'wp_ajax_wl_navigator', 'wl_shortcode_navigator_ajax' );
492
-add_action( 'wp_ajax_nopriv_wl_navigator', 'wl_shortcode_navigator_ajax' );
491
+add_action('wp_ajax_wl_navigator', 'wl_shortcode_navigator_ajax');
492
+add_action('wp_ajax_nopriv_wl_navigator', 'wl_shortcode_navigator_ajax');
493 493
 
494 494
 /**
495 495
  * wp-json call for the navigator widget
@@ -497,13 +497,13 @@  discard block
 block discarded – undo
497 497
 function wl_shortcode_navigator_wp_json() {
498 498
 
499 499
 	$results = wl_shortcode_navigator_data();
500
-	if ( ob_get_contents() ) {
500
+	if (ob_get_contents()) {
501 501
 		ob_clean();
502 502
 	}
503 503
 
504 504
 	return array(
505 505
 		'items' => array(
506
-			array( 'values' => $results ),
506
+			array('values' => $results),
507 507
 		),
508 508
 	);
509 509
 
@@ -512,23 +512,23 @@  discard block
 block discarded – undo
512 512
 /**
513 513
  * Adding `rest_api_init` action for amp backend of navigator
514 514
  */
515
-add_action( 'rest_api_init', function () {
516
-	register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, '/navigator', array(
515
+add_action('rest_api_init', function() {
516
+	register_rest_route(WL_REST_ROUTE_DEFAULT_NAMESPACE, '/navigator', array(
517 517
 		'methods'             => 'GET',
518 518
 		'permission_callback' => '__return_true',
519 519
 		'callback'            => 'wl_shortcode_navigator_wp_json'
520
-	) );
520
+	));
521 521
 } );
522 522
 
523 523
 /**
524 524
  * Adding `rest_api_init` action for backend of network navigator
525 525
  */
526
-add_action( 'rest_api_init', function () {
527
-	register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, '/network-navigator', array(
526
+add_action('rest_api_init', function() {
527
+	register_rest_route(WL_REST_ROUTE_DEFAULT_NAMESPACE, '/network-navigator', array(
528 528
 		'methods'             => 'GET',
529 529
 		'callback'            => 'wl_network_navigator_wp_json',
530 530
 		'permission_callback' => '__return_true',
531
-	) );
531
+	));
532 532
 } );
533 533
 
534 534
 /**
@@ -536,24 +536,24 @@  discard block
 block discarded – undo
536 536
  *
537 537
  * @since 2.2.0
538 538
  */
539
-add_action( 'plugins_loaded', function () {
539
+add_action('plugins_loaded', function() {
540 540
 
541
-	if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || 'wl_navigator' !== $_REQUEST['action'] ) {
541
+	if ( ! defined('DOING_AJAX') || ! DOING_AJAX || 'wl_navigator' !== $_REQUEST['action']) {
542 542
 		return;
543 543
 	}
544 544
 
545
-	remove_action( 'plugins_loaded', 'rocket_init' );
546
-	remove_action( 'plugins_loaded', 'wpseo_premium_init', 14 );
547
-	remove_action( 'plugins_loaded', 'wpseo_init', 14 );
548
-}, 0 );
545
+	remove_action('plugins_loaded', 'rocket_init');
546
+	remove_action('plugins_loaded', 'wpseo_premium_init', 14);
547
+	remove_action('plugins_loaded', 'wpseo_init', 14);
548
+}, 0);
549 549
 
550
-add_action( 'init', function () {
550
+add_action('init', function() {
551 551
 
552
-	if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || 'wl_navigator' !== $_REQUEST['action'] ) {
552
+	if ( ! defined('DOING_AJAX') || ! DOING_AJAX || 'wl_navigator' !== $_REQUEST['action']) {
553 553
 		return;
554 554
 	}
555 555
 
556
-	remove_action( 'init', 'wp_widgets_init', 1 );
557
-	remove_action( 'init', 'gglcptch_init' );
558
-}, 0 );
556
+	remove_action('init', 'wp_widgets_init', 1);
557
+	remove_action('init', 'gglcptch_init');
558
+}, 0);
559 559
 
Please login to merge, or discard this patch.
src/wordlift/autocomplete/class-linked-data-autocomplete-service.php 2 patches
Indentation   +170 added lines, -170 removed lines patch added patch discarded remove patch
@@ -16,175 +16,175 @@
 block discarded – undo
16 16
 
17 17
 class Linked_Data_Autocomplete_Service implements Autocomplete_Service {
18 18
 
19
-	/**
20
-	 * The {@link Wordlift_Configuration_Service} instance.
21
-	 *
22
-	 * @since  3.15.0
23
-	 * @access private
24
-	 * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
25
-	 */
26
-	private $configuration_service;
27
-
28
-	/**
29
-	 * A {@link Wordlift_Log_Service} instance.
30
-	 *
31
-	 * @since  3.15.0
32
-	 * @access private
33
-	 * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
34
-	 */
35
-	private $log;
36
-	private $entity_helper;
37
-	private $entity_uri_service;
38
-	/**
39
-	 * @var \Wordlift_Entity_Service
40
-	 */
41
-	private $entity_service;
42
-
43
-	/**
44
-	 * The {@link Class_Wordlift_Autocomplete_Service} instance.
45
-	 *
46
-	 * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
47
-	 * @param Entity_Helper $entity_helper
48
-	 * @param \Wordlift_Entity_Uri_Service $entity_uri_service
49
-	 * @param \Wordlift_Entity_Service $entity_service
50
-	 *
51
-	 * @since 3.15.0
52
-	 */
53
-	public function __construct( $configuration_service, $entity_helper, $entity_uri_service, $entity_service ) {
54
-
55
-		$this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Autocomplete_Service' );
56
-
57
-		$this->configuration_service = $configuration_service;
58
-		$this->entity_helper         = $entity_helper;
59
-		$this->entity_uri_service    = $entity_uri_service;
60
-		$this->entity_service        = $entity_service;
61
-
62
-	}
63
-
64
-	/**
65
-	 * Make request to external API and return the response.
66
-	 *
67
-	 * @param string $query The search string.
68
-	 * @param string $scope The search scope: "local" will search only in the local dataset; "cloud" will search also
69
-	 *                      in Wikipedia. By default is "cloud".
70
-	 * @param array|string $excludes The exclude parameter string.
71
-	 *
72
-	 * @return array $response The API response.
73
-	 * @since 3.15.0
74
-	 *
75
-	 */
76
-	public function query( $query, $scope = 'cloud', $excludes = array() ) {
77
-
78
-		$results = $this->do_query( $query, $scope, $excludes );
79
-
80
-		$uris = array_reduce( $results, function ( $carry, $result ) {
81
-
82
-			$carry[] = $result['id'];
83
-
84
-			return array_merge( $carry, $result['sameAss'] );
85
-		}, array() );
86
-
87
-		$mappings = $this->entity_helper->map_many_to_local( $uris );
88
-
89
-		$that           = $this;
90
-		$mapped_results = array_map( function ( $result ) use ( $that, $mappings ) {
91
-
92
-			if ( $that->entity_uri_service->is_internal( $result['id'] ) ) {
93
-				return $result;
94
-			}
95
-
96
-			$uris = array_merge( (array) $result['id'], $result['sameAss'] );
97
-
98
-			foreach ( $uris as $uri ) {
99
-				if ( isset( $mappings[ $uri ] ) ) {
100
-					$local_entity = $that->entity_uri_service->get_entity( $mappings[ $uri ] );
101
-
102
-					return $that->post_to_autocomplete_result( $mappings[ $uri ], $local_entity );
103
-				}
104
-			}
105
-
106
-			return $result;
107
-		}, $results );
108
-
109
-		return $mapped_results;
110
-	}
111
-
112
-	private function do_query( $query, $scope = 'cloud', $exclude = '' ) {
113
-		$url = $this->build_request_url( $query, $exclude, $scope );
114
-
115
-		// Return the response.
116
-		$response = Default_Api_Service::get_instance()->get( $url )->get_response();
117
-
118
-		// If the response is valid, then send the suggestions.
119
-		if ( ! is_wp_error( $response ) && 200 === (int) $response['response']['code'] ) {
120
-			// Echo the response.
121
-			return json_decode( wp_remote_retrieve_body( $response ), true );
122
-		} else {
123
-			// Default error message.
124
-			$error_message = 'Something went wrong.';
125
-
126
-			// Get the real error message if there is WP_Error.
127
-			if ( is_wp_error( $response ) ) {
128
-				$error_message = $response->get_error_message();
129
-			}
130
-
131
-			$this->log->error( $error_message );
132
-
133
-			return array();
134
-		}
135
-	}
136
-
137
-	/**
138
-	 * Build the autocomplete url.
139
-	 *
140
-	 * @param string $query The search string.
141
-	 * @param array|string $exclude The exclude parameter.
142
-	 * @param string $scope The search scope: "local" will search only in the local dataset; "cloud" will search also
143
-	 *                      in Wikipedia. By default is "cloud".
144
-	 *
145
-	 * @return string Built url.
146
-	 * @since 3.15.0
147
-	 *
148
-	 */
149
-	private function build_request_url( $query, $exclude, $scope ) {
150
-		$args = array(
151
-			'key'      => $this->configuration_service->get_key(),
152
-			'language' => $this->configuration_service->get_language_code(),
153
-			'query'    => $query,
154
-			'scope'    => $scope,
155
-			'limit'    => 10,
156
-		);
157
-
158
-		// Add args to URL.
159
-		$request_url = add_query_arg(
160
-			urlencode_deep( $args ),
161
-			'/autocomplete'
162
-		);
163
-
164
-		// Add the exclude parameter.
165
-		if ( ! empty( $exclude ) ) {
166
-			$request_url .= "&exclude=" . implode( '&exclude=', array_map( 'urlencode', (array) $exclude ) );
167
-		}
168
-
169
-		// return the built url.
170
-		return $request_url;
171
-	}
172
-
173
-	private function post_to_autocomplete_result( $uri, $post ) {
174
-
175
-		return array(
176
-			'id'           => $uri,
177
-			'label'        => array( $post->post_title ),
178
-			'labels'       => $this->entity_service->get_alternative_labels( $post->ID ),
179
-			'descriptions' => array( Wordlift_Post_Excerpt_Helper::get_text_excerpt( $post ) ),
180
-			'scope'        => 'local',
181
-			'sameAss'      => get_post_meta( $post->ID, \Wordlift_Schema_Service::FIELD_SAME_AS ),
182
-			// The following properties are less relevant because we're linking entities that exist already in the
183
-			// vocabulary. That's why we don't make an effort to load the real data.
184
-			'types'        => array( 'http://schema.org/Thing' ),
185
-			'urls'         => array(),
186
-			'images'       => array(),
187
-		);
188
-	}
19
+    /**
20
+     * The {@link Wordlift_Configuration_Service} instance.
21
+     *
22
+     * @since  3.15.0
23
+     * @access private
24
+     * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
25
+     */
26
+    private $configuration_service;
27
+
28
+    /**
29
+     * A {@link Wordlift_Log_Service} instance.
30
+     *
31
+     * @since  3.15.0
32
+     * @access private
33
+     * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
34
+     */
35
+    private $log;
36
+    private $entity_helper;
37
+    private $entity_uri_service;
38
+    /**
39
+     * @var \Wordlift_Entity_Service
40
+     */
41
+    private $entity_service;
42
+
43
+    /**
44
+     * The {@link Class_Wordlift_Autocomplete_Service} instance.
45
+     *
46
+     * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
47
+     * @param Entity_Helper $entity_helper
48
+     * @param \Wordlift_Entity_Uri_Service $entity_uri_service
49
+     * @param \Wordlift_Entity_Service $entity_service
50
+     *
51
+     * @since 3.15.0
52
+     */
53
+    public function __construct( $configuration_service, $entity_helper, $entity_uri_service, $entity_service ) {
54
+
55
+        $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Autocomplete_Service' );
56
+
57
+        $this->configuration_service = $configuration_service;
58
+        $this->entity_helper         = $entity_helper;
59
+        $this->entity_uri_service    = $entity_uri_service;
60
+        $this->entity_service        = $entity_service;
61
+
62
+    }
63
+
64
+    /**
65
+     * Make request to external API and return the response.
66
+     *
67
+     * @param string $query The search string.
68
+     * @param string $scope The search scope: "local" will search only in the local dataset; "cloud" will search also
69
+     *                      in Wikipedia. By default is "cloud".
70
+     * @param array|string $excludes The exclude parameter string.
71
+     *
72
+     * @return array $response The API response.
73
+     * @since 3.15.0
74
+     *
75
+     */
76
+    public function query( $query, $scope = 'cloud', $excludes = array() ) {
77
+
78
+        $results = $this->do_query( $query, $scope, $excludes );
79
+
80
+        $uris = array_reduce( $results, function ( $carry, $result ) {
81
+
82
+            $carry[] = $result['id'];
83
+
84
+            return array_merge( $carry, $result['sameAss'] );
85
+        }, array() );
86
+
87
+        $mappings = $this->entity_helper->map_many_to_local( $uris );
88
+
89
+        $that           = $this;
90
+        $mapped_results = array_map( function ( $result ) use ( $that, $mappings ) {
91
+
92
+            if ( $that->entity_uri_service->is_internal( $result['id'] ) ) {
93
+                return $result;
94
+            }
95
+
96
+            $uris = array_merge( (array) $result['id'], $result['sameAss'] );
97
+
98
+            foreach ( $uris as $uri ) {
99
+                if ( isset( $mappings[ $uri ] ) ) {
100
+                    $local_entity = $that->entity_uri_service->get_entity( $mappings[ $uri ] );
101
+
102
+                    return $that->post_to_autocomplete_result( $mappings[ $uri ], $local_entity );
103
+                }
104
+            }
105
+
106
+            return $result;
107
+        }, $results );
108
+
109
+        return $mapped_results;
110
+    }
111
+
112
+    private function do_query( $query, $scope = 'cloud', $exclude = '' ) {
113
+        $url = $this->build_request_url( $query, $exclude, $scope );
114
+
115
+        // Return the response.
116
+        $response = Default_Api_Service::get_instance()->get( $url )->get_response();
117
+
118
+        // If the response is valid, then send the suggestions.
119
+        if ( ! is_wp_error( $response ) && 200 === (int) $response['response']['code'] ) {
120
+            // Echo the response.
121
+            return json_decode( wp_remote_retrieve_body( $response ), true );
122
+        } else {
123
+            // Default error message.
124
+            $error_message = 'Something went wrong.';
125
+
126
+            // Get the real error message if there is WP_Error.
127
+            if ( is_wp_error( $response ) ) {
128
+                $error_message = $response->get_error_message();
129
+            }
130
+
131
+            $this->log->error( $error_message );
132
+
133
+            return array();
134
+        }
135
+    }
136
+
137
+    /**
138
+     * Build the autocomplete url.
139
+     *
140
+     * @param string $query The search string.
141
+     * @param array|string $exclude The exclude parameter.
142
+     * @param string $scope The search scope: "local" will search only in the local dataset; "cloud" will search also
143
+     *                      in Wikipedia. By default is "cloud".
144
+     *
145
+     * @return string Built url.
146
+     * @since 3.15.0
147
+     *
148
+     */
149
+    private function build_request_url( $query, $exclude, $scope ) {
150
+        $args = array(
151
+            'key'      => $this->configuration_service->get_key(),
152
+            'language' => $this->configuration_service->get_language_code(),
153
+            'query'    => $query,
154
+            'scope'    => $scope,
155
+            'limit'    => 10,
156
+        );
157
+
158
+        // Add args to URL.
159
+        $request_url = add_query_arg(
160
+            urlencode_deep( $args ),
161
+            '/autocomplete'
162
+        );
163
+
164
+        // Add the exclude parameter.
165
+        if ( ! empty( $exclude ) ) {
166
+            $request_url .= "&exclude=" . implode( '&exclude=', array_map( 'urlencode', (array) $exclude ) );
167
+        }
168
+
169
+        // return the built url.
170
+        return $request_url;
171
+    }
172
+
173
+    private function post_to_autocomplete_result( $uri, $post ) {
174
+
175
+        return array(
176
+            'id'           => $uri,
177
+            'label'        => array( $post->post_title ),
178
+            'labels'       => $this->entity_service->get_alternative_labels( $post->ID ),
179
+            'descriptions' => array( Wordlift_Post_Excerpt_Helper::get_text_excerpt( $post ) ),
180
+            'scope'        => 'local',
181
+            'sameAss'      => get_post_meta( $post->ID, \Wordlift_Schema_Service::FIELD_SAME_AS ),
182
+            // The following properties are less relevant because we're linking entities that exist already in the
183
+            // vocabulary. That's why we don't make an effort to load the real data.
184
+            'types'        => array( 'http://schema.org/Thing' ),
185
+            'urls'         => array(),
186
+            'images'       => array(),
187
+        );
188
+    }
189 189
 
190 190
 }
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @since 3.15.0
52 52
 	 */
53
-	public function __construct( $configuration_service, $entity_helper, $entity_uri_service, $entity_service ) {
53
+	public function __construct($configuration_service, $entity_helper, $entity_uri_service, $entity_service) {
54 54
 
55
-		$this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Autocomplete_Service' );
55
+		$this->log = Wordlift_Log_Service::get_logger('Wordlift_Autocomplete_Service');
56 56
 
57 57
 		$this->configuration_service = $configuration_service;
58 58
 		$this->entity_helper         = $entity_helper;
@@ -73,62 +73,62 @@  discard block
 block discarded – undo
73 73
 	 * @since 3.15.0
74 74
 	 *
75 75
 	 */
76
-	public function query( $query, $scope = 'cloud', $excludes = array() ) {
76
+	public function query($query, $scope = 'cloud', $excludes = array()) {
77 77
 
78
-		$results = $this->do_query( $query, $scope, $excludes );
78
+		$results = $this->do_query($query, $scope, $excludes);
79 79
 
80
-		$uris = array_reduce( $results, function ( $carry, $result ) {
80
+		$uris = array_reduce($results, function($carry, $result) {
81 81
 
82 82
 			$carry[] = $result['id'];
83 83
 
84
-			return array_merge( $carry, $result['sameAss'] );
85
-		}, array() );
84
+			return array_merge($carry, $result['sameAss']);
85
+		}, array());
86 86
 
87
-		$mappings = $this->entity_helper->map_many_to_local( $uris );
87
+		$mappings = $this->entity_helper->map_many_to_local($uris);
88 88
 
89 89
 		$that           = $this;
90
-		$mapped_results = array_map( function ( $result ) use ( $that, $mappings ) {
90
+		$mapped_results = array_map(function($result) use ($that, $mappings) {
91 91
 
92
-			if ( $that->entity_uri_service->is_internal( $result['id'] ) ) {
92
+			if ($that->entity_uri_service->is_internal($result['id'])) {
93 93
 				return $result;
94 94
 			}
95 95
 
96
-			$uris = array_merge( (array) $result['id'], $result['sameAss'] );
96
+			$uris = array_merge((array) $result['id'], $result['sameAss']);
97 97
 
98
-			foreach ( $uris as $uri ) {
99
-				if ( isset( $mappings[ $uri ] ) ) {
100
-					$local_entity = $that->entity_uri_service->get_entity( $mappings[ $uri ] );
98
+			foreach ($uris as $uri) {
99
+				if (isset($mappings[$uri])) {
100
+					$local_entity = $that->entity_uri_service->get_entity($mappings[$uri]);
101 101
 
102
-					return $that->post_to_autocomplete_result( $mappings[ $uri ], $local_entity );
102
+					return $that->post_to_autocomplete_result($mappings[$uri], $local_entity);
103 103
 				}
104 104
 			}
105 105
 
106 106
 			return $result;
107
-		}, $results );
107
+		}, $results);
108 108
 
109 109
 		return $mapped_results;
110 110
 	}
111 111
 
112
-	private function do_query( $query, $scope = 'cloud', $exclude = '' ) {
113
-		$url = $this->build_request_url( $query, $exclude, $scope );
112
+	private function do_query($query, $scope = 'cloud', $exclude = '') {
113
+		$url = $this->build_request_url($query, $exclude, $scope);
114 114
 
115 115
 		// Return the response.
116
-		$response = Default_Api_Service::get_instance()->get( $url )->get_response();
116
+		$response = Default_Api_Service::get_instance()->get($url)->get_response();
117 117
 
118 118
 		// If the response is valid, then send the suggestions.
119
-		if ( ! is_wp_error( $response ) && 200 === (int) $response['response']['code'] ) {
119
+		if ( ! is_wp_error($response) && 200 === (int) $response['response']['code']) {
120 120
 			// Echo the response.
121
-			return json_decode( wp_remote_retrieve_body( $response ), true );
121
+			return json_decode(wp_remote_retrieve_body($response), true);
122 122
 		} else {
123 123
 			// Default error message.
124 124
 			$error_message = 'Something went wrong.';
125 125
 
126 126
 			// Get the real error message if there is WP_Error.
127
-			if ( is_wp_error( $response ) ) {
127
+			if (is_wp_error($response)) {
128 128
 				$error_message = $response->get_error_message();
129 129
 			}
130 130
 
131
-			$this->log->error( $error_message );
131
+			$this->log->error($error_message);
132 132
 
133 133
 			return array();
134 134
 		}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @since 3.15.0
147 147
 	 *
148 148
 	 */
149
-	private function build_request_url( $query, $exclude, $scope ) {
149
+	private function build_request_url($query, $exclude, $scope) {
150 150
 		$args = array(
151 151
 			'key'      => $this->configuration_service->get_key(),
152 152
 			'language' => $this->configuration_service->get_language_code(),
@@ -157,31 +157,31 @@  discard block
 block discarded – undo
157 157
 
158 158
 		// Add args to URL.
159 159
 		$request_url = add_query_arg(
160
-			urlencode_deep( $args ),
160
+			urlencode_deep($args),
161 161
 			'/autocomplete'
162 162
 		);
163 163
 
164 164
 		// Add the exclude parameter.
165
-		if ( ! empty( $exclude ) ) {
166
-			$request_url .= "&exclude=" . implode( '&exclude=', array_map( 'urlencode', (array) $exclude ) );
165
+		if ( ! empty($exclude)) {
166
+			$request_url .= "&exclude=".implode('&exclude=', array_map('urlencode', (array) $exclude));
167 167
 		}
168 168
 
169 169
 		// return the built url.
170 170
 		return $request_url;
171 171
 	}
172 172
 
173
-	private function post_to_autocomplete_result( $uri, $post ) {
173
+	private function post_to_autocomplete_result($uri, $post) {
174 174
 
175 175
 		return array(
176 176
 			'id'           => $uri,
177
-			'label'        => array( $post->post_title ),
178
-			'labels'       => $this->entity_service->get_alternative_labels( $post->ID ),
179
-			'descriptions' => array( Wordlift_Post_Excerpt_Helper::get_text_excerpt( $post ) ),
177
+			'label'        => array($post->post_title),
178
+			'labels'       => $this->entity_service->get_alternative_labels($post->ID),
179
+			'descriptions' => array(Wordlift_Post_Excerpt_Helper::get_text_excerpt($post)),
180 180
 			'scope'        => 'local',
181
-			'sameAss'      => get_post_meta( $post->ID, \Wordlift_Schema_Service::FIELD_SAME_AS ),
181
+			'sameAss'      => get_post_meta($post->ID, \Wordlift_Schema_Service::FIELD_SAME_AS),
182 182
 			// The following properties are less relevant because we're linking entities that exist already in the
183 183
 			// vocabulary. That's why we don't make an effort to load the real data.
184
-			'types'        => array( 'http://schema.org/Thing' ),
184
+			'types'        => array('http://schema.org/Thing'),
185 185
 			'urls'         => array(),
186 186
 			'images'       => array(),
187 187
 		);
Please login to merge, or discard this patch.
src/shortcodes/wordlift_shortcode_faceted_search.php 2 patches
Indentation   +241 added lines, -241 removed lines patch added patch discarded remove patch
@@ -18,30 +18,30 @@  discard block
 block discarded – undo
18 18
  */
19 19
 function wl_shortcode_faceted_search( $request ) {
20 20
 
21
-	// Create the cache key.
22
-	$cache_key = array(
23
-		'request_params' => $_GET,
24
-	);
21
+    // Create the cache key.
22
+    $cache_key = array(
23
+        'request_params' => $_GET,
24
+    );
25 25
 
26
-	// Create the TTL cache and try to get the results.
27
-	$cache         = new Ttl_Cache( "faceted-search", 8 * 60 * 60 ); // 8 hours.
28
-	$cache_results = $cache->get( $cache_key );
26
+    // Create the TTL cache and try to get the results.
27
+    $cache         = new Ttl_Cache( "faceted-search", 8 * 60 * 60 ); // 8 hours.
28
+    $cache_results = $cache->get( $cache_key );
29 29
 
30
-	if ( isset( $cache_results ) ) {
31
-		header( 'X-WordLift-Cache: HIT' );
32
-		wl_core_send_json( $cache_results );
30
+    if ( isset( $cache_results ) ) {
31
+        header( 'X-WordLift-Cache: HIT' );
32
+        wl_core_send_json( $cache_results );
33 33
 
34
-		return;
35
-	}
34
+        return;
35
+    }
36 36
 
37
-	header( 'X-WordLift-Cache: MISS' );
37
+    header( 'X-WordLift-Cache: MISS' );
38 38
 
39
-	$results = wl_shortcode_faceted_search_origin( $request );
39
+    $results = wl_shortcode_faceted_search_origin( $request );
40 40
 
41
-	// Put the result before sending the json to the client, since sending the json will terminate us.
42
-	$cache->put( $cache_key, $results );
41
+    // Put the result before sending the json to the client, since sending the json will terminate us.
42
+    $cache->put( $cache_key, $results );
43 43
 
44
-	wl_core_send_json( $results );
44
+    wl_core_send_json( $results );
45 45
 
46 46
 }
47 47
 
@@ -52,137 +52,137 @@  discard block
 block discarded – undo
52 52
  * @since        3.26.0
53 53
  */
54 54
 function wl_shortcode_faceted_search_origin( $request ) {
55
-	// Post ID must be defined.
56
-	if ( ! isset( $_GET['post_id'] ) ) { // WPCS: input var ok; CSRF ok.
57
-		wp_die( 'No post_id given' );
58
-
59
-		return;
60
-	}
61
-
62
-	$current_post_id = $_GET['post_id']; // WPCS: input var ok; CSRF ok.
63
-	$current_post    = get_post( $current_post_id );
64
-	$faceted_id      = $_GET['uniqid'];
65
-
66
-	// Post ID has to match an existing item.
67
-	if ( null === $current_post ) {
68
-		wp_die( 'No valid post_id given' );
69
-
70
-		return;
71
-	}
72
-
73
-	// If the current post is an entity,
74
-	// the current post is used as main entity.
75
-	// Otherwise, current post related entities are used.
76
-	$entity_service = Wordlift_Entity_Service::get_instance();
77
-	$entity_ids     = $entity_service->is_entity( $current_post->ID ) ?
78
-		array( $current_post->ID ) :
79
-		$entity_service->get_related_entities( $current_post->ID );
80
-
81
-	// If there are no entities we cannot render the widget.
82
-	if ( 0 === count( $entity_ids ) ) {
83
-		/**
84
-		 * If this function is not called from ajax
85
-		 * then this should not throw an error.
86
-		 * Note: Used in scripbox longtail project on json endpoint.
87
-		 */
88
-		if ( apply_filters( 'wp_doing_ajax', defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
89
-			wp_die( 'No entities available' );
90
-		}
91
-
92
-	}
93
-
94
-	$limit = ( isset( $_GET['limit'] ) ) ? (int) $_GET['limit'] : 4;  // WPCS: input var ok; CSRF ok.
95
-	$amp   = ( isset( $_GET['amp'] ) ) ? true : false;
96
-
97
-
98
-	/**
99
-	 * see https://github.com/insideout10/wordlift-plugin/issues/1181
100
-	 * The ordering should be descending by date on default.
101
-	 */
102
-	$order_by = 'DESC';
103
-	if ( isset( $_GET['sort'] ) && is_string( $_GET['sort'] ) ) {
104
-		$order_by = (string) $_GET['sort'];
105
-	}
106
-
107
-	$referencing_posts = Wordlift_Relation_Service::get_instance()->get_article_subjects(
108
-		$entity_ids,
109
-		'*',
110
-		null,
111
-		'publish',
112
-		array( $current_post_id ),
113
-		$limit,
114
-		null,
115
-		$order_by
116
-	);
117
-
118
-	$referencing_post_ids = array_map( function ( $p ) {
119
-		return $p->ID;
120
-	}, $referencing_posts );
121
-
122
-	$post_results   = array();
123
-	$entity_results = array();
124
-
125
-	// Populate $post_results
126
-
127
-	$filtered_posts = ( empty( $filtering_entity_uris ) ) ?
128
-		$referencing_posts :
129
-		Wordlift_Relation_Service::get_instance()->get_article_subjects(
130
-			wl_get_entity_post_ids_by_uris( $filtering_entity_uris ),
131
-			'*',
132
-			null,
133
-			null,
134
-			array(),
135
-			null,
136
-			$referencing_post_ids
137
-		);
138
-
139
-	if ( $filtered_posts ) {
140
-		foreach ( $filtered_posts as $post_obj ) {
141
-
142
-			/**
143
-			 * Use the thumbnail.
144
-			 *
145
-			 * @see https://github.com/insideout10/wordlift-plugin/issues/825 related issue.
146
-			 * @see https://github.com/insideout10/wordlift-plugin/issues/837
147
-			 *
148
-			 * @since 3.19.3 We're using the medium size image.
149
-			 */
150
-			$thumbnail           = get_the_post_thumbnail_url( $post_obj, 'medium' );
151
-			$post_obj->thumbnail = ( $thumbnail ) ?
152
-				$thumbnail : WL_DEFAULT_THUMBNAIL_PATH;
153
-			$post_obj->permalink = get_permalink( $post_obj->ID );
154
-
155
-			$result         = $post_obj;
156
-			$post_results[] = $result;
157
-		}
158
-	}
159
-
160
-	// Add filler posts if needed
161
-
162
-	$filler_count = $limit - count( $post_results );
163
-	if ( $filler_count > 0 ) {
164
-		$filler_posts = wl_shortcode_faceted_search_filler_posts( $filler_count, $current_post_id, $referencing_post_ids );
165
-		$post_results = array_merge( $post_results, $filler_posts );
166
-	}
167
-	$referencing_post_ids = array_map( function ( $post ) {
168
-		return $post->ID;
169
-	}, $post_results );
170
-
171
-	// Populate $entity_results
172
-
173
-	global $wpdb;
174
-
175
-	// Retrieve Wordlift relation instances table name.
176
-	$table_name = wl_core_get_relation_instances_table_name();
177
-
178
-	/*
55
+    // Post ID must be defined.
56
+    if ( ! isset( $_GET['post_id'] ) ) { // WPCS: input var ok; CSRF ok.
57
+        wp_die( 'No post_id given' );
58
+
59
+        return;
60
+    }
61
+
62
+    $current_post_id = $_GET['post_id']; // WPCS: input var ok; CSRF ok.
63
+    $current_post    = get_post( $current_post_id );
64
+    $faceted_id      = $_GET['uniqid'];
65
+
66
+    // Post ID has to match an existing item.
67
+    if ( null === $current_post ) {
68
+        wp_die( 'No valid post_id given' );
69
+
70
+        return;
71
+    }
72
+
73
+    // If the current post is an entity,
74
+    // the current post is used as main entity.
75
+    // Otherwise, current post related entities are used.
76
+    $entity_service = Wordlift_Entity_Service::get_instance();
77
+    $entity_ids     = $entity_service->is_entity( $current_post->ID ) ?
78
+        array( $current_post->ID ) :
79
+        $entity_service->get_related_entities( $current_post->ID );
80
+
81
+    // If there are no entities we cannot render the widget.
82
+    if ( 0 === count( $entity_ids ) ) {
83
+        /**
84
+         * If this function is not called from ajax
85
+         * then this should not throw an error.
86
+         * Note: Used in scripbox longtail project on json endpoint.
87
+         */
88
+        if ( apply_filters( 'wp_doing_ajax', defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
89
+            wp_die( 'No entities available' );
90
+        }
91
+
92
+    }
93
+
94
+    $limit = ( isset( $_GET['limit'] ) ) ? (int) $_GET['limit'] : 4;  // WPCS: input var ok; CSRF ok.
95
+    $amp   = ( isset( $_GET['amp'] ) ) ? true : false;
96
+
97
+
98
+    /**
99
+     * see https://github.com/insideout10/wordlift-plugin/issues/1181
100
+     * The ordering should be descending by date on default.
101
+     */
102
+    $order_by = 'DESC';
103
+    if ( isset( $_GET['sort'] ) && is_string( $_GET['sort'] ) ) {
104
+        $order_by = (string) $_GET['sort'];
105
+    }
106
+
107
+    $referencing_posts = Wordlift_Relation_Service::get_instance()->get_article_subjects(
108
+        $entity_ids,
109
+        '*',
110
+        null,
111
+        'publish',
112
+        array( $current_post_id ),
113
+        $limit,
114
+        null,
115
+        $order_by
116
+    );
117
+
118
+    $referencing_post_ids = array_map( function ( $p ) {
119
+        return $p->ID;
120
+    }, $referencing_posts );
121
+
122
+    $post_results   = array();
123
+    $entity_results = array();
124
+
125
+    // Populate $post_results
126
+
127
+    $filtered_posts = ( empty( $filtering_entity_uris ) ) ?
128
+        $referencing_posts :
129
+        Wordlift_Relation_Service::get_instance()->get_article_subjects(
130
+            wl_get_entity_post_ids_by_uris( $filtering_entity_uris ),
131
+            '*',
132
+            null,
133
+            null,
134
+            array(),
135
+            null,
136
+            $referencing_post_ids
137
+        );
138
+
139
+    if ( $filtered_posts ) {
140
+        foreach ( $filtered_posts as $post_obj ) {
141
+
142
+            /**
143
+             * Use the thumbnail.
144
+             *
145
+             * @see https://github.com/insideout10/wordlift-plugin/issues/825 related issue.
146
+             * @see https://github.com/insideout10/wordlift-plugin/issues/837
147
+             *
148
+             * @since 3.19.3 We're using the medium size image.
149
+             */
150
+            $thumbnail           = get_the_post_thumbnail_url( $post_obj, 'medium' );
151
+            $post_obj->thumbnail = ( $thumbnail ) ?
152
+                $thumbnail : WL_DEFAULT_THUMBNAIL_PATH;
153
+            $post_obj->permalink = get_permalink( $post_obj->ID );
154
+
155
+            $result         = $post_obj;
156
+            $post_results[] = $result;
157
+        }
158
+    }
159
+
160
+    // Add filler posts if needed
161
+
162
+    $filler_count = $limit - count( $post_results );
163
+    if ( $filler_count > 0 ) {
164
+        $filler_posts = wl_shortcode_faceted_search_filler_posts( $filler_count, $current_post_id, $referencing_post_ids );
165
+        $post_results = array_merge( $post_results, $filler_posts );
166
+    }
167
+    $referencing_post_ids = array_map( function ( $post ) {
168
+        return $post->ID;
169
+    }, $post_results );
170
+
171
+    // Populate $entity_results
172
+
173
+    global $wpdb;
174
+
175
+    // Retrieve Wordlift relation instances table name.
176
+    $table_name = wl_core_get_relation_instances_table_name();
177
+
178
+    /*
179 179
 	 * Make sure we have some referenced post, otherwise the IN parts of
180 180
 	 * the SQL will produce an SQL error.
181 181
 	 */
182
-	if ( ! empty( $referencing_post_ids ) ) {
183
-		$subject_ids = implode( ',', $referencing_post_ids );
182
+    if ( ! empty( $referencing_post_ids ) ) {
183
+        $subject_ids = implode( ',', $referencing_post_ids );
184 184
 
185
-		$query = "
185
+        $query = "
186 186
 				SELECT
187 187
 					object_id AS ID,
188 188
 					count( object_id ) AS counter
@@ -194,119 +194,119 @@  discard block
 block discarded – undo
194 194
 				LIMIT $limit;
195 195
 			";
196 196
 
197
-		wl_write_log( "Going to find related entities for the current post [ post ID :: $current_post_id ] [ query :: $query ]" );
197
+        wl_write_log( "Going to find related entities for the current post [ post ID :: $current_post_id ] [ query :: $query ]" );
198 198
 
199
-		$entities = $wpdb->get_results( $query, OBJECT ); // No cache ok.
199
+        $entities = $wpdb->get_results( $query, OBJECT ); // No cache ok.
200 200
 
201
-		wl_write_log( 'Entities found ' . count( $entities ) );
201
+        wl_write_log( 'Entities found ' . count( $entities ) );
202 202
 
203
-		foreach ( $entities as $obj ) {
203
+        foreach ( $entities as $obj ) {
204 204
 
205
-			$entity = get_post( $obj->ID );
205
+            $entity = get_post( $obj->ID );
206 206
 
207
-			// Ensure only valid and published entities are returned.
208
-			if ( ( null !== $entity ) && ( 'publish' === $entity->post_status ) ) {
207
+            // Ensure only valid and published entities are returned.
208
+            if ( ( null !== $entity ) && ( 'publish' === $entity->post_status ) ) {
209 209
 
210
-				$serialized_entity                    = wl_serialize_entity( $entity );
211
-				$serialized_entity['label']           = wl_shortcode_faceted_search_get_the_title( $obj->ID );
212
-				$serialized_entity['counter']         = $obj->counter;
213
-				$serialized_entity['createdAt']       = $entity->post_date;
214
-				$serialized_entity['referencedPosts'] = Wordlift_Relation_Service::get_instance()->get_article_subjects(
215
-					$obj->ID,
216
-					'ids',
217
-					null,
218
-					null,
219
-					array(),
220
-					null,
221
-					$referencing_post_ids
222
-				);
223
-				$entity_results[]                     = $serialized_entity;
224
-			}
225
-		}
226
-	}
210
+                $serialized_entity                    = wl_serialize_entity( $entity );
211
+                $serialized_entity['label']           = wl_shortcode_faceted_search_get_the_title( $obj->ID );
212
+                $serialized_entity['counter']         = $obj->counter;
213
+                $serialized_entity['createdAt']       = $entity->post_date;
214
+                $serialized_entity['referencedPosts'] = Wordlift_Relation_Service::get_instance()->get_article_subjects(
215
+                    $obj->ID,
216
+                    'ids',
217
+                    null,
218
+                    null,
219
+                    array(),
220
+                    null,
221
+                    $referencing_post_ids
222
+                );
223
+                $entity_results[]                     = $serialized_entity;
224
+            }
225
+        }
226
+    }
227 227
 
228
-	$post_results   = apply_filters( 'wl_faceted_data_posts', $post_results, $faceted_id );
229
-	$entity_results = apply_filters( 'wl_faceted_data_entities', $entity_results, $faceted_id );
228
+    $post_results   = apply_filters( 'wl_faceted_data_posts', $post_results, $faceted_id );
229
+    $entity_results = apply_filters( 'wl_faceted_data_entities', $entity_results, $faceted_id );
230 230
 
231
-	return array(
232
-		'posts'    => $amp ? array( array( 'values' => $post_results ) ) : $post_results,
233
-		'entities' => $entity_results
234
-	);
231
+    return array(
232
+        'posts'    => $amp ? array( array( 'values' => $post_results ) ) : $post_results,
233
+        'entities' => $entity_results
234
+    );
235 235
 
236 236
 }
237 237
 
238 238
 function wl_shortcode_faceted_search_get_the_title( $post_id ) {
239 239
 
240
-	$title = get_the_title( $post_id );
240
+    $title = get_the_title( $post_id );
241 241
 
242
-	if ( get_post_type( $post_id ) !== Wordlift_Entity_Service::TYPE_NAME ) {
243
-		$alternative_labels = Wordlift_Entity_Service::get_instance()->get_alternative_labels( $post_id );
242
+    if ( get_post_type( $post_id ) !== Wordlift_Entity_Service::TYPE_NAME ) {
243
+        $alternative_labels = Wordlift_Entity_Service::get_instance()->get_alternative_labels( $post_id );
244 244
 
245
-		if ( count( $alternative_labels ) > 0 ) {
246
-			$title = $alternative_labels[0];
247
-		}
248
-	}
245
+        if ( count( $alternative_labels ) > 0 ) {
246
+            $title = $alternative_labels[0];
247
+        }
248
+    }
249 249
 
250
-	return remove_accents( $title );
250
+    return remove_accents( $title );
251 251
 
252 252
 }
253 253
 
254 254
 function wl_shortcode_faceted_search_filler_posts( $filler_count, $current_post_id, $referencing_post_ids ) {
255 255
 
256
-	$filler_posts = array();
257
-
258
-	// First add latest posts from same categories as the current post
259
-	if ( $filler_count > 0 ) {
260
-
261
-		$current_post_categories = wp_get_post_categories( $current_post_id );
262
-
263
-		$args = array(
264
-			'meta_query'          => array(
265
-				array(
266
-					'key' => '_thumbnail_id'
267
-				)
268
-			),
269
-			'category__in'        => $current_post_categories,
270
-			'numberposts'         => $filler_count,
271
-			'post__not_in'        => array_merge( array( $current_post_id ), $referencing_post_ids ),
272
-			'ignore_sticky_posts' => 1
273
-		);
274
-
275
-		$filler_posts = get_posts( $args );
276
-	}
277
-
278
-	$filler_count    = $filler_count - count( $filler_posts );
279
-	$filler_post_ids = array_map( function ( $post ) {
280
-		return $post->ID;
281
-	}, $filler_posts );
282
-
283
-	// If that does not fill, add latest posts irrespective of category
284
-	if ( $filler_count > 0 ) {
285
-
286
-		$args = array(
287
-			'meta_query'          => array(
288
-				array(
289
-					'key' => '_thumbnail_id'
290
-				)
291
-			),
292
-			'numberposts'         => $filler_count,
293
-			'post__not_in'        => array_merge( array( $current_post_id ), $referencing_post_ids, $filler_post_ids ),
294
-			'ignore_sticky_posts' => 1
295
-		);
296
-
297
-		$filler_posts = array_merge( $filler_posts, get_posts( $args ) );
298
-
299
-	}
300
-
301
-	// Add thumbnail and permalink to filler posts
302
-	foreach ( $filler_posts as $post_obj ) {
303
-		$thumbnail           = get_the_post_thumbnail_url( $post_obj, 'medium' );
304
-		$post_obj->thumbnail = ( $thumbnail ) ?
305
-			$thumbnail : WL_DEFAULT_THUMBNAIL_PATH;
306
-		$post_obj->permalink = get_permalink( $post_obj->ID );
307
-	}
308
-
309
-	return $filler_posts;
256
+    $filler_posts = array();
257
+
258
+    // First add latest posts from same categories as the current post
259
+    if ( $filler_count > 0 ) {
260
+
261
+        $current_post_categories = wp_get_post_categories( $current_post_id );
262
+
263
+        $args = array(
264
+            'meta_query'          => array(
265
+                array(
266
+                    'key' => '_thumbnail_id'
267
+                )
268
+            ),
269
+            'category__in'        => $current_post_categories,
270
+            'numberposts'         => $filler_count,
271
+            'post__not_in'        => array_merge( array( $current_post_id ), $referencing_post_ids ),
272
+            'ignore_sticky_posts' => 1
273
+        );
274
+
275
+        $filler_posts = get_posts( $args );
276
+    }
277
+
278
+    $filler_count    = $filler_count - count( $filler_posts );
279
+    $filler_post_ids = array_map( function ( $post ) {
280
+        return $post->ID;
281
+    }, $filler_posts );
282
+
283
+    // If that does not fill, add latest posts irrespective of category
284
+    if ( $filler_count > 0 ) {
285
+
286
+        $args = array(
287
+            'meta_query'          => array(
288
+                array(
289
+                    'key' => '_thumbnail_id'
290
+                )
291
+            ),
292
+            'numberposts'         => $filler_count,
293
+            'post__not_in'        => array_merge( array( $current_post_id ), $referencing_post_ids, $filler_post_ids ),
294
+            'ignore_sticky_posts' => 1
295
+        );
296
+
297
+        $filler_posts = array_merge( $filler_posts, get_posts( $args ) );
298
+
299
+    }
300
+
301
+    // Add thumbnail and permalink to filler posts
302
+    foreach ( $filler_posts as $post_obj ) {
303
+        $thumbnail           = get_the_post_thumbnail_url( $post_obj, 'medium' );
304
+        $post_obj->thumbnail = ( $thumbnail ) ?
305
+            $thumbnail : WL_DEFAULT_THUMBNAIL_PATH;
306
+        $post_obj->permalink = get_permalink( $post_obj->ID );
307
+    }
308
+
309
+    return $filler_posts;
310 310
 
311 311
 }
312 312
 
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
  * Adding `rest_api_init` action for network faceted-search
315 315
  */
316 316
 add_action( 'rest_api_init', function () {
317
-	register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, '/faceted-search', array(
318
-		'methods'             => 'GET',
319
-		'callback'            => 'wl_shortcode_faceted_search',
320
-		'permission_callback' => '__return_true',
321
-	) );
317
+    register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, '/faceted-search', array(
318
+        'methods'             => 'GET',
319
+        'callback'            => 'wl_shortcode_faceted_search',
320
+        'permission_callback' => '__return_true',
321
+    ) );
322 322
 } );
Please login to merge, or discard this patch.
Spacing   +79 added lines, -81 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @since 3.21.4 fix the cache key by also using the request body.
17 17
  * @since 3.21.2 add a caching layer.
18 18
  */
19
-function wl_shortcode_faceted_search( $request ) {
19
+function wl_shortcode_faceted_search($request) {
20 20
 
21 21
 	// Create the cache key.
22 22
 	$cache_key = array(
@@ -24,24 +24,24 @@  discard block
 block discarded – undo
24 24
 	);
25 25
 
26 26
 	// Create the TTL cache and try to get the results.
27
-	$cache         = new Ttl_Cache( "faceted-search", 8 * 60 * 60 ); // 8 hours.
28
-	$cache_results = $cache->get( $cache_key );
27
+	$cache         = new Ttl_Cache("faceted-search", 8 * 60 * 60); // 8 hours.
28
+	$cache_results = $cache->get($cache_key);
29 29
 
30
-	if ( isset( $cache_results ) ) {
31
-		header( 'X-WordLift-Cache: HIT' );
32
-		wl_core_send_json( $cache_results );
30
+	if (isset($cache_results)) {
31
+		header('X-WordLift-Cache: HIT');
32
+		wl_core_send_json($cache_results);
33 33
 
34 34
 		return;
35 35
 	}
36 36
 
37
-	header( 'X-WordLift-Cache: MISS' );
37
+	header('X-WordLift-Cache: MISS');
38 38
 
39
-	$results = wl_shortcode_faceted_search_origin( $request );
39
+	$results = wl_shortcode_faceted_search_origin($request);
40 40
 
41 41
 	// Put the result before sending the json to the client, since sending the json will terminate us.
42
-	$cache->put( $cache_key, $results );
42
+	$cache->put($cache_key, $results);
43 43
 
44
-	wl_core_send_json( $results );
44
+	wl_core_send_json($results);
45 45
 
46 46
 }
47 47
 
@@ -51,21 +51,21 @@  discard block
 block discarded – undo
51 51
  * @return array $results
52 52
  * @since        3.26.0
53 53
  */
54
-function wl_shortcode_faceted_search_origin( $request ) {
54
+function wl_shortcode_faceted_search_origin($request) {
55 55
 	// Post ID must be defined.
56
-	if ( ! isset( $_GET['post_id'] ) ) { // WPCS: input var ok; CSRF ok.
57
-		wp_die( 'No post_id given' );
56
+	if ( ! isset($_GET['post_id'])) { // WPCS: input var ok; CSRF ok.
57
+		wp_die('No post_id given');
58 58
 
59 59
 		return;
60 60
 	}
61 61
 
62 62
 	$current_post_id = $_GET['post_id']; // WPCS: input var ok; CSRF ok.
63
-	$current_post    = get_post( $current_post_id );
63
+	$current_post    = get_post($current_post_id);
64 64
 	$faceted_id      = $_GET['uniqid'];
65 65
 
66 66
 	// Post ID has to match an existing item.
67
-	if ( null === $current_post ) {
68
-		wp_die( 'No valid post_id given' );
67
+	if (null === $current_post) {
68
+		wp_die('No valid post_id given');
69 69
 
70 70
 		return;
71 71
 	}
@@ -74,25 +74,24 @@  discard block
 block discarded – undo
74 74
 	// the current post is used as main entity.
75 75
 	// Otherwise, current post related entities are used.
76 76
 	$entity_service = Wordlift_Entity_Service::get_instance();
77
-	$entity_ids     = $entity_service->is_entity( $current_post->ID ) ?
78
-		array( $current_post->ID ) :
79
-		$entity_service->get_related_entities( $current_post->ID );
77
+	$entity_ids     = $entity_service->is_entity($current_post->ID) ?
78
+		array($current_post->ID) : $entity_service->get_related_entities($current_post->ID);
80 79
 
81 80
 	// If there are no entities we cannot render the widget.
82
-	if ( 0 === count( $entity_ids ) ) {
81
+	if (0 === count($entity_ids)) {
83 82
 		/**
84 83
 		 * If this function is not called from ajax
85 84
 		 * then this should not throw an error.
86 85
 		 * Note: Used in scripbox longtail project on json endpoint.
87 86
 		 */
88
-		if ( apply_filters( 'wp_doing_ajax', defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
89
-			wp_die( 'No entities available' );
87
+		if (apply_filters('wp_doing_ajax', defined('DOING_AJAX') && DOING_AJAX)) {
88
+			wp_die('No entities available');
90 89
 		}
91 90
 
92 91
 	}
93 92
 
94
-	$limit = ( isset( $_GET['limit'] ) ) ? (int) $_GET['limit'] : 4;  // WPCS: input var ok; CSRF ok.
95
-	$amp   = ( isset( $_GET['amp'] ) ) ? true : false;
93
+	$limit = (isset($_GET['limit'])) ? (int) $_GET['limit'] : 4; // WPCS: input var ok; CSRF ok.
94
+	$amp   = (isset($_GET['amp'])) ? true : false;
96 95
 
97 96
 
98 97
 	/**
@@ -100,7 +99,7 @@  discard block
 block discarded – undo
100 99
 	 * The ordering should be descending by date on default.
101 100
 	 */
102 101
 	$order_by = 'DESC';
103
-	if ( isset( $_GET['sort'] ) && is_string( $_GET['sort'] ) ) {
102
+	if (isset($_GET['sort']) && is_string($_GET['sort'])) {
104 103
 		$order_by = (string) $_GET['sort'];
105 104
 	}
106 105
 
@@ -109,25 +108,24 @@  discard block
 block discarded – undo
109 108
 		'*',
110 109
 		null,
111 110
 		'publish',
112
-		array( $current_post_id ),
111
+		array($current_post_id),
113 112
 		$limit,
114 113
 		null,
115 114
 		$order_by
116 115
 	);
117 116
 
118
-	$referencing_post_ids = array_map( function ( $p ) {
117
+	$referencing_post_ids = array_map(function($p) {
119 118
 		return $p->ID;
120
-	}, $referencing_posts );
119
+	}, $referencing_posts);
121 120
 
122 121
 	$post_results   = array();
123 122
 	$entity_results = array();
124 123
 
125 124
 	// Populate $post_results
126 125
 
127
-	$filtered_posts = ( empty( $filtering_entity_uris ) ) ?
128
-		$referencing_posts :
129
-		Wordlift_Relation_Service::get_instance()->get_article_subjects(
130
-			wl_get_entity_post_ids_by_uris( $filtering_entity_uris ),
126
+	$filtered_posts = (empty($filtering_entity_uris)) ?
127
+		$referencing_posts : Wordlift_Relation_Service::get_instance()->get_article_subjects(
128
+			wl_get_entity_post_ids_by_uris($filtering_entity_uris),
131 129
 			'*',
132 130
 			null,
133 131
 			null,
@@ -136,8 +134,8 @@  discard block
 block discarded – undo
136 134
 			$referencing_post_ids
137 135
 		);
138 136
 
139
-	if ( $filtered_posts ) {
140
-		foreach ( $filtered_posts as $post_obj ) {
137
+	if ($filtered_posts) {
138
+		foreach ($filtered_posts as $post_obj) {
141 139
 
142 140
 			/**
143 141
 			 * Use the thumbnail.
@@ -147,10 +145,10 @@  discard block
 block discarded – undo
147 145
 			 *
148 146
 			 * @since 3.19.3 We're using the medium size image.
149 147
 			 */
150
-			$thumbnail           = get_the_post_thumbnail_url( $post_obj, 'medium' );
151
-			$post_obj->thumbnail = ( $thumbnail ) ?
148
+			$thumbnail           = get_the_post_thumbnail_url($post_obj, 'medium');
149
+			$post_obj->thumbnail = ($thumbnail) ?
152 150
 				$thumbnail : WL_DEFAULT_THUMBNAIL_PATH;
153
-			$post_obj->permalink = get_permalink( $post_obj->ID );
151
+			$post_obj->permalink = get_permalink($post_obj->ID);
154 152
 
155 153
 			$result         = $post_obj;
156 154
 			$post_results[] = $result;
@@ -159,14 +157,14 @@  discard block
 block discarded – undo
159 157
 
160 158
 	// Add filler posts if needed
161 159
 
162
-	$filler_count = $limit - count( $post_results );
163
-	if ( $filler_count > 0 ) {
164
-		$filler_posts = wl_shortcode_faceted_search_filler_posts( $filler_count, $current_post_id, $referencing_post_ids );
165
-		$post_results = array_merge( $post_results, $filler_posts );
160
+	$filler_count = $limit - count($post_results);
161
+	if ($filler_count > 0) {
162
+		$filler_posts = wl_shortcode_faceted_search_filler_posts($filler_count, $current_post_id, $referencing_post_ids);
163
+		$post_results = array_merge($post_results, $filler_posts);
166 164
 	}
167
-	$referencing_post_ids = array_map( function ( $post ) {
165
+	$referencing_post_ids = array_map(function($post) {
168 166
 		return $post->ID;
169
-	}, $post_results );
167
+	}, $post_results);
170 168
 
171 169
 	// Populate $entity_results
172 170
 
@@ -179,8 +177,8 @@  discard block
 block discarded – undo
179 177
 	 * Make sure we have some referenced post, otherwise the IN parts of
180 178
 	 * the SQL will produce an SQL error.
181 179
 	 */
182
-	if ( ! empty( $referencing_post_ids ) ) {
183
-		$subject_ids = implode( ',', $referencing_post_ids );
180
+	if ( ! empty($referencing_post_ids)) {
181
+		$subject_ids = implode(',', $referencing_post_ids);
184 182
 
185 183
 		$query = "
186 184
 				SELECT
@@ -194,21 +192,21 @@  discard block
 block discarded – undo
194 192
 				LIMIT $limit;
195 193
 			";
196 194
 
197
-		wl_write_log( "Going to find related entities for the current post [ post ID :: $current_post_id ] [ query :: $query ]" );
195
+		wl_write_log("Going to find related entities for the current post [ post ID :: $current_post_id ] [ query :: $query ]");
198 196
 
199
-		$entities = $wpdb->get_results( $query, OBJECT ); // No cache ok.
197
+		$entities = $wpdb->get_results($query, OBJECT); // No cache ok.
200 198
 
201
-		wl_write_log( 'Entities found ' . count( $entities ) );
199
+		wl_write_log('Entities found '.count($entities));
202 200
 
203
-		foreach ( $entities as $obj ) {
201
+		foreach ($entities as $obj) {
204 202
 
205
-			$entity = get_post( $obj->ID );
203
+			$entity = get_post($obj->ID);
206 204
 
207 205
 			// Ensure only valid and published entities are returned.
208
-			if ( ( null !== $entity ) && ( 'publish' === $entity->post_status ) ) {
206
+			if ((null !== $entity) && ('publish' === $entity->post_status)) {
209 207
 
210
-				$serialized_entity                    = wl_serialize_entity( $entity );
211
-				$serialized_entity['label']           = wl_shortcode_faceted_search_get_the_title( $obj->ID );
208
+				$serialized_entity                    = wl_serialize_entity($entity);
209
+				$serialized_entity['label']           = wl_shortcode_faceted_search_get_the_title($obj->ID);
212 210
 				$serialized_entity['counter']         = $obj->counter;
213 211
 				$serialized_entity['createdAt']       = $entity->post_date;
214 212
 				$serialized_entity['referencedPosts'] = Wordlift_Relation_Service::get_instance()->get_article_subjects(
@@ -220,45 +218,45 @@  discard block
 block discarded – undo
220 218
 					null,
221 219
 					$referencing_post_ids
222 220
 				);
223
-				$entity_results[]                     = $serialized_entity;
221
+				$entity_results[] = $serialized_entity;
224 222
 			}
225 223
 		}
226 224
 	}
227 225
 
228
-	$post_results   = apply_filters( 'wl_faceted_data_posts', $post_results, $faceted_id );
229
-	$entity_results = apply_filters( 'wl_faceted_data_entities', $entity_results, $faceted_id );
226
+	$post_results   = apply_filters('wl_faceted_data_posts', $post_results, $faceted_id);
227
+	$entity_results = apply_filters('wl_faceted_data_entities', $entity_results, $faceted_id);
230 228
 
231 229
 	return array(
232
-		'posts'    => $amp ? array( array( 'values' => $post_results ) ) : $post_results,
230
+		'posts'    => $amp ? array(array('values' => $post_results)) : $post_results,
233 231
 		'entities' => $entity_results
234 232
 	);
235 233
 
236 234
 }
237 235
 
238
-function wl_shortcode_faceted_search_get_the_title( $post_id ) {
236
+function wl_shortcode_faceted_search_get_the_title($post_id) {
239 237
 
240
-	$title = get_the_title( $post_id );
238
+	$title = get_the_title($post_id);
241 239
 
242
-	if ( get_post_type( $post_id ) !== Wordlift_Entity_Service::TYPE_NAME ) {
243
-		$alternative_labels = Wordlift_Entity_Service::get_instance()->get_alternative_labels( $post_id );
240
+	if (get_post_type($post_id) !== Wordlift_Entity_Service::TYPE_NAME) {
241
+		$alternative_labels = Wordlift_Entity_Service::get_instance()->get_alternative_labels($post_id);
244 242
 
245
-		if ( count( $alternative_labels ) > 0 ) {
243
+		if (count($alternative_labels) > 0) {
246 244
 			$title = $alternative_labels[0];
247 245
 		}
248 246
 	}
249 247
 
250
-	return remove_accents( $title );
248
+	return remove_accents($title);
251 249
 
252 250
 }
253 251
 
254
-function wl_shortcode_faceted_search_filler_posts( $filler_count, $current_post_id, $referencing_post_ids ) {
252
+function wl_shortcode_faceted_search_filler_posts($filler_count, $current_post_id, $referencing_post_ids) {
255 253
 
256 254
 	$filler_posts = array();
257 255
 
258 256
 	// First add latest posts from same categories as the current post
259
-	if ( $filler_count > 0 ) {
257
+	if ($filler_count > 0) {
260 258
 
261
-		$current_post_categories = wp_get_post_categories( $current_post_id );
259
+		$current_post_categories = wp_get_post_categories($current_post_id);
262 260
 
263 261
 		$args = array(
264 262
 			'meta_query'          => array(
@@ -268,20 +266,20 @@  discard block
 block discarded – undo
268 266
 			),
269 267
 			'category__in'        => $current_post_categories,
270 268
 			'numberposts'         => $filler_count,
271
-			'post__not_in'        => array_merge( array( $current_post_id ), $referencing_post_ids ),
269
+			'post__not_in'        => array_merge(array($current_post_id), $referencing_post_ids),
272 270
 			'ignore_sticky_posts' => 1
273 271
 		);
274 272
 
275
-		$filler_posts = get_posts( $args );
273
+		$filler_posts = get_posts($args);
276 274
 	}
277 275
 
278
-	$filler_count    = $filler_count - count( $filler_posts );
279
-	$filler_post_ids = array_map( function ( $post ) {
276
+	$filler_count    = $filler_count - count($filler_posts);
277
+	$filler_post_ids = array_map(function($post) {
280 278
 		return $post->ID;
281
-	}, $filler_posts );
279
+	}, $filler_posts);
282 280
 
283 281
 	// If that does not fill, add latest posts irrespective of category
284
-	if ( $filler_count > 0 ) {
282
+	if ($filler_count > 0) {
285 283
 
286 284
 		$args = array(
287 285
 			'meta_query'          => array(
@@ -290,20 +288,20 @@  discard block
 block discarded – undo
290 288
 				)
291 289
 			),
292 290
 			'numberposts'         => $filler_count,
293
-			'post__not_in'        => array_merge( array( $current_post_id ), $referencing_post_ids, $filler_post_ids ),
291
+			'post__not_in'        => array_merge(array($current_post_id), $referencing_post_ids, $filler_post_ids),
294 292
 			'ignore_sticky_posts' => 1
295 293
 		);
296 294
 
297
-		$filler_posts = array_merge( $filler_posts, get_posts( $args ) );
295
+		$filler_posts = array_merge($filler_posts, get_posts($args));
298 296
 
299 297
 	}
300 298
 
301 299
 	// Add thumbnail and permalink to filler posts
302
-	foreach ( $filler_posts as $post_obj ) {
303
-		$thumbnail           = get_the_post_thumbnail_url( $post_obj, 'medium' );
304
-		$post_obj->thumbnail = ( $thumbnail ) ?
300
+	foreach ($filler_posts as $post_obj) {
301
+		$thumbnail           = get_the_post_thumbnail_url($post_obj, 'medium');
302
+		$post_obj->thumbnail = ($thumbnail) ?
305 303
 			$thumbnail : WL_DEFAULT_THUMBNAIL_PATH;
306
-		$post_obj->permalink = get_permalink( $post_obj->ID );
304
+		$post_obj->permalink = get_permalink($post_obj->ID);
307 305
 	}
308 306
 
309 307
 	return $filler_posts;
@@ -313,10 +311,10 @@  discard block
 block discarded – undo
313 311
 /**
314 312
  * Adding `rest_api_init` action for network faceted-search
315 313
  */
316
-add_action( 'rest_api_init', function () {
317
-	register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, '/faceted-search', array(
314
+add_action('rest_api_init', function() {
315
+	register_rest_route(WL_REST_ROUTE_DEFAULT_NAMESPACE, '/faceted-search', array(
318 316
 		'methods'             => 'GET',
319 317
 		'callback'            => 'wl_shortcode_faceted_search',
320 318
 		'permission_callback' => '__return_true',
321
-	) );
319
+	));
322 320
 } );
Please login to merge, or discard this patch.
src/includes/class-wordlift-entity-service.php 2 patches
Indentation   +598 added lines, -598 removed lines patch added patch discarded remove patch
@@ -18,522 +18,522 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Entity_Service {
20 20
 
21
-	/**
22
-	 * The Log service.
23
-	 *
24
-	 * @since  3.2.0
25
-	 * @access private
26
-	 * @var \Wordlift_Log_Service $log The Log service.
27
-	 */
28
-	private $log;
29
-
30
-	/**
31
-	 * The UI service.
32
-	 *
33
-	 * @since  3.2.0
34
-	 * @access private
35
-	 * @var \Wordlift_UI_Service $ui_service The UI service.
36
-	 */
37
-	private $ui_service;
38
-
39
-	/**
40
-	 * The {@link Wordlift_Relation_Service} instance.
41
-	 *
42
-	 * @since  3.15.0
43
-	 * @access private
44
-	 * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
45
-	 */
46
-	private $relation_service;
47
-
48
-	/**
49
-	 * The {@link Wordlift_Entity_Uri_Service} instance.
50
-	 *
51
-	 * @since  3.16.3
52
-	 * @access private
53
-	 * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
54
-	 */
55
-	private $entity_uri_service;
56
-
57
-	/**
58
-	 * The entity post type name.
59
-	 *
60
-	 * @since 3.1.0
61
-	 */
62
-	const TYPE_NAME = 'entity';
63
-
64
-	/**
65
-	 * The alternative label meta key.
66
-	 *
67
-	 * @since 3.2.0
68
-	 */
69
-	const ALTERNATIVE_LABEL_META_KEY = '_wl_alt_label';
70
-
71
-	/**
72
-	 * The alternative label input template.
73
-	 *
74
-	 * @since 3.2.0
75
-	 */
76
-	// TODO: this should be moved to a class that deals with HTML code.
77
-	const ALTERNATIVE_LABEL_INPUT_TEMPLATE = '<div class="wl-alternative-label">
21
+    /**
22
+     * The Log service.
23
+     *
24
+     * @since  3.2.0
25
+     * @access private
26
+     * @var \Wordlift_Log_Service $log The Log service.
27
+     */
28
+    private $log;
29
+
30
+    /**
31
+     * The UI service.
32
+     *
33
+     * @since  3.2.0
34
+     * @access private
35
+     * @var \Wordlift_UI_Service $ui_service The UI service.
36
+     */
37
+    private $ui_service;
38
+
39
+    /**
40
+     * The {@link Wordlift_Relation_Service} instance.
41
+     *
42
+     * @since  3.15.0
43
+     * @access private
44
+     * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
45
+     */
46
+    private $relation_service;
47
+
48
+    /**
49
+     * The {@link Wordlift_Entity_Uri_Service} instance.
50
+     *
51
+     * @since  3.16.3
52
+     * @access private
53
+     * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
54
+     */
55
+    private $entity_uri_service;
56
+
57
+    /**
58
+     * The entity post type name.
59
+     *
60
+     * @since 3.1.0
61
+     */
62
+    const TYPE_NAME = 'entity';
63
+
64
+    /**
65
+     * The alternative label meta key.
66
+     *
67
+     * @since 3.2.0
68
+     */
69
+    const ALTERNATIVE_LABEL_META_KEY = '_wl_alt_label';
70
+
71
+    /**
72
+     * The alternative label input template.
73
+     *
74
+     * @since 3.2.0
75
+     */
76
+    // TODO: this should be moved to a class that deals with HTML code.
77
+    const ALTERNATIVE_LABEL_INPUT_TEMPLATE = '<div class="wl-alternative-label">
78 78
                 <label class="screen-reader-text" id="wl-alternative-label-prompt-text" for="wl-alternative-label">Enter alternative label here</label>
79 79
                 <input name="wl_alternative_label[]" size="30" value="%s" id="wl-alternative-label" type="text">
80 80
                 <button class="button wl-delete-button">%s</button>
81 81
                 </div>';
82 82
 
83
-	/**
84
-	 * A singleton instance of the Entity service.
85
-	 *
86
-	 * @since  3.2.0
87
-	 * @access private
88
-	 * @var \Wordlift_Entity_Service $instance A singleton instance of the Entity service.
89
-	 */
90
-	private static $instance;
91
-
92
-	/**
93
-	 * Create a Wordlift_Entity_Service instance.
94
-	 *
95
-	 * @param \Wordlift_UI_Service $ui_service The UI service.
96
-	 * @param \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
97
-	 * @param \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
98
-	 *
99
-	 * @since 3.2.0
100
-	 *
101
-	 */
102
-	public function __construct( $ui_service, $relation_service, $entity_uri_service ) {
103
-
104
-		$this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' );
105
-
106
-		$this->ui_service         = $ui_service;
107
-		$this->relation_service   = $relation_service;
108
-		$this->entity_uri_service = $entity_uri_service;
109
-
110
-		// Set the singleton instance.
111
-		self::$instance = $this;
112
-	}
113
-
114
-	/**
115
-	 * Get the singleton instance of the Entity service.
116
-	 *
117
-	 * @return \Wordlift_Entity_Service The singleton instance of the Entity service.
118
-	 * @since 3.2.0
119
-	 */
120
-	public static function get_instance() {
121
-
122
-		return self::$instance;
123
-	}
124
-
125
-	/**
126
-	 * Determines whether a post is an entity or not. Entity is in this context
127
-	 * something which is not an article.
128
-	 *
129
-	 * @param int $post_id A post id.
130
-	 *
131
-	 * @return bool Return true if the post is an entity otherwise false.
132
-	 * @since 3.1.0
133
-	 *
134
-	 */
135
-	public function is_entity( $post_id ) {
136
-
137
-		$terms = wp_get_object_terms( $post_id, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
138
-
139
-		if ( is_wp_error( $terms ) ) {
140
-			$this->log->error( "Cannot get the terms for post $post_id: " . $terms->get_error_message() );
141
-
142
-			return false;
143
-		}
144
-
145
-		if ( empty( $terms ) ) {
146
-			return false;
147
-		}
148
-
149
-		/*
83
+    /**
84
+     * A singleton instance of the Entity service.
85
+     *
86
+     * @since  3.2.0
87
+     * @access private
88
+     * @var \Wordlift_Entity_Service $instance A singleton instance of the Entity service.
89
+     */
90
+    private static $instance;
91
+
92
+    /**
93
+     * Create a Wordlift_Entity_Service instance.
94
+     *
95
+     * @param \Wordlift_UI_Service $ui_service The UI service.
96
+     * @param \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
97
+     * @param \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
98
+     *
99
+     * @since 3.2.0
100
+     *
101
+     */
102
+    public function __construct( $ui_service, $relation_service, $entity_uri_service ) {
103
+
104
+        $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' );
105
+
106
+        $this->ui_service         = $ui_service;
107
+        $this->relation_service   = $relation_service;
108
+        $this->entity_uri_service = $entity_uri_service;
109
+
110
+        // Set the singleton instance.
111
+        self::$instance = $this;
112
+    }
113
+
114
+    /**
115
+     * Get the singleton instance of the Entity service.
116
+     *
117
+     * @return \Wordlift_Entity_Service The singleton instance of the Entity service.
118
+     * @since 3.2.0
119
+     */
120
+    public static function get_instance() {
121
+
122
+        return self::$instance;
123
+    }
124
+
125
+    /**
126
+     * Determines whether a post is an entity or not. Entity is in this context
127
+     * something which is not an article.
128
+     *
129
+     * @param int $post_id A post id.
130
+     *
131
+     * @return bool Return true if the post is an entity otherwise false.
132
+     * @since 3.1.0
133
+     *
134
+     */
135
+    public function is_entity( $post_id ) {
136
+
137
+        $terms = wp_get_object_terms( $post_id, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
138
+
139
+        if ( is_wp_error( $terms ) ) {
140
+            $this->log->error( "Cannot get the terms for post $post_id: " . $terms->get_error_message() );
141
+
142
+            return false;
143
+        }
144
+
145
+        if ( empty( $terms ) ) {
146
+            return false;
147
+        }
148
+
149
+        /*
150 150
 		 * We don't consider an `article` to be an entity.
151 151
 		 *
152 152
 		 * @since 3.20.0 At least one associated mustn't be an `article`.
153 153
 		 *
154 154
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
155 155
 		 */
156
-		foreach ( $terms as $term ) {
157
-			if ( 1 !== preg_match( '~(^|-)article$~', $term->slug ) ) {
158
-				return true;
159
-			}
160
-		}
161
-
162
-		return false;
163
-	}
164
-
165
-	/**
166
-	 * Get the proper classification scope for a given entity post
167
-	 *
168
-	 * @param integer $post_id An entity post id.
169
-	 *
170
-	 * @param string $default The default classification scope, `what` if not
171
-	 *                         provided.
172
-	 *
173
-	 * @return string Returns a classification scope (e.g. 'what').
174
-	 * @since 3.5.0
175
-	 *
176
-	 */
177
-	public function get_classification_scope_for( $post_id, $default = WL_WHAT_RELATION ) {
178
-
179
-		if ( false === $this->is_entity( $post_id ) ) {
180
-			return $default;
181
-		}
182
-
183
-		// Retrieve the entity type
184
-		$entity_type_arr = Wordlift_Entity_Type_Service::get_instance()->get( $post_id );
185
-		$entity_type     = str_replace( 'wl-', '', $entity_type_arr['css_class'] );
186
-		// Retrieve classification boxes configuration
187
-		$classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES );
188
-		foreach ( $classification_boxes as $cb ) {
189
-			if ( in_array( $entity_type, $cb['registeredTypes'] ) ) {
190
-				return $cb['id'];
191
-			}
192
-		}
193
-
194
-		return $default;
195
-	}
196
-
197
-	/**
198
-	 * Check whether a {@link WP_Post} is used.
199
-	 *
200
-	 * @param int $post_id The {@link WP_Post}'s id.
201
-	 *
202
-	 * @return bool|null Null if it's not an entity, otherwise true if it's used.
203
-	 */
204
-	public function is_used( $post_id ) {
205
-
206
-		if ( false === $this->is_entity( $post_id ) ) {
207
-			return null;
208
-		}
209
-		// Retrieve the post
210
-		$entity = get_post( $post_id );
211
-
212
-		global $wpdb;
213
-		// Retrieve Wordlift relation instances table name
214
-		$table_name = wl_core_get_relation_instances_table_name();
215
-
216
-		// Check is it's referenced / related to another post / entity
217
-		$stmt = $wpdb->prepare(
218
-			"SELECT COUNT(*) FROM $table_name WHERE  object_id = %d",
219
-			$entity->ID
220
-		);
221
-
222
-		// Perform the query
223
-		$relation_instances = (int) $wpdb->get_var( $stmt );
224
-		// If there is at least one relation instance for the current entity, then it's used
225
-		if ( 0 < $relation_instances ) {
226
-			return true;
227
-		}
228
-
229
-		// Check if the entity uri is used as meta_value
230
-		$stmt = $wpdb->prepare(
231
-			"SELECT COUNT(*) FROM $wpdb->postmeta WHERE post_id != %d AND meta_value = %s",
232
-			$entity->ID,
233
-			wl_get_entity_uri( $entity->ID )
234
-		);
235
-		// Perform the query
236
-		$meta_instances = (int) $wpdb->get_var( $stmt );
237
-
238
-		// If there is at least one meta that refers the current entity uri, then current entity is used
239
-		if ( 0 < $meta_instances ) {
240
-			return true;
241
-		}
242
-
243
-		// If we are here, it means the current entity is not used at the moment
244
-		return false;
245
-	}
246
-
247
-	/**
248
-	 * Find entity posts by the entity URI. Entity as searched by their entity URI or same as.
249
-	 *
250
-	 * @param string $uri The entity URI.
251
-	 *
252
-	 * @return WP_Post|null A WP_Post instance or null if not found.
253
-	 * @deprecated in favor of Wordlift_Entity_Uri_Service->get_entity( $uri );
254
-	 *
255
-	 * @since      3.16.3 deprecated in favor of Wordlift_Entity_Uri_Service->get_entity( $uri );
256
-	 * @since      3.2.0
257
-	 *
258
-	 */
259
-	public function get_entity_post_by_uri( $uri ) {
260
-
261
-		return $this->entity_uri_service->get_entity( $uri );
262
-	}
263
-
264
-	/**
265
-	 * Fires once a post has been saved. This function uses the $_REQUEST, therefore
266
-	 * we check that the post we're saving is the current post.
267
-	 *
268
-	 * @see   https://github.com/insideout10/wordlift-plugin/issues/363
269
-	 *
270
-	 * @since 3.2.0
271
-	 *
272
-	 * @param int $post_id Post ID.
273
-	 * @param WP_Post $post Post object.
274
-	 * @param bool $update Whether this is an existing post being updated or not.
275
-	 */
276
-	public function save_post( $post_id, $post, $update ) {
277
-
278
-		// Avoid doing anything if post is autosave or a revision.
279
-		if ( wp_is_post_autosave( $post ) || wp_is_post_revision( $post ) ) {
280
-			return;
281
-		}
282
-
283
-		// We're setting the alternative label that have been provided via the UI
284
-		// (in fact we're using $_REQUEST), while save_post may be also called
285
-		// programmatically by some other function: we need to check therefore if
286
-		// the $post_id in the save_post call matches the post id set in the request.
287
-		//
288
-		// If this is not the current post being saved or if it's not an entity, return.
289
-		if ( ! isset( $_REQUEST['post_ID'] ) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity( $post_id ) ) {
290
-			return;
291
-		}
292
-
293
-		// Get the alt labels from the request (or empty array).
294
-		$alt_labels = isset( $_REQUEST['wl_alternative_label'] ) ? $_REQUEST['wl_alternative_label'] : array();
295
-
296
-		if ( ( ! empty( $_POST['content'] ) && ! empty( $_POST['post_content'] ) ) || isset( $_REQUEST['wl_alternative_label'] ) ) {
297
-			// This is via classic editor, so set the alternative labels.
298
-			$this->set_alternative_labels( $post_id, $alt_labels );
299
-		}
300
-
301
-
302
-	}
303
-
304
-	/**
305
-	 * Set the alternative labels.
306
-	 *
307
-	 * @param int $post_id The post id.
308
-	 * @param array $alt_labels An array of labels.
309
-	 *
310
-	 * @since 3.2.0
311
-	 *
312
-	 */
313
-	public function set_alternative_labels( $post_id, $alt_labels ) {
314
-
315
-		// Bail out if post id is not numeric. We add this check as we found a WP install that was sending a WP_Error
316
-		// instead of post id.
317
-		if ( ! is_numeric( $post_id ) ) {
318
-			return;
319
-		}
320
-
321
-		// Force $alt_labels to be an array
322
-		if ( ! is_array( $alt_labels ) ) {
323
-			$alt_labels = array( $alt_labels );
324
-		}
325
-
326
-		$this->log->debug( "Setting alternative labels [ post id :: $post_id ][ alt labels :: " . implode( ',', $alt_labels ) . " ]" );
327
-
328
-		// Delete all the existing alternate labels.
329
-		delete_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
330
-
331
-		// Set the alternative labels.
332
-		foreach ( $alt_labels as $alt_label ) {
333
-			if ( ! empty( $alt_label ) ) {
334
-				add_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label );
335
-			}
336
-		}
337
-
338
-	}
339
-
340
-	/**
341
-	 * Retrieve the alternate labels.
342
-	 *
343
-	 * @param int $post_id Post id.
344
-	 *
345
-	 * @return mixed An array  of alternative labels.
346
-	 * @since 3.2.0
347
-	 *
348
-	 */
349
-	public function get_alternative_labels( $post_id ) {
350
-
351
-		return get_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
352
-	}
353
-
354
-	/**
355
-	 * Retrieve the labels for an entity, i.e. the title + the synonyms.
356
-	 *
357
-	 * @param int $post_id The entity {@link WP_Post} id.
358
-	 *
359
-	 * @return array An array with the entity title and labels.
360
-	 * @since 3.12.0
361
-	 *
362
-	 */
363
-	public function get_labels( $post_id ) {
364
-
365
-		return array_merge( (array) get_the_title( $post_id ), $this->get_alternative_labels( $post_id ) );
366
-	}
367
-
368
-	/**
369
-	 * Fires before the permalink field in the edit form (this event is available in WP from 4.1.0).
370
-	 *
371
-	 * @param WP_Post $post Post object.
372
-	 *
373
-	 * @since 3.2.0
374
-	 *
375
-	 */
376
-	public function edit_form_before_permalink( $post ) {
377
-
378
-		// If it's not an entity, return.
379
-		if ( ! $this->is_entity( $post->ID ) ) {
380
-			return;
381
-		}
382
-
383
-		// Print the input template.
384
-		$this->ui_service->print_template( 'wl-tmpl-alternative-label-input', $this->get_alternative_label_input() );
385
-
386
-		// Print all the currently set alternative labels.
387
-		foreach ( $this->get_alternative_labels( $post->ID ) as $alt_label ) {
388
-
389
-			echo $this->get_alternative_label_input( $alt_label );
390
-
391
-		};
392
-
393
-		// Print the button.
394
-		$this->ui_service->print_button( 'wl-add-alternative-labels-button', __( 'Add more titles', 'wordlift' ) );
395
-
396
-	}
397
-
398
-	/**
399
-	 * Get the URI for the entity with the specified post id.
400
-	 *
401
-	 * @param int $post_id The entity post id.
402
-	 *
403
-	 * @return null|string The entity URI or NULL if not found or the dataset URI is not configured.
404
-	 * @since 3.6.0
405
-	 *
406
-	 */
407
-	private function get_uri_for_post( $post_id ) {
408
-
409
-		$log = Wordlift_Log_Service::get_logger( get_class() );
410
-
411
-		// If a null is given, nothing to do
412
-		if ( is_null( $post_id ) ) {
413
-			return null;
414
-		}
415
-
416
-		$dataset_uri = wl_configuration_get_redlink_dataset_uri();
417
-
418
-		if ( empty( $dataset_uri ) ) {
419
-			// Continue even if the dataset uri is not properly configured. It is handled in function wl_build_entity_uri()
420
-			$log->debug( 'Continuing, dataset uri not configured...' );
421
-		}
422
-
423
-		$uri = get_post_meta( $post_id, WL_ENTITY_URL_META_NAME, true );
424
-
425
-		/*
156
+        foreach ( $terms as $term ) {
157
+            if ( 1 !== preg_match( '~(^|-)article$~', $term->slug ) ) {
158
+                return true;
159
+            }
160
+        }
161
+
162
+        return false;
163
+    }
164
+
165
+    /**
166
+     * Get the proper classification scope for a given entity post
167
+     *
168
+     * @param integer $post_id An entity post id.
169
+     *
170
+     * @param string $default The default classification scope, `what` if not
171
+     *                         provided.
172
+     *
173
+     * @return string Returns a classification scope (e.g. 'what').
174
+     * @since 3.5.0
175
+     *
176
+     */
177
+    public function get_classification_scope_for( $post_id, $default = WL_WHAT_RELATION ) {
178
+
179
+        if ( false === $this->is_entity( $post_id ) ) {
180
+            return $default;
181
+        }
182
+
183
+        // Retrieve the entity type
184
+        $entity_type_arr = Wordlift_Entity_Type_Service::get_instance()->get( $post_id );
185
+        $entity_type     = str_replace( 'wl-', '', $entity_type_arr['css_class'] );
186
+        // Retrieve classification boxes configuration
187
+        $classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES );
188
+        foreach ( $classification_boxes as $cb ) {
189
+            if ( in_array( $entity_type, $cb['registeredTypes'] ) ) {
190
+                return $cb['id'];
191
+            }
192
+        }
193
+
194
+        return $default;
195
+    }
196
+
197
+    /**
198
+     * Check whether a {@link WP_Post} is used.
199
+     *
200
+     * @param int $post_id The {@link WP_Post}'s id.
201
+     *
202
+     * @return bool|null Null if it's not an entity, otherwise true if it's used.
203
+     */
204
+    public function is_used( $post_id ) {
205
+
206
+        if ( false === $this->is_entity( $post_id ) ) {
207
+            return null;
208
+        }
209
+        // Retrieve the post
210
+        $entity = get_post( $post_id );
211
+
212
+        global $wpdb;
213
+        // Retrieve Wordlift relation instances table name
214
+        $table_name = wl_core_get_relation_instances_table_name();
215
+
216
+        // Check is it's referenced / related to another post / entity
217
+        $stmt = $wpdb->prepare(
218
+            "SELECT COUNT(*) FROM $table_name WHERE  object_id = %d",
219
+            $entity->ID
220
+        );
221
+
222
+        // Perform the query
223
+        $relation_instances = (int) $wpdb->get_var( $stmt );
224
+        // If there is at least one relation instance for the current entity, then it's used
225
+        if ( 0 < $relation_instances ) {
226
+            return true;
227
+        }
228
+
229
+        // Check if the entity uri is used as meta_value
230
+        $stmt = $wpdb->prepare(
231
+            "SELECT COUNT(*) FROM $wpdb->postmeta WHERE post_id != %d AND meta_value = %s",
232
+            $entity->ID,
233
+            wl_get_entity_uri( $entity->ID )
234
+        );
235
+        // Perform the query
236
+        $meta_instances = (int) $wpdb->get_var( $stmt );
237
+
238
+        // If there is at least one meta that refers the current entity uri, then current entity is used
239
+        if ( 0 < $meta_instances ) {
240
+            return true;
241
+        }
242
+
243
+        // If we are here, it means the current entity is not used at the moment
244
+        return false;
245
+    }
246
+
247
+    /**
248
+     * Find entity posts by the entity URI. Entity as searched by their entity URI or same as.
249
+     *
250
+     * @param string $uri The entity URI.
251
+     *
252
+     * @return WP_Post|null A WP_Post instance or null if not found.
253
+     * @deprecated in favor of Wordlift_Entity_Uri_Service->get_entity( $uri );
254
+     *
255
+     * @since      3.16.3 deprecated in favor of Wordlift_Entity_Uri_Service->get_entity( $uri );
256
+     * @since      3.2.0
257
+     *
258
+     */
259
+    public function get_entity_post_by_uri( $uri ) {
260
+
261
+        return $this->entity_uri_service->get_entity( $uri );
262
+    }
263
+
264
+    /**
265
+     * Fires once a post has been saved. This function uses the $_REQUEST, therefore
266
+     * we check that the post we're saving is the current post.
267
+     *
268
+     * @see   https://github.com/insideout10/wordlift-plugin/issues/363
269
+     *
270
+     * @since 3.2.0
271
+     *
272
+     * @param int $post_id Post ID.
273
+     * @param WP_Post $post Post object.
274
+     * @param bool $update Whether this is an existing post being updated or not.
275
+     */
276
+    public function save_post( $post_id, $post, $update ) {
277
+
278
+        // Avoid doing anything if post is autosave or a revision.
279
+        if ( wp_is_post_autosave( $post ) || wp_is_post_revision( $post ) ) {
280
+            return;
281
+        }
282
+
283
+        // We're setting the alternative label that have been provided via the UI
284
+        // (in fact we're using $_REQUEST), while save_post may be also called
285
+        // programmatically by some other function: we need to check therefore if
286
+        // the $post_id in the save_post call matches the post id set in the request.
287
+        //
288
+        // If this is not the current post being saved or if it's not an entity, return.
289
+        if ( ! isset( $_REQUEST['post_ID'] ) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity( $post_id ) ) {
290
+            return;
291
+        }
292
+
293
+        // Get the alt labels from the request (or empty array).
294
+        $alt_labels = isset( $_REQUEST['wl_alternative_label'] ) ? $_REQUEST['wl_alternative_label'] : array();
295
+
296
+        if ( ( ! empty( $_POST['content'] ) && ! empty( $_POST['post_content'] ) ) || isset( $_REQUEST['wl_alternative_label'] ) ) {
297
+            // This is via classic editor, so set the alternative labels.
298
+            $this->set_alternative_labels( $post_id, $alt_labels );
299
+        }
300
+
301
+
302
+    }
303
+
304
+    /**
305
+     * Set the alternative labels.
306
+     *
307
+     * @param int $post_id The post id.
308
+     * @param array $alt_labels An array of labels.
309
+     *
310
+     * @since 3.2.0
311
+     *
312
+     */
313
+    public function set_alternative_labels( $post_id, $alt_labels ) {
314
+
315
+        // Bail out if post id is not numeric. We add this check as we found a WP install that was sending a WP_Error
316
+        // instead of post id.
317
+        if ( ! is_numeric( $post_id ) ) {
318
+            return;
319
+        }
320
+
321
+        // Force $alt_labels to be an array
322
+        if ( ! is_array( $alt_labels ) ) {
323
+            $alt_labels = array( $alt_labels );
324
+        }
325
+
326
+        $this->log->debug( "Setting alternative labels [ post id :: $post_id ][ alt labels :: " . implode( ',', $alt_labels ) . " ]" );
327
+
328
+        // Delete all the existing alternate labels.
329
+        delete_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
330
+
331
+        // Set the alternative labels.
332
+        foreach ( $alt_labels as $alt_label ) {
333
+            if ( ! empty( $alt_label ) ) {
334
+                add_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label );
335
+            }
336
+        }
337
+
338
+    }
339
+
340
+    /**
341
+     * Retrieve the alternate labels.
342
+     *
343
+     * @param int $post_id Post id.
344
+     *
345
+     * @return mixed An array  of alternative labels.
346
+     * @since 3.2.0
347
+     *
348
+     */
349
+    public function get_alternative_labels( $post_id ) {
350
+
351
+        return get_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
352
+    }
353
+
354
+    /**
355
+     * Retrieve the labels for an entity, i.e. the title + the synonyms.
356
+     *
357
+     * @param int $post_id The entity {@link WP_Post} id.
358
+     *
359
+     * @return array An array with the entity title and labels.
360
+     * @since 3.12.0
361
+     *
362
+     */
363
+    public function get_labels( $post_id ) {
364
+
365
+        return array_merge( (array) get_the_title( $post_id ), $this->get_alternative_labels( $post_id ) );
366
+    }
367
+
368
+    /**
369
+     * Fires before the permalink field in the edit form (this event is available in WP from 4.1.0).
370
+     *
371
+     * @param WP_Post $post Post object.
372
+     *
373
+     * @since 3.2.0
374
+     *
375
+     */
376
+    public function edit_form_before_permalink( $post ) {
377
+
378
+        // If it's not an entity, return.
379
+        if ( ! $this->is_entity( $post->ID ) ) {
380
+            return;
381
+        }
382
+
383
+        // Print the input template.
384
+        $this->ui_service->print_template( 'wl-tmpl-alternative-label-input', $this->get_alternative_label_input() );
385
+
386
+        // Print all the currently set alternative labels.
387
+        foreach ( $this->get_alternative_labels( $post->ID ) as $alt_label ) {
388
+
389
+            echo $this->get_alternative_label_input( $alt_label );
390
+
391
+        };
392
+
393
+        // Print the button.
394
+        $this->ui_service->print_button( 'wl-add-alternative-labels-button', __( 'Add more titles', 'wordlift' ) );
395
+
396
+    }
397
+
398
+    /**
399
+     * Get the URI for the entity with the specified post id.
400
+     *
401
+     * @param int $post_id The entity post id.
402
+     *
403
+     * @return null|string The entity URI or NULL if not found or the dataset URI is not configured.
404
+     * @since 3.6.0
405
+     *
406
+     */
407
+    private function get_uri_for_post( $post_id ) {
408
+
409
+        $log = Wordlift_Log_Service::get_logger( get_class() );
410
+
411
+        // If a null is given, nothing to do
412
+        if ( is_null( $post_id ) ) {
413
+            return null;
414
+        }
415
+
416
+        $dataset_uri = wl_configuration_get_redlink_dataset_uri();
417
+
418
+        if ( empty( $dataset_uri ) ) {
419
+            // Continue even if the dataset uri is not properly configured. It is handled in function wl_build_entity_uri()
420
+            $log->debug( 'Continuing, dataset uri not configured...' );
421
+        }
422
+
423
+        $uri = get_post_meta( $post_id, WL_ENTITY_URL_META_NAME, true );
424
+
425
+        /*
426 426
 		 * Consider the URI invalid if it doesn't start with the dataset URI.
427 427
 		 *
428 428
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/996
429 429
 		 */
430
-		if ( empty( $dataset_uri ) || 0 !== strpos( $uri, $dataset_uri ) ) {
431
-			$uri = null;
432
-		}
433
-
434
-		// Set the URI if it isn't set yet.
435
-		$post_status = get_post_status( $post_id );
436
-		if ( empty( $uri ) && 'auto-draft' !== $post_status && 'inherit' !== $post_status ) {
437
-			$uri = wl_build_entity_uri( $post_id );
438
-			wl_set_entity_uri( $post_id, $uri );
439
-		}
440
-
441
-		return $uri;
442
-	}
443
-
444
-	public function get_uri( $object_id, $type = Object_Type_Enum::POST ) {
445
-
446
-		if ( Object_Type_Enum::POST === $type ) {
447
-			return $this->get_uri_for_post( $object_id );
448
-		}
449
-
450
-		if ( Object_Type_Enum::USER === $type ) {
451
-			$uri = Wordlift_User_Service::get_instance()->get_uri( $object_id );
452
-
453
-			return ( false === $uri ? null : $uri );
454
-		}
455
-
456
-		return null;
457
-	}
458
-
459
-	/**
460
-	 * Get the alternative label input HTML code.
461
-	 *
462
-	 * @param string $value The input value.
463
-	 *
464
-	 * @return string The input HTML code.
465
-	 * @since 3.2.0
466
-	 *
467
-	 */
468
-	private function get_alternative_label_input( $value = '' ) {
469
-
470
-		return sprintf( self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr( $value ), __( 'Delete', 'wordlift' ) );
471
-	}
472
-
473
-	/**
474
-	 * Get the number of entity posts published in this blog.
475
-	 *
476
-	 * @return int The number of published entity posts.
477
-	 * @since 3.6.0
478
-	 *
479
-	 */
480
-	public function count() {
481
-		global $wpdb;
482
-
483
-		// Try to get the count from the transient.
484
-		$count = get_transient( '_wl_entity_service__count' );
485
-		if ( false !== $count ) {
486
-			return $count;
487
-		}
488
-
489
-		// Query the count.
490
-		$count = $wpdb->get_var( $wpdb->prepare(
491
-			"SELECT COUNT( DISTINCT( tr.object_id ) )"
492
-			. " FROM {$wpdb->term_relationships} tr"
493
-			. " INNER JOIN {$wpdb->term_taxonomy} tt"
494
-			. "  ON tt.taxonomy = %s AND tt.term_taxonomy_id = tr.term_taxonomy_id"
495
-			. " INNER JOIN {$wpdb->terms} t"
496
-			. "  ON t.term_id = tt.term_id AND t.name != %s",
497
-			Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
498
-			'article'
499
-		) );
500
-
501
-		// Store the count in cache.
502
-		set_transient( '_wl_entity_service__count', $count, 900 );
503
-
504
-		return $count;
505
-	}
506
-
507
-	/**
508
-	 * Add the entity filtering criterias to the arguments for a `get_posts`
509
-	 * call.
510
-	 *
511
-	 * @param array $args The arguments for a `get_posts` call.
512
-	 *
513
-	 * @return array The arguments for a `get_posts` call.
514
-	 * @since 3.15.0
515
-	 *
516
-	 */
517
-	public static function add_criterias( $args ) {
518
-
519
-		// Build an optimal tax-query.
520
-		$tax_query = array(
521
-			'relation' => 'AND',
522
-			array(
523
-				'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
524
-				'operator' => 'EXISTS',
525
-			),
526
-			array(
527
-				'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
528
-				'field'    => 'slug',
529
-				'terms'    => 'article',
530
-				'operator' => 'NOT IN',
531
-			),
532
-		);
533
-
534
-		return $args + array(
535
-				'post_type' => Wordlift_Entity_Service::valid_entity_post_types(),
536
-				/*
430
+        if ( empty( $dataset_uri ) || 0 !== strpos( $uri, $dataset_uri ) ) {
431
+            $uri = null;
432
+        }
433
+
434
+        // Set the URI if it isn't set yet.
435
+        $post_status = get_post_status( $post_id );
436
+        if ( empty( $uri ) && 'auto-draft' !== $post_status && 'inherit' !== $post_status ) {
437
+            $uri = wl_build_entity_uri( $post_id );
438
+            wl_set_entity_uri( $post_id, $uri );
439
+        }
440
+
441
+        return $uri;
442
+    }
443
+
444
+    public function get_uri( $object_id, $type = Object_Type_Enum::POST ) {
445
+
446
+        if ( Object_Type_Enum::POST === $type ) {
447
+            return $this->get_uri_for_post( $object_id );
448
+        }
449
+
450
+        if ( Object_Type_Enum::USER === $type ) {
451
+            $uri = Wordlift_User_Service::get_instance()->get_uri( $object_id );
452
+
453
+            return ( false === $uri ? null : $uri );
454
+        }
455
+
456
+        return null;
457
+    }
458
+
459
+    /**
460
+     * Get the alternative label input HTML code.
461
+     *
462
+     * @param string $value The input value.
463
+     *
464
+     * @return string The input HTML code.
465
+     * @since 3.2.0
466
+     *
467
+     */
468
+    private function get_alternative_label_input( $value = '' ) {
469
+
470
+        return sprintf( self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr( $value ), __( 'Delete', 'wordlift' ) );
471
+    }
472
+
473
+    /**
474
+     * Get the number of entity posts published in this blog.
475
+     *
476
+     * @return int The number of published entity posts.
477
+     * @since 3.6.0
478
+     *
479
+     */
480
+    public function count() {
481
+        global $wpdb;
482
+
483
+        // Try to get the count from the transient.
484
+        $count = get_transient( '_wl_entity_service__count' );
485
+        if ( false !== $count ) {
486
+            return $count;
487
+        }
488
+
489
+        // Query the count.
490
+        $count = $wpdb->get_var( $wpdb->prepare(
491
+            "SELECT COUNT( DISTINCT( tr.object_id ) )"
492
+            . " FROM {$wpdb->term_relationships} tr"
493
+            . " INNER JOIN {$wpdb->term_taxonomy} tt"
494
+            . "  ON tt.taxonomy = %s AND tt.term_taxonomy_id = tr.term_taxonomy_id"
495
+            . " INNER JOIN {$wpdb->terms} t"
496
+            . "  ON t.term_id = tt.term_id AND t.name != %s",
497
+            Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
498
+            'article'
499
+        ) );
500
+
501
+        // Store the count in cache.
502
+        set_transient( '_wl_entity_service__count', $count, 900 );
503
+
504
+        return $count;
505
+    }
506
+
507
+    /**
508
+     * Add the entity filtering criterias to the arguments for a `get_posts`
509
+     * call.
510
+     *
511
+     * @param array $args The arguments for a `get_posts` call.
512
+     *
513
+     * @return array The arguments for a `get_posts` call.
514
+     * @since 3.15.0
515
+     *
516
+     */
517
+    public static function add_criterias( $args ) {
518
+
519
+        // Build an optimal tax-query.
520
+        $tax_query = array(
521
+            'relation' => 'AND',
522
+            array(
523
+                'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
524
+                'operator' => 'EXISTS',
525
+            ),
526
+            array(
527
+                'taxonomy' => Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
528
+                'field'    => 'slug',
529
+                'terms'    => 'article',
530
+                'operator' => 'NOT IN',
531
+            ),
532
+        );
533
+
534
+        return $args + array(
535
+                'post_type' => Wordlift_Entity_Service::valid_entity_post_types(),
536
+                /*
537 537
 				 * Ensure compatibility with Polylang.
538 538
 				 *
539 539
 				 * @see https://github.com/insideout10/wordlift-plugin/issues/855.
@@ -541,102 +541,102 @@  discard block
 block discarded – undo
541 541
 				 *
542 542
 				 * @since 3.19.5
543 543
 				 */
544
-				'lang'      => '',
545
-				'tax_query' => $tax_query,
546
-			);
547
-	}
548
-
549
-	/**
550
-	 * Create a new entity.
551
-	 *
552
-	 * @param string $name The entity name.
553
-	 * @param string $type_uri The entity's type URI.
554
-	 * @param null $logo The entity logo id (or NULL if none).
555
-	 * @param string $status The post status, by default 'publish'.
556
-	 *
557
-	 * @return int|WP_Error The entity post id or a {@link WP_Error} in case the `wp_insert_post` call fails.
558
-	 * @since 3.9.0
559
-	 *
560
-	 */
561
-	public function create( $name, $type_uri, $logo = null, $status = 'publish' ) {
562
-
563
-		// Create an entity for the publisher.
564
-		$post_id = @wp_insert_post( array(
565
-			'post_type'    => self::TYPE_NAME,
566
-			'post_title'   => $name,
567
-			'post_status'  => $status,
568
-			'post_content' => '',
569
-		) );
570
-
571
-		// Return the error if any.
572
-		if ( is_wp_error( $post_id ) ) {
573
-			return $post_id;
574
-		}
575
-
576
-		// Set the entity logo.
577
-		if ( $logo && is_numeric( $logo ) ) {
578
-			set_post_thumbnail( $post_id, $logo );
579
-		}
580
-
581
-		// Set the entity type.
582
-		Wordlift_Entity_Type_Service::get_instance()->set( $post_id, $type_uri );
583
-
584
-		return $post_id;
585
-	}
586
-
587
-	/**
588
-	 * Get the entities related to the one with the specified id. By default only
589
-	 * published entities will be returned.
590
-	 *
591
-	 * @param int $id The post id.
592
-	 * @param string $post_status The target post status (default = publish).
593
-	 *
594
-	 * @return array An array of post ids.
595
-	 * @since 3.10.0
596
-	 *
597
-	 */
598
-	public function get_related_entities( $id, $post_status = 'publish' ) {
599
-
600
-		return $this->relation_service->get_objects( $id, 'ids', null, $post_status );
601
-	}
602
-
603
-	/**
604
-	 * Get the list of entities.
605
-	 *
606
-	 * @param array $params Custom parameters for WordPress' own {@link get_posts} function.
607
-	 *
608
-	 * @return array An array of entity posts.
609
-	 * @since 3.12.2
610
-	 *
611
-	 */
612
-	public function get( $params = array() ) {
613
-
614
-		// Set the defaults.
615
-		$defaults = array( 'post_type' => 'entity' );
616
-
617
-		// Merge the defaults with the provided parameters.
618
-		$args = wp_parse_args( $params, $defaults );
619
-
620
-		// Call the `get_posts` function.
621
-		return get_posts( $args );
622
-	}
623
-
624
-	/**
625
-	 * The list of post type names which can be used for entities
626
-	 *
627
-	 * Criteria is that the post type is public. The list of valid post types
628
-	 * can be overridden with a filter.
629
-	 *
630
-	 * @return array Array containing the names of the valid post types.
631
-	 * @since 3.15.0
632
-	 *
633
-	 */
634
-	static function valid_entity_post_types() {
635
-
636
-		// Ignore builtins in the call to avoid getting attachments.
637
-		$post_types = array( 'post', 'page', self::TYPE_NAME, 'product' );
638
-
639
-		return apply_filters( 'wl_valid_entity_post_types', $post_types );
640
-	}
544
+                'lang'      => '',
545
+                'tax_query' => $tax_query,
546
+            );
547
+    }
548
+
549
+    /**
550
+     * Create a new entity.
551
+     *
552
+     * @param string $name The entity name.
553
+     * @param string $type_uri The entity's type URI.
554
+     * @param null $logo The entity logo id (or NULL if none).
555
+     * @param string $status The post status, by default 'publish'.
556
+     *
557
+     * @return int|WP_Error The entity post id or a {@link WP_Error} in case the `wp_insert_post` call fails.
558
+     * @since 3.9.0
559
+     *
560
+     */
561
+    public function create( $name, $type_uri, $logo = null, $status = 'publish' ) {
562
+
563
+        // Create an entity for the publisher.
564
+        $post_id = @wp_insert_post( array(
565
+            'post_type'    => self::TYPE_NAME,
566
+            'post_title'   => $name,
567
+            'post_status'  => $status,
568
+            'post_content' => '',
569
+        ) );
570
+
571
+        // Return the error if any.
572
+        if ( is_wp_error( $post_id ) ) {
573
+            return $post_id;
574
+        }
575
+
576
+        // Set the entity logo.
577
+        if ( $logo && is_numeric( $logo ) ) {
578
+            set_post_thumbnail( $post_id, $logo );
579
+        }
580
+
581
+        // Set the entity type.
582
+        Wordlift_Entity_Type_Service::get_instance()->set( $post_id, $type_uri );
583
+
584
+        return $post_id;
585
+    }
586
+
587
+    /**
588
+     * Get the entities related to the one with the specified id. By default only
589
+     * published entities will be returned.
590
+     *
591
+     * @param int $id The post id.
592
+     * @param string $post_status The target post status (default = publish).
593
+     *
594
+     * @return array An array of post ids.
595
+     * @since 3.10.0
596
+     *
597
+     */
598
+    public function get_related_entities( $id, $post_status = 'publish' ) {
599
+
600
+        return $this->relation_service->get_objects( $id, 'ids', null, $post_status );
601
+    }
602
+
603
+    /**
604
+     * Get the list of entities.
605
+     *
606
+     * @param array $params Custom parameters for WordPress' own {@link get_posts} function.
607
+     *
608
+     * @return array An array of entity posts.
609
+     * @since 3.12.2
610
+     *
611
+     */
612
+    public function get( $params = array() ) {
613
+
614
+        // Set the defaults.
615
+        $defaults = array( 'post_type' => 'entity' );
616
+
617
+        // Merge the defaults with the provided parameters.
618
+        $args = wp_parse_args( $params, $defaults );
619
+
620
+        // Call the `get_posts` function.
621
+        return get_posts( $args );
622
+    }
623
+
624
+    /**
625
+     * The list of post type names which can be used for entities
626
+     *
627
+     * Criteria is that the post type is public. The list of valid post types
628
+     * can be overridden with a filter.
629
+     *
630
+     * @return array Array containing the names of the valid post types.
631
+     * @since 3.15.0
632
+     *
633
+     */
634
+    static function valid_entity_post_types() {
635
+
636
+        // Ignore builtins in the call to avoid getting attachments.
637
+        $post_types = array( 'post', 'page', self::TYPE_NAME, 'product' );
638
+
639
+        return apply_filters( 'wl_valid_entity_post_types', $post_types );
640
+    }
641 641
 
642 642
 }
Please login to merge, or discard this patch.
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 	 * @since 3.2.0
100 100
 	 *
101 101
 	 */
102
-	public function __construct( $ui_service, $relation_service, $entity_uri_service ) {
102
+	public function __construct($ui_service, $relation_service, $entity_uri_service) {
103 103
 
104
-		$this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' );
104
+		$this->log = Wordlift_Log_Service::get_logger('Wordlift_Entity_Service');
105 105
 
106 106
 		$this->ui_service         = $ui_service;
107 107
 		$this->relation_service   = $relation_service;
@@ -132,17 +132,17 @@  discard block
 block discarded – undo
132 132
 	 * @since 3.1.0
133 133
 	 *
134 134
 	 */
135
-	public function is_entity( $post_id ) {
135
+	public function is_entity($post_id) {
136 136
 
137
-		$terms = wp_get_object_terms( $post_id, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
137
+		$terms = wp_get_object_terms($post_id, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME);
138 138
 
139
-		if ( is_wp_error( $terms ) ) {
140
-			$this->log->error( "Cannot get the terms for post $post_id: " . $terms->get_error_message() );
139
+		if (is_wp_error($terms)) {
140
+			$this->log->error("Cannot get the terms for post $post_id: ".$terms->get_error_message());
141 141
 
142 142
 			return false;
143 143
 		}
144 144
 
145
-		if ( empty( $terms ) ) {
145
+		if (empty($terms)) {
146 146
 			return false;
147 147
 		}
148 148
 
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 		 *
154 154
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
155 155
 		 */
156
-		foreach ( $terms as $term ) {
157
-			if ( 1 !== preg_match( '~(^|-)article$~', $term->slug ) ) {
156
+		foreach ($terms as $term) {
157
+			if (1 !== preg_match('~(^|-)article$~', $term->slug)) {
158 158
 				return true;
159 159
 			}
160 160
 		}
@@ -174,19 +174,19 @@  discard block
 block discarded – undo
174 174
 	 * @since 3.5.0
175 175
 	 *
176 176
 	 */
177
-	public function get_classification_scope_for( $post_id, $default = WL_WHAT_RELATION ) {
177
+	public function get_classification_scope_for($post_id, $default = WL_WHAT_RELATION) {
178 178
 
179
-		if ( false === $this->is_entity( $post_id ) ) {
179
+		if (false === $this->is_entity($post_id)) {
180 180
 			return $default;
181 181
 		}
182 182
 
183 183
 		// Retrieve the entity type
184
-		$entity_type_arr = Wordlift_Entity_Type_Service::get_instance()->get( $post_id );
185
-		$entity_type     = str_replace( 'wl-', '', $entity_type_arr['css_class'] );
184
+		$entity_type_arr = Wordlift_Entity_Type_Service::get_instance()->get($post_id);
185
+		$entity_type     = str_replace('wl-', '', $entity_type_arr['css_class']);
186 186
 		// Retrieve classification boxes configuration
187
-		$classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES );
188
-		foreach ( $classification_boxes as $cb ) {
189
-			if ( in_array( $entity_type, $cb['registeredTypes'] ) ) {
187
+		$classification_boxes = unserialize(WL_CORE_POST_CLASSIFICATION_BOXES);
188
+		foreach ($classification_boxes as $cb) {
189
+			if (in_array($entity_type, $cb['registeredTypes'])) {
190 190
 				return $cb['id'];
191 191
 			}
192 192
 		}
@@ -201,13 +201,13 @@  discard block
 block discarded – undo
201 201
 	 *
202 202
 	 * @return bool|null Null if it's not an entity, otherwise true if it's used.
203 203
 	 */
204
-	public function is_used( $post_id ) {
204
+	public function is_used($post_id) {
205 205
 
206
-		if ( false === $this->is_entity( $post_id ) ) {
206
+		if (false === $this->is_entity($post_id)) {
207 207
 			return null;
208 208
 		}
209 209
 		// Retrieve the post
210
-		$entity = get_post( $post_id );
210
+		$entity = get_post($post_id);
211 211
 
212 212
 		global $wpdb;
213 213
 		// Retrieve Wordlift relation instances table name
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
 		);
221 221
 
222 222
 		// Perform the query
223
-		$relation_instances = (int) $wpdb->get_var( $stmt );
223
+		$relation_instances = (int) $wpdb->get_var($stmt);
224 224
 		// If there is at least one relation instance for the current entity, then it's used
225
-		if ( 0 < $relation_instances ) {
225
+		if (0 < $relation_instances) {
226 226
 			return true;
227 227
 		}
228 228
 
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
 		$stmt = $wpdb->prepare(
231 231
 			"SELECT COUNT(*) FROM $wpdb->postmeta WHERE post_id != %d AND meta_value = %s",
232 232
 			$entity->ID,
233
-			wl_get_entity_uri( $entity->ID )
233
+			wl_get_entity_uri($entity->ID)
234 234
 		);
235 235
 		// Perform the query
236
-		$meta_instances = (int) $wpdb->get_var( $stmt );
236
+		$meta_instances = (int) $wpdb->get_var($stmt);
237 237
 
238 238
 		// If there is at least one meta that refers the current entity uri, then current entity is used
239
-		if ( 0 < $meta_instances ) {
239
+		if (0 < $meta_instances) {
240 240
 			return true;
241 241
 		}
242 242
 
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
 	 * @since      3.2.0
257 257
 	 *
258 258
 	 */
259
-	public function get_entity_post_by_uri( $uri ) {
259
+	public function get_entity_post_by_uri($uri) {
260 260
 
261
-		return $this->entity_uri_service->get_entity( $uri );
261
+		return $this->entity_uri_service->get_entity($uri);
262 262
 	}
263 263
 
264 264
 	/**
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
 	 * @param WP_Post $post Post object.
274 274
 	 * @param bool $update Whether this is an existing post being updated or not.
275 275
 	 */
276
-	public function save_post( $post_id, $post, $update ) {
276
+	public function save_post($post_id, $post, $update) {
277 277
 
278 278
 		// Avoid doing anything if post is autosave or a revision.
279
-		if ( wp_is_post_autosave( $post ) || wp_is_post_revision( $post ) ) {
279
+		if (wp_is_post_autosave($post) || wp_is_post_revision($post)) {
280 280
 			return;
281 281
 		}
282 282
 
@@ -286,16 +286,16 @@  discard block
 block discarded – undo
286 286
 		// the $post_id in the save_post call matches the post id set in the request.
287 287
 		//
288 288
 		// If this is not the current post being saved or if it's not an entity, return.
289
-		if ( ! isset( $_REQUEST['post_ID'] ) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity( $post_id ) ) {
289
+		if ( ! isset($_REQUEST['post_ID']) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity($post_id)) {
290 290
 			return;
291 291
 		}
292 292
 
293 293
 		// Get the alt labels from the request (or empty array).
294
-		$alt_labels = isset( $_REQUEST['wl_alternative_label'] ) ? $_REQUEST['wl_alternative_label'] : array();
294
+		$alt_labels = isset($_REQUEST['wl_alternative_label']) ? $_REQUEST['wl_alternative_label'] : array();
295 295
 
296
-		if ( ( ! empty( $_POST['content'] ) && ! empty( $_POST['post_content'] ) ) || isset( $_REQUEST['wl_alternative_label'] ) ) {
296
+		if (( ! empty($_POST['content']) && ! empty($_POST['post_content'])) || isset($_REQUEST['wl_alternative_label'])) {
297 297
 			// This is via classic editor, so set the alternative labels.
298
-			$this->set_alternative_labels( $post_id, $alt_labels );
298
+			$this->set_alternative_labels($post_id, $alt_labels);
299 299
 		}
300 300
 
301 301
 
@@ -310,28 +310,28 @@  discard block
 block discarded – undo
310 310
 	 * @since 3.2.0
311 311
 	 *
312 312
 	 */
313
-	public function set_alternative_labels( $post_id, $alt_labels ) {
313
+	public function set_alternative_labels($post_id, $alt_labels) {
314 314
 
315 315
 		// Bail out if post id is not numeric. We add this check as we found a WP install that was sending a WP_Error
316 316
 		// instead of post id.
317
-		if ( ! is_numeric( $post_id ) ) {
317
+		if ( ! is_numeric($post_id)) {
318 318
 			return;
319 319
 		}
320 320
 
321 321
 		// Force $alt_labels to be an array
322
-		if ( ! is_array( $alt_labels ) ) {
323
-			$alt_labels = array( $alt_labels );
322
+		if ( ! is_array($alt_labels)) {
323
+			$alt_labels = array($alt_labels);
324 324
 		}
325 325
 
326
-		$this->log->debug( "Setting alternative labels [ post id :: $post_id ][ alt labels :: " . implode( ',', $alt_labels ) . " ]" );
326
+		$this->log->debug("Setting alternative labels [ post id :: $post_id ][ alt labels :: ".implode(',', $alt_labels)." ]");
327 327
 
328 328
 		// Delete all the existing alternate labels.
329
-		delete_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
329
+		delete_post_meta($post_id, self::ALTERNATIVE_LABEL_META_KEY);
330 330
 
331 331
 		// Set the alternative labels.
332
-		foreach ( $alt_labels as $alt_label ) {
333
-			if ( ! empty( $alt_label ) ) {
334
-				add_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label );
332
+		foreach ($alt_labels as $alt_label) {
333
+			if ( ! empty($alt_label)) {
334
+				add_post_meta($post_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label);
335 335
 			}
336 336
 		}
337 337
 
@@ -346,9 +346,9 @@  discard block
 block discarded – undo
346 346
 	 * @since 3.2.0
347 347
 	 *
348 348
 	 */
349
-	public function get_alternative_labels( $post_id ) {
349
+	public function get_alternative_labels($post_id) {
350 350
 
351
-		return get_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
351
+		return get_post_meta($post_id, self::ALTERNATIVE_LABEL_META_KEY);
352 352
 	}
353 353
 
354 354
 	/**
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
 	 * @since 3.12.0
361 361
 	 *
362 362
 	 */
363
-	public function get_labels( $post_id ) {
363
+	public function get_labels($post_id) {
364 364
 
365
-		return array_merge( (array) get_the_title( $post_id ), $this->get_alternative_labels( $post_id ) );
365
+		return array_merge((array) get_the_title($post_id), $this->get_alternative_labels($post_id));
366 366
 	}
367 367
 
368 368
 	/**
@@ -373,25 +373,25 @@  discard block
 block discarded – undo
373 373
 	 * @since 3.2.0
374 374
 	 *
375 375
 	 */
376
-	public function edit_form_before_permalink( $post ) {
376
+	public function edit_form_before_permalink($post) {
377 377
 
378 378
 		// If it's not an entity, return.
379
-		if ( ! $this->is_entity( $post->ID ) ) {
379
+		if ( ! $this->is_entity($post->ID)) {
380 380
 			return;
381 381
 		}
382 382
 
383 383
 		// Print the input template.
384
-		$this->ui_service->print_template( 'wl-tmpl-alternative-label-input', $this->get_alternative_label_input() );
384
+		$this->ui_service->print_template('wl-tmpl-alternative-label-input', $this->get_alternative_label_input());
385 385
 
386 386
 		// Print all the currently set alternative labels.
387
-		foreach ( $this->get_alternative_labels( $post->ID ) as $alt_label ) {
387
+		foreach ($this->get_alternative_labels($post->ID) as $alt_label) {
388 388
 
389
-			echo $this->get_alternative_label_input( $alt_label );
389
+			echo $this->get_alternative_label_input($alt_label);
390 390
 
391 391
 		};
392 392
 
393 393
 		// Print the button.
394
-		$this->ui_service->print_button( 'wl-add-alternative-labels-button', __( 'Add more titles', 'wordlift' ) );
394
+		$this->ui_service->print_button('wl-add-alternative-labels-button', __('Add more titles', 'wordlift'));
395 395
 
396 396
 	}
397 397
 
@@ -404,53 +404,53 @@  discard block
 block discarded – undo
404 404
 	 * @since 3.6.0
405 405
 	 *
406 406
 	 */
407
-	private function get_uri_for_post( $post_id ) {
407
+	private function get_uri_for_post($post_id) {
408 408
 
409
-		$log = Wordlift_Log_Service::get_logger( get_class() );
409
+		$log = Wordlift_Log_Service::get_logger(get_class());
410 410
 
411 411
 		// If a null is given, nothing to do
412
-		if ( is_null( $post_id ) ) {
412
+		if (is_null($post_id)) {
413 413
 			return null;
414 414
 		}
415 415
 
416 416
 		$dataset_uri = wl_configuration_get_redlink_dataset_uri();
417 417
 
418
-		if ( empty( $dataset_uri ) ) {
418
+		if (empty($dataset_uri)) {
419 419
 			// Continue even if the dataset uri is not properly configured. It is handled in function wl_build_entity_uri()
420
-			$log->debug( 'Continuing, dataset uri not configured...' );
420
+			$log->debug('Continuing, dataset uri not configured...');
421 421
 		}
422 422
 
423
-		$uri = get_post_meta( $post_id, WL_ENTITY_URL_META_NAME, true );
423
+		$uri = get_post_meta($post_id, WL_ENTITY_URL_META_NAME, true);
424 424
 
425 425
 		/*
426 426
 		 * Consider the URI invalid if it doesn't start with the dataset URI.
427 427
 		 *
428 428
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/996
429 429
 		 */
430
-		if ( empty( $dataset_uri ) || 0 !== strpos( $uri, $dataset_uri ) ) {
430
+		if (empty($dataset_uri) || 0 !== strpos($uri, $dataset_uri)) {
431 431
 			$uri = null;
432 432
 		}
433 433
 
434 434
 		// Set the URI if it isn't set yet.
435
-		$post_status = get_post_status( $post_id );
436
-		if ( empty( $uri ) && 'auto-draft' !== $post_status && 'inherit' !== $post_status ) {
437
-			$uri = wl_build_entity_uri( $post_id );
438
-			wl_set_entity_uri( $post_id, $uri );
435
+		$post_status = get_post_status($post_id);
436
+		if (empty($uri) && 'auto-draft' !== $post_status && 'inherit' !== $post_status) {
437
+			$uri = wl_build_entity_uri($post_id);
438
+			wl_set_entity_uri($post_id, $uri);
439 439
 		}
440 440
 
441 441
 		return $uri;
442 442
 	}
443 443
 
444
-	public function get_uri( $object_id, $type = Object_Type_Enum::POST ) {
444
+	public function get_uri($object_id, $type = Object_Type_Enum::POST) {
445 445
 
446
-		if ( Object_Type_Enum::POST === $type ) {
447
-			return $this->get_uri_for_post( $object_id );
446
+		if (Object_Type_Enum::POST === $type) {
447
+			return $this->get_uri_for_post($object_id);
448 448
 		}
449 449
 
450
-		if ( Object_Type_Enum::USER === $type ) {
451
-			$uri = Wordlift_User_Service::get_instance()->get_uri( $object_id );
450
+		if (Object_Type_Enum::USER === $type) {
451
+			$uri = Wordlift_User_Service::get_instance()->get_uri($object_id);
452 452
 
453
-			return ( false === $uri ? null : $uri );
453
+			return (false === $uri ? null : $uri);
454 454
 		}
455 455
 
456 456
 		return null;
@@ -465,9 +465,9 @@  discard block
 block discarded – undo
465 465
 	 * @since 3.2.0
466 466
 	 *
467 467
 	 */
468
-	private function get_alternative_label_input( $value = '' ) {
468
+	private function get_alternative_label_input($value = '') {
469 469
 
470
-		return sprintf( self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr( $value ), __( 'Delete', 'wordlift' ) );
470
+		return sprintf(self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr($value), __('Delete', 'wordlift'));
471 471
 	}
472 472
 
473 473
 	/**
@@ -481,13 +481,13 @@  discard block
 block discarded – undo
481 481
 		global $wpdb;
482 482
 
483 483
 		// Try to get the count from the transient.
484
-		$count = get_transient( '_wl_entity_service__count' );
485
-		if ( false !== $count ) {
484
+		$count = get_transient('_wl_entity_service__count');
485
+		if (false !== $count) {
486 486
 			return $count;
487 487
 		}
488 488
 
489 489
 		// Query the count.
490
-		$count = $wpdb->get_var( $wpdb->prepare(
490
+		$count = $wpdb->get_var($wpdb->prepare(
491 491
 			"SELECT COUNT( DISTINCT( tr.object_id ) )"
492 492
 			. " FROM {$wpdb->term_relationships} tr"
493 493
 			. " INNER JOIN {$wpdb->term_taxonomy} tt"
@@ -496,10 +496,10 @@  discard block
 block discarded – undo
496 496
 			. "  ON t.term_id = tt.term_id AND t.name != %s",
497 497
 			Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
498 498
 			'article'
499
-		) );
499
+		));
500 500
 
501 501
 		// Store the count in cache.
502
-		set_transient( '_wl_entity_service__count', $count, 900 );
502
+		set_transient('_wl_entity_service__count', $count, 900);
503 503
 
504 504
 		return $count;
505 505
 	}
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 	 * @since 3.15.0
515 515
 	 *
516 516
 	 */
517
-	public static function add_criterias( $args ) {
517
+	public static function add_criterias($args) {
518 518
 
519 519
 		// Build an optimal tax-query.
520 520
 		$tax_query = array(
@@ -558,28 +558,28 @@  discard block
 block discarded – undo
558 558
 	 * @since 3.9.0
559 559
 	 *
560 560
 	 */
561
-	public function create( $name, $type_uri, $logo = null, $status = 'publish' ) {
561
+	public function create($name, $type_uri, $logo = null, $status = 'publish') {
562 562
 
563 563
 		// Create an entity for the publisher.
564
-		$post_id = @wp_insert_post( array(
564
+		$post_id = @wp_insert_post(array(
565 565
 			'post_type'    => self::TYPE_NAME,
566 566
 			'post_title'   => $name,
567 567
 			'post_status'  => $status,
568 568
 			'post_content' => '',
569
-		) );
569
+		));
570 570
 
571 571
 		// Return the error if any.
572
-		if ( is_wp_error( $post_id ) ) {
572
+		if (is_wp_error($post_id)) {
573 573
 			return $post_id;
574 574
 		}
575 575
 
576 576
 		// Set the entity logo.
577
-		if ( $logo && is_numeric( $logo ) ) {
578
-			set_post_thumbnail( $post_id, $logo );
577
+		if ($logo && is_numeric($logo)) {
578
+			set_post_thumbnail($post_id, $logo);
579 579
 		}
580 580
 
581 581
 		// Set the entity type.
582
-		Wordlift_Entity_Type_Service::get_instance()->set( $post_id, $type_uri );
582
+		Wordlift_Entity_Type_Service::get_instance()->set($post_id, $type_uri);
583 583
 
584 584
 		return $post_id;
585 585
 	}
@@ -595,9 +595,9 @@  discard block
 block discarded – undo
595 595
 	 * @since 3.10.0
596 596
 	 *
597 597
 	 */
598
-	public function get_related_entities( $id, $post_status = 'publish' ) {
598
+	public function get_related_entities($id, $post_status = 'publish') {
599 599
 
600
-		return $this->relation_service->get_objects( $id, 'ids', null, $post_status );
600
+		return $this->relation_service->get_objects($id, 'ids', null, $post_status);
601 601
 	}
602 602
 
603 603
 	/**
@@ -609,16 +609,16 @@  discard block
 block discarded – undo
609 609
 	 * @since 3.12.2
610 610
 	 *
611 611
 	 */
612
-	public function get( $params = array() ) {
612
+	public function get($params = array()) {
613 613
 
614 614
 		// Set the defaults.
615
-		$defaults = array( 'post_type' => 'entity' );
615
+		$defaults = array('post_type' => 'entity');
616 616
 
617 617
 		// Merge the defaults with the provided parameters.
618
-		$args = wp_parse_args( $params, $defaults );
618
+		$args = wp_parse_args($params, $defaults);
619 619
 
620 620
 		// Call the `get_posts` function.
621
-		return get_posts( $args );
621
+		return get_posts($args);
622 622
 	}
623 623
 
624 624
 	/**
@@ -634,9 +634,9 @@  discard block
 block discarded – undo
634 634
 	static function valid_entity_post_types() {
635 635
 
636 636
 		// Ignore builtins in the call to avoid getting attachments.
637
-		$post_types = array( 'post', 'page', self::TYPE_NAME, 'product' );
637
+		$post_types = array('post', 'page', self::TYPE_NAME, 'product');
638 638
 
639
-		return apply_filters( 'wl_valid_entity_post_types', $post_types );
639
+		return apply_filters('wl_valid_entity_post_types', $post_types);
640 640
 	}
641 641
 
642 642
 }
Please login to merge, or discard this patch.
src/includes/class-wordlift.php 2 patches
Indentation   +1813 added lines, -1813 removed lines patch added patch discarded remove patch
@@ -67,1556 +67,1556 @@  discard block
 block discarded – undo
67 67
  */
68 68
 class Wordlift {
69 69
 
70
-	//<editor-fold desc="## FIELDS">
71
-
72
-	/**
73
-	 * The loader that's responsible for maintaining and registering all hooks that power
74
-	 * the plugin.
75
-	 *
76
-	 * @since    1.0.0
77
-	 * @access   protected
78
-	 * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
79
-	 */
80
-	protected $loader;
81
-
82
-	/**
83
-	 * The unique identifier of this plugin.
84
-	 *
85
-	 * @since    1.0.0
86
-	 * @access   protected
87
-	 * @var      string $plugin_name The string used to uniquely identify this plugin.
88
-	 */
89
-	protected $plugin_name;
90
-
91
-	/**
92
-	 * The current version of the plugin.
93
-	 *
94
-	 * @since    1.0.0
95
-	 * @access   protected
96
-	 * @var      string $version The current version of the plugin.
97
-	 */
98
-	protected $version;
99
-
100
-	/**
101
-	 * The {@link Wordlift_Tinymce_Adapter} instance.
102
-	 *
103
-	 * @since  3.12.0
104
-	 * @access protected
105
-	 * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
106
-	 */
107
-	protected $tinymce_adapter;
108
-
109
-	/**
110
-	 * The {@link Faq_Tinymce_Adapter} instance
111
-	 * @since 3.26.0
112
-	 * @access protected
113
-	 * @var Faq_Tinymce_Adapter $faq_tinymce_adapter .
114
-	 */
115
-	//protected $faq_tinymce_adapter;
116
-
117
-	/**
118
-	 * The Thumbnail service.
119
-	 *
120
-	 * @since  3.1.5
121
-	 * @access private
122
-	 * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
123
-	 */
124
-	private $thumbnail_service;
125
-
126
-	/**
127
-	 * The UI service.
128
-	 *
129
-	 * @since  3.2.0
130
-	 * @access private
131
-	 * @var \Wordlift_UI_Service $ui_service The UI service.
132
-	 */
133
-	private $ui_service;
134
-
135
-	/**
136
-	 * The Schema service.
137
-	 *
138
-	 * @since  3.3.0
139
-	 * @access protected
140
-	 * @var \Wordlift_Schema_Service $schema_service The Schema service.
141
-	 */
142
-	protected $schema_service;
143
-
144
-	/**
145
-	 * The Entity service.
146
-	 *
147
-	 * @since  3.1.0
148
-	 * @access protected
149
-	 * @var \Wordlift_Entity_Service $entity_service The Entity service.
150
-	 */
151
-	protected $entity_service;
152
-
153
-	/**
154
-	 * The Topic Taxonomy service.
155
-	 *
156
-	 * @since  3.5.0
157
-	 * @access private
158
-	 * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
159
-	 */
160
-	private $topic_taxonomy_service;
161
-
162
-	/**
163
-	 * The Entity Types Taxonomy service.
164
-	 *
165
-	 * @since  3.18.0
166
-	 * @access private
167
-	 * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service.
168
-	 */
169
-	private $entity_types_taxonomy_service;
170
-
171
-	/**
172
-	 * The User service.
173
-	 *
174
-	 * @since  3.1.7
175
-	 * @access protected
176
-	 * @var \Wordlift_User_Service $user_service The User service.
177
-	 */
178
-	protected $user_service;
179
-
180
-	/**
181
-	 * The Timeline service.
182
-	 *
183
-	 * @since  3.1.0
184
-	 * @access private
185
-	 * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
186
-	 */
187
-	private $timeline_service;
188
-
189
-	/**
190
-	 * The Redirect service.
191
-	 *
192
-	 * @since  3.2.0
193
-	 * @access private
194
-	 * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
195
-	 */
196
-	private $redirect_service;
197
-
198
-	/**
199
-	 * The Notice service.
200
-	 *
201
-	 * @since  3.3.0
202
-	 * @access private
203
-	 * @var \Wordlift_Notice_Service $notice_service The Notice service.
204
-	 */
205
-	private $notice_service;
206
-
207
-	/**
208
-	 * The Entity list customization.
209
-	 *
210
-	 * @since  3.3.0
211
-	 * @access protected
212
-	 * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
213
-	 */
214
-	protected $entity_list_service;
215
-
216
-	/**
217
-	 * The Entity Types Taxonomy Walker.
218
-	 *
219
-	 * @since  3.1.0
220
-	 * @access private
221
-	 * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
222
-	 */
223
-	private $entity_types_taxonomy_walker;
224
-
225
-	/**
226
-	 * The ShareThis service.
227
-	 *
228
-	 * @since  3.2.0
229
-	 * @access private
230
-	 * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
231
-	 */
232
-	private $sharethis_service;
233
-
234
-	/**
235
-	 * The PrimaShop adapter.
236
-	 *
237
-	 * @since  3.2.3
238
-	 * @access private
239
-	 * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
240
-	 */
241
-	private $primashop_adapter;
242
-
243
-	/**
244
-	 * The WordLift Dashboard adapter.
245
-	 *
246
-	 * @since  3.4.0
247
-	 * @access private
248
-	 * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
249
-	 */
250
-	private $dashboard_service;
251
-
252
-	/**
253
-	 * The entity type service.
254
-	 *
255
-	 * @since  3.6.0
256
-	 * @access private
257
-	 * @var \Wordlift_Entity_Post_Type_Service
258
-	 */
259
-	private $entity_post_type_service;
260
-
261
-	/**
262
-	 * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
263
-	 *
264
-	 * @since  3.6.0
265
-	 * @access private
266
-	 * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance.
267
-	 */
268
-	private $entity_link_service;
269
-
270
-	/**
271
-	 * A {@link Wordlift_Sparql_Service} instance.
272
-	 *
273
-	 * @since    3.6.0
274
-	 * @access   protected
275
-	 * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
276
-	 */
277
-	protected $sparql_service;
278
-
279
-	/**
280
-	 * A {@link Wordlift_Import_Service} instance.
281
-	 *
282
-	 * @since  3.6.0
283
-	 * @access private
284
-	 * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
285
-	 */
286
-	private $import_service;
287
-
288
-	/**
289
-	 * A {@link Wordlift_Rebuild_Service} instance.
290
-	 *
291
-	 * @since  3.6.0
292
-	 * @access private
293
-	 * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
294
-	 */
295
-	private $rebuild_service;
296
-
297
-	/**
298
-	 * A {@link Wordlift_Jsonld_Service} instance.
299
-	 *
300
-	 * @since  3.7.0
301
-	 * @access protected
302
-	 * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
303
-	 */
304
-	protected $jsonld_service;
305
-
306
-	/**
307
-	 * A {@link Wordlift_Website_Jsonld_Converter} instance.
308
-	 *
309
-	 * @since  3.14.0
310
-	 * @access protected
311
-	 * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance.
312
-	 */
313
-	protected $jsonld_website_converter;
314
-
315
-	/**
316
-	 * A {@link Wordlift_Property_Factory} instance.
317
-	 *
318
-	 * @since  3.7.0
319
-	 * @access private
320
-	 * @var \Wordlift_Property_Factory $property_factory
321
-	 */
322
-	private $property_factory;
323
-
324
-	/**
325
-	 * The 'Download Your Data' page.
326
-	 *
327
-	 * @since  3.6.0
328
-	 * @access private
329
-	 * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
330
-	 */
331
-	private $download_your_data_page;
332
-
333
-	/**
334
-	 * The 'WordLift Settings' page.
335
-	 *
336
-	 * @since  3.11.0
337
-	 * @access protected
338
-	 * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
339
-	 */
340
-	protected $settings_page;
341
-
342
-	/**
343
-	 * The install wizard page.
344
-	 *
345
-	 * @since  3.9.0
346
-	 * @access private
347
-	 * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
348
-	 */
349
-	public $admin_setup;
350
-
351
-	/**
352
-	 * The Content Filter Service hooks up to the 'the_content' filter and provides
353
-	 * linking of entities to their pages.
354
-	 *
355
-	 * @since  3.8.0
356
-	 * @access private
357
-	 * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
358
-	 */
359
-	private $content_filter_service;
360
-
361
-	/**
362
-	 * The Faq Content filter service
363
-	 * @since  3.26.0
364
-	 * @access private
365
-	 * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance.
366
-	 */
367
-	private $faq_content_filter_service;
368
-
369
-	/**
370
-	 * A {@link Wordlift_Key_Validation_Service} instance.
371
-	 *
372
-	 * @since  3.9.0
373
-	 * @access private
374
-	 * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
375
-	 */
376
-	private $key_validation_service;
377
-
378
-	/**
379
-	 * A {@link Wordlift_Rating_Service} instance.
380
-	 *
381
-	 * @since  3.10.0
382
-	 * @access private
383
-	 * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
384
-	 */
385
-	private $rating_service;
386
-
387
-	/**
388
-	 * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
389
-	 *
390
-	 * @since  3.10.0
391
-	 * @access protected
392
-	 * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
393
-	 */
394
-	protected $post_to_jsonld_converter;
395
-
396
-	/**
397
-	 * A {@link Wordlift_Configuration_Service} instance.
398
-	 *
399
-	 * @since  3.10.0
400
-	 * @access protected
401
-	 * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
402
-	 */
403
-	protected $configuration_service;
404
-
405
-	/**
406
-	 * A {@link Wordlift_Install_Service} instance.
407
-	 *
408
-	 * @since  3.18.0
409
-	 * @access protected
410
-	 * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance.
411
-	 */
412
-	protected $install_service;
413
-
414
-	/**
415
-	 * A {@link Wordlift_Entity_Type_Service} instance.
416
-	 *
417
-	 * @since  3.10.0
418
-	 * @access protected
419
-	 * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
420
-	 */
421
-	protected $entity_type_service;
422
-
423
-	/**
424
-	 * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
425
-	 *
426
-	 * @since  3.10.0
427
-	 * @access protected
428
-	 * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
429
-	 */
430
-	protected $entity_post_to_jsonld_converter;
431
-
432
-	/**
433
-	 * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
434
-	 *
435
-	 * @since  3.10.0
436
-	 * @access protected
437
-	 * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
438
-	 */
439
-	protected $postid_to_jsonld_converter;
440
-
441
-	/**
442
-	 * The {@link Wordlift_Admin_Status_Page} class.
443
-	 *
444
-	 * @since  3.9.8
445
-	 * @access private
446
-	 * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
447
-	 */
448
-	private $status_page;
449
-
450
-	/**
451
-	 * The {@link Wordlift_Category_Taxonomy_Service} instance.
452
-	 *
453
-	 * @since  3.11.0
454
-	 * @access protected
455
-	 * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
456
-	 */
457
-	protected $category_taxonomy_service;
458
-
459
-	/**
460
-	 * The {@link Wordlift_Entity_Page_Service} instance.
461
-	 *
462
-	 * @since  3.11.0
463
-	 * @access protected
464
-	 * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance.
465
-	 */
466
-	protected $entity_page_service;
467
-
468
-	/**
469
-	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
470
-	 *
471
-	 * @since  3.11.0
472
-	 * @access protected
473
-	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
474
-	 */
475
-	protected $settings_page_action_link;
476
-
477
-	/**
478
-	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
479
-	 *
480
-	 * @since  3.11.0
481
-	 * @access protected
482
-	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
483
-	 */
484
-	protected $analytics_settings_page_action_link;
485
-
486
-	/**
487
-	 * The {@link Wordlift_Analytics_Connect} class.
488
-	 *
489
-	 * @since  3.11.0
490
-	 * @access protected
491
-	 * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class.
492
-	 */
493
-	protected $analytics_connect;
494
-
495
-	/**
496
-	 * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
497
-	 *
498
-	 * @since  3.11.0
499
-	 * @access protected
500
-	 * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
501
-	 */
502
-	protected $publisher_ajax_adapter;
503
-
504
-	/**
505
-	 * The {@link Wordlift_Admin_Input_Element} element renderer.
506
-	 *
507
-	 * @since  3.11.0
508
-	 * @access protected
509
-	 * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
510
-	 */
511
-	protected $input_element;
512
-
513
-	/**
514
-	 * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
515
-	 *
516
-	 * @since  3.13.0
517
-	 * @access protected
518
-	 * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
519
-	 */
520
-	protected $radio_input_element;
521
-
522
-	/**
523
-	 * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
524
-	 *
525
-	 * @since  3.11.0
526
-	 * @access protected
527
-	 * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
528
-	 */
529
-	protected $language_select_element;
530
-
531
-	/**
532
-	 * The {@link Wordlift_Admin_Country_Select_Element} element renderer.
533
-	 *
534
-	 * @since  3.18.0
535
-	 * @access protected
536
-	 * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer.
537
-	 */
538
-	protected $country_select_element;
539
-
540
-	/**
541
-	 * The {@link Wordlift_Admin_Publisher_Element} element renderer.
542
-	 *
543
-	 * @since  3.11.0
544
-	 * @access protected
545
-	 * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
546
-	 */
547
-	protected $publisher_element;
548
-
549
-	/**
550
-	 * The {@link Wordlift_Admin_Select2_Element} element renderer.
551
-	 *
552
-	 * @since  3.11.0
553
-	 * @access protected
554
-	 * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
555
-	 */
556
-	protected $select2_element;
557
-
558
-	/**
559
-	 * The controller for the entity type list admin page
560
-	 *
561
-	 * @since  3.11.0
562
-	 * @access private
563
-	 * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
564
-	 */
565
-	private $entity_type_admin_page;
566
-
567
-	/**
568
-	 * The controller for the entity type settings admin page
569
-	 *
570
-	 * @since  3.11.0
571
-	 * @access private
572
-	 * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
573
-	 */
574
-	private $entity_type_settings_admin_page;
575
-
576
-	/**
577
-	 * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
578
-	 *
579
-	 * @since  3.11.0
580
-	 * @access protected
581
-	 * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
582
-	 */
583
-	protected $related_entities_cloud_widget;
584
-
585
-	/**
586
-	 * The {@link Wordlift_Admin_Author_Element} instance.
587
-	 *
588
-	 * @since  3.14.0
589
-	 * @access protected
590
-	 * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
591
-	 */
592
-	protected $author_element;
593
-
594
-	/**
595
-	 * The {@link Wordlift_Sample_Data_Service} instance.
596
-	 *
597
-	 * @since  3.12.0
598
-	 * @access protected
599
-	 * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
600
-	 */
601
-	protected $sample_data_service;
602
-
603
-	/**
604
-	 * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
605
-	 *
606
-	 * @since  3.12.0
607
-	 * @access protected
608
-	 * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
609
-	 */
610
-	protected $sample_data_ajax_adapter;
611
-
612
-	/**
613
-	 * The {@link Wordlift_Relation_Rebuild_Service} instance.
614
-	 *
615
-	 * @since  3.14.3
616
-	 * @access private
617
-	 * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance.
618
-	 */
619
-	private $relation_rebuild_service;
620
-
621
-	/**
622
-	 * The {@link Wordlift_Relation_Rebuild_Adapter} instance.
623
-	 *
624
-	 * @since  3.14.3
625
-	 * @access private
626
-	 * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance.
627
-	 */
628
-	private $relation_rebuild_adapter;
629
-
630
-	/**
631
-	 * The {@link Wordlift_Reference_Rebuild_Service} instance.
632
-	 *
633
-	 * @since  3.18.0
634
-	 * @access private
635
-	 * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance.
636
-	 */
637
-	private $reference_rebuild_service;
638
-
639
-	/**
640
-	 * The {@link Wordlift_Google_Analytics_Export_Service} instance.
641
-	 *
642
-	 * @since  3.16.0
643
-	 * @access protected
644
-	 * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance.
645
-	 */
646
-	protected $google_analytics_export_service;
647
-
648
-	/**
649
-	 * {@link Wordlift}'s singleton instance.
650
-	 *
651
-	 * @since  3.15.0
652
-	 * @access protected
653
-	 * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance.
654
-	 */
655
-	protected $entity_type_adapter;
656
-
657
-	/**
658
-	 * The {@link Wordlift_Storage_Factory} instance.
659
-	 *
660
-	 * @since  3.15.0
661
-	 * @access protected
662
-	 * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance.
663
-	 */
664
-	protected $storage_factory;
665
-
666
-	/**
667
-	 * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
668
-	 *
669
-	 * @since  3.15.0
670
-	 * @access protected
671
-	 * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
672
-	 */
673
-	protected $rendition_factory;
674
-
675
-	/**
676
-	 * The {@link Wordlift_Autocomplete_Adapter} instance.
677
-	 *
678
-	 * @since  3.15.0
679
-	 * @access private
680
-	 * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance.
681
-	 */
682
-	private $autocomplete_adapter;
683
-
684
-	/**
685
-	 * The {@link Wordlift_Relation_Service} instance.
686
-	 *
687
-	 * @since  3.15.0
688
-	 * @access protected
689
-	 * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
690
-	 */
691
-	protected $relation_service;
692
-
693
-	/**
694
-	 * The {@link Wordlift_Cached_Post_Converter} instance.
695
-	 *
696
-	 * @since  3.16.0
697
-	 * @access protected
698
-	 * @var  \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance.
699
-	 *
700
-	 */
701
-	protected $cached_postid_to_jsonld_converter;
702
-
703
-	/**
704
-	 * The {@link Wordlift_Entity_Uri_Service} instance.
705
-	 *
706
-	 * @since  3.16.3
707
-	 * @access protected
708
-	 * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
709
-	 */
710
-	protected $entity_uri_service;
711
-
712
-	/**
713
-	 * The {@link Wordlift_Publisher_Service} instance.
714
-	 *
715
-	 * @since  3.19.0
716
-	 * @access protected
717
-	 * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
718
-	 */
719
-	protected $publisher_service;
720
-
721
-	/**
722
-	 * The {@link Wordlift_Context_Cards_Service} instance.
723
-	 *
724
-	 * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance.
725
-	 */
726
-	protected $context_cards_service;
727
-
728
-	/**
729
-	 * {@link Wordlift}'s singleton instance.
730
-	 *
731
-	 * @since  3.11.2
732
-	 * @access private
733
-	 * @var Wordlift $instance {@link Wordlift}'s singleton instance.
734
-	 */
735
-	private static $instance;
736
-
737
-	//</editor-fold>
738
-
739
-	/**
740
-	 * Define the core functionality of the plugin.
741
-	 *
742
-	 * Set the plugin name and the plugin version that can be used throughout the plugin.
743
-	 * Load the dependencies, define the locale, and set the hooks for the admin area and
744
-	 * the public-facing side of the site.
745
-	 *
746
-	 * @since    1.0.0
747
-	 */
748
-	public function __construct() {
749
-
750
-		self::$instance = $this;
751
-
752
-		$this->plugin_name = 'wordlift';
753
-		$this->version     = '3.27.7.2';
754
-		$this->load_dependencies();
755
-		$this->set_locale();
756
-		$this->define_admin_hooks();
757
-		$this->define_public_hooks();
758
-
759
-		// If we're in `WP_CLI` load the related files.
760
-		if ( class_exists( 'WP_CLI' ) ) {
761
-			$this->load_cli_dependencies();
762
-		}
763
-
764
-	}
765
-
766
-	/**
767
-	 * Get the singleton instance.
768
-	 *
769
-	 * @return Wordlift The {@link Wordlift} singleton instance.
770
-	 * @since 3.11.2
771
-	 *
772
-	 */
773
-	public static function get_instance() {
774
-
775
-		return self::$instance;
776
-	}
777
-
778
-	/**
779
-	 * Load the required dependencies for this plugin.
780
-	 *
781
-	 * Include the following files that make up the plugin:
782
-	 *
783
-	 * - Wordlift_Loader. Orchestrates the hooks of the plugin.
784
-	 * - Wordlift_i18n. Defines internationalization functionality.
785
-	 * - Wordlift_Admin. Defines all hooks for the admin area.
786
-	 * - Wordlift_Public. Defines all hooks for the public side of the site.
787
-	 *
788
-	 * Create an instance of the loader which will be used to register the hooks
789
-	 * with WordPress.
790
-	 *
791
-	 * @throws Exception
792
-	 * @since    1.0.0
793
-	 * @access   private
794
-	 */
795
-	private function load_dependencies() {
796
-
797
-		/**
798
-		 * The class responsible for orchestrating the actions and filters of the
799
-		 * core plugin.
800
-		 */
801
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
802
-
803
-		// The class responsible for plugin uninstall.
804
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php';
805
-
806
-		/**
807
-		 * The class responsible for defining internationalization functionality
808
-		 * of the plugin.
809
-		 */
810
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
811
-
812
-		/**
813
-		 * WordLift's supported languages.
814
-		 */
815
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
816
-
817
-		/**
818
-		 * WordLift's supported countries.
819
-		 */
820
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php';
821
-
822
-		/**
823
-		 * Provide support functions to sanitize data.
824
-		 */
825
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
826
-
827
-		/** Services. */
828
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
829
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
830
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
831
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
832
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
833
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
834
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
835
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
836
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
837
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php';
838
-
839
-		/**
840
-		 * The Query builder.
841
-		 */
842
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
843
-
844
-		/**
845
-		 * The Schema service.
846
-		 */
847
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
848
-
849
-		/**
850
-		 * The schema:url property service.
851
-		 */
852
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
853
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
854
-
855
-		/**
856
-		 * The UI service.
857
-		 */
858
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
859
-
860
-		/**
861
-		 * The Thumbnail service.
862
-		 */
863
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
864
-
865
-		/**
866
-		 * The Entity Types Taxonomy service.
867
-		 */
868
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
869
-
870
-		/**
871
-		 * The Entity service.
872
-		 */
873
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
874
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
875
-
876
-		// Add the entity rating service.
877
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
878
-
879
-		/**
880
-		 * The User service.
881
-		 */
882
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
883
-
884
-		/**
885
-		 * The Timeline service.
886
-		 */
887
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
888
-
889
-		/**
890
-		 * The Topic Taxonomy service.
891
-		 */
892
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
893
-
894
-		/**
895
-		 * The SPARQL service.
896
-		 */
897
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
898
-
899
-		/**
900
-		 * The WordLift import service.
901
-		 */
902
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
903
-
904
-		/**
905
-		 * The WordLift URI service.
906
-		 */
907
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
908
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
909
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
910
-
911
-		/**
912
-		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
913
-		 */
914
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php';
915
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php';
916
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php';
917
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php';
918
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
919
-
920
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
921
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
922
-
923
-		/**
924
-		 * Load the converters.
925
-		 */
926
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
927
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
928
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
929
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
930
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
931
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
932
-
933
-		/**
934
-		 * Load cache-related files.
935
-		 */
936
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
937
-
938
-		/**
939
-		 * Load the content filter.
940
-		 */
941
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
942
-
943
-		/*
70
+    //<editor-fold desc="## FIELDS">
71
+
72
+    /**
73
+     * The loader that's responsible for maintaining and registering all hooks that power
74
+     * the plugin.
75
+     *
76
+     * @since    1.0.0
77
+     * @access   protected
78
+     * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
79
+     */
80
+    protected $loader;
81
+
82
+    /**
83
+     * The unique identifier of this plugin.
84
+     *
85
+     * @since    1.0.0
86
+     * @access   protected
87
+     * @var      string $plugin_name The string used to uniquely identify this plugin.
88
+     */
89
+    protected $plugin_name;
90
+
91
+    /**
92
+     * The current version of the plugin.
93
+     *
94
+     * @since    1.0.0
95
+     * @access   protected
96
+     * @var      string $version The current version of the plugin.
97
+     */
98
+    protected $version;
99
+
100
+    /**
101
+     * The {@link Wordlift_Tinymce_Adapter} instance.
102
+     *
103
+     * @since  3.12.0
104
+     * @access protected
105
+     * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
106
+     */
107
+    protected $tinymce_adapter;
108
+
109
+    /**
110
+     * The {@link Faq_Tinymce_Adapter} instance
111
+     * @since 3.26.0
112
+     * @access protected
113
+     * @var Faq_Tinymce_Adapter $faq_tinymce_adapter .
114
+     */
115
+    //protected $faq_tinymce_adapter;
116
+
117
+    /**
118
+     * The Thumbnail service.
119
+     *
120
+     * @since  3.1.5
121
+     * @access private
122
+     * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
123
+     */
124
+    private $thumbnail_service;
125
+
126
+    /**
127
+     * The UI service.
128
+     *
129
+     * @since  3.2.0
130
+     * @access private
131
+     * @var \Wordlift_UI_Service $ui_service The UI service.
132
+     */
133
+    private $ui_service;
134
+
135
+    /**
136
+     * The Schema service.
137
+     *
138
+     * @since  3.3.0
139
+     * @access protected
140
+     * @var \Wordlift_Schema_Service $schema_service The Schema service.
141
+     */
142
+    protected $schema_service;
143
+
144
+    /**
145
+     * The Entity service.
146
+     *
147
+     * @since  3.1.0
148
+     * @access protected
149
+     * @var \Wordlift_Entity_Service $entity_service The Entity service.
150
+     */
151
+    protected $entity_service;
152
+
153
+    /**
154
+     * The Topic Taxonomy service.
155
+     *
156
+     * @since  3.5.0
157
+     * @access private
158
+     * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
159
+     */
160
+    private $topic_taxonomy_service;
161
+
162
+    /**
163
+     * The Entity Types Taxonomy service.
164
+     *
165
+     * @since  3.18.0
166
+     * @access private
167
+     * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service.
168
+     */
169
+    private $entity_types_taxonomy_service;
170
+
171
+    /**
172
+     * The User service.
173
+     *
174
+     * @since  3.1.7
175
+     * @access protected
176
+     * @var \Wordlift_User_Service $user_service The User service.
177
+     */
178
+    protected $user_service;
179
+
180
+    /**
181
+     * The Timeline service.
182
+     *
183
+     * @since  3.1.0
184
+     * @access private
185
+     * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
186
+     */
187
+    private $timeline_service;
188
+
189
+    /**
190
+     * The Redirect service.
191
+     *
192
+     * @since  3.2.0
193
+     * @access private
194
+     * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
195
+     */
196
+    private $redirect_service;
197
+
198
+    /**
199
+     * The Notice service.
200
+     *
201
+     * @since  3.3.0
202
+     * @access private
203
+     * @var \Wordlift_Notice_Service $notice_service The Notice service.
204
+     */
205
+    private $notice_service;
206
+
207
+    /**
208
+     * The Entity list customization.
209
+     *
210
+     * @since  3.3.0
211
+     * @access protected
212
+     * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
213
+     */
214
+    protected $entity_list_service;
215
+
216
+    /**
217
+     * The Entity Types Taxonomy Walker.
218
+     *
219
+     * @since  3.1.0
220
+     * @access private
221
+     * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
222
+     */
223
+    private $entity_types_taxonomy_walker;
224
+
225
+    /**
226
+     * The ShareThis service.
227
+     *
228
+     * @since  3.2.0
229
+     * @access private
230
+     * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
231
+     */
232
+    private $sharethis_service;
233
+
234
+    /**
235
+     * The PrimaShop adapter.
236
+     *
237
+     * @since  3.2.3
238
+     * @access private
239
+     * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
240
+     */
241
+    private $primashop_adapter;
242
+
243
+    /**
244
+     * The WordLift Dashboard adapter.
245
+     *
246
+     * @since  3.4.0
247
+     * @access private
248
+     * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
249
+     */
250
+    private $dashboard_service;
251
+
252
+    /**
253
+     * The entity type service.
254
+     *
255
+     * @since  3.6.0
256
+     * @access private
257
+     * @var \Wordlift_Entity_Post_Type_Service
258
+     */
259
+    private $entity_post_type_service;
260
+
261
+    /**
262
+     * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
263
+     *
264
+     * @since  3.6.0
265
+     * @access private
266
+     * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance.
267
+     */
268
+    private $entity_link_service;
269
+
270
+    /**
271
+     * A {@link Wordlift_Sparql_Service} instance.
272
+     *
273
+     * @since    3.6.0
274
+     * @access   protected
275
+     * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
276
+     */
277
+    protected $sparql_service;
278
+
279
+    /**
280
+     * A {@link Wordlift_Import_Service} instance.
281
+     *
282
+     * @since  3.6.0
283
+     * @access private
284
+     * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
285
+     */
286
+    private $import_service;
287
+
288
+    /**
289
+     * A {@link Wordlift_Rebuild_Service} instance.
290
+     *
291
+     * @since  3.6.0
292
+     * @access private
293
+     * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
294
+     */
295
+    private $rebuild_service;
296
+
297
+    /**
298
+     * A {@link Wordlift_Jsonld_Service} instance.
299
+     *
300
+     * @since  3.7.0
301
+     * @access protected
302
+     * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
303
+     */
304
+    protected $jsonld_service;
305
+
306
+    /**
307
+     * A {@link Wordlift_Website_Jsonld_Converter} instance.
308
+     *
309
+     * @since  3.14.0
310
+     * @access protected
311
+     * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance.
312
+     */
313
+    protected $jsonld_website_converter;
314
+
315
+    /**
316
+     * A {@link Wordlift_Property_Factory} instance.
317
+     *
318
+     * @since  3.7.0
319
+     * @access private
320
+     * @var \Wordlift_Property_Factory $property_factory
321
+     */
322
+    private $property_factory;
323
+
324
+    /**
325
+     * The 'Download Your Data' page.
326
+     *
327
+     * @since  3.6.0
328
+     * @access private
329
+     * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
330
+     */
331
+    private $download_your_data_page;
332
+
333
+    /**
334
+     * The 'WordLift Settings' page.
335
+     *
336
+     * @since  3.11.0
337
+     * @access protected
338
+     * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
339
+     */
340
+    protected $settings_page;
341
+
342
+    /**
343
+     * The install wizard page.
344
+     *
345
+     * @since  3.9.0
346
+     * @access private
347
+     * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
348
+     */
349
+    public $admin_setup;
350
+
351
+    /**
352
+     * The Content Filter Service hooks up to the 'the_content' filter and provides
353
+     * linking of entities to their pages.
354
+     *
355
+     * @since  3.8.0
356
+     * @access private
357
+     * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
358
+     */
359
+    private $content_filter_service;
360
+
361
+    /**
362
+     * The Faq Content filter service
363
+     * @since  3.26.0
364
+     * @access private
365
+     * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance.
366
+     */
367
+    private $faq_content_filter_service;
368
+
369
+    /**
370
+     * A {@link Wordlift_Key_Validation_Service} instance.
371
+     *
372
+     * @since  3.9.0
373
+     * @access private
374
+     * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
375
+     */
376
+    private $key_validation_service;
377
+
378
+    /**
379
+     * A {@link Wordlift_Rating_Service} instance.
380
+     *
381
+     * @since  3.10.0
382
+     * @access private
383
+     * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
384
+     */
385
+    private $rating_service;
386
+
387
+    /**
388
+     * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
389
+     *
390
+     * @since  3.10.0
391
+     * @access protected
392
+     * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
393
+     */
394
+    protected $post_to_jsonld_converter;
395
+
396
+    /**
397
+     * A {@link Wordlift_Configuration_Service} instance.
398
+     *
399
+     * @since  3.10.0
400
+     * @access protected
401
+     * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
402
+     */
403
+    protected $configuration_service;
404
+
405
+    /**
406
+     * A {@link Wordlift_Install_Service} instance.
407
+     *
408
+     * @since  3.18.0
409
+     * @access protected
410
+     * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance.
411
+     */
412
+    protected $install_service;
413
+
414
+    /**
415
+     * A {@link Wordlift_Entity_Type_Service} instance.
416
+     *
417
+     * @since  3.10.0
418
+     * @access protected
419
+     * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
420
+     */
421
+    protected $entity_type_service;
422
+
423
+    /**
424
+     * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
425
+     *
426
+     * @since  3.10.0
427
+     * @access protected
428
+     * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
429
+     */
430
+    protected $entity_post_to_jsonld_converter;
431
+
432
+    /**
433
+     * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
434
+     *
435
+     * @since  3.10.0
436
+     * @access protected
437
+     * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
438
+     */
439
+    protected $postid_to_jsonld_converter;
440
+
441
+    /**
442
+     * The {@link Wordlift_Admin_Status_Page} class.
443
+     *
444
+     * @since  3.9.8
445
+     * @access private
446
+     * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
447
+     */
448
+    private $status_page;
449
+
450
+    /**
451
+     * The {@link Wordlift_Category_Taxonomy_Service} instance.
452
+     *
453
+     * @since  3.11.0
454
+     * @access protected
455
+     * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
456
+     */
457
+    protected $category_taxonomy_service;
458
+
459
+    /**
460
+     * The {@link Wordlift_Entity_Page_Service} instance.
461
+     *
462
+     * @since  3.11.0
463
+     * @access protected
464
+     * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance.
465
+     */
466
+    protected $entity_page_service;
467
+
468
+    /**
469
+     * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
470
+     *
471
+     * @since  3.11.0
472
+     * @access protected
473
+     * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
474
+     */
475
+    protected $settings_page_action_link;
476
+
477
+    /**
478
+     * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
479
+     *
480
+     * @since  3.11.0
481
+     * @access protected
482
+     * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
483
+     */
484
+    protected $analytics_settings_page_action_link;
485
+
486
+    /**
487
+     * The {@link Wordlift_Analytics_Connect} class.
488
+     *
489
+     * @since  3.11.0
490
+     * @access protected
491
+     * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class.
492
+     */
493
+    protected $analytics_connect;
494
+
495
+    /**
496
+     * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
497
+     *
498
+     * @since  3.11.0
499
+     * @access protected
500
+     * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
501
+     */
502
+    protected $publisher_ajax_adapter;
503
+
504
+    /**
505
+     * The {@link Wordlift_Admin_Input_Element} element renderer.
506
+     *
507
+     * @since  3.11.0
508
+     * @access protected
509
+     * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
510
+     */
511
+    protected $input_element;
512
+
513
+    /**
514
+     * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
515
+     *
516
+     * @since  3.13.0
517
+     * @access protected
518
+     * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
519
+     */
520
+    protected $radio_input_element;
521
+
522
+    /**
523
+     * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
524
+     *
525
+     * @since  3.11.0
526
+     * @access protected
527
+     * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
528
+     */
529
+    protected $language_select_element;
530
+
531
+    /**
532
+     * The {@link Wordlift_Admin_Country_Select_Element} element renderer.
533
+     *
534
+     * @since  3.18.0
535
+     * @access protected
536
+     * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer.
537
+     */
538
+    protected $country_select_element;
539
+
540
+    /**
541
+     * The {@link Wordlift_Admin_Publisher_Element} element renderer.
542
+     *
543
+     * @since  3.11.0
544
+     * @access protected
545
+     * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
546
+     */
547
+    protected $publisher_element;
548
+
549
+    /**
550
+     * The {@link Wordlift_Admin_Select2_Element} element renderer.
551
+     *
552
+     * @since  3.11.0
553
+     * @access protected
554
+     * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
555
+     */
556
+    protected $select2_element;
557
+
558
+    /**
559
+     * The controller for the entity type list admin page
560
+     *
561
+     * @since  3.11.0
562
+     * @access private
563
+     * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
564
+     */
565
+    private $entity_type_admin_page;
566
+
567
+    /**
568
+     * The controller for the entity type settings admin page
569
+     *
570
+     * @since  3.11.0
571
+     * @access private
572
+     * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
573
+     */
574
+    private $entity_type_settings_admin_page;
575
+
576
+    /**
577
+     * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
578
+     *
579
+     * @since  3.11.0
580
+     * @access protected
581
+     * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
582
+     */
583
+    protected $related_entities_cloud_widget;
584
+
585
+    /**
586
+     * The {@link Wordlift_Admin_Author_Element} instance.
587
+     *
588
+     * @since  3.14.0
589
+     * @access protected
590
+     * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
591
+     */
592
+    protected $author_element;
593
+
594
+    /**
595
+     * The {@link Wordlift_Sample_Data_Service} instance.
596
+     *
597
+     * @since  3.12.0
598
+     * @access protected
599
+     * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
600
+     */
601
+    protected $sample_data_service;
602
+
603
+    /**
604
+     * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
605
+     *
606
+     * @since  3.12.0
607
+     * @access protected
608
+     * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
609
+     */
610
+    protected $sample_data_ajax_adapter;
611
+
612
+    /**
613
+     * The {@link Wordlift_Relation_Rebuild_Service} instance.
614
+     *
615
+     * @since  3.14.3
616
+     * @access private
617
+     * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance.
618
+     */
619
+    private $relation_rebuild_service;
620
+
621
+    /**
622
+     * The {@link Wordlift_Relation_Rebuild_Adapter} instance.
623
+     *
624
+     * @since  3.14.3
625
+     * @access private
626
+     * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance.
627
+     */
628
+    private $relation_rebuild_adapter;
629
+
630
+    /**
631
+     * The {@link Wordlift_Reference_Rebuild_Service} instance.
632
+     *
633
+     * @since  3.18.0
634
+     * @access private
635
+     * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance.
636
+     */
637
+    private $reference_rebuild_service;
638
+
639
+    /**
640
+     * The {@link Wordlift_Google_Analytics_Export_Service} instance.
641
+     *
642
+     * @since  3.16.0
643
+     * @access protected
644
+     * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance.
645
+     */
646
+    protected $google_analytics_export_service;
647
+
648
+    /**
649
+     * {@link Wordlift}'s singleton instance.
650
+     *
651
+     * @since  3.15.0
652
+     * @access protected
653
+     * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance.
654
+     */
655
+    protected $entity_type_adapter;
656
+
657
+    /**
658
+     * The {@link Wordlift_Storage_Factory} instance.
659
+     *
660
+     * @since  3.15.0
661
+     * @access protected
662
+     * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance.
663
+     */
664
+    protected $storage_factory;
665
+
666
+    /**
667
+     * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
668
+     *
669
+     * @since  3.15.0
670
+     * @access protected
671
+     * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
672
+     */
673
+    protected $rendition_factory;
674
+
675
+    /**
676
+     * The {@link Wordlift_Autocomplete_Adapter} instance.
677
+     *
678
+     * @since  3.15.0
679
+     * @access private
680
+     * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance.
681
+     */
682
+    private $autocomplete_adapter;
683
+
684
+    /**
685
+     * The {@link Wordlift_Relation_Service} instance.
686
+     *
687
+     * @since  3.15.0
688
+     * @access protected
689
+     * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
690
+     */
691
+    protected $relation_service;
692
+
693
+    /**
694
+     * The {@link Wordlift_Cached_Post_Converter} instance.
695
+     *
696
+     * @since  3.16.0
697
+     * @access protected
698
+     * @var  \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance.
699
+     *
700
+     */
701
+    protected $cached_postid_to_jsonld_converter;
702
+
703
+    /**
704
+     * The {@link Wordlift_Entity_Uri_Service} instance.
705
+     *
706
+     * @since  3.16.3
707
+     * @access protected
708
+     * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
709
+     */
710
+    protected $entity_uri_service;
711
+
712
+    /**
713
+     * The {@link Wordlift_Publisher_Service} instance.
714
+     *
715
+     * @since  3.19.0
716
+     * @access protected
717
+     * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
718
+     */
719
+    protected $publisher_service;
720
+
721
+    /**
722
+     * The {@link Wordlift_Context_Cards_Service} instance.
723
+     *
724
+     * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance.
725
+     */
726
+    protected $context_cards_service;
727
+
728
+    /**
729
+     * {@link Wordlift}'s singleton instance.
730
+     *
731
+     * @since  3.11.2
732
+     * @access private
733
+     * @var Wordlift $instance {@link Wordlift}'s singleton instance.
734
+     */
735
+    private static $instance;
736
+
737
+    //</editor-fold>
738
+
739
+    /**
740
+     * Define the core functionality of the plugin.
741
+     *
742
+     * Set the plugin name and the plugin version that can be used throughout the plugin.
743
+     * Load the dependencies, define the locale, and set the hooks for the admin area and
744
+     * the public-facing side of the site.
745
+     *
746
+     * @since    1.0.0
747
+     */
748
+    public function __construct() {
749
+
750
+        self::$instance = $this;
751
+
752
+        $this->plugin_name = 'wordlift';
753
+        $this->version     = '3.27.7.2';
754
+        $this->load_dependencies();
755
+        $this->set_locale();
756
+        $this->define_admin_hooks();
757
+        $this->define_public_hooks();
758
+
759
+        // If we're in `WP_CLI` load the related files.
760
+        if ( class_exists( 'WP_CLI' ) ) {
761
+            $this->load_cli_dependencies();
762
+        }
763
+
764
+    }
765
+
766
+    /**
767
+     * Get the singleton instance.
768
+     *
769
+     * @return Wordlift The {@link Wordlift} singleton instance.
770
+     * @since 3.11.2
771
+     *
772
+     */
773
+    public static function get_instance() {
774
+
775
+        return self::$instance;
776
+    }
777
+
778
+    /**
779
+     * Load the required dependencies for this plugin.
780
+     *
781
+     * Include the following files that make up the plugin:
782
+     *
783
+     * - Wordlift_Loader. Orchestrates the hooks of the plugin.
784
+     * - Wordlift_i18n. Defines internationalization functionality.
785
+     * - Wordlift_Admin. Defines all hooks for the admin area.
786
+     * - Wordlift_Public. Defines all hooks for the public side of the site.
787
+     *
788
+     * Create an instance of the loader which will be used to register the hooks
789
+     * with WordPress.
790
+     *
791
+     * @throws Exception
792
+     * @since    1.0.0
793
+     * @access   private
794
+     */
795
+    private function load_dependencies() {
796
+
797
+        /**
798
+         * The class responsible for orchestrating the actions and filters of the
799
+         * core plugin.
800
+         */
801
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
802
+
803
+        // The class responsible for plugin uninstall.
804
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php';
805
+
806
+        /**
807
+         * The class responsible for defining internationalization functionality
808
+         * of the plugin.
809
+         */
810
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
811
+
812
+        /**
813
+         * WordLift's supported languages.
814
+         */
815
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
816
+
817
+        /**
818
+         * WordLift's supported countries.
819
+         */
820
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php';
821
+
822
+        /**
823
+         * Provide support functions to sanitize data.
824
+         */
825
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
826
+
827
+        /** Services. */
828
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
829
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
830
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
831
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
832
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
833
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
834
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
835
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
836
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
837
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php';
838
+
839
+        /**
840
+         * The Query builder.
841
+         */
842
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
843
+
844
+        /**
845
+         * The Schema service.
846
+         */
847
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
848
+
849
+        /**
850
+         * The schema:url property service.
851
+         */
852
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
853
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
854
+
855
+        /**
856
+         * The UI service.
857
+         */
858
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
859
+
860
+        /**
861
+         * The Thumbnail service.
862
+         */
863
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
864
+
865
+        /**
866
+         * The Entity Types Taxonomy service.
867
+         */
868
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
869
+
870
+        /**
871
+         * The Entity service.
872
+         */
873
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
874
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
875
+
876
+        // Add the entity rating service.
877
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
878
+
879
+        /**
880
+         * The User service.
881
+         */
882
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
883
+
884
+        /**
885
+         * The Timeline service.
886
+         */
887
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
888
+
889
+        /**
890
+         * The Topic Taxonomy service.
891
+         */
892
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
893
+
894
+        /**
895
+         * The SPARQL service.
896
+         */
897
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
898
+
899
+        /**
900
+         * The WordLift import service.
901
+         */
902
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
903
+
904
+        /**
905
+         * The WordLift URI service.
906
+         */
907
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
908
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
909
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
910
+
911
+        /**
912
+         * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
913
+         */
914
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php';
915
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php';
916
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php';
917
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php';
918
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
919
+
920
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
921
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
922
+
923
+        /**
924
+         * Load the converters.
925
+         */
926
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
927
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
928
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
929
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
930
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
931
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
932
+
933
+        /**
934
+         * Load cache-related files.
935
+         */
936
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
937
+
938
+        /**
939
+         * Load the content filter.
940
+         */
941
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
942
+
943
+        /*
944 944
 		 * Load the excerpt helper.
945 945
 		 */
946
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
947
-
948
-		/**
949
-		 * Load the JSON-LD service to publish entities using JSON-LD.s
950
-		 *
951
-		 * @since 3.8.0
952
-		 */
953
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
954
-
955
-		// The Publisher Service and the AJAX adapter.
956
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
957
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
958
-
959
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
960
-
961
-		/**
962
-		 * Load the WordLift key validation service.
963
-		 */
964
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
965
-
966
-		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
967
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
968
-
969
-		// Load the `Wordlift_Entity_Page_Service` class definition.
970
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
971
-
972
-		/** Linked Data. */
973
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
974
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
975
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
976
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
977
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
978
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
979
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
980
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
981
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
982
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
983
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
984
-
985
-		/** Linked Data Rendition. */
986
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
987
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
988
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
989
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
990
-
991
-		/** Services. */
992
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
993
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php';
994
-
995
-		/** Adapters. */
996
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
997
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
998
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
999
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
1000
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php';
1001
-
1002
-		/** Async Tasks. */
1003
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
1004
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
1005
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php';
1006
-
1007
-		/** Autocomplete. */
1008
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
1009
-
1010
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
1011
-
1012
-		/** Analytics */
1013
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php';
1014
-
1015
-		/**
1016
-		 * The class responsible for defining all actions that occur in the admin area.
1017
-		 */
1018
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
1019
-
1020
-		/**
1021
-		 * The class to customize the entity list admin page.
1022
-		 */
1023
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
1024
-
1025
-		/**
1026
-		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
1027
-		 */
1028
-		global $wp_version;
1029
-		if ( version_compare( $wp_version, '5.3', '<' ) ) {
1030
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
1031
-		} else {
1032
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php';
1033
-		}
1034
-
1035
-		/**
1036
-		 * The Notice service.
1037
-		 */
1038
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
1039
-
1040
-		/**
1041
-		 * The PrimaShop adapter.
1042
-		 */
1043
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
1044
-
1045
-		/**
1046
-		 * The WordLift Dashboard service.
1047
-		 */
1048
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
1049
-
1050
-		/**
1051
-		 * The admin 'Install wizard' page.
1052
-		 */
1053
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
1054
-
1055
-		/**
1056
-		 * The WordLift entity type list admin page controller.
1057
-		 */
1058
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1059
-
1060
-		/**
1061
-		 * The WordLift entity type settings admin page controller.
1062
-		 */
1063
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
1064
-
1065
-		/**
1066
-		 * The admin 'Download Your Data' page.
1067
-		 */
1068
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
1069
-
1070
-		/**
1071
-		 * The admin 'WordLift Settings' page.
1072
-		 */
1073
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php';
1074
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php';
1075
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php';
1076
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php';
1077
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php';
1078
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php';
1079
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php';
1080
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php';
1081
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php';
1082
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php';
1083
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
1084
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
1085
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php';
1086
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
1087
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php';
1088
-
1089
-		/** Admin Pages */
1090
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
1091
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
1092
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php';
1093
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
1094
-
1095
-		/**
1096
-		 * The class responsible for defining all actions that occur in the public-facing
1097
-		 * side of the site.
1098
-		 */
1099
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1100
-
1101
-		/**
1102
-		 * The shortcode abstract class.
1103
-		 */
1104
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1105
-
1106
-		/**
1107
-		 * The Timeline shortcode.
1108
-		 */
1109
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1110
-
1111
-		/**
1112
-		 * The Navigator shortcode.
1113
-		 */
1114
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1115
-
1116
-		/**
1117
-		 * The Products Navigator shortcode.
1118
-		 */
1119
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php';
1120
-
1121
-		/**
1122
-		 * The chord shortcode.
1123
-		 */
1124
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1125
-
1126
-		/**
1127
-		 * The geomap shortcode.
1128
-		 */
1129
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1130
-
1131
-		/**
1132
-		 * The entity cloud shortcode.
1133
-		 */
1134
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1135
-
1136
-		/**
1137
-		 * The entity glossary shortcode.
1138
-		 */
1139
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1140
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1141
-
1142
-		/**
1143
-		 * Faceted Search shortcode.
1144
-		 */
1145
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php';
1146
-
1147
-		/**
1148
-		 * The ShareThis service.
1149
-		 */
1150
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1151
-
1152
-		/**
1153
-		 * The SEO service.
1154
-		 */
1155
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1156
-
1157
-		/**
1158
-		 * The AMP service.
1159
-		 */
1160
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1161
-
1162
-		/** Widgets */
1163
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1164
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1165
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php';
1166
-
1167
-		/*
946
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
947
+
948
+        /**
949
+         * Load the JSON-LD service to publish entities using JSON-LD.s
950
+         *
951
+         * @since 3.8.0
952
+         */
953
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
954
+
955
+        // The Publisher Service and the AJAX adapter.
956
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
957
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
958
+
959
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
960
+
961
+        /**
962
+         * Load the WordLift key validation service.
963
+         */
964
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
965
+
966
+        // Load the `Wordlift_Category_Taxonomy_Service` class definition.
967
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
968
+
969
+        // Load the `Wordlift_Entity_Page_Service` class definition.
970
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
971
+
972
+        /** Linked Data. */
973
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
974
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
975
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
976
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
977
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
978
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
979
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
980
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
981
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
982
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
983
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
984
+
985
+        /** Linked Data Rendition. */
986
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
987
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
988
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
989
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
990
+
991
+        /** Services. */
992
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
993
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php';
994
+
995
+        /** Adapters. */
996
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
997
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
998
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
999
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
1000
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php';
1001
+
1002
+        /** Async Tasks. */
1003
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
1004
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
1005
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php';
1006
+
1007
+        /** Autocomplete. */
1008
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
1009
+
1010
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
1011
+
1012
+        /** Analytics */
1013
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php';
1014
+
1015
+        /**
1016
+         * The class responsible for defining all actions that occur in the admin area.
1017
+         */
1018
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
1019
+
1020
+        /**
1021
+         * The class to customize the entity list admin page.
1022
+         */
1023
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
1024
+
1025
+        /**
1026
+         * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
1027
+         */
1028
+        global $wp_version;
1029
+        if ( version_compare( $wp_version, '5.3', '<' ) ) {
1030
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
1031
+        } else {
1032
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php';
1033
+        }
1034
+
1035
+        /**
1036
+         * The Notice service.
1037
+         */
1038
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
1039
+
1040
+        /**
1041
+         * The PrimaShop adapter.
1042
+         */
1043
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
1044
+
1045
+        /**
1046
+         * The WordLift Dashboard service.
1047
+         */
1048
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
1049
+
1050
+        /**
1051
+         * The admin 'Install wizard' page.
1052
+         */
1053
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
1054
+
1055
+        /**
1056
+         * The WordLift entity type list admin page controller.
1057
+         */
1058
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1059
+
1060
+        /**
1061
+         * The WordLift entity type settings admin page controller.
1062
+         */
1063
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
1064
+
1065
+        /**
1066
+         * The admin 'Download Your Data' page.
1067
+         */
1068
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
1069
+
1070
+        /**
1071
+         * The admin 'WordLift Settings' page.
1072
+         */
1073
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php';
1074
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php';
1075
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php';
1076
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php';
1077
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php';
1078
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php';
1079
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php';
1080
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php';
1081
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php';
1082
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php';
1083
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
1084
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
1085
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php';
1086
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
1087
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php';
1088
+
1089
+        /** Admin Pages */
1090
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
1091
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
1092
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php';
1093
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
1094
+
1095
+        /**
1096
+         * The class responsible for defining all actions that occur in the public-facing
1097
+         * side of the site.
1098
+         */
1099
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1100
+
1101
+        /**
1102
+         * The shortcode abstract class.
1103
+         */
1104
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1105
+
1106
+        /**
1107
+         * The Timeline shortcode.
1108
+         */
1109
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1110
+
1111
+        /**
1112
+         * The Navigator shortcode.
1113
+         */
1114
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1115
+
1116
+        /**
1117
+         * The Products Navigator shortcode.
1118
+         */
1119
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php';
1120
+
1121
+        /**
1122
+         * The chord shortcode.
1123
+         */
1124
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1125
+
1126
+        /**
1127
+         * The geomap shortcode.
1128
+         */
1129
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1130
+
1131
+        /**
1132
+         * The entity cloud shortcode.
1133
+         */
1134
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1135
+
1136
+        /**
1137
+         * The entity glossary shortcode.
1138
+         */
1139
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1140
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1141
+
1142
+        /**
1143
+         * Faceted Search shortcode.
1144
+         */
1145
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php';
1146
+
1147
+        /**
1148
+         * The ShareThis service.
1149
+         */
1150
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1151
+
1152
+        /**
1153
+         * The SEO service.
1154
+         */
1155
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1156
+
1157
+        /**
1158
+         * The AMP service.
1159
+         */
1160
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1161
+
1162
+        /** Widgets */
1163
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1164
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1165
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php';
1166
+
1167
+        /*
1168 1168
 		 * Schema.org Services.
1169 1169
 		 *
1170 1170
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1171 1171
 		 */
1172
-		if ( WL_ALL_ENTITY_TYPES ) {
1173
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php';
1174
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php';
1175
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php';
1176
-			new Wordlift_Schemaorg_Sync_Service();
1177
-			$schemaorg_property_service = new Wordlift_Schemaorg_Property_Service();
1178
-			new Wordlift_Schemaorg_Class_Service();
1179
-		} else {
1180
-			$schemaorg_property_service = null;
1181
-		}
1172
+        if ( WL_ALL_ENTITY_TYPES ) {
1173
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php';
1174
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php';
1175
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php';
1176
+            new Wordlift_Schemaorg_Sync_Service();
1177
+            $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service();
1178
+            new Wordlift_Schemaorg_Class_Service();
1179
+        } else {
1180
+            $schemaorg_property_service = null;
1181
+        }
1182 1182
 
1183
-		$this->loader = new Wordlift_Loader();
1183
+        $this->loader = new Wordlift_Loader();
1184 1184
 
1185
-		// Instantiate a global logger.
1186
-		global $wl_logger;
1187
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1185
+        // Instantiate a global logger.
1186
+        global $wl_logger;
1187
+        $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1188 1188
 
1189
-		// Load the `wl-api` end-point.
1190
-		new Wordlift_Http_Api();
1189
+        // Load the `wl-api` end-point.
1190
+        new Wordlift_Http_Api();
1191 1191
 
1192
-		// Load the Install Service.
1193
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
1194
-		$this->install_service = new Wordlift_Install_Service();
1192
+        // Load the Install Service.
1193
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
1194
+        $this->install_service = new Wordlift_Install_Service();
1195 1195
 
1196
-		/** Services. */
1197
-		// Create the configuration service.
1198
-		$this->configuration_service = new Wordlift_Configuration_Service();
1199
-		$api_service                 = new Wordlift_Api_Service( $this->configuration_service );
1196
+        /** Services. */
1197
+        // Create the configuration service.
1198
+        $this->configuration_service = new Wordlift_Configuration_Service();
1199
+        $api_service                 = new Wordlift_Api_Service( $this->configuration_service );
1200 1200
 
1201
-		// Create an entity type service instance. It'll be later bound to the init action.
1202
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1201
+        // Create an entity type service instance. It'll be later bound to the init action.
1202
+        $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1203 1203
 
1204
-		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1205
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1204
+        // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1205
+        $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1206 1206
 
1207
-		// Create an instance of the UI service.
1208
-		$this->ui_service = new Wordlift_UI_Service();
1207
+        // Create an instance of the UI service.
1208
+        $this->ui_service = new Wordlift_UI_Service();
1209 1209
 
1210
-		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
1211
-		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
1210
+        // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
1211
+        $this->thumbnail_service = new Wordlift_Thumbnail_Service();
1212 1212
 
1213
-		$this->sparql_service        = new Wordlift_Sparql_Service();
1214
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1215
-		$this->notice_service        = new Wordlift_Notice_Service();
1216
-		$this->relation_service      = new Wordlift_Relation_Service();
1213
+        $this->sparql_service        = new Wordlift_Sparql_Service();
1214
+        $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1215
+        $this->notice_service        = new Wordlift_Notice_Service();
1216
+        $this->relation_service      = new Wordlift_Relation_Service();
1217 1217
 
1218
-		$entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1219
-		$this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1220
-		$this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1221
-		$this->user_service       = new Wordlift_User_Service( $this->sparql_service, $this->entity_service );
1218
+        $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1219
+        $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1220
+        $this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1221
+        $this->user_service       = new Wordlift_User_Service( $this->sparql_service, $this->entity_service );
1222 1222
 
1223
-		// Instantiate the JSON-LD service.
1224
-		$property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1223
+        // Instantiate the JSON-LD service.
1224
+        $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1225 1225
 
1226
-		/** Linked Data. */
1227
-		$this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1228
-		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1226
+        /** Linked Data. */
1227
+        $this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1228
+        $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1229 1229
 
1230
-		$this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1230
+        $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1231 1231
 
1232
-		// Create a new instance of the Redirect service.
1233
-		$this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_uri_service );
1234
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1232
+        // Create a new instance of the Redirect service.
1233
+        $this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_uri_service );
1234
+        $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1235 1235
 
1236
-		if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) {
1237
-			new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service );
1238
-		}
1236
+        if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) {
1237
+            new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service );
1238
+        }
1239 1239
 
1240
-		// Create a new instance of the Timeline service and Timeline shortcode.
1241
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1240
+        // Create a new instance of the Timeline service and Timeline shortcode.
1241
+        $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1242 1242
 
1243
-		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1243
+        $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1244 1244
 
1245
-		$this->topic_taxonomy_service        = new Wordlift_Topic_Taxonomy_Service();
1246
-		$this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service();
1245
+        $this->topic_taxonomy_service        = new Wordlift_Topic_Taxonomy_Service();
1246
+        $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service();
1247 1247
 
1248
-		// Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1249
-		$this->sharethis_service = new Wordlift_ShareThis_Service();
1248
+        // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1249
+        $this->sharethis_service = new Wordlift_ShareThis_Service();
1250 1250
 
1251
-		// Create an instance of the PrimaShop adapter.
1252
-		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1251
+        // Create an instance of the PrimaShop adapter.
1252
+        $this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1253 1253
 
1254
-		// Create an import service instance to hook later to WP's import function.
1255
-		$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() );
1254
+        // Create an import service instance to hook later to WP's import function.
1255
+        $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() );
1256 1256
 
1257
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1257
+        $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1258 1258
 
1259
-		// Create the entity rating service.
1260
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1259
+        // Create the entity rating service.
1260
+        $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1261 1261
 
1262
-		// Create entity list customization (wp-admin/edit.php).
1263
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1262
+        // Create entity list customization (wp-admin/edit.php).
1263
+        $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1264 1264
 
1265
-		// Create a new instance of the Redirect service.
1266
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1265
+        // Create a new instance of the Redirect service.
1266
+        $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1267 1267
 
1268
-		// Create an instance of the Publisher Service and the AJAX Adapter.
1269
-		$this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service );
1270
-		$this->property_factory  = new Wordlift_Property_Factory( $schema_url_property_service );
1271
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1268
+        // Create an instance of the Publisher Service and the AJAX Adapter.
1269
+        $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service );
1270
+        $this->property_factory  = new Wordlift_Property_Factory( $schema_url_property_service );
1271
+        $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1272 1272
 
1273
-		$attachment_service = new Wordlift_Attachment_Service();
1273
+        $attachment_service = new Wordlift_Attachment_Service();
1274 1274
 
1275
-		// Instantiate the JSON-LD service.
1276
-		$property_getter                       = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1277
-		$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 );
1278
-		$this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $this->post_to_jsonld_converter );
1279
-		$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 );
1280
-		$this->jsonld_website_converter        = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1275
+        // Instantiate the JSON-LD service.
1276
+        $property_getter                       = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1277
+        $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 );
1278
+        $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $this->post_to_jsonld_converter );
1279
+        $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 );
1280
+        $this->jsonld_website_converter        = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1281 1281
 
1282
-		$jsonld_cache                            = new Ttl_Cache( 'jsonld', 86400 );
1283
-		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache );
1284
-		$this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1282
+        $jsonld_cache                            = new Ttl_Cache( 'jsonld', 86400 );
1283
+        $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache );
1284
+        $this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1285 1285
 
1286
-		/*
1286
+        /*
1287 1287
 		 * Load the `Wordlift_Term_JsonLd_Adapter`.
1288 1288
 		 *
1289 1289
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/892
1290 1290
 		 *
1291 1291
 		 * @since 3.20.0
1292 1292
 		 */
1293
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php';
1294
-		$term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service );
1295
-		$jsonld_service      = new Jsonld_Service(
1296
-			$this->jsonld_service,
1297
-			$term_jsonld_adapter,
1298
-			new Jsonld_User_Service( $this->user_service ) );
1299
-		new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service );
1300
-
1301
-		// Prints the JSON-LD in the head.
1302
-		new Jsonld_Adapter( $this->jsonld_service );
1303
-
1304
-		new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service );
1305
-
1306
-		$this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service );
1307
-		$this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1308
-		// Creating Faq Content filter service.
1309
-		$this->faq_content_filter_service = new Faq_Content_Filter();
1310
-		$this->relation_rebuild_service   = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1311
-		$this->sample_data_service        = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1312
-		$this->sample_data_ajax_adapter   = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1313
-		$this->reference_rebuild_service  = new Wordlift_Reference_Rebuild_Service( $this->entity_service );
1314
-
1315
-		$this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' );
1316
-
1317
-		/**
1318
-		 * Filter: wl_feature__enable__blocks.
1319
-		 *
1320
-		 * @param bool whether the blocks needed to be registered, defaults to true.
1321
-		 *
1322
-		 * @return bool
1323
-		 * @since 3.27.6
1324
-		 */
1325
-		if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
1326
-			// Initialize the short-codes.
1327
-			new Wordlift_Navigator_Shortcode();
1328
-			new Wordlift_Chord_Shortcode();
1329
-			new Wordlift_Geomap_Shortcode();
1330
-			new Wordlift_Timeline_Shortcode();
1331
-			new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1332
-			new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1333
-			new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() );
1334
-		}
1335
-
1336
-		new Wordlift_Products_Navigator_Shortcode();
1337
-
1338
-
1339
-		// Initialize the Context Cards Service
1340
-		$this->context_cards_service = new Wordlift_Context_Cards_Service();
1341
-
1342
-		// Initialize the SEO service.
1343
-		new Wordlift_Seo_Service();
1344
-
1345
-		// Initialize the AMP service.
1346
-		new Wordlift_AMP_Service( $this->jsonld_service );
1347
-
1348
-		/** Services. */
1349
-		$this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1350
-		new Wordlift_Image_Service();
1351
-
1352
-		/** Adapters. */
1353
-		$this->entity_type_adapter    = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1354
-		$this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service );
1355
-		$this->tinymce_adapter        = new Wordlift_Tinymce_Adapter( $this );
1356
-		//$this->faq_tinymce_adapter      = new Faq_Tinymce_Adapter();
1357
-		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1358
-
1359
-		/*
1293
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php';
1294
+        $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service );
1295
+        $jsonld_service      = new Jsonld_Service(
1296
+            $this->jsonld_service,
1297
+            $term_jsonld_adapter,
1298
+            new Jsonld_User_Service( $this->user_service ) );
1299
+        new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service );
1300
+
1301
+        // Prints the JSON-LD in the head.
1302
+        new Jsonld_Adapter( $this->jsonld_service );
1303
+
1304
+        new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service );
1305
+
1306
+        $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service );
1307
+        $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1308
+        // Creating Faq Content filter service.
1309
+        $this->faq_content_filter_service = new Faq_Content_Filter();
1310
+        $this->relation_rebuild_service   = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1311
+        $this->sample_data_service        = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1312
+        $this->sample_data_ajax_adapter   = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1313
+        $this->reference_rebuild_service  = new Wordlift_Reference_Rebuild_Service( $this->entity_service );
1314
+
1315
+        $this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' );
1316
+
1317
+        /**
1318
+         * Filter: wl_feature__enable__blocks.
1319
+         *
1320
+         * @param bool whether the blocks needed to be registered, defaults to true.
1321
+         *
1322
+         * @return bool
1323
+         * @since 3.27.6
1324
+         */
1325
+        if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
1326
+            // Initialize the short-codes.
1327
+            new Wordlift_Navigator_Shortcode();
1328
+            new Wordlift_Chord_Shortcode();
1329
+            new Wordlift_Geomap_Shortcode();
1330
+            new Wordlift_Timeline_Shortcode();
1331
+            new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1332
+            new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1333
+            new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() );
1334
+        }
1335
+
1336
+        new Wordlift_Products_Navigator_Shortcode();
1337
+
1338
+
1339
+        // Initialize the Context Cards Service
1340
+        $this->context_cards_service = new Wordlift_Context_Cards_Service();
1341
+
1342
+        // Initialize the SEO service.
1343
+        new Wordlift_Seo_Service();
1344
+
1345
+        // Initialize the AMP service.
1346
+        new Wordlift_AMP_Service( $this->jsonld_service );
1347
+
1348
+        /** Services. */
1349
+        $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1350
+        new Wordlift_Image_Service();
1351
+
1352
+        /** Adapters. */
1353
+        $this->entity_type_adapter    = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1354
+        $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service );
1355
+        $this->tinymce_adapter        = new Wordlift_Tinymce_Adapter( $this );
1356
+        //$this->faq_tinymce_adapter      = new Faq_Tinymce_Adapter();
1357
+        $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1358
+
1359
+        /*
1360 1360
 		 * Exclude our public js from WP-Rocket.
1361 1361
 		 *
1362 1362
 		 * @since 3.19.4
1363 1363
 		 *
1364 1364
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/842.
1365 1365
 		 */
1366
-		new Wordlift_WpRocket_Adapter();
1367
-
1368
-		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
1369
-		$this->rebuild_service = new Wordlift_Rebuild_Service(
1370
-			$this->sparql_service,
1371
-			$uri_service
1372
-		);
1373
-
1374
-		/** Async Tasks. */
1375
-		if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) {
1376
-			new Wordlift_Sparql_Query_Async_Task();
1377
-			new Wordlift_Push_References_Async_Task();
1378
-		}
1379
-
1380
-		/** WordPress Admin UI. */
1381
-
1382
-		// UI elements.
1383
-		$this->input_element           = new Wordlift_Admin_Input_Element();
1384
-		$this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1385
-		$this->select2_element         = new Wordlift_Admin_Select2_Element();
1386
-		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1387
-		$this->country_select_element  = new Wordlift_Admin_Country_Select_Element();
1388
-		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
1389
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element );
1390
-		$this->author_element          = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element );
1391
-
1392
-		$this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element );
1393
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1394
-
1395
-		$this->analytics_settings_page             = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element );
1396
-		$this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page );
1397
-		$this->analytics_connect                   = new Wordlift_Analytics_Connect();
1398
-
1399
-		// Pages.
1400
-		/*
1366
+        new Wordlift_WpRocket_Adapter();
1367
+
1368
+        // Create a Rebuild Service instance, which we'll later bound to an ajax call.
1369
+        $this->rebuild_service = new Wordlift_Rebuild_Service(
1370
+            $this->sparql_service,
1371
+            $uri_service
1372
+        );
1373
+
1374
+        /** Async Tasks. */
1375
+        if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) {
1376
+            new Wordlift_Sparql_Query_Async_Task();
1377
+            new Wordlift_Push_References_Async_Task();
1378
+        }
1379
+
1380
+        /** WordPress Admin UI. */
1381
+
1382
+        // UI elements.
1383
+        $this->input_element           = new Wordlift_Admin_Input_Element();
1384
+        $this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1385
+        $this->select2_element         = new Wordlift_Admin_Select2_Element();
1386
+        $this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1387
+        $this->country_select_element  = new Wordlift_Admin_Country_Select_Element();
1388
+        $tabs_element                  = new Wordlift_Admin_Tabs_Element();
1389
+        $this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element );
1390
+        $this->author_element          = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element );
1391
+
1392
+        $this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element );
1393
+        $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1394
+
1395
+        $this->analytics_settings_page             = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element );
1396
+        $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page );
1397
+        $this->analytics_connect                   = new Wordlift_Analytics_Connect();
1398
+
1399
+        // Pages.
1400
+        /*
1401 1401
 		 * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box.
1402 1402
 		 *
1403 1403
 		 * @since 3.20.3
1404 1404
 		 *
1405 1405
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/914
1406 1406
 		 */
1407
-		if ( apply_filters( 'wl_can_see_classification_box', true ) ) {
1408
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1409
-			new Wordlift_Admin_Post_Edit_Page( $this );
1410
-		}
1411
-		new Wordlift_Entity_Type_Admin_Service();
1407
+        if ( apply_filters( 'wl_can_see_classification_box', true ) ) {
1408
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1409
+            new Wordlift_Admin_Post_Edit_Page( $this );
1410
+        }
1411
+        new Wordlift_Entity_Type_Admin_Service();
1412 1412
 
1413
-		// create an instance of the entity type list admin page controller.
1414
-		$this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1413
+        // create an instance of the entity type list admin page controller.
1414
+        $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1415 1415
 
1416
-		// create an instance of the entity type setting admin page controller.
1417
-		$this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1416
+        // create an instance of the entity type setting admin page controller.
1417
+        $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1418 1418
 
1419
-		/** Widgets */
1420
-		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1419
+        /** Widgets */
1420
+        $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1421 1421
 
1422
-		/* WordPress Admin. */
1423
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1424
-		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1422
+        /* WordPress Admin. */
1423
+        $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1424
+        $this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1425 1425
 
1426
-		// Create an instance of the install wizard.
1427
-		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element );
1426
+        // Create an instance of the install wizard.
1427
+        $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element );
1428 1428
 
1429
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1429
+        $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1430 1430
 
1431
-		// User Profile.
1432
-		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1431
+        // User Profile.
1432
+        new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1433 1433
 
1434
-		$this->entity_page_service = new Wordlift_Entity_Page_Service();
1434
+        $this->entity_page_service = new Wordlift_Entity_Page_Service();
1435 1435
 
1436
-		// Load the debug service if WP is in debug mode.
1437
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1438
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1439
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1440
-		}
1436
+        // Load the debug service if WP is in debug mode.
1437
+        if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1438
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1439
+            new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1440
+        }
1441 1441
 
1442
-		// Remote Image Service.
1443
-		new Wordlift_Remote_Image_Service();
1442
+        // Remote Image Service.
1443
+        new Wordlift_Remote_Image_Service();
1444 1444
 
1445
-		/*
1445
+        /*
1446 1446
 		 * Provides mappings between post types and entity types.
1447 1447
 		 *
1448 1448
 		 * @since 3.20.0
1449 1449
 		 *
1450 1450
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/852.
1451 1451
 		 */
1452
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php';
1453
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php';
1454
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php';
1452
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php';
1453
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php';
1454
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php';
1455 1455
 
1456
-		// Create an instance of the Mapping Service and assign it to the Ajax Adapter.
1457
-		new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) );
1456
+        // Create an instance of the Mapping Service and assign it to the Ajax Adapter.
1457
+        new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) );
1458 1458
 
1459
-		/*
1459
+        /*
1460 1460
 		 * Batch Operations. They're similar to Batch Actions but do not require working on post types.
1461 1461
 		 *
1462 1462
 		 * Eventually Batch Actions will become Batch Operations.
1463 1463
 		 *
1464 1464
 		 * @since 3.20.0
1465 1465
 		 */
1466
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php';
1467
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php';
1466
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php';
1467
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php';
1468 1468
 
1469
-		/*
1469
+        /*
1470 1470
 		 * Add the Search Keywords taxonomy to manage the Search Keywords on WLS.
1471 1471
 		 *
1472 1472
 		 * @link https://github.com/insideout10/wordlift-plugin/issues/761
1473 1473
 		 *
1474 1474
 		 * @since 3.20.0
1475 1475
 		 */
1476
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php';
1477
-		new Wordlift_Search_Keyword_Taxonomy( $api_service );
1476
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php';
1477
+        new Wordlift_Search_Keyword_Taxonomy( $api_service );
1478 1478
 
1479
-		/*
1479
+        /*
1480 1480
 		 * Load the Mappings JSON-LD post processing.
1481 1481
 		 *
1482 1482
 		 * @since 3.25.0
1483 1483
 		 */
1484 1484
 
1485
-		$mappings_dbo           = new Mappings_DBO();
1486
-		$default_rule_validator = new Taxonomy_Rule_Validator();
1487
-		new Post_Type_Rule_Validator();
1488
-		// Taxonomy term rule validator for validating rules for term pages.
1489
-		new Taxonomy_Term_Rule_Validator();
1490
-		$rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator );
1491
-		$rule_groups_validator    = new Rule_Groups_Validator( $rule_validators_registry );
1492
-		$mappings_validator       = new Mappings_Validator( $mappings_dbo, $rule_groups_validator );
1493
-
1494
-		new Url_To_Entity_Transform_Function( $this->entity_uri_service );
1495
-		new Taxonomy_To_Terms_Transform_Function();
1496
-		new Post_Id_To_Entity_Transform_Function();
1497
-		$mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry();
1498
-
1499
-		/**
1500
-		 * @since 3.27.1
1501
-		 * Intiailize the acf group data formatter.
1502
-		 */
1503
-		new Acf_Group_Formatter();
1504
-		new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry );
1505
-
1506
-		/**
1507
-		 * @since 3.26.0
1508
-		 * Initialize the Faq JSON LD converter here - disabled.
1509
-		 */
1510
-		// new Faq_To_Jsonld_Converter();
1511
-		/*
1485
+        $mappings_dbo           = new Mappings_DBO();
1486
+        $default_rule_validator = new Taxonomy_Rule_Validator();
1487
+        new Post_Type_Rule_Validator();
1488
+        // Taxonomy term rule validator for validating rules for term pages.
1489
+        new Taxonomy_Term_Rule_Validator();
1490
+        $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator );
1491
+        $rule_groups_validator    = new Rule_Groups_Validator( $rule_validators_registry );
1492
+        $mappings_validator       = new Mappings_Validator( $mappings_dbo, $rule_groups_validator );
1493
+
1494
+        new Url_To_Entity_Transform_Function( $this->entity_uri_service );
1495
+        new Taxonomy_To_Terms_Transform_Function();
1496
+        new Post_Id_To_Entity_Transform_Function();
1497
+        $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry();
1498
+
1499
+        /**
1500
+         * @since 3.27.1
1501
+         * Intiailize the acf group data formatter.
1502
+         */
1503
+        new Acf_Group_Formatter();
1504
+        new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry );
1505
+
1506
+        /**
1507
+         * @since 3.26.0
1508
+         * Initialize the Faq JSON LD converter here - disabled.
1509
+         */
1510
+        // new Faq_To_Jsonld_Converter();
1511
+        /*
1512 1512
 		 * Use the Templates Ajax Endpoint to load HTML templates for the legacy Angular app via admin-ajax.php
1513 1513
 		 * end-point.
1514 1514
 		 *
1515 1515
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/834
1516 1516
 		 * @since 3.24.4
1517 1517
 		 */
1518
-		new Templates_Ajax_Endpoint();
1519
-		// Call this static method to register FAQ routes to rest api - disabled
1520
-		//Faq_Rest_Controller::register_routes();
1518
+        new Templates_Ajax_Endpoint();
1519
+        // Call this static method to register FAQ routes to rest api - disabled
1520
+        //Faq_Rest_Controller::register_routes();
1521 1521
 
1522
-		/*
1522
+        /*
1523 1523
 		 * Create a singleton for the Analysis_Response_Ops_Factory.
1524 1524
 		 */
1525
-		$entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service );
1526
-		new Analysis_Response_Ops_Factory(
1527
-			$this->entity_uri_service,
1528
-			$this->entity_service,
1529
-			$this->entity_type_service,
1530
-			$this->storage_factory->post_images(),
1531
-			$entity_helper
1532
-		);
1533
-
1534
-		/** WL Autocomplete. */
1535
-		$autocomplete_service       = new All_Autocomplete_Service( array(
1536
-			new Local_Autocomplete_Service(),
1537
-			new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ),
1538
-		) );
1539
-		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service );
1540
-
1541
-		/**
1542
-		 * @since 3.27.2
1543
-		 * Integrate the recipe maker jsonld & set recipe
1544
-		 * as default entity type to the wprm_recipe CPT.
1545
-		 */
1546
-		new Recipe_Maker_Post_Type_Hook();
1547
-		$recipe_maker_validation_service = new Recipe_Maker_Validation_Service();
1548
-		new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service );
1549
-		new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service );
1550
-		new Recipe_Maker_Warning( $recipe_maker_validation_service );
1551
-		new Yoast_Jsonld( $recipe_maker_validation_service );
1552
-
1553
-		/**
1554
-		 * @since 3.27.4
1555
-		 * Add the faq duplicate markup hook.
1556
-		 */
1557
-		new Faq_Duplicate_Markup_Remover();
1558
-	}
1559
-
1560
-	/**
1561
-	 * Define the locale for this plugin for internationalization.
1562
-	 *
1563
-	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1564
-	 * with WordPress.
1565
-	 *
1566
-	 * @since    1.0.0
1567
-	 * @access   private
1568
-	 */
1569
-	private function set_locale() {
1570
-
1571
-		$plugin_i18n = new Wordlift_i18n();
1572
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1573
-
1574
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1575
-
1576
-	}
1577
-
1578
-	/**
1579
-	 * Register all of the hooks related to the admin area functionality
1580
-	 * of the plugin.
1581
-	 *
1582
-	 * @since    1.0.0
1583
-	 * @access   private
1584
-	 */
1585
-	private function define_admin_hooks() {
1586
-
1587
-		$plugin_admin = new Wordlift_Admin(
1588
-			$this->get_plugin_name(),
1589
-			$this->get_version(),
1590
-			$this->configuration_service,
1591
-			$this->notice_service,
1592
-			$this->user_service
1593
-		);
1594
-
1595
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1596
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 );
1597
-
1598
-		// Hook the init action to taxonomy services.
1599
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1600
-		$this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 );
1601
-
1602
-		// Hook the deleted_post_meta action to the Thumbnail service.
1603
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1604
-
1605
-		// Hook the added_post_meta action to the Thumbnail service.
1606
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1607
-
1608
-		// Hook the updated_post_meta action to the Thumbnail service.
1609
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1610
-
1611
-		// Hook the AJAX wl_timeline action to the Timeline service.
1612
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1613
-
1614
-		// Register custom allowed redirect hosts.
1615
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1616
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1617
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1618
-
1619
-		/*
1525
+        $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service );
1526
+        new Analysis_Response_Ops_Factory(
1527
+            $this->entity_uri_service,
1528
+            $this->entity_service,
1529
+            $this->entity_type_service,
1530
+            $this->storage_factory->post_images(),
1531
+            $entity_helper
1532
+        );
1533
+
1534
+        /** WL Autocomplete. */
1535
+        $autocomplete_service       = new All_Autocomplete_Service( array(
1536
+            new Local_Autocomplete_Service(),
1537
+            new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ),
1538
+        ) );
1539
+        $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service );
1540
+
1541
+        /**
1542
+         * @since 3.27.2
1543
+         * Integrate the recipe maker jsonld & set recipe
1544
+         * as default entity type to the wprm_recipe CPT.
1545
+         */
1546
+        new Recipe_Maker_Post_Type_Hook();
1547
+        $recipe_maker_validation_service = new Recipe_Maker_Validation_Service();
1548
+        new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service );
1549
+        new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service );
1550
+        new Recipe_Maker_Warning( $recipe_maker_validation_service );
1551
+        new Yoast_Jsonld( $recipe_maker_validation_service );
1552
+
1553
+        /**
1554
+         * @since 3.27.4
1555
+         * Add the faq duplicate markup hook.
1556
+         */
1557
+        new Faq_Duplicate_Markup_Remover();
1558
+    }
1559
+
1560
+    /**
1561
+     * Define the locale for this plugin for internationalization.
1562
+     *
1563
+     * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1564
+     * with WordPress.
1565
+     *
1566
+     * @since    1.0.0
1567
+     * @access   private
1568
+     */
1569
+    private function set_locale() {
1570
+
1571
+        $plugin_i18n = new Wordlift_i18n();
1572
+        $plugin_i18n->set_domain( $this->get_plugin_name() );
1573
+
1574
+        $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1575
+
1576
+    }
1577
+
1578
+    /**
1579
+     * Register all of the hooks related to the admin area functionality
1580
+     * of the plugin.
1581
+     *
1582
+     * @since    1.0.0
1583
+     * @access   private
1584
+     */
1585
+    private function define_admin_hooks() {
1586
+
1587
+        $plugin_admin = new Wordlift_Admin(
1588
+            $this->get_plugin_name(),
1589
+            $this->get_version(),
1590
+            $this->configuration_service,
1591
+            $this->notice_service,
1592
+            $this->user_service
1593
+        );
1594
+
1595
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1596
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 );
1597
+
1598
+        // Hook the init action to taxonomy services.
1599
+        $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1600
+        $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 );
1601
+
1602
+        // Hook the deleted_post_meta action to the Thumbnail service.
1603
+        $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1604
+
1605
+        // Hook the added_post_meta action to the Thumbnail service.
1606
+        $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1607
+
1608
+        // Hook the updated_post_meta action to the Thumbnail service.
1609
+        $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1610
+
1611
+        // Hook the AJAX wl_timeline action to the Timeline service.
1612
+        $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1613
+
1614
+        // Register custom allowed redirect hosts.
1615
+        $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1616
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1617
+        $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1618
+
1619
+        /*
1620 1620
 		 * The old dashboard is replaced with dashboard v2.
1621 1621
 		 *
1622 1622
 		 * The old dashboard service is still loaded because its functions are used.
@@ -1625,389 +1625,389 @@  discard block
 block discarded – undo
1625 1625
 		 *
1626 1626
 		 * @since 3.20.0
1627 1627
 		 */
1628
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1629
-		// $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1630
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1631
-		// $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1632
-
1633
-		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1634
-		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1635
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1636
-		$this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1637
-
1638
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1639
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1640
-
1641
-		// Entity listing customization (wp-admin/edit.php)
1642
-		// Add custom columns.
1643
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1644
-		// no explicit entity as it prevents handling of other post types.
1645
-		$this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1646
-		// Add 4W selection.
1647
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1648
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1649
-		$this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1650
-		$this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1651
-
1652
-		/*
1628
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1629
+        // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1630
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1631
+        // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1632
+
1633
+        // Hook save_post to the entity service to update custom fields (such as alternate labels).
1634
+        // We have a priority of 9 because we want to be executed before data is sent to Redlink.
1635
+        $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1636
+        $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1637
+
1638
+        $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1639
+        $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1640
+
1641
+        // Entity listing customization (wp-admin/edit.php)
1642
+        // Add custom columns.
1643
+        $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1644
+        // no explicit entity as it prevents handling of other post types.
1645
+        $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1646
+        // Add 4W selection.
1647
+        $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1648
+        $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1649
+        $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1650
+        $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1651
+
1652
+        /*
1653 1653
 		 * If `All Entity Types` is disable, use the radio button Walker.
1654 1654
 		 *
1655 1655
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1656 1656
 		 */
1657
-		if ( ! WL_ALL_ENTITY_TYPES ) {
1658
-			$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1659
-		}
1660
-
1661
-		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1662
-		// entities.
1663
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1664
-
1665
-		// Filter imported post meta.
1666
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1667
-
1668
-		// Notify the import service when an import starts and ends.
1669
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1670
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1671
-
1672
-		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1673
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1674
-		$this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' );
1675
-
1676
-		/**
1677
-		 * Filter: wl_feature__enable__screens.
1678
-		 *
1679
-		 * @param bool whether the screens needed to be registered, defaults to true.
1680
-		 *
1681
-		 * @return bool
1682
-		 * @since 3.27.6
1683
-		 */
1684
-		if ( apply_filters( 'wl_feature__enable__screens', true ) ) {
1685
-			// Hook the menu to the Download Your Data page.
1686
-			$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1687
-			$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1688
-			$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1689
-		}
1690
-		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1691
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1692
-
1693
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1694
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1695
-		$this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' );
1696
-		$this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1697
-
1698
-		// Hook the AJAX wl_validate_key action to the Key Validation service.
1699
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1700
-
1701
-		// Hook the AJAX wl_update_country_options action to the countries.
1702
-		$this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' );
1703
-
1704
-		// Hook the `admin_init` function to the Admin Setup.
1705
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1706
-
1707
-		// Hook the admin_init to the settings page.
1708
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1709
-		$this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' );
1710
-
1711
-		$this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' );
1712
-
1713
-		// Hook the menu creation on the general wordlift menu creation.
1714
-		/**
1715
-		 * Filter: wl_feature__enable__screens.
1716
-		 *
1717
-		 * @param bool whether the screens needed to be registered, defaults to true.
1718
-		 *
1719
-		 * @return bool
1720
-		 * @since 3.27.6
1721
-		 */
1722
-		if ( apply_filters( 'wl_feature__enable__screens', true ) ) {
1723
-			$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1724
-		}
1725
-		/*
1657
+        if ( ! WL_ALL_ENTITY_TYPES ) {
1658
+            $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1659
+        }
1660
+
1661
+        // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1662
+        // entities.
1663
+        $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1664
+
1665
+        // Filter imported post meta.
1666
+        $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1667
+
1668
+        // Notify the import service when an import starts and ends.
1669
+        $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1670
+        $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1671
+
1672
+        // Hook the AJAX wl_rebuild action to the Rebuild Service.
1673
+        $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1674
+        $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' );
1675
+
1676
+        /**
1677
+         * Filter: wl_feature__enable__screens.
1678
+         *
1679
+         * @param bool whether the screens needed to be registered, defaults to true.
1680
+         *
1681
+         * @return bool
1682
+         * @since 3.27.6
1683
+         */
1684
+        if ( apply_filters( 'wl_feature__enable__screens', true ) ) {
1685
+            // Hook the menu to the Download Your Data page.
1686
+            $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1687
+            $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1688
+            $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1689
+        }
1690
+        // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1691
+        $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1692
+
1693
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1694
+        $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1695
+        $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' );
1696
+        $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1697
+
1698
+        // Hook the AJAX wl_validate_key action to the Key Validation service.
1699
+        $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1700
+
1701
+        // Hook the AJAX wl_update_country_options action to the countries.
1702
+        $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' );
1703
+
1704
+        // Hook the `admin_init` function to the Admin Setup.
1705
+        $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1706
+
1707
+        // Hook the admin_init to the settings page.
1708
+        $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1709
+        $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' );
1710
+
1711
+        $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' );
1712
+
1713
+        // Hook the menu creation on the general wordlift menu creation.
1714
+        /**
1715
+         * Filter: wl_feature__enable__screens.
1716
+         *
1717
+         * @param bool whether the screens needed to be registered, defaults to true.
1718
+         *
1719
+         * @return bool
1720
+         * @since 3.27.6
1721
+         */
1722
+        if ( apply_filters( 'wl_feature__enable__screens', true ) ) {
1723
+            $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1724
+        }
1725
+        /*
1726 1726
 		 * Display the `Wordlift_Admin_Search_Rankings_Page` page.
1727 1727
 		 *
1728 1728
 		 * @link https://github.com/insideout10/wordlift-plugin/issues/761
1729 1729
 		 *
1730 1730
 		 * @since 3.20.0
1731 1731
 		 */
1732
-		if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) {
1733
-			/**
1734
-			 * Filter: wl_feature__enable__screens.
1735
-			 *
1736
-			 * @param bool whether the screens needed to be registered, defaults to true.
1737
-			 *
1738
-			 * @return bool
1739
-			 * @since 3.27.6
1740
-			 */
1741
-			if ( apply_filters( 'wl_feature__enable__screens', true ) ) {
1742
-				$admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page();
1743
-				$this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' );
1744
-			}
1745
-		}
1746
-
1747
-		// Hook key update.
1748
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1749
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1750
-
1751
-		// Add additional action links to the WordLift plugin in the plugins page.
1752
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1753
-
1754
-		/*
1732
+        if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) {
1733
+            /**
1734
+             * Filter: wl_feature__enable__screens.
1735
+             *
1736
+             * @param bool whether the screens needed to be registered, defaults to true.
1737
+             *
1738
+             * @return bool
1739
+             * @since 3.27.6
1740
+             */
1741
+            if ( apply_filters( 'wl_feature__enable__screens', true ) ) {
1742
+                $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page();
1743
+                $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' );
1744
+            }
1745
+        }
1746
+
1747
+        // Hook key update.
1748
+        $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1749
+        $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1750
+
1751
+        // Add additional action links to the WordLift plugin in the plugins page.
1752
+        $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1753
+
1754
+        /*
1755 1755
 		 * Remove the Analytics Settings link from the plugin page.
1756 1756
 		 *
1757 1757
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/932
1758 1758
 		 * @since 3.21.1
1759 1759
 		 */
1760
-		// $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 );
1761
-
1762
-		// Hook the AJAX `wl_publisher` action name.
1763
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1764
-
1765
-		// Hook row actions for the entity type list admin.
1766
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1767
-
1768
-		/** Ajax actions. */
1769
-		$this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1770
-
1771
-		// Hook capabilities manipulation to allow access to entity type admin
1772
-		// page  on WordPress versions before 4.7.
1773
-		global $wp_version;
1774
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1775
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1776
-		}
1777
-
1778
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1779
-
1780
-		/** Adapters. */
1781
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1782
-		/**
1783
-		 * Disabling Faq temporarily.
1784
-		 * Load the tinymce editor button on the tool bar.
1785
-		 * @since 3.26.0
1786
-		 */
1787
-		//$this->loader->add_filter( 'tiny_mce_before_init', $this->faq_tinymce_adapter, 'register_custom_tags' );
1788
-		//$this->loader->add_filter( 'mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 );
1789
-		//$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 );
1790
-
1791
-
1792
-		$this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1793
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1794
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1795
-		/**
1796
-		 * @since 3.26.0
1797
-		 */
1798
-		if ( apply_filters( 'wl_feature__enable__post_excerpt', true ) ) {
1799
-			$excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter();
1800
-			$this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' );
1801
-			// Adding Rest route for the post excerpt
1802
-			Post_Excerpt_Rest_Controller::register_routes();
1803
-		}
1804
-
1805
-		$this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 );
1806
-		$this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 );
1807
-
1808
-		// Handle the autocomplete request.
1809
-		add_action( 'wp_ajax_wl_autocomplete', array(
1810
-			$this->autocomplete_adapter,
1811
-			'wl_autocomplete',
1812
-		) );
1813
-		add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1814
-			$this->autocomplete_adapter,
1815
-			'wl_autocomplete',
1816
-		) );
1817
-
1818
-		// Hooks to restrict multisite super admin from manipulating entity types.
1819
-		if ( is_multisite() ) {
1820
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1821
-		}
1822
-
1823
-		$deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service );
1824
-
1825
-		add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) );
1826
-		add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) );
1827
-		add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) );
1828
-
1829
-		/**
1830
-		 * Always allow the `wordlift/classification` block.
1831
-		 *
1832
-		 * @since 3.23.0
1833
-		 */
1834
-		add_filter( 'allowed_block_types', function ( $value ) {
1835
-
1836
-			if ( true === $value ) {
1837
-				return $value;
1838
-			}
1839
-
1840
-			return array_merge( (array) $value, array( 'wordlift/classification' ) );
1841
-		}, PHP_INT_MAX );
1842
-
1843
-		/**
1844
-		 * @since 3.27.7
1845
-		 * @see https://github.com/insideout10/wordlift-plugin/issues/1214
1846
-		 */
1847
-		new Top_Entities();
1848
-	}
1849
-
1850
-	/**
1851
-	 * Register all of the hooks related to the public-facing functionality
1852
-	 * of the plugin.
1853
-	 *
1854
-	 * @since    1.0.0
1855
-	 * @access   private
1856
-	 */
1857
-	private function define_public_hooks() {
1858
-
1859
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1860
-
1861
-		// Register the entity post type.
1862
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1863
-
1864
-		// Bind the link generation and handling hooks to the entity link service.
1865
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1866
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1867
-		// $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 );
1868
-		// $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 );
1869
-
1870
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1871
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1872
-		$this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' );
1873
-
1874
-		// Registering Faq_Content_Filter service used for removing faq question and answer tags from the html.
1875
-		$this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' );
1876
-		// Hook the content filter service to add entity links.
1877
-		if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1878
-			$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1879
-		}
1880
-
1881
-		// Hook the AJAX wl_timeline action to the Timeline service.
1882
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1883
-
1884
-		// Hook the ShareThis service.
1885
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1886
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1887
-
1888
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1889
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1890
-
1891
-		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1892
-		// in order to tweak WP's `WP_Query` to include entities in queries related
1893
-		// to categories.
1894
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1895
-
1896
-		/*
1760
+        // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 );
1761
+
1762
+        // Hook the AJAX `wl_publisher` action name.
1763
+        $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1764
+
1765
+        // Hook row actions for the entity type list admin.
1766
+        $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1767
+
1768
+        /** Ajax actions. */
1769
+        $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1770
+
1771
+        // Hook capabilities manipulation to allow access to entity type admin
1772
+        // page  on WordPress versions before 4.7.
1773
+        global $wp_version;
1774
+        if ( version_compare( $wp_version, '4.7', '<' ) ) {
1775
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1776
+        }
1777
+
1778
+        $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1779
+
1780
+        /** Adapters. */
1781
+        $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1782
+        /**
1783
+         * Disabling Faq temporarily.
1784
+         * Load the tinymce editor button on the tool bar.
1785
+         * @since 3.26.0
1786
+         */
1787
+        //$this->loader->add_filter( 'tiny_mce_before_init', $this->faq_tinymce_adapter, 'register_custom_tags' );
1788
+        //$this->loader->add_filter( 'mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 );
1789
+        //$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 );
1790
+
1791
+
1792
+        $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1793
+        $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1794
+        $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1795
+        /**
1796
+         * @since 3.26.0
1797
+         */
1798
+        if ( apply_filters( 'wl_feature__enable__post_excerpt', true ) ) {
1799
+            $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter();
1800
+            $this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' );
1801
+            // Adding Rest route for the post excerpt
1802
+            Post_Excerpt_Rest_Controller::register_routes();
1803
+        }
1804
+
1805
+        $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 );
1806
+        $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 );
1807
+
1808
+        // Handle the autocomplete request.
1809
+        add_action( 'wp_ajax_wl_autocomplete', array(
1810
+            $this->autocomplete_adapter,
1811
+            'wl_autocomplete',
1812
+        ) );
1813
+        add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1814
+            $this->autocomplete_adapter,
1815
+            'wl_autocomplete',
1816
+        ) );
1817
+
1818
+        // Hooks to restrict multisite super admin from manipulating entity types.
1819
+        if ( is_multisite() ) {
1820
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1821
+        }
1822
+
1823
+        $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service );
1824
+
1825
+        add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) );
1826
+        add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) );
1827
+        add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) );
1828
+
1829
+        /**
1830
+         * Always allow the `wordlift/classification` block.
1831
+         *
1832
+         * @since 3.23.0
1833
+         */
1834
+        add_filter( 'allowed_block_types', function ( $value ) {
1835
+
1836
+            if ( true === $value ) {
1837
+                return $value;
1838
+            }
1839
+
1840
+            return array_merge( (array) $value, array( 'wordlift/classification' ) );
1841
+        }, PHP_INT_MAX );
1842
+
1843
+        /**
1844
+         * @since 3.27.7
1845
+         * @see https://github.com/insideout10/wordlift-plugin/issues/1214
1846
+         */
1847
+        new Top_Entities();
1848
+    }
1849
+
1850
+    /**
1851
+     * Register all of the hooks related to the public-facing functionality
1852
+     * of the plugin.
1853
+     *
1854
+     * @since    1.0.0
1855
+     * @access   private
1856
+     */
1857
+    private function define_public_hooks() {
1858
+
1859
+        $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1860
+
1861
+        // Register the entity post type.
1862
+        $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1863
+
1864
+        // Bind the link generation and handling hooks to the entity link service.
1865
+        $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1866
+        $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1867
+        // $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 );
1868
+        // $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 );
1869
+
1870
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1871
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1872
+        $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' );
1873
+
1874
+        // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html.
1875
+        $this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' );
1876
+        // Hook the content filter service to add entity links.
1877
+        if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1878
+            $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1879
+        }
1880
+
1881
+        // Hook the AJAX wl_timeline action to the Timeline service.
1882
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1883
+
1884
+        // Hook the ShareThis service.
1885
+        $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1886
+        $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1887
+
1888
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1889
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1890
+
1891
+        // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1892
+        // in order to tweak WP's `WP_Query` to include entities in queries related
1893
+        // to categories.
1894
+        $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1895
+
1896
+        /*
1897 1897
 		 * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service`
1898 1898
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1899 1899
 		 * order of start time.
1900 1900
 		 */
1901
-		$this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1902
-
1903
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1904
-
1905
-		// This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1906
-		$this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1907
-
1908
-		// Analytics Script Frontend.
1909
-		if ( $this->configuration_service->is_analytics_enable() ) {
1910
-			$this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 );
1911
-		}
1912
-
1913
-	}
1914
-
1915
-	/**
1916
-	 * Run the loader to execute all of the hooks with WordPress.
1917
-	 *
1918
-	 * @since    1.0.0
1919
-	 */
1920
-	public function run() {
1921
-		$this->loader->run();
1922
-	}
1923
-
1924
-	/**
1925
-	 * The name of the plugin used to uniquely identify it within the context of
1926
-	 * WordPress and to define internationalization functionality.
1927
-	 *
1928
-	 * @return    string    The name of the plugin.
1929
-	 * @since     1.0.0
1930
-	 */
1931
-	public function get_plugin_name() {
1932
-		return $this->plugin_name;
1933
-	}
1934
-
1935
-	/**
1936
-	 * The reference to the class that orchestrates the hooks with the plugin.
1937
-	 *
1938
-	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1939
-	 * @since     1.0.0
1940
-	 */
1941
-	public function get_loader() {
1942
-		return $this->loader;
1943
-	}
1944
-
1945
-	/**
1946
-	 * Retrieve the version number of the plugin.
1947
-	 *
1948
-	 * @return    string    The version number of the plugin.
1949
-	 * @since     1.0.0
1950
-	 */
1951
-	public function get_version() {
1952
-		return $this->version;
1953
-	}
1954
-
1955
-	/**
1956
-	 * Load dependencies for WP-CLI.
1957
-	 *
1958
-	 * @throws Exception
1959
-	 * @since 3.18.0
1960
-	 */
1961
-	private function load_cli_dependencies() {
1962
-
1963
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php';
1964
-
1965
-		$push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service );
1966
-
1967
-		WP_CLI::add_command( 'wl references push', $push_reference_data_command );
1968
-
1969
-	}
1970
-
1971
-	/**
1972
-	 * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions.
1973
-	 *
1974
-	 * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance.
1975
-	 * @since 3.20.0
1976
-	 */
1977
-	public function get_dashboard_service() {
1978
-
1979
-		return $this->dashboard_service;
1980
-	}
1981
-
1982
-	public function add_wl_enabled_blocks() {
1983
-		/**
1984
-		 * Filter: wl_feature__enable__blocks.
1985
-		 *
1986
-		 * @param bool whether the blocks needed to be registered, defaults to true.
1987
-		 *
1988
-		 * @return bool
1989
-		 * @since 3.27.6
1990
-		 */
1991
-
1992
-		wp_register_script( 'wl_enabled_blocks', false );
1993
-
1994
-		$enabled_blocks = array( 'wordlift/products-navigator' );
1995
-
1996
-		if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
1997
-			// To intimate JS
1998
-			$enabled_blocks = array_merge( $enabled_blocks, array(
1999
-				'wordlift/navigator',
2000
-				'wordlift/chord',
2001
-				'wordlift/geomap',
2002
-				'wordlift/timeline',
2003
-				'wordlift/cloud',
2004
-				'wordlift/vocabulary',
2005
-				'wordlift/faceted-search'
2006
-			) );
2007
-		}
2008
-
2009
-		wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks );
2010
-		wp_enqueue_script( 'wl_enabled_blocks' );
2011
-	}
1901
+        $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1902
+
1903
+        $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1904
+
1905
+        // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1906
+        $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1907
+
1908
+        // Analytics Script Frontend.
1909
+        if ( $this->configuration_service->is_analytics_enable() ) {
1910
+            $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 );
1911
+        }
1912
+
1913
+    }
1914
+
1915
+    /**
1916
+     * Run the loader to execute all of the hooks with WordPress.
1917
+     *
1918
+     * @since    1.0.0
1919
+     */
1920
+    public function run() {
1921
+        $this->loader->run();
1922
+    }
1923
+
1924
+    /**
1925
+     * The name of the plugin used to uniquely identify it within the context of
1926
+     * WordPress and to define internationalization functionality.
1927
+     *
1928
+     * @return    string    The name of the plugin.
1929
+     * @since     1.0.0
1930
+     */
1931
+    public function get_plugin_name() {
1932
+        return $this->plugin_name;
1933
+    }
1934
+
1935
+    /**
1936
+     * The reference to the class that orchestrates the hooks with the plugin.
1937
+     *
1938
+     * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1939
+     * @since     1.0.0
1940
+     */
1941
+    public function get_loader() {
1942
+        return $this->loader;
1943
+    }
1944
+
1945
+    /**
1946
+     * Retrieve the version number of the plugin.
1947
+     *
1948
+     * @return    string    The version number of the plugin.
1949
+     * @since     1.0.0
1950
+     */
1951
+    public function get_version() {
1952
+        return $this->version;
1953
+    }
1954
+
1955
+    /**
1956
+     * Load dependencies for WP-CLI.
1957
+     *
1958
+     * @throws Exception
1959
+     * @since 3.18.0
1960
+     */
1961
+    private function load_cli_dependencies() {
1962
+
1963
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php';
1964
+
1965
+        $push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service );
1966
+
1967
+        WP_CLI::add_command( 'wl references push', $push_reference_data_command );
1968
+
1969
+    }
1970
+
1971
+    /**
1972
+     * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions.
1973
+     *
1974
+     * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance.
1975
+     * @since 3.20.0
1976
+     */
1977
+    public function get_dashboard_service() {
1978
+
1979
+        return $this->dashboard_service;
1980
+    }
1981
+
1982
+    public function add_wl_enabled_blocks() {
1983
+        /**
1984
+         * Filter: wl_feature__enable__blocks.
1985
+         *
1986
+         * @param bool whether the blocks needed to be registered, defaults to true.
1987
+         *
1988
+         * @return bool
1989
+         * @since 3.27.6
1990
+         */
1991
+
1992
+        wp_register_script( 'wl_enabled_blocks', false );
1993
+
1994
+        $enabled_blocks = array( 'wordlift/products-navigator' );
1995
+
1996
+        if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
1997
+            // To intimate JS
1998
+            $enabled_blocks = array_merge( $enabled_blocks, array(
1999
+                'wordlift/navigator',
2000
+                'wordlift/chord',
2001
+                'wordlift/geomap',
2002
+                'wordlift/timeline',
2003
+                'wordlift/cloud',
2004
+                'wordlift/vocabulary',
2005
+                'wordlift/faceted-search'
2006
+            ) );
2007
+        }
2008
+
2009
+        wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks );
2010
+        wp_enqueue_script( 'wl_enabled_blocks' );
2011
+    }
2012 2012
 
2013 2013
 }
Please login to merge, or discard this patch.
Spacing   +345 added lines, -345 removed lines patch added patch discarded remove patch
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 		$this->define_public_hooks();
758 758
 
759 759
 		// If we're in `WP_CLI` load the related files.
760
-		if ( class_exists( 'WP_CLI' ) ) {
760
+		if (class_exists('WP_CLI')) {
761 761
 			$this->load_cli_dependencies();
762 762
 		}
763 763
 
@@ -798,381 +798,381 @@  discard block
 block discarded – undo
798 798
 		 * The class responsible for orchestrating the actions and filters of the
799 799
 		 * core plugin.
800 800
 		 */
801
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
801
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php';
802 802
 
803 803
 		// The class responsible for plugin uninstall.
804
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php';
804
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-deactivator-feedback.php';
805 805
 
806 806
 		/**
807 807
 		 * The class responsible for defining internationalization functionality
808 808
 		 * of the plugin.
809 809
 		 */
810
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
810
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php';
811 811
 
812 812
 		/**
813 813
 		 * WordLift's supported languages.
814 814
 		 */
815
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
815
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-languages.php';
816 816
 
817 817
 		/**
818 818
 		 * WordLift's supported countries.
819 819
 		 */
820
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php';
820
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-countries.php';
821 821
 
822 822
 		/**
823 823
 		 * Provide support functions to sanitize data.
824 824
 		 */
825
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
825
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php';
826 826
 
827 827
 		/** Services. */
828
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
829
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
830
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
831
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
832
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
833
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
834
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
835
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
836
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
837
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php';
828
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php';
829
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-http-api.php';
830
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php';
831
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php';
832
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-type-service.php';
833
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php';
834
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php';
835
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-linked-data-service.php';
836
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-service.php';
837
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-image-service.php';
838 838
 
839 839
 		/**
840 840
 		 * The Query builder.
841 841
 		 */
842
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
842
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php';
843 843
 
844 844
 		/**
845 845
 		 * The Schema service.
846 846
 		 */
847
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
847
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php';
848 848
 
849 849
 		/**
850 850
 		 * The schema:url property service.
851 851
 		 */
852
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
853
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
852
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php';
853
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php';
854 854
 
855 855
 		/**
856 856
 		 * The UI service.
857 857
 		 */
858
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
858
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php';
859 859
 
860 860
 		/**
861 861
 		 * The Thumbnail service.
862 862
 		 */
863
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
863
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php';
864 864
 
865 865
 		/**
866 866
 		 * The Entity Types Taxonomy service.
867 867
 		 */
868
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
868
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-taxonomy-service.php';
869 869
 
870 870
 		/**
871 871
 		 * The Entity service.
872 872
 		 */
873
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
874
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
873
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-uri-service.php';
874
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php';
875 875
 
876 876
 		// Add the entity rating service.
877
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
877
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rating-service.php';
878 878
 
879 879
 		/**
880 880
 		 * The User service.
881 881
 		 */
882
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
882
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php';
883 883
 
884 884
 		/**
885 885
 		 * The Timeline service.
886 886
 		 */
887
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
887
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php';
888 888
 
889 889
 		/**
890 890
 		 * The Topic Taxonomy service.
891 891
 		 */
892
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
892
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php';
893 893
 
894 894
 		/**
895 895
 		 * The SPARQL service.
896 896
 		 */
897
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
897
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sparql-service.php';
898 898
 
899 899
 		/**
900 900
 		 * The WordLift import service.
901 901
 		 */
902
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
902
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-import-service.php';
903 903
 
904 904
 		/**
905 905
 		 * The WordLift URI service.
906 906
 		 */
907
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
908
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
909
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
907
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php';
908
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-factory.php';
909
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-service.php';
910 910
 
911 911
 		/**
912 912
 		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
913 913
 		 */
914
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php';
915
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php';
916
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php';
917
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php';
918
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
914
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-listable.php';
915
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-rebuild-service.php';
916
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-reference-rebuild-service.php';
917
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-service.php';
918
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
919 919
 
920
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
921
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
920
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/properties/class-wordlift-property-getter-factory.php';
921
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-attachment-service.php';
922 922
 
923 923
 		/**
924 924
 		 * Load the converters.
925 925
 		 */
926
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
927
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
928
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
929
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
930
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
931
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
926
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/intf-wordlift-post-converter.php';
927
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
928
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-postid-to-jsonld-converter.php';
929
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-to-jsonld-converter.php';
930
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-to-jsonld-converter.php';
931
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-website-converter.php';
932 932
 
933 933
 		/**
934 934
 		 * Load cache-related files.
935 935
 		 */
936
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
936
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/cache/require.php';
937 937
 
938 938
 		/**
939 939
 		 * Load the content filter.
940 940
 		 */
941
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
941
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-content-filter-service.php';
942 942
 
943 943
 		/*
944 944
 		 * Load the excerpt helper.
945 945
 		 */
946
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
946
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-excerpt-helper.php';
947 947
 
948 948
 		/**
949 949
 		 * Load the JSON-LD service to publish entities using JSON-LD.s
950 950
 		 *
951 951
 		 * @since 3.8.0
952 952
 		 */
953
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
953
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-service.php';
954 954
 
955 955
 		// The Publisher Service and the AJAX adapter.
956
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
957
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
956
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-service.php';
957
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-ajax-adapter.php';
958 958
 
959
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
959
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-adapter.php';
960 960
 
961 961
 		/**
962 962
 		 * Load the WordLift key validation service.
963 963
 		 */
964
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
964
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php';
965 965
 
966 966
 		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
967
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
967
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php';
968 968
 
969 969
 		// Load the `Wordlift_Entity_Page_Service` class definition.
970
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
970
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-page-service.php';
971 971
 
972 972
 		/** Linked Data. */
973
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
974
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
975
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
976
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
977
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
978
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
979
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
980
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
981
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
982
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
983
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
973
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage.php';
974
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
975
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-property-storage.php';
976
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
977
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
978
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-author-storage.php';
979
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
980
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-image-storage.php';
981
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-related-storage.php';
982
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-url-property-storage.php';
983
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage-factory.php';
984 984
 
985 985
 		/** Linked Data Rendition. */
986
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
987
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
988
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
989
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
986
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
987
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
988
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
989
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
990 990
 
991 991
 		/** Services. */
992
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
993
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php';
992
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-google-analytics-export-service.php';
993
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-api-service.php';
994 994
 
995 995
 		/** Adapters. */
996
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
997
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
998
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
999
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
1000
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php';
996
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php';
997
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-newrelic-adapter.php';
998
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-ajax-adapter.php';
999
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-adapter.php';
1000
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-wprocket-adapter.php';
1001 1001
 
1002 1002
 		/** Async Tasks. */
1003
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
1004
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
1005
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php';
1003
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-async-task.php';
1004
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
1005
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-push-references-async-task.php';
1006 1006
 
1007 1007
 		/** Autocomplete. */
1008
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
1008
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-adapter.php';
1009 1009
 
1010
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
1010
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-remote-image-service.php';
1011 1011
 
1012 1012
 		/** Analytics */
1013
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php';
1013
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/analytics/class-wordlift-analytics-connect.php';
1014 1014
 
1015 1015
 		/**
1016 1016
 		 * The class responsible for defining all actions that occur in the admin area.
1017 1017
 		 */
1018
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
1018
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php';
1019 1019
 
1020 1020
 		/**
1021 1021
 		 * The class to customize the entity list admin page.
1022 1022
 		 */
1023
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
1023
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php';
1024 1024
 
1025 1025
 		/**
1026 1026
 		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
1027 1027
 		 */
1028 1028
 		global $wp_version;
1029
-		if ( version_compare( $wp_version, '5.3', '<' ) ) {
1030
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
1029
+		if (version_compare($wp_version, '5.3', '<')) {
1030
+			require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php';
1031 1031
 		} else {
1032
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php';
1032
+			require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php';
1033 1033
 		}
1034 1034
 
1035 1035
 		/**
1036 1036
 		 * The Notice service.
1037 1037
 		 */
1038
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
1038
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php';
1039 1039
 
1040 1040
 		/**
1041 1041
 		 * The PrimaShop adapter.
1042 1042
 		 */
1043
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
1043
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php';
1044 1044
 
1045 1045
 		/**
1046 1046
 		 * The WordLift Dashboard service.
1047 1047
 		 */
1048
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
1048
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php';
1049 1049
 
1050 1050
 		/**
1051 1051
 		 * The admin 'Install wizard' page.
1052 1052
 		 */
1053
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
1053
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php';
1054 1054
 
1055 1055
 		/**
1056 1056
 		 * The WordLift entity type list admin page controller.
1057 1057
 		 */
1058
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1058
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1059 1059
 
1060 1060
 		/**
1061 1061
 		 * The WordLift entity type settings admin page controller.
1062 1062
 		 */
1063
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
1063
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php';
1064 1064
 
1065 1065
 		/**
1066 1066
 		 * The admin 'Download Your Data' page.
1067 1067
 		 */
1068
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
1068
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php';
1069 1069
 
1070 1070
 		/**
1071 1071
 		 * The admin 'WordLift Settings' page.
1072 1072
 		 */
1073
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php';
1074
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php';
1075
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php';
1076
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php';
1077
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php';
1078
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php';
1079
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php';
1080
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php';
1081
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php';
1082
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php';
1083
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
1084
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
1085
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php';
1086
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
1087
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php';
1073
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/intf-wordlift-admin-element.php';
1074
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-element.php';
1075
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-radio-element.php';
1076
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select-element.php';
1077
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select2-element.php';
1078
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-language-select-element.php';
1079
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-country-select-element.php';
1080
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-tabs-element.php';
1081
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-author-element.php';
1082
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-publisher-element.php';
1083
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php';
1084
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php';
1085
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page.php';
1086
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php';
1087
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-analytics-page-action-link.php';
1088 1088
 
1089 1089
 		/** Admin Pages */
1090
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
1091
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
1092
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php';
1093
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
1090
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-user-profile-page.php';
1091
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-status-page.php';
1092
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-search-rankings-page.php';
1093
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-admin-service.php';
1094 1094
 
1095 1095
 		/**
1096 1096
 		 * The class responsible for defining all actions that occur in the public-facing
1097 1097
 		 * side of the site.
1098 1098
 		 */
1099
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1099
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php';
1100 1100
 
1101 1101
 		/**
1102 1102
 		 * The shortcode abstract class.
1103 1103
 		 */
1104
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1104
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php';
1105 1105
 
1106 1106
 		/**
1107 1107
 		 * The Timeline shortcode.
1108 1108
 		 */
1109
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1109
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php';
1110 1110
 
1111 1111
 		/**
1112 1112
 		 * The Navigator shortcode.
1113 1113
 		 */
1114
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1114
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php';
1115 1115
 
1116 1116
 		/**
1117 1117
 		 * The Products Navigator shortcode.
1118 1118
 		 */
1119
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php';
1119
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-products-navigator-shortcode.php';
1120 1120
 
1121 1121
 		/**
1122 1122
 		 * The chord shortcode.
1123 1123
 		 */
1124
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1124
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php';
1125 1125
 
1126 1126
 		/**
1127 1127
 		 * The geomap shortcode.
1128 1128
 		 */
1129
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1129
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php';
1130 1130
 
1131 1131
 		/**
1132 1132
 		 * The entity cloud shortcode.
1133 1133
 		 */
1134
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1134
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php';
1135 1135
 
1136 1136
 		/**
1137 1137
 		 * The entity glossary shortcode.
1138 1138
 		 */
1139
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1140
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1139
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-alphabet-service.php';
1140
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-vocabulary-shortcode.php';
1141 1141
 
1142 1142
 		/**
1143 1143
 		 * Faceted Search shortcode.
1144 1144
 		 */
1145
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php';
1145
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-faceted-search-shortcode.php';
1146 1146
 
1147 1147
 		/**
1148 1148
 		 * The ShareThis service.
1149 1149
 		 */
1150
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1150
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php';
1151 1151
 
1152 1152
 		/**
1153 1153
 		 * The SEO service.
1154 1154
 		 */
1155
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1155
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php';
1156 1156
 
1157 1157
 		/**
1158 1158
 		 * The AMP service.
1159 1159
 		 */
1160
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1160
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-amp-service.php';
1161 1161
 
1162 1162
 		/** Widgets */
1163
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1164
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1165
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php';
1163
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php';
1164
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php';
1165
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-context-cards.php';
1166 1166
 
1167 1167
 		/*
1168 1168
 		 * Schema.org Services.
1169 1169
 		 *
1170 1170
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1171 1171
 		 */
1172
-		if ( WL_ALL_ENTITY_TYPES ) {
1173
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php';
1174
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php';
1175
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php';
1172
+		if (WL_ALL_ENTITY_TYPES) {
1173
+			require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-sync-service.php';
1174
+			require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-property-service.php';
1175
+			require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-class-service.php';
1176 1176
 			new Wordlift_Schemaorg_Sync_Service();
1177 1177
 			$schemaorg_property_service = new Wordlift_Schemaorg_Property_Service();
1178 1178
 			new Wordlift_Schemaorg_Class_Service();
@@ -1184,25 +1184,25 @@  discard block
 block discarded – undo
1184 1184
 
1185 1185
 		// Instantiate a global logger.
1186 1186
 		global $wl_logger;
1187
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1187
+		$wl_logger = Wordlift_Log_Service::get_logger('WordLift');
1188 1188
 
1189 1189
 		// Load the `wl-api` end-point.
1190 1190
 		new Wordlift_Http_Api();
1191 1191
 
1192 1192
 		// Load the Install Service.
1193
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
1193
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-service.php';
1194 1194
 		$this->install_service = new Wordlift_Install_Service();
1195 1195
 
1196 1196
 		/** Services. */
1197 1197
 		// Create the configuration service.
1198 1198
 		$this->configuration_service = new Wordlift_Configuration_Service();
1199
-		$api_service                 = new Wordlift_Api_Service( $this->configuration_service );
1199
+		$api_service                 = new Wordlift_Api_Service($this->configuration_service);
1200 1200
 
1201 1201
 		// Create an entity type service instance. It'll be later bound to the init action.
1202
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1202
+		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path());
1203 1203
 
1204 1204
 		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1205
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1205
+		$this->entity_link_service = new Wordlift_Entity_Link_Service($this->entity_post_type_service, $this->configuration_service->get_entity_base_path());
1206 1206
 
1207 1207
 		// Create an instance of the UI service.
1208 1208
 		$this->ui_service = new Wordlift_UI_Service();
@@ -1211,34 +1211,34 @@  discard block
 block discarded – undo
1211 1211
 		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
1212 1212
 
1213 1213
 		$this->sparql_service        = new Wordlift_Sparql_Service();
1214
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1214
+		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service($this->sparql_service);
1215 1215
 		$this->notice_service        = new Wordlift_Notice_Service();
1216 1216
 		$this->relation_service      = new Wordlift_Relation_Service();
1217 1217
 
1218
-		$entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1219
-		$this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1220
-		$this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1221
-		$this->user_service       = new Wordlift_User_Service( $this->sparql_service, $this->entity_service );
1218
+		$entity_uri_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'entity_uri/');
1219
+		$this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service($this->configuration_service, $entity_uri_cache_service);
1220
+		$this->entity_service     = new Wordlift_Entity_Service($this->ui_service, $this->relation_service, $this->entity_uri_service);
1221
+		$this->user_service       = new Wordlift_User_Service($this->sparql_service, $this->entity_service);
1222 1222
 
1223 1223
 		// Instantiate the JSON-LD service.
1224
-		$property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1224
+		$property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service);
1225 1225
 
1226 1226
 		/** Linked Data. */
1227
-		$this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1228
-		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1227
+		$this->storage_factory   = new Wordlift_Storage_Factory($this->entity_service, $this->user_service, $property_getter);
1228
+		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory($this->entity_service);
1229 1229
 
1230
-		$this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1230
+		$this->schema_service = new Wordlift_Schema_Service($this->storage_factory, $this->rendition_factory, $this->configuration_service);
1231 1231
 
1232 1232
 		// Create a new instance of the Redirect service.
1233
-		$this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_uri_service );
1234
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1233
+		$this->redirect_service    = new Wordlift_Redirect_Service($this->entity_uri_service);
1234
+		$this->entity_type_service = new Wordlift_Entity_Type_Service($this->schema_service);
1235 1235
 
1236
-		if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) {
1237
-			new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service );
1236
+		if ( ! apply_filters('wl_feature__enable__dataset-ng', false)) {
1237
+			new Wordlift_Linked_Data_Service($this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service);
1238 1238
 		}
1239 1239
 
1240 1240
 		// Create a new instance of the Timeline service and Timeline shortcode.
1241
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1241
+		$this->timeline_service = new Wordlift_Timeline_Service($this->entity_service, $this->entity_type_service);
1242 1242
 
1243 1243
 		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1244 1244
 
@@ -1252,36 +1252,36 @@  discard block
 block discarded – undo
1252 1252
 		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1253 1253
 
1254 1254
 		// Create an import service instance to hook later to WP's import function.
1255
-		$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() );
1255
+		$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());
1256 1256
 
1257
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1257
+		$uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']);
1258 1258
 
1259 1259
 		// Create the entity rating service.
1260
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1260
+		$this->rating_service = new Wordlift_Rating_Service($this->entity_service, $this->entity_type_service, $this->notice_service);
1261 1261
 
1262 1262
 		// Create entity list customization (wp-admin/edit.php).
1263
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1263
+		$this->entity_list_service = new Wordlift_Entity_List_Service($this->rating_service);
1264 1264
 
1265 1265
 		// Create a new instance of the Redirect service.
1266
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1266
+		$this->dashboard_service = new Wordlift_Dashboard_Service($this->rating_service, $this->entity_service);
1267 1267
 
1268 1268
 		// Create an instance of the Publisher Service and the AJAX Adapter.
1269
-		$this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service );
1270
-		$this->property_factory  = new Wordlift_Property_Factory( $schema_url_property_service );
1271
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1269
+		$this->publisher_service = new Wordlift_Publisher_Service($this->configuration_service);
1270
+		$this->property_factory  = new Wordlift_Property_Factory($schema_url_property_service);
1271
+		$this->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service);
1272 1272
 
1273 1273
 		$attachment_service = new Wordlift_Attachment_Service();
1274 1274
 
1275 1275
 		// Instantiate the JSON-LD service.
1276
-		$property_getter                       = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1277
-		$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 );
1278
-		$this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $this->post_to_jsonld_converter );
1279
-		$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 );
1280
-		$this->jsonld_website_converter        = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1276
+		$property_getter                       = Wordlift_Property_Getter_Factory::create($this->entity_service);
1277
+		$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);
1278
+		$this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $this->post_to_jsonld_converter);
1279
+		$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);
1280
+		$this->jsonld_website_converter        = new Wordlift_Website_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service);
1281 1281
 
1282
-		$jsonld_cache                            = new Ttl_Cache( 'jsonld', 86400 );
1283
-		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache );
1284
-		$this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1282
+		$jsonld_cache                            = new Ttl_Cache('jsonld', 86400);
1283
+		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter($this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache);
1284
+		$this->jsonld_service                    = new Wordlift_Jsonld_Service($this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter);
1285 1285
 
1286 1286
 		/*
1287 1287
 		 * Load the `Wordlift_Term_JsonLd_Adapter`.
@@ -1290,29 +1290,29 @@  discard block
 block discarded – undo
1290 1290
 		 *
1291 1291
 		 * @since 3.20.0
1292 1292
 		 */
1293
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php';
1294
-		$term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service );
1293
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-term-jsonld-adapter.php';
1294
+		$term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter($this->entity_uri_service, $this->jsonld_service);
1295 1295
 		$jsonld_service      = new Jsonld_Service(
1296 1296
 			$this->jsonld_service,
1297 1297
 			$term_jsonld_adapter,
1298
-			new Jsonld_User_Service( $this->user_service ) );
1299
-		new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service );
1298
+			new Jsonld_User_Service($this->user_service) );
1299
+		new Jsonld_Endpoint($jsonld_service, $this->entity_uri_service);
1300 1300
 
1301 1301
 		// Prints the JSON-LD in the head.
1302
-		new Jsonld_Adapter( $this->jsonld_service );
1302
+		new Jsonld_Adapter($this->jsonld_service);
1303 1303
 
1304
-		new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service );
1304
+		new Jsonld_By_Id_Endpoint($this->jsonld_service, $this->entity_uri_service);
1305 1305
 
1306
-		$this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service );
1307
-		$this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1306
+		$this->key_validation_service = new Wordlift_Key_Validation_Service($this->configuration_service);
1307
+		$this->content_filter_service = new Wordlift_Content_Filter_Service($this->entity_service, $this->configuration_service, $this->entity_uri_service);
1308 1308
 		// Creating Faq Content filter service.
1309 1309
 		$this->faq_content_filter_service = new Faq_Content_Filter();
1310
-		$this->relation_rebuild_service   = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1311
-		$this->sample_data_service        = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1312
-		$this->sample_data_ajax_adapter   = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1313
-		$this->reference_rebuild_service  = new Wordlift_Reference_Rebuild_Service( $this->entity_service );
1310
+		$this->relation_rebuild_service   = new Wordlift_Relation_Rebuild_Service($this->content_filter_service, $this->entity_service);
1311
+		$this->sample_data_service        = new Wordlift_Sample_Data_Service($this->entity_type_service, $this->configuration_service, $this->user_service);
1312
+		$this->sample_data_ajax_adapter   = new Wordlift_Sample_Data_Ajax_Adapter($this->sample_data_service);
1313
+		$this->reference_rebuild_service  = new Wordlift_Reference_Rebuild_Service($this->entity_service);
1314 1314
 
1315
-		$this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' );
1315
+		$this->loader->add_action('enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks');
1316 1316
 
1317 1317
 		/**
1318 1318
 		 * Filter: wl_feature__enable__blocks.
@@ -1322,15 +1322,15 @@  discard block
 block discarded – undo
1322 1322
 		 * @return bool
1323 1323
 		 * @since 3.27.6
1324 1324
 		 */
1325
-		if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
1325
+		if (apply_filters('wl_feature__enable__blocks', true)) {
1326 1326
 			// Initialize the short-codes.
1327 1327
 			new Wordlift_Navigator_Shortcode();
1328 1328
 			new Wordlift_Chord_Shortcode();
1329 1329
 			new Wordlift_Geomap_Shortcode();
1330 1330
 			new Wordlift_Timeline_Shortcode();
1331
-			new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1332
-			new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1333
-			new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() );
1331
+			new Wordlift_Related_Entities_Cloud_Shortcode($this->relation_service);
1332
+			new Wordlift_Vocabulary_Shortcode($this->configuration_service);
1333
+			new Async_Template_Decorator(new Wordlift_Faceted_Search_Shortcode());
1334 1334
 		}
1335 1335
 
1336 1336
 		new Wordlift_Products_Navigator_Shortcode();
@@ -1343,18 +1343,18 @@  discard block
 block discarded – undo
1343 1343
 		new Wordlift_Seo_Service();
1344 1344
 
1345 1345
 		// Initialize the AMP service.
1346
-		new Wordlift_AMP_Service( $this->jsonld_service );
1346
+		new Wordlift_AMP_Service($this->jsonld_service);
1347 1347
 
1348 1348
 		/** Services. */
1349 1349
 		$this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1350 1350
 		new Wordlift_Image_Service();
1351 1351
 
1352 1352
 		/** Adapters. */
1353
-		$this->entity_type_adapter    = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1354
-		$this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service );
1355
-		$this->tinymce_adapter        = new Wordlift_Tinymce_Adapter( $this );
1353
+		$this->entity_type_adapter    = new Wordlift_Entity_Type_Adapter($this->entity_type_service);
1354
+		$this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter($this->publisher_service);
1355
+		$this->tinymce_adapter        = new Wordlift_Tinymce_Adapter($this);
1356 1356
 		//$this->faq_tinymce_adapter      = new Faq_Tinymce_Adapter();
1357
-		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1357
+		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter($this->relation_rebuild_service);
1358 1358
 
1359 1359
 		/*
1360 1360
 		 * Exclude our public js from WP-Rocket.
@@ -1372,7 +1372,7 @@  discard block
 block discarded – undo
1372 1372
 		);
1373 1373
 
1374 1374
 		/** Async Tasks. */
1375
-		if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) {
1375
+		if ( ! apply_filters('wl_feature__enable__dataset-ng', false)) {
1376 1376
 			new Wordlift_Sparql_Query_Async_Task();
1377 1377
 			new Wordlift_Push_References_Async_Task();
1378 1378
 		}
@@ -1386,14 +1386,14 @@  discard block
 block discarded – undo
1386 1386
 		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1387 1387
 		$this->country_select_element  = new Wordlift_Admin_Country_Select_Element();
1388 1388
 		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
1389
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element );
1390
-		$this->author_element          = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element );
1389
+		$this->publisher_element       = new Wordlift_Admin_Publisher_Element($this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element);
1390
+		$this->author_element          = new Wordlift_Admin_Author_Element($this->publisher_service, $this->select2_element);
1391 1391
 
1392
-		$this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element );
1393
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1392
+		$this->settings_page             = new Wordlift_Admin_Settings_Page($this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element);
1393
+		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($this->settings_page);
1394 1394
 
1395
-		$this->analytics_settings_page             = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element );
1396
-		$this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page );
1395
+		$this->analytics_settings_page             = new Wordlift_Admin_Settings_Analytics_Page($this->configuration_service, $this->input_element, $this->radio_input_element);
1396
+		$this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link($this->analytics_settings_page);
1397 1397
 		$this->analytics_connect                   = new Wordlift_Analytics_Connect();
1398 1398
 
1399 1399
 		// Pages.
@@ -1404,9 +1404,9 @@  discard block
 block discarded – undo
1404 1404
 		 *
1405 1405
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/914
1406 1406
 		 */
1407
-		if ( apply_filters( 'wl_can_see_classification_box', true ) ) {
1408
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1409
-			new Wordlift_Admin_Post_Edit_Page( $this );
1407
+		if (apply_filters('wl_can_see_classification_box', true)) {
1408
+			require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php';
1409
+			new Wordlift_Admin_Post_Edit_Page($this);
1410 1410
 		}
1411 1411
 		new Wordlift_Entity_Type_Admin_Service();
1412 1412
 
@@ -1420,23 +1420,23 @@  discard block
 block discarded – undo
1420 1420
 		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1421 1421
 
1422 1422
 		/* WordPress Admin. */
1423
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1424
-		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1423
+		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service);
1424
+		$this->status_page             = new Wordlift_Admin_Status_Page($this->entity_service, $this->sparql_service);
1425 1425
 
1426 1426
 		// Create an instance of the install wizard.
1427
-		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element );
1427
+		$this->admin_setup = new Wordlift_Admin_Setup($this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element);
1428 1428
 
1429
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1429
+		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($this->entity_post_type_service);
1430 1430
 
1431 1431
 		// User Profile.
1432
-		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1432
+		new Wordlift_Admin_User_Profile_Page($this->author_element, $this->user_service);
1433 1433
 
1434 1434
 		$this->entity_page_service = new Wordlift_Entity_Page_Service();
1435 1435
 
1436 1436
 		// Load the debug service if WP is in debug mode.
1437
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1438
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1439
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1437
+		if (defined('WP_DEBUG') && WP_DEBUG) {
1438
+			require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php';
1439
+			new Wordlift_Debug_Service($this->entity_service, $uri_service);
1440 1440
 		}
1441 1441
 
1442 1442
 		// Remote Image Service.
@@ -1449,12 +1449,12 @@  discard block
 block discarded – undo
1449 1449
 		 *
1450 1450
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/852.
1451 1451
 		 */
1452
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php';
1453
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php';
1454
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php';
1452
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-batch-action.php';
1453
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-service.php';
1454
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-ajax-adapter.php';
1455 1455
 
1456 1456
 		// Create an instance of the Mapping Service and assign it to the Ajax Adapter.
1457
-		new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) );
1457
+		new Wordlift_Mapping_Ajax_Adapter(new Wordlift_Mapping_Service(Wordlift_Entity_Type_Service::get_instance()));
1458 1458
 
1459 1459
 		/*
1460 1460
 		 * Batch Operations. They're similar to Batch Actions but do not require working on post types.
@@ -1463,8 +1463,8 @@  discard block
 block discarded – undo
1463 1463
 		 *
1464 1464
 		 * @since 3.20.0
1465 1465
 		 */
1466
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php';
1467
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php';
1466
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/intf-wordlift-batch-operation.php';
1467
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/class-wordlift-batch-operation-ajax-adapter.php';
1468 1468
 
1469 1469
 		/*
1470 1470
 		 * Add the Search Keywords taxonomy to manage the Search Keywords on WLS.
@@ -1473,8 +1473,8 @@  discard block
 block discarded – undo
1473 1473
 		 *
1474 1474
 		 * @since 3.20.0
1475 1475
 		 */
1476
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php';
1477
-		new Wordlift_Search_Keyword_Taxonomy( $api_service );
1476
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php';
1477
+		new Wordlift_Search_Keyword_Taxonomy($api_service);
1478 1478
 
1479 1479
 		/*
1480 1480
 		 * Load the Mappings JSON-LD post processing.
@@ -1487,11 +1487,11 @@  discard block
 block discarded – undo
1487 1487
 		new Post_Type_Rule_Validator();
1488 1488
 		// Taxonomy term rule validator for validating rules for term pages.
1489 1489
 		new Taxonomy_Term_Rule_Validator();
1490
-		$rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator );
1491
-		$rule_groups_validator    = new Rule_Groups_Validator( $rule_validators_registry );
1492
-		$mappings_validator       = new Mappings_Validator( $mappings_dbo, $rule_groups_validator );
1490
+		$rule_validators_registry = new Rule_Validators_Registry($default_rule_validator);
1491
+		$rule_groups_validator    = new Rule_Groups_Validator($rule_validators_registry);
1492
+		$mappings_validator       = new Mappings_Validator($mappings_dbo, $rule_groups_validator);
1493 1493
 
1494
-		new Url_To_Entity_Transform_Function( $this->entity_uri_service );
1494
+		new Url_To_Entity_Transform_Function($this->entity_uri_service);
1495 1495
 		new Taxonomy_To_Terms_Transform_Function();
1496 1496
 		new Post_Id_To_Entity_Transform_Function();
1497 1497
 		$mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry();
@@ -1501,7 +1501,7 @@  discard block
 block discarded – undo
1501 1501
 		 * Intiailize the acf group data formatter.
1502 1502
 		 */
1503 1503
 		new Acf_Group_Formatter();
1504
-		new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry );
1504
+		new Jsonld_Converter($mappings_validator, $mappings_transform_functions_registry);
1505 1505
 
1506 1506
 		/**
1507 1507
 		 * @since 3.26.0
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
 		/*
1523 1523
 		 * Create a singleton for the Analysis_Response_Ops_Factory.
1524 1524
 		 */
1525
-		$entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service );
1525
+		$entity_helper = new Entity_Helper($this->entity_uri_service, $this->entity_service);
1526 1526
 		new Analysis_Response_Ops_Factory(
1527 1527
 			$this->entity_uri_service,
1528 1528
 			$this->entity_service,
@@ -1532,11 +1532,11 @@  discard block
 block discarded – undo
1532 1532
 		);
1533 1533
 
1534 1534
 		/** WL Autocomplete. */
1535
-		$autocomplete_service       = new All_Autocomplete_Service( array(
1535
+		$autocomplete_service = new All_Autocomplete_Service(array(
1536 1536
 			new Local_Autocomplete_Service(),
1537
-			new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ),
1538
-		) );
1539
-		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service );
1537
+			new Linked_Data_Autocomplete_Service($this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service),
1538
+		));
1539
+		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter($autocomplete_service);
1540 1540
 
1541 1541
 		/**
1542 1542
 		 * @since 3.27.2
@@ -1545,10 +1545,10 @@  discard block
 block discarded – undo
1545 1545
 		 */
1546 1546
 		new Recipe_Maker_Post_Type_Hook();
1547 1547
 		$recipe_maker_validation_service = new Recipe_Maker_Validation_Service();
1548
-		new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service );
1549
-		new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service );
1550
-		new Recipe_Maker_Warning( $recipe_maker_validation_service );
1551
-		new Yoast_Jsonld( $recipe_maker_validation_service );
1548
+		new Recipe_Maker_Jsonld_Hook($attachment_service, $recipe_maker_validation_service);
1549
+		new Recipe_Maker_After_Get_Jsonld_Hook($recipe_maker_validation_service);
1550
+		new Recipe_Maker_Warning($recipe_maker_validation_service);
1551
+		new Yoast_Jsonld($recipe_maker_validation_service);
1552 1552
 
1553 1553
 		/**
1554 1554
 		 * @since 3.27.4
@@ -1569,9 +1569,9 @@  discard block
 block discarded – undo
1569 1569
 	private function set_locale() {
1570 1570
 
1571 1571
 		$plugin_i18n = new Wordlift_i18n();
1572
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1572
+		$plugin_i18n->set_domain($this->get_plugin_name());
1573 1573
 
1574
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1574
+		$this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain');
1575 1575
 
1576 1576
 	}
1577 1577
 
@@ -1592,29 +1592,29 @@  discard block
 block discarded – undo
1592 1592
 			$this->user_service
1593 1593
 		);
1594 1594
 
1595
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1596
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 );
1595
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles');
1596
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11);
1597 1597
 
1598 1598
 		// Hook the init action to taxonomy services.
1599
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1600
-		$this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 );
1599
+		$this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0);
1600
+		$this->loader->add_action('init', $this->entity_types_taxonomy_service, 'init', 0);
1601 1601
 
1602 1602
 		// Hook the deleted_post_meta action to the Thumbnail service.
1603
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1603
+		$this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4);
1604 1604
 
1605 1605
 		// Hook the added_post_meta action to the Thumbnail service.
1606
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1606
+		$this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4);
1607 1607
 
1608 1608
 		// Hook the updated_post_meta action to the Thumbnail service.
1609
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1609
+		$this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4);
1610 1610
 
1611 1611
 		// Hook the AJAX wl_timeline action to the Timeline service.
1612
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1612
+		$this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline');
1613 1613
 
1614 1614
 		// Register custom allowed redirect hosts.
1615
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1615
+		$this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts');
1616 1616
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1617
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1617
+		$this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect');
1618 1618
 
1619 1619
 		/*
1620 1620
 		 * The old dashboard is replaced with dashboard v2.
@@ -1632,46 +1632,46 @@  discard block
 block discarded – undo
1632 1632
 
1633 1633
 		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1634 1634
 		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1635
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1636
-		$this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1635
+		$this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3);
1636
+		$this->loader->add_action('save_post', $this->rating_service, 'set_rating_for', 20, 1);
1637 1637
 
1638
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1639
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1638
+		$this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1);
1639
+		$this->loader->add_action('in_admin_header', $this->rating_service, 'in_admin_header');
1640 1640
 
1641 1641
 		// Entity listing customization (wp-admin/edit.php)
1642 1642
 		// Add custom columns.
1643
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1643
+		$this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns');
1644 1644
 		// no explicit entity as it prevents handling of other post types.
1645
-		$this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1645
+		$this->loader->add_filter('manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2);
1646 1646
 		// Add 4W selection.
1647
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1648
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1649
-		$this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1650
-		$this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1647
+		$this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope');
1648
+		$this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope');
1649
+		$this->loader->add_action('pre_get_posts', $this->entity_list_service, 'pre_get_posts');
1650
+		$this->loader->add_action('load-edit.php', $this->entity_list_service, 'load_edit');
1651 1651
 
1652 1652
 		/*
1653 1653
 		 * If `All Entity Types` is disable, use the radio button Walker.
1654 1654
 		 *
1655 1655
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1656 1656
 		 */
1657
-		if ( ! WL_ALL_ENTITY_TYPES ) {
1658
-			$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1657
+		if ( ! WL_ALL_ENTITY_TYPES) {
1658
+			$this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args');
1659 1659
 		}
1660 1660
 
1661 1661
 		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1662 1662
 		// entities.
1663
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1663
+		$this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2);
1664 1664
 
1665 1665
 		// Filter imported post meta.
1666
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1666
+		$this->loader->add_filter('wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3);
1667 1667
 
1668 1668
 		// Notify the import service when an import starts and ends.
1669
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1670
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1669
+		$this->loader->add_action('import_start', $this->import_service, 'import_start', 10, 0);
1670
+		$this->loader->add_action('import_end', $this->import_service, 'import_end', 10, 0);
1671 1671
 
1672 1672
 		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1673
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1674
-		$this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' );
1673
+		$this->loader->add_action('wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild');
1674
+		$this->loader->add_action('wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild');
1675 1675
 
1676 1676
 		/**
1677 1677
 		 * Filter: wl_feature__enable__screens.
@@ -1681,34 +1681,34 @@  discard block
 block discarded – undo
1681 1681
 		 * @return bool
1682 1682
 		 * @since 3.27.6
1683 1683
 		 */
1684
-		if ( apply_filters( 'wl_feature__enable__screens', true ) ) {
1684
+		if (apply_filters('wl_feature__enable__screens', true)) {
1685 1685
 			// Hook the menu to the Download Your Data page.
1686
-			$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1687
-			$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1688
-			$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1686
+			$this->loader->add_action('admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0);
1687
+			$this->loader->add_action('admin_menu', $this->status_page, 'admin_menu', 100, 0);
1688
+			$this->loader->add_action('admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0);
1689 1689
 		}
1690 1690
 		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1691
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1691
+		$this->loader->add_action('wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10);
1692 1692
 
1693 1693
 		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1694
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1695
-		$this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' );
1696
-		$this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1694
+		$this->loader->add_action('wp_ajax_wl_jsonld', $this->jsonld_service, 'get');
1695
+		$this->loader->add_action('admin_post_wl_jsonld', $this->jsonld_service, 'get');
1696
+		$this->loader->add_action('admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get');
1697 1697
 
1698 1698
 		// Hook the AJAX wl_validate_key action to the Key Validation service.
1699
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1699
+		$this->loader->add_action('wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key');
1700 1700
 
1701 1701
 		// Hook the AJAX wl_update_country_options action to the countries.
1702
-		$this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' );
1702
+		$this->loader->add_action('wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html');
1703 1703
 
1704 1704
 		// Hook the `admin_init` function to the Admin Setup.
1705
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1705
+		$this->loader->add_action('admin_init', $this->admin_setup, 'admin_init');
1706 1706
 
1707 1707
 		// Hook the admin_init to the settings page.
1708
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1709
-		$this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' );
1708
+		$this->loader->add_action('admin_init', $this->settings_page, 'admin_init');
1709
+		$this->loader->add_action('admin_init', $this->analytics_settings_page, 'admin_init');
1710 1710
 
1711
-		$this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' );
1711
+		$this->loader->add_filter('admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction');
1712 1712
 
1713 1713
 		// Hook the menu creation on the general wordlift menu creation.
1714 1714
 		/**
@@ -1719,8 +1719,8 @@  discard block
 block discarded – undo
1719 1719
 		 * @return bool
1720 1720
 		 * @since 3.27.6
1721 1721
 		 */
1722
-		if ( apply_filters( 'wl_feature__enable__screens', true ) ) {
1723
-			$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1722
+		if (apply_filters('wl_feature__enable__screens', true)) {
1723
+			$this->loader->add_action('wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2);
1724 1724
 		}
1725 1725
 		/*
1726 1726
 		 * Display the `Wordlift_Admin_Search_Rankings_Page` page.
@@ -1729,7 +1729,7 @@  discard block
 block discarded – undo
1729 1729
 		 *
1730 1730
 		 * @since 3.20.0
1731 1731
 		 */
1732
-		if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) {
1732
+		if (in_array($this->configuration_service->get_package_type(), array('editorial', 'business'))) {
1733 1733
 			/**
1734 1734
 			 * Filter: wl_feature__enable__screens.
1735 1735
 			 *
@@ -1738,18 +1738,18 @@  discard block
 block discarded – undo
1738 1738
 			 * @return bool
1739 1739
 			 * @since 3.27.6
1740 1740
 			 */
1741
-			if ( apply_filters( 'wl_feature__enable__screens', true ) ) {
1741
+			if (apply_filters('wl_feature__enable__screens', true)) {
1742 1742
 				$admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page();
1743
-				$this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' );
1743
+				$this->loader->add_action('wl_admin_menu', $admin_search_rankings_page, 'admin_menu');
1744 1744
 			}
1745 1745
 		}
1746 1746
 
1747 1747
 		// Hook key update.
1748
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1749
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1748
+		$this->loader->add_action('pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2);
1749
+		$this->loader->add_action('update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2);
1750 1750
 
1751 1751
 		// Add additional action links to the WordLift plugin in the plugins page.
1752
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1752
+		$this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1);
1753 1753
 
1754 1754
 		/*
1755 1755
 		 * Remove the Analytics Settings link from the plugin page.
@@ -1760,25 +1760,25 @@  discard block
 block discarded – undo
1760 1760
 		// $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 );
1761 1761
 
1762 1762
 		// Hook the AJAX `wl_publisher` action name.
1763
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1763
+		$this->loader->add_action('wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher');
1764 1764
 
1765 1765
 		// Hook row actions for the entity type list admin.
1766
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1766
+		$this->loader->add_filter('wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2);
1767 1767
 
1768 1768
 		/** Ajax actions. */
1769
-		$this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1769
+		$this->loader->add_action('wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export');
1770 1770
 
1771 1771
 		// Hook capabilities manipulation to allow access to entity type admin
1772 1772
 		// page  on WordPress versions before 4.7.
1773 1773
 		global $wp_version;
1774
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1775
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1774
+		if (version_compare($wp_version, '4.7', '<')) {
1775
+			$this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4);
1776 1776
 		}
1777 1777
 
1778
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1778
+		$this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1);
1779 1779
 
1780 1780
 		/** Adapters. */
1781
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1781
+		$this->loader->add_filter('mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1);
1782 1782
 		/**
1783 1783
 		 * Disabling Faq temporarily.
1784 1784
 		 * Load the tinymce editor button on the tool bar.
@@ -1789,56 +1789,56 @@  discard block
 block discarded – undo
1789 1789
 		//$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 );
1790 1790
 
1791 1791
 
1792
-		$this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1793
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1794
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1792
+		$this->loader->add_action('wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all');
1793
+		$this->loader->add_action('wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create');
1794
+		$this->loader->add_action('wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete');
1795 1795
 		/**
1796 1796
 		 * @since 3.26.0
1797 1797
 		 */
1798
-		if ( apply_filters( 'wl_feature__enable__post_excerpt', true ) ) {
1798
+		if (apply_filters('wl_feature__enable__post_excerpt', true)) {
1799 1799
 			$excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter();
1800
-			$this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' );
1800
+			$this->loader->add_action('do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box');
1801 1801
 			// Adding Rest route for the post excerpt
1802 1802
 			Post_Excerpt_Rest_Controller::register_routes();
1803 1803
 		}
1804 1804
 
1805
-		$this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 );
1806
-		$this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 );
1805
+		$this->loader->add_action('update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5);
1806
+		$this->loader->add_action('delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5);
1807 1807
 
1808 1808
 		// Handle the autocomplete request.
1809
-		add_action( 'wp_ajax_wl_autocomplete', array(
1809
+		add_action('wp_ajax_wl_autocomplete', array(
1810 1810
 			$this->autocomplete_adapter,
1811 1811
 			'wl_autocomplete',
1812
-		) );
1813
-		add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1812
+		));
1813
+		add_action('wp_ajax_nopriv_wl_autocomplete', array(
1814 1814
 			$this->autocomplete_adapter,
1815 1815
 			'wl_autocomplete',
1816
-		) );
1816
+		));
1817 1817
 
1818 1818
 		// Hooks to restrict multisite super admin from manipulating entity types.
1819
-		if ( is_multisite() ) {
1820
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1819
+		if (is_multisite()) {
1820
+			$this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4);
1821 1821
 		}
1822 1822
 
1823
-		$deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service );
1823
+		$deactivator_feedback = new Wordlift_Deactivator_Feedback($this->configuration_service);
1824 1824
 
1825
-		add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) );
1826
-		add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) );
1827
-		add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) );
1825
+		add_action('admin_footer', array($deactivator_feedback, 'render_feedback_popup'));
1826
+		add_action('admin_enqueue_scripts', array($deactivator_feedback, 'enqueue_popup_scripts'));
1827
+		add_action('wp_ajax_wl_deactivation_feedback', array($deactivator_feedback, 'wl_deactivation_feedback'));
1828 1828
 
1829 1829
 		/**
1830 1830
 		 * Always allow the `wordlift/classification` block.
1831 1831
 		 *
1832 1832
 		 * @since 3.23.0
1833 1833
 		 */
1834
-		add_filter( 'allowed_block_types', function ( $value ) {
1834
+		add_filter('allowed_block_types', function($value) {
1835 1835
 
1836
-			if ( true === $value ) {
1836
+			if (true === $value) {
1837 1837
 				return $value;
1838 1838
 			}
1839 1839
 
1840
-			return array_merge( (array) $value, array( 'wordlift/classification' ) );
1841
-		}, PHP_INT_MAX );
1840
+			return array_merge((array) $value, array('wordlift/classification'));
1841
+		}, PHP_INT_MAX);
1842 1842
 
1843 1843
 		/**
1844 1844
 		 * @since 3.27.7
@@ -1856,58 +1856,58 @@  discard block
 block discarded – undo
1856 1856
 	 */
1857 1857
 	private function define_public_hooks() {
1858 1858
 
1859
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1859
+		$plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version());
1860 1860
 
1861 1861
 		// Register the entity post type.
1862
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1862
+		$this->loader->add_action('init', $this->entity_post_type_service, 'register');
1863 1863
 
1864 1864
 		// Bind the link generation and handling hooks to the entity link service.
1865
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1866
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1865
+		$this->loader->add_filter('post_type_link', $this->entity_link_service, 'post_type_link', 10, 4);
1866
+		$this->loader->add_action('pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1);
1867 1867
 		// $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 );
1868 1868
 		// $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 );
1869 1869
 
1870
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1871
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1872
-		$this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' );
1870
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles');
1871
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts');
1872
+		$this->loader->add_action('wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts');
1873 1873
 
1874 1874
 		// Registering Faq_Content_Filter service used for removing faq question and answer tags from the html.
1875
-		$this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' );
1875
+		$this->loader->add_filter('the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags');
1876 1876
 		// Hook the content filter service to add entity links.
1877
-		if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1878
-			$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1877
+		if ( ! defined('WL_DISABLE_CONTENT_FILTER') || ! WL_DISABLE_CONTENT_FILTER) {
1878
+			$this->loader->add_filter('the_content', $this->content_filter_service, 'the_content');
1879 1879
 		}
1880 1880
 
1881 1881
 		// Hook the AJAX wl_timeline action to the Timeline service.
1882
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1882
+		$this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline');
1883 1883
 
1884 1884
 		// Hook the ShareThis service.
1885
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1886
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1885
+		$this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99);
1886
+		$this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99);
1887 1887
 
1888 1888
 		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1889
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1889
+		$this->loader->add_action('wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get');
1890 1890
 
1891 1891
 		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1892 1892
 		// in order to tweak WP's `WP_Query` to include entities in queries related
1893 1893
 		// to categories.
1894
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1894
+		$this->loader->add_action('pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1);
1895 1895
 
1896 1896
 		/*
1897 1897
 		 * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service`
1898 1898
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1899 1899
 		 * order of start time.
1900 1900
 		 */
1901
-		$this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1901
+		$this->loader->add_action('pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1);
1902 1902
 
1903
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1903
+		$this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1);
1904 1904
 
1905 1905
 		// This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1906
-		$this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1906
+		$this->loader->add_action('save_post', $this->entity_type_adapter, 'save_post', 9, 3);
1907 1907
 
1908 1908
 		// Analytics Script Frontend.
1909
-		if ( $this->configuration_service->is_analytics_enable() ) {
1910
-			$this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 );
1909
+		if ($this->configuration_service->is_analytics_enable()) {
1910
+			$this->loader->add_action('wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10);
1911 1911
 		}
1912 1912
 
1913 1913
 	}
@@ -1960,11 +1960,11 @@  discard block
 block discarded – undo
1960 1960
 	 */
1961 1961
 	private function load_cli_dependencies() {
1962 1962
 
1963
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php';
1963
+		require_once plugin_dir_path(dirname(__FILE__)).'cli/class-wordlift-push-reference-data-command.php';
1964 1964
 
1965
-		$push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service );
1965
+		$push_reference_data_command = new Wordlift_Push_Reference_Data_Command($this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service);
1966 1966
 
1967
-		WP_CLI::add_command( 'wl references push', $push_reference_data_command );
1967
+		WP_CLI::add_command('wl references push', $push_reference_data_command);
1968 1968
 
1969 1969
 	}
1970 1970
 
@@ -1989,13 +1989,13 @@  discard block
 block discarded – undo
1989 1989
 		 * @since 3.27.6
1990 1990
 		 */
1991 1991
 
1992
-		wp_register_script( 'wl_enabled_blocks', false );
1992
+		wp_register_script('wl_enabled_blocks', false);
1993 1993
 
1994
-		$enabled_blocks = array( 'wordlift/products-navigator' );
1994
+		$enabled_blocks = array('wordlift/products-navigator');
1995 1995
 
1996
-		if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
1996
+		if (apply_filters('wl_feature__enable__blocks', true)) {
1997 1997
 			// To intimate JS
1998
-			$enabled_blocks = array_merge( $enabled_blocks, array(
1998
+			$enabled_blocks = array_merge($enabled_blocks, array(
1999 1999
 				'wordlift/navigator',
2000 2000
 				'wordlift/chord',
2001 2001
 				'wordlift/geomap',
@@ -2003,11 +2003,11 @@  discard block
 block discarded – undo
2003 2003
 				'wordlift/cloud',
2004 2004
 				'wordlift/vocabulary',
2005 2005
 				'wordlift/faceted-search'
2006
-			) );
2006
+			));
2007 2007
 		}
2008 2008
 
2009
-		wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks );
2010
-		wp_enqueue_script( 'wl_enabled_blocks' );
2009
+		wp_localize_script('wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks);
2010
+		wp_enqueue_script('wl_enabled_blocks');
2011 2011
 	}
2012 2012
 
2013 2013
 }
Please login to merge, or discard this patch.