Completed
Push — develop ( f5cfcc...e2baaf )
by Naveen
01:17
created
src/shortcodes/wordlift_shortcode_navigator.php 2 patches
Indentation   +268 added lines, -268 removed lines patch added patch discarded remove patch
@@ -20,32 +20,32 @@  discard block
 block discarded – undo
20 20
  */
21 21
 function wl_shortcode_navigator_data() {
22 22
 
23
-	// Create the cache key.
24
-	$cache_key_params = $_REQUEST;
25
-	unset( $cache_key_params['uniqid'] );
26
-	$cache_key = array( 'request_params' => $cache_key_params );
23
+    // Create the cache key.
24
+    $cache_key_params = $_REQUEST;
25
+    unset( $cache_key_params['uniqid'] );
26
+    $cache_key = array( 'request_params' => $cache_key_params );
27 27
 
28
-	// Create the TTL cache and try to get the results.
29
-	$cache         = new Ttl_Cache( "navigator", 8 * 60 * 60 ); // 8 hours.
30
-	$cache_results = $cache->get( $cache_key );
28
+    // Create the TTL cache and try to get the results.
29
+    $cache         = new Ttl_Cache( "navigator", 8 * 60 * 60 ); // 8 hours.
30
+    $cache_results = $cache->get( $cache_key );
31 31
 
32
-	// So that the endpoint can be used remotely
33
-	header( 'Access-Control-Allow-Origin: *' );
32
+    // So that the endpoint can be used remotely
33
+    header( 'Access-Control-Allow-Origin: *' );
34 34
 
35
-	if ( isset( $cache_results ) ) {
36
-		header( 'X-WordLift-Cache: HIT' );
35
+    if ( isset( $cache_results ) ) {
36
+        header( 'X-WordLift-Cache: HIT' );
37 37
 
38
-		return $cache_results;
39
-	}
38
+        return $cache_results;
39
+    }
40 40
 
41
-	header( 'X-WordLift-Cache: MISS' );
41
+    header( 'X-WordLift-Cache: MISS' );
42 42
 
43
-	$results = _wl_navigator_get_data();
43
+    $results = _wl_navigator_get_data();
44 44
 
45
-	// Put the result before sending the json to the client, since sending the json will terminate us.
46
-	$cache->put( $cache_key, $results );
45
+    // Put the result before sending the json to the client, since sending the json will terminate us.
46
+    $cache->put( $cache_key, $results );
47 47
 
48
-	return $results;
48
+    return $results;
49 49
 }
50 50
 
51 51
 /**
@@ -60,240 +60,240 @@  discard block
 block discarded – undo
60 60
  */
61 61
 function wl_network_navigator_wp_json( $request ) {
62 62
 
63
-	// Create the cache key.
64
-	$cache_key_params = $_REQUEST;
65
-	unset( $cache_key_params['uniqid'] );
66
-	$cache_key = array( 'request_params' => $cache_key_params );
63
+    // Create the cache key.
64
+    $cache_key_params = $_REQUEST;
65
+    unset( $cache_key_params['uniqid'] );
66
+    $cache_key = array( 'request_params' => $cache_key_params );
67 67
 
68
-	// Create the TTL cache and try to get the results.
69
-	$cache         = new Ttl_Cache( "network-navigator", 8 * 60 * 60 ); // 8 hours.
70
-	$cache_results = $cache->get( $cache_key );
68
+    // Create the TTL cache and try to get the results.
69
+    $cache         = new Ttl_Cache( "network-navigator", 8 * 60 * 60 ); // 8 hours.
70
+    $cache_results = $cache->get( $cache_key );
71 71
 
72
-	if ( isset( $cache_results ) ) {
73
-		header( 'X-WordLift-Cache: HIT' );
72
+    if ( isset( $cache_results ) ) {
73
+        header( 'X-WordLift-Cache: HIT' );
74 74
 
75
-		return $cache_results;
76
-	}
75
+        return $cache_results;
76
+    }
77 77
 
78
-	header( 'X-WordLift-Cache: MISS' );
78
+    header( 'X-WordLift-Cache: MISS' );
79 79
 
80
-	$results = _wl_network_navigator_get_data( $request );
80
+    $results = _wl_network_navigator_get_data( $request );
81 81
 
82
-	// Put the result before sending the json to the client, since sending the json will terminate us.
83
-	$cache->put( $cache_key, $results );
82
+    // Put the result before sending the json to the client, since sending the json will terminate us.
83
+    $cache->put( $cache_key, $results );
84 84
 
85
-	return $results;
85
+    return $results;
86 86
 
87 87
 }
88 88
 
89 89
 function _wl_navigator_get_data() {
90 90
 
91
-	// Post ID must be defined
92
-	if ( ! isset( $_GET['post_id'] ) ) {
93
-		wp_send_json_error( 'No post_id given' );
94
-
95
-		return array();
96
-	}
97
-
98
-	// Post ID must be defined
99
-	if ( ! isset( $_GET['uniqid'] ) ) {
100
-		wp_send_json_error( 'No uniqid given' );
101
-
102
-		return array();
103
-	}
104
-
105
-	// Limit the results (defaults to 4)
106
-	$navigator_length    = isset( $_GET['limit'] ) ? intval( $_GET['limit'] ) : 4;
107
-	$navigator_offset    = isset( $_GET['offset'] ) ? intval( $_GET['offset'] ) : 0;
108
-	$order_by            = isset( $_GET['sort'] ) ? sanitize_sql_orderby( $_GET['sort'] ) : 'ID DESC';
109
-	$post_types          = isset( $_GET['post_types'] ) ? (string) $_GET['post_types'] : '';
110
-	$post_types          = explode( ',', $post_types );
111
-	$existing_post_types = get_post_types();
112
-	$post_types          = array_values( array_intersect( $existing_post_types, $post_types ) );
113
-	$current_post_id     = (int) $_GET['post_id'];
114
-	$current_post        = get_post( $current_post_id );
115
-
116
-	$navigator_id = (string) $_GET['uniqid'];
117
-
118
-	// Post ID has to match an existing item
119
-	if ( null === $current_post ) {
120
-		wp_send_json_error( 'No valid post_id given' );
121
-
122
-		return array();
123
-	}
124
-
125
-	// Determine navigator type and call respective _get_results
126
-	if ( get_post_type( $current_post_id ) === Wordlift_Entity_Service::TYPE_NAME ) {
127
-
128
-		$referencing_posts = Navigator_Data::entity_navigator_get_results( $current_post_id, array(
129
-			'ID',
130
-			'post_title',
131
-		), $order_by, $navigator_length, $navigator_offset, $post_types );
132
-	} else {
133
-		$referencing_posts = Navigator_Data::post_navigator_get_results( $current_post_id, array(
134
-			'ID',
135
-			'post_title',
136
-		), $order_by, $navigator_length, $navigator_offset, $post_types );
137
-
138
-	}
139
-
140
-	// loop over them and take the first one which is not already in the $related_posts
141
-	$results = array();
142
-	foreach ( $referencing_posts as $referencing_post ) {
143
-		$serialized_entity = wl_serialize_entity( $referencing_post->entity_id );
144
-
145
-		/**
146
-		 * Use the thumbnail.
147
-		 *
148
-		 * @see https://github.com/insideout10/wordlift-plugin/issues/825 related issue.
149
-		 * @see https://github.com/insideout10/wordlift-plugin/issues/837
150
-		 *
151
-		 * @since 3.19.3 We're using the medium size image.
152
-		 */
153
-		$thumbnail = get_the_post_thumbnail_url( $referencing_post, 'medium' );
154
-
155
-		$result = array(
156
-			'post'   => array(
157
-				'id'        => $referencing_post->ID,
158
-				'permalink' => get_permalink( $referencing_post->ID ),
159
-				'title'     => html_entity_decode( $referencing_post->post_title, ENT_QUOTES, 'UTF-8' ),
160
-				'thumbnail' => $thumbnail,
161
-				'srcset'    => Srcset_Util::get_srcset( $referencing_post->ID, Srcset_Util::NAVIGATOR_WIDGET )
162
-			),
163
-			'entity' => array(
164
-				'id'        => $referencing_post->entity_id,
165
-				'label'     => $serialized_entity['label'],
166
-				'mainType'  => $serialized_entity['mainType'],
167
-				'permalink' => get_permalink( $referencing_post->entity_id ),
168
-			),
169
-		);
170
-
171
-		$results[] = $result;
172
-	}
173
-
174
-
175
-	if ( count( $results ) < $navigator_length ) {
176
-		$results = apply_filters( 'wl_navigator_data_placeholder', $results, $navigator_id, $navigator_offset, $navigator_length );
177
-	}
178
-
179
-	// Add filler posts if needed
180
-	$filler_count = $navigator_length - count( $results );
181
-	if ( $filler_count > 0 ) {
182
-		$referencing_post_ids = array_map( function ( $p ) {
183
-			return $p->ID;
184
-		}, $referencing_posts );
185
-		/**
186
-		 * @since 3.27.8
187
-		 * Filler posts are fetched using this util.
188
-		 */
189
-		$filler_posts_util       = new Filler_Posts_Util( $current_post_id, $post_types );
190
-		$post_ids_to_be_excluded = array_merge( array( $current_post_id ), $referencing_post_ids );
191
-		$filler_posts            = $filler_posts_util->get_filler_response( $filler_count, $post_ids_to_be_excluded );
192
-		$results                 = array_merge( $results, $filler_posts );
193
-	}
194
-
195
-	// Apply filters after fillers are added
196
-	foreach ( $results as $result_index => $result ) {
197
-		$results[ $result_index ]['post']   = apply_filters( 'wl_navigator_data_post', $result['post'], intval( $result['post']['id'] ), $navigator_id );
198
-		$results[ $result_index ]['entity'] = apply_filters( 'wl_navigator_data_entity', $result['entity'], intval( $result['entity']['id'] ), $navigator_id );
199
-	}
200
-
201
-	$results = apply_filters( 'wl_navigator_results', $results, $navigator_id, $current_post_id );
202
-
203
-	return $results;
91
+    // Post ID must be defined
92
+    if ( ! isset( $_GET['post_id'] ) ) {
93
+        wp_send_json_error( 'No post_id given' );
94
+
95
+        return array();
96
+    }
97
+
98
+    // Post ID must be defined
99
+    if ( ! isset( $_GET['uniqid'] ) ) {
100
+        wp_send_json_error( 'No uniqid given' );
101
+
102
+        return array();
103
+    }
104
+
105
+    // Limit the results (defaults to 4)
106
+    $navigator_length    = isset( $_GET['limit'] ) ? intval( $_GET['limit'] ) : 4;
107
+    $navigator_offset    = isset( $_GET['offset'] ) ? intval( $_GET['offset'] ) : 0;
108
+    $order_by            = isset( $_GET['sort'] ) ? sanitize_sql_orderby( $_GET['sort'] ) : 'ID DESC';
109
+    $post_types          = isset( $_GET['post_types'] ) ? (string) $_GET['post_types'] : '';
110
+    $post_types          = explode( ',', $post_types );
111
+    $existing_post_types = get_post_types();
112
+    $post_types          = array_values( array_intersect( $existing_post_types, $post_types ) );
113
+    $current_post_id     = (int) $_GET['post_id'];
114
+    $current_post        = get_post( $current_post_id );
115
+
116
+    $navigator_id = (string) $_GET['uniqid'];
117
+
118
+    // Post ID has to match an existing item
119
+    if ( null === $current_post ) {
120
+        wp_send_json_error( 'No valid post_id given' );
121
+
122
+        return array();
123
+    }
124
+
125
+    // Determine navigator type and call respective _get_results
126
+    if ( get_post_type( $current_post_id ) === Wordlift_Entity_Service::TYPE_NAME ) {
127
+
128
+        $referencing_posts = Navigator_Data::entity_navigator_get_results( $current_post_id, array(
129
+            'ID',
130
+            'post_title',
131
+        ), $order_by, $navigator_length, $navigator_offset, $post_types );
132
+    } else {
133
+        $referencing_posts = Navigator_Data::post_navigator_get_results( $current_post_id, array(
134
+            'ID',
135
+            'post_title',
136
+        ), $order_by, $navigator_length, $navigator_offset, $post_types );
137
+
138
+    }
139
+
140
+    // loop over them and take the first one which is not already in the $related_posts
141
+    $results = array();
142
+    foreach ( $referencing_posts as $referencing_post ) {
143
+        $serialized_entity = wl_serialize_entity( $referencing_post->entity_id );
144
+
145
+        /**
146
+         * Use the thumbnail.
147
+         *
148
+         * @see https://github.com/insideout10/wordlift-plugin/issues/825 related issue.
149
+         * @see https://github.com/insideout10/wordlift-plugin/issues/837
150
+         *
151
+         * @since 3.19.3 We're using the medium size image.
152
+         */
153
+        $thumbnail = get_the_post_thumbnail_url( $referencing_post, 'medium' );
154
+
155
+        $result = array(
156
+            'post'   => array(
157
+                'id'        => $referencing_post->ID,
158
+                'permalink' => get_permalink( $referencing_post->ID ),
159
+                'title'     => html_entity_decode( $referencing_post->post_title, ENT_QUOTES, 'UTF-8' ),
160
+                'thumbnail' => $thumbnail,
161
+                'srcset'    => Srcset_Util::get_srcset( $referencing_post->ID, Srcset_Util::NAVIGATOR_WIDGET )
162
+            ),
163
+            'entity' => array(
164
+                'id'        => $referencing_post->entity_id,
165
+                'label'     => $serialized_entity['label'],
166
+                'mainType'  => $serialized_entity['mainType'],
167
+                'permalink' => get_permalink( $referencing_post->entity_id ),
168
+            ),
169
+        );
170
+
171
+        $results[] = $result;
172
+    }
173
+
174
+
175
+    if ( count( $results ) < $navigator_length ) {
176
+        $results = apply_filters( 'wl_navigator_data_placeholder', $results, $navigator_id, $navigator_offset, $navigator_length );
177
+    }
178
+
179
+    // Add filler posts if needed
180
+    $filler_count = $navigator_length - count( $results );
181
+    if ( $filler_count > 0 ) {
182
+        $referencing_post_ids = array_map( function ( $p ) {
183
+            return $p->ID;
184
+        }, $referencing_posts );
185
+        /**
186
+         * @since 3.27.8
187
+         * Filler posts are fetched using this util.
188
+         */
189
+        $filler_posts_util       = new Filler_Posts_Util( $current_post_id, $post_types );
190
+        $post_ids_to_be_excluded = array_merge( array( $current_post_id ), $referencing_post_ids );
191
+        $filler_posts            = $filler_posts_util->get_filler_response( $filler_count, $post_ids_to_be_excluded );
192
+        $results                 = array_merge( $results, $filler_posts );
193
+    }
194
+
195
+    // Apply filters after fillers are added
196
+    foreach ( $results as $result_index => $result ) {
197
+        $results[ $result_index ]['post']   = apply_filters( 'wl_navigator_data_post', $result['post'], intval( $result['post']['id'] ), $navigator_id );
198
+        $results[ $result_index ]['entity'] = apply_filters( 'wl_navigator_data_entity', $result['entity'], intval( $result['entity']['id'] ), $navigator_id );
199
+    }
200
+
201
+    $results = apply_filters( 'wl_navigator_results', $results, $navigator_id, $current_post_id );
202
+
203
+    return $results;
204 204
 }
205 205
 
206 206
 function _wl_network_navigator_get_data( $request ) {
207 207
 
208
-	// Limit the results (defaults to 4)
209
-	$navigator_length = isset( $request['limit'] ) ? intval( $request['limit'] ) : 4;
210
-	$navigator_offset = isset( $request['offset'] ) ? intval( $request['offset'] ) : 0;
211
-	$navigator_id     = $request['uniqid'];
212
-	$order_by         = isset( $_GET['sort'] ) ? sanitize_sql_orderby( $_GET['sort'] ) : 'ID DESC';
213
-
214
-	$entities = $request['entities'];
215
-
216
-	// Post ID has to match an existing item
217
-	if ( ! isset( $entities ) || empty( $entities ) ) {
218
-		wp_send_json_error( 'No valid entities provided' );
219
-	}
220
-
221
-	$referencing_posts = _wl_network_navigator_get_results( $entities, array(
222
-		'ID',
223
-		'post_title',
224
-	), $order_by, $navigator_length, $navigator_offset );
225
-
226
-	// loop over them and take the first one which is not already in the $related_posts
227
-	$results = array();
228
-	foreach ( $referencing_posts as $referencing_post ) {
229
-		$serialized_entity = wl_serialize_entity( $referencing_post->entity_id );
230
-
231
-		/**
232
-		 * Use the thumbnail.
233
-		 *
234
-		 * @see https://github.com/insideout10/wordlift-plugin/issues/825 related issue.
235
-		 * @see https://github.com/insideout10/wordlift-plugin/issues/837
236
-		 *
237
-		 * @since 3.19.3 We're using the medium size image.
238
-		 */
239
-		$thumbnail = get_the_post_thumbnail_url( $referencing_post, 'medium' );
240
-
241
-		$result = array(
242
-			'post'   => array(
243
-				'permalink' => get_permalink( $referencing_post->ID ),
244
-				'title'     => $referencing_post->post_title,
245
-				'thumbnail' => $thumbnail,
246
-			),
247
-			'entity' => array(
248
-				'label'     => $serialized_entity['label'],
249
-				'mainType'  => $serialized_entity['mainType'],
250
-				'permalink' => get_permalink( $referencing_post->entity_id ),
251
-			),
252
-		);
253
-
254
-		$result['post']   = apply_filters( 'wl_network_navigator_data_post', $result['post'], intval( $referencing_post->ID ), $navigator_id );
255
-		$result['entity'] = apply_filters( 'wl_network_navigator_data_entity', $result['entity'], intval( $referencing_post->entity_id ), $navigator_id );
256
-
257
-		$results[] = $result;
258
-
259
-	}
260
-
261
-	if ( count( $results ) < $navigator_length ) {
262
-		$results = apply_filters( 'wl_network_navigator_data_placeholder', $results, $navigator_id, $navigator_offset, $navigator_length );
263
-	}
264
-
265
-	$results = apply_filters( 'wl_network_navigator_results', $results, $navigator_id );
266
-
267
-	return $results;
208
+    // Limit the results (defaults to 4)
209
+    $navigator_length = isset( $request['limit'] ) ? intval( $request['limit'] ) : 4;
210
+    $navigator_offset = isset( $request['offset'] ) ? intval( $request['offset'] ) : 0;
211
+    $navigator_id     = $request['uniqid'];
212
+    $order_by         = isset( $_GET['sort'] ) ? sanitize_sql_orderby( $_GET['sort'] ) : 'ID DESC';
213
+
214
+    $entities = $request['entities'];
215
+
216
+    // Post ID has to match an existing item
217
+    if ( ! isset( $entities ) || empty( $entities ) ) {
218
+        wp_send_json_error( 'No valid entities provided' );
219
+    }
220
+
221
+    $referencing_posts = _wl_network_navigator_get_results( $entities, array(
222
+        'ID',
223
+        'post_title',
224
+    ), $order_by, $navigator_length, $navigator_offset );
225
+
226
+    // loop over them and take the first one which is not already in the $related_posts
227
+    $results = array();
228
+    foreach ( $referencing_posts as $referencing_post ) {
229
+        $serialized_entity = wl_serialize_entity( $referencing_post->entity_id );
230
+
231
+        /**
232
+         * Use the thumbnail.
233
+         *
234
+         * @see https://github.com/insideout10/wordlift-plugin/issues/825 related issue.
235
+         * @see https://github.com/insideout10/wordlift-plugin/issues/837
236
+         *
237
+         * @since 3.19.3 We're using the medium size image.
238
+         */
239
+        $thumbnail = get_the_post_thumbnail_url( $referencing_post, 'medium' );
240
+
241
+        $result = array(
242
+            'post'   => array(
243
+                'permalink' => get_permalink( $referencing_post->ID ),
244
+                'title'     => $referencing_post->post_title,
245
+                'thumbnail' => $thumbnail,
246
+            ),
247
+            'entity' => array(
248
+                'label'     => $serialized_entity['label'],
249
+                'mainType'  => $serialized_entity['mainType'],
250
+                'permalink' => get_permalink( $referencing_post->entity_id ),
251
+            ),
252
+        );
253
+
254
+        $result['post']   = apply_filters( 'wl_network_navigator_data_post', $result['post'], intval( $referencing_post->ID ), $navigator_id );
255
+        $result['entity'] = apply_filters( 'wl_network_navigator_data_entity', $result['entity'], intval( $referencing_post->entity_id ), $navigator_id );
256
+
257
+        $results[] = $result;
258
+
259
+    }
260
+
261
+    if ( count( $results ) < $navigator_length ) {
262
+        $results = apply_filters( 'wl_network_navigator_data_placeholder', $results, $navigator_id, $navigator_offset, $navigator_length );
263
+    }
264
+
265
+    $results = apply_filters( 'wl_network_navigator_results', $results, $navigator_id );
266
+
267
+    return $results;
268 268
 
269 269
 }
270 270
 
271 271
 function _wl_network_navigator_get_results(
272
-	$entities, $fields = array(
273
-	'ID',
274
-	'post_title',
272
+    $entities, $fields = array(
273
+    'ID',
274
+    'post_title',
275 275
 ), $order_by = 'ID DESC', $limit = 10, $offset = 0
276 276
 ) {
277
-	global $wpdb;
278
-
279
-	$select = implode( ', ', array_map( function ( $item ) {
280
-		return "p.$item AS $item";
281
-	}, (array) $fields ) );
282
-
283
-	$order_by = implode( ', ', array_map( function ( $item ) {
284
-		return "p.$item";
285
-	}, (array) $order_by ) );
286
-
287
-	$entities_in = implode( ',', array_map( function ( $item ) {
288
-		$entity = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( urldecode( $item ) );
289
-		if ( isset( $entity ) ) {
290
-			return $entity->ID;
291
-		}
292
-	}, $entities ) );
293
-
294
-	/** @noinspection SqlNoDataSourceInspection */
295
-	return $wpdb->get_results(
296
-		$wpdb->prepare( <<<EOF
277
+    global $wpdb;
278
+
279
+    $select = implode( ', ', array_map( function ( $item ) {
280
+        return "p.$item AS $item";
281
+    }, (array) $fields ) );
282
+
283
+    $order_by = implode( ', ', array_map( function ( $item ) {
284
+        return "p.$item";
285
+    }, (array) $order_by ) );
286
+
287
+    $entities_in = implode( ',', array_map( function ( $item ) {
288
+        $entity = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( urldecode( $item ) );
289
+        if ( isset( $entity ) ) {
290
+            return $entity->ID;
291
+        }
292
+    }, $entities ) );
293
+
294
+    /** @noinspection SqlNoDataSourceInspection */
295
+    return $wpdb->get_results(
296
+        $wpdb->prepare( <<<EOF
297 297
 SELECT %3\$s, p2.ID as entity_id
298 298
  FROM {$wpdb->prefix}wl_relation_instances r1
299 299
 	-- get the ID of the post entity in common between the object and the subject 2. 
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
  LIMIT %1\$d
320 320
  OFFSET %2\$d
321 321
 EOF
322
-			, $limit, $offset, $select, $order_by )
323
-	);
322
+            , $limit, $offset, $select, $order_by )
323
+    );
324 324
 
325 325
 }
326 326
 
@@ -332,9 +332,9 @@  discard block
 block discarded – undo
332 332
  */
333 333
 function wl_shortcode_navigator_ajax() {
334 334
 
335
-	// Temporary blocking the Navigator.
336
-	$results = wl_shortcode_navigator_data();
337
-	wl_core_send_json( $results );
335
+    // Temporary blocking the Navigator.
336
+    $results = wl_shortcode_navigator_data();
337
+    wl_core_send_json( $results );
338 338
 
339 339
 }
340 340
 
@@ -346,16 +346,16 @@  discard block
 block discarded – undo
346 346
  */
347 347
 function wl_shortcode_navigator_wp_json() {
348 348
 
349
-	$results = wl_shortcode_navigator_data();
350
-	if ( ob_get_contents() ) {
351
-		ob_clean();
352
-	}
349
+    $results = wl_shortcode_navigator_data();
350
+    if ( ob_get_contents() ) {
351
+        ob_clean();
352
+    }
353 353
 
354
-	return array(
355
-		'items' => array(
356
-			array( 'values' => $results ),
357
-		),
358
-	);
354
+    return array(
355
+        'items' => array(
356
+            array( 'values' => $results ),
357
+        ),
358
+    );
359 359
 
360 360
 }
361 361
 
@@ -363,22 +363,22 @@  discard block
 block discarded – undo
363 363
  * Adding `rest_api_init` action for amp backend of navigator
364 364
  */
365 365
 add_action( 'rest_api_init', function () {
366
-	register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, '/navigator', array(
367
-		'methods'             => 'GET',
368
-		'permission_callback' => '__return_true',
369
-		'callback'            => 'wl_shortcode_navigator_wp_json'
370
-	) );
366
+    register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, '/navigator', array(
367
+        'methods'             => 'GET',
368
+        'permission_callback' => '__return_true',
369
+        'callback'            => 'wl_shortcode_navigator_wp_json'
370
+    ) );
371 371
 } );
372 372
 
373 373
 /**
374 374
  * Adding `rest_api_init` action for backend of network navigator
375 375
  */
376 376
 add_action( 'rest_api_init', function () {
377
-	register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, '/network-navigator', array(
378
-		'methods'             => 'GET',
379
-		'callback'            => 'wl_network_navigator_wp_json',
380
-		'permission_callback' => '__return_true',
381
-	) );
377
+    register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, '/network-navigator', array(
378
+        'methods'             => 'GET',
379
+        'callback'            => 'wl_network_navigator_wp_json',
380
+        'permission_callback' => '__return_true',
381
+    ) );
382 382
 } );
383 383
 
384 384
 /**
@@ -387,23 +387,23 @@  discard block
 block discarded – undo
387 387
  * @since 2.2.0
388 388
  */
389 389
 add_action( 'plugins_loaded', function () {
390
-	$action = array_key_exists( 'action', $_REQUEST ) ? (string) $_REQUEST['action'] : '';
391
-	if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || 'wl_navigator' !== $action ) {
392
-		return;
393
-	}
394
-
395
-	remove_action( 'plugins_loaded', 'rocket_init' );
396
-	remove_action( 'plugins_loaded', 'wpseo_premium_init', 14 );
397
-	remove_action( 'plugins_loaded', 'wpseo_init', 14 );
390
+    $action = array_key_exists( 'action', $_REQUEST ) ? (string) $_REQUEST['action'] : '';
391
+    if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || 'wl_navigator' !== $action ) {
392
+        return;
393
+    }
394
+
395
+    remove_action( 'plugins_loaded', 'rocket_init' );
396
+    remove_action( 'plugins_loaded', 'wpseo_premium_init', 14 );
397
+    remove_action( 'plugins_loaded', 'wpseo_init', 14 );
398 398
 }, 0 );
399 399
 
400 400
 add_action( 'init', function () {
401
-	$action = array_key_exists( 'action', $_REQUEST ) ? (string) $_REQUEST['action'] : '';
402
-	if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || 'wl_navigator' !== $action ) {
403
-		return;
404
-	}
401
+    $action = array_key_exists( 'action', $_REQUEST ) ? (string) $_REQUEST['action'] : '';
402
+    if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || 'wl_navigator' !== $action ) {
403
+        return;
404
+    }
405 405
 
406
-	remove_action( 'init', 'wp_widgets_init', 1 );
407
-	remove_action( 'init', 'gglcptch_init' );
406
+    remove_action( 'init', 'wp_widgets_init', 1 );
407
+    remove_action( 'init', 'gglcptch_init' );
408 408
 }, 0 );
409 409
 
Please login to merge, or discard this patch.
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -22,28 +22,28 @@  discard block
 block discarded – undo
22 22
 
23 23
 	// Create the cache key.
24 24
 	$cache_key_params = $_REQUEST;
25
-	unset( $cache_key_params['uniqid'] );
26
-	$cache_key = array( 'request_params' => $cache_key_params );
25
+	unset($cache_key_params['uniqid']);
26
+	$cache_key = array('request_params' => $cache_key_params);
27 27
 
28 28
 	// Create the TTL cache and try to get the results.
29
-	$cache         = new Ttl_Cache( "navigator", 8 * 60 * 60 ); // 8 hours.
30
-	$cache_results = $cache->get( $cache_key );
29
+	$cache         = new Ttl_Cache("navigator", 8 * 60 * 60); // 8 hours.
30
+	$cache_results = $cache->get($cache_key);
31 31
 
32 32
 	// So that the endpoint can be used remotely
33
-	header( 'Access-Control-Allow-Origin: *' );
33
+	header('Access-Control-Allow-Origin: *');
34 34
 
35
-	if ( isset( $cache_results ) ) {
36
-		header( 'X-WordLift-Cache: HIT' );
35
+	if (isset($cache_results)) {
36
+		header('X-WordLift-Cache: HIT');
37 37
 
38 38
 		return $cache_results;
39 39
 	}
40 40
 
41
-	header( 'X-WordLift-Cache: MISS' );
41
+	header('X-WordLift-Cache: MISS');
42 42
 
43 43
 	$results = _wl_navigator_get_data();
44 44
 
45 45
 	// Put the result before sending the json to the client, since sending the json will terminate us.
46
-	$cache->put( $cache_key, $results );
46
+	$cache->put($cache_key, $results);
47 47
 
48 48
 	return $results;
49 49
 }
@@ -58,29 +58,29 @@  discard block
 block discarded – undo
58 58
  * @since 3.22.6
59 59
  *
60 60
  */
61
-function wl_network_navigator_wp_json( $request ) {
61
+function wl_network_navigator_wp_json($request) {
62 62
 
63 63
 	// Create the cache key.
64 64
 	$cache_key_params = $_REQUEST;
65
-	unset( $cache_key_params['uniqid'] );
66
-	$cache_key = array( 'request_params' => $cache_key_params );
65
+	unset($cache_key_params['uniqid']);
66
+	$cache_key = array('request_params' => $cache_key_params);
67 67
 
68 68
 	// Create the TTL cache and try to get the results.
69
-	$cache         = new Ttl_Cache( "network-navigator", 8 * 60 * 60 ); // 8 hours.
70
-	$cache_results = $cache->get( $cache_key );
69
+	$cache         = new Ttl_Cache("network-navigator", 8 * 60 * 60); // 8 hours.
70
+	$cache_results = $cache->get($cache_key);
71 71
 
72
-	if ( isset( $cache_results ) ) {
73
-		header( 'X-WordLift-Cache: HIT' );
72
+	if (isset($cache_results)) {
73
+		header('X-WordLift-Cache: HIT');
74 74
 
75 75
 		return $cache_results;
76 76
 	}
77 77
 
78
-	header( 'X-WordLift-Cache: MISS' );
78
+	header('X-WordLift-Cache: MISS');
79 79
 
80
-	$results = _wl_network_navigator_get_data( $request );
80
+	$results = _wl_network_navigator_get_data($request);
81 81
 
82 82
 	// Put the result before sending the json to the client, since sending the json will terminate us.
83
-	$cache->put( $cache_key, $results );
83
+	$cache->put($cache_key, $results);
84 84
 
85 85
 	return $results;
86 86
 
@@ -89,58 +89,58 @@  discard block
 block discarded – undo
89 89
 function _wl_navigator_get_data() {
90 90
 
91 91
 	// Post ID must be defined
92
-	if ( ! isset( $_GET['post_id'] ) ) {
93
-		wp_send_json_error( 'No post_id given' );
92
+	if ( ! isset($_GET['post_id'])) {
93
+		wp_send_json_error('No post_id given');
94 94
 
95 95
 		return array();
96 96
 	}
97 97
 
98 98
 	// Post ID must be defined
99
-	if ( ! isset( $_GET['uniqid'] ) ) {
100
-		wp_send_json_error( 'No uniqid given' );
99
+	if ( ! isset($_GET['uniqid'])) {
100
+		wp_send_json_error('No uniqid given');
101 101
 
102 102
 		return array();
103 103
 	}
104 104
 
105 105
 	// Limit the results (defaults to 4)
106
-	$navigator_length    = isset( $_GET['limit'] ) ? intval( $_GET['limit'] ) : 4;
107
-	$navigator_offset    = isset( $_GET['offset'] ) ? intval( $_GET['offset'] ) : 0;
108
-	$order_by            = isset( $_GET['sort'] ) ? sanitize_sql_orderby( $_GET['sort'] ) : 'ID DESC';
109
-	$post_types          = isset( $_GET['post_types'] ) ? (string) $_GET['post_types'] : '';
110
-	$post_types          = explode( ',', $post_types );
106
+	$navigator_length    = isset($_GET['limit']) ? intval($_GET['limit']) : 4;
107
+	$navigator_offset    = isset($_GET['offset']) ? intval($_GET['offset']) : 0;
108
+	$order_by            = isset($_GET['sort']) ? sanitize_sql_orderby($_GET['sort']) : 'ID DESC';
109
+	$post_types          = isset($_GET['post_types']) ? (string) $_GET['post_types'] : '';
110
+	$post_types          = explode(',', $post_types);
111 111
 	$existing_post_types = get_post_types();
112
-	$post_types          = array_values( array_intersect( $existing_post_types, $post_types ) );
112
+	$post_types          = array_values(array_intersect($existing_post_types, $post_types));
113 113
 	$current_post_id     = (int) $_GET['post_id'];
114
-	$current_post        = get_post( $current_post_id );
114
+	$current_post        = get_post($current_post_id);
115 115
 
116 116
 	$navigator_id = (string) $_GET['uniqid'];
117 117
 
118 118
 	// Post ID has to match an existing item
119
-	if ( null === $current_post ) {
120
-		wp_send_json_error( 'No valid post_id given' );
119
+	if (null === $current_post) {
120
+		wp_send_json_error('No valid post_id given');
121 121
 
122 122
 		return array();
123 123
 	}
124 124
 
125 125
 	// Determine navigator type and call respective _get_results
126
-	if ( get_post_type( $current_post_id ) === Wordlift_Entity_Service::TYPE_NAME ) {
126
+	if (get_post_type($current_post_id) === Wordlift_Entity_Service::TYPE_NAME) {
127 127
 
128
-		$referencing_posts = Navigator_Data::entity_navigator_get_results( $current_post_id, array(
128
+		$referencing_posts = Navigator_Data::entity_navigator_get_results($current_post_id, array(
129 129
 			'ID',
130 130
 			'post_title',
131
-		), $order_by, $navigator_length, $navigator_offset, $post_types );
131
+		), $order_by, $navigator_length, $navigator_offset, $post_types);
132 132
 	} else {
133
-		$referencing_posts = Navigator_Data::post_navigator_get_results( $current_post_id, array(
133
+		$referencing_posts = Navigator_Data::post_navigator_get_results($current_post_id, array(
134 134
 			'ID',
135 135
 			'post_title',
136
-		), $order_by, $navigator_length, $navigator_offset, $post_types );
136
+		), $order_by, $navigator_length, $navigator_offset, $post_types);
137 137
 
138 138
 	}
139 139
 
140 140
 	// loop over them and take the first one which is not already in the $related_posts
141 141
 	$results = array();
142
-	foreach ( $referencing_posts as $referencing_post ) {
143
-		$serialized_entity = wl_serialize_entity( $referencing_post->entity_id );
142
+	foreach ($referencing_posts as $referencing_post) {
143
+		$serialized_entity = wl_serialize_entity($referencing_post->entity_id);
144 144
 
145 145
 		/**
146 146
 		 * Use the thumbnail.
@@ -150,21 +150,21 @@  discard block
 block discarded – undo
150 150
 		 *
151 151
 		 * @since 3.19.3 We're using the medium size image.
152 152
 		 */
153
-		$thumbnail = get_the_post_thumbnail_url( $referencing_post, 'medium' );
153
+		$thumbnail = get_the_post_thumbnail_url($referencing_post, 'medium');
154 154
 
155 155
 		$result = array(
156 156
 			'post'   => array(
157 157
 				'id'        => $referencing_post->ID,
158
-				'permalink' => get_permalink( $referencing_post->ID ),
159
-				'title'     => html_entity_decode( $referencing_post->post_title, ENT_QUOTES, 'UTF-8' ),
158
+				'permalink' => get_permalink($referencing_post->ID),
159
+				'title'     => html_entity_decode($referencing_post->post_title, ENT_QUOTES, 'UTF-8'),
160 160
 				'thumbnail' => $thumbnail,
161
-				'srcset'    => Srcset_Util::get_srcset( $referencing_post->ID, Srcset_Util::NAVIGATOR_WIDGET )
161
+				'srcset'    => Srcset_Util::get_srcset($referencing_post->ID, Srcset_Util::NAVIGATOR_WIDGET)
162 162
 			),
163 163
 			'entity' => array(
164 164
 				'id'        => $referencing_post->entity_id,
165 165
 				'label'     => $serialized_entity['label'],
166 166
 				'mainType'  => $serialized_entity['mainType'],
167
-				'permalink' => get_permalink( $referencing_post->entity_id ),
167
+				'permalink' => get_permalink($referencing_post->entity_id),
168 168
 			),
169 169
 		);
170 170
 
@@ -172,61 +172,61 @@  discard block
 block discarded – undo
172 172
 	}
173 173
 
174 174
 
175
-	if ( count( $results ) < $navigator_length ) {
176
-		$results = apply_filters( 'wl_navigator_data_placeholder', $results, $navigator_id, $navigator_offset, $navigator_length );
175
+	if (count($results) < $navigator_length) {
176
+		$results = apply_filters('wl_navigator_data_placeholder', $results, $navigator_id, $navigator_offset, $navigator_length);
177 177
 	}
178 178
 
179 179
 	// Add filler posts if needed
180
-	$filler_count = $navigator_length - count( $results );
181
-	if ( $filler_count > 0 ) {
182
-		$referencing_post_ids = array_map( function ( $p ) {
180
+	$filler_count = $navigator_length - count($results);
181
+	if ($filler_count > 0) {
182
+		$referencing_post_ids = array_map(function($p) {
183 183
 			return $p->ID;
184
-		}, $referencing_posts );
184
+		}, $referencing_posts);
185 185
 		/**
186 186
 		 * @since 3.27.8
187 187
 		 * Filler posts are fetched using this util.
188 188
 		 */
189
-		$filler_posts_util       = new Filler_Posts_Util( $current_post_id, $post_types );
190
-		$post_ids_to_be_excluded = array_merge( array( $current_post_id ), $referencing_post_ids );
191
-		$filler_posts            = $filler_posts_util->get_filler_response( $filler_count, $post_ids_to_be_excluded );
192
-		$results                 = array_merge( $results, $filler_posts );
189
+		$filler_posts_util       = new Filler_Posts_Util($current_post_id, $post_types);
190
+		$post_ids_to_be_excluded = array_merge(array($current_post_id), $referencing_post_ids);
191
+		$filler_posts            = $filler_posts_util->get_filler_response($filler_count, $post_ids_to_be_excluded);
192
+		$results                 = array_merge($results, $filler_posts);
193 193
 	}
194 194
 
195 195
 	// Apply filters after fillers are added
196
-	foreach ( $results as $result_index => $result ) {
197
-		$results[ $result_index ]['post']   = apply_filters( 'wl_navigator_data_post', $result['post'], intval( $result['post']['id'] ), $navigator_id );
198
-		$results[ $result_index ]['entity'] = apply_filters( 'wl_navigator_data_entity', $result['entity'], intval( $result['entity']['id'] ), $navigator_id );
196
+	foreach ($results as $result_index => $result) {
197
+		$results[$result_index]['post']   = apply_filters('wl_navigator_data_post', $result['post'], intval($result['post']['id']), $navigator_id);
198
+		$results[$result_index]['entity'] = apply_filters('wl_navigator_data_entity', $result['entity'], intval($result['entity']['id']), $navigator_id);
199 199
 	}
200 200
 
201
-	$results = apply_filters( 'wl_navigator_results', $results, $navigator_id, $current_post_id );
201
+	$results = apply_filters('wl_navigator_results', $results, $navigator_id, $current_post_id);
202 202
 
203 203
 	return $results;
204 204
 }
205 205
 
206
-function _wl_network_navigator_get_data( $request ) {
206
+function _wl_network_navigator_get_data($request) {
207 207
 
208 208
 	// Limit the results (defaults to 4)
209
-	$navigator_length = isset( $request['limit'] ) ? intval( $request['limit'] ) : 4;
210
-	$navigator_offset = isset( $request['offset'] ) ? intval( $request['offset'] ) : 0;
209
+	$navigator_length = isset($request['limit']) ? intval($request['limit']) : 4;
210
+	$navigator_offset = isset($request['offset']) ? intval($request['offset']) : 0;
211 211
 	$navigator_id     = $request['uniqid'];
212
-	$order_by         = isset( $_GET['sort'] ) ? sanitize_sql_orderby( $_GET['sort'] ) : 'ID DESC';
212
+	$order_by         = isset($_GET['sort']) ? sanitize_sql_orderby($_GET['sort']) : 'ID DESC';
213 213
 
214 214
 	$entities = $request['entities'];
215 215
 
216 216
 	// Post ID has to match an existing item
217
-	if ( ! isset( $entities ) || empty( $entities ) ) {
218
-		wp_send_json_error( 'No valid entities provided' );
217
+	if ( ! isset($entities) || empty($entities)) {
218
+		wp_send_json_error('No valid entities provided');
219 219
 	}
220 220
 
221
-	$referencing_posts = _wl_network_navigator_get_results( $entities, array(
221
+	$referencing_posts = _wl_network_navigator_get_results($entities, array(
222 222
 		'ID',
223 223
 		'post_title',
224
-	), $order_by, $navigator_length, $navigator_offset );
224
+	), $order_by, $navigator_length, $navigator_offset);
225 225
 
226 226
 	// loop over them and take the first one which is not already in the $related_posts
227 227
 	$results = array();
228
-	foreach ( $referencing_posts as $referencing_post ) {
229
-		$serialized_entity = wl_serialize_entity( $referencing_post->entity_id );
228
+	foreach ($referencing_posts as $referencing_post) {
229
+		$serialized_entity = wl_serialize_entity($referencing_post->entity_id);
230 230
 
231 231
 		/**
232 232
 		 * Use the thumbnail.
@@ -236,33 +236,33 @@  discard block
 block discarded – undo
236 236
 		 *
237 237
 		 * @since 3.19.3 We're using the medium size image.
238 238
 		 */
239
-		$thumbnail = get_the_post_thumbnail_url( $referencing_post, 'medium' );
239
+		$thumbnail = get_the_post_thumbnail_url($referencing_post, 'medium');
240 240
 
241 241
 		$result = array(
242 242
 			'post'   => array(
243
-				'permalink' => get_permalink( $referencing_post->ID ),
243
+				'permalink' => get_permalink($referencing_post->ID),
244 244
 				'title'     => $referencing_post->post_title,
245 245
 				'thumbnail' => $thumbnail,
246 246
 			),
247 247
 			'entity' => array(
248 248
 				'label'     => $serialized_entity['label'],
249 249
 				'mainType'  => $serialized_entity['mainType'],
250
-				'permalink' => get_permalink( $referencing_post->entity_id ),
250
+				'permalink' => get_permalink($referencing_post->entity_id),
251 251
 			),
252 252
 		);
253 253
 
254
-		$result['post']   = apply_filters( 'wl_network_navigator_data_post', $result['post'], intval( $referencing_post->ID ), $navigator_id );
255
-		$result['entity'] = apply_filters( 'wl_network_navigator_data_entity', $result['entity'], intval( $referencing_post->entity_id ), $navigator_id );
254
+		$result['post']   = apply_filters('wl_network_navigator_data_post', $result['post'], intval($referencing_post->ID), $navigator_id);
255
+		$result['entity'] = apply_filters('wl_network_navigator_data_entity', $result['entity'], intval($referencing_post->entity_id), $navigator_id);
256 256
 
257 257
 		$results[] = $result;
258 258
 
259 259
 	}
260 260
 
261
-	if ( count( $results ) < $navigator_length ) {
262
-		$results = apply_filters( 'wl_network_navigator_data_placeholder', $results, $navigator_id, $navigator_offset, $navigator_length );
261
+	if (count($results) < $navigator_length) {
262
+		$results = apply_filters('wl_network_navigator_data_placeholder', $results, $navigator_id, $navigator_offset, $navigator_length);
263 263
 	}
264 264
 
265
-	$results = apply_filters( 'wl_network_navigator_results', $results, $navigator_id );
265
+	$results = apply_filters('wl_network_navigator_results', $results, $navigator_id);
266 266
 
267 267
 	return $results;
268 268
 
@@ -276,24 +276,24 @@  discard block
 block discarded – undo
276 276
 ) {
277 277
 	global $wpdb;
278 278
 
279
-	$select = implode( ', ', array_map( function ( $item ) {
279
+	$select = implode(', ', array_map(function($item) {
280 280
 		return "p.$item AS $item";
281
-	}, (array) $fields ) );
281
+	}, (array) $fields));
282 282
 
283
-	$order_by = implode( ', ', array_map( function ( $item ) {
283
+	$order_by = implode(', ', array_map(function($item) {
284 284
 		return "p.$item";
285
-	}, (array) $order_by ) );
285
+	}, (array) $order_by));
286 286
 
287
-	$entities_in = implode( ',', array_map( function ( $item ) {
288
-		$entity = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri( urldecode( $item ) );
289
-		if ( isset( $entity ) ) {
287
+	$entities_in = implode(',', array_map(function($item) {
288
+		$entity = Wordlift_Entity_Service::get_instance()->get_entity_post_by_uri(urldecode($item));
289
+		if (isset($entity)) {
290 290
 			return $entity->ID;
291 291
 		}
292
-	}, $entities ) );
292
+	}, $entities));
293 293
 
294 294
 	/** @noinspection SqlNoDataSourceInspection */
295 295
 	return $wpdb->get_results(
296
-		$wpdb->prepare( <<<EOF
296
+		$wpdb->prepare(<<<EOF
297 297
 SELECT %3\$s, p2.ID as entity_id
298 298
  FROM {$wpdb->prefix}wl_relation_instances r1
299 299
 	-- get the ID of the post entity in common between the object and the subject 2. 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
  LIMIT %1\$d
320 320
  OFFSET %2\$d
321 321
 EOF
322
-			, $limit, $offset, $select, $order_by )
322
+			, $limit, $offset, $select, $order_by)
323 323
 	);
324 324
 
325 325
 }
@@ -334,12 +334,12 @@  discard block
 block discarded – undo
334 334
 
335 335
 	// Temporary blocking the Navigator.
336 336
 	$results = wl_shortcode_navigator_data();
337
-	wl_core_send_json( $results );
337
+	wl_core_send_json($results);
338 338
 
339 339
 }
340 340
 
341
-add_action( 'wp_ajax_wl_navigator', 'wl_shortcode_navigator_ajax' );
342
-add_action( 'wp_ajax_nopriv_wl_navigator', 'wl_shortcode_navigator_ajax' );
341
+add_action('wp_ajax_wl_navigator', 'wl_shortcode_navigator_ajax');
342
+add_action('wp_ajax_nopriv_wl_navigator', 'wl_shortcode_navigator_ajax');
343 343
 
344 344
 /**
345 345
  * wp-json call for the navigator widget
@@ -347,13 +347,13 @@  discard block
 block discarded – undo
347 347
 function wl_shortcode_navigator_wp_json() {
348 348
 
349 349
 	$results = wl_shortcode_navigator_data();
350
-	if ( ob_get_contents() ) {
350
+	if (ob_get_contents()) {
351 351
 		ob_clean();
352 352
 	}
353 353
 
354 354
 	return array(
355 355
 		'items' => array(
356
-			array( 'values' => $results ),
356
+			array('values' => $results),
357 357
 		),
358 358
 	);
359 359
 
@@ -362,23 +362,23 @@  discard block
 block discarded – undo
362 362
 /**
363 363
  * Adding `rest_api_init` action for amp backend of navigator
364 364
  */
365
-add_action( 'rest_api_init', function () {
366
-	register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, '/navigator', array(
365
+add_action('rest_api_init', function() {
366
+	register_rest_route(WL_REST_ROUTE_DEFAULT_NAMESPACE, '/navigator', array(
367 367
 		'methods'             => 'GET',
368 368
 		'permission_callback' => '__return_true',
369 369
 		'callback'            => 'wl_shortcode_navigator_wp_json'
370
-	) );
370
+	));
371 371
 } );
372 372
 
373 373
 /**
374 374
  * Adding `rest_api_init` action for backend of network navigator
375 375
  */
376
-add_action( 'rest_api_init', function () {
377
-	register_rest_route( WL_REST_ROUTE_DEFAULT_NAMESPACE, '/network-navigator', array(
376
+add_action('rest_api_init', function() {
377
+	register_rest_route(WL_REST_ROUTE_DEFAULT_NAMESPACE, '/network-navigator', array(
378 378
 		'methods'             => 'GET',
379 379
 		'callback'            => 'wl_network_navigator_wp_json',
380 380
 		'permission_callback' => '__return_true',
381
-	) );
381
+	));
382 382
 } );
383 383
 
384 384
 /**
@@ -386,24 +386,24 @@  discard block
 block discarded – undo
386 386
  *
387 387
  * @since 2.2.0
388 388
  */
389
-add_action( 'plugins_loaded', function () {
390
-	$action = array_key_exists( 'action', $_REQUEST ) ? (string) $_REQUEST['action'] : '';
391
-	if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || 'wl_navigator' !== $action ) {
389
+add_action('plugins_loaded', function() {
390
+	$action = array_key_exists('action', $_REQUEST) ? (string) $_REQUEST['action'] : '';
391
+	if ( ! defined('DOING_AJAX') || ! DOING_AJAX || 'wl_navigator' !== $action) {
392 392
 		return;
393 393
 	}
394 394
 
395
-	remove_action( 'plugins_loaded', 'rocket_init' );
396
-	remove_action( 'plugins_loaded', 'wpseo_premium_init', 14 );
397
-	remove_action( 'plugins_loaded', 'wpseo_init', 14 );
398
-}, 0 );
395
+	remove_action('plugins_loaded', 'rocket_init');
396
+	remove_action('plugins_loaded', 'wpseo_premium_init', 14);
397
+	remove_action('plugins_loaded', 'wpseo_init', 14);
398
+}, 0);
399 399
 
400
-add_action( 'init', function () {
401
-	$action = array_key_exists( 'action', $_REQUEST ) ? (string) $_REQUEST['action'] : '';
402
-	if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || 'wl_navigator' !== $action ) {
400
+add_action('init', function() {
401
+	$action = array_key_exists('action', $_REQUEST) ? (string) $_REQUEST['action'] : '';
402
+	if ( ! defined('DOING_AJAX') || ! DOING_AJAX || 'wl_navigator' !== $action) {
403 403
 		return;
404 404
 	}
405 405
 
406
-	remove_action( 'init', 'wp_widgets_init', 1 );
407
-	remove_action( 'init', 'gglcptch_init' );
408
-}, 0 );
406
+	remove_action('init', 'wp_widgets_init', 1);
407
+	remove_action('init', 'gglcptch_init');
408
+}, 0);
409 409
 
Please login to merge, or discard this patch.
src/wordlift/vocabulary/class-analysis-background-service.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
 	private $log;
26 26
 
27 27
 
28
-	public function __construct( $analysis_service ) {
28
+	public function __construct($analysis_service) {
29 29
 
30 30
 		$this->analysis_service = $analysis_service;
31 31
 
32
-		$this->analysis_background_process = new Analysis_Background_Process( $this );
32
+		$this->analysis_background_process = new Analysis_Background_Process($this);
33 33
 
34
-		$this->log = \Wordlift_Log_Service::get_logger( get_class() );
34
+		$this->log = \Wordlift_Log_Service::get_logger(get_class());
35 35
 	}
36 36
 
37 37
 	public function start() {
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
 		$state = $this->info();
57 57
 
58
-		return Terms_Compat::get_terms( Terms_Compat::get_public_taxonomies(), array(
58
+		return Terms_Compat::get_terms(Terms_Compat::get_public_taxonomies(), array(
59 59
 			'fields'     => 'ids',
60 60
 			'hide_empty' => false,
61 61
 			'number'     => $this->get_batch_size(),
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
 					'compare' => 'NOT EXISTS'
67 67
 				)
68 68
 			),
69
-		) );
69
+		));
70 70
 	}
71 71
 
72 72
 	public function count() {
73 73
 
74
-		$count = count( Terms_Compat::get_terms(
74
+		$count = count(Terms_Compat::get_terms(
75 75
 			Terms_Compat::get_public_taxonomies(),
76 76
 			array(
77 77
 			'fields'     => 'ids',
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 					'compare' => 'NOT EXISTS'
85 85
 				)
86 86
 			),
87
-		) ) );
87
+		) ));
88 88
 
89
-		$this->log->debug( "Count returned as $count" );
89
+		$this->log->debug("Count returned as $count");
90 90
 
91 91
 
92 92
 		return $count;
@@ -105,23 +105,23 @@  discard block
 block discarded – undo
105 105
 	 *
106 106
 	 * @return bool
107 107
 	 */
108
-	public function perform_analysis_for_terms( $term_ids ) {
108
+	public function perform_analysis_for_terms($term_ids) {
109 109
 
110
-		foreach ( $term_ids as $term_id ) {
110
+		foreach ($term_ids as $term_id) {
111 111
 
112
-			$tag = get_term( $term_id );
112
+			$tag = get_term($term_id);
113 113
 
114 114
 			// This adds the entities to ttl cache
115
-			$result = $this->analysis_service->get_entities( $tag );
115
+			$result = $this->analysis_service->get_entities($tag);
116 116
 
117
-			$this->log->debug( "Received result " . var_export( $result ) . " for ${term_id}" );
117
+			$this->log->debug("Received result ".var_export($result)." for ${term_id}");
118 118
 
119 119
 			// then set the analysis complete flag.
120
-			update_term_meta( $term_id, self::ANALYSIS_DONE_FLAG, 1 );
120
+			update_term_meta($term_id, self::ANALYSIS_DONE_FLAG, 1);
121 121
 
122
-			if ( $result !== false ) {
123
-				if ( count( $result ) > 0 ) {
124
-					update_term_meta( $term_id, self::ENTITIES_PRESENT_FOR_TERM, 1 );
122
+			if ($result !== false) {
123
+				if (count($result) > 0) {
124
+					update_term_meta($term_id, self::ENTITIES_PRESENT_FOR_TERM, 1);
125 125
 				}
126 126
 			}
127 127
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		 * This action fires when the analysis is complete for the current batch
132 132
 		 * @since 3.30.0
133 133
 		 */
134
-		do_action( 'wordlift_vocabulary_analysis_complete_for_terms_batch' );
134
+		do_action('wordlift_vocabulary_analysis_complete_for_terms_batch');
135 135
 
136 136
 		return true;
137 137
 
Please login to merge, or discard this patch.
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -6,136 +6,136 @@
 block discarded – undo
6 6
 class Analysis_Background_Service {
7 7
 
8 8
 
9
-	const ANALYSIS_DONE_FLAG = '_wl_cmkg_analysis_complete_for_term_options_cache';
10
-	const TERMS_COUNT_TRANSIENT = '_wl_cmkg_analysis_background_service_terms_count';
11
-	const ENTITIES_PRESENT_FOR_TERM = '_wl_cmkg_analysis_entities_present_for_term_options_cache';
9
+    const ANALYSIS_DONE_FLAG = '_wl_cmkg_analysis_complete_for_term_options_cache';
10
+    const TERMS_COUNT_TRANSIENT = '_wl_cmkg_analysis_background_service_terms_count';
11
+    const ENTITIES_PRESENT_FOR_TERM = '_wl_cmkg_analysis_entities_present_for_term_options_cache';
12 12
 
13
-	/**
14
-	 * @var Analysis_Service
15
-	 */
16
-	private $analysis_service;
17
-	/**
18
-	 * @var Analysis_Background_Process
19
-	 */
20
-	private $analysis_background_process;
13
+    /**
14
+     * @var Analysis_Service
15
+     */
16
+    private $analysis_service;
17
+    /**
18
+     * @var Analysis_Background_Process
19
+     */
20
+    private $analysis_background_process;
21 21
 
22
-	/**
23
-	 * @var \Wordlift_Log_Service
24
-	 */
25
-	private $log;
22
+    /**
23
+     * @var \Wordlift_Log_Service
24
+     */
25
+    private $log;
26 26
 
27 27
 
28
-	public function __construct( $analysis_service ) {
28
+    public function __construct( $analysis_service ) {
29 29
 
30
-		$this->analysis_service = $analysis_service;
30
+        $this->analysis_service = $analysis_service;
31 31
 
32
-		$this->analysis_background_process = new Analysis_Background_Process( $this );
32
+        $this->analysis_background_process = new Analysis_Background_Process( $this );
33 33
 
34
-		$this->log = \Wordlift_Log_Service::get_logger( get_class() );
35
-	}
34
+        $this->log = \Wordlift_Log_Service::get_logger( get_class() );
35
+    }
36 36
 
37
-	public function start() {
38
-		$this->analysis_background_process->start();
39
-	}
37
+    public function start() {
38
+        $this->analysis_background_process->start();
39
+    }
40 40
 
41
-	public function cancel() {
42
-		$this->analysis_background_process->cancel();
43
-	}
41
+    public function cancel() {
42
+        $this->analysis_background_process->cancel();
43
+    }
44 44
 
45
-	public function stop() {
46
-		$this->analysis_background_process->cancel();
47
-		$this->analysis_background_process->request_cancel();
48
-	}
45
+    public function stop() {
46
+        $this->analysis_background_process->cancel();
47
+        $this->analysis_background_process->request_cancel();
48
+    }
49 49
 
50
-	/**
51
-	 * A list of term ids.
52
-	 * @return int|\WP_Error|\WP_Term[]
53
-	 */
54
-	public function next() {
50
+    /**
51
+     * A list of term ids.
52
+     * @return int|\WP_Error|\WP_Term[]
53
+     */
54
+    public function next() {
55 55
 
56
-		$state = $this->info();
56
+        $state = $this->info();
57 57
 
58
-		return Terms_Compat::get_terms( Terms_Compat::get_public_taxonomies(), array(
59
-			'fields'     => 'ids',
60
-			'hide_empty' => false,
61
-			'number'     => $this->get_batch_size(),
58
+        return Terms_Compat::get_terms( Terms_Compat::get_public_taxonomies(), array(
59
+            'fields'     => 'ids',
60
+            'hide_empty' => false,
61
+            'number'     => $this->get_batch_size(),
62 62
 //			'offset'     => $state->index,
63
-			'meta_query' => array(
64
-				array(
65
-					'key'     => self::ANALYSIS_DONE_FLAG,
66
-					'compare' => 'NOT EXISTS'
67
-				)
68
-			),
69
-		) );
70
-	}
63
+            'meta_query' => array(
64
+                array(
65
+                    'key'     => self::ANALYSIS_DONE_FLAG,
66
+                    'compare' => 'NOT EXISTS'
67
+                )
68
+            ),
69
+        ) );
70
+    }
71 71
 
72
-	public function count() {
72
+    public function count() {
73 73
 
74
-		$count = count( Terms_Compat::get_terms(
75
-			Terms_Compat::get_public_taxonomies(),
76
-			array(
77
-			'fields'     => 'ids',
78
-			'hide_empty' => false,
79
-			// return all terms, we cant pass -1 here.
80
-			'number'     => 0,
81
-			'meta_query' => array(
82
-				array(
83
-					'key'     => self::ANALYSIS_DONE_FLAG,
84
-					'compare' => 'NOT EXISTS'
85
-				)
86
-			),
87
-		) ) );
74
+        $count = count( Terms_Compat::get_terms(
75
+            Terms_Compat::get_public_taxonomies(),
76
+            array(
77
+            'fields'     => 'ids',
78
+            'hide_empty' => false,
79
+            // return all terms, we cant pass -1 here.
80
+            'number'     => 0,
81
+            'meta_query' => array(
82
+                array(
83
+                    'key'     => self::ANALYSIS_DONE_FLAG,
84
+                    'compare' => 'NOT EXISTS'
85
+                )
86
+            ),
87
+        ) ) );
88 88
 
89
-		$this->log->debug( "Count returned as $count" );
89
+        $this->log->debug( "Count returned as $count" );
90 90
 
91 91
 
92
-		return $count;
93
-	}
92
+        return $count;
93
+    }
94 94
 
95
-	public function get_batch_size() {
96
-		return 10;
97
-	}
95
+    public function get_batch_size() {
96
+        return 10;
97
+    }
98 98
 
99
-	public function info() {
100
-		return Analysis_Background_Process::get_state();
101
-	}
99
+    public function info() {
100
+        return Analysis_Background_Process::get_state();
101
+    }
102 102
 
103
-	/**
104
-	 * @param $term_ids
105
-	 *
106
-	 * @return bool
107
-	 */
108
-	public function perform_analysis_for_terms( $term_ids ) {
103
+    /**
104
+     * @param $term_ids
105
+     *
106
+     * @return bool
107
+     */
108
+    public function perform_analysis_for_terms( $term_ids ) {
109 109
 
110
-		foreach ( $term_ids as $term_id ) {
110
+        foreach ( $term_ids as $term_id ) {
111 111
 
112
-			$tag = get_term( $term_id );
112
+            $tag = get_term( $term_id );
113 113
 
114
-			// This adds the entities to ttl cache
115
-			$result = $this->analysis_service->get_entities( $tag );
114
+            // This adds the entities to ttl cache
115
+            $result = $this->analysis_service->get_entities( $tag );
116 116
 
117
-			$this->log->debug( "Received result " . var_export( $result ) . " for ${term_id}" );
117
+            $this->log->debug( "Received result " . var_export( $result ) . " for ${term_id}" );
118 118
 
119
-			// then set the analysis complete flag.
120
-			update_term_meta( $term_id, self::ANALYSIS_DONE_FLAG, 1 );
119
+            // then set the analysis complete flag.
120
+            update_term_meta( $term_id, self::ANALYSIS_DONE_FLAG, 1 );
121 121
 
122
-			if ( $result !== false ) {
123
-				if ( count( $result ) > 0 ) {
124
-					update_term_meta( $term_id, self::ENTITIES_PRESENT_FOR_TERM, 1 );
125
-				}
126
-			}
122
+            if ( $result !== false ) {
123
+                if ( count( $result ) > 0 ) {
124
+                    update_term_meta( $term_id, self::ENTITIES_PRESENT_FOR_TERM, 1 );
125
+                }
126
+            }
127 127
 
128
-		}
128
+        }
129 129
 
130
-		/**
131
-		 * This action fires when the analysis is complete for the current batch
132
-		 * @since 3.30.0
133
-		 */
134
-		do_action( 'wordlift_vocabulary_analysis_complete_for_terms_batch' );
130
+        /**
131
+         * This action fires when the analysis is complete for the current batch
132
+         * @since 3.30.0
133
+         */
134
+        do_action( 'wordlift_vocabulary_analysis_complete_for_terms_batch' );
135 135
 
136
-		return true;
136
+        return true;
137 137
 
138 138
 
139
-	}
139
+    }
140 140
 
141 141
 }
142 142
\ No newline at end of file
Please login to merge, or discard this patch.
src/includes/class-wordlift.php 1 patch
Indentation   +1946 added lines, -1946 removed lines patch added patch discarded remove patch
@@ -86,1670 +86,1670 @@  discard block
 block discarded – undo
86 86
  */
87 87
 class Wordlift {
88 88
 
89
-	//<editor-fold desc="## FIELDS">
90
-
91
-	/**
92
-	 * The loader that's responsible for maintaining and registering all hooks that power
93
-	 * the plugin.
94
-	 *
95
-	 * @since    1.0.0
96
-	 * @access   protected
97
-	 * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
98
-	 */
99
-	protected $loader;
100
-
101
-	/**
102
-	 * The unique identifier of this plugin.
103
-	 *
104
-	 * @since    1.0.0
105
-	 * @access   protected
106
-	 * @var      string $plugin_name The string used to uniquely identify this plugin.
107
-	 */
108
-	protected $plugin_name;
109
-
110
-	/**
111
-	 * The current version of the plugin.
112
-	 *
113
-	 * @since    1.0.0
114
-	 * @access   protected
115
-	 * @var      string $version The current version of the plugin.
116
-	 */
117
-	protected $version;
118
-
119
-	/**
120
-	 * The {@link Wordlift_Tinymce_Adapter} instance.
121
-	 *
122
-	 * @since  3.12.0
123
-	 * @access protected
124
-	 * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
125
-	 */
126
-	protected $tinymce_adapter;
127
-
128
-	/**
129
-	 * The {@link Faq_Tinymce_Adapter} instance
130
-	 * @since 3.26.0
131
-	 * @access protected
132
-	 * @var Faq_Tinymce_Adapter $faq_tinymce_adapter .
133
-	 */
134
-	//protected $faq_tinymce_adapter;
135
-
136
-	/**
137
-	 * The Thumbnail service.
138
-	 *
139
-	 * @since  3.1.5
140
-	 * @access private
141
-	 * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
142
-	 */
143
-	private $thumbnail_service;
144
-
145
-	/**
146
-	 * The UI service.
147
-	 *
148
-	 * @since  3.2.0
149
-	 * @access private
150
-	 * @var \Wordlift_UI_Service $ui_service The UI service.
151
-	 */
152
-	private $ui_service;
153
-
154
-	/**
155
-	 * The Schema service.
156
-	 *
157
-	 * @since  3.3.0
158
-	 * @access protected
159
-	 * @var \Wordlift_Schema_Service $schema_service The Schema service.
160
-	 */
161
-	protected $schema_service;
162
-
163
-	/**
164
-	 * The Entity service.
165
-	 *
166
-	 * @since  3.1.0
167
-	 * @access protected
168
-	 * @var \Wordlift_Entity_Service $entity_service The Entity service.
169
-	 */
170
-	protected $entity_service;
171
-
172
-	/**
173
-	 * The Topic Taxonomy service.
174
-	 *
175
-	 * @since  3.5.0
176
-	 * @access private
177
-	 * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
178
-	 */
179
-	private $topic_taxonomy_service;
180
-
181
-	/**
182
-	 * The Entity Types Taxonomy service.
183
-	 *
184
-	 * @since  3.18.0
185
-	 * @access private
186
-	 * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service.
187
-	 */
188
-	private $entity_types_taxonomy_service;
189
-
190
-	/**
191
-	 * The User service.
192
-	 *
193
-	 * @since  3.1.7
194
-	 * @access protected
195
-	 * @var \Wordlift_User_Service $user_service The User service.
196
-	 */
197
-	protected $user_service;
198
-
199
-	/**
200
-	 * The Timeline service.
201
-	 *
202
-	 * @since  3.1.0
203
-	 * @access private
204
-	 * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
205
-	 */
206
-	private $timeline_service;
207
-
208
-	/**
209
-	 * The Redirect service.
210
-	 *
211
-	 * @since  3.2.0
212
-	 * @access private
213
-	 * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
214
-	 */
215
-	private $redirect_service;
216
-
217
-	/**
218
-	 * The Notice service.
219
-	 *
220
-	 * @since  3.3.0
221
-	 * @access private
222
-	 * @var \Wordlift_Notice_Service $notice_service The Notice service.
223
-	 */
224
-	private $notice_service;
225
-
226
-	/**
227
-	 * The Entity list customization.
228
-	 *
229
-	 * @since  3.3.0
230
-	 * @access protected
231
-	 * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
232
-	 */
233
-	protected $entity_list_service;
234
-
235
-	/**
236
-	 * The Entity Types Taxonomy Walker.
237
-	 *
238
-	 * @since  3.1.0
239
-	 * @access private
240
-	 * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
241
-	 */
242
-	private $entity_types_taxonomy_walker;
243
-
244
-	/**
245
-	 * The ShareThis service.
246
-	 *
247
-	 * @since  3.2.0
248
-	 * @access private
249
-	 * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
250
-	 */
251
-	private $sharethis_service;
252
-
253
-	/**
254
-	 * The PrimaShop adapter.
255
-	 *
256
-	 * @since  3.2.3
257
-	 * @access private
258
-	 * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
259
-	 */
260
-	private $primashop_adapter;
261
-
262
-	/**
263
-	 * The WordLift Dashboard adapter.
264
-	 *
265
-	 * @since  3.4.0
266
-	 * @access private
267
-	 * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
268
-	 */
269
-	private $dashboard_service;
270
-
271
-	/**
272
-	 * The entity type service.
273
-	 *
274
-	 * @since  3.6.0
275
-	 * @access private
276
-	 * @var \Wordlift_Entity_Post_Type_Service
277
-	 */
278
-	private $entity_post_type_service;
279
-
280
-	/**
281
-	 * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
282
-	 *
283
-	 * @since  3.6.0
284
-	 * @access private
285
-	 * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance.
286
-	 */
287
-	private $entity_link_service;
288
-
289
-	/**
290
-	 * A {@link Wordlift_Sparql_Service} instance.
291
-	 *
292
-	 * @since    3.6.0
293
-	 * @access   protected
294
-	 * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
295
-	 */
296
-	protected $sparql_service;
297
-
298
-	/**
299
-	 * A {@link Wordlift_Import_Service} instance.
300
-	 *
301
-	 * @since  3.6.0
302
-	 * @access private
303
-	 * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
304
-	 */
305
-	private $import_service;
306
-
307
-	/**
308
-	 * A {@link Wordlift_Rebuild_Service} instance.
309
-	 *
310
-	 * @since  3.6.0
311
-	 * @access private
312
-	 * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
313
-	 */
314
-	private $rebuild_service;
315
-
316
-	/**
317
-	 * A {@link Wordlift_Jsonld_Service} instance.
318
-	 *
319
-	 * @since  3.7.0
320
-	 * @access protected
321
-	 * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
322
-	 */
323
-	protected $jsonld_service;
324
-
325
-	/**
326
-	 * A {@link Wordlift_Website_Jsonld_Converter} instance.
327
-	 *
328
-	 * @since  3.14.0
329
-	 * @access protected
330
-	 * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance.
331
-	 */
332
-	protected $jsonld_website_converter;
333
-
334
-	/**
335
-	 * A {@link Wordlift_Property_Factory} instance.
336
-	 *
337
-	 * @since  3.7.0
338
-	 * @access private
339
-	 * @var \Wordlift_Property_Factory $property_factory
340
-	 */
341
-	private $property_factory;
342
-
343
-	/**
344
-	 * The 'Download Your Data' page.
345
-	 *
346
-	 * @since  3.6.0
347
-	 * @access private
348
-	 * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
349
-	 */
350
-	private $download_your_data_page;
351
-
352
-	/**
353
-	 * The 'WordLift Settings' page.
354
-	 *
355
-	 * @since  3.11.0
356
-	 * @access protected
357
-	 * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
358
-	 */
359
-	protected $settings_page;
360
-
361
-	/**
362
-	 * The install wizard page.
363
-	 *
364
-	 * @since  3.9.0
365
-	 * @access private
366
-	 * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
367
-	 */
368
-	public $admin_setup;
369
-
370
-	/**
371
-	 * The Content Filter Service hooks up to the 'the_content' filter and provides
372
-	 * linking of entities to their pages.
373
-	 *
374
-	 * @since  3.8.0
375
-	 * @access private
376
-	 * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
377
-	 */
378
-	private $content_filter_service;
379
-
380
-	/**
381
-	 * The Faq Content filter service
382
-	 * @since  3.26.0
383
-	 * @access private
384
-	 * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance.
385
-	 */
386
-	private $faq_content_filter_service;
387
-
388
-	/**
389
-	 * A {@link Wordlift_Key_Validation_Service} instance.
390
-	 *
391
-	 * @since  3.9.0
392
-	 * @access private
393
-	 * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
394
-	 */
395
-	private $key_validation_service;
396
-
397
-	/**
398
-	 * A {@link Wordlift_Rating_Service} instance.
399
-	 *
400
-	 * @since  3.10.0
401
-	 * @access private
402
-	 * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
403
-	 */
404
-	private $rating_service;
405
-
406
-	/**
407
-	 * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
408
-	 *
409
-	 * @since  3.10.0
410
-	 * @access protected
411
-	 * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
412
-	 */
413
-	protected $post_to_jsonld_converter;
414
-
415
-	/**
416
-	 * A {@link Wordlift_Configuration_Service} instance.
417
-	 *
418
-	 * @since  3.10.0
419
-	 * @access protected
420
-	 * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
421
-	 */
422
-	protected $configuration_service;
423
-
424
-	/**
425
-	 * A {@link Wordlift_Install_Service} instance.
426
-	 *
427
-	 * @since  3.18.0
428
-	 * @access protected
429
-	 * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance.
430
-	 */
431
-	protected $install_service;
432
-
433
-	/**
434
-	 * A {@link Wordlift_Entity_Type_Service} instance.
435
-	 *
436
-	 * @since  3.10.0
437
-	 * @access protected
438
-	 * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
439
-	 */
440
-	protected $entity_type_service;
441
-
442
-	/**
443
-	 * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
444
-	 *
445
-	 * @since  3.10.0
446
-	 * @access protected
447
-	 * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
448
-	 */
449
-	protected $entity_post_to_jsonld_converter;
450
-
451
-	/**
452
-	 * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
453
-	 *
454
-	 * @since  3.10.0
455
-	 * @access protected
456
-	 * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
457
-	 */
458
-	protected $postid_to_jsonld_converter;
459
-
460
-	/**
461
-	 * The {@link Wordlift_Admin_Status_Page} class.
462
-	 *
463
-	 * @since  3.9.8
464
-	 * @access private
465
-	 * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
466
-	 */
467
-	private $status_page;
468
-
469
-	/**
470
-	 * The {@link Wordlift_Category_Taxonomy_Service} instance.
471
-	 *
472
-	 * @since  3.11.0
473
-	 * @access protected
474
-	 * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
475
-	 */
476
-	protected $category_taxonomy_service;
477
-
478
-	/**
479
-	 * The {@link Wordlift_Entity_Page_Service} instance.
480
-	 *
481
-	 * @since  3.11.0
482
-	 * @access protected
483
-	 * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance.
484
-	 */
485
-	protected $entity_page_service;
486
-
487
-	/**
488
-	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
489
-	 *
490
-	 * @since  3.11.0
491
-	 * @access protected
492
-	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
493
-	 */
494
-	protected $settings_page_action_link;
495
-
496
-	/**
497
-	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
498
-	 *
499
-	 * @since  3.11.0
500
-	 * @access protected
501
-	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
502
-	 */
503
-	protected $analytics_settings_page_action_link;
504
-
505
-	/**
506
-	 * The {@link Wordlift_Analytics_Connect} class.
507
-	 *
508
-	 * @since  3.11.0
509
-	 * @access protected
510
-	 * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class.
511
-	 */
512
-	protected $analytics_connect;
513
-
514
-	/**
515
-	 * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
516
-	 *
517
-	 * @since  3.11.0
518
-	 * @access protected
519
-	 * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
520
-	 */
521
-	protected $publisher_ajax_adapter;
522
-
523
-	/**
524
-	 * The {@link Wordlift_Admin_Input_Element} element renderer.
525
-	 *
526
-	 * @since  3.11.0
527
-	 * @access protected
528
-	 * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
529
-	 */
530
-	protected $input_element;
531
-
532
-	/**
533
-	 * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
534
-	 *
535
-	 * @since  3.13.0
536
-	 * @access protected
537
-	 * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
538
-	 */
539
-	protected $radio_input_element;
540
-
541
-	/**
542
-	 * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
543
-	 *
544
-	 * @since  3.11.0
545
-	 * @access protected
546
-	 * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
547
-	 */
548
-	protected $language_select_element;
549
-
550
-	/**
551
-	 * The {@link Wordlift_Admin_Country_Select_Element} element renderer.
552
-	 *
553
-	 * @since  3.18.0
554
-	 * @access protected
555
-	 * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer.
556
-	 */
557
-	protected $country_select_element;
558
-
559
-	/**
560
-	 * The {@link Wordlift_Admin_Publisher_Element} element renderer.
561
-	 *
562
-	 * @since  3.11.0
563
-	 * @access protected
564
-	 * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
565
-	 */
566
-	protected $publisher_element;
567
-
568
-	/**
569
-	 * The {@link Wordlift_Admin_Select2_Element} element renderer.
570
-	 *
571
-	 * @since  3.11.0
572
-	 * @access protected
573
-	 * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
574
-	 */
575
-	protected $select2_element;
576
-
577
-	/**
578
-	 * The controller for the entity type list admin page
579
-	 *
580
-	 * @since  3.11.0
581
-	 * @access private
582
-	 * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
583
-	 */
584
-	private $entity_type_admin_page;
585
-
586
-	/**
587
-	 * The controller for the entity type settings admin page
588
-	 *
589
-	 * @since  3.11.0
590
-	 * @access private
591
-	 * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
592
-	 */
593
-	private $entity_type_settings_admin_page;
594
-
595
-	/**
596
-	 * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
597
-	 *
598
-	 * @since  3.11.0
599
-	 * @access protected
600
-	 * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
601
-	 */
602
-	protected $related_entities_cloud_widget;
603
-
604
-	/**
605
-	 * The {@link Wordlift_Admin_Author_Element} instance.
606
-	 *
607
-	 * @since  3.14.0
608
-	 * @access protected
609
-	 * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
610
-	 */
611
-	protected $author_element;
612
-
613
-	/**
614
-	 * The {@link Wordlift_Sample_Data_Service} instance.
615
-	 *
616
-	 * @since  3.12.0
617
-	 * @access protected
618
-	 * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
619
-	 */
620
-	protected $sample_data_service;
621
-
622
-	/**
623
-	 * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
624
-	 *
625
-	 * @since  3.12.0
626
-	 * @access protected
627
-	 * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
628
-	 */
629
-	protected $sample_data_ajax_adapter;
630
-
631
-	/**
632
-	 * The {@link Wordlift_Relation_Rebuild_Service} instance.
633
-	 *
634
-	 * @since  3.14.3
635
-	 * @access private
636
-	 * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance.
637
-	 */
638
-	private $relation_rebuild_service;
639
-
640
-	/**
641
-	 * The {@link Wordlift_Relation_Rebuild_Adapter} instance.
642
-	 *
643
-	 * @since  3.14.3
644
-	 * @access private
645
-	 * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance.
646
-	 */
647
-	private $relation_rebuild_adapter;
648
-
649
-	/**
650
-	 * The {@link Wordlift_Reference_Rebuild_Service} instance.
651
-	 *
652
-	 * @since  3.18.0
653
-	 * @access private
654
-	 * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance.
655
-	 */
656
-	private $reference_rebuild_service;
657
-
658
-	/**
659
-	 * The {@link Wordlift_Google_Analytics_Export_Service} instance.
660
-	 *
661
-	 * @since  3.16.0
662
-	 * @access protected
663
-	 * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance.
664
-	 */
665
-	protected $google_analytics_export_service;
666
-
667
-	/**
668
-	 * {@link Wordlift}'s singleton instance.
669
-	 *
670
-	 * @since  3.15.0
671
-	 * @access protected
672
-	 * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance.
673
-	 */
674
-	protected $entity_type_adapter;
675
-
676
-	/**
677
-	 * The {@link Wordlift_Storage_Factory} instance.
678
-	 *
679
-	 * @since  3.15.0
680
-	 * @access protected
681
-	 * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance.
682
-	 */
683
-	protected $storage_factory;
684
-
685
-	/**
686
-	 * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
687
-	 *
688
-	 * @since  3.15.0
689
-	 * @access protected
690
-	 * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
691
-	 */
692
-	protected $rendition_factory;
693
-
694
-	/**
695
-	 * The {@link Wordlift_Autocomplete_Adapter} instance.
696
-	 *
697
-	 * @since  3.15.0
698
-	 * @access private
699
-	 * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance.
700
-	 */
701
-	private $autocomplete_adapter;
702
-
703
-	/**
704
-	 * The {@link Wordlift_Relation_Service} instance.
705
-	 *
706
-	 * @since  3.15.0
707
-	 * @access protected
708
-	 * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
709
-	 */
710
-	protected $relation_service;
711
-
712
-	/**
713
-	 * The {@link Wordlift_Cached_Post_Converter} instance.
714
-	 *
715
-	 * @since  3.16.0
716
-	 * @access protected
717
-	 * @var  \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance.
718
-	 *
719
-	 */
720
-	protected $cached_postid_to_jsonld_converter;
721
-
722
-	/**
723
-	 * The {@link Wordlift_Entity_Uri_Service} instance.
724
-	 *
725
-	 * @since  3.16.3
726
-	 * @access protected
727
-	 * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
728
-	 */
729
-	protected $entity_uri_service;
730
-
731
-	/**
732
-	 * The {@link Wordlift_Publisher_Service} instance.
733
-	 *
734
-	 * @since  3.19.0
735
-	 * @access protected
736
-	 * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
737
-	 */
738
-	protected $publisher_service;
739
-
740
-	/**
741
-	 * The {@link Wordlift_Context_Cards_Service} instance.
742
-	 *
743
-	 * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance.
744
-	 */
745
-	protected $context_cards_service;
746
-
747
-	/**
748
-	 * {@link Wordlift}'s singleton instance.
749
-	 *
750
-	 * @since  3.11.2
751
-	 * @access private
752
-	 * @var Wordlift $instance {@link Wordlift}'s singleton instance.
753
-	 */
754
-	private static $instance;
755
-
756
-	/**
757
-	 * A singleton instance of features registry.
758
-	 * @since 3.30.0
759
-	 * @var Features_Registry
760
-	 */
761
-	private $features_registry;
762
-
763
-	//</editor-fold>
764
-
765
-	// Experimental code added by Nishit for feature request 1496
766
-	private $webhook_loader;
767
-	// Experimental code ents here
768
-
769
-	/**
770
-	 * Define the core functionality of the plugin.
771
-	 *
772
-	 * Set the plugin name and the plugin version that can be used throughout the plugin.
773
-	 * Load the dependencies, define the locale, and set the hooks for the admin area and
774
-	 * the public-facing side of the site.
775
-	 *
776
-	 * @since    1.0.0
777
-	 */
778
-	public function __construct() {
779
-
780
-		self::$instance = $this;
781
-
782
-		$this->plugin_name = 'wordlift';
783
-		$this->version     = '3.33.7';
784
-		$this->load_dependencies();
785
-		$this->set_locale();
786
-		$this->define_admin_hooks();
787
-		$this->define_public_hooks();
788
-
789
-		// If we're in `WP_CLI` load the related files.
790
-		if ( class_exists( 'WP_CLI' ) ) {
791
-			$this->load_cli_dependencies();
792
-		}
793
-
794
-	}
795
-
796
-	/**
797
-	 * Get the singleton instance.
798
-	 *
799
-	 * @return Wordlift The {@link Wordlift} singleton instance.
800
-	 * @since 3.11.2
801
-	 *
802
-	 */
803
-	public static function get_instance() {
804
-
805
-		return self::$instance;
806
-	}
807
-
808
-	/**
809
-	 * Load the required dependencies for this plugin.
810
-	 *
811
-	 * Include the following files that make up the plugin:
812
-	 *
813
-	 * - Wordlift_Loader. Orchestrates the hooks of the plugin.
814
-	 * - Wordlift_i18n. Defines internationalization functionality.
815
-	 * - Wordlift_Admin. Defines all hooks for the admin area.
816
-	 * - Wordlift_Public. Defines all hooks for the public side of the site.
817
-	 *
818
-	 * Create an instance of the loader which will be used to register the hooks
819
-	 * with WordPress.
820
-	 *
821
-	 * @throws Exception
822
-	 * @since    1.0.0
823
-	 * @access   private
824
-	 */
825
-	private function load_dependencies() {
826
-
827
-		/**
828
-		 * The class responsible for orchestrating the actions and filters of the
829
-		 * core plugin.
830
-		 */
831
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
832
-
833
-		// The class responsible for plugin uninstall.
834
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php';
835
-
836
-		/**
837
-		 * The class responsible for defining internationalization functionality
838
-		 * of the plugin.
839
-		 */
840
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
841
-
842
-		/**
843
-		 * WordLift's supported languages.
844
-		 */
845
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
846
-
847
-		/**
848
-		 * WordLift's supported countries.
849
-		 */
850
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php';
851
-
852
-		/**
853
-		 * Provide support functions to sanitize data.
854
-		 */
855
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
856
-
857
-		/** Services. */
858
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
859
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
860
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
861
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
862
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
863
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
864
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
865
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
866
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
867
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php';
868
-
869
-		/**
870
-		 * The Query builder.
871
-		 */
872
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
873
-
874
-		/**
875
-		 * The Schema service.
876
-		 */
877
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
878
-
879
-		/**
880
-		 * The schema:url property service.
881
-		 */
882
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
883
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
884
-
885
-		/**
886
-		 * The UI service.
887
-		 */
888
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
889
-
890
-		/**
891
-		 * The Thumbnail service.
892
-		 */
893
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
894
-
895
-		/**
896
-		 * The Entity Types Taxonomy service.
897
-		 */
898
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
899
-
900
-		/**
901
-		 * The Entity service.
902
-		 */
903
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
904
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
905
-
906
-		// Add the entity rating service.
907
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
908
-
909
-		/**
910
-		 * The User service.
911
-		 */
912
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
913
-
914
-		/**
915
-		 * The Timeline service.
916
-		 */
917
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
918
-
919
-		/**
920
-		 * The Topic Taxonomy service.
921
-		 */
922
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
923
-
924
-		/**
925
-		 * The SPARQL service.
926
-		 */
927
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
928
-
929
-		/**
930
-		 * The WordLift import service.
931
-		 */
932
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
933
-
934
-		/**
935
-		 * The WordLift URI service.
936
-		 */
937
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
938
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
939
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
940
-
941
-		/**
942
-		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
943
-		 */
944
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php';
945
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php';
946
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php';
947
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php';
948
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
949
-
950
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
951
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
952
-
953
-		/**
954
-		 * Load the converters.
955
-		 */
956
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
957
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
958
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
959
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
960
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
961
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
962
-
963
-		/**
964
-		 * Load cache-related files.
965
-		 */
966
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
967
-
968
-		/**
969
-		 * Load the content filter.
970
-		 */
971
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
972
-
973
-		/*
89
+    //<editor-fold desc="## FIELDS">
90
+
91
+    /**
92
+     * The loader that's responsible for maintaining and registering all hooks that power
93
+     * the plugin.
94
+     *
95
+     * @since    1.0.0
96
+     * @access   protected
97
+     * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
98
+     */
99
+    protected $loader;
100
+
101
+    /**
102
+     * The unique identifier of this plugin.
103
+     *
104
+     * @since    1.0.0
105
+     * @access   protected
106
+     * @var      string $plugin_name The string used to uniquely identify this plugin.
107
+     */
108
+    protected $plugin_name;
109
+
110
+    /**
111
+     * The current version of the plugin.
112
+     *
113
+     * @since    1.0.0
114
+     * @access   protected
115
+     * @var      string $version The current version of the plugin.
116
+     */
117
+    protected $version;
118
+
119
+    /**
120
+     * The {@link Wordlift_Tinymce_Adapter} instance.
121
+     *
122
+     * @since  3.12.0
123
+     * @access protected
124
+     * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
125
+     */
126
+    protected $tinymce_adapter;
127
+
128
+    /**
129
+     * The {@link Faq_Tinymce_Adapter} instance
130
+     * @since 3.26.0
131
+     * @access protected
132
+     * @var Faq_Tinymce_Adapter $faq_tinymce_adapter .
133
+     */
134
+    //protected $faq_tinymce_adapter;
135
+
136
+    /**
137
+     * The Thumbnail service.
138
+     *
139
+     * @since  3.1.5
140
+     * @access private
141
+     * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
142
+     */
143
+    private $thumbnail_service;
144
+
145
+    /**
146
+     * The UI service.
147
+     *
148
+     * @since  3.2.0
149
+     * @access private
150
+     * @var \Wordlift_UI_Service $ui_service The UI service.
151
+     */
152
+    private $ui_service;
153
+
154
+    /**
155
+     * The Schema service.
156
+     *
157
+     * @since  3.3.0
158
+     * @access protected
159
+     * @var \Wordlift_Schema_Service $schema_service The Schema service.
160
+     */
161
+    protected $schema_service;
162
+
163
+    /**
164
+     * The Entity service.
165
+     *
166
+     * @since  3.1.0
167
+     * @access protected
168
+     * @var \Wordlift_Entity_Service $entity_service The Entity service.
169
+     */
170
+    protected $entity_service;
171
+
172
+    /**
173
+     * The Topic Taxonomy service.
174
+     *
175
+     * @since  3.5.0
176
+     * @access private
177
+     * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
178
+     */
179
+    private $topic_taxonomy_service;
180
+
181
+    /**
182
+     * The Entity Types Taxonomy service.
183
+     *
184
+     * @since  3.18.0
185
+     * @access private
186
+     * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service.
187
+     */
188
+    private $entity_types_taxonomy_service;
189
+
190
+    /**
191
+     * The User service.
192
+     *
193
+     * @since  3.1.7
194
+     * @access protected
195
+     * @var \Wordlift_User_Service $user_service The User service.
196
+     */
197
+    protected $user_service;
198
+
199
+    /**
200
+     * The Timeline service.
201
+     *
202
+     * @since  3.1.0
203
+     * @access private
204
+     * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
205
+     */
206
+    private $timeline_service;
207
+
208
+    /**
209
+     * The Redirect service.
210
+     *
211
+     * @since  3.2.0
212
+     * @access private
213
+     * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
214
+     */
215
+    private $redirect_service;
216
+
217
+    /**
218
+     * The Notice service.
219
+     *
220
+     * @since  3.3.0
221
+     * @access private
222
+     * @var \Wordlift_Notice_Service $notice_service The Notice service.
223
+     */
224
+    private $notice_service;
225
+
226
+    /**
227
+     * The Entity list customization.
228
+     *
229
+     * @since  3.3.0
230
+     * @access protected
231
+     * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
232
+     */
233
+    protected $entity_list_service;
234
+
235
+    /**
236
+     * The Entity Types Taxonomy Walker.
237
+     *
238
+     * @since  3.1.0
239
+     * @access private
240
+     * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
241
+     */
242
+    private $entity_types_taxonomy_walker;
243
+
244
+    /**
245
+     * The ShareThis service.
246
+     *
247
+     * @since  3.2.0
248
+     * @access private
249
+     * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
250
+     */
251
+    private $sharethis_service;
252
+
253
+    /**
254
+     * The PrimaShop adapter.
255
+     *
256
+     * @since  3.2.3
257
+     * @access private
258
+     * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
259
+     */
260
+    private $primashop_adapter;
261
+
262
+    /**
263
+     * The WordLift Dashboard adapter.
264
+     *
265
+     * @since  3.4.0
266
+     * @access private
267
+     * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
268
+     */
269
+    private $dashboard_service;
270
+
271
+    /**
272
+     * The entity type service.
273
+     *
274
+     * @since  3.6.0
275
+     * @access private
276
+     * @var \Wordlift_Entity_Post_Type_Service
277
+     */
278
+    private $entity_post_type_service;
279
+
280
+    /**
281
+     * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
282
+     *
283
+     * @since  3.6.0
284
+     * @access private
285
+     * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance.
286
+     */
287
+    private $entity_link_service;
288
+
289
+    /**
290
+     * A {@link Wordlift_Sparql_Service} instance.
291
+     *
292
+     * @since    3.6.0
293
+     * @access   protected
294
+     * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
295
+     */
296
+    protected $sparql_service;
297
+
298
+    /**
299
+     * A {@link Wordlift_Import_Service} instance.
300
+     *
301
+     * @since  3.6.0
302
+     * @access private
303
+     * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
304
+     */
305
+    private $import_service;
306
+
307
+    /**
308
+     * A {@link Wordlift_Rebuild_Service} instance.
309
+     *
310
+     * @since  3.6.0
311
+     * @access private
312
+     * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
313
+     */
314
+    private $rebuild_service;
315
+
316
+    /**
317
+     * A {@link Wordlift_Jsonld_Service} instance.
318
+     *
319
+     * @since  3.7.0
320
+     * @access protected
321
+     * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
322
+     */
323
+    protected $jsonld_service;
324
+
325
+    /**
326
+     * A {@link Wordlift_Website_Jsonld_Converter} instance.
327
+     *
328
+     * @since  3.14.0
329
+     * @access protected
330
+     * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance.
331
+     */
332
+    protected $jsonld_website_converter;
333
+
334
+    /**
335
+     * A {@link Wordlift_Property_Factory} instance.
336
+     *
337
+     * @since  3.7.0
338
+     * @access private
339
+     * @var \Wordlift_Property_Factory $property_factory
340
+     */
341
+    private $property_factory;
342
+
343
+    /**
344
+     * The 'Download Your Data' page.
345
+     *
346
+     * @since  3.6.0
347
+     * @access private
348
+     * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
349
+     */
350
+    private $download_your_data_page;
351
+
352
+    /**
353
+     * The 'WordLift Settings' page.
354
+     *
355
+     * @since  3.11.0
356
+     * @access protected
357
+     * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
358
+     */
359
+    protected $settings_page;
360
+
361
+    /**
362
+     * The install wizard page.
363
+     *
364
+     * @since  3.9.0
365
+     * @access private
366
+     * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
367
+     */
368
+    public $admin_setup;
369
+
370
+    /**
371
+     * The Content Filter Service hooks up to the 'the_content' filter and provides
372
+     * linking of entities to their pages.
373
+     *
374
+     * @since  3.8.0
375
+     * @access private
376
+     * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
377
+     */
378
+    private $content_filter_service;
379
+
380
+    /**
381
+     * The Faq Content filter service
382
+     * @since  3.26.0
383
+     * @access private
384
+     * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance.
385
+     */
386
+    private $faq_content_filter_service;
387
+
388
+    /**
389
+     * A {@link Wordlift_Key_Validation_Service} instance.
390
+     *
391
+     * @since  3.9.0
392
+     * @access private
393
+     * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
394
+     */
395
+    private $key_validation_service;
396
+
397
+    /**
398
+     * A {@link Wordlift_Rating_Service} instance.
399
+     *
400
+     * @since  3.10.0
401
+     * @access private
402
+     * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
403
+     */
404
+    private $rating_service;
405
+
406
+    /**
407
+     * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
408
+     *
409
+     * @since  3.10.0
410
+     * @access protected
411
+     * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
412
+     */
413
+    protected $post_to_jsonld_converter;
414
+
415
+    /**
416
+     * A {@link Wordlift_Configuration_Service} instance.
417
+     *
418
+     * @since  3.10.0
419
+     * @access protected
420
+     * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
421
+     */
422
+    protected $configuration_service;
423
+
424
+    /**
425
+     * A {@link Wordlift_Install_Service} instance.
426
+     *
427
+     * @since  3.18.0
428
+     * @access protected
429
+     * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance.
430
+     */
431
+    protected $install_service;
432
+
433
+    /**
434
+     * A {@link Wordlift_Entity_Type_Service} instance.
435
+     *
436
+     * @since  3.10.0
437
+     * @access protected
438
+     * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
439
+     */
440
+    protected $entity_type_service;
441
+
442
+    /**
443
+     * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
444
+     *
445
+     * @since  3.10.0
446
+     * @access protected
447
+     * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
448
+     */
449
+    protected $entity_post_to_jsonld_converter;
450
+
451
+    /**
452
+     * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
453
+     *
454
+     * @since  3.10.0
455
+     * @access protected
456
+     * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
457
+     */
458
+    protected $postid_to_jsonld_converter;
459
+
460
+    /**
461
+     * The {@link Wordlift_Admin_Status_Page} class.
462
+     *
463
+     * @since  3.9.8
464
+     * @access private
465
+     * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
466
+     */
467
+    private $status_page;
468
+
469
+    /**
470
+     * The {@link Wordlift_Category_Taxonomy_Service} instance.
471
+     *
472
+     * @since  3.11.0
473
+     * @access protected
474
+     * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
475
+     */
476
+    protected $category_taxonomy_service;
477
+
478
+    /**
479
+     * The {@link Wordlift_Entity_Page_Service} instance.
480
+     *
481
+     * @since  3.11.0
482
+     * @access protected
483
+     * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance.
484
+     */
485
+    protected $entity_page_service;
486
+
487
+    /**
488
+     * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
489
+     *
490
+     * @since  3.11.0
491
+     * @access protected
492
+     * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
493
+     */
494
+    protected $settings_page_action_link;
495
+
496
+    /**
497
+     * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
498
+     *
499
+     * @since  3.11.0
500
+     * @access protected
501
+     * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
502
+     */
503
+    protected $analytics_settings_page_action_link;
504
+
505
+    /**
506
+     * The {@link Wordlift_Analytics_Connect} class.
507
+     *
508
+     * @since  3.11.0
509
+     * @access protected
510
+     * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class.
511
+     */
512
+    protected $analytics_connect;
513
+
514
+    /**
515
+     * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
516
+     *
517
+     * @since  3.11.0
518
+     * @access protected
519
+     * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
520
+     */
521
+    protected $publisher_ajax_adapter;
522
+
523
+    /**
524
+     * The {@link Wordlift_Admin_Input_Element} element renderer.
525
+     *
526
+     * @since  3.11.0
527
+     * @access protected
528
+     * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
529
+     */
530
+    protected $input_element;
531
+
532
+    /**
533
+     * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
534
+     *
535
+     * @since  3.13.0
536
+     * @access protected
537
+     * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
538
+     */
539
+    protected $radio_input_element;
540
+
541
+    /**
542
+     * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
543
+     *
544
+     * @since  3.11.0
545
+     * @access protected
546
+     * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
547
+     */
548
+    protected $language_select_element;
549
+
550
+    /**
551
+     * The {@link Wordlift_Admin_Country_Select_Element} element renderer.
552
+     *
553
+     * @since  3.18.0
554
+     * @access protected
555
+     * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer.
556
+     */
557
+    protected $country_select_element;
558
+
559
+    /**
560
+     * The {@link Wordlift_Admin_Publisher_Element} element renderer.
561
+     *
562
+     * @since  3.11.0
563
+     * @access protected
564
+     * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
565
+     */
566
+    protected $publisher_element;
567
+
568
+    /**
569
+     * The {@link Wordlift_Admin_Select2_Element} element renderer.
570
+     *
571
+     * @since  3.11.0
572
+     * @access protected
573
+     * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
574
+     */
575
+    protected $select2_element;
576
+
577
+    /**
578
+     * The controller for the entity type list admin page
579
+     *
580
+     * @since  3.11.0
581
+     * @access private
582
+     * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
583
+     */
584
+    private $entity_type_admin_page;
585
+
586
+    /**
587
+     * The controller for the entity type settings admin page
588
+     *
589
+     * @since  3.11.0
590
+     * @access private
591
+     * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
592
+     */
593
+    private $entity_type_settings_admin_page;
594
+
595
+    /**
596
+     * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
597
+     *
598
+     * @since  3.11.0
599
+     * @access protected
600
+     * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
601
+     */
602
+    protected $related_entities_cloud_widget;
603
+
604
+    /**
605
+     * The {@link Wordlift_Admin_Author_Element} instance.
606
+     *
607
+     * @since  3.14.0
608
+     * @access protected
609
+     * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
610
+     */
611
+    protected $author_element;
612
+
613
+    /**
614
+     * The {@link Wordlift_Sample_Data_Service} instance.
615
+     *
616
+     * @since  3.12.0
617
+     * @access protected
618
+     * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
619
+     */
620
+    protected $sample_data_service;
621
+
622
+    /**
623
+     * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
624
+     *
625
+     * @since  3.12.0
626
+     * @access protected
627
+     * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
628
+     */
629
+    protected $sample_data_ajax_adapter;
630
+
631
+    /**
632
+     * The {@link Wordlift_Relation_Rebuild_Service} instance.
633
+     *
634
+     * @since  3.14.3
635
+     * @access private
636
+     * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance.
637
+     */
638
+    private $relation_rebuild_service;
639
+
640
+    /**
641
+     * The {@link Wordlift_Relation_Rebuild_Adapter} instance.
642
+     *
643
+     * @since  3.14.3
644
+     * @access private
645
+     * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance.
646
+     */
647
+    private $relation_rebuild_adapter;
648
+
649
+    /**
650
+     * The {@link Wordlift_Reference_Rebuild_Service} instance.
651
+     *
652
+     * @since  3.18.0
653
+     * @access private
654
+     * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance.
655
+     */
656
+    private $reference_rebuild_service;
657
+
658
+    /**
659
+     * The {@link Wordlift_Google_Analytics_Export_Service} instance.
660
+     *
661
+     * @since  3.16.0
662
+     * @access protected
663
+     * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance.
664
+     */
665
+    protected $google_analytics_export_service;
666
+
667
+    /**
668
+     * {@link Wordlift}'s singleton instance.
669
+     *
670
+     * @since  3.15.0
671
+     * @access protected
672
+     * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance.
673
+     */
674
+    protected $entity_type_adapter;
675
+
676
+    /**
677
+     * The {@link Wordlift_Storage_Factory} instance.
678
+     *
679
+     * @since  3.15.0
680
+     * @access protected
681
+     * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance.
682
+     */
683
+    protected $storage_factory;
684
+
685
+    /**
686
+     * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
687
+     *
688
+     * @since  3.15.0
689
+     * @access protected
690
+     * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
691
+     */
692
+    protected $rendition_factory;
693
+
694
+    /**
695
+     * The {@link Wordlift_Autocomplete_Adapter} instance.
696
+     *
697
+     * @since  3.15.0
698
+     * @access private
699
+     * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance.
700
+     */
701
+    private $autocomplete_adapter;
702
+
703
+    /**
704
+     * The {@link Wordlift_Relation_Service} instance.
705
+     *
706
+     * @since  3.15.0
707
+     * @access protected
708
+     * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
709
+     */
710
+    protected $relation_service;
711
+
712
+    /**
713
+     * The {@link Wordlift_Cached_Post_Converter} instance.
714
+     *
715
+     * @since  3.16.0
716
+     * @access protected
717
+     * @var  \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance.
718
+     *
719
+     */
720
+    protected $cached_postid_to_jsonld_converter;
721
+
722
+    /**
723
+     * The {@link Wordlift_Entity_Uri_Service} instance.
724
+     *
725
+     * @since  3.16.3
726
+     * @access protected
727
+     * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
728
+     */
729
+    protected $entity_uri_service;
730
+
731
+    /**
732
+     * The {@link Wordlift_Publisher_Service} instance.
733
+     *
734
+     * @since  3.19.0
735
+     * @access protected
736
+     * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
737
+     */
738
+    protected $publisher_service;
739
+
740
+    /**
741
+     * The {@link Wordlift_Context_Cards_Service} instance.
742
+     *
743
+     * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance.
744
+     */
745
+    protected $context_cards_service;
746
+
747
+    /**
748
+     * {@link Wordlift}'s singleton instance.
749
+     *
750
+     * @since  3.11.2
751
+     * @access private
752
+     * @var Wordlift $instance {@link Wordlift}'s singleton instance.
753
+     */
754
+    private static $instance;
755
+
756
+    /**
757
+     * A singleton instance of features registry.
758
+     * @since 3.30.0
759
+     * @var Features_Registry
760
+     */
761
+    private $features_registry;
762
+
763
+    //</editor-fold>
764
+
765
+    // Experimental code added by Nishit for feature request 1496
766
+    private $webhook_loader;
767
+    // Experimental code ents here
768
+
769
+    /**
770
+     * Define the core functionality of the plugin.
771
+     *
772
+     * Set the plugin name and the plugin version that can be used throughout the plugin.
773
+     * Load the dependencies, define the locale, and set the hooks for the admin area and
774
+     * the public-facing side of the site.
775
+     *
776
+     * @since    1.0.0
777
+     */
778
+    public function __construct() {
779
+
780
+        self::$instance = $this;
781
+
782
+        $this->plugin_name = 'wordlift';
783
+        $this->version     = '3.33.7';
784
+        $this->load_dependencies();
785
+        $this->set_locale();
786
+        $this->define_admin_hooks();
787
+        $this->define_public_hooks();
788
+
789
+        // If we're in `WP_CLI` load the related files.
790
+        if ( class_exists( 'WP_CLI' ) ) {
791
+            $this->load_cli_dependencies();
792
+        }
793
+
794
+    }
795
+
796
+    /**
797
+     * Get the singleton instance.
798
+     *
799
+     * @return Wordlift The {@link Wordlift} singleton instance.
800
+     * @since 3.11.2
801
+     *
802
+     */
803
+    public static function get_instance() {
804
+
805
+        return self::$instance;
806
+    }
807
+
808
+    /**
809
+     * Load the required dependencies for this plugin.
810
+     *
811
+     * Include the following files that make up the plugin:
812
+     *
813
+     * - Wordlift_Loader. Orchestrates the hooks of the plugin.
814
+     * - Wordlift_i18n. Defines internationalization functionality.
815
+     * - Wordlift_Admin. Defines all hooks for the admin area.
816
+     * - Wordlift_Public. Defines all hooks for the public side of the site.
817
+     *
818
+     * Create an instance of the loader which will be used to register the hooks
819
+     * with WordPress.
820
+     *
821
+     * @throws Exception
822
+     * @since    1.0.0
823
+     * @access   private
824
+     */
825
+    private function load_dependencies() {
826
+
827
+        /**
828
+         * The class responsible for orchestrating the actions and filters of the
829
+         * core plugin.
830
+         */
831
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
832
+
833
+        // The class responsible for plugin uninstall.
834
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php';
835
+
836
+        /**
837
+         * The class responsible for defining internationalization functionality
838
+         * of the plugin.
839
+         */
840
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
841
+
842
+        /**
843
+         * WordLift's supported languages.
844
+         */
845
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
846
+
847
+        /**
848
+         * WordLift's supported countries.
849
+         */
850
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php';
851
+
852
+        /**
853
+         * Provide support functions to sanitize data.
854
+         */
855
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
856
+
857
+        /** Services. */
858
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
859
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
860
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
861
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
862
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
863
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
864
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
865
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
866
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
867
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php';
868
+
869
+        /**
870
+         * The Query builder.
871
+         */
872
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
873
+
874
+        /**
875
+         * The Schema service.
876
+         */
877
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
878
+
879
+        /**
880
+         * The schema:url property service.
881
+         */
882
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
883
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
884
+
885
+        /**
886
+         * The UI service.
887
+         */
888
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
889
+
890
+        /**
891
+         * The Thumbnail service.
892
+         */
893
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
894
+
895
+        /**
896
+         * The Entity Types Taxonomy service.
897
+         */
898
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
899
+
900
+        /**
901
+         * The Entity service.
902
+         */
903
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
904
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
905
+
906
+        // Add the entity rating service.
907
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
908
+
909
+        /**
910
+         * The User service.
911
+         */
912
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
913
+
914
+        /**
915
+         * The Timeline service.
916
+         */
917
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
918
+
919
+        /**
920
+         * The Topic Taxonomy service.
921
+         */
922
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
923
+
924
+        /**
925
+         * The SPARQL service.
926
+         */
927
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
928
+
929
+        /**
930
+         * The WordLift import service.
931
+         */
932
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
933
+
934
+        /**
935
+         * The WordLift URI service.
936
+         */
937
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
938
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
939
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
940
+
941
+        /**
942
+         * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
943
+         */
944
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php';
945
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php';
946
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php';
947
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php';
948
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
949
+
950
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
951
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
952
+
953
+        /**
954
+         * Load the converters.
955
+         */
956
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
957
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
958
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
959
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
960
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
961
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
962
+
963
+        /**
964
+         * Load cache-related files.
965
+         */
966
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
967
+
968
+        /**
969
+         * Load the content filter.
970
+         */
971
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
972
+
973
+        /*
974 974
 		 * Load the excerpt helper.
975 975
 		 */
976
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
977
-
978
-		/**
979
-		 * Load the JSON-LD service to publish entities using JSON-LD.s
980
-		 *
981
-		 * @since 3.8.0
982
-		 */
983
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
984
-
985
-		// The Publisher Service and the AJAX adapter.
986
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
987
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
988
-
989
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
990
-
991
-		/**
992
-		 * Load the WordLift key validation service.
993
-		 */
994
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
995
-
996
-		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
997
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
998
-
999
-		// Load the `Wordlift_Entity_Page_Service` class definition.
1000
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
1001
-
1002
-		/** Linked Data. */
1003
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
1004
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
1005
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
1006
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
1007
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
1008
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
1009
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
1010
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
1011
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
1012
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
1013
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
1014
-
1015
-		/** Linked Data Rendition. */
1016
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
1017
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
1018
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
1019
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
1020
-
1021
-		/** Services. */
1022
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
1023
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php';
1024
-
1025
-		/** Adapters. */
1026
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
1027
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
1028
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
1029
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
1030
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php';
1031
-
1032
-		/** Async Tasks. */
1033
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
1034
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
1035
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php';
1036
-
1037
-		/** Autocomplete. */
1038
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
1039
-
1040
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
1041
-
1042
-		/** Analytics */
1043
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php';
1044
-
1045
-		/**
1046
-		 * The class responsible for defining all actions that occur in the admin area.
1047
-		 */
1048
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
1049
-
1050
-		/**
1051
-		 * The class to customize the entity list admin page.
1052
-		 */
1053
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
1054
-
1055
-		/**
1056
-		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
1057
-		 */
1058
-		global $wp_version;
1059
-		if ( version_compare( $wp_version, '5.3', '<' ) ) {
1060
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
1061
-		} else {
1062
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php';
1063
-		}
1064
-
1065
-		/**
1066
-		 * The Notice service.
1067
-		 */
1068
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
1069
-
1070
-		/**
1071
-		 * The PrimaShop adapter.
1072
-		 */
1073
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
1074
-
1075
-		/**
1076
-		 * The WordLift Dashboard service.
1077
-		 */
1078
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
1079
-
1080
-		/**
1081
-		 * The admin 'Install wizard' page.
1082
-		 */
1083
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
1084
-
1085
-		/**
1086
-		 * The WordLift entity type list admin page controller.
1087
-		 */
1088
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1089
-
1090
-		/**
1091
-		 * The WordLift entity type settings admin page controller.
1092
-		 */
1093
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
1094
-
1095
-		/**
1096
-		 * The admin 'Download Your Data' page.
1097
-		 */
1098
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
1099
-
1100
-		/**
1101
-		 * The admin 'WordLift Settings' page.
1102
-		 */
1103
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php';
1104
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php';
1105
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php';
1106
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php';
1107
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php';
1108
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php';
1109
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php';
1110
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php';
1111
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php';
1112
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php';
1113
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
1114
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
1115
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php';
1116
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
1117
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php';
1118
-
1119
-		/** Admin Pages */
1120
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
1121
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
1122
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
1123
-
1124
-		/**
1125
-		 * The class responsible for defining all actions that occur in the public-facing
1126
-		 * side of the site.
1127
-		 */
1128
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1129
-
1130
-		/**
1131
-		 * The shortcode abstract class.
1132
-		 */
1133
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1134
-
1135
-		/**
1136
-		 * The Timeline shortcode.
1137
-		 */
1138
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1139
-
1140
-		/**
1141
-		 * The Navigator shortcode.
1142
-		 */
1143
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1144
-
1145
-		/**
1146
-		 * The Products Navigator shortcode.
1147
-		 */
1148
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php';
1149
-
1150
-		/**
1151
-		 * The chord shortcode.
1152
-		 */
1153
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1154
-
1155
-		/**
1156
-		 * The geomap shortcode.
1157
-		 */
1158
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1159
-
1160
-		/**
1161
-		 * The entity cloud shortcode.
1162
-		 */
1163
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1164
-
1165
-		/**
1166
-		 * The entity glossary shortcode.
1167
-		 */
1168
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1169
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1170
-
1171
-		/**
1172
-		 * Faceted Search shortcode.
1173
-		 */
1174
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php';
1175
-
1176
-		/**
1177
-		 * The ShareThis service.
1178
-		 */
1179
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1180
-
1181
-		/**
1182
-		 * The SEO service.
1183
-		 */
1184
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1185
-
1186
-		/**
1187
-		 * The AMP service.
1188
-		 */
1189
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1190
-
1191
-		/** Widgets */
1192
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1193
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1194
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php';
1195
-
1196
-		/*
976
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
977
+
978
+        /**
979
+         * Load the JSON-LD service to publish entities using JSON-LD.s
980
+         *
981
+         * @since 3.8.0
982
+         */
983
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
984
+
985
+        // The Publisher Service and the AJAX adapter.
986
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
987
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
988
+
989
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
990
+
991
+        /**
992
+         * Load the WordLift key validation service.
993
+         */
994
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
995
+
996
+        // Load the `Wordlift_Category_Taxonomy_Service` class definition.
997
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
998
+
999
+        // Load the `Wordlift_Entity_Page_Service` class definition.
1000
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
1001
+
1002
+        /** Linked Data. */
1003
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
1004
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
1005
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
1006
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
1007
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
1008
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
1009
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
1010
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
1011
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
1012
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
1013
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
1014
+
1015
+        /** Linked Data Rendition. */
1016
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
1017
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
1018
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
1019
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
1020
+
1021
+        /** Services. */
1022
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
1023
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php';
1024
+
1025
+        /** Adapters. */
1026
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
1027
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
1028
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
1029
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
1030
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php';
1031
+
1032
+        /** Async Tasks. */
1033
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
1034
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
1035
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php';
1036
+
1037
+        /** Autocomplete. */
1038
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
1039
+
1040
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
1041
+
1042
+        /** Analytics */
1043
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php';
1044
+
1045
+        /**
1046
+         * The class responsible for defining all actions that occur in the admin area.
1047
+         */
1048
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
1049
+
1050
+        /**
1051
+         * The class to customize the entity list admin page.
1052
+         */
1053
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
1054
+
1055
+        /**
1056
+         * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
1057
+         */
1058
+        global $wp_version;
1059
+        if ( version_compare( $wp_version, '5.3', '<' ) ) {
1060
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
1061
+        } else {
1062
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php';
1063
+        }
1064
+
1065
+        /**
1066
+         * The Notice service.
1067
+         */
1068
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
1069
+
1070
+        /**
1071
+         * The PrimaShop adapter.
1072
+         */
1073
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
1074
+
1075
+        /**
1076
+         * The WordLift Dashboard service.
1077
+         */
1078
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
1079
+
1080
+        /**
1081
+         * The admin 'Install wizard' page.
1082
+         */
1083
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
1084
+
1085
+        /**
1086
+         * The WordLift entity type list admin page controller.
1087
+         */
1088
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1089
+
1090
+        /**
1091
+         * The WordLift entity type settings admin page controller.
1092
+         */
1093
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
1094
+
1095
+        /**
1096
+         * The admin 'Download Your Data' page.
1097
+         */
1098
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
1099
+
1100
+        /**
1101
+         * The admin 'WordLift Settings' page.
1102
+         */
1103
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php';
1104
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php';
1105
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php';
1106
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php';
1107
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php';
1108
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php';
1109
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php';
1110
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php';
1111
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php';
1112
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php';
1113
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
1114
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
1115
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page.php';
1116
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
1117
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php';
1118
+
1119
+        /** Admin Pages */
1120
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
1121
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
1122
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
1123
+
1124
+        /**
1125
+         * The class responsible for defining all actions that occur in the public-facing
1126
+         * side of the site.
1127
+         */
1128
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1129
+
1130
+        /**
1131
+         * The shortcode abstract class.
1132
+         */
1133
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1134
+
1135
+        /**
1136
+         * The Timeline shortcode.
1137
+         */
1138
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1139
+
1140
+        /**
1141
+         * The Navigator shortcode.
1142
+         */
1143
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1144
+
1145
+        /**
1146
+         * The Products Navigator shortcode.
1147
+         */
1148
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-products-navigator-shortcode.php';
1149
+
1150
+        /**
1151
+         * The chord shortcode.
1152
+         */
1153
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1154
+
1155
+        /**
1156
+         * The geomap shortcode.
1157
+         */
1158
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1159
+
1160
+        /**
1161
+         * The entity cloud shortcode.
1162
+         */
1163
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1164
+
1165
+        /**
1166
+         * The entity glossary shortcode.
1167
+         */
1168
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1169
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1170
+
1171
+        /**
1172
+         * Faceted Search shortcode.
1173
+         */
1174
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php';
1175
+
1176
+        /**
1177
+         * The ShareThis service.
1178
+         */
1179
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1180
+
1181
+        /**
1182
+         * The SEO service.
1183
+         */
1184
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1185
+
1186
+        /**
1187
+         * The AMP service.
1188
+         */
1189
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1190
+
1191
+        /** Widgets */
1192
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1193
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1194
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-context-cards.php';
1195
+
1196
+        /*
1197 1197
 		 * Schema.org Services.
1198 1198
 		 *
1199 1199
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1200 1200
 		 */
1201
-		if ( WL_ALL_ENTITY_TYPES ) {
1202
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php';
1203
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php';
1204
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php';
1205
-			new Wordlift_Schemaorg_Sync_Service();
1206
-			$schemaorg_property_service = new Wordlift_Schemaorg_Property_Service();
1207
-			new Wordlift_Schemaorg_Class_Service();
1208
-		} else {
1209
-			$schemaorg_property_service = null;
1210
-		}
1211
-
1212
-		$this->loader = new Wordlift_Loader();
1213
-		/**
1214
-		 * @since 3.30.0
1215
-		 */
1216
-		$this->features_registry = Features_Registry::get_instance();
1201
+        if ( WL_ALL_ENTITY_TYPES ) {
1202
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php';
1203
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php';
1204
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php';
1205
+            new Wordlift_Schemaorg_Sync_Service();
1206
+            $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service();
1207
+            new Wordlift_Schemaorg_Class_Service();
1208
+        } else {
1209
+            $schemaorg_property_service = null;
1210
+        }
1217 1211
 
1218
-		// Instantiate a global logger.
1219
-		global $wl_logger;
1220
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1212
+        $this->loader = new Wordlift_Loader();
1213
+        /**
1214
+         * @since 3.30.0
1215
+         */
1216
+        $this->features_registry = Features_Registry::get_instance();
1221 1217
 
1222
-		// Load the `wl-api` end-point.
1223
-		new Wordlift_Http_Api();
1218
+        // Instantiate a global logger.
1219
+        global $wl_logger;
1220
+        $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1224 1221
 
1225
-		// Load the Install Service.
1226
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
1227
-		$this->install_service = new Wordlift_Install_Service();
1222
+        // Load the `wl-api` end-point.
1223
+        new Wordlift_Http_Api();
1228 1224
 
1229
-		/** Services. */
1230
-		// Create the configuration service.
1231
-		$this->configuration_service = new Wordlift_Configuration_Service();
1232
-		$api_service                 = new Wordlift_Api_Service( $this->configuration_service );
1225
+        // Load the Install Service.
1226
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
1227
+        $this->install_service = new Wordlift_Install_Service();
1233 1228
 
1234
-		// Create an entity type service instance. It'll be later bound to the init action.
1235
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1229
+        /** Services. */
1230
+        // Create the configuration service.
1231
+        $this->configuration_service = new Wordlift_Configuration_Service();
1232
+        $api_service                 = new Wordlift_Api_Service( $this->configuration_service );
1236 1233
 
1237
-		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1238
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1234
+        // Create an entity type service instance. It'll be later bound to the init action.
1235
+        $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1239 1236
 
1240
-		// Create an instance of the UI service.
1241
-		$this->ui_service = new Wordlift_UI_Service();
1237
+        // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1238
+        $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1242 1239
 
1243
-		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
1244
-		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
1240
+        // Create an instance of the UI service.
1241
+        $this->ui_service = new Wordlift_UI_Service();
1245 1242
 
1246
-		$this->sparql_service        = new Wordlift_Sparql_Service();
1247
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1248
-		$this->notice_service        = new Wordlift_Notice_Service();
1249
-		$this->relation_service      = new Wordlift_Relation_Service();
1243
+        // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
1244
+        $this->thumbnail_service = new Wordlift_Thumbnail_Service();
1250 1245
 
1251
-		$entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1252
-		$this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1253
-		$this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1254
-		$this->user_service       = new Wordlift_User_Service( $this->sparql_service, $this->entity_service );
1246
+        $this->sparql_service        = new Wordlift_Sparql_Service();
1247
+        $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1248
+        $this->notice_service        = new Wordlift_Notice_Service();
1249
+        $this->relation_service      = new Wordlift_Relation_Service();
1255 1250
 
1256
-		// Instantiate the JSON-LD service.
1257
-		$property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1251
+        $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1252
+        $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1253
+        $this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1254
+        $this->user_service       = new Wordlift_User_Service( $this->sparql_service, $this->entity_service );
1258 1255
 
1259
-		/** Linked Data. */
1260
-		$this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1261
-		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1256
+        // Instantiate the JSON-LD service.
1257
+        $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1262 1258
 
1263
-		$this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1259
+        /** Linked Data. */
1260
+        $this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1261
+        $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1264 1262
 
1265
-		// Create a new instance of the Redirect service.
1266
-		$this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_uri_service );
1267
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1263
+        $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1268 1264
 
1269
-		// Create a new instance of the Timeline service and Timeline shortcode.
1270
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1265
+        // Create a new instance of the Redirect service.
1266
+        $this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_uri_service );
1267
+        $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1271 1268
 
1272
-		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1269
+        // Create a new instance of the Timeline service and Timeline shortcode.
1270
+        $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1273 1271
 
1274
-		$this->topic_taxonomy_service        = new Wordlift_Topic_Taxonomy_Service();
1275
-		$this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service();
1272
+        $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1276 1273
 
1277
-		// Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1278
-		$this->sharethis_service = new Wordlift_ShareThis_Service();
1274
+        $this->topic_taxonomy_service        = new Wordlift_Topic_Taxonomy_Service();
1275
+        $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service();
1279 1276
 
1280
-		// Create an instance of the PrimaShop adapter.
1281
-		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1277
+        // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1278
+        $this->sharethis_service = new Wordlift_ShareThis_Service();
1282 1279
 
1283
-		// Create an import service instance to hook later to WP's import function.
1284
-		$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() );
1280
+        // Create an instance of the PrimaShop adapter.
1281
+        $this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1285 1282
 
1286
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1283
+        // Create an import service instance to hook later to WP's import function.
1284
+        $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() );
1287 1285
 
1288
-		// Create the entity rating service.
1289
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1286
+        $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1290 1287
 
1291
-		// Create entity list customization (wp-admin/edit.php).
1292
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1288
+        // Create the entity rating service.
1289
+        $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1293 1290
 
1294
-		// Create a new instance of the Redirect service.
1295
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1291
+        // Create entity list customization (wp-admin/edit.php).
1292
+        $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1296 1293
 
1297
-		// Create an instance of the Publisher Service and the AJAX Adapter.
1298
-		$this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service );
1299
-		$this->property_factory  = new Wordlift_Property_Factory( $schema_url_property_service );
1300
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1294
+        // Create a new instance of the Redirect service.
1295
+        $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1301 1296
 
1302
-		$attachment_service = new Wordlift_Attachment_Service();
1297
+        // Create an instance of the Publisher Service and the AJAX Adapter.
1298
+        $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service );
1299
+        $this->property_factory  = new Wordlift_Property_Factory( $schema_url_property_service );
1300
+        $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1303 1301
 
1304
-		// Instantiate the JSON-LD service.
1305
-		$property_getter                       = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1306
-		$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 );
1307
-		$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 );
1308
-		$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 );
1309
-		$this->jsonld_website_converter        = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1302
+        $attachment_service = new Wordlift_Attachment_Service();
1310 1303
 
1311
-		$jsonld_cache                            = new Ttl_Cache( 'jsonld', 86400 );
1312
-		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache );
1313
-		/*
1304
+        // Instantiate the JSON-LD service.
1305
+        $property_getter                       = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1306
+        $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 );
1307
+        $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 );
1308
+        $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 );
1309
+        $this->jsonld_website_converter        = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1310
+
1311
+        $jsonld_cache                            = new Ttl_Cache( 'jsonld', 86400 );
1312
+        $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->configuration_service, $jsonld_cache );
1313
+        /*
1314 1314
 		 * Load the `Wordlift_Term_JsonLd_Adapter`.
1315 1315
 		 *
1316 1316
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/892
1317 1317
 		 *
1318 1318
 		 * @since 3.20.0
1319 1319
 		 */
1320
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php';
1321
-
1322
-		$term_jsonld_adapter  = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->cached_postid_to_jsonld_converter );
1323
-		$this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter, $term_jsonld_adapter );
1324
-
1325
-		$jsonld_service = new Jsonld_Service(
1326
-			$this->jsonld_service,
1327
-			$term_jsonld_adapter,
1328
-			new Jsonld_User_Service( $this->user_service ) );
1329
-		new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service );
1330
-
1331
-		// Prints the JSON-LD in the head.
1332
-		new Jsonld_Adapter( $this->jsonld_service );
1333
-
1334
-		new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service );
1335
-
1336
-		$this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service );
1337
-		$this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1338
-		// Creating Faq Content filter service.
1339
-		$this->faq_content_filter_service = new Faq_Content_Filter();
1340
-		$this->relation_rebuild_service   = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1341
-		$this->sample_data_service        = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1342
-		$this->sample_data_ajax_adapter   = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1343
-		$this->reference_rebuild_service  = new Wordlift_Reference_Rebuild_Service( $this->entity_service );
1344
-
1345
-		$this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' );
1346
-		$this->loader->add_action( 'admin_enqueue_scripts', $this, 'add_wl_enabled_blocks' );
1347
-
1348
-		/**
1349
-		 * Filter: wl_feature__enable__blocks.
1350
-		 *
1351
-		 * @param bool whether the blocks needed to be registered, defaults to true.
1352
-		 *
1353
-		 * @return bool
1354
-		 * @since 3.27.6
1355
-		 */
1356
-		if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
1357
-			// Initialize the short-codes.
1358
-			new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() );
1359
-			new Wordlift_Chord_Shortcode();
1360
-			new Wordlift_Geomap_Shortcode();
1361
-			new Wordlift_Timeline_Shortcode();
1362
-			new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service, $this->entity_service );
1363
-			new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1364
-			new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() );
1365
-		}
1366
-
1367
-		new Wordlift_Products_Navigator_Shortcode();
1368
-
1369
-
1370
-		// Initialize the Context Cards Service
1371
-		$this->context_cards_service = new Wordlift_Context_Cards_Service();
1372
-
1373
-		// Initialize the SEO service.
1374
-		new Wordlift_Seo_Service();
1375
-
1376
-		// Initialize the AMP service.
1377
-		new Wordlift_AMP_Service( $this->jsonld_service );
1378
-
1379
-		/** Services. */
1380
-		$this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1381
-		new Wordlift_Image_Service();
1382
-
1383
-		/** Adapters. */
1384
-		$this->entity_type_adapter    = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1385
-		$this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service );
1386
-		$this->tinymce_adapter        = new Wordlift_Tinymce_Adapter( $this );
1387
-		//$this->faq_tinymce_adapter      = new Faq_Tinymce_Adapter();
1388
-		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1389
-
1390
-		/*
1320
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php';
1321
+
1322
+        $term_jsonld_adapter  = new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->cached_postid_to_jsonld_converter );
1323
+        $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter, $term_jsonld_adapter );
1324
+
1325
+        $jsonld_service = new Jsonld_Service(
1326
+            $this->jsonld_service,
1327
+            $term_jsonld_adapter,
1328
+            new Jsonld_User_Service( $this->user_service ) );
1329
+        new Jsonld_Endpoint( $jsonld_service, $this->entity_uri_service );
1330
+
1331
+        // Prints the JSON-LD in the head.
1332
+        new Jsonld_Adapter( $this->jsonld_service );
1333
+
1334
+        new Jsonld_By_Id_Endpoint( $this->jsonld_service, $this->entity_uri_service );
1335
+
1336
+        $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service );
1337
+        $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1338
+        // Creating Faq Content filter service.
1339
+        $this->faq_content_filter_service = new Faq_Content_Filter();
1340
+        $this->relation_rebuild_service   = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1341
+        $this->sample_data_service        = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1342
+        $this->sample_data_ajax_adapter   = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1343
+        $this->reference_rebuild_service  = new Wordlift_Reference_Rebuild_Service( $this->entity_service );
1344
+
1345
+        $this->loader->add_action( 'enqueue_block_editor_assets', $this, 'add_wl_enabled_blocks' );
1346
+        $this->loader->add_action( 'admin_enqueue_scripts', $this, 'add_wl_enabled_blocks' );
1347
+
1348
+        /**
1349
+         * Filter: wl_feature__enable__blocks.
1350
+         *
1351
+         * @param bool whether the blocks needed to be registered, defaults to true.
1352
+         *
1353
+         * @return bool
1354
+         * @since 3.27.6
1355
+         */
1356
+        if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
1357
+            // Initialize the short-codes.
1358
+            new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() );
1359
+            new Wordlift_Chord_Shortcode();
1360
+            new Wordlift_Geomap_Shortcode();
1361
+            new Wordlift_Timeline_Shortcode();
1362
+            new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service, $this->entity_service );
1363
+            new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1364
+            new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() );
1365
+        }
1366
+
1367
+        new Wordlift_Products_Navigator_Shortcode();
1368
+
1369
+
1370
+        // Initialize the Context Cards Service
1371
+        $this->context_cards_service = new Wordlift_Context_Cards_Service();
1372
+
1373
+        // Initialize the SEO service.
1374
+        new Wordlift_Seo_Service();
1375
+
1376
+        // Initialize the AMP service.
1377
+        new Wordlift_AMP_Service( $this->jsonld_service );
1378
+
1379
+        /** Services. */
1380
+        $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1381
+        new Wordlift_Image_Service();
1382
+
1383
+        /** Adapters. */
1384
+        $this->entity_type_adapter    = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1385
+        $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service );
1386
+        $this->tinymce_adapter        = new Wordlift_Tinymce_Adapter( $this );
1387
+        //$this->faq_tinymce_adapter      = new Faq_Tinymce_Adapter();
1388
+        $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1389
+
1390
+        /*
1391 1391
 		 * Exclude our public js from WP-Rocket.
1392 1392
 		 *
1393 1393
 		 * @since 3.19.4
1394 1394
 		 *
1395 1395
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/842.
1396 1396
 		 */
1397
-		new Wordlift_WpRocket_Adapter();
1398
-
1399
-		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
1400
-		$this->rebuild_service = new Wordlift_Rebuild_Service(
1401
-			$this->sparql_service,
1402
-			$uri_service
1403
-		);
1404
-
1405
-		$that = $this;
1406
-		add_action( 'plugins_loaded', function () use ( $that ) {
1407
-			if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) {
1408
-				new Wordlift_Linked_Data_Service( $that->entity_service, $that->entity_type_service, $that->schema_service, $that->sparql_service );
1409
-				new Wordlift_Sparql_Query_Async_Task();
1410
-				new Wordlift_Push_References_Async_Task();
1411
-			}
1412
-		} );
1413
-
1414
-		/** WordPress Admin UI. */
1415
-
1416
-		// UI elements.
1417
-		$this->input_element           = new Wordlift_Admin_Input_Element();
1418
-		$this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1419
-		$this->select2_element         = new Wordlift_Admin_Select2_Element();
1420
-		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1421
-		$this->country_select_element  = new Wordlift_Admin_Country_Select_Element();
1422
-		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
1423
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element );
1424
-		$this->author_element          = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element );
1425
-
1426
-		$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 );
1427
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1428
-
1429
-		$this->analytics_settings_page             = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element );
1430
-		$this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page );
1431
-		$this->analytics_connect                   = new Wordlift_Analytics_Connect();
1432
-
1433
-		// Pages.
1434
-		/*
1397
+        new Wordlift_WpRocket_Adapter();
1398
+
1399
+        // Create a Rebuild Service instance, which we'll later bound to an ajax call.
1400
+        $this->rebuild_service = new Wordlift_Rebuild_Service(
1401
+            $this->sparql_service,
1402
+            $uri_service
1403
+        );
1404
+
1405
+        $that = $this;
1406
+        add_action( 'plugins_loaded', function () use ( $that ) {
1407
+            if ( ! apply_filters( 'wl_feature__enable__dataset-ng', false ) ) {
1408
+                new Wordlift_Linked_Data_Service( $that->entity_service, $that->entity_type_service, $that->schema_service, $that->sparql_service );
1409
+                new Wordlift_Sparql_Query_Async_Task();
1410
+                new Wordlift_Push_References_Async_Task();
1411
+            }
1412
+        } );
1413
+
1414
+        /** WordPress Admin UI. */
1415
+
1416
+        // UI elements.
1417
+        $this->input_element           = new Wordlift_Admin_Input_Element();
1418
+        $this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1419
+        $this->select2_element         = new Wordlift_Admin_Select2_Element();
1420
+        $this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1421
+        $this->country_select_element  = new Wordlift_Admin_Country_Select_Element();
1422
+        $tabs_element                  = new Wordlift_Admin_Tabs_Element();
1423
+        $this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element );
1424
+        $this->author_element          = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element );
1425
+
1426
+        $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 );
1427
+        $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1428
+
1429
+        $this->analytics_settings_page             = new Wordlift_Admin_Settings_Analytics_Page( $this->configuration_service, $this->input_element, $this->radio_input_element );
1430
+        $this->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $this->analytics_settings_page );
1431
+        $this->analytics_connect                   = new Wordlift_Analytics_Connect();
1432
+
1433
+        // Pages.
1434
+        /*
1435 1435
 		 * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box.
1436 1436
 		 *
1437 1437
 		 * @since 3.20.3
1438 1438
 		 *
1439 1439
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/914
1440 1440
 		 */
1441
-		if ( apply_filters( 'wl_can_see_classification_box', true ) ) {
1442
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1443
-			new Wordlift_Admin_Post_Edit_Page( $this );
1444
-		}
1445
-		new Wordlift_Entity_Type_Admin_Service();
1441
+        if ( apply_filters( 'wl_can_see_classification_box', true ) ) {
1442
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1443
+            new Wordlift_Admin_Post_Edit_Page( $this );
1444
+        }
1445
+        new Wordlift_Entity_Type_Admin_Service();
1446 1446
 
1447
-		// create an instance of the entity type list admin page controller.
1448
-		$this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1447
+        // create an instance of the entity type list admin page controller.
1448
+        $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1449 1449
 
1450
-		// create an instance of the entity type setting admin page controller.
1451
-		$this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1450
+        // create an instance of the entity type setting admin page controller.
1451
+        $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1452 1452
 
1453
-		/** Widgets */
1454
-		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1453
+        /** Widgets */
1454
+        $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1455 1455
 
1456
-		/* WordPress Admin. */
1457
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1458
-		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1456
+        /* WordPress Admin. */
1457
+        $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1458
+        $this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1459 1459
 
1460
-		// Create an instance of the install wizard.
1461
-		$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 );
1460
+        // Create an instance of the install wizard.
1461
+        $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 );
1462 1462
 
1463
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1463
+        $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1464 1464
 
1465
-		// User Profile.
1466
-		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1465
+        // User Profile.
1466
+        new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1467 1467
 
1468
-		$this->entity_page_service = new Wordlift_Entity_Page_Service();
1468
+        $this->entity_page_service = new Wordlift_Entity_Page_Service();
1469 1469
 
1470
-		// Load the debug service if WP is in debug mode.
1471
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1472
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1473
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1474
-		}
1470
+        // Load the debug service if WP is in debug mode.
1471
+        if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1472
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1473
+            new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1474
+        }
1475 1475
 
1476
-		// Remote Image Service.
1477
-		new Wordlift_Remote_Image_Service();
1476
+        // Remote Image Service.
1477
+        new Wordlift_Remote_Image_Service();
1478 1478
 
1479
-		/*
1479
+        /*
1480 1480
 		 * Provides mappings between post types and entity types.
1481 1481
 		 *
1482 1482
 		 * @since 3.20.0
1483 1483
 		 *
1484 1484
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/852.
1485 1485
 		 */
1486
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php';
1487
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php';
1488
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php';
1486
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php';
1487
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php';
1488
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php';
1489 1489
 
1490
-		// Create an instance of the Mapping Service and assign it to the Ajax Adapter.
1491
-		new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) );
1490
+        // Create an instance of the Mapping Service and assign it to the Ajax Adapter.
1491
+        new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) );
1492 1492
 
1493
-		/*
1493
+        /*
1494 1494
 		 * Batch Operations. They're similar to Batch Actions but do not require working on post types.
1495 1495
 		 *
1496 1496
 		 * Eventually Batch Actions will become Batch Operations.
1497 1497
 		 *
1498 1498
 		 * @since 3.20.0
1499 1499
 		 */
1500
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php';
1501
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php';
1502
-		/*
1500
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php';
1501
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php';
1502
+        /*
1503 1503
 		 * Load the Mappings JSON-LD post processing.
1504 1504
 		 *
1505 1505
 		 * @since 3.25.0
1506 1506
 		 */
1507 1507
 
1508
-		$mappings_dbo           = new Mappings_DBO();
1509
-		$default_rule_validator = new Taxonomy_Rule_Validator();
1510
-		new Post_Type_Rule_Validator();
1511
-		// Taxonomy term rule validator for validating rules for term pages.
1512
-		new Taxonomy_Term_Rule_Validator();
1513
-		new Post_Taxonomy_Term_Rule_Validator();
1514
-		$rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator );
1515
-		$rule_groups_validator    = new Rule_Groups_Validator( $rule_validators_registry );
1516
-		$mappings_validator       = new Mappings_Validator( $mappings_dbo, $rule_groups_validator );
1517
-
1518
-		new Url_To_Entity_Transform_Function( $this->entity_uri_service );
1519
-		new Taxonomy_To_Terms_Transform_Function();
1520
-		new Post_Id_To_Entity_Transform_Function();
1521
-		$mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry();
1522
-
1523
-		/**
1524
-		 * @since 3.27.1
1525
-		 * Intiailize the acf group data formatter.
1526
-		 */
1527
-		new Acf_Group_Formatter();
1528
-		new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry );
1529
-
1530
-		/**
1531
-		 * @since 3.26.0
1532
-		 * Initialize the Faq JSON LD converter here - disabled.
1533
-		 */
1534
-		// new Faq_To_Jsonld_Converter();
1535
-		/*
1508
+        $mappings_dbo           = new Mappings_DBO();
1509
+        $default_rule_validator = new Taxonomy_Rule_Validator();
1510
+        new Post_Type_Rule_Validator();
1511
+        // Taxonomy term rule validator for validating rules for term pages.
1512
+        new Taxonomy_Term_Rule_Validator();
1513
+        new Post_Taxonomy_Term_Rule_Validator();
1514
+        $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator );
1515
+        $rule_groups_validator    = new Rule_Groups_Validator( $rule_validators_registry );
1516
+        $mappings_validator       = new Mappings_Validator( $mappings_dbo, $rule_groups_validator );
1517
+
1518
+        new Url_To_Entity_Transform_Function( $this->entity_uri_service );
1519
+        new Taxonomy_To_Terms_Transform_Function();
1520
+        new Post_Id_To_Entity_Transform_Function();
1521
+        $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry();
1522
+
1523
+        /**
1524
+         * @since 3.27.1
1525
+         * Intiailize the acf group data formatter.
1526
+         */
1527
+        new Acf_Group_Formatter();
1528
+        new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry );
1529
+
1530
+        /**
1531
+         * @since 3.26.0
1532
+         * Initialize the Faq JSON LD converter here - disabled.
1533
+         */
1534
+        // new Faq_To_Jsonld_Converter();
1535
+        /*
1536 1536
 		 * Use the Templates Ajax Endpoint to load HTML templates for the legacy Angular app via admin-ajax.php
1537 1537
 		 * end-point.
1538 1538
 		 *
1539 1539
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/834
1540 1540
 		 * @since 3.24.4
1541 1541
 		 */
1542
-		new Templates_Ajax_Endpoint();
1543
-		// Call this static method to register FAQ routes to rest api - disabled
1544
-		//Faq_Rest_Controller::register_routes();
1542
+        new Templates_Ajax_Endpoint();
1543
+        // Call this static method to register FAQ routes to rest api - disabled
1544
+        //Faq_Rest_Controller::register_routes();
1545 1545
 
1546
-		/*
1546
+        /*
1547 1547
 		 * Create a singleton for the Analysis_Response_Ops_Factory.
1548 1548
 		 */
1549
-		$entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service );
1550
-		/**
1551
-		 * @since 3.32.0
1552
-		 * Initialize a local entity provider which acts as an abstraction layer
1553
-		 * between the different types of objects in wordpress.
1554
-		 */
1555
-		$entity_provider_registry = new Entity_Provider_Registry();
1556
-
1557
-		/**
1558
-		 * @since 3.32.0
1559
-		 * The post entity provider has the legacy code which provides the entity
1560
-		 * if the object is post {@link \Wordlift\Object_Type_Enum::POST}
1561
-		 */
1562
-		new Post_Entity_Provider( $this->entity_uri_service,
1563
-			$this->entity_type_service, $this->storage_factory->post_images() );
1564
-		/**
1565
-		 * @since 3.32.0
1566
-		 * The term entity provider provides the entity
1567
-		 * if the object is term {@link \Wordlift\Object_Type_Enum::POST}
1568
-		 */
1569
-		new Term_Entity_Provider();
1570
-
1571
-		new Analysis_Response_Ops_Factory(
1572
-			$this->entity_uri_service,
1573
-			$entity_helper,
1574
-			$entity_provider_registry
1575
-		);
1576
-
1577
-		/** WL Autocomplete. */
1578
-		$autocomplete_service       = new All_Autocomplete_Service( array(
1579
-			new Local_Autocomplete_Service(),
1580
-			new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ),
1581
-		) );
1582
-		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service );
1583
-
1584
-		/**
1585
-		 * @since 3.27.2
1586
-		 * Integrate the recipe maker jsonld & set recipe
1587
-		 * as default entity type to the wprm_recipe CPT.
1588
-		 */
1589
-		new Recipe_Maker_Post_Type_Hook();
1590
-		$recipe_maker_validation_service = new Recipe_Maker_Validation_Service();
1591
-		new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service );
1592
-		new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service );
1593
-		new Recipe_Maker_Warning( $recipe_maker_validation_service );
1594
-		new Yoast_Jsonld( $recipe_maker_validation_service );
1595
-
1596
-		/**
1597
-		 * @since 3.27.4
1598
-		 * Add the faq duplicate markup hook.
1599
-		 */
1600
-		new Faq_Duplicate_Markup_Remover();
1601
-		/**
1602
-		 * @since 3.33.1
1603
-		 * Remove the duplicate HowTo Markup.
1604
-		 */
1605
-		new How_To_Duplicate_Markup_Remover();
1606
-
1607
-		/**
1608
-		 * @since 3.27.8
1609
-		 * @see https://github.com/insideout10/wordlift-plugin/issues/1248
1610
-		 */
1611
-		new Key_Validation_Notice( $this->key_validation_service, $this->configuration_service );
1612
-		/**
1613
-		 * @since 3.28.0
1614
-		 * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen
1615
-		 */
1616
-		new Entity_No_Index_Flag();
1617
-
1618
-		/**
1619
-		 * @since 3.29.0
1620
-		 * @see https://github.com/insideout10/wordlift-plugin/issues/1304
1621
-		 */
1622
-		new Entity_Rest_Service( $this->entity_type_service );
1623
-
1624
-		/**
1625
-		 * Expand author in to references.
1626
-		 * @since 3.30.0
1627
-		 * @see https://github.com/insideout10/wordlift-plugin/issues/1318
1628
-		 */
1629
-
1630
-		add_action( 'plugins_loaded', function () use ( $that ) {
1631
-
1632
-			if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) {
1633
-				new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter );
1634
-			}
1635
-
1636
-			if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) {
1637
-				$vocabulary_loader = new Vocabulary_Loader();
1638
-				$vocabulary_loader->init_vocabulary();
1639
-			}
1640
-
1641
-			/**
1642
-			 *Added for feature request 1496 (Webhooks)
1643
-			 */
1644
-			if ( apply_filters( 'wl_feature__enable__webhooks', false ) ) {
1645
-				$that->webhook_loader = new Webhooks_Loader();
1646
-				$that->webhook_loader->init();
1647
-			}
1648
-
1649
-		} );
1650
-
1651
-		/**
1652
-		 * @since 3.30.0
1653
-		 * Add a checkbox to user option screen for wordlift admin.
1654
-		 */
1655
-		$wordlift_admin_checkbox = new Admin_User_Option();
1656
-		$wordlift_admin_checkbox->connect_hook();
1657
-
1658
-		/**
1659
-		 * @since 3.31.0
1660
-		 * Init loader class for videoobject.
1661
-		 */
1662
-		$videoobject_loader = new Loader();
1663
-		$videoobject_loader->init_feature();
1664
-		/**
1665
-		 * @since 3.31.5
1666
-		 * Create configuration endpoint for webapp to configure.
1667
-		 */
1668
-		new Config( $this->admin_setup, $this->key_validation_service, $this->configuration_service );
1669
-		/**
1670
-		 * @since 3.31.7
1671
-		 * Remove duplicate videoobject.
1672
-		 */
1673
-		new Videoobject_Duplicate_Remover();
1674
-		$synonym_loader = new \Wordlift\Synonym\Loader();
1675
-		$synonym_loader->init_feature();
1676
-		/**
1677
-		 * @since 3.32.0
1678
-		 * Create loader for vocabulary terms.
1679
-		 */
1680
-		$vocabulary_terms_loader = new Vocabulary_Terms_Loader( $this->entity_type_service, $property_getter );
1681
-		$vocabulary_terms_loader->init_feature();
1682
-
1683
-		new Entity_Type_Change_Handler(
1684
-			$this->entity_service,
1685
-			$this->entity_type_service
1686
-		);
1687
-
1688
-		new Entity_Type_Setter();
1689
-		$no_editor_analysis_loader = new \Wordlift\No_Editor_Analysis\Loader();
1690
-		$no_editor_analysis_loader->init_feature();
1691
-	}
1692
-
1693
-	/**
1694
-	 * Define the locale for this plugin for internationalization.
1695
-	 *
1696
-	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1697
-	 * with WordPress.
1698
-	 *
1699
-	 * @since    1.0.0
1700
-	 * @access   private
1701
-	 */
1702
-	private function set_locale() {
1703
-
1704
-		$plugin_i18n = new Wordlift_i18n();
1705
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1706
-
1707
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1708
-
1709
-	}
1710
-
1711
-	/**
1712
-	 * Register all of the hooks related to the admin area functionality
1713
-	 * of the plugin.
1714
-	 *
1715
-	 * @since    1.0.0
1716
-	 * @access   private
1717
-	 */
1718
-	private function define_admin_hooks() {
1719
-		$that         = $this;
1720
-		$plugin_admin = new Wordlift_Admin(
1721
-			$this->get_plugin_name(),
1722
-			$this->get_version(),
1723
-			$this->configuration_service,
1724
-			$this->notice_service,
1725
-			$this->user_service
1726
-		);
1727
-
1728
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1729
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 );
1730
-
1731
-		// Hook the init action to taxonomy services.
1732
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1733
-		$this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 );
1734
-
1735
-		// Hook the deleted_post_meta action to the Thumbnail service.
1736
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1737
-
1738
-		// Hook the added_post_meta action to the Thumbnail service.
1739
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1740
-
1741
-		// Hook the updated_post_meta action to the Thumbnail service.
1742
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1743
-
1744
-		// Hook the AJAX wl_timeline action to the Timeline service.
1745
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1746
-
1747
-		// Register custom allowed redirect hosts.
1748
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1749
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1750
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1751
-
1752
-		/*
1549
+        $entity_helper = new Entity_Helper( $this->entity_uri_service, $this->entity_service );
1550
+        /**
1551
+         * @since 3.32.0
1552
+         * Initialize a local entity provider which acts as an abstraction layer
1553
+         * between the different types of objects in wordpress.
1554
+         */
1555
+        $entity_provider_registry = new Entity_Provider_Registry();
1556
+
1557
+        /**
1558
+         * @since 3.32.0
1559
+         * The post entity provider has the legacy code which provides the entity
1560
+         * if the object is post {@link \Wordlift\Object_Type_Enum::POST}
1561
+         */
1562
+        new Post_Entity_Provider( $this->entity_uri_service,
1563
+            $this->entity_type_service, $this->storage_factory->post_images() );
1564
+        /**
1565
+         * @since 3.32.0
1566
+         * The term entity provider provides the entity
1567
+         * if the object is term {@link \Wordlift\Object_Type_Enum::POST}
1568
+         */
1569
+        new Term_Entity_Provider();
1570
+
1571
+        new Analysis_Response_Ops_Factory(
1572
+            $this->entity_uri_service,
1573
+            $entity_helper,
1574
+            $entity_provider_registry
1575
+        );
1576
+
1577
+        /** WL Autocomplete. */
1578
+        $autocomplete_service       = new All_Autocomplete_Service( array(
1579
+            new Local_Autocomplete_Service(),
1580
+            new Linked_Data_Autocomplete_Service( $this->configuration_service, $entity_helper, $this->entity_uri_service, $this->entity_service ),
1581
+        ) );
1582
+        $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service );
1583
+
1584
+        /**
1585
+         * @since 3.27.2
1586
+         * Integrate the recipe maker jsonld & set recipe
1587
+         * as default entity type to the wprm_recipe CPT.
1588
+         */
1589
+        new Recipe_Maker_Post_Type_Hook();
1590
+        $recipe_maker_validation_service = new Recipe_Maker_Validation_Service();
1591
+        new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service );
1592
+        new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service );
1593
+        new Recipe_Maker_Warning( $recipe_maker_validation_service );
1594
+        new Yoast_Jsonld( $recipe_maker_validation_service );
1595
+
1596
+        /**
1597
+         * @since 3.27.4
1598
+         * Add the faq duplicate markup hook.
1599
+         */
1600
+        new Faq_Duplicate_Markup_Remover();
1601
+        /**
1602
+         * @since 3.33.1
1603
+         * Remove the duplicate HowTo Markup.
1604
+         */
1605
+        new How_To_Duplicate_Markup_Remover();
1606
+
1607
+        /**
1608
+         * @since 3.27.8
1609
+         * @see https://github.com/insideout10/wordlift-plugin/issues/1248
1610
+         */
1611
+        new Key_Validation_Notice( $this->key_validation_service, $this->configuration_service );
1612
+        /**
1613
+         * @since 3.28.0
1614
+         * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen
1615
+         */
1616
+        new Entity_No_Index_Flag();
1617
+
1618
+        /**
1619
+         * @since 3.29.0
1620
+         * @see https://github.com/insideout10/wordlift-plugin/issues/1304
1621
+         */
1622
+        new Entity_Rest_Service( $this->entity_type_service );
1623
+
1624
+        /**
1625
+         * Expand author in to references.
1626
+         * @since 3.30.0
1627
+         * @see https://github.com/insideout10/wordlift-plugin/issues/1318
1628
+         */
1629
+
1630
+        add_action( 'plugins_loaded', function () use ( $that ) {
1631
+
1632
+            if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) {
1633
+                new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter );
1634
+            }
1635
+
1636
+            if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) {
1637
+                $vocabulary_loader = new Vocabulary_Loader();
1638
+                $vocabulary_loader->init_vocabulary();
1639
+            }
1640
+
1641
+            /**
1642
+             *Added for feature request 1496 (Webhooks)
1643
+             */
1644
+            if ( apply_filters( 'wl_feature__enable__webhooks', false ) ) {
1645
+                $that->webhook_loader = new Webhooks_Loader();
1646
+                $that->webhook_loader->init();
1647
+            }
1648
+
1649
+        } );
1650
+
1651
+        /**
1652
+         * @since 3.30.0
1653
+         * Add a checkbox to user option screen for wordlift admin.
1654
+         */
1655
+        $wordlift_admin_checkbox = new Admin_User_Option();
1656
+        $wordlift_admin_checkbox->connect_hook();
1657
+
1658
+        /**
1659
+         * @since 3.31.0
1660
+         * Init loader class for videoobject.
1661
+         */
1662
+        $videoobject_loader = new Loader();
1663
+        $videoobject_loader->init_feature();
1664
+        /**
1665
+         * @since 3.31.5
1666
+         * Create configuration endpoint for webapp to configure.
1667
+         */
1668
+        new Config( $this->admin_setup, $this->key_validation_service, $this->configuration_service );
1669
+        /**
1670
+         * @since 3.31.7
1671
+         * Remove duplicate videoobject.
1672
+         */
1673
+        new Videoobject_Duplicate_Remover();
1674
+        $synonym_loader = new \Wordlift\Synonym\Loader();
1675
+        $synonym_loader->init_feature();
1676
+        /**
1677
+         * @since 3.32.0
1678
+         * Create loader for vocabulary terms.
1679
+         */
1680
+        $vocabulary_terms_loader = new Vocabulary_Terms_Loader( $this->entity_type_service, $property_getter );
1681
+        $vocabulary_terms_loader->init_feature();
1682
+
1683
+        new Entity_Type_Change_Handler(
1684
+            $this->entity_service,
1685
+            $this->entity_type_service
1686
+        );
1687
+
1688
+        new Entity_Type_Setter();
1689
+        $no_editor_analysis_loader = new \Wordlift\No_Editor_Analysis\Loader();
1690
+        $no_editor_analysis_loader->init_feature();
1691
+    }
1692
+
1693
+    /**
1694
+     * Define the locale for this plugin for internationalization.
1695
+     *
1696
+     * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1697
+     * with WordPress.
1698
+     *
1699
+     * @since    1.0.0
1700
+     * @access   private
1701
+     */
1702
+    private function set_locale() {
1703
+
1704
+        $plugin_i18n = new Wordlift_i18n();
1705
+        $plugin_i18n->set_domain( $this->get_plugin_name() );
1706
+
1707
+        $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1708
+
1709
+    }
1710
+
1711
+    /**
1712
+     * Register all of the hooks related to the admin area functionality
1713
+     * of the plugin.
1714
+     *
1715
+     * @since    1.0.0
1716
+     * @access   private
1717
+     */
1718
+    private function define_admin_hooks() {
1719
+        $that         = $this;
1720
+        $plugin_admin = new Wordlift_Admin(
1721
+            $this->get_plugin_name(),
1722
+            $this->get_version(),
1723
+            $this->configuration_service,
1724
+            $this->notice_service,
1725
+            $this->user_service
1726
+        );
1727
+
1728
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1729
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 );
1730
+
1731
+        // Hook the init action to taxonomy services.
1732
+        $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1733
+        $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 );
1734
+
1735
+        // Hook the deleted_post_meta action to the Thumbnail service.
1736
+        $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1737
+
1738
+        // Hook the added_post_meta action to the Thumbnail service.
1739
+        $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1740
+
1741
+        // Hook the updated_post_meta action to the Thumbnail service.
1742
+        $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1743
+
1744
+        // Hook the AJAX wl_timeline action to the Timeline service.
1745
+        $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1746
+
1747
+        // Register custom allowed redirect hosts.
1748
+        $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1749
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1750
+        $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1751
+
1752
+        /*
1753 1753
 		 * The old dashboard is replaced with dashboard v2.
1754 1754
 		 *
1755 1755
 		 * The old dashboard service is still loaded because its functions are used.
@@ -1758,391 +1758,391 @@  discard block
 block discarded – undo
1758 1758
 		 *
1759 1759
 		 * @since 3.20.0
1760 1760
 		 */
1761
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1762
-		// $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1763
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1764
-		// $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1765
-
1766
-		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1767
-		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1768
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1769
-		$this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1770
-
1771
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1772
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1773
-
1774
-		// Entity listing customization (wp-admin/edit.php)
1775
-		// Add custom columns.
1776
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1777
-		// no explicit entity as it prevents handling of other post types.
1778
-		$this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1779
-		// Add 4W selection.
1780
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1781
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1782
-		$this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1783
-		$this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1784
-
1785
-		/*
1761
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1762
+        // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1763
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1764
+        // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1765
+
1766
+        // Hook save_post to the entity service to update custom fields (such as alternate labels).
1767
+        // We have a priority of 9 because we want to be executed before data is sent to Redlink.
1768
+        $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1769
+        $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1770
+
1771
+        $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1772
+        $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1773
+
1774
+        // Entity listing customization (wp-admin/edit.php)
1775
+        // Add custom columns.
1776
+        $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1777
+        // no explicit entity as it prevents handling of other post types.
1778
+        $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1779
+        // Add 4W selection.
1780
+        $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1781
+        $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1782
+        $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1783
+        $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1784
+
1785
+        /*
1786 1786
 		 * If `All Entity Types` is disable, use the radio button Walker.
1787 1787
 		 *
1788 1788
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/835
1789 1789
 		 */
1790
-		if ( ! WL_ALL_ENTITY_TYPES ) {
1791
-			$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1792
-		}
1793
-
1794
-		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1795
-		// entities.
1796
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1797
-
1798
-		// Filter imported post meta.
1799
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1800
-
1801
-		// Notify the import service when an import starts and ends.
1802
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1803
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1804
-
1805
-		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1806
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1807
-		$this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' );
1808
-
1809
-		/**
1810
-		 * Filter: wl_feature__enable__settings-download.
1811
-		 *
1812
-		 * @param bool whether the screens needed to be registered, defaults to true.
1813
-		 *
1814
-		 * @return bool
1815
-		 * @since 3.27.6
1816
-		 */
1817
-		$this->features_registry->register_feature_from_slug( 'settings-download', true, array(
1818
-			$this,
1819
-			'register_screens'
1820
-		) );
1821
-
1822
-
1823
-		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1824
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1825
-
1826
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1827
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1828
-		$this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' );
1829
-		$this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1830
-
1831
-		// Hook the AJAX wl_validate_key action to the Key Validation service.
1832
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1833
-
1834
-		// Hook the AJAX wl_update_country_options action to the countries.
1835
-		$this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' );
1836
-
1837
-		// Hook the `admin_init` function to the Admin Setup.
1838
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1839
-
1840
-		// Hook the admin_init to the settings page.
1841
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1842
-		$this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' );
1843
-
1844
-		$this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' );
1845
-
1846
-		// Hook the menu creation on the general wordlift menu creation.
1847
-		/**
1848
-		 * Filter: wl_feature__enable__screens.
1849
-		 *
1850
-		 * @param bool whether the screens needed to be registered, defaults to true.
1851
-		 *
1852
-		 * @return bool
1853
-		 * @since 3.27.6
1854
-		 *
1855
-		 * Since 3.30.0 this feature is registered using registry.
1856
-		 */
1857
-		add_action( 'plugins_loaded', function () use ( $that ) {
1858
-			if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) {
1859
-				add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 );
1860
-			}
1861
-		} );
1862
-
1863
-		// Hook key update.
1864
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1865
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1866
-
1867
-		// Add additional action links to the WordLift plugin in the plugins page.
1868
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1869
-
1870
-		/*
1790
+        if ( ! WL_ALL_ENTITY_TYPES ) {
1791
+            $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1792
+        }
1793
+
1794
+        // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1795
+        // entities.
1796
+        $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1797
+
1798
+        // Filter imported post meta.
1799
+        $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1800
+
1801
+        // Notify the import service when an import starts and ends.
1802
+        $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1803
+        $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1804
+
1805
+        // Hook the AJAX wl_rebuild action to the Rebuild Service.
1806
+        $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1807
+        $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' );
1808
+
1809
+        /**
1810
+         * Filter: wl_feature__enable__settings-download.
1811
+         *
1812
+         * @param bool whether the screens needed to be registered, defaults to true.
1813
+         *
1814
+         * @return bool
1815
+         * @since 3.27.6
1816
+         */
1817
+        $this->features_registry->register_feature_from_slug( 'settings-download', true, array(
1818
+            $this,
1819
+            'register_screens'
1820
+        ) );
1821
+
1822
+
1823
+        // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1824
+        $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1825
+
1826
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1827
+        $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1828
+        $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' );
1829
+        $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1830
+
1831
+        // Hook the AJAX wl_validate_key action to the Key Validation service.
1832
+        $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1833
+
1834
+        // Hook the AJAX wl_update_country_options action to the countries.
1835
+        $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' );
1836
+
1837
+        // Hook the `admin_init` function to the Admin Setup.
1838
+        $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1839
+
1840
+        // Hook the admin_init to the settings page.
1841
+        $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1842
+        $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' );
1843
+
1844
+        $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' );
1845
+
1846
+        // Hook the menu creation on the general wordlift menu creation.
1847
+        /**
1848
+         * Filter: wl_feature__enable__screens.
1849
+         *
1850
+         * @param bool whether the screens needed to be registered, defaults to true.
1851
+         *
1852
+         * @return bool
1853
+         * @since 3.27.6
1854
+         *
1855
+         * Since 3.30.0 this feature is registered using registry.
1856
+         */
1857
+        add_action( 'plugins_loaded', function () use ( $that ) {
1858
+            if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) {
1859
+                add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 );
1860
+            }
1861
+        } );
1862
+
1863
+        // Hook key update.
1864
+        $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1865
+        $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1866
+
1867
+        // Add additional action links to the WordLift plugin in the plugins page.
1868
+        $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1869
+
1870
+        /*
1871 1871
 		 * Remove the Analytics Settings link from the plugin page.
1872 1872
 		 *
1873 1873
 		 * @see https://github.com/insideout10/wordlift-plugin/issues/932
1874 1874
 		 * @since 3.21.1
1875 1875
 		 */
1876
-		// $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 );
1877
-
1878
-		// Hook the AJAX `wl_publisher` action name.
1879
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1880
-
1881
-		// Hook row actions for the entity type list admin.
1882
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1883
-
1884
-		/** Ajax actions. */
1885
-		$this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1886
-
1887
-		// Hook capabilities manipulation to allow access to entity type admin
1888
-		// page  on WordPress versions before 4.7.
1889
-		global $wp_version;
1890
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1891
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1892
-		}
1893
-
1894
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1895
-
1896
-		/** Adapters. */
1897
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1898
-		/**
1899
-		 * Disabling Faq temporarily.
1900
-		 * Load the tinymce editor button on the tool bar.
1901
-		 * @since 3.26.0
1902
-		 */
1903
-		//$this->loader->add_filter( 'tiny_mce_before_init', $this->faq_tinymce_adapter, 'register_custom_tags' );
1904
-		//$this->loader->add_filter( 'mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 );
1905
-		//$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 );
1906
-
1907
-
1908
-		$this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1909
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1910
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1911
-		/**
1912
-		 * @since 3.26.0
1913
-		 */
1914
-		$excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter();
1915
-		$this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' );
1916
-		// Adding Rest route for the post excerpt
1917
-		Post_Excerpt_Rest_Controller::register_routes();
1918
-
1919
-		$this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 );
1920
-		$this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 );
1921
-
1922
-		// Handle the autocomplete request.
1923
-		add_action( 'wp_ajax_wl_autocomplete', array(
1924
-			$this->autocomplete_adapter,
1925
-			'wl_autocomplete',
1926
-		) );
1927
-		add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1928
-			$this->autocomplete_adapter,
1929
-			'wl_autocomplete',
1930
-		) );
1931
-
1932
-		// Hooks to restrict multisite super admin from manipulating entity types.
1933
-		if ( is_multisite() ) {
1934
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1935
-		}
1936
-
1937
-		$deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service );
1938
-
1939
-		add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) );
1940
-		add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) );
1941
-		add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) );
1942
-
1943
-		/**
1944
-		 * Always allow the `wordlift/classification` block.
1945
-		 *
1946
-		 * @since 3.23.0
1947
-		 */
1948
-		add_filter( 'allowed_block_types', function ( $value ) {
1949
-
1950
-			if ( true === $value ) {
1951
-				return $value;
1952
-			}
1953
-
1954
-			return array_merge( (array) $value, array( 'wordlift/classification' ) );
1955
-		}, PHP_INT_MAX );
1956
-
1957
-		/**
1958
-		 * @since 3.27.7
1959
-		 * @see https://github.com/insideout10/wordlift-plugin/issues/1214
1960
-		 */
1961
-		new Top_Entities();
1962
-	}
1963
-
1964
-	/**
1965
-	 * Register all of the hooks related to the public-facing functionality
1966
-	 * of the plugin.
1967
-	 *
1968
-	 * @since    1.0.0
1969
-	 * @access   private
1970
-	 */
1971
-	private function define_public_hooks() {
1972
-
1973
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1974
-
1975
-		// Register the entity post type.
1976
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1977
-
1978
-		// Bind the link generation and handling hooks to the entity link service.
1979
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1980
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1981
-		// $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 );
1982
-		// $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 );
1983
-
1984
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1985
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1986
-		$this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' );
1987
-
1988
-		// Registering Faq_Content_Filter service used for removing faq question and answer tags from the html.
1989
-		$this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' );
1990
-		// Hook the content filter service to add entity links.
1991
-		if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1992
-			$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1993
-		}
1994
-
1995
-		// Hook the AJAX wl_timeline action to the Timeline service.
1996
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1997
-
1998
-		// Hook the ShareThis service.
1999
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
2000
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
2001
-
2002
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
2003
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
2004
-
2005
-		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
2006
-		// in order to tweak WP's `WP_Query` to include entities in queries related
2007
-		// to categories.
2008
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
2009
-
2010
-		/*
1876
+        // $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 );
1877
+
1878
+        // Hook the AJAX `wl_publisher` action name.
1879
+        $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1880
+
1881
+        // Hook row actions for the entity type list admin.
1882
+        $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1883
+
1884
+        /** Ajax actions. */
1885
+        $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1886
+
1887
+        // Hook capabilities manipulation to allow access to entity type admin
1888
+        // page  on WordPress versions before 4.7.
1889
+        global $wp_version;
1890
+        if ( version_compare( $wp_version, '4.7', '<' ) ) {
1891
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1892
+        }
1893
+
1894
+        $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1895
+
1896
+        /** Adapters. */
1897
+        $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1898
+        /**
1899
+         * Disabling Faq temporarily.
1900
+         * Load the tinymce editor button on the tool bar.
1901
+         * @since 3.26.0
1902
+         */
1903
+        //$this->loader->add_filter( 'tiny_mce_before_init', $this->faq_tinymce_adapter, 'register_custom_tags' );
1904
+        //$this->loader->add_filter( 'mce_buttons', $this->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 );
1905
+        //$this->loader->add_filter( 'mce_external_plugins', $this->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 );
1906
+
1907
+
1908
+        $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1909
+        $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1910
+        $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1911
+        /**
1912
+         * @since 3.26.0
1913
+         */
1914
+        $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter();
1915
+        $this->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' );
1916
+        // Adding Rest route for the post excerpt
1917
+        Post_Excerpt_Rest_Controller::register_routes();
1918
+
1919
+        $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 );
1920
+        $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 );
1921
+
1922
+        // Handle the autocomplete request.
1923
+        add_action( 'wp_ajax_wl_autocomplete', array(
1924
+            $this->autocomplete_adapter,
1925
+            'wl_autocomplete',
1926
+        ) );
1927
+        add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1928
+            $this->autocomplete_adapter,
1929
+            'wl_autocomplete',
1930
+        ) );
1931
+
1932
+        // Hooks to restrict multisite super admin from manipulating entity types.
1933
+        if ( is_multisite() ) {
1934
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1935
+        }
1936
+
1937
+        $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service );
1938
+
1939
+        add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) );
1940
+        add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) );
1941
+        add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) );
1942
+
1943
+        /**
1944
+         * Always allow the `wordlift/classification` block.
1945
+         *
1946
+         * @since 3.23.0
1947
+         */
1948
+        add_filter( 'allowed_block_types', function ( $value ) {
1949
+
1950
+            if ( true === $value ) {
1951
+                return $value;
1952
+            }
1953
+
1954
+            return array_merge( (array) $value, array( 'wordlift/classification' ) );
1955
+        }, PHP_INT_MAX );
1956
+
1957
+        /**
1958
+         * @since 3.27.7
1959
+         * @see https://github.com/insideout10/wordlift-plugin/issues/1214
1960
+         */
1961
+        new Top_Entities();
1962
+    }
1963
+
1964
+    /**
1965
+     * Register all of the hooks related to the public-facing functionality
1966
+     * of the plugin.
1967
+     *
1968
+     * @since    1.0.0
1969
+     * @access   private
1970
+     */
1971
+    private function define_public_hooks() {
1972
+
1973
+        $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1974
+
1975
+        // Register the entity post type.
1976
+        $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1977
+
1978
+        // Bind the link generation and handling hooks to the entity link service.
1979
+        $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1980
+        $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1981
+        // $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 );
1982
+        // $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 );
1983
+
1984
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1985
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1986
+        $this->loader->add_action( 'wp_enqueue_scripts', $this->context_cards_service, 'enqueue_scripts' );
1987
+
1988
+        // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html.
1989
+        $this->loader->add_filter( 'the_content', $this->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' );
1990
+        // Hook the content filter service to add entity links.
1991
+        if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1992
+            $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1993
+        }
1994
+
1995
+        // Hook the AJAX wl_timeline action to the Timeline service.
1996
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1997
+
1998
+        // Hook the ShareThis service.
1999
+        $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
2000
+        $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
2001
+
2002
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
2003
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
2004
+
2005
+        // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
2006
+        // in order to tweak WP's `WP_Query` to include entities in queries related
2007
+        // to categories.
2008
+        $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
2009
+
2010
+        /*
2011 2011
 		 * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service`
2012 2012
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
2013 2013
 		 * order of start time.
2014 2014
 		 */
2015
-		$this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
2016
-
2017
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
2018
-
2019
-		// This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
2020
-		$this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
2021
-
2022
-		// Analytics Script Frontend.
2023
-		if ( apply_filters( 'wl_feature__enable__analytics', true ) && $this->configuration_service->is_analytics_enable() ) {
2024
-			$this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 );
2025
-		}
2026
-
2027
-	}
2028
-
2029
-	/**
2030
-	 * Run the loader to execute all of the hooks with WordPress.
2031
-	 *
2032
-	 * @since    1.0.0
2033
-	 */
2034
-	public function run() {
2035
-		$this->loader->run();
2036
-	}
2037
-
2038
-	/**
2039
-	 * The name of the plugin used to uniquely identify it within the context of
2040
-	 * WordPress and to define internationalization functionality.
2041
-	 *
2042
-	 * @return    string    The name of the plugin.
2043
-	 * @since     1.0.0
2044
-	 */
2045
-	public function get_plugin_name() {
2046
-		return $this->plugin_name;
2047
-	}
2048
-
2049
-	/**
2050
-	 * The reference to the class that orchestrates the hooks with the plugin.
2051
-	 *
2052
-	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
2053
-	 * @since     1.0.0
2054
-	 */
2055
-	public function get_loader() {
2056
-		return $this->loader;
2057
-	}
2058
-
2059
-	/**
2060
-	 * Retrieve the version number of the plugin.
2061
-	 *
2062
-	 * @return    string    The version number of the plugin.
2063
-	 * @since     1.0.0
2064
-	 */
2065
-	public function get_version() {
2066
-		return $this->version;
2067
-	}
2068
-
2069
-	/**
2070
-	 * Load dependencies for WP-CLI.
2071
-	 *
2072
-	 * @throws Exception
2073
-	 * @since 3.18.0
2074
-	 */
2075
-	private function load_cli_dependencies() {
2076
-
2077
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php';
2078
-
2079
-		$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 );
2080
-
2081
-		WP_CLI::add_command( 'wl references push', $push_reference_data_command );
2082
-
2083
-	}
2084
-
2085
-	/**
2086
-	 * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions.
2087
-	 *
2088
-	 * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance.
2089
-	 * @since 3.20.0
2090
-	 */
2091
-	public function get_dashboard_service() {
2092
-
2093
-		return $this->dashboard_service;
2094
-	}
2095
-
2096
-	public function add_wl_enabled_blocks() {
2097
-		/**
2098
-		 * Filter: wl_feature__enable__blocks.
2099
-		 *
2100
-		 * @param bool whether the blocks needed to be registered, defaults to true.
2101
-		 *
2102
-		 * @return bool
2103
-		 * @since 3.27.6
2104
-		 */
2105
-
2106
-		wp_register_script( 'wl_enabled_blocks', false );
2107
-
2108
-		$enabled_blocks = array();
2109
-
2110
-		/**
2111
-		 * Filter name: wl_feature__enable__product-navigator
2112
-		 * @since 3.32.3
2113
-		 */
2114
-		if ( apply_filters( 'wl_feature__enable__product-navigator', true ) ) {
2115
-			$enabled_blocks[] = 'wordlift/products-navigator';
2116
-		}
2117
-
2118
-		if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
2119
-			// To intimate JS
2120
-			$enabled_blocks = array_merge( $enabled_blocks, array(
2121
-				'wordlift/navigator',
2122
-				'wordlift/chord',
2123
-				'wordlift/geomap',
2124
-				'wordlift/timeline',
2125
-				'wordlift/cloud',
2126
-				'wordlift/vocabulary',
2127
-				'wordlift/faceted-search'
2128
-			) );
2129
-		}
2130
-
2131
-		wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks );
2132
-		wp_enqueue_script( 'wl_enabled_blocks' );
2133
-	}
2134
-
2135
-	/**
2136
-	 * Register screens based on the filter.
2137
-	 */
2138
-	public function register_screens() {
2139
-		// Hook the menu to the Download Your Data page.
2140
-		if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) {
2141
-			add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 );
2142
-		}
2143
-		add_action( 'admin_menu', array( $this->status_page, 'admin_menu' ), 100, 0 );
2144
-		add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 );
2145
-
2146
-	}
2015
+        $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
2016
+
2017
+        $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
2018
+
2019
+        // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
2020
+        $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
2021
+
2022
+        // Analytics Script Frontend.
2023
+        if ( apply_filters( 'wl_feature__enable__analytics', true ) && $this->configuration_service->is_analytics_enable() ) {
2024
+            $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 );
2025
+        }
2026
+
2027
+    }
2028
+
2029
+    /**
2030
+     * Run the loader to execute all of the hooks with WordPress.
2031
+     *
2032
+     * @since    1.0.0
2033
+     */
2034
+    public function run() {
2035
+        $this->loader->run();
2036
+    }
2037
+
2038
+    /**
2039
+     * The name of the plugin used to uniquely identify it within the context of
2040
+     * WordPress and to define internationalization functionality.
2041
+     *
2042
+     * @return    string    The name of the plugin.
2043
+     * @since     1.0.0
2044
+     */
2045
+    public function get_plugin_name() {
2046
+        return $this->plugin_name;
2047
+    }
2048
+
2049
+    /**
2050
+     * The reference to the class that orchestrates the hooks with the plugin.
2051
+     *
2052
+     * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
2053
+     * @since     1.0.0
2054
+     */
2055
+    public function get_loader() {
2056
+        return $this->loader;
2057
+    }
2058
+
2059
+    /**
2060
+     * Retrieve the version number of the plugin.
2061
+     *
2062
+     * @return    string    The version number of the plugin.
2063
+     * @since     1.0.0
2064
+     */
2065
+    public function get_version() {
2066
+        return $this->version;
2067
+    }
2068
+
2069
+    /**
2070
+     * Load dependencies for WP-CLI.
2071
+     *
2072
+     * @throws Exception
2073
+     * @since 3.18.0
2074
+     */
2075
+    private function load_cli_dependencies() {
2076
+
2077
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php';
2078
+
2079
+        $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 );
2080
+
2081
+        WP_CLI::add_command( 'wl references push', $push_reference_data_command );
2082
+
2083
+    }
2084
+
2085
+    /**
2086
+     * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions.
2087
+     *
2088
+     * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance.
2089
+     * @since 3.20.0
2090
+     */
2091
+    public function get_dashboard_service() {
2092
+
2093
+        return $this->dashboard_service;
2094
+    }
2095
+
2096
+    public function add_wl_enabled_blocks() {
2097
+        /**
2098
+         * Filter: wl_feature__enable__blocks.
2099
+         *
2100
+         * @param bool whether the blocks needed to be registered, defaults to true.
2101
+         *
2102
+         * @return bool
2103
+         * @since 3.27.6
2104
+         */
2105
+
2106
+        wp_register_script( 'wl_enabled_blocks', false );
2107
+
2108
+        $enabled_blocks = array();
2109
+
2110
+        /**
2111
+         * Filter name: wl_feature__enable__product-navigator
2112
+         * @since 3.32.3
2113
+         */
2114
+        if ( apply_filters( 'wl_feature__enable__product-navigator', true ) ) {
2115
+            $enabled_blocks[] = 'wordlift/products-navigator';
2116
+        }
2117
+
2118
+        if ( apply_filters( 'wl_feature__enable__blocks', true ) ) {
2119
+            // To intimate JS
2120
+            $enabled_blocks = array_merge( $enabled_blocks, array(
2121
+                'wordlift/navigator',
2122
+                'wordlift/chord',
2123
+                'wordlift/geomap',
2124
+                'wordlift/timeline',
2125
+                'wordlift/cloud',
2126
+                'wordlift/vocabulary',
2127
+                'wordlift/faceted-search'
2128
+            ) );
2129
+        }
2130
+
2131
+        wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks );
2132
+        wp_enqueue_script( 'wl_enabled_blocks' );
2133
+    }
2134
+
2135
+    /**
2136
+     * Register screens based on the filter.
2137
+     */
2138
+    public function register_screens() {
2139
+        // Hook the menu to the Download Your Data page.
2140
+        if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) {
2141
+            add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 );
2142
+        }
2143
+        add_action( 'admin_menu', array( $this->status_page, 'admin_menu' ), 100, 0 );
2144
+        add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 );
2145
+
2146
+    }
2147 2147
 
2148 2148
 }
Please login to merge, or discard this patch.
src/wordlift/vocabulary/class-analysis-background-process.php 2 patches
Indentation   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -4,198 +4,198 @@
 block discarded – undo
4 4
 
5 5
 class Analysis_Background_Process extends \Wordlift_Plugin_WP_Background_Process {
6 6
 
7
-	const WL_CMKG_ANALYSIS_BACKGROUND_PROCESS = '_wl_cmkg_analysis_background_process';
7
+    const WL_CMKG_ANALYSIS_BACKGROUND_PROCESS = '_wl_cmkg_analysis_background_process';
8 8
 
9 9
 
10
-	protected $action = 'wl_cmkg_analysis_background__analysis';
11
-
12
-	/**
13
-	 * @var Analysis_Background_Service
14
-	 */
15
-	private $analysis_background_service;
16
-
17
-	/**
18
-	 * @var \Wordlift_Log_Service
19
-	 */
20
-	private $log;
10
+    protected $action = 'wl_cmkg_analysis_background__analysis';
11
+
12
+    /**
13
+     * @var Analysis_Background_Service
14
+     */
15
+    private $analysis_background_service;
16
+
17
+    /**
18
+     * @var \Wordlift_Log_Service
19
+     */
20
+    private $log;
21 21
 
22
-	/**
23
-	 * Analysis_Background_Process constructor.
24
-	 *
25
-	 * @param $analysis_background_service Analysis_Background_Service A {@link Analysis_Background_Service} instance providing the supporting functions to this background process.
26
-	 */
27
-	public function __construct( $analysis_background_service ) {
28
-		parent::__construct();
29
-
30
-		$this->log = \Wordlift_Log_Service::get_logger( get_class() );
31
-
32
-		$this->analysis_background_service = $analysis_background_service;
33
-
34
-
35
-	}
36
-
37
-	/**
38
-	 * This function is called:
39
-	 *  - To start a new Synchronization, by passing a {@link Sync_Start_Message} instance.
40
-	 *  - To synchronize a post, by passing a numeric ID.
41
-	 *
42
-	 * This function returns the parameter for the next call or NULL if there are no more posts to process.
43
-	 *
44
-	 * @param int[] $term_ids An array of term IDs.
45
-	 *
46
-	 * @return int[]|false The next term IDs or false if there are no more.
47
-	 */
48
-	protected function task( $term_ids ) {
49
-
50
-		// Check if we must cancel.
51
-		if ( $this->must_cancel() ) {
52
-			$this->cancel();
53
-
54
-			return false;
55
-		}
56
-
57
-		if ( ! $term_ids || ! is_array( $term_ids ) ) {
58
-			$this->cancel();
59
-			return false;
60
-		}
61
-
62
-		$this->log->debug( sprintf( "Synchronizing terms %s...", implode( ', ', $term_ids ) ) );
63
-		// Sync the item.
64
-		return $this->sync_items( $term_ids );
65
-	}
66
-
67
-	/**
68
-	 * Start the background processing.
69
-	 *
70
-	 * @return bool True if the process has been started, otherwise false.
71
-	 */
72
-	public function start() {
73
-		$this->log->debug( "Trying to start analysis bg service..." );
74
-		// Create a new Sync_Model state of `started`.
75
-		if ( ! $this->is_started( self::get_state() ) ) {
76
-			$this->log->debug( "Starting..." );
77
-
78
-			$sync_state = new Sync_State( time(), 0, $this->analysis_background_service->count(), time(), 'started' );
79
-			update_option( self::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS, $sync_state, false );
80
-
81
-			$next = $this->analysis_background_service->next();
82
-
83
-			$this->push_to_queue( $next );
84
-			$this->save()->dispatch();
85
-
86
-			if ( $next && is_array( $next ) ) {
87
-				$this->log->debug( sprintf( 'Started with term IDs %s.', implode( ', ', $next ) ) );
88
-			}
89
-
90
-			return true;
91
-		}
92
-
93
-		return false;
94
-	}
95
-
96
-	/**
97
-	 * Set the transient to cancel the process. The next time the process runs, it'll check whether this transient is
98
-	 * set and will stop processing.
99
-	 */
100
-	public function request_cancel() {
101
-
102
-		set_transient( "{$this->action}__cancel", true );
103
-
104
-	}
105
-
106
-	/**
107
-	 * Get the sync state.
108
-	 *
109
-	 * @return Sync_State The {@link Sync_State}.
110
-	 */
111
-	public static function get_state() {
112
-
113
-		try {
114
-			return get_option( self::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS, Sync_State::unknown() );
115
-		} catch ( \Exception $e ) {
116
-			return Sync_State::unknown();
117
-		}
118
-
119
-	}
120
-
121
-	/**
122
-	 * Check whether the provided state is `started` or not.
123
-	 *
124
-	 * @param Sync_State $state The {@link Sync_State}.
125
-	 *
126
-	 * @return bool True if the state is started.
127
-	 */
128
-	private function is_started( $state ) {
129
-		return $state instanceof Sync_State && 'started' === $state->state && 30 > ( time() - $state->last_update );
130
-	}
131
-
132
-	/**
133
-	 * Check whether the process must cancel or not.
134
-	 *
135
-	 * @return bool Whether to cancel or not the process.
136
-	 */
137
-	private function must_cancel() {
138
-
139
-		return get_transient( "{$this->action}__cancel" );
140
-	}
141
-
142
-	/**
143
-	 * Cancels the current process.
144
-	 */
145
-	public function cancel() {
146
-
147
-		$this->log->debug( "Cancelling synchronization..." );
148
-
149
-		// Cleanup the process data.
150
-		$this->cancel_process();
151
-
152
-		// Set the state to cancelled.
153
-		$state = self::get_state();
154
-		$state->set_state( 'cancelled' );
155
-		update_option( self::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS, $state, false );
156
-
157
-		// Finally delete the transient.
158
-		delete_transient( "{$this->action}__cancel" );
159
-
160
-	}
161
-
162
-	/**
163
-	 * Push the post with the provided ID to the remote platform.
164
-	 *
165
-	 * @param int[] $term_ids The term IDs.
166
-	 *
167
-	 * @return int[]|false The next term ID to process or false if processing is complete.
168
-	 */
169
-	private function sync_items( $term_ids ) {
170
-
171
-		// Sync this item.
172
-		if ( $this->analysis_background_service->perform_analysis_for_terms( $term_ids ) ) {
173
-
174
-			$next       = $this->analysis_background_service->next();
175
-			$next_state = isset( $next ) ? 'started' : 'ended';
176
-
177
-			/**
178
-			 * Update the synchronization meta data, by increasing the current index.
179
-			 *
180
-			 * @var Sync_State $sync The {@link Sync_State}.
181
-			 */
182
-			$state = self::get_state()
183
-			             ->increment_index( $this->analysis_background_service->get_batch_size() )
184
-			             ->set_state( $next_state );
185
-			update_option( self::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS . '', $state, false );
186
-
187
-
188
-			// Return the next IDs or false if there aren't.
189
-			return isset( $next ) ? $next : false;
190
-		} else {
191
-			// Retry.
192
-			// @@todo: put a limit to the number of retries.
193
-
194
-			$this->log->error( sprintf( "Sync failed for terms %s.", implode( ', ', $term_ids ) ) );
195
-
196
-			return $term_ids;
197
-		}
198
-
199
-	}
22
+    /**
23
+     * Analysis_Background_Process constructor.
24
+     *
25
+     * @param $analysis_background_service Analysis_Background_Service A {@link Analysis_Background_Service} instance providing the supporting functions to this background process.
26
+     */
27
+    public function __construct( $analysis_background_service ) {
28
+        parent::__construct();
29
+
30
+        $this->log = \Wordlift_Log_Service::get_logger( get_class() );
31
+
32
+        $this->analysis_background_service = $analysis_background_service;
33
+
34
+
35
+    }
36
+
37
+    /**
38
+     * This function is called:
39
+     *  - To start a new Synchronization, by passing a {@link Sync_Start_Message} instance.
40
+     *  - To synchronize a post, by passing a numeric ID.
41
+     *
42
+     * This function returns the parameter for the next call or NULL if there are no more posts to process.
43
+     *
44
+     * @param int[] $term_ids An array of term IDs.
45
+     *
46
+     * @return int[]|false The next term IDs or false if there are no more.
47
+     */
48
+    protected function task( $term_ids ) {
49
+
50
+        // Check if we must cancel.
51
+        if ( $this->must_cancel() ) {
52
+            $this->cancel();
53
+
54
+            return false;
55
+        }
56
+
57
+        if ( ! $term_ids || ! is_array( $term_ids ) ) {
58
+            $this->cancel();
59
+            return false;
60
+        }
61
+
62
+        $this->log->debug( sprintf( "Synchronizing terms %s...", implode( ', ', $term_ids ) ) );
63
+        // Sync the item.
64
+        return $this->sync_items( $term_ids );
65
+    }
66
+
67
+    /**
68
+     * Start the background processing.
69
+     *
70
+     * @return bool True if the process has been started, otherwise false.
71
+     */
72
+    public function start() {
73
+        $this->log->debug( "Trying to start analysis bg service..." );
74
+        // Create a new Sync_Model state of `started`.
75
+        if ( ! $this->is_started( self::get_state() ) ) {
76
+            $this->log->debug( "Starting..." );
77
+
78
+            $sync_state = new Sync_State( time(), 0, $this->analysis_background_service->count(), time(), 'started' );
79
+            update_option( self::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS, $sync_state, false );
80
+
81
+            $next = $this->analysis_background_service->next();
82
+
83
+            $this->push_to_queue( $next );
84
+            $this->save()->dispatch();
85
+
86
+            if ( $next && is_array( $next ) ) {
87
+                $this->log->debug( sprintf( 'Started with term IDs %s.', implode( ', ', $next ) ) );
88
+            }
89
+
90
+            return true;
91
+        }
92
+
93
+        return false;
94
+    }
95
+
96
+    /**
97
+     * Set the transient to cancel the process. The next time the process runs, it'll check whether this transient is
98
+     * set and will stop processing.
99
+     */
100
+    public function request_cancel() {
101
+
102
+        set_transient( "{$this->action}__cancel", true );
103
+
104
+    }
105
+
106
+    /**
107
+     * Get the sync state.
108
+     *
109
+     * @return Sync_State The {@link Sync_State}.
110
+     */
111
+    public static function get_state() {
112
+
113
+        try {
114
+            return get_option( self::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS, Sync_State::unknown() );
115
+        } catch ( \Exception $e ) {
116
+            return Sync_State::unknown();
117
+        }
118
+
119
+    }
120
+
121
+    /**
122
+     * Check whether the provided state is `started` or not.
123
+     *
124
+     * @param Sync_State $state The {@link Sync_State}.
125
+     *
126
+     * @return bool True if the state is started.
127
+     */
128
+    private function is_started( $state ) {
129
+        return $state instanceof Sync_State && 'started' === $state->state && 30 > ( time() - $state->last_update );
130
+    }
131
+
132
+    /**
133
+     * Check whether the process must cancel or not.
134
+     *
135
+     * @return bool Whether to cancel or not the process.
136
+     */
137
+    private function must_cancel() {
138
+
139
+        return get_transient( "{$this->action}__cancel" );
140
+    }
141
+
142
+    /**
143
+     * Cancels the current process.
144
+     */
145
+    public function cancel() {
146
+
147
+        $this->log->debug( "Cancelling synchronization..." );
148
+
149
+        // Cleanup the process data.
150
+        $this->cancel_process();
151
+
152
+        // Set the state to cancelled.
153
+        $state = self::get_state();
154
+        $state->set_state( 'cancelled' );
155
+        update_option( self::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS, $state, false );
156
+
157
+        // Finally delete the transient.
158
+        delete_transient( "{$this->action}__cancel" );
159
+
160
+    }
161
+
162
+    /**
163
+     * Push the post with the provided ID to the remote platform.
164
+     *
165
+     * @param int[] $term_ids The term IDs.
166
+     *
167
+     * @return int[]|false The next term ID to process or false if processing is complete.
168
+     */
169
+    private function sync_items( $term_ids ) {
170
+
171
+        // Sync this item.
172
+        if ( $this->analysis_background_service->perform_analysis_for_terms( $term_ids ) ) {
173
+
174
+            $next       = $this->analysis_background_service->next();
175
+            $next_state = isset( $next ) ? 'started' : 'ended';
176
+
177
+            /**
178
+             * Update the synchronization meta data, by increasing the current index.
179
+             *
180
+             * @var Sync_State $sync The {@link Sync_State}.
181
+             */
182
+            $state = self::get_state()
183
+                            ->increment_index( $this->analysis_background_service->get_batch_size() )
184
+                            ->set_state( $next_state );
185
+            update_option( self::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS . '', $state, false );
186
+
187
+
188
+            // Return the next IDs or false if there aren't.
189
+            return isset( $next ) ? $next : false;
190
+        } else {
191
+            // Retry.
192
+            // @@todo: put a limit to the number of retries.
193
+
194
+            $this->log->error( sprintf( "Sync failed for terms %s.", implode( ', ', $term_ids ) ) );
195
+
196
+            return $term_ids;
197
+        }
198
+
199
+    }
200 200
 
201 201
 }
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @param $analysis_background_service Analysis_Background_Service A {@link Analysis_Background_Service} instance providing the supporting functions to this background process.
26 26
 	 */
27
-	public function __construct( $analysis_background_service ) {
27
+	public function __construct($analysis_background_service) {
28 28
 		parent::__construct();
29 29
 
30
-		$this->log = \Wordlift_Log_Service::get_logger( get_class() );
30
+		$this->log = \Wordlift_Log_Service::get_logger(get_class());
31 31
 
32 32
 		$this->analysis_background_service = $analysis_background_service;
33 33
 
@@ -45,23 +45,23 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @return int[]|false The next term IDs or false if there are no more.
47 47
 	 */
48
-	protected function task( $term_ids ) {
48
+	protected function task($term_ids) {
49 49
 
50 50
 		// Check if we must cancel.
51
-		if ( $this->must_cancel() ) {
51
+		if ($this->must_cancel()) {
52 52
 			$this->cancel();
53 53
 
54 54
 			return false;
55 55
 		}
56 56
 
57
-		if ( ! $term_ids || ! is_array( $term_ids ) ) {
57
+		if ( ! $term_ids || ! is_array($term_ids)) {
58 58
 			$this->cancel();
59 59
 			return false;
60 60
 		}
61 61
 
62
-		$this->log->debug( sprintf( "Synchronizing terms %s...", implode( ', ', $term_ids ) ) );
62
+		$this->log->debug(sprintf("Synchronizing terms %s...", implode(', ', $term_ids)));
63 63
 		// Sync the item.
64
-		return $this->sync_items( $term_ids );
64
+		return $this->sync_items($term_ids);
65 65
 	}
66 66
 
67 67
 	/**
@@ -70,21 +70,21 @@  discard block
 block discarded – undo
70 70
 	 * @return bool True if the process has been started, otherwise false.
71 71
 	 */
72 72
 	public function start() {
73
-		$this->log->debug( "Trying to start analysis bg service..." );
73
+		$this->log->debug("Trying to start analysis bg service...");
74 74
 		// Create a new Sync_Model state of `started`.
75
-		if ( ! $this->is_started( self::get_state() ) ) {
76
-			$this->log->debug( "Starting..." );
75
+		if ( ! $this->is_started(self::get_state())) {
76
+			$this->log->debug("Starting...");
77 77
 
78
-			$sync_state = new Sync_State( time(), 0, $this->analysis_background_service->count(), time(), 'started' );
79
-			update_option( self::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS, $sync_state, false );
78
+			$sync_state = new Sync_State(time(), 0, $this->analysis_background_service->count(), time(), 'started');
79
+			update_option(self::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS, $sync_state, false);
80 80
 
81 81
 			$next = $this->analysis_background_service->next();
82 82
 
83
-			$this->push_to_queue( $next );
83
+			$this->push_to_queue($next);
84 84
 			$this->save()->dispatch();
85 85
 
86
-			if ( $next && is_array( $next ) ) {
87
-				$this->log->debug( sprintf( 'Started with term IDs %s.', implode( ', ', $next ) ) );
86
+			if ($next && is_array($next)) {
87
+				$this->log->debug(sprintf('Started with term IDs %s.', implode(', ', $next)));
88 88
 			}
89 89
 
90 90
 			return true;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	public function request_cancel() {
101 101
 
102
-		set_transient( "{$this->action}__cancel", true );
102
+		set_transient("{$this->action}__cancel", true);
103 103
 
104 104
 	}
105 105
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 	public static function get_state() {
112 112
 
113 113
 		try {
114
-			return get_option( self::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS, Sync_State::unknown() );
115
-		} catch ( \Exception $e ) {
114
+			return get_option(self::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS, Sync_State::unknown());
115
+		} catch (\Exception $e) {
116 116
 			return Sync_State::unknown();
117 117
 		}
118 118
 
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 	 *
126 126
 	 * @return bool True if the state is started.
127 127
 	 */
128
-	private function is_started( $state ) {
129
-		return $state instanceof Sync_State && 'started' === $state->state && 30 > ( time() - $state->last_update );
128
+	private function is_started($state) {
129
+		return $state instanceof Sync_State && 'started' === $state->state && 30 > (time() - $state->last_update);
130 130
 	}
131 131
 
132 132
 	/**
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 */
137 137
 	private function must_cancel() {
138 138
 
139
-		return get_transient( "{$this->action}__cancel" );
139
+		return get_transient("{$this->action}__cancel");
140 140
 	}
141 141
 
142 142
 	/**
@@ -144,18 +144,18 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public function cancel() {
146 146
 
147
-		$this->log->debug( "Cancelling synchronization..." );
147
+		$this->log->debug("Cancelling synchronization...");
148 148
 
149 149
 		// Cleanup the process data.
150 150
 		$this->cancel_process();
151 151
 
152 152
 		// Set the state to cancelled.
153 153
 		$state = self::get_state();
154
-		$state->set_state( 'cancelled' );
155
-		update_option( self::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS, $state, false );
154
+		$state->set_state('cancelled');
155
+		update_option(self::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS, $state, false);
156 156
 
157 157
 		// Finally delete the transient.
158
-		delete_transient( "{$this->action}__cancel" );
158
+		delete_transient("{$this->action}__cancel");
159 159
 
160 160
 	}
161 161
 
@@ -166,13 +166,13 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @return int[]|false The next term ID to process or false if processing is complete.
168 168
 	 */
169
-	private function sync_items( $term_ids ) {
169
+	private function sync_items($term_ids) {
170 170
 
171 171
 		// Sync this item.
172
-		if ( $this->analysis_background_service->perform_analysis_for_terms( $term_ids ) ) {
172
+		if ($this->analysis_background_service->perform_analysis_for_terms($term_ids)) {
173 173
 
174 174
 			$next       = $this->analysis_background_service->next();
175
-			$next_state = isset( $next ) ? 'started' : 'ended';
175
+			$next_state = isset($next) ? 'started' : 'ended';
176 176
 
177 177
 			/**
178 178
 			 * Update the synchronization meta data, by increasing the current index.
@@ -180,18 +180,18 @@  discard block
 block discarded – undo
180 180
 			 * @var Sync_State $sync The {@link Sync_State}.
181 181
 			 */
182 182
 			$state = self::get_state()
183
-			             ->increment_index( $this->analysis_background_service->get_batch_size() )
184
-			             ->set_state( $next_state );
185
-			update_option( self::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS . '', $state, false );
183
+			             ->increment_index($this->analysis_background_service->get_batch_size())
184
+			             ->set_state($next_state);
185
+			update_option(self::WL_CMKG_ANALYSIS_BACKGROUND_PROCESS.'', $state, false);
186 186
 
187 187
 
188 188
 			// Return the next IDs or false if there aren't.
189
-			return isset( $next ) ? $next : false;
189
+			return isset($next) ? $next : false;
190 190
 		} else {
191 191
 			// Retry.
192 192
 			// @@todo: put a limit to the number of retries.
193 193
 
194
-			$this->log->error( sprintf( "Sync failed for terms %s.", implode( ', ', $term_ids ) ) );
194
+			$this->log->error(sprintf("Sync failed for terms %s.", implode(', ', $term_ids)));
195 195
 
196 196
 			return $term_ids;
197 197
 		}
Please login to merge, or discard this patch.