Completed
Push — master ( fb86a2...6c57f6 )
by David
03:43
created
src/includes/class-wordlift-batch-analysis-service.php 2 patches
Indentation   +603 added lines, -603 removed lines patch added patch discarded remove patch
@@ -51,158 +51,158 @@  discard block
 block discarded – undo
51 51
  */
52 52
 class Wordlift_Batch_Analysis_Service {
53 53
 
54
-	/**
55
-	 * The list of states for the Batch Analysis:
56
-	 *  - STATE_META_KEY: the batch analysis state meta key,
57
-	 *  - STATE_SUBMIT: a post/page has been submitted for analysis,
58
-	 *  - STATE_REQUEST: the plugin requested an analysis for the submitted
59
-	 *      post/page,
60
-	 *  - STATE_SUCCESS: the analysis has completed successfully,
61
-	 *  - STATE_ERROR: the analysis returned an error.
62
-	 *
63
-	 * @since 3.14.2
64
-	 */
65
-	const STATE_META_KEY = '_wl_batch_analysis_state';
66
-	const STATE_SUBMIT = 0;
67
-	const STATE_REQUEST = 1;
68
-	//### COMPLETE states.
69
-	const STATE_SUCCESS = 2;
70
-	const STATE_ERROR = 2;
71
-
72
-	/**
73
-	 * The submit timestamp meta key. A post may have more than one timestamp.
74
-	 *
75
-	 * @since 3.14.2
76
-	 */
77
-	const SUBMIT_TIMESTAMP_META_KEY = '_wl_batch_analysis_submit_timestamp';
78
-
79
-	/**
80
-	 * The request timestamp meta key. A post may have more than one timestamp.
81
-	 *
82
-	 * @since 3.14.2
83
-	 */
84
-	const REQUEST_TIMESTAMP_META_KEY = '_wl_batch_analysis_request_timestamp';
85
-
86
-	/**
87
-	 * The complete (success or error) timestamp meta key. A post may have more
88
-	 * than one timestamp.
89
-	 *
90
-	 * @since 3.14.2
91
-	 */
92
-	const COMPLETE_TIMESTAMP_META_KEY = '_wl_batch_analysis_complete_timestamp';
93
-
94
-	/**
95
-	 * The link setting meta key. A post may have more than one setting.
96
-	 *
97
-	 * @since 3.14.2
98
-	 */
99
-	const LINK_META_KEY = '_wl_batch_analysis_link';
100
-
101
-	/**
102
-	 * The warning timestamp meta key. A post has only zero/one value.
103
-	 *
104
-	 * @since 3.14.2
105
-	 */
106
-	const WARNING_META_KEY = '_wl_batch_analysis_warning';
107
-
108
-	/**
109
-	 * Option name.
110
-	 *
111
-	 * @since  3.14.0
112
-	 */
113
-	const OPTION_NAME = 'wl_analyze_batch';
114
-
115
-	/**
116
-	 * Name of waiting to be processed queue array inside the option.
117
-	 *
118
-	 * @since  3.14.0
119
-	 */
120
-	const ANALYZE_QUEUE = 'queue';
121
-
122
-	/**
123
-	 * Name of waiting for response queue array inside the option.
124
-	 *
125
-	 * @since  3.14.0
126
-	 */
127
-	const RESPONSE_QUEUE = 'processing';
128
-
129
-	/**
130
-	 * The {@link Wordlift} plugin instance.
131
-	 *
132
-	 * @since  3.14.0
133
-	 * @access private
134
-	 * @var \Wordlift $plugin The {@link Wordlift} plugin instance.
135
-	 */
136
-	private $plugin;
137
-
138
-	/**
139
-	 * The {@link Wordlift_Configuration_Service} instance.
140
-	 *
141
-	 * @since  3.14.0
142
-	 * @access private
143
-	 * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
144
-	 */
145
-	private $configuration_service;
146
-
147
-	/**
148
-	 * A {@link Wordlift_Log_Service} instance.
149
-	 *
150
-	 * @since  3.14.2
151
-	 * @access private
152
-	 * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
153
-	 */
154
-	private $log;
155
-
156
-	/**
157
-	 * The {@link Class_Wordlift_Batch_Analys_Service} instance.
158
-	 *
159
-	 * @since 3.14.0
160
-	 *
161
-	 * @param \Wordlift                       $plugin                The {@link Wordlift} plugin instance.
162
-	 * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
163
-	 */
164
-	public function __construct( $plugin, $configuration_service ) {
165
-
166
-		$this->plugin                = $plugin;
167
-		$this->configuration_service = $configuration_service;
168
-		$this->log                   = Wordlift_Log_Service::get_logger( 'Wordlift_Batch_Analysis_Service' );
169
-
170
-		add_action( 'wp_async_wl_batch_analysis_request', array(
171
-			$this,
172
-			'request',
173
-		) );
174
-		add_action( 'wp_async_wl_batch_analysis_complete', array(
175
-			$this,
176
-			'complete',
177
-		) );
178
-
179
-	}
180
-
181
-	/**
182
-	 * Get the base SQL statement to submit a post for Batch Analysis.
183
-	 *
184
-	 * Functions may use this base SQL and add their own filters.
185
-	 *
186
-	 * @since 3.14.2
187
-	 *
188
-	 * @param string $link The link setting ('yes'/'no').
189
-	 *
190
-	 * @return string The base SQL.
191
-	 */
192
-	private function get_sql( $link ) {
193
-		global $wpdb;
194
-
195
-		// Prepare the statement:
196
-		//  1. Insert into `postmeta` the meta keys and values:
197
-		//    a) state meta, with value of SUBMIT (0),
198
-		//    b) submit timestamp, with value of UTC timestamp,
199
-		//    c) link meta, with the provided value.
200
-		//  2. Join the current state value, can be used for filters by other
201
-		//     functions.
202
-		//  3. Filter by `post`/`page` types.
203
-		//  4. Filter by `publish` status.
204
-		return $wpdb->prepare(
205
-			"
54
+    /**
55
+     * The list of states for the Batch Analysis:
56
+     *  - STATE_META_KEY: the batch analysis state meta key,
57
+     *  - STATE_SUBMIT: a post/page has been submitted for analysis,
58
+     *  - STATE_REQUEST: the plugin requested an analysis for the submitted
59
+     *      post/page,
60
+     *  - STATE_SUCCESS: the analysis has completed successfully,
61
+     *  - STATE_ERROR: the analysis returned an error.
62
+     *
63
+     * @since 3.14.2
64
+     */
65
+    const STATE_META_KEY = '_wl_batch_analysis_state';
66
+    const STATE_SUBMIT = 0;
67
+    const STATE_REQUEST = 1;
68
+    //### COMPLETE states.
69
+    const STATE_SUCCESS = 2;
70
+    const STATE_ERROR = 2;
71
+
72
+    /**
73
+     * The submit timestamp meta key. A post may have more than one timestamp.
74
+     *
75
+     * @since 3.14.2
76
+     */
77
+    const SUBMIT_TIMESTAMP_META_KEY = '_wl_batch_analysis_submit_timestamp';
78
+
79
+    /**
80
+     * The request timestamp meta key. A post may have more than one timestamp.
81
+     *
82
+     * @since 3.14.2
83
+     */
84
+    const REQUEST_TIMESTAMP_META_KEY = '_wl_batch_analysis_request_timestamp';
85
+
86
+    /**
87
+     * The complete (success or error) timestamp meta key. A post may have more
88
+     * than one timestamp.
89
+     *
90
+     * @since 3.14.2
91
+     */
92
+    const COMPLETE_TIMESTAMP_META_KEY = '_wl_batch_analysis_complete_timestamp';
93
+
94
+    /**
95
+     * The link setting meta key. A post may have more than one setting.
96
+     *
97
+     * @since 3.14.2
98
+     */
99
+    const LINK_META_KEY = '_wl_batch_analysis_link';
100
+
101
+    /**
102
+     * The warning timestamp meta key. A post has only zero/one value.
103
+     *
104
+     * @since 3.14.2
105
+     */
106
+    const WARNING_META_KEY = '_wl_batch_analysis_warning';
107
+
108
+    /**
109
+     * Option name.
110
+     *
111
+     * @since  3.14.0
112
+     */
113
+    const OPTION_NAME = 'wl_analyze_batch';
114
+
115
+    /**
116
+     * Name of waiting to be processed queue array inside the option.
117
+     *
118
+     * @since  3.14.0
119
+     */
120
+    const ANALYZE_QUEUE = 'queue';
121
+
122
+    /**
123
+     * Name of waiting for response queue array inside the option.
124
+     *
125
+     * @since  3.14.0
126
+     */
127
+    const RESPONSE_QUEUE = 'processing';
128
+
129
+    /**
130
+     * The {@link Wordlift} plugin instance.
131
+     *
132
+     * @since  3.14.0
133
+     * @access private
134
+     * @var \Wordlift $plugin The {@link Wordlift} plugin instance.
135
+     */
136
+    private $plugin;
137
+
138
+    /**
139
+     * The {@link Wordlift_Configuration_Service} instance.
140
+     *
141
+     * @since  3.14.0
142
+     * @access private
143
+     * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
144
+     */
145
+    private $configuration_service;
146
+
147
+    /**
148
+     * A {@link Wordlift_Log_Service} instance.
149
+     *
150
+     * @since  3.14.2
151
+     * @access private
152
+     * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
153
+     */
154
+    private $log;
155
+
156
+    /**
157
+     * The {@link Class_Wordlift_Batch_Analys_Service} instance.
158
+     *
159
+     * @since 3.14.0
160
+     *
161
+     * @param \Wordlift                       $plugin                The {@link Wordlift} plugin instance.
162
+     * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
163
+     */
164
+    public function __construct( $plugin, $configuration_service ) {
165
+
166
+        $this->plugin                = $plugin;
167
+        $this->configuration_service = $configuration_service;
168
+        $this->log                   = Wordlift_Log_Service::get_logger( 'Wordlift_Batch_Analysis_Service' );
169
+
170
+        add_action( 'wp_async_wl_batch_analysis_request', array(
171
+            $this,
172
+            'request',
173
+        ) );
174
+        add_action( 'wp_async_wl_batch_analysis_complete', array(
175
+            $this,
176
+            'complete',
177
+        ) );
178
+
179
+    }
180
+
181
+    /**
182
+     * Get the base SQL statement to submit a post for Batch Analysis.
183
+     *
184
+     * Functions may use this base SQL and add their own filters.
185
+     *
186
+     * @since 3.14.2
187
+     *
188
+     * @param string $link The link setting ('yes'/'no').
189
+     *
190
+     * @return string The base SQL.
191
+     */
192
+    private function get_sql( $link ) {
193
+        global $wpdb;
194
+
195
+        // Prepare the statement:
196
+        //  1. Insert into `postmeta` the meta keys and values:
197
+        //    a) state meta, with value of SUBMIT (0),
198
+        //    b) submit timestamp, with value of UTC timestamp,
199
+        //    c) link meta, with the provided value.
200
+        //  2. Join the current state value, can be used for filters by other
201
+        //     functions.
202
+        //  3. Filter by `post`/`page` types.
203
+        //  4. Filter by `publish` status.
204
+        return $wpdb->prepare(
205
+            "
206 206
 			INSERT INTO $wpdb->postmeta ( post_id, meta_key, meta_value )
207 207
 			SELECT p.ID, metas.*
208 208
 			FROM (
@@ -218,492 +218,492 @@  discard block
 block discarded – undo
218 218
 			WHERE p.post_type IN ('post', 'page')
219 219
 				AND p.post_status = 'publish'
220 220
 			",
221
-			self::STATE_META_KEY,
222
-			self::SUBMIT_TIMESTAMP_META_KEY,
223
-			self::LINK_META_KEY,
224
-			$link,
225
-			self::STATE_META_KEY
226
-		);
227
-	}
228
-
229
-	/**
230
-	 * Submit for analysis all the posts/pages which do not have annotations
231
-	 * and haven't been analyzed before.
232
-	 *
233
-	 * @since 3.14.2
234
-	 *
235
-	 * @param string $link The link setting.
236
-	 *
237
-	 * @return false|int The number of submitted {@link WP_Post}s or false on
238
-	 *                   error.
239
-	 */
240
-	public function submit_auto_selected_posts( $link ) {
241
-		global $wpdb;
242
-
243
-		// Submit the posts/pages and return the number of affected results.
244
-		// We're using a SQL query here because we could have potentially
245
-		// thousands of rows.
246
-		$count = $wpdb->query( $wpdb->prepare(
247
-			$this->get_sql( $link ) .
248
-			"
221
+            self::STATE_META_KEY,
222
+            self::SUBMIT_TIMESTAMP_META_KEY,
223
+            self::LINK_META_KEY,
224
+            $link,
225
+            self::STATE_META_KEY
226
+        );
227
+    }
228
+
229
+    /**
230
+     * Submit for analysis all the posts/pages which do not have annotations
231
+     * and haven't been analyzed before.
232
+     *
233
+     * @since 3.14.2
234
+     *
235
+     * @param string $link The link setting.
236
+     *
237
+     * @return false|int The number of submitted {@link WP_Post}s or false on
238
+     *                   error.
239
+     */
240
+    public function submit_auto_selected_posts( $link ) {
241
+        global $wpdb;
242
+
243
+        // Submit the posts/pages and return the number of affected results.
244
+        // We're using a SQL query here because we could have potentially
245
+        // thousands of rows.
246
+        $count = $wpdb->query( $wpdb->prepare(
247
+            $this->get_sql( $link ) .
248
+            "
249 249
 				AND batch_analysis_state.meta_value IS NULL
250 250
 				AND p.post_content NOT REGEXP %s;
251 251
 			",
252
-			'<[a-z]+ id="urn:[^"]+" class="[^"]+" itemid="[^"]+">'
253
-		) );
254
-
255
-		// Request Batch Analysis (the operation is handled asynchronously).
256
-		do_action( 'wl_batch_analysis_request' );
257
-
258
-		// Divide the count by 3 to get the number of posts/pages queued.
259
-		return $count / 3;
260
-	}
261
-
262
-	/**
263
-	 * Submit the provided list of {@link WP_Post}s' ids for Batch Analysis.
264
-	 *
265
-	 * @since 3.14.2
266
-	 *
267
-	 * @param int|array $post_ids A single {@link WP_Post}'s id or an array of
268
-	 *                            {@link WP_Post}s' ids.
269
-	 * @param string    $link     The link setting.
270
-	 *
271
-	 * @return int The number of submitted {@link WP_Post}s or false on error.
272
-	 */
273
-	public function submit( $post_ids, $link ) {
274
-		global $wpdb;
275
-
276
-		// Submit the posts/pages and return the number of affected results.
277
-		// We're using a SQL query here because we could have potentially
278
-		// thousands of rows.
279
-		$count = $wpdb->query(
280
-			$this->get_sql( $link ) .
281
-			' AND p.ID IN ( ' . implode( ',', wp_parse_id_list( $post_ids ) ) . ' )'
282
-		);
283
-
284
-		// Request Batch Analysis (the operation is handled asynchronously).
285
-		do_action( 'wl_batch_analysis_request' );
286
-
287
-		// Divide the count by 3 to get the number of posts/pages queued.
288
-		return $count / 3;
289
-	}
290
-
291
-	/**
292
-	 * Cancel the Batch Analysis request for the specified {@link WP_Post}s.
293
-	 *
294
-	 * @since 3.14.2
295
-	 *
296
-	 * @param int|array $post_ids A single {@link WP_Post}'s id or an array of
297
-	 *                            {@link WP_Post}s' ids.
298
-	 *
299
-	 * @return false|int The number of cancelled {@link WP_Post}s or false on
300
-	 *                   error.
301
-	 */
302
-	public function cancel( $post_ids ) {
303
-		global $wpdb;
304
-
305
-		return $wpdb->query( $wpdb->prepare(
306
-			"
252
+            '<[a-z]+ id="urn:[^"]+" class="[^"]+" itemid="[^"]+">'
253
+        ) );
254
+
255
+        // Request Batch Analysis (the operation is handled asynchronously).
256
+        do_action( 'wl_batch_analysis_request' );
257
+
258
+        // Divide the count by 3 to get the number of posts/pages queued.
259
+        return $count / 3;
260
+    }
261
+
262
+    /**
263
+     * Submit the provided list of {@link WP_Post}s' ids for Batch Analysis.
264
+     *
265
+     * @since 3.14.2
266
+     *
267
+     * @param int|array $post_ids A single {@link WP_Post}'s id or an array of
268
+     *                            {@link WP_Post}s' ids.
269
+     * @param string    $link     The link setting.
270
+     *
271
+     * @return int The number of submitted {@link WP_Post}s or false on error.
272
+     */
273
+    public function submit( $post_ids, $link ) {
274
+        global $wpdb;
275
+
276
+        // Submit the posts/pages and return the number of affected results.
277
+        // We're using a SQL query here because we could have potentially
278
+        // thousands of rows.
279
+        $count = $wpdb->query(
280
+            $this->get_sql( $link ) .
281
+            ' AND p.ID IN ( ' . implode( ',', wp_parse_id_list( $post_ids ) ) . ' )'
282
+        );
283
+
284
+        // Request Batch Analysis (the operation is handled asynchronously).
285
+        do_action( 'wl_batch_analysis_request' );
286
+
287
+        // Divide the count by 3 to get the number of posts/pages queued.
288
+        return $count / 3;
289
+    }
290
+
291
+    /**
292
+     * Cancel the Batch Analysis request for the specified {@link WP_Post}s.
293
+     *
294
+     * @since 3.14.2
295
+     *
296
+     * @param int|array $post_ids A single {@link WP_Post}'s id or an array of
297
+     *                            {@link WP_Post}s' ids.
298
+     *
299
+     * @return false|int The number of cancelled {@link WP_Post}s or false on
300
+     *                   error.
301
+     */
302
+    public function cancel( $post_ids ) {
303
+        global $wpdb;
304
+
305
+        return $wpdb->query( $wpdb->prepare(
306
+            "
307 307
 			DELETE FROM $wpdb->postmeta
308 308
 			WHERE meta_key = %s
309 309
 				AND meta_value = %s
310 310
 				AND post_id IN ( " . implode( ',', wp_parse_id_list( $post_ids ) ) . " )
311 311
 			",
312
-			self::STATE_META_KEY,
313
-			self::STATE_REQUEST
314
-		) );
312
+            self::STATE_META_KEY,
313
+            self::STATE_REQUEST
314
+        ) );
315 315
 
316
-	}
316
+    }
317 317
 
318
-	/**
319
-	 * Request the batch analysis for submitted posts.
320
-	 *
321
-	 * @since 3.14.2
322
-	 */
323
-	public function request() {
318
+    /**
319
+     * Request the batch analysis for submitted posts.
320
+     *
321
+     * @since 3.14.2
322
+     */
323
+    public function request() {
324 324
 
325
-		$this->log->debug( "Requesting analysis..." );
325
+        $this->log->debug( "Requesting analysis..." );
326 326
 
327
-		// By default 5 posts of any post type are returned.
328
-		$posts = get_posts( array(
329
-			'fields'     => 'ids',
330
-			'meta_key'   => self::STATE_META_KEY,
331
-			'meta_value' => self::STATE_SUBMIT,
332
-			'orderby'    => 'ID',
333
-		) );
327
+        // By default 5 posts of any post type are returned.
328
+        $posts = get_posts( array(
329
+            'fields'     => 'ids',
330
+            'meta_key'   => self::STATE_META_KEY,
331
+            'meta_value' => self::STATE_SUBMIT,
332
+            'orderby'    => 'ID',
333
+        ) );
334 334
 
335
-		// Bail out if there are no submitted posts.
336
-		if ( empty( $posts ) ) {
337
-			$this->log->debug( 'No posts to submit found, checking for completed requests...' );
335
+        // Bail out if there are no submitted posts.
336
+        if ( empty( $posts ) ) {
337
+            $this->log->debug( 'No posts to submit found, checking for completed requests...' );
338 338
 
339
-			do_action( 'wl_batch_analysis_complete' );
339
+            do_action( 'wl_batch_analysis_complete' );
340 340
 
341
-			return;
342
-		}
341
+            return;
342
+        }
343 343
 
344
-		// Send a request for each post.
345
-		foreach ( $posts as $id ) {
346
-			$this->log->debug( "Requesting analysis for post $id..." );
344
+        // Send a request for each post.
345
+        foreach ( $posts as $id ) {
346
+            $this->log->debug( "Requesting analysis for post $id..." );
347 347
 
348
-			// Change the state to `REQUEST`.
349
-			$this->set_state( $id, self::STATE_REQUEST );
348
+            // Change the state to `REQUEST`.
349
+            $this->set_state( $id, self::STATE_REQUEST );
350 350
 
351
-			// Send the actual request to the remote service.
352
-			$result = $this->do_request( $id );
351
+            // Send the actual request to the remote service.
352
+            $result = $this->do_request( $id );
353 353
 
354
-			$this->log->debug( "Analysis requested for post $id." );
354
+            $this->log->debug( "Analysis requested for post $id." );
355 355
 
356
-			// Set an error if we received an error.
357
-			if ( is_wp_error( $result ) ) {
358
-				$this->log->error( "Analysis request for post $id returned {$result->get_error_message()}." );
356
+            // Set an error if we received an error.
357
+            if ( is_wp_error( $result ) ) {
358
+                $this->log->error( "Analysis request for post $id returned {$result->get_error_message()}." );
359 359
 
360
-				$this->set_state( $id, self::STATE_ERROR );
361
-			}
360
+                $this->set_state( $id, self::STATE_ERROR );
361
+            }
362 362
 
363
-		}
363
+        }
364 364
 
365
-		// Call the `wl_batch_analysis_request` action again. This is going
366
-		// to be handled by the async task.
367
-		do_action( 'wl_batch_analysis_request' );
365
+        // Call the `wl_batch_analysis_request` action again. This is going
366
+        // to be handled by the async task.
367
+        do_action( 'wl_batch_analysis_request' );
368 368
 
369
-	}
369
+    }
370 370
 
371
-	/**
372
-	 * Get the results for the Batch Analysis.
373
-	 *
374
-	 * @since 3.14.2
375
-	 */
376
-	public function complete() {
371
+    /**
372
+     * Get the results for the Batch Analysis.
373
+     *
374
+     * @since 3.14.2
375
+     */
376
+    public function complete() {
377 377
 
378
-		$this->log->debug( "Requesting results..." );
378
+        $this->log->debug( "Requesting results..." );
379 379
 
380
-		// By default 5 posts of any post type are returned.
381
-		$posts = get_posts( array(
382
-			'fields'     => 'ids',
383
-			'meta_key'   => self::STATE_META_KEY,
384
-			'meta_value' => self::STATE_REQUEST,
385
-			'orderby'    => 'ID',
386
-		) );
380
+        // By default 5 posts of any post type are returned.
381
+        $posts = get_posts( array(
382
+            'fields'     => 'ids',
383
+            'meta_key'   => self::STATE_META_KEY,
384
+            'meta_value' => self::STATE_REQUEST,
385
+            'orderby'    => 'ID',
386
+        ) );
387 387
 
388
-		// Bail out if there are no submitted posts.
389
-		if ( empty( $posts ) ) {
390
-			$this->log->debug( 'No posts in request state found.' );
388
+        // Bail out if there are no submitted posts.
389
+        if ( empty( $posts ) ) {
390
+            $this->log->debug( 'No posts in request state found.' );
391 391
 
392
-			return;
393
-		}
392
+            return;
393
+        }
394 394
 
395
-		// Send a request for each post.
396
-		foreach ( $posts as $id ) {
397
-			$this->log->debug( "Requesting results for post $id..." );
395
+        // Send a request for each post.
396
+        foreach ( $posts as $id ) {
397
+            $this->log->debug( "Requesting results for post $id..." );
398 398
 
399
-			// Send the actual request to the remote service.
400
-			$response = $this->do_complete( $id );
399
+            // Send the actual request to the remote service.
400
+            $response = $this->do_complete( $id );
401 401
 
402
-			$this->log->debug( "Results requested for post $id." );
402
+            $this->log->debug( "Results requested for post $id." );
403 403
 
404
-			// Set an error if we received an error.
405
-			if ( ! is_wp_error( $response ) && isset( $response['body'] ) ) {
404
+            // Set an error if we received an error.
405
+            if ( ! is_wp_error( $response ) && isset( $response['body'] ) ) {
406 406
 
407
-				$this->log->debug( "Results received for post $id." );
407
+                $this->log->debug( "Results received for post $id." );
408 408
 
409
-				// Save the returned content as new revision.
410
-				$json = json_decode( $response['body'] );
411
-
412
-				// Continue if the content isn't set.
413
-				if ( ! isset( $json->content ) || empty( $json->content ) ) {
414
-					continue;
415
-				}
409
+                // Save the returned content as new revision.
410
+                $json = json_decode( $response['body'] );
411
+
412
+                // Continue if the content isn't set.
413
+                if ( ! isset( $json->content ) || empty( $json->content ) ) {
414
+                    continue;
415
+                }
416 416
 
417
-				$this->set_warning_based_on_content( $id, $json->content );
418
-
419
-				$content = wp_slash( $json->content );
420
-
421
-				wp_update_post( array(
422
-					'ID'           => $id,
423
-					'post_content' => $content,
424
-				) );
425
-
426
-				// Update the status.
427
-				$this->set_state( $id, self::STATE_SUCCESS );
428
-
429
-				$this->log->debug( "Post $id updated with batch analysis results." );
430
-
431
-				continue;
432
-			}
433
-
434
-			// @todo: implement a kind of timeout that sets an error if the
435
-			// results haven't been received after a long time.
436
-
437
-		}
438
-
439
-		// Call the `wl_batch_analysis_request` action again. This is going
440
-		// to be handled by the async task.
441
-		do_action( 'wl_batch_analysis_complete' );
442
-
443
-	}
444
-
445
-	/**
446
-	 * Set a warning flag on the {@link WP_Post} if its content has suspicious
447
-	 * interpolations.
448
-	 *
449
-	 * @since 3.14.2
450
-	 *
451
-	 * @param int    $post_id The {@link WP_Post}'s id.
452
-	 * @param string $content The {@link WP_Post}'s content.
453
-	 *
454
-	 * @return string The content (for chaining operations).
455
-	 */
456
-	private function set_warning_based_on_content( $post_id, $content ) {
457
-
458
-		$matches = array();
459
-
460
-		// Check for suspicious interpolations.
461
-		$warning = 0 < preg_match_all( '/\w<[a-z]+ id="urn:enhancement-[^"]+" class="[^"]+" itemid="[^"]+">/', $content, $matches )
462
-		           || 0 < preg_match_all( '/<[a-z]+ id="urn:enhancement-[^"]+" class="[^"]+" itemid="[^"]+">\s/', $content, $matches );
463
-
464
-		// Set the warning flag accordingly.
465
-		$this->set_warning( $post_id, $warning );
466
-
467
-		return $content;
468
-	}
469
-
470
-	/**
471
-	 * Clear the warning flag for the specified {@link WP_Post}s.
472
-	 *
473
-	 * @since 3.14.2
474
-	 *
475
-	 * @param int|array $post_ids A single {@link WP_Post}'s id or an array of
476
-	 *                            {@link WP_Post}s' ids.
477
-	 */
478
-	public function clear_warning( $post_ids ) {
479
-
480
-		foreach ( (array) $post_ids as $post_id ) {
481
-			delete_post_meta( $post_id, self::WARNING_META_KEY );
482
-		}
483
-
484
-	}
485
-
486
-	/**
487
-	 * Set the warning flag for the specified {@link WP_Post}.
488
-	 *
489
-	 * @since 3.14.2
490
-	 *
491
-	 * @param int  $post_id The {@link WP_Post}'s id.
492
-	 * @param bool $value   The flag's value.
493
-	 *
494
-	 * @return int|bool Meta ID if the key didn't exist, true on successful update,
495
-	 *                  false on failure.
496
-	 */
497
-	private function set_warning( $post_id, $value ) {
498
-
499
-		return update_post_meta( $post_id, self::WARNING_META_KEY, ( true === $value ? 'yes' : 'no' ) );
500
-	}
501
-
502
-	/**
503
-	 * Get the post/page batch analysis state.
504
-	 *
505
-	 * @since 3.14.2
506
-	 *
507
-	 * @param int $post_id The {@link WP_Post}'s id.
508
-	 *
509
-	 * @return int|string The post state or an empty string if not set.
510
-	 */
511
-	public function get_state( $post_id ) {
512
-
513
-		return get_post_meta( $post_id, self::STATE_META_KEY, true );
514
-	}
515
-
516
-	/**
517
-	 * Set the post/page batch analysis state.
518
-	 *
519
-	 * @since 3.14.2
520
-	 *
521
-	 * @param int $post_id The {@link WP_Post}'s id.
522
-	 * @param int $value   The new state.
523
-	 *
524
-	 * @return int|bool Meta ID if the key didn't exist, true on successful update,
525
-	 *                  false on failure.
526
-	 */
527
-	public function set_state( $post_id, $value ) {
528
-
529
-		// Update the state.
530
-		$result = update_post_meta( $post_id, self::STATE_META_KEY, $value );
531
-
532
-		// Update timestamps as required.
533
-		switch ( $value ) {
534
-
535
-			//### REQUEST state.
536
-			case self::STATE_REQUEST:
537
-				add_post_meta( $post_id, self::REQUEST_TIMESTAMP_META_KEY, current_time( 'mysql', true ) );
538
-				break;
539
-
540
-			//### SUCCESS/ERROR state.
541
-			case self::STATE_SUCCESS:
542
-			case self::STATE_ERROR:
543
-				add_post_meta( $post_id, self::COMPLETE_TIMESTAMP_META_KEY, current_time( 'mysql', true ) );
544
-				break;
545
-		}
546
-
547
-		// Finally return the result.
548
-		return $result;
549
-	}
550
-
551
-	/**
552
-	 * Get the link setting for a {@link WP_Post}.
553
-	 *
554
-	 * If there are multiple link settings, only the last one is returned.
555
-	 *
556
-	 * @since 3.14.2
557
-	 *
558
-	 * @param int $post_id The {@link WP_Post}'s id.
559
-	 *
560
-	 * @return string The link setting or `default` if not set.
561
-	 */
562
-	public function get_link( $post_id ) {
563
-
564
-		$values = get_post_meta( $post_id, self::LINK_META_KEY );
565
-
566
-		return end( $values ) ?: 'default';
567
-	}
568
-
569
-	/**
570
-	 * Get the array of post IDS waiting in the queue to start processing.
571
-	 *
572
-	 * @since 3.14.0
573
-	 *
574
-	 * @return array The waiting to be processed post ids queue.
575
-	 */
576
-	public function waiting_for_analysis() {
577
-
578
-		return get_posts( array(
579
-			'posts_per_page' => - 1,
580
-			'fields'         => 'ids',
581
-			'post_status'    => 'any',
582
-			'meta_key'       => self::STATE_META_KEY,
583
-			'meta_value'     => self::STATE_SUBMIT,
584
-			'orderby'        => 'ID',
585
-		) );
586
-	}
587
-
588
-	/**
589
-	 * Get the array of post IDS waiting for response.
590
-	 *
591
-	 * @deprecated
592
-	 * @since 3.14.0
593
-	 *
594
-	 * @return array The waiting for response post ids queue.
595
-	 */
596
-	public function waiting_for_response() {
597
-
598
-		return get_posts( array(
599
-			'posts_per_page' => - 1,
600
-			'fields'         => 'ids',
601
-			'post_status'    => 'any',
602
-			'meta_key'       => self::STATE_META_KEY,
603
-			'meta_value'     => self::STATE_REQUEST,
604
-			'orderby'        => 'ID',
605
-		) );
606
-	}
607
-
608
-	/**
609
-	 * Request the analysis for the specified {@link WP_Post}.
610
-	 *
611
-	 * @since 3.14.2
612
-	 *
613
-	 * @param int $post_id The {@link WP_Post}'s id.
614
-	 *
615
-	 * @return WP_Error|array The response or WP_Error on failure.
616
-	 */
617
-	private function do_request( $post_id ) {
618
-
619
-		// Get the post.
620
-		$post = get_post( $post_id );
621
-
622
-		// Bail out if the post isn't found.
623
-		if ( null === $post ) {
624
-			$this->log->warn( "Post $post_id not found." );
625
-
626
-			return new WP_Error( 0, "Cannot find post $post_id." );
627
-		}
628
-
629
-		// Get the link setting.
630
-		$link = $this->get_link( $post_id );
631
-
632
-		$this->log->debug( "Sending analysis request for post $post_id [ link :: $link ]..." );
633
-
634
-		// Get the batch analysis URL.
635
-		$url = $this->configuration_service->get_batch_analysis_url();
636
-
637
-		// Prepare the POST parameters.
638
-		$param = array(
639
-			'id'              => $post->ID,
640
-			'key'             => $this->configuration_service->get_key(),
641
-			'content'         => $post->post_content,
642
-			'contentLanguage' => $this->configuration_service->get_language_code(),
643
-			'version'         => $this->plugin->get_version(),
644
-			'links'           => $link,
645
-			'scope'           => 'local',
646
-		);
647
-
648
-		// Get the HTTP options.
649
-		$args = array_merge_recursive( unserialize( WL_REDLINK_API_HTTP_OPTIONS ), array(
650
-			'method'      => 'POST',
651
-			'headers'     => array(
652
-				'Accept'       => 'application/json',
653
-				'Content-type' => 'application/json; charset=UTF-8',
654
-			),
655
-			// we need to downgrade the HTTP version in this case since chunked encoding is dumping numbers in the response.
656
-			'httpversion' => '1.0',
657
-			'body'        => wp_json_encode( $param ),
658
-		) );
659
-
660
-		$this->log->debug( "Posting analysis request for post $post_id to $url..." );
661
-
662
-		// Post the parameter.
663
-		return wp_remote_post( $url, $args );
664
-	}
665
-
666
-	/**
667
-	 * Get the Batch Analysis results for the specified {@link WP_Post}.
668
-	 *
669
-	 * @since 3.14.2
670
-	 *
671
-	 * @param int $post_id The {@link WP_Post}'s id.
672
-	 *
673
-	 * @return WP_Error|array The response or WP_Error on failure.
674
-	 */
675
-	private function do_complete( $post_id ) {
676
-
677
-		$post = get_post( $post_id );
678
-
679
-		if ( null === $post ) {
680
-			// Post was possibly deleted, just bailout.
681
-			return new WP_Error( 0, "Post $post_id not found." );
682
-		}
683
-
684
-		$url = $this->configuration_service->get_batch_analysis_url();
685
-		$key = $this->configuration_service->get_key();
686
-		$url = $url . '/' . $post->ID . '?key=' . $key;
687
-
688
-		return wp_remote_get( $url, unserialize( WL_REDLINK_API_HTTP_OPTIONS ) );
689
-	}
690
-
691
-	/**
692
-	 * Get the {@link WP_Post}s' ids flagged with warnings.
693
-	 *
694
-	 * @since 3.14.2
695
-	 *
696
-	 * @return array An array of {@link WP_Post}s' ids.
697
-	 */
698
-	public function get_warnings() {
699
-
700
-		return get_posts( array(
701
-			'fields'      => 'ids',
702
-			'numberposts' => - 1,
703
-			'post_status' => 'any',
704
-			'meta_key'    => self::WARNING_META_KEY,
705
-			'meta_value'  => 'yes',
706
-		) );
707
-	}
417
+                $this->set_warning_based_on_content( $id, $json->content );
418
+
419
+                $content = wp_slash( $json->content );
420
+
421
+                wp_update_post( array(
422
+                    'ID'           => $id,
423
+                    'post_content' => $content,
424
+                ) );
425
+
426
+                // Update the status.
427
+                $this->set_state( $id, self::STATE_SUCCESS );
428
+
429
+                $this->log->debug( "Post $id updated with batch analysis results." );
430
+
431
+                continue;
432
+            }
433
+
434
+            // @todo: implement a kind of timeout that sets an error if the
435
+            // results haven't been received after a long time.
436
+
437
+        }
438
+
439
+        // Call the `wl_batch_analysis_request` action again. This is going
440
+        // to be handled by the async task.
441
+        do_action( 'wl_batch_analysis_complete' );
442
+
443
+    }
444
+
445
+    /**
446
+     * Set a warning flag on the {@link WP_Post} if its content has suspicious
447
+     * interpolations.
448
+     *
449
+     * @since 3.14.2
450
+     *
451
+     * @param int    $post_id The {@link WP_Post}'s id.
452
+     * @param string $content The {@link WP_Post}'s content.
453
+     *
454
+     * @return string The content (for chaining operations).
455
+     */
456
+    private function set_warning_based_on_content( $post_id, $content ) {
457
+
458
+        $matches = array();
459
+
460
+        // Check for suspicious interpolations.
461
+        $warning = 0 < preg_match_all( '/\w<[a-z]+ id="urn:enhancement-[^"]+" class="[^"]+" itemid="[^"]+">/', $content, $matches )
462
+                   || 0 < preg_match_all( '/<[a-z]+ id="urn:enhancement-[^"]+" class="[^"]+" itemid="[^"]+">\s/', $content, $matches );
463
+
464
+        // Set the warning flag accordingly.
465
+        $this->set_warning( $post_id, $warning );
466
+
467
+        return $content;
468
+    }
469
+
470
+    /**
471
+     * Clear the warning flag for the specified {@link WP_Post}s.
472
+     *
473
+     * @since 3.14.2
474
+     *
475
+     * @param int|array $post_ids A single {@link WP_Post}'s id or an array of
476
+     *                            {@link WP_Post}s' ids.
477
+     */
478
+    public function clear_warning( $post_ids ) {
479
+
480
+        foreach ( (array) $post_ids as $post_id ) {
481
+            delete_post_meta( $post_id, self::WARNING_META_KEY );
482
+        }
483
+
484
+    }
485
+
486
+    /**
487
+     * Set the warning flag for the specified {@link WP_Post}.
488
+     *
489
+     * @since 3.14.2
490
+     *
491
+     * @param int  $post_id The {@link WP_Post}'s id.
492
+     * @param bool $value   The flag's value.
493
+     *
494
+     * @return int|bool Meta ID if the key didn't exist, true on successful update,
495
+     *                  false on failure.
496
+     */
497
+    private function set_warning( $post_id, $value ) {
498
+
499
+        return update_post_meta( $post_id, self::WARNING_META_KEY, ( true === $value ? 'yes' : 'no' ) );
500
+    }
501
+
502
+    /**
503
+     * Get the post/page batch analysis state.
504
+     *
505
+     * @since 3.14.2
506
+     *
507
+     * @param int $post_id The {@link WP_Post}'s id.
508
+     *
509
+     * @return int|string The post state or an empty string if not set.
510
+     */
511
+    public function get_state( $post_id ) {
512
+
513
+        return get_post_meta( $post_id, self::STATE_META_KEY, true );
514
+    }
515
+
516
+    /**
517
+     * Set the post/page batch analysis state.
518
+     *
519
+     * @since 3.14.2
520
+     *
521
+     * @param int $post_id The {@link WP_Post}'s id.
522
+     * @param int $value   The new state.
523
+     *
524
+     * @return int|bool Meta ID if the key didn't exist, true on successful update,
525
+     *                  false on failure.
526
+     */
527
+    public function set_state( $post_id, $value ) {
528
+
529
+        // Update the state.
530
+        $result = update_post_meta( $post_id, self::STATE_META_KEY, $value );
531
+
532
+        // Update timestamps as required.
533
+        switch ( $value ) {
534
+
535
+            //### REQUEST state.
536
+            case self::STATE_REQUEST:
537
+                add_post_meta( $post_id, self::REQUEST_TIMESTAMP_META_KEY, current_time( 'mysql', true ) );
538
+                break;
539
+
540
+            //### SUCCESS/ERROR state.
541
+            case self::STATE_SUCCESS:
542
+            case self::STATE_ERROR:
543
+                add_post_meta( $post_id, self::COMPLETE_TIMESTAMP_META_KEY, current_time( 'mysql', true ) );
544
+                break;
545
+        }
546
+
547
+        // Finally return the result.
548
+        return $result;
549
+    }
550
+
551
+    /**
552
+     * Get the link setting for a {@link WP_Post}.
553
+     *
554
+     * If there are multiple link settings, only the last one is returned.
555
+     *
556
+     * @since 3.14.2
557
+     *
558
+     * @param int $post_id The {@link WP_Post}'s id.
559
+     *
560
+     * @return string The link setting or `default` if not set.
561
+     */
562
+    public function get_link( $post_id ) {
563
+
564
+        $values = get_post_meta( $post_id, self::LINK_META_KEY );
565
+
566
+        return end( $values ) ?: 'default';
567
+    }
568
+
569
+    /**
570
+     * Get the array of post IDS waiting in the queue to start processing.
571
+     *
572
+     * @since 3.14.0
573
+     *
574
+     * @return array The waiting to be processed post ids queue.
575
+     */
576
+    public function waiting_for_analysis() {
577
+
578
+        return get_posts( array(
579
+            'posts_per_page' => - 1,
580
+            'fields'         => 'ids',
581
+            'post_status'    => 'any',
582
+            'meta_key'       => self::STATE_META_KEY,
583
+            'meta_value'     => self::STATE_SUBMIT,
584
+            'orderby'        => 'ID',
585
+        ) );
586
+    }
587
+
588
+    /**
589
+     * Get the array of post IDS waiting for response.
590
+     *
591
+     * @deprecated
592
+     * @since 3.14.0
593
+     *
594
+     * @return array The waiting for response post ids queue.
595
+     */
596
+    public function waiting_for_response() {
597
+
598
+        return get_posts( array(
599
+            'posts_per_page' => - 1,
600
+            'fields'         => 'ids',
601
+            'post_status'    => 'any',
602
+            'meta_key'       => self::STATE_META_KEY,
603
+            'meta_value'     => self::STATE_REQUEST,
604
+            'orderby'        => 'ID',
605
+        ) );
606
+    }
607
+
608
+    /**
609
+     * Request the analysis for the specified {@link WP_Post}.
610
+     *
611
+     * @since 3.14.2
612
+     *
613
+     * @param int $post_id The {@link WP_Post}'s id.
614
+     *
615
+     * @return WP_Error|array The response or WP_Error on failure.
616
+     */
617
+    private function do_request( $post_id ) {
618
+
619
+        // Get the post.
620
+        $post = get_post( $post_id );
621
+
622
+        // Bail out if the post isn't found.
623
+        if ( null === $post ) {
624
+            $this->log->warn( "Post $post_id not found." );
625
+
626
+            return new WP_Error( 0, "Cannot find post $post_id." );
627
+        }
628
+
629
+        // Get the link setting.
630
+        $link = $this->get_link( $post_id );
631
+
632
+        $this->log->debug( "Sending analysis request for post $post_id [ link :: $link ]..." );
633
+
634
+        // Get the batch analysis URL.
635
+        $url = $this->configuration_service->get_batch_analysis_url();
636
+
637
+        // Prepare the POST parameters.
638
+        $param = array(
639
+            'id'              => $post->ID,
640
+            'key'             => $this->configuration_service->get_key(),
641
+            'content'         => $post->post_content,
642
+            'contentLanguage' => $this->configuration_service->get_language_code(),
643
+            'version'         => $this->plugin->get_version(),
644
+            'links'           => $link,
645
+            'scope'           => 'local',
646
+        );
647
+
648
+        // Get the HTTP options.
649
+        $args = array_merge_recursive( unserialize( WL_REDLINK_API_HTTP_OPTIONS ), array(
650
+            'method'      => 'POST',
651
+            'headers'     => array(
652
+                'Accept'       => 'application/json',
653
+                'Content-type' => 'application/json; charset=UTF-8',
654
+            ),
655
+            // we need to downgrade the HTTP version in this case since chunked encoding is dumping numbers in the response.
656
+            'httpversion' => '1.0',
657
+            'body'        => wp_json_encode( $param ),
658
+        ) );
659
+
660
+        $this->log->debug( "Posting analysis request for post $post_id to $url..." );
661
+
662
+        // Post the parameter.
663
+        return wp_remote_post( $url, $args );
664
+    }
665
+
666
+    /**
667
+     * Get the Batch Analysis results for the specified {@link WP_Post}.
668
+     *
669
+     * @since 3.14.2
670
+     *
671
+     * @param int $post_id The {@link WP_Post}'s id.
672
+     *
673
+     * @return WP_Error|array The response or WP_Error on failure.
674
+     */
675
+    private function do_complete( $post_id ) {
676
+
677
+        $post = get_post( $post_id );
678
+
679
+        if ( null === $post ) {
680
+            // Post was possibly deleted, just bailout.
681
+            return new WP_Error( 0, "Post $post_id not found." );
682
+        }
683
+
684
+        $url = $this->configuration_service->get_batch_analysis_url();
685
+        $key = $this->configuration_service->get_key();
686
+        $url = $url . '/' . $post->ID . '?key=' . $key;
687
+
688
+        return wp_remote_get( $url, unserialize( WL_REDLINK_API_HTTP_OPTIONS ) );
689
+    }
690
+
691
+    /**
692
+     * Get the {@link WP_Post}s' ids flagged with warnings.
693
+     *
694
+     * @since 3.14.2
695
+     *
696
+     * @return array An array of {@link WP_Post}s' ids.
697
+     */
698
+    public function get_warnings() {
699
+
700
+        return get_posts( array(
701
+            'fields'      => 'ids',
702
+            'numberposts' => - 1,
703
+            'post_status' => 'any',
704
+            'meta_key'    => self::WARNING_META_KEY,
705
+            'meta_value'  => 'yes',
706
+        ) );
707
+    }
708 708
 
709 709
 }
Please login to merge, or discard this patch.
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -161,20 +161,20 @@  discard block
 block discarded – undo
161 161
 	 * @param \Wordlift                       $plugin                The {@link Wordlift} plugin instance.
162 162
 	 * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
163 163
 	 */
164
-	public function __construct( $plugin, $configuration_service ) {
164
+	public function __construct($plugin, $configuration_service) {
165 165
 
166 166
 		$this->plugin                = $plugin;
167 167
 		$this->configuration_service = $configuration_service;
168
-		$this->log                   = Wordlift_Log_Service::get_logger( 'Wordlift_Batch_Analysis_Service' );
168
+		$this->log                   = Wordlift_Log_Service::get_logger('Wordlift_Batch_Analysis_Service');
169 169
 
170
-		add_action( 'wp_async_wl_batch_analysis_request', array(
170
+		add_action('wp_async_wl_batch_analysis_request', array(
171 171
 			$this,
172 172
 			'request',
173
-		) );
174
-		add_action( 'wp_async_wl_batch_analysis_complete', array(
173
+		));
174
+		add_action('wp_async_wl_batch_analysis_complete', array(
175 175
 			$this,
176 176
 			'complete',
177
-		) );
177
+		));
178 178
 
179 179
 	}
180 180
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 *
190 190
 	 * @return string The base SQL.
191 191
 	 */
192
-	private function get_sql( $link ) {
192
+	private function get_sql($link) {
193 193
 		global $wpdb;
194 194
 
195 195
 		// Prepare the statement:
@@ -237,23 +237,23 @@  discard block
 block discarded – undo
237 237
 	 * @return false|int The number of submitted {@link WP_Post}s or false on
238 238
 	 *                   error.
239 239
 	 */
240
-	public function submit_auto_selected_posts( $link ) {
240
+	public function submit_auto_selected_posts($link) {
241 241
 		global $wpdb;
242 242
 
243 243
 		// Submit the posts/pages and return the number of affected results.
244 244
 		// We're using a SQL query here because we could have potentially
245 245
 		// thousands of rows.
246
-		$count = $wpdb->query( $wpdb->prepare(
247
-			$this->get_sql( $link ) .
246
+		$count = $wpdb->query($wpdb->prepare(
247
+			$this->get_sql($link).
248 248
 			"
249 249
 				AND batch_analysis_state.meta_value IS NULL
250 250
 				AND p.post_content NOT REGEXP %s;
251 251
 			",
252 252
 			'<[a-z]+ id="urn:[^"]+" class="[^"]+" itemid="[^"]+">'
253
-		) );
253
+		));
254 254
 
255 255
 		// Request Batch Analysis (the operation is handled asynchronously).
256
-		do_action( 'wl_batch_analysis_request' );
256
+		do_action('wl_batch_analysis_request');
257 257
 
258 258
 		// Divide the count by 3 to get the number of posts/pages queued.
259 259
 		return $count / 3;
@@ -270,19 +270,19 @@  discard block
 block discarded – undo
270 270
 	 *
271 271
 	 * @return int The number of submitted {@link WP_Post}s or false on error.
272 272
 	 */
273
-	public function submit( $post_ids, $link ) {
273
+	public function submit($post_ids, $link) {
274 274
 		global $wpdb;
275 275
 
276 276
 		// Submit the posts/pages and return the number of affected results.
277 277
 		// We're using a SQL query here because we could have potentially
278 278
 		// thousands of rows.
279 279
 		$count = $wpdb->query(
280
-			$this->get_sql( $link ) .
281
-			' AND p.ID IN ( ' . implode( ',', wp_parse_id_list( $post_ids ) ) . ' )'
280
+			$this->get_sql($link).
281
+			' AND p.ID IN ( '.implode(',', wp_parse_id_list($post_ids)).' )'
282 282
 		);
283 283
 
284 284
 		// Request Batch Analysis (the operation is handled asynchronously).
285
-		do_action( 'wl_batch_analysis_request' );
285
+		do_action('wl_batch_analysis_request');
286 286
 
287 287
 		// Divide the count by 3 to get the number of posts/pages queued.
288 288
 		return $count / 3;
@@ -299,19 +299,19 @@  discard block
 block discarded – undo
299 299
 	 * @return false|int The number of cancelled {@link WP_Post}s or false on
300 300
 	 *                   error.
301 301
 	 */
302
-	public function cancel( $post_ids ) {
302
+	public function cancel($post_ids) {
303 303
 		global $wpdb;
304 304
 
305
-		return $wpdb->query( $wpdb->prepare(
305
+		return $wpdb->query($wpdb->prepare(
306 306
 			"
307 307
 			DELETE FROM $wpdb->postmeta
308 308
 			WHERE meta_key = %s
309 309
 				AND meta_value = %s
310
-				AND post_id IN ( " . implode( ',', wp_parse_id_list( $post_ids ) ) . " )
310
+				AND post_id IN ( ".implode(',', wp_parse_id_list($post_ids))." )
311 311
 			",
312 312
 			self::STATE_META_KEY,
313 313
 			self::STATE_REQUEST
314
-		) );
314
+		));
315 315
 
316 316
 	}
317 317
 
@@ -322,49 +322,49 @@  discard block
 block discarded – undo
322 322
 	 */
323 323
 	public function request() {
324 324
 
325
-		$this->log->debug( "Requesting analysis..." );
325
+		$this->log->debug("Requesting analysis...");
326 326
 
327 327
 		// By default 5 posts of any post type are returned.
328
-		$posts = get_posts( array(
328
+		$posts = get_posts(array(
329 329
 			'fields'     => 'ids',
330 330
 			'meta_key'   => self::STATE_META_KEY,
331 331
 			'meta_value' => self::STATE_SUBMIT,
332 332
 			'orderby'    => 'ID',
333
-		) );
333
+		));
334 334
 
335 335
 		// Bail out if there are no submitted posts.
336
-		if ( empty( $posts ) ) {
337
-			$this->log->debug( 'No posts to submit found, checking for completed requests...' );
336
+		if (empty($posts)) {
337
+			$this->log->debug('No posts to submit found, checking for completed requests...');
338 338
 
339
-			do_action( 'wl_batch_analysis_complete' );
339
+			do_action('wl_batch_analysis_complete');
340 340
 
341 341
 			return;
342 342
 		}
343 343
 
344 344
 		// Send a request for each post.
345
-		foreach ( $posts as $id ) {
346
-			$this->log->debug( "Requesting analysis for post $id..." );
345
+		foreach ($posts as $id) {
346
+			$this->log->debug("Requesting analysis for post $id...");
347 347
 
348 348
 			// Change the state to `REQUEST`.
349
-			$this->set_state( $id, self::STATE_REQUEST );
349
+			$this->set_state($id, self::STATE_REQUEST);
350 350
 
351 351
 			// Send the actual request to the remote service.
352
-			$result = $this->do_request( $id );
352
+			$result = $this->do_request($id);
353 353
 
354
-			$this->log->debug( "Analysis requested for post $id." );
354
+			$this->log->debug("Analysis requested for post $id.");
355 355
 
356 356
 			// Set an error if we received an error.
357
-			if ( is_wp_error( $result ) ) {
358
-				$this->log->error( "Analysis request for post $id returned {$result->get_error_message()}." );
357
+			if (is_wp_error($result)) {
358
+				$this->log->error("Analysis request for post $id returned {$result->get_error_message()}.");
359 359
 
360
-				$this->set_state( $id, self::STATE_ERROR );
360
+				$this->set_state($id, self::STATE_ERROR);
361 361
 			}
362 362
 
363 363
 		}
364 364
 
365 365
 		// Call the `wl_batch_analysis_request` action again. This is going
366 366
 		// to be handled by the async task.
367
-		do_action( 'wl_batch_analysis_request' );
367
+		do_action('wl_batch_analysis_request');
368 368
 
369 369
 	}
370 370
 
@@ -375,58 +375,58 @@  discard block
 block discarded – undo
375 375
 	 */
376 376
 	public function complete() {
377 377
 
378
-		$this->log->debug( "Requesting results..." );
378
+		$this->log->debug("Requesting results...");
379 379
 
380 380
 		// By default 5 posts of any post type are returned.
381
-		$posts = get_posts( array(
381
+		$posts = get_posts(array(
382 382
 			'fields'     => 'ids',
383 383
 			'meta_key'   => self::STATE_META_KEY,
384 384
 			'meta_value' => self::STATE_REQUEST,
385 385
 			'orderby'    => 'ID',
386
-		) );
386
+		));
387 387
 
388 388
 		// Bail out if there are no submitted posts.
389
-		if ( empty( $posts ) ) {
390
-			$this->log->debug( 'No posts in request state found.' );
389
+		if (empty($posts)) {
390
+			$this->log->debug('No posts in request state found.');
391 391
 
392 392
 			return;
393 393
 		}
394 394
 
395 395
 		// Send a request for each post.
396
-		foreach ( $posts as $id ) {
397
-			$this->log->debug( "Requesting results for post $id..." );
396
+		foreach ($posts as $id) {
397
+			$this->log->debug("Requesting results for post $id...");
398 398
 
399 399
 			// Send the actual request to the remote service.
400
-			$response = $this->do_complete( $id );
400
+			$response = $this->do_complete($id);
401 401
 
402
-			$this->log->debug( "Results requested for post $id." );
402
+			$this->log->debug("Results requested for post $id.");
403 403
 
404 404
 			// Set an error if we received an error.
405
-			if ( ! is_wp_error( $response ) && isset( $response['body'] ) ) {
405
+			if ( ! is_wp_error($response) && isset($response['body'])) {
406 406
 
407
-				$this->log->debug( "Results received for post $id." );
407
+				$this->log->debug("Results received for post $id.");
408 408
 
409 409
 				// Save the returned content as new revision.
410
-				$json = json_decode( $response['body'] );
410
+				$json = json_decode($response['body']);
411 411
 
412 412
 				// Continue if the content isn't set.
413
-				if ( ! isset( $json->content ) || empty( $json->content ) ) {
413
+				if ( ! isset($json->content) || empty($json->content)) {
414 414
 					continue;
415 415
 				}
416 416
 
417
-				$this->set_warning_based_on_content( $id, $json->content );
417
+				$this->set_warning_based_on_content($id, $json->content);
418 418
 
419
-				$content = wp_slash( $json->content );
419
+				$content = wp_slash($json->content);
420 420
 
421
-				wp_update_post( array(
421
+				wp_update_post(array(
422 422
 					'ID'           => $id,
423 423
 					'post_content' => $content,
424
-				) );
424
+				));
425 425
 
426 426
 				// Update the status.
427
-				$this->set_state( $id, self::STATE_SUCCESS );
427
+				$this->set_state($id, self::STATE_SUCCESS);
428 428
 
429
-				$this->log->debug( "Post $id updated with batch analysis results." );
429
+				$this->log->debug("Post $id updated with batch analysis results.");
430 430
 
431 431
 				continue;
432 432
 			}
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 
439 439
 		// Call the `wl_batch_analysis_request` action again. This is going
440 440
 		// to be handled by the async task.
441
-		do_action( 'wl_batch_analysis_complete' );
441
+		do_action('wl_batch_analysis_complete');
442 442
 
443 443
 	}
444 444
 
@@ -453,16 +453,16 @@  discard block
 block discarded – undo
453 453
 	 *
454 454
 	 * @return string The content (for chaining operations).
455 455
 	 */
456
-	private function set_warning_based_on_content( $post_id, $content ) {
456
+	private function set_warning_based_on_content($post_id, $content) {
457 457
 
458 458
 		$matches = array();
459 459
 
460 460
 		// Check for suspicious interpolations.
461
-		$warning = 0 < preg_match_all( '/\w<[a-z]+ id="urn:enhancement-[^"]+" class="[^"]+" itemid="[^"]+">/', $content, $matches )
462
-		           || 0 < preg_match_all( '/<[a-z]+ id="urn:enhancement-[^"]+" class="[^"]+" itemid="[^"]+">\s/', $content, $matches );
461
+		$warning = 0 < preg_match_all('/\w<[a-z]+ id="urn:enhancement-[^"]+" class="[^"]+" itemid="[^"]+">/', $content, $matches)
462
+		           || 0 < preg_match_all('/<[a-z]+ id="urn:enhancement-[^"]+" class="[^"]+" itemid="[^"]+">\s/', $content, $matches);
463 463
 
464 464
 		// Set the warning flag accordingly.
465
-		$this->set_warning( $post_id, $warning );
465
+		$this->set_warning($post_id, $warning);
466 466
 
467 467
 		return $content;
468 468
 	}
@@ -475,10 +475,10 @@  discard block
 block discarded – undo
475 475
 	 * @param int|array $post_ids A single {@link WP_Post}'s id or an array of
476 476
 	 *                            {@link WP_Post}s' ids.
477 477
 	 */
478
-	public function clear_warning( $post_ids ) {
478
+	public function clear_warning($post_ids) {
479 479
 
480
-		foreach ( (array) $post_ids as $post_id ) {
481
-			delete_post_meta( $post_id, self::WARNING_META_KEY );
480
+		foreach ((array) $post_ids as $post_id) {
481
+			delete_post_meta($post_id, self::WARNING_META_KEY);
482 482
 		}
483 483
 
484 484
 	}
@@ -494,9 +494,9 @@  discard block
 block discarded – undo
494 494
 	 * @return int|bool Meta ID if the key didn't exist, true on successful update,
495 495
 	 *                  false on failure.
496 496
 	 */
497
-	private function set_warning( $post_id, $value ) {
497
+	private function set_warning($post_id, $value) {
498 498
 
499
-		return update_post_meta( $post_id, self::WARNING_META_KEY, ( true === $value ? 'yes' : 'no' ) );
499
+		return update_post_meta($post_id, self::WARNING_META_KEY, (true === $value ? 'yes' : 'no'));
500 500
 	}
501 501
 
502 502
 	/**
@@ -508,9 +508,9 @@  discard block
 block discarded – undo
508 508
 	 *
509 509
 	 * @return int|string The post state or an empty string if not set.
510 510
 	 */
511
-	public function get_state( $post_id ) {
511
+	public function get_state($post_id) {
512 512
 
513
-		return get_post_meta( $post_id, self::STATE_META_KEY, true );
513
+		return get_post_meta($post_id, self::STATE_META_KEY, true);
514 514
 	}
515 515
 
516 516
 	/**
@@ -524,23 +524,23 @@  discard block
 block discarded – undo
524 524
 	 * @return int|bool Meta ID if the key didn't exist, true on successful update,
525 525
 	 *                  false on failure.
526 526
 	 */
527
-	public function set_state( $post_id, $value ) {
527
+	public function set_state($post_id, $value) {
528 528
 
529 529
 		// Update the state.
530
-		$result = update_post_meta( $post_id, self::STATE_META_KEY, $value );
530
+		$result = update_post_meta($post_id, self::STATE_META_KEY, $value);
531 531
 
532 532
 		// Update timestamps as required.
533
-		switch ( $value ) {
533
+		switch ($value) {
534 534
 
535 535
 			//### REQUEST state.
536 536
 			case self::STATE_REQUEST:
537
-				add_post_meta( $post_id, self::REQUEST_TIMESTAMP_META_KEY, current_time( 'mysql', true ) );
537
+				add_post_meta($post_id, self::REQUEST_TIMESTAMP_META_KEY, current_time('mysql', true));
538 538
 				break;
539 539
 
540 540
 			//### SUCCESS/ERROR state.
541 541
 			case self::STATE_SUCCESS:
542 542
 			case self::STATE_ERROR:
543
-				add_post_meta( $post_id, self::COMPLETE_TIMESTAMP_META_KEY, current_time( 'mysql', true ) );
543
+				add_post_meta($post_id, self::COMPLETE_TIMESTAMP_META_KEY, current_time('mysql', true));
544 544
 				break;
545 545
 		}
546 546
 
@@ -559,11 +559,11 @@  discard block
 block discarded – undo
559 559
 	 *
560 560
 	 * @return string The link setting or `default` if not set.
561 561
 	 */
562
-	public function get_link( $post_id ) {
562
+	public function get_link($post_id) {
563 563
 
564
-		$values = get_post_meta( $post_id, self::LINK_META_KEY );
564
+		$values = get_post_meta($post_id, self::LINK_META_KEY);
565 565
 
566
-		return end( $values ) ?: 'default';
566
+		return end($values) ?: 'default';
567 567
 	}
568 568
 
569 569
 	/**
@@ -575,14 +575,14 @@  discard block
 block discarded – undo
575 575
 	 */
576 576
 	public function waiting_for_analysis() {
577 577
 
578
-		return get_posts( array(
579
-			'posts_per_page' => - 1,
578
+		return get_posts(array(
579
+			'posts_per_page' => -1,
580 580
 			'fields'         => 'ids',
581 581
 			'post_status'    => 'any',
582 582
 			'meta_key'       => self::STATE_META_KEY,
583 583
 			'meta_value'     => self::STATE_SUBMIT,
584 584
 			'orderby'        => 'ID',
585
-		) );
585
+		));
586 586
 	}
587 587
 
588 588
 	/**
@@ -595,14 +595,14 @@  discard block
 block discarded – undo
595 595
 	 */
596 596
 	public function waiting_for_response() {
597 597
 
598
-		return get_posts( array(
599
-			'posts_per_page' => - 1,
598
+		return get_posts(array(
599
+			'posts_per_page' => -1,
600 600
 			'fields'         => 'ids',
601 601
 			'post_status'    => 'any',
602 602
 			'meta_key'       => self::STATE_META_KEY,
603 603
 			'meta_value'     => self::STATE_REQUEST,
604 604
 			'orderby'        => 'ID',
605
-		) );
605
+		));
606 606
 	}
607 607
 
608 608
 	/**
@@ -614,22 +614,22 @@  discard block
 block discarded – undo
614 614
 	 *
615 615
 	 * @return WP_Error|array The response or WP_Error on failure.
616 616
 	 */
617
-	private function do_request( $post_id ) {
617
+	private function do_request($post_id) {
618 618
 
619 619
 		// Get the post.
620
-		$post = get_post( $post_id );
620
+		$post = get_post($post_id);
621 621
 
622 622
 		// Bail out if the post isn't found.
623
-		if ( null === $post ) {
624
-			$this->log->warn( "Post $post_id not found." );
623
+		if (null === $post) {
624
+			$this->log->warn("Post $post_id not found.");
625 625
 
626
-			return new WP_Error( 0, "Cannot find post $post_id." );
626
+			return new WP_Error(0, "Cannot find post $post_id.");
627 627
 		}
628 628
 
629 629
 		// Get the link setting.
630
-		$link = $this->get_link( $post_id );
630
+		$link = $this->get_link($post_id);
631 631
 
632
-		$this->log->debug( "Sending analysis request for post $post_id [ link :: $link ]..." );
632
+		$this->log->debug("Sending analysis request for post $post_id [ link :: $link ]...");
633 633
 
634 634
 		// Get the batch analysis URL.
635 635
 		$url = $this->configuration_service->get_batch_analysis_url();
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 		);
647 647
 
648 648
 		// Get the HTTP options.
649
-		$args = array_merge_recursive( unserialize( WL_REDLINK_API_HTTP_OPTIONS ), array(
649
+		$args = array_merge_recursive(unserialize(WL_REDLINK_API_HTTP_OPTIONS), array(
650 650
 			'method'      => 'POST',
651 651
 			'headers'     => array(
652 652
 				'Accept'       => 'application/json',
@@ -654,13 +654,13 @@  discard block
 block discarded – undo
654 654
 			),
655 655
 			// we need to downgrade the HTTP version in this case since chunked encoding is dumping numbers in the response.
656 656
 			'httpversion' => '1.0',
657
-			'body'        => wp_json_encode( $param ),
658
-		) );
657
+			'body'        => wp_json_encode($param),
658
+		));
659 659
 
660
-		$this->log->debug( "Posting analysis request for post $post_id to $url..." );
660
+		$this->log->debug("Posting analysis request for post $post_id to $url...");
661 661
 
662 662
 		// Post the parameter.
663
-		return wp_remote_post( $url, $args );
663
+		return wp_remote_post($url, $args);
664 664
 	}
665 665
 
666 666
 	/**
@@ -672,20 +672,20 @@  discard block
 block discarded – undo
672 672
 	 *
673 673
 	 * @return WP_Error|array The response or WP_Error on failure.
674 674
 	 */
675
-	private function do_complete( $post_id ) {
675
+	private function do_complete($post_id) {
676 676
 
677
-		$post = get_post( $post_id );
677
+		$post = get_post($post_id);
678 678
 
679
-		if ( null === $post ) {
679
+		if (null === $post) {
680 680
 			// Post was possibly deleted, just bailout.
681
-			return new WP_Error( 0, "Post $post_id not found." );
681
+			return new WP_Error(0, "Post $post_id not found.");
682 682
 		}
683 683
 
684 684
 		$url = $this->configuration_service->get_batch_analysis_url();
685 685
 		$key = $this->configuration_service->get_key();
686
-		$url = $url . '/' . $post->ID . '?key=' . $key;
686
+		$url = $url.'/'.$post->ID.'?key='.$key;
687 687
 
688
-		return wp_remote_get( $url, unserialize( WL_REDLINK_API_HTTP_OPTIONS ) );
688
+		return wp_remote_get($url, unserialize(WL_REDLINK_API_HTTP_OPTIONS));
689 689
 	}
690 690
 
691 691
 	/**
@@ -697,13 +697,13 @@  discard block
 block discarded – undo
697 697
 	 */
698 698
 	public function get_warnings() {
699 699
 
700
-		return get_posts( array(
700
+		return get_posts(array(
701 701
 			'fields'      => 'ids',
702
-			'numberposts' => - 1,
702
+			'numberposts' => -1,
703 703
 			'post_status' => 'any',
704 704
 			'meta_key'    => self::WARNING_META_KEY,
705 705
 			'meta_value'  => 'yes',
706
-		) );
706
+		));
707 707
 	}
708 708
 
709 709
 }
Please login to merge, or discard this patch.
src/includes/class-wordlift-relation-rebuild-adapter.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,31 +1,31 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class Wordlift_Relation_Rebuild_Adapter {
4
-	/**
5
-	 * @var Wordlift_Relation_Rebuild_Service
6
-	 */
7
-	private $relation_rebuild_service;
4
+    /**
5
+     * @var Wordlift_Relation_Rebuild_Service
6
+     */
7
+    private $relation_rebuild_service;
8 8
 
9 9
 
10
-	/**
11
-	 * Wordlift_Relation_Rebuild_Adapter constructor.
12
-	 *
13
-	 * @param \Wordlift_Relation_Rebuild_Service $relation_rebuild_service
14
-	 */
15
-	public function __construct( $relation_rebuild_service ) {
16
-		$this->relation_rebuild_service = $relation_rebuild_service;
17
-	}
10
+    /**
11
+     * Wordlift_Relation_Rebuild_Adapter constructor.
12
+     *
13
+     * @param \Wordlift_Relation_Rebuild_Service $relation_rebuild_service
14
+     */
15
+    public function __construct( $relation_rebuild_service ) {
16
+        $this->relation_rebuild_service = $relation_rebuild_service;
17
+    }
18 18
 
19
-	public function process_all() {
19
+    public function process_all() {
20 20
 
21
-		$this->relation_rebuild_service->process_all();
21
+        $this->relation_rebuild_service->process_all();
22 22
 
23
-		ob_clean();
23
+        ob_clean();
24 24
 
25
-		wp_send_json_success( array(
26
-			'count' => $this->relation_rebuild_service->get_count(),
27
-		) );
25
+        wp_send_json_success( array(
26
+            'count' => $this->relation_rebuild_service->get_count(),
27
+        ) );
28 28
 
29
-	}
29
+    }
30 30
 
31 31
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 	 *
13 13
 	 * @param \Wordlift_Relation_Rebuild_Service $relation_rebuild_service
14 14
 	 */
15
-	public function __construct( $relation_rebuild_service ) {
15
+	public function __construct($relation_rebuild_service) {
16 16
 		$this->relation_rebuild_service = $relation_rebuild_service;
17 17
 	}
18 18
 
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 
23 23
 		ob_clean();
24 24
 
25
-		wp_send_json_success( array(
25
+		wp_send_json_success(array(
26 26
 			'count' => $this->relation_rebuild_service->get_count(),
27
-		) );
27
+		));
28 28
 
29 29
 	}
30 30
 
Please login to merge, or discard this patch.
src/includes/class-wordlift-listable.php 2 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -4,51 +4,51 @@
 block discarded – undo
4 4
  */
5 5
 abstract class Wordlift_Listable {
6 6
 
7
-	private $count = 0;
7
+    private $count = 0;
8 8
 
9
-	/**
10
-	 * List the items starting at the specified offset and up to the specified limit.
11
-	 *
12
-	 * @param int   $offset The start offset.
13
-	 * @param int   $limit  The maximum number of items to return.
14
-	 * @param array $args   Additional arguments.
15
-	 *
16
-	 * @return array A array of items (or an empty array if no items are found).
17
-	 */
18
-	abstract function find( $offset = 0, $limit = 10, $args = array() );
9
+    /**
10
+     * List the items starting at the specified offset and up to the specified limit.
11
+     *
12
+     * @param int   $offset The start offset.
13
+     * @param int   $limit  The maximum number of items to return.
14
+     * @param array $args   Additional arguments.
15
+     *
16
+     * @return array A array of items (or an empty array if no items are found).
17
+     */
18
+    abstract function find( $offset = 0, $limit = 10, $args = array() );
19 19
 
20
-	/**
21
-	 * @param callable $callback
22
-	 * @param array    $args
23
-	 * @param int      $offset
24
-	 * @param int      $max
25
-	 */
26
-	public function process( $callback, $args = array(), $offset = 0, $max = PHP_INT_MAX ) {
20
+    /**
21
+     * @param callable $callback
22
+     * @param array    $args
23
+     * @param int      $offset
24
+     * @param int      $max
25
+     */
26
+    public function process( $callback, $args = array(), $offset = 0, $max = PHP_INT_MAX ) {
27 27
 
28
-		// We process chunks in order to avoid using too much memory,
29
-		// starting at offset 0.
30
-		while ( 0 < sizeof( $items = $this->find( $offset, 1, $args ) ) && $offset < $max ) {
28
+        // We process chunks in order to avoid using too much memory,
29
+        // starting at offset 0.
30
+        while ( 0 < sizeof( $items = $this->find( $offset, 1, $args ) ) && $offset < $max ) {
31 31
 
32
-			// Cycle through items and call the callback function.
33
-			foreach ( $items as $item ) {
34
-				call_user_func_array( $callback, array( $item ) );
35
-			}
32
+            // Cycle through items and call the callback function.
33
+            foreach ( $items as $item ) {
34
+                call_user_func_array( $callback, array( $item ) );
35
+            }
36 36
 
37
-			// Clean the cache to avoid memory errors.
38
-			wp_cache_flush();
37
+            // Clean the cache to avoid memory errors.
38
+            wp_cache_flush();
39 39
 
40
-			// Move to the next offset.
41
-			$offset += 1;
40
+            // Move to the next offset.
41
+            $offset += 1;
42 42
 
43
-			$this->count ++;
43
+            $this->count ++;
44 44
 
45
-		}
45
+        }
46 46
 
47
-	}
47
+    }
48 48
 
49
-	public function get_count() {
49
+    public function get_count() {
50 50
 
51
-		return $this->count;
52
-	}
51
+        return $this->count;
52
+    }
53 53
 
54 54
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	 *
16 16
 	 * @return array A array of items (or an empty array if no items are found).
17 17
 	 */
18
-	abstract function find( $offset = 0, $limit = 10, $args = array() );
18
+	abstract function find($offset = 0, $limit = 10, $args = array());
19 19
 
20 20
 	/**
21 21
 	 * @param callable $callback
@@ -23,15 +23,15 @@  discard block
 block discarded – undo
23 23
 	 * @param int      $offset
24 24
 	 * @param int      $max
25 25
 	 */
26
-	public function process( $callback, $args = array(), $offset = 0, $max = PHP_INT_MAX ) {
26
+	public function process($callback, $args = array(), $offset = 0, $max = PHP_INT_MAX) {
27 27
 
28 28
 		// We process chunks in order to avoid using too much memory,
29 29
 		// starting at offset 0.
30
-		while ( 0 < sizeof( $items = $this->find( $offset, 1, $args ) ) && $offset < $max ) {
30
+		while (0 < sizeof($items = $this->find($offset, 1, $args)) && $offset < $max) {
31 31
 
32 32
 			// Cycle through items and call the callback function.
33
-			foreach ( $items as $item ) {
34
-				call_user_func_array( $callback, array( $item ) );
33
+			foreach ($items as $item) {
34
+				call_user_func_array($callback, array($item));
35 35
 			}
36 36
 
37 37
 			// Clean the cache to avoid memory errors.
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 			// Move to the next offset.
41 41
 			$offset += 1;
42 42
 
43
-			$this->count ++;
43
+			$this->count++;
44 44
 
45 45
 		}
46 46
 
Please login to merge, or discard this patch.
src/includes/class-wordlift-relation-rebuild-service.php 2 patches
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -1,133 +1,133 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 class Wordlift_Relation_Rebuild_Service extends Wordlift_Listable {
4
-	/**
5
-	 * @var Wordlift_Content_Filter_Service
6
-	 */
7
-	private $content_filter_service;
4
+    /**
5
+     * @var Wordlift_Content_Filter_Service
6
+     */
7
+    private $content_filter_service;
8 8
 
9
-	/**
10
-	 * @var Wordlift_Entity_Service
11
-	 */
12
-	private $entity_service;
9
+    /**
10
+     * @var Wordlift_Entity_Service
11
+     */
12
+    private $entity_service;
13 13
 
14
-	/**
15
-	 * A {@link Wordlift_Log_Service} instance.
16
-	 *
17
-	 * @since  3.14.3
18
-	 * @access private
19
-	 * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
20
-	 */
21
-	private $log;
14
+    /**
15
+     * A {@link Wordlift_Log_Service} instance.
16
+     *
17
+     * @since  3.14.3
18
+     * @access private
19
+     * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
20
+     */
21
+    private $log;
22 22
 
23 23
 
24
-	/**
25
-	 * Wordlift_Relation_Rebuild_Service constructor.
26
-	 *
27
-	 * @param \Wordlift_Content_Filter_Service $content_filter_service
28
-	 * @param \Wordlift_Entity_Service         $entity_service
29
-	 */
30
-	public function __construct( $content_filter_service, $entity_service ) {
24
+    /**
25
+     * Wordlift_Relation_Rebuild_Service constructor.
26
+     *
27
+     * @param \Wordlift_Content_Filter_Service $content_filter_service
28
+     * @param \Wordlift_Entity_Service         $entity_service
29
+     */
30
+    public function __construct( $content_filter_service, $entity_service ) {
31 31
 
32
-		$this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Relation_Rebuild_Service' );
32
+        $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Relation_Rebuild_Service' );
33 33
 
34
-		$this->content_filter_service = $content_filter_service;
35
-		$this->entity_service         = $entity_service;
34
+        $this->content_filter_service = $content_filter_service;
35
+        $this->entity_service         = $entity_service;
36 36
 
37
-	}
37
+    }
38 38
 
39
-	public function process_all() {
40
-		global $wpdb;
39
+    public function process_all() {
40
+        global $wpdb;
41 41
 
42
-		set_time_limit( 21600 ); // 6 hours
42
+        set_time_limit( 21600 ); // 6 hours
43 43
 
44
-		$this->log->debug( 'Deleting all existing relations...' );
44
+        $this->log->debug( 'Deleting all existing relations...' );
45 45
 
46
-		// Delete existing data.
47
-		$wpdb->query( "TRUNCATE TABLE {$wpdb->prefix}wl_relation_instances" );
46
+        // Delete existing data.
47
+        $wpdb->query( "TRUNCATE TABLE {$wpdb->prefix}wl_relation_instances" );
48 48
 
49
-		$this->log->debug( 'Processing contents...' );
49
+        $this->log->debug( 'Processing contents...' );
50 50
 
51
-		$this->process( array( $this, 'process_single' ) );
51
+        $this->process( array( $this, 'process_single' ) );
52 52
 
53
-	}
53
+    }
54 54
 
55
-	public function process_single( $post_id ) {
55
+    public function process_single( $post_id ) {
56 56
 
57
-		$this->log->debug( "Processing post $post_id..." );
57
+        $this->log->debug( "Processing post $post_id..." );
58 58
 
59
-		// Bail out if the post is not found.
60
-		$post = get_post( $post_id );
59
+        // Bail out if the post is not found.
60
+        $post = get_post( $post_id );
61 61
 
62
-		if ( null === $post ) {
63
-			$this->log->error( "Post $post_id not found." );
62
+        if ( null === $post ) {
63
+            $this->log->error( "Post $post_id not found." );
64 64
 
65
-			return;
66
-		}
65
+            return;
66
+        }
67 67
 
68
-		// Get the URIs from the post content.
69
-		$uris = $this->content_filter_service->get_entity_uris( $post->post_content );
68
+        // Get the URIs from the post content.
69
+        $uris = $this->content_filter_service->get_entity_uris( $post->post_content );
70 70
 
71
-		// Map the URIs to post IDs.
72
-		$ids = $this->uri_to_post_id( $uris );
71
+        // Map the URIs to post IDs.
72
+        $ids = $this->uri_to_post_id( $uris );
73 73
 
74
-		$this->log->info( 'Found ' . count( $uris ) . ' annotation(s) and ' . count( $ids ) . ' unique relation(s).' );
74
+        $this->log->info( 'Found ' . count( $uris ) . ' annotation(s) and ' . count( $ids ) . ' unique relation(s).' );
75 75
 
76
-		// Create the relations.
77
-		$this->create_relations( $post_id, $ids );
76
+        // Create the relations.
77
+        $this->create_relations( $post_id, $ids );
78 78
 
79
-	}
79
+    }
80 80
 
81
-	private function create_relations( $subject_id, $object_ids ) {
81
+    private function create_relations( $subject_id, $object_ids ) {
82 82
 
83
-		$this->log->info( "Creating relations for post $subject_id..." );
83
+        $this->log->info( "Creating relations for post $subject_id..." );
84 84
 
85
-		$entity_service = $this->entity_service;
85
+        $entity_service = $this->entity_service;
86 86
 
87
-		array_walk( $object_ids, function ( $item ) use ( $subject_id, $entity_service ) {
88
-			wl_core_add_relation_instance(
89
-				$subject_id,
90
-				$entity_service->get_classification_scope_for( $item ),
91
-				$item
92
-			);
93
-		} );
87
+        array_walk( $object_ids, function ( $item ) use ( $subject_id, $entity_service ) {
88
+            wl_core_add_relation_instance(
89
+                $subject_id,
90
+                $entity_service->get_classification_scope_for( $item ),
91
+                $item
92
+            );
93
+        } );
94 94
 
95
-	}
95
+    }
96 96
 
97
-	private function uri_to_post_id( $uris ) {
97
+    private function uri_to_post_id( $uris ) {
98 98
 
99
-		$entity_service = $this->entity_service;
99
+        $entity_service = $this->entity_service;
100 100
 
101
-		$ids = array_unique( array_map( function ( $item ) use ( $entity_service ) {
102
-			$post = $entity_service->get_entity_post_by_uri( $item );
101
+        $ids = array_unique( array_map( function ( $item ) use ( $entity_service ) {
102
+            $post = $entity_service->get_entity_post_by_uri( $item );
103 103
 
104
-			return null === $post ? null : $post->ID;
105
-		}, (array) $uris ) );
104
+            return null === $post ? null : $post->ID;
105
+        }, (array) $uris ) );
106 106
 
107
-		return array_filter( $ids, function ( $item ) {
108
-			return null !== $item;
109
-		} );
110
-	}
107
+        return array_filter( $ids, function ( $item ) {
108
+            return null !== $item;
109
+        } );
110
+    }
111 111
 
112
-	/**
113
-	 * @inheritdoc
114
-	 */
115
-	function find( $offset = 0, $limit = 10, $args = array() ) {
116
-		global $wpdb;
112
+    /**
113
+     * @inheritdoc
114
+     */
115
+    function find( $offset = 0, $limit = 10, $args = array() ) {
116
+        global $wpdb;
117 117
 
118
-		return $wpdb->get_col( $wpdb->prepare(
119
-			"
118
+        return $wpdb->get_col( $wpdb->prepare(
119
+            "
120 120
 			SELECT id
121 121
 			FROM $wpdb->posts
122 122
 			WHERE post_type NOT IN ( 'attachment', 'revision' )
123 123
 				AND post_content REGEXP %s
124 124
 			LIMIT %d OFFSET %d
125 125
 			",
126
-			'<[a-z]+ id="urn:[^"]+" class="[^"]+" itemid="[^"]+">',
127
-			$limit,
128
-			$offset
129
-		) );
126
+            '<[a-z]+ id="urn:[^"]+" class="[^"]+" itemid="[^"]+">',
127
+            $limit,
128
+            $offset
129
+        ) );
130 130
 
131
-	}
131
+    }
132 132
 
133 133
 }
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
 	 * @param \Wordlift_Content_Filter_Service $content_filter_service
28 28
 	 * @param \Wordlift_Entity_Service         $entity_service
29 29
 	 */
30
-	public function __construct( $content_filter_service, $entity_service ) {
30
+	public function __construct($content_filter_service, $entity_service) {
31 31
 
32
-		$this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Relation_Rebuild_Service' );
32
+		$this->log = Wordlift_Log_Service::get_logger('Wordlift_Relation_Rebuild_Service');
33 33
 
34 34
 		$this->content_filter_service = $content_filter_service;
35 35
 		$this->entity_service         = $entity_service;
@@ -39,72 +39,72 @@  discard block
 block discarded – undo
39 39
 	public function process_all() {
40 40
 		global $wpdb;
41 41
 
42
-		set_time_limit( 21600 ); // 6 hours
42
+		set_time_limit(21600); // 6 hours
43 43
 
44
-		$this->log->debug( 'Deleting all existing relations...' );
44
+		$this->log->debug('Deleting all existing relations...');
45 45
 
46 46
 		// Delete existing data.
47
-		$wpdb->query( "TRUNCATE TABLE {$wpdb->prefix}wl_relation_instances" );
47
+		$wpdb->query("TRUNCATE TABLE {$wpdb->prefix}wl_relation_instances");
48 48
 
49
-		$this->log->debug( 'Processing contents...' );
49
+		$this->log->debug('Processing contents...');
50 50
 
51
-		$this->process( array( $this, 'process_single' ) );
51
+		$this->process(array($this, 'process_single'));
52 52
 
53 53
 	}
54 54
 
55
-	public function process_single( $post_id ) {
55
+	public function process_single($post_id) {
56 56
 
57
-		$this->log->debug( "Processing post $post_id..." );
57
+		$this->log->debug("Processing post $post_id...");
58 58
 
59 59
 		// Bail out if the post is not found.
60
-		$post = get_post( $post_id );
60
+		$post = get_post($post_id);
61 61
 
62
-		if ( null === $post ) {
63
-			$this->log->error( "Post $post_id not found." );
62
+		if (null === $post) {
63
+			$this->log->error("Post $post_id not found.");
64 64
 
65 65
 			return;
66 66
 		}
67 67
 
68 68
 		// Get the URIs from the post content.
69
-		$uris = $this->content_filter_service->get_entity_uris( $post->post_content );
69
+		$uris = $this->content_filter_service->get_entity_uris($post->post_content);
70 70
 
71 71
 		// Map the URIs to post IDs.
72
-		$ids = $this->uri_to_post_id( $uris );
72
+		$ids = $this->uri_to_post_id($uris);
73 73
 
74
-		$this->log->info( 'Found ' . count( $uris ) . ' annotation(s) and ' . count( $ids ) . ' unique relation(s).' );
74
+		$this->log->info('Found '.count($uris).' annotation(s) and '.count($ids).' unique relation(s).');
75 75
 
76 76
 		// Create the relations.
77
-		$this->create_relations( $post_id, $ids );
77
+		$this->create_relations($post_id, $ids);
78 78
 
79 79
 	}
80 80
 
81
-	private function create_relations( $subject_id, $object_ids ) {
81
+	private function create_relations($subject_id, $object_ids) {
82 82
 
83
-		$this->log->info( "Creating relations for post $subject_id..." );
83
+		$this->log->info("Creating relations for post $subject_id...");
84 84
 
85 85
 		$entity_service = $this->entity_service;
86 86
 
87
-		array_walk( $object_ids, function ( $item ) use ( $subject_id, $entity_service ) {
87
+		array_walk($object_ids, function($item) use ($subject_id, $entity_service) {
88 88
 			wl_core_add_relation_instance(
89 89
 				$subject_id,
90
-				$entity_service->get_classification_scope_for( $item ),
90
+				$entity_service->get_classification_scope_for($item),
91 91
 				$item
92 92
 			);
93 93
 		} );
94 94
 
95 95
 	}
96 96
 
97
-	private function uri_to_post_id( $uris ) {
97
+	private function uri_to_post_id($uris) {
98 98
 
99 99
 		$entity_service = $this->entity_service;
100 100
 
101
-		$ids = array_unique( array_map( function ( $item ) use ( $entity_service ) {
102
-			$post = $entity_service->get_entity_post_by_uri( $item );
101
+		$ids = array_unique(array_map(function($item) use ($entity_service) {
102
+			$post = $entity_service->get_entity_post_by_uri($item);
103 103
 
104 104
 			return null === $post ? null : $post->ID;
105
-		}, (array) $uris ) );
105
+		}, (array) $uris));
106 106
 
107
-		return array_filter( $ids, function ( $item ) {
107
+		return array_filter($ids, function($item) {
108 108
 			return null !== $item;
109 109
 		} );
110 110
 	}
@@ -112,10 +112,10 @@  discard block
 block discarded – undo
112 112
 	/**
113 113
 	 * @inheritdoc
114 114
 	 */
115
-	function find( $offset = 0, $limit = 10, $args = array() ) {
115
+	function find($offset = 0, $limit = 10, $args = array()) {
116 116
 		global $wpdb;
117 117
 
118
-		return $wpdb->get_col( $wpdb->prepare(
118
+		return $wpdb->get_col($wpdb->prepare(
119 119
 			"
120 120
 			SELECT id
121 121
 			FROM $wpdb->posts
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 			'<[a-z]+ id="urn:[^"]+" class="[^"]+" itemid="[^"]+">',
127 127
 			$limit,
128 128
 			$offset
129
-		) );
129
+		));
130 130
 
131 131
 	}
132 132
 
Please login to merge, or discard this patch.
src/includes/class-wordlift.php 2 patches
Indentation   +1230 added lines, -1230 removed lines patch added patch discarded remove patch
@@ -29,1312 +29,1312 @@
 block discarded – undo
29 29
  */
30 30
 class Wordlift {
31 31
 
32
-	/**
33
-	 * The loader that's responsible for maintaining and registering all hooks that power
34
-	 * the plugin.
35
-	 *
36
-	 * @since    1.0.0
37
-	 * @access   protected
38
-	 * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
39
-	 */
40
-	protected $loader;
41
-
42
-	/**
43
-	 * The unique identifier of this plugin.
44
-	 *
45
-	 * @since    1.0.0
46
-	 * @access   protected
47
-	 * @var      string $plugin_name The string used to uniquely identify this plugin.
48
-	 */
49
-	protected $plugin_name;
50
-
51
-	/**
52
-	 * The current version of the plugin.
53
-	 *
54
-	 * @since    1.0.0
55
-	 * @access   protected
56
-	 * @var      string $version The current version of the plugin.
57
-	 */
58
-	protected $version;
59
-
60
-	/**
61
-	 * The {@link Wordlift_Tinymce_Adapter} instance.
62
-	 *
63
-	 * @since  3.12.0
64
-	 * @access protected
65
-	 * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
66
-	 */
67
-	protected $tinymce_adapter;
68
-
69
-	/**
70
-	 * The Thumbnail service.
71
-	 *
72
-	 * @since  3.1.5
73
-	 * @access private
74
-	 * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
75
-	 */
76
-	private $thumbnail_service;
77
-
78
-	/**
79
-	 * The UI service.
80
-	 *
81
-	 * @since  3.2.0
82
-	 * @access private
83
-	 * @var \Wordlift_UI_Service $ui_service The UI service.
84
-	 */
85
-	private $ui_service;
86
-
87
-	/**
88
-	 * The Schema service.
89
-	 *
90
-	 * @since  3.3.0
91
-	 * @access private
92
-	 * @var \Wordlift_Schema_Service $schema_service The Schema service.
93
-	 */
94
-	private $schema_service;
95
-
96
-	/**
97
-	 * The Entity service.
98
-	 *
99
-	 * @since  3.1.0
100
-	 * @access protected
101
-	 * @var \Wordlift_Entity_Service $entity_service The Entity service.
102
-	 */
103
-	protected $entity_service;
104
-
105
-	/**
106
-	 * The Topic Taxonomy service.
107
-	 *
108
-	 * @since  3.5.0
109
-	 * @access private
110
-	 * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
111
-	 */
112
-	private $topic_taxonomy_service;
113
-
114
-	/**
115
-	 * The User service.
116
-	 *
117
-	 * @since  3.1.7
118
-	 * @access protected
119
-	 * @var \Wordlift_User_Service $user_service The User service.
120
-	 */
121
-	protected $user_service;
122
-
123
-	/**
124
-	 * The Timeline service.
125
-	 *
126
-	 * @since  3.1.0
127
-	 * @access private
128
-	 * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
129
-	 */
130
-	private $timeline_service;
131
-
132
-	/**
133
-	 * The Redirect service.
134
-	 *
135
-	 * @since  3.2.0
136
-	 * @access private
137
-	 * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
138
-	 */
139
-	private $redirect_service;
140
-
141
-	/**
142
-	 * The Notice service.
143
-	 *
144
-	 * @since  3.3.0
145
-	 * @access private
146
-	 * @var \Wordlift_Notice_Service $notice_service The Notice service.
147
-	 */
148
-	private $notice_service;
149
-
150
-	/**
151
-	 * The Entity list customization.
152
-	 *
153
-	 * @since  3.3.0
154
-	 * @access private
155
-	 * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
156
-	 */
157
-	private $entity_list_service;
158
-
159
-	/**
160
-	 * The Entity Types Taxonomy Walker.
161
-	 *
162
-	 * @since  3.1.0
163
-	 * @access private
164
-	 * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
165
-	 */
166
-	private $entity_types_taxonomy_walker;
167
-
168
-	/**
169
-	 * The ShareThis service.
170
-	 *
171
-	 * @since  3.2.0
172
-	 * @access private
173
-	 * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
174
-	 */
175
-	private $sharethis_service;
176
-
177
-	/**
178
-	 * The PrimaShop adapter.
179
-	 *
180
-	 * @since  3.2.3
181
-	 * @access private
182
-	 * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
183
-	 */
184
-	private $primashop_adapter;
185
-
186
-	/**
187
-	 * The WordLift Dashboard adapter.
188
-	 *
189
-	 * @since  3.4.0
190
-	 * @access private
191
-	 * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
192
-	 */
193
-	private $dashboard_service;
194
-
195
-	/**
196
-	 * The entity type service.
197
-	 *
198
-	 * @since  3.6.0
199
-	 * @access private
200
-	 * @var \Wordlift_Entity_Post_Type_Service
201
-	 */
202
-	private $entity_post_type_service;
203
-
204
-	/**
205
-	 * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
206
-	 *
207
-	 * @since  3.6.0
208
-	 * @access private
209
-	 * @var \Wordlift_Entity_Link_Service
210
-	 */
211
-	private $entity_link_service;
212
-
213
-	/**
214
-	 * A {@link Wordlift_Sparql_Service} instance.
215
-	 *
216
-	 * @var    3.6.0
217
-	 * @access protected
218
-	 * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
219
-	 */
220
-	protected $sparql_service;
221
-
222
-	/**
223
-	 * A {@link Wordlift_Import_Service} instance.
224
-	 *
225
-	 * @since  3.6.0
226
-	 * @access private
227
-	 * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
228
-	 */
229
-	private $import_service;
230
-
231
-	/**
232
-	 * A {@link Wordlift_Rebuild_Service} instance.
233
-	 *
234
-	 * @since  3.6.0
235
-	 * @access private
236
-	 * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
237
-	 */
238
-	private $rebuild_service;
239
-
240
-	/**
241
-	 * A {@link Wordlift_Jsonld_Service} instance.
242
-	 *
243
-	 * @since  3.7.0
244
-	 * @access protected
245
-	 * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
246
-	 */
247
-	protected $jsonld_service;
248
-
249
-	/**
250
-	 * A {@link Wordlift_Website_Jsonld_Converter} instance.
251
-	 *
252
-	 * @since  3.14.0
253
-	 * @access protected
254
-	 * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance.
255
-	 */
256
-	protected $jsonld_website_converter;
257
-
258
-	/**
259
-	 *
260
-	 * @since  3.7.0
261
-	 * @access private
262
-	 * @var \Wordlift_Property_Factory $property_factory
263
-	 */
264
-	private $property_factory;
265
-
266
-	/**
267
-	 * The 'Download Your Data' page.
268
-	 *
269
-	 * @since  3.6.0
270
-	 * @access private
271
-	 * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
272
-	 */
273
-	private $download_your_data_page;
274
-
275
-	/**
276
-	 * The 'WordLift Settings' page.
277
-	 *
278
-	 * @since  3.11.0
279
-	 * @access protected
280
-	 * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
281
-	 */
282
-	protected $settings_page;
283
-
284
-	/**
285
-	 * The 'WordLift Batch analysis' page.
286
-	 *
287
-	 * @since  3.14.0
288
-	 * @access protected
289
-	 * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page.
290
-	 */
291
-	protected $batch_analysis_page;
292
-
293
-	/**
294
-	 * The install wizard page.
295
-	 *
296
-	 * @since  3.9.0
297
-	 * @access private
298
-	 * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
299
-	 */
300
-	private $admin_setup;
301
-
302
-	/**
303
-	 * The Content Filter Service hooks up to the 'the_content' filter and provides
304
-	 * linking of entities to their pages.
305
-	 *
306
-	 * @since  3.8.0
307
-	 * @access private
308
-	 * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
309
-	 */
310
-	private $content_filter_service;
311
-
312
-	/**
313
-	 * A {@link Wordlift_Key_Validation_Service} instance.
314
-	 *
315
-	 * @since  3.9.0
316
-	 * @access private
317
-	 * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
318
-	 */
319
-	private $key_validation_service;
320
-
321
-	/**
322
-	 * A {@link Wordlift_Rating_Service} instance.
323
-	 *
324
-	 * @since  3.10.0
325
-	 * @access private
326
-	 * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
327
-	 */
328
-	private $rating_service;
329
-
330
-	/**
331
-	 * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
332
-	 *
333
-	 * @since  3.10.0
334
-	 * @access protected
335
-	 * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
336
-	 */
337
-	protected $post_to_jsonld_converter;
338
-
339
-	/**
340
-	 * A {@link Wordlift_Configuration_Service} instance.
341
-	 *
342
-	 * @since  3.10.0
343
-	 * @access protected
344
-	 * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
345
-	 */
346
-	protected $configuration_service;
347
-
348
-	/**
349
-	 * A {@link Wordlift_Entity_Type_Service} instance.
350
-	 *
351
-	 * @since  3.10.0
352
-	 * @access protected
353
-	 * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
354
-	 */
355
-	protected $entity_type_service;
356
-
357
-	/**
358
-	 * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
359
-	 *
360
-	 * @since  3.10.0
361
-	 * @access protected
362
-	 * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
363
-	 */
364
-	protected $entity_post_to_jsonld_converter;
365
-
366
-	/**
367
-	 * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
368
-	 *
369
-	 * @since  3.10.0
370
-	 * @access protected
371
-	 * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
372
-	 */
373
-	protected $postid_to_jsonld_converter;
374
-
375
-	/**
376
-	 * The {@link Wordlift_Admin_Status_Page} class.
377
-	 *
378
-	 * @since  3.9.8
379
-	 * @access private
380
-	 * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
381
-	 */
382
-	private $status_page;
383
-
384
-	/**
385
-	 * The {@link Wordlift_Category_Taxonomy_Service} instance.
386
-	 *
387
-	 * @since  3.11.0
388
-	 * @access protected
389
-	 * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
390
-	 */
391
-	protected $category_taxonomy_service;
392
-
393
-	/**
394
-	 * The {@link Wordlift_Event_Entity_Page_Service} instance.
395
-	 *
396
-	 * @since  3.11.0
397
-	 * @access protected
398
-	 * @var \Wordlift_Event_Entity_Page_Service $event_entity_page_service The {@link Wordlift_Event_Entity_Page_Service} instance.
399
-	 */
400
-	protected $event_entity_page_service;
401
-
402
-	/**
403
-	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
404
-	 *
405
-	 * @since  3.11.0
406
-	 * @access protected
407
-	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
408
-	 */
409
-	protected $settings_page_action_link;
410
-
411
-	/**
412
-	 * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
413
-	 *
414
-	 * @since  3.11.0
415
-	 * @access protected
416
-	 * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
417
-	 */
418
-	protected $publisher_ajax_adapter;
419
-
420
-	/**
421
-	 * The {@link Wordlift_Admin_Input_Element} element renderer.
422
-	 *
423
-	 * @since  3.11.0
424
-	 * @access protected
425
-	 * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
426
-	 */
427
-	protected $input_element;
428
-
429
-	/**
430
-	 * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
431
-	 *
432
-	 * @since  3.13.0
433
-	 * @access protected
434
-	 * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
435
-	 */
436
-	protected $radio_input_element;
437
-
438
-	/**
439
-	 * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
440
-	 *
441
-	 * @since  3.11.0
442
-	 * @access protected
443
-	 * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
444
-	 */
445
-	protected $language_select_element;
446
-
447
-	/**
448
-	 * The {@link Wordlift_Admin_Publisher_Element} element renderer.
449
-	 *
450
-	 * @since  3.11.0
451
-	 * @access protected
452
-	 * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
453
-	 */
454
-	protected $publisher_element;
455
-
456
-	/**
457
-	 * The {@link Wordlift_Admin_Select2_Element} element renderer.
458
-	 *
459
-	 * @since  3.11.0
460
-	 * @access protected
461
-	 * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
462
-	 */
463
-	protected $select2_element;
464
-
465
-	/**
466
-	 * The controller for the entity type list admin page
467
-	 *
468
-	 * @since  3.11.0
469
-	 * @access private
470
-	 * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
471
-	 */
472
-	private $entity_type_admin_page;
473
-
474
-	/**
475
-	 * The controller for the entity type settings admin page
476
-	 *
477
-	 * @since  3.11.0
478
-	 * @access private
479
-	 * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
480
-	 */
481
-	private $entity_type_settings_admin_page;
482
-
483
-	/**
484
-	 * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
485
-	 *
486
-	 * @since  3.11.0
487
-	 * @access protected
488
-	 * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
489
-	 */
490
-	protected $related_entities_cloud_widget;
491
-
492
-	/**
493
-	 * The {@link Wordlift_Admin_Author_Element} instance.
494
-	 *
495
-	 * @since  3.14.0
496
-	 * @access protected
497
-	 * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
498
-	 */
499
-	protected $author_element;
500
-
501
-	/**
502
-	 * The {@link Wordlift_Batch_Analysis_Service} instance.
503
-	 *
504
-	 * @since  3.14.0
505
-	 * @access protected
506
-	 * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance.
507
-	 */
508
-	protected $batch_analysis_service;
509
-
510
-	/**
511
-	 * The {@link Wordlift_Batch_Analysis_Adapter} instance.
512
-	 *
513
-	 * @since  3.14.2
514
-	 * @access protected
515
-	 * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance.
516
-	 */
517
-	private $batch_analysis_adapter;
518
-
519
-	/**
520
-	 * The {@link Wordlift_Relation_Rebuild_Service} instance.
521
-	 *
522
-	 * @since  3.14.3
523
-	 * @access private
524
-	 * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance.
525
-	 */
526
-	private $relation_rebuild_service;
527
-
528
-	/**
529
-	 * The {@link Wordlift_Relation_Rebuild_Adapter} instance.
530
-	 *
531
-	 * @since  3.14.3
532
-	 * @access private
533
-	 * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance.
534
-	 */
535
-	private $relation_rebuild_adapter;
536
-
537
-	/**
538
-	 * {@link Wordlift}'s singleton instance.
539
-	 *
540
-	 * @since  3.11.2
541
-	 *
542
-	 * @since  3.11.2
543
-	 * @access private
544
-	 * @var Wordlift $instance {@link Wordlift}'s singleton instance.
545
-	 */
546
-	private static $instance;
547
-
548
-	/**
549
-	 * Define the core functionality of the plugin.
550
-	 *
551
-	 * Set the plugin name and the plugin version that can be used throughout the plugin.
552
-	 * Load the dependencies, define the locale, and set the hooks for the admin area and
553
-	 * the public-facing side of the site.
554
-	 *
555
-	 * @since    1.0.0
556
-	 */
557
-	public function __construct() {
558
-
559
-		$this->plugin_name = 'wordlift';
560
-		$this->version     = '3.14.3';
561
-		$this->load_dependencies();
562
-		$this->set_locale();
563
-		$this->define_admin_hooks();
564
-		$this->define_public_hooks();
565
-
566
-		self::$instance = $this;
567
-
568
-	}
569
-
570
-	/**
571
-	 * Get the singleton instance.
572
-	 *
573
-	 * @since 3.11.2
574
-	 *
575
-	 * @return Wordlift The {@link Wordlift} singleton instance.
576
-	 */
577
-	public static function get_instance() {
578
-
579
-		return self::$instance;
580
-	}
581
-
582
-	/**
583
-	 * Load the required dependencies for this plugin.
584
-	 *
585
-	 * Include the following files that make up the plugin:
586
-	 *
587
-	 * - Wordlift_Loader. Orchestrates the hooks of the plugin.
588
-	 * - Wordlift_i18n. Defines internationalization functionality.
589
-	 * - Wordlift_Admin. Defines all hooks for the admin area.
590
-	 * - Wordlift_Public. Defines all hooks for the public side of the site.
591
-	 *
592
-	 * Create an instance of the loader which will be used to register the hooks
593
-	 * with WordPress.
594
-	 *
595
-	 * @since    1.0.0
596
-	 * @access   private
597
-	 */
598
-	private function load_dependencies() {
599
-
600
-		/**
601
-		 * The class responsible for orchestrating the actions and filters of the
602
-		 * core plugin.
603
-		 */
604
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
605
-
606
-		/**
607
-		 * The class responsible for defining internationalization functionality
608
-		 * of the plugin.
609
-		 */
610
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
611
-
612
-		/**
613
-		 * WordLift's supported languages.
614
-		 */
615
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
616
-
617
-		/**
618
-		 * Provide support functions to sanitize data.
619
-		 */
620
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
621
-
622
-		/**
623
-		 * The Redirect service.
624
-		 */
625
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
626
-
627
-		/**
628
-		 * The Log service.
629
-		 */
630
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
631
-
632
-		/**
633
-		 * The configuration service.
634
-		 */
635
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
636
-
637
-		/**
638
-		 * The entity post type service (this is the WordPress post type, not the entity schema type).
639
-		 */
640
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
641
-
642
-		/**
643
-		 * The entity type service (i.e. the schema type).
644
-		 */
645
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
646
-
647
-		/**
648
-		 * The entity link service.
649
-		 */
650
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
651
-
652
-		/**
653
-		 * The Query builder.
654
-		 */
655
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
656
-
657
-		/**
658
-		 * The Schema service.
659
-		 */
660
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
661
-
662
-		/**
663
-		 * The schema:url property service.
664
-		 */
665
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
666
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
667
-
668
-		/**
669
-		 * The UI service.
670
-		 */
671
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
672
-
673
-		/**
674
-		 * The Thumbnail service.
675
-		 */
676
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
677
-
678
-		/**
679
-		 * The Entity Types Taxonomy service.
680
-		 */
681
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
682
-
683
-		/**
684
-		 * The Entity service.
685
-		 */
686
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
687
-
688
-		// Add the entity rating service.
689
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
690
-
691
-		/**
692
-		 * The User service.
693
-		 */
694
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
695
-
696
-		/**
697
-		 * The Timeline service.
698
-		 */
699
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
700
-
701
-		/**
702
-		 * The Topic Taxonomy service.
703
-		 */
704
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
705
-
706
-		/**
707
-		 * The SPARQL service.
708
-		 */
709
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
710
-
711
-		/**
712
-		 * The WordLift import service.
713
-		 */
714
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
715
-
716
-		/**
717
-		 * The WordLift URI service.
718
-		 */
719
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
720
-
721
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php';
722
-
723
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
724
-
725
-		/**
726
-		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
727
-		 */
728
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php';
729
-
730
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
731
-
732
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
733
-
734
-		/**
735
-		 * Load the converters.
736
-		 */
737
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
738
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
739
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
740
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
741
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
742
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
743
-
744
-		/**
745
-		 * Load the content filter.
746
-		 */
747
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
748
-
749
-		/*
32
+    /**
33
+     * The loader that's responsible for maintaining and registering all hooks that power
34
+     * the plugin.
35
+     *
36
+     * @since    1.0.0
37
+     * @access   protected
38
+     * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
39
+     */
40
+    protected $loader;
41
+
42
+    /**
43
+     * The unique identifier of this plugin.
44
+     *
45
+     * @since    1.0.0
46
+     * @access   protected
47
+     * @var      string $plugin_name The string used to uniquely identify this plugin.
48
+     */
49
+    protected $plugin_name;
50
+
51
+    /**
52
+     * The current version of the plugin.
53
+     *
54
+     * @since    1.0.0
55
+     * @access   protected
56
+     * @var      string $version The current version of the plugin.
57
+     */
58
+    protected $version;
59
+
60
+    /**
61
+     * The {@link Wordlift_Tinymce_Adapter} instance.
62
+     *
63
+     * @since  3.12.0
64
+     * @access protected
65
+     * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
66
+     */
67
+    protected $tinymce_adapter;
68
+
69
+    /**
70
+     * The Thumbnail service.
71
+     *
72
+     * @since  3.1.5
73
+     * @access private
74
+     * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
75
+     */
76
+    private $thumbnail_service;
77
+
78
+    /**
79
+     * The UI service.
80
+     *
81
+     * @since  3.2.0
82
+     * @access private
83
+     * @var \Wordlift_UI_Service $ui_service The UI service.
84
+     */
85
+    private $ui_service;
86
+
87
+    /**
88
+     * The Schema service.
89
+     *
90
+     * @since  3.3.0
91
+     * @access private
92
+     * @var \Wordlift_Schema_Service $schema_service The Schema service.
93
+     */
94
+    private $schema_service;
95
+
96
+    /**
97
+     * The Entity service.
98
+     *
99
+     * @since  3.1.0
100
+     * @access protected
101
+     * @var \Wordlift_Entity_Service $entity_service The Entity service.
102
+     */
103
+    protected $entity_service;
104
+
105
+    /**
106
+     * The Topic Taxonomy service.
107
+     *
108
+     * @since  3.5.0
109
+     * @access private
110
+     * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
111
+     */
112
+    private $topic_taxonomy_service;
113
+
114
+    /**
115
+     * The User service.
116
+     *
117
+     * @since  3.1.7
118
+     * @access protected
119
+     * @var \Wordlift_User_Service $user_service The User service.
120
+     */
121
+    protected $user_service;
122
+
123
+    /**
124
+     * The Timeline service.
125
+     *
126
+     * @since  3.1.0
127
+     * @access private
128
+     * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
129
+     */
130
+    private $timeline_service;
131
+
132
+    /**
133
+     * The Redirect service.
134
+     *
135
+     * @since  3.2.0
136
+     * @access private
137
+     * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
138
+     */
139
+    private $redirect_service;
140
+
141
+    /**
142
+     * The Notice service.
143
+     *
144
+     * @since  3.3.0
145
+     * @access private
146
+     * @var \Wordlift_Notice_Service $notice_service The Notice service.
147
+     */
148
+    private $notice_service;
149
+
150
+    /**
151
+     * The Entity list customization.
152
+     *
153
+     * @since  3.3.0
154
+     * @access private
155
+     * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
156
+     */
157
+    private $entity_list_service;
158
+
159
+    /**
160
+     * The Entity Types Taxonomy Walker.
161
+     *
162
+     * @since  3.1.0
163
+     * @access private
164
+     * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
165
+     */
166
+    private $entity_types_taxonomy_walker;
167
+
168
+    /**
169
+     * The ShareThis service.
170
+     *
171
+     * @since  3.2.0
172
+     * @access private
173
+     * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
174
+     */
175
+    private $sharethis_service;
176
+
177
+    /**
178
+     * The PrimaShop adapter.
179
+     *
180
+     * @since  3.2.3
181
+     * @access private
182
+     * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
183
+     */
184
+    private $primashop_adapter;
185
+
186
+    /**
187
+     * The WordLift Dashboard adapter.
188
+     *
189
+     * @since  3.4.0
190
+     * @access private
191
+     * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
192
+     */
193
+    private $dashboard_service;
194
+
195
+    /**
196
+     * The entity type service.
197
+     *
198
+     * @since  3.6.0
199
+     * @access private
200
+     * @var \Wordlift_Entity_Post_Type_Service
201
+     */
202
+    private $entity_post_type_service;
203
+
204
+    /**
205
+     * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
206
+     *
207
+     * @since  3.6.0
208
+     * @access private
209
+     * @var \Wordlift_Entity_Link_Service
210
+     */
211
+    private $entity_link_service;
212
+
213
+    /**
214
+     * A {@link Wordlift_Sparql_Service} instance.
215
+     *
216
+     * @var    3.6.0
217
+     * @access protected
218
+     * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
219
+     */
220
+    protected $sparql_service;
221
+
222
+    /**
223
+     * A {@link Wordlift_Import_Service} instance.
224
+     *
225
+     * @since  3.6.0
226
+     * @access private
227
+     * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
228
+     */
229
+    private $import_service;
230
+
231
+    /**
232
+     * A {@link Wordlift_Rebuild_Service} instance.
233
+     *
234
+     * @since  3.6.0
235
+     * @access private
236
+     * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
237
+     */
238
+    private $rebuild_service;
239
+
240
+    /**
241
+     * A {@link Wordlift_Jsonld_Service} instance.
242
+     *
243
+     * @since  3.7.0
244
+     * @access protected
245
+     * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
246
+     */
247
+    protected $jsonld_service;
248
+
249
+    /**
250
+     * A {@link Wordlift_Website_Jsonld_Converter} instance.
251
+     *
252
+     * @since  3.14.0
253
+     * @access protected
254
+     * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance.
255
+     */
256
+    protected $jsonld_website_converter;
257
+
258
+    /**
259
+     *
260
+     * @since  3.7.0
261
+     * @access private
262
+     * @var \Wordlift_Property_Factory $property_factory
263
+     */
264
+    private $property_factory;
265
+
266
+    /**
267
+     * The 'Download Your Data' page.
268
+     *
269
+     * @since  3.6.0
270
+     * @access private
271
+     * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
272
+     */
273
+    private $download_your_data_page;
274
+
275
+    /**
276
+     * The 'WordLift Settings' page.
277
+     *
278
+     * @since  3.11.0
279
+     * @access protected
280
+     * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
281
+     */
282
+    protected $settings_page;
283
+
284
+    /**
285
+     * The 'WordLift Batch analysis' page.
286
+     *
287
+     * @since  3.14.0
288
+     * @access protected
289
+     * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page.
290
+     */
291
+    protected $batch_analysis_page;
292
+
293
+    /**
294
+     * The install wizard page.
295
+     *
296
+     * @since  3.9.0
297
+     * @access private
298
+     * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
299
+     */
300
+    private $admin_setup;
301
+
302
+    /**
303
+     * The Content Filter Service hooks up to the 'the_content' filter and provides
304
+     * linking of entities to their pages.
305
+     *
306
+     * @since  3.8.0
307
+     * @access private
308
+     * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
309
+     */
310
+    private $content_filter_service;
311
+
312
+    /**
313
+     * A {@link Wordlift_Key_Validation_Service} instance.
314
+     *
315
+     * @since  3.9.0
316
+     * @access private
317
+     * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
318
+     */
319
+    private $key_validation_service;
320
+
321
+    /**
322
+     * A {@link Wordlift_Rating_Service} instance.
323
+     *
324
+     * @since  3.10.0
325
+     * @access private
326
+     * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
327
+     */
328
+    private $rating_service;
329
+
330
+    /**
331
+     * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
332
+     *
333
+     * @since  3.10.0
334
+     * @access protected
335
+     * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
336
+     */
337
+    protected $post_to_jsonld_converter;
338
+
339
+    /**
340
+     * A {@link Wordlift_Configuration_Service} instance.
341
+     *
342
+     * @since  3.10.0
343
+     * @access protected
344
+     * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
345
+     */
346
+    protected $configuration_service;
347
+
348
+    /**
349
+     * A {@link Wordlift_Entity_Type_Service} instance.
350
+     *
351
+     * @since  3.10.0
352
+     * @access protected
353
+     * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
354
+     */
355
+    protected $entity_type_service;
356
+
357
+    /**
358
+     * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
359
+     *
360
+     * @since  3.10.0
361
+     * @access protected
362
+     * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
363
+     */
364
+    protected $entity_post_to_jsonld_converter;
365
+
366
+    /**
367
+     * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
368
+     *
369
+     * @since  3.10.0
370
+     * @access protected
371
+     * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
372
+     */
373
+    protected $postid_to_jsonld_converter;
374
+
375
+    /**
376
+     * The {@link Wordlift_Admin_Status_Page} class.
377
+     *
378
+     * @since  3.9.8
379
+     * @access private
380
+     * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
381
+     */
382
+    private $status_page;
383
+
384
+    /**
385
+     * The {@link Wordlift_Category_Taxonomy_Service} instance.
386
+     *
387
+     * @since  3.11.0
388
+     * @access protected
389
+     * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
390
+     */
391
+    protected $category_taxonomy_service;
392
+
393
+    /**
394
+     * The {@link Wordlift_Event_Entity_Page_Service} instance.
395
+     *
396
+     * @since  3.11.0
397
+     * @access protected
398
+     * @var \Wordlift_Event_Entity_Page_Service $event_entity_page_service The {@link Wordlift_Event_Entity_Page_Service} instance.
399
+     */
400
+    protected $event_entity_page_service;
401
+
402
+    /**
403
+     * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
404
+     *
405
+     * @since  3.11.0
406
+     * @access protected
407
+     * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
408
+     */
409
+    protected $settings_page_action_link;
410
+
411
+    /**
412
+     * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
413
+     *
414
+     * @since  3.11.0
415
+     * @access protected
416
+     * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
417
+     */
418
+    protected $publisher_ajax_adapter;
419
+
420
+    /**
421
+     * The {@link Wordlift_Admin_Input_Element} element renderer.
422
+     *
423
+     * @since  3.11.0
424
+     * @access protected
425
+     * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
426
+     */
427
+    protected $input_element;
428
+
429
+    /**
430
+     * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
431
+     *
432
+     * @since  3.13.0
433
+     * @access protected
434
+     * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
435
+     */
436
+    protected $radio_input_element;
437
+
438
+    /**
439
+     * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
440
+     *
441
+     * @since  3.11.0
442
+     * @access protected
443
+     * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
444
+     */
445
+    protected $language_select_element;
446
+
447
+    /**
448
+     * The {@link Wordlift_Admin_Publisher_Element} element renderer.
449
+     *
450
+     * @since  3.11.0
451
+     * @access protected
452
+     * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
453
+     */
454
+    protected $publisher_element;
455
+
456
+    /**
457
+     * The {@link Wordlift_Admin_Select2_Element} element renderer.
458
+     *
459
+     * @since  3.11.0
460
+     * @access protected
461
+     * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
462
+     */
463
+    protected $select2_element;
464
+
465
+    /**
466
+     * The controller for the entity type list admin page
467
+     *
468
+     * @since  3.11.0
469
+     * @access private
470
+     * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
471
+     */
472
+    private $entity_type_admin_page;
473
+
474
+    /**
475
+     * The controller for the entity type settings admin page
476
+     *
477
+     * @since  3.11.0
478
+     * @access private
479
+     * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
480
+     */
481
+    private $entity_type_settings_admin_page;
482
+
483
+    /**
484
+     * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
485
+     *
486
+     * @since  3.11.0
487
+     * @access protected
488
+     * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
489
+     */
490
+    protected $related_entities_cloud_widget;
491
+
492
+    /**
493
+     * The {@link Wordlift_Admin_Author_Element} instance.
494
+     *
495
+     * @since  3.14.0
496
+     * @access protected
497
+     * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
498
+     */
499
+    protected $author_element;
500
+
501
+    /**
502
+     * The {@link Wordlift_Batch_Analysis_Service} instance.
503
+     *
504
+     * @since  3.14.0
505
+     * @access protected
506
+     * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance.
507
+     */
508
+    protected $batch_analysis_service;
509
+
510
+    /**
511
+     * The {@link Wordlift_Batch_Analysis_Adapter} instance.
512
+     *
513
+     * @since  3.14.2
514
+     * @access protected
515
+     * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance.
516
+     */
517
+    private $batch_analysis_adapter;
518
+
519
+    /**
520
+     * The {@link Wordlift_Relation_Rebuild_Service} instance.
521
+     *
522
+     * @since  3.14.3
523
+     * @access private
524
+     * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance.
525
+     */
526
+    private $relation_rebuild_service;
527
+
528
+    /**
529
+     * The {@link Wordlift_Relation_Rebuild_Adapter} instance.
530
+     *
531
+     * @since  3.14.3
532
+     * @access private
533
+     * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance.
534
+     */
535
+    private $relation_rebuild_adapter;
536
+
537
+    /**
538
+     * {@link Wordlift}'s singleton instance.
539
+     *
540
+     * @since  3.11.2
541
+     *
542
+     * @since  3.11.2
543
+     * @access private
544
+     * @var Wordlift $instance {@link Wordlift}'s singleton instance.
545
+     */
546
+    private static $instance;
547
+
548
+    /**
549
+     * Define the core functionality of the plugin.
550
+     *
551
+     * Set the plugin name and the plugin version that can be used throughout the plugin.
552
+     * Load the dependencies, define the locale, and set the hooks for the admin area and
553
+     * the public-facing side of the site.
554
+     *
555
+     * @since    1.0.0
556
+     */
557
+    public function __construct() {
558
+
559
+        $this->plugin_name = 'wordlift';
560
+        $this->version     = '3.14.3';
561
+        $this->load_dependencies();
562
+        $this->set_locale();
563
+        $this->define_admin_hooks();
564
+        $this->define_public_hooks();
565
+
566
+        self::$instance = $this;
567
+
568
+    }
569
+
570
+    /**
571
+     * Get the singleton instance.
572
+     *
573
+     * @since 3.11.2
574
+     *
575
+     * @return Wordlift The {@link Wordlift} singleton instance.
576
+     */
577
+    public static function get_instance() {
578
+
579
+        return self::$instance;
580
+    }
581
+
582
+    /**
583
+     * Load the required dependencies for this plugin.
584
+     *
585
+     * Include the following files that make up the plugin:
586
+     *
587
+     * - Wordlift_Loader. Orchestrates the hooks of the plugin.
588
+     * - Wordlift_i18n. Defines internationalization functionality.
589
+     * - Wordlift_Admin. Defines all hooks for the admin area.
590
+     * - Wordlift_Public. Defines all hooks for the public side of the site.
591
+     *
592
+     * Create an instance of the loader which will be used to register the hooks
593
+     * with WordPress.
594
+     *
595
+     * @since    1.0.0
596
+     * @access   private
597
+     */
598
+    private function load_dependencies() {
599
+
600
+        /**
601
+         * The class responsible for orchestrating the actions and filters of the
602
+         * core plugin.
603
+         */
604
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
605
+
606
+        /**
607
+         * The class responsible for defining internationalization functionality
608
+         * of the plugin.
609
+         */
610
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
611
+
612
+        /**
613
+         * WordLift's supported languages.
614
+         */
615
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
616
+
617
+        /**
618
+         * Provide support functions to sanitize data.
619
+         */
620
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
621
+
622
+        /**
623
+         * The Redirect service.
624
+         */
625
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
626
+
627
+        /**
628
+         * The Log service.
629
+         */
630
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
631
+
632
+        /**
633
+         * The configuration service.
634
+         */
635
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
636
+
637
+        /**
638
+         * The entity post type service (this is the WordPress post type, not the entity schema type).
639
+         */
640
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
641
+
642
+        /**
643
+         * The entity type service (i.e. the schema type).
644
+         */
645
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
646
+
647
+        /**
648
+         * The entity link service.
649
+         */
650
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
651
+
652
+        /**
653
+         * The Query builder.
654
+         */
655
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
656
+
657
+        /**
658
+         * The Schema service.
659
+         */
660
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
661
+
662
+        /**
663
+         * The schema:url property service.
664
+         */
665
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
666
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
667
+
668
+        /**
669
+         * The UI service.
670
+         */
671
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
672
+
673
+        /**
674
+         * The Thumbnail service.
675
+         */
676
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
677
+
678
+        /**
679
+         * The Entity Types Taxonomy service.
680
+         */
681
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
682
+
683
+        /**
684
+         * The Entity service.
685
+         */
686
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
687
+
688
+        // Add the entity rating service.
689
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
690
+
691
+        /**
692
+         * The User service.
693
+         */
694
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
695
+
696
+        /**
697
+         * The Timeline service.
698
+         */
699
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
700
+
701
+        /**
702
+         * The Topic Taxonomy service.
703
+         */
704
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
705
+
706
+        /**
707
+         * The SPARQL service.
708
+         */
709
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
710
+
711
+        /**
712
+         * The WordLift import service.
713
+         */
714
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
715
+
716
+        /**
717
+         * The WordLift URI service.
718
+         */
719
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
720
+
721
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php';
722
+
723
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
724
+
725
+        /**
726
+         * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
727
+         */
728
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php';
729
+
730
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
731
+
732
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
733
+
734
+        /**
735
+         * Load the converters.
736
+         */
737
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
738
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
739
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
740
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
741
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
742
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
743
+
744
+        /**
745
+         * Load the content filter.
746
+         */
747
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
748
+
749
+        /*
750 750
 		 * Load the excerpt helper.
751 751
 		 */
752
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
753
-
754
-		/**
755
-		 * Load the JSON-LD service to publish entities using JSON-LD.s
756
-		 *
757
-		 * @since 3.8.0
758
-		 */
759
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
760
-
761
-		// The Publisher Service and the AJAX adapter.
762
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
763
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
764
-
765
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
766
-
767
-		/**
768
-		 * Load the WordLift key validation service.
769
-		 */
770
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
771
-
772
-		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
773
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
774
-
775
-		// Load the `Wordlift_Event_Entity_Page_Service` class definition.
776
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-event-entity-page-service.php';
777
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-analysis-service.php';
778
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-rebuild-service.php';
779
-
780
-		/** Adapters. */
781
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
782
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
783
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-analysis-adapter.php';
784
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-rebuild-adapter.php';
785
-
786
-		/** Async Tasks. */
787
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/wp-async-task.php';
788
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
789
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
790
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
791
-
792
-		/**
793
-		 * The class responsible for defining all actions that occur in the admin area.
794
-		 */
795
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
796
-
797
-		/**
798
-		 * The class to customize the entity list admin page.
799
-		 */
800
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
801
-
802
-		/**
803
-		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
804
-		 */
805
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
752
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
753
+
754
+        /**
755
+         * Load the JSON-LD service to publish entities using JSON-LD.s
756
+         *
757
+         * @since 3.8.0
758
+         */
759
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
760
+
761
+        // The Publisher Service and the AJAX adapter.
762
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
763
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
764
+
765
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
766
+
767
+        /**
768
+         * Load the WordLift key validation service.
769
+         */
770
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
771
+
772
+        // Load the `Wordlift_Category_Taxonomy_Service` class definition.
773
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
774
+
775
+        // Load the `Wordlift_Event_Entity_Page_Service` class definition.
776
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-event-entity-page-service.php';
777
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-analysis-service.php';
778
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-rebuild-service.php';
779
+
780
+        /** Adapters. */
781
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
782
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
783
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-analysis-adapter.php';
784
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-rebuild-adapter.php';
785
+
786
+        /** Async Tasks. */
787
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/wp-async-task.php';
788
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
789
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
790
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
791
+
792
+        /**
793
+         * The class responsible for defining all actions that occur in the admin area.
794
+         */
795
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
796
+
797
+        /**
798
+         * The class to customize the entity list admin page.
799
+         */
800
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
801
+
802
+        /**
803
+         * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
804
+         */
805
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
806
+
807
+        /**
808
+         * The Notice service.
809
+         */
810
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
811
+
812
+        /**
813
+         * The PrimaShop adapter.
814
+         */
815
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
816
+
817
+        /**
818
+         * The WordLift Dashboard service.
819
+         */
820
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
821
+
822
+        /**
823
+         * The admin 'Install wizard' page.
824
+         */
825
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
826
+
827
+        /**
828
+         * The WordLift entity type list admin page controller.
829
+         */
830
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
831
+
832
+        /**
833
+         * The WordLift entity type settings admin page controller.
834
+         */
835
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
836
+
837
+        /**
838
+         * The admin 'Download Your Data' page.
839
+         */
840
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
841
+
842
+        /**
843
+         * The admin 'Download Your Data' page.
844
+         */
845
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
846
+
847
+        /**
848
+         * The admin 'WordLift Settings' page.
849
+         */
850
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
851
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
852
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
853
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
854
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
855
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
856
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
857
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
858
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
859
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
860
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php';
861
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
862
+
863
+        /** Admin Pages */
864
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
865
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
866
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
867
+
868
+        /**
869
+         * The class responsible for defining all actions that occur in the public-facing
870
+         * side of the site.
871
+         */
872
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
873
+
874
+        /**
875
+         * The shortcode abstract class.
876
+         */
877
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
878
+
879
+        /**
880
+         * The Timeline shortcode.
881
+         */
882
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
883
+
884
+        /**
885
+         * The Navigator shortcode.
886
+         */
887
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
888
+
889
+        /**
890
+         * The chord shortcode.
891
+         */
892
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
893
+
894
+        /**
895
+         * The geomap shortcode.
896
+         */
897
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
898
+
899
+        /**
900
+         * The entity cloud shortcode.
901
+         */
902
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
903
+
904
+        /**
905
+         * The ShareThis service.
906
+         */
907
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
806 908
 
807
-		/**
808
-		 * The Notice service.
809
-		 */
810
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
909
+        /**
910
+         * The SEO service.
911
+         */
912
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
811 913
 
812
-		/**
813
-		 * The PrimaShop adapter.
814
-		 */
815
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
816
-
817
-		/**
818
-		 * The WordLift Dashboard service.
819
-		 */
820
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
821
-
822
-		/**
823
-		 * The admin 'Install wizard' page.
824
-		 */
825
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
826
-
827
-		/**
828
-		 * The WordLift entity type list admin page controller.
829
-		 */
830
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
831
-
832
-		/**
833
-		 * The WordLift entity type settings admin page controller.
834
-		 */
835
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
836
-
837
-		/**
838
-		 * The admin 'Download Your Data' page.
839
-		 */
840
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
841
-
842
-		/**
843
-		 * The admin 'Download Your Data' page.
844
-		 */
845
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
846
-
847
-		/**
848
-		 * The admin 'WordLift Settings' page.
849
-		 */
850
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
851
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
852
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
853
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
854
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
855
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
856
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
857
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
858
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
859
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
860
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php';
861
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
862
-
863
-		/** Admin Pages */
864
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
865
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
866
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
867
-
868
-		/**
869
-		 * The class responsible for defining all actions that occur in the public-facing
870
-		 * side of the site.
871
-		 */
872
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
873
-
874
-		/**
875
-		 * The shortcode abstract class.
876
-		 */
877
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
878
-
879
-		/**
880
-		 * The Timeline shortcode.
881
-		 */
882
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
883
-
884
-		/**
885
-		 * The Navigator shortcode.
886
-		 */
887
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
888
-
889
-		/**
890
-		 * The chord shortcode.
891
-		 */
892
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
893
-
894
-		/**
895
-		 * The geomap shortcode.
896
-		 */
897
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
898
-
899
-		/**
900
-		 * The entity cloud shortcode.
901
-		 */
902
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
903
-
904
-		/**
905
-		 * The ShareThis service.
906
-		 */
907
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
908
-
909
-		/**
910
-		 * The SEO service.
911
-		 */
912
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
913
-
914
-		/**
915
-		 * The AMP service.
916
-		 */
917
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
914
+        /**
915
+         * The AMP service.
916
+         */
917
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
918 918
 
919
-		/** Widgets */
920
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
921
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
919
+        /** Widgets */
920
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
921
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
922 922
 
923
-		$this->loader = new Wordlift_Loader();
923
+        $this->loader = new Wordlift_Loader();
924 924
 
925
-		// Instantiate a global logger.
926
-		global $wl_logger;
927
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
925
+        // Instantiate a global logger.
926
+        global $wl_logger;
927
+        $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
928 928
 
929
-		// Create the configuration service.
930
-		$this->configuration_service = new Wordlift_Configuration_Service();
929
+        // Create the configuration service.
930
+        $this->configuration_service = new Wordlift_Configuration_Service();
931 931
 
932
-		// Create an entity type service instance. It'll be later bound to the init action.
933
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
932
+        // Create an entity type service instance. It'll be later bound to the init action.
933
+        $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
934 934
 
935
-		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
936
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
935
+        // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
936
+        $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
937 937
 
938
-		// Create an instance of the UI service.
939
-		$this->ui_service = new Wordlift_UI_Service();
938
+        // Create an instance of the UI service.
939
+        $this->ui_service = new Wordlift_UI_Service();
940 940
 
941
-		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
942
-		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
941
+        // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
942
+        $this->thumbnail_service = new Wordlift_Thumbnail_Service();
943 943
 
944
-		$this->sparql_service = new Wordlift_Sparql_Service();
944
+        $this->sparql_service = new Wordlift_Sparql_Service();
945 945
 
946
-		// Create an instance of the Schema service.
947
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
948
-		$this->schema_service        = new Wordlift_Schema_Service();
946
+        // Create an instance of the Schema service.
947
+        $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
948
+        $this->schema_service        = new Wordlift_Schema_Service();
949 949
 
950
-		// Create an instance of the Notice service.
951
-		$this->notice_service = new Wordlift_Notice_Service();
950
+        // Create an instance of the Notice service.
951
+        $this->notice_service = new Wordlift_Notice_Service();
952 952
 
953
-		// Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page.
954
-		$this->entity_service = new Wordlift_Entity_Service( $this->ui_service );
953
+        // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page.
954
+        $this->entity_service = new Wordlift_Entity_Service( $this->ui_service );
955 955
 
956
-		// Create an instance of the User service.
957
-		$this->user_service = new Wordlift_User_Service();
956
+        // Create an instance of the User service.
957
+        $this->user_service = new Wordlift_User_Service();
958 958
 
959
-		// Create a new instance of the Timeline service and Timeline shortcode.
960
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
959
+        // Create a new instance of the Timeline service and Timeline shortcode.
960
+        $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
961 961
 
962
-		// Create a new instance of the Redirect service.
963
-		$this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service );
962
+        // Create a new instance of the Redirect service.
963
+        $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service );
964 964
 
965
-		// Initialize the shortcodes.
966
-		new Wordlift_Navigator_Shortcode();
967
-		new Wordlift_Chord_Shortcode();
968
-		new Wordlift_Geomap_Shortcode();
969
-		new Wordlift_Timeline_Shortcode();
970
-		new Wordlift_Related_Entities_Cloud_Shortcode();
965
+        // Initialize the shortcodes.
966
+        new Wordlift_Navigator_Shortcode();
967
+        new Wordlift_Chord_Shortcode();
968
+        new Wordlift_Geomap_Shortcode();
969
+        new Wordlift_Timeline_Shortcode();
970
+        new Wordlift_Related_Entities_Cloud_Shortcode();
971 971
 
972
-		// Initialize the SEO service.
973
-		new Wordlift_Seo_Service();
972
+        // Initialize the SEO service.
973
+        new Wordlift_Seo_Service();
974 974
 
975
-		// Initialize the AMP service.
976
-		new Wordlift_AMP_Service();
975
+        // Initialize the AMP service.
976
+        new Wordlift_AMP_Service();
977 977
 
978
-		$this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service );
978
+        $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service );
979 979
 
980
-		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
980
+        $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
981 981
 
982
-		$this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service();
982
+        $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service();
983 983
 
984
-		// Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
985
-		$this->sharethis_service = new Wordlift_ShareThis_Service();
984
+        // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
985
+        $this->sharethis_service = new Wordlift_ShareThis_Service();
986 986
 
987
-		// Create an instance of the PrimaShop adapter.
988
-		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
987
+        // Create an instance of the PrimaShop adapter.
988
+        $this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
989 989
 
990
-		// Create an import service instance to hook later to WP's import function.
991
-		$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() );
990
+        // Create an import service instance to hook later to WP's import function.
991
+        $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() );
992 992
 
993
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
993
+        $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
994 994
 
995
-		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
996
-		$this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service );
995
+        // Create a Rebuild Service instance, which we'll later bound to an ajax call.
996
+        $this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service );
997 997
 
998
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
998
+        $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
999 999
 
1000
-		// Create the entity rating service.
1001
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1000
+        // Create the entity rating service.
1001
+        $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1002 1002
 
1003
-		// Create entity list customization (wp-admin/edit.php)
1004
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1003
+        // Create entity list customization (wp-admin/edit.php)
1004
+        $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1005 1005
 
1006
-		// Create a new instance of the Redirect service.
1007
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service );
1006
+        // Create a new instance of the Redirect service.
1007
+        $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service );
1008 1008
 
1009
-		$this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service );
1010
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1009
+        $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service );
1010
+        $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1011 1011
 
1012
-		$attachment_service = new Wordlift_Attachment_Service();
1012
+        $attachment_service = new Wordlift_Attachment_Service();
1013 1013
 
1014
-		// Instantiate the JSON-LD service.
1015
-		$property_getter                       = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1016
-		$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 );
1017
-		$this->post_to_jsonld_converter        = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service, $this->entity_post_to_jsonld_converter );
1018
-		$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 );
1019
-		$this->jsonld_website_converter        = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service, $this->entity_post_to_jsonld_converter );
1020
-		$this->jsonld_service                  = new Wordlift_Jsonld_Service( $this->entity_service, $this->postid_to_jsonld_converter, $this->jsonld_website_converter );
1014
+        // Instantiate the JSON-LD service.
1015
+        $property_getter                       = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1016
+        $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 );
1017
+        $this->post_to_jsonld_converter        = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service, $this->entity_post_to_jsonld_converter );
1018
+        $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 );
1019
+        $this->jsonld_website_converter        = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service, $this->entity_post_to_jsonld_converter );
1020
+        $this->jsonld_service                  = new Wordlift_Jsonld_Service( $this->entity_service, $this->postid_to_jsonld_converter, $this->jsonld_website_converter );
1021 1021
 
1022
-		$this->key_validation_service   = new Wordlift_Key_Validation_Service( $this->configuration_service );
1023
-		$publisher_service              = new Wordlift_Publisher_Service();
1024
-		$this->content_filter_service   = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service );
1025
-		$this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1022
+        $this->key_validation_service   = new Wordlift_Key_Validation_Service( $this->configuration_service );
1023
+        $publisher_service              = new Wordlift_Publisher_Service();
1024
+        $this->content_filter_service   = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service );
1025
+        $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1026 1026
 
1027
-		/** Adapters. */
1028
-		$this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter( $publisher_service );
1029
-		$this->tinymce_adapter          = new Wordlift_Tinymce_Adapter( $this );
1030
-		$this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service );
1031
-		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1027
+        /** Adapters. */
1028
+        $this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter( $publisher_service );
1029
+        $this->tinymce_adapter          = new Wordlift_Tinymce_Adapter( $this );
1030
+        $this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service );
1031
+        $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1032 1032
 
1033
-		/** Async Tasks. */
1034
-		new Wordlift_Sparql_Query_Async_Task();
1035
-		new Wordlift_Batch_Analysis_Request_Async_Task();
1036
-		new Wordlift_Batch_Analysis_Complete_Async_Task();
1033
+        /** Async Tasks. */
1034
+        new Wordlift_Sparql_Query_Async_Task();
1035
+        new Wordlift_Batch_Analysis_Request_Async_Task();
1036
+        new Wordlift_Batch_Analysis_Complete_Async_Task();
1037 1037
 
1038
-		/** WordPress Admin UI. */
1038
+        /** WordPress Admin UI. */
1039 1039
 
1040
-		// UI elements.
1041
-		$this->input_element           = new Wordlift_Admin_Input_Element();
1042
-		$this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1043
-		$this->select2_element         = new Wordlift_Admin_Select2_Element();
1044
-		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1045
-		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
1046
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element );
1047
-		$this->author_element          = new Wordlift_Admin_Author_Element( $publisher_service, $this->select2_element );
1040
+        // UI elements.
1041
+        $this->input_element           = new Wordlift_Admin_Input_Element();
1042
+        $this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1043
+        $this->select2_element         = new Wordlift_Admin_Select2_Element();
1044
+        $this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1045
+        $tabs_element                  = new Wordlift_Admin_Tabs_Element();
1046
+        $this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element );
1047
+        $this->author_element          = new Wordlift_Admin_Author_Element( $publisher_service, $this->select2_element );
1048 1048
 
1049
-		$this->download_your_data_page   = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1050
-		$this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element );
1051
-		$this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service );
1052
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1049
+        $this->download_your_data_page   = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1050
+        $this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element );
1051
+        $this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service );
1052
+        $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1053 1053
 
1054
-		// Pages.
1055
-		new Wordlift_Admin_Post_Edit_Page( $this );
1054
+        // Pages.
1055
+        new Wordlift_Admin_Post_Edit_Page( $this );
1056 1056
 
1057
-		// create an instance of the entity type list admin page controller.
1058
-		$this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1057
+        // create an instance of the entity type list admin page controller.
1058
+        $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1059 1059
 
1060
-		// create an instance of the entity type etting admin page controller.
1061
-		$this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1060
+        // create an instance of the entity type etting admin page controller.
1061
+        $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1062 1062
 
1063
-		/** Widgets */
1064
-		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1063
+        /** Widgets */
1064
+        $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1065 1065
 
1066
-		//** WordPress Admin */
1067
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1068
-		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1066
+        //** WordPress Admin */
1067
+        $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1068
+        $this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1069 1069
 
1070
-		// Create an instance of the install wizard.
1071
-		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1070
+        // Create an instance of the install wizard.
1071
+        $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1072 1072
 
1073
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1073
+        $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1074 1074
 
1075
-		// User Profile.
1076
-		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1075
+        // User Profile.
1076
+        new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1077 1077
 
1078
-		$this->event_entity_page_service = new Wordlift_Event_Entity_Page_Service();
1078
+        $this->event_entity_page_service = new Wordlift_Event_Entity_Page_Service();
1079 1079
 
1080
-		// Load the debug service if WP is in debug mode.
1081
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1082
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1083
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1084
-		}
1080
+        // Load the debug service if WP is in debug mode.
1081
+        if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1082
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1083
+            new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1084
+        }
1085 1085
 
1086
-	}
1086
+    }
1087 1087
 
1088
-	/**
1089
-	 * Define the locale for this plugin for internationalization.
1090
-	 *
1091
-	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1092
-	 * with WordPress.
1093
-	 *
1094
-	 * @since    1.0.0
1095
-	 * @access   private
1096
-	 */
1097
-	private function set_locale() {
1088
+    /**
1089
+     * Define the locale for this plugin for internationalization.
1090
+     *
1091
+     * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1092
+     * with WordPress.
1093
+     *
1094
+     * @since    1.0.0
1095
+     * @access   private
1096
+     */
1097
+    private function set_locale() {
1098 1098
 
1099
-		$plugin_i18n = new Wordlift_i18n();
1100
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1099
+        $plugin_i18n = new Wordlift_i18n();
1100
+        $plugin_i18n->set_domain( $this->get_plugin_name() );
1101 1101
 
1102
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1103
-
1104
-	}
1102
+        $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1103
+
1104
+    }
1105 1105
 
1106
-	/**
1107
-	 * Register all of the hooks related to the admin area functionality
1108
-	 * of the plugin.
1109
-	 *
1110
-	 * @since    1.0.0
1111
-	 * @access   private
1112
-	 */
1113
-	private function define_admin_hooks() {
1114
-
1115
-		$plugin_admin = new Wordlift_Admin(
1116
-			$this->get_plugin_name(),
1117
-			$this->get_version(),
1118
-			$this->configuration_service,
1119
-			$this->notice_service,
1120
-			$this->user_service
1121
-		);
1122
-
1123
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1124
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1106
+    /**
1107
+     * Register all of the hooks related to the admin area functionality
1108
+     * of the plugin.
1109
+     *
1110
+     * @since    1.0.0
1111
+     * @access   private
1112
+     */
1113
+    private function define_admin_hooks() {
1114
+
1115
+        $plugin_admin = new Wordlift_Admin(
1116
+            $this->get_plugin_name(),
1117
+            $this->get_version(),
1118
+            $this->configuration_service,
1119
+            $this->notice_service,
1120
+            $this->user_service
1121
+        );
1122
+
1123
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1124
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1125 1125
 
1126
-		// Hook the init action to the Topic Taxonomy service.
1127
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1128
-
1129
-		// Hook the deleted_post_meta action to the Thumbnail service.
1130
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1126
+        // Hook the init action to the Topic Taxonomy service.
1127
+        $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1128
+
1129
+        // Hook the deleted_post_meta action to the Thumbnail service.
1130
+        $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1131 1131
 
1132
-		// Hook the added_post_meta action to the Thumbnail service.
1133
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1132
+        // Hook the added_post_meta action to the Thumbnail service.
1133
+        $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1134 1134
 
1135
-		// Hook the updated_post_meta action to the Thumbnail service.
1136
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1135
+        // Hook the updated_post_meta action to the Thumbnail service.
1136
+        $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1137 1137
 
1138
-		// Hook posts inserts (or updates) to the user service.
1139
-		$this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
1140
-
1141
-		// Hook the AJAX wl_timeline action to the Timeline service.
1142
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1143
-
1144
-		// Register custom allowed redirect hosts.
1145
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1146
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1147
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1148
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1149
-		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1150
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1151
-		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1152
-
1153
-		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1154
-		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1155
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1156
-		$this->loader->add_action( 'save_post_entity', $this->rating_service, 'set_rating_for', 10, 1 );
1157
-
1158
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1159
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1160
-
1161
-		// Entity listing customization (wp-admin/edit.php)
1162
-		// Add custom columns
1163
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1164
-		$this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1165
-		// Add 4W selection
1166
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1167
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1168
-
1169
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1170
-
1171
-		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1172
-		// entities.
1173
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1174
-
1175
-		// Filter imported post meta.
1176
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1177
-
1178
-		// Notify the import service when an import starts and ends.
1179
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1180
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1181
-
1182
-		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1183
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1184
-
1185
-		// Hook the menu to the Download Your Data page.
1186
-		$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1187
-		$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1188
-		$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1189
-
1190
-		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1191
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1192
-
1193
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1194
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1195
-
1196
-		// Hook the AJAX wl_validate_key action to the Key Validation service.
1197
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1198
-
1199
-		// Hook the `admin_init` function to the Admin Setup.
1200
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1201
-
1202
-		// Hook the admin_init to the settings page.
1203
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1204
-
1205
-		// Hook the menu creation on the general wordlift menu creation
1206
-		$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1207
-		if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) {
1208
-			// Add the functionality only if a flag is set in wp-config.php .
1209
-			$this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 );
1210
-		}
1211
-
1212
-		// Hook key update.
1213
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1214
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1215
-
1216
-		// Add additional action links to the WordLift plugin in the plugins page.
1217
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1218
-
1219
-		// Hook the AJAX `wl_publisher` action name.
1220
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1138
+        // Hook posts inserts (or updates) to the user service.
1139
+        $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
1140
+
1141
+        // Hook the AJAX wl_timeline action to the Timeline service.
1142
+        $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1143
+
1144
+        // Register custom allowed redirect hosts.
1145
+        $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1146
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1147
+        $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1148
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1149
+        $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1150
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1151
+        $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1152
+
1153
+        // Hook save_post to the entity service to update custom fields (such as alternate labels).
1154
+        // We have a priority of 9 because we want to be executed before data is sent to Redlink.
1155
+        $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1156
+        $this->loader->add_action( 'save_post_entity', $this->rating_service, 'set_rating_for', 10, 1 );
1157
+
1158
+        $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1159
+        $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1160
+
1161
+        // Entity listing customization (wp-admin/edit.php)
1162
+        // Add custom columns
1163
+        $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1164
+        $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1165
+        // Add 4W selection
1166
+        $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1167
+        $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1168
+
1169
+        $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1170
+
1171
+        // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1172
+        // entities.
1173
+        $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1174
+
1175
+        // Filter imported post meta.
1176
+        $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1177
+
1178
+        // Notify the import service when an import starts and ends.
1179
+        $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1180
+        $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1181
+
1182
+        // Hook the AJAX wl_rebuild action to the Rebuild Service.
1183
+        $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1184
+
1185
+        // Hook the menu to the Download Your Data page.
1186
+        $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1187
+        $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1188
+        $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1189
+
1190
+        // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1191
+        $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1192
+
1193
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1194
+        $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1195
+
1196
+        // Hook the AJAX wl_validate_key action to the Key Validation service.
1197
+        $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1198
+
1199
+        // Hook the `admin_init` function to the Admin Setup.
1200
+        $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1201
+
1202
+        // Hook the admin_init to the settings page.
1203
+        $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1204
+
1205
+        // Hook the menu creation on the general wordlift menu creation
1206
+        $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1207
+        if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) {
1208
+            // Add the functionality only if a flag is set in wp-config.php .
1209
+            $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 );
1210
+        }
1211
+
1212
+        // Hook key update.
1213
+        $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1214
+        $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1215
+
1216
+        // Add additional action links to the WordLift plugin in the plugins page.
1217
+        $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1218
+
1219
+        // Hook the AJAX `wl_publisher` action name.
1220
+        $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1221 1221
 
1222
-		// Hook row actions for the entity type list admin.
1223
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1222
+        // Hook row actions for the entity type list admin.
1223
+        $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1224 1224
 
1225
-		// Hook capabilities manipulation to allow access to entity type admin
1226
-		// page  on wordpress versions before 4.7.
1227
-		global $wp_version;
1228
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1229
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1230
-		}
1225
+        // Hook capabilities manipulation to allow access to entity type admin
1226
+        // page  on wordpress versions before 4.7.
1227
+        global $wp_version;
1228
+        if ( version_compare( $wp_version, '4.7', '<' ) ) {
1229
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1230
+        }
1231 1231
 
1232
-		$this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1233
-
1234
-		/** Adapters. */
1235
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1236
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_auto_selected_posts', $this->batch_analysis_adapter, 'submit_auto_selected_posts', 10 );
1237
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit', 10 );
1238
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel', 10 );
1239
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning', 10 );
1240
-		$this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all', 10 );
1241
-
1242
-		// Hooks to restrict multisite super admin from manipulating entity types.
1243
-		if ( is_multisite() ) {
1244
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1245
-		}
1246
-	}
1247
-
1248
-	/**
1249
-	 * Register all of the hooks related to the public-facing functionality
1250
-	 * of the plugin.
1251
-	 *
1252
-	 * @since    1.0.0
1253
-	 * @access   private
1254
-	 */
1255
-	private function define_public_hooks() {
1232
+        $this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1233
+
1234
+        /** Adapters. */
1235
+        $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1236
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_auto_selected_posts', $this->batch_analysis_adapter, 'submit_auto_selected_posts', 10 );
1237
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit', 10 );
1238
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel', 10 );
1239
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning', 10 );
1240
+        $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all', 10 );
1241
+
1242
+        // Hooks to restrict multisite super admin from manipulating entity types.
1243
+        if ( is_multisite() ) {
1244
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1245
+        }
1246
+    }
1247
+
1248
+    /**
1249
+     * Register all of the hooks related to the public-facing functionality
1250
+     * of the plugin.
1251
+     *
1252
+     * @since    1.0.0
1253
+     * @access   private
1254
+     */
1255
+    private function define_public_hooks() {
1256 1256
 
1257
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1258
-
1259
-		// Register the entity post type.
1260
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1261
-
1262
-		// Bind the link generation and handling hooks to the entity link service.
1263
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1264
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1265
-		$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 );
1266
-		$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 );
1257
+        $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1258
+
1259
+        // Register the entity post type.
1260
+        $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1261
+
1262
+        // Bind the link generation and handling hooks to the entity link service.
1263
+        $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1264
+        $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1265
+        $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 );
1266
+        $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 );
1267 1267
 
1268
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1269
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1268
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1269
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1270 1270
 
1271
-		// Hook the content filter service to add entity links.
1272
-		$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1271
+        // Hook the content filter service to add entity links.
1272
+        $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1273 1273
 
1274
-		// Hook the AJAX wl_timeline action to the Timeline service.
1275
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1274
+        // Hook the AJAX wl_timeline action to the Timeline service.
1275
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1276 1276
 
1277
-		// Hook the ShareThis service.
1278
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1279
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1277
+        // Hook the ShareThis service.
1278
+        $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1279
+        $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1280 1280
 
1281
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1282
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1281
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1282
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1283 1283
 
1284
-		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1285
-		// in order to tweak WP's `WP_Query` to include entities in queries related
1286
-		// to categories.
1287
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1284
+        // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1285
+        // in order to tweak WP's `WP_Query` to include entities in queries related
1286
+        // to categories.
1287
+        $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1288 1288
 
1289
-		/*
1289
+        /*
1290 1290
 		 * Hook the `pre_get_posts` action to the `Wordlift_Event_Entity_Page_Service`
1291 1291
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1292 1292
 		 * order of start time.
1293 1293
 		 */
1294
-		$this->loader->add_action( 'pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1 );
1295
-
1296
-		$this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1297
-
1298
-	}
1299
-
1300
-	/**
1301
-	 * Run the loader to execute all of the hooks with WordPress.
1302
-	 *
1303
-	 * @since    1.0.0
1304
-	 */
1305
-	public function run() {
1306
-		$this->loader->run();
1307
-	}
1308
-
1309
-	/**
1310
-	 * The name of the plugin used to uniquely identify it within the context of
1311
-	 * WordPress and to define internationalization functionality.
1312
-	 *
1313
-	 * @since     1.0.0
1314
-	 * @return    string    The name of the plugin.
1315
-	 */
1316
-	public function get_plugin_name() {
1317
-		return $this->plugin_name;
1318
-	}
1319
-
1320
-	/**
1321
-	 * The reference to the class that orchestrates the hooks with the plugin.
1322
-	 *
1323
-	 * @since     1.0.0
1324
-	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1325
-	 */
1326
-	public function get_loader() {
1327
-		return $this->loader;
1328
-	}
1329
-
1330
-	/**
1331
-	 * Retrieve the version number of the plugin.
1332
-	 *
1333
-	 * @since     1.0.0
1334
-	 * @return    string    The version number of the plugin.
1335
-	 */
1336
-	public function get_version() {
1337
-		return $this->version;
1338
-	}
1294
+        $this->loader->add_action( 'pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1 );
1295
+
1296
+        $this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1297
+
1298
+    }
1299
+
1300
+    /**
1301
+     * Run the loader to execute all of the hooks with WordPress.
1302
+     *
1303
+     * @since    1.0.0
1304
+     */
1305
+    public function run() {
1306
+        $this->loader->run();
1307
+    }
1308
+
1309
+    /**
1310
+     * The name of the plugin used to uniquely identify it within the context of
1311
+     * WordPress and to define internationalization functionality.
1312
+     *
1313
+     * @since     1.0.0
1314
+     * @return    string    The name of the plugin.
1315
+     */
1316
+    public function get_plugin_name() {
1317
+        return $this->plugin_name;
1318
+    }
1319
+
1320
+    /**
1321
+     * The reference to the class that orchestrates the hooks with the plugin.
1322
+     *
1323
+     * @since     1.0.0
1324
+     * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1325
+     */
1326
+    public function get_loader() {
1327
+        return $this->loader;
1328
+    }
1329
+
1330
+    /**
1331
+     * Retrieve the version number of the plugin.
1332
+     *
1333
+     * @since     1.0.0
1334
+     * @return    string    The version number of the plugin.
1335
+     */
1336
+    public function get_version() {
1337
+        return $this->version;
1338
+    }
1339 1339
 
1340 1340
 }
Please login to merge, or discard this patch.
Spacing   +210 added lines, -210 removed lines patch added patch discarded remove patch
@@ -601,339 +601,339 @@  discard block
 block discarded – undo
601 601
 		 * The class responsible for orchestrating the actions and filters of the
602 602
 		 * core plugin.
603 603
 		 */
604
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
604
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php';
605 605
 
606 606
 		/**
607 607
 		 * The class responsible for defining internationalization functionality
608 608
 		 * of the plugin.
609 609
 		 */
610
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
610
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php';
611 611
 
612 612
 		/**
613 613
 		 * WordLift's supported languages.
614 614
 		 */
615
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
615
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-languages.php';
616 616
 
617 617
 		/**
618 618
 		 * Provide support functions to sanitize data.
619 619
 		 */
620
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
620
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php';
621 621
 
622 622
 		/**
623 623
 		 * The Redirect service.
624 624
 		 */
625
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
625
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php';
626 626
 
627 627
 		/**
628 628
 		 * The Log service.
629 629
 		 */
630
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
630
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php';
631 631
 
632 632
 		/**
633 633
 		 * The configuration service.
634 634
 		 */
635
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
635
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php';
636 636
 
637 637
 		/**
638 638
 		 * The entity post type service (this is the WordPress post type, not the entity schema type).
639 639
 		 */
640
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
640
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-type-service.php';
641 641
 
642 642
 		/**
643 643
 		 * The entity type service (i.e. the schema type).
644 644
 		 */
645
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
645
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php';
646 646
 
647 647
 		/**
648 648
 		 * The entity link service.
649 649
 		 */
650
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
650
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php';
651 651
 
652 652
 		/**
653 653
 		 * The Query builder.
654 654
 		 */
655
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
655
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php';
656 656
 
657 657
 		/**
658 658
 		 * The Schema service.
659 659
 		 */
660
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
660
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php';
661 661
 
662 662
 		/**
663 663
 		 * The schema:url property service.
664 664
 		 */
665
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
666
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
665
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php';
666
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php';
667 667
 
668 668
 		/**
669 669
 		 * The UI service.
670 670
 		 */
671
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
671
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php';
672 672
 
673 673
 		/**
674 674
 		 * The Thumbnail service.
675 675
 		 */
676
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
676
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php';
677 677
 
678 678
 		/**
679 679
 		 * The Entity Types Taxonomy service.
680 680
 		 */
681
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
681
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-types-taxonomy-service.php';
682 682
 
683 683
 		/**
684 684
 		 * The Entity service.
685 685
 		 */
686
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
686
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php';
687 687
 
688 688
 		// Add the entity rating service.
689
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
689
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rating-service.php';
690 690
 
691 691
 		/**
692 692
 		 * The User service.
693 693
 		 */
694
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
694
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php';
695 695
 
696 696
 		/**
697 697
 		 * The Timeline service.
698 698
 		 */
699
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
699
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php';
700 700
 
701 701
 		/**
702 702
 		 * The Topic Taxonomy service.
703 703
 		 */
704
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
704
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php';
705 705
 
706 706
 		/**
707 707
 		 * The SPARQL service.
708 708
 		 */
709
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
709
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sparql-service.php';
710 710
 
711 711
 		/**
712 712
 		 * The WordLift import service.
713 713
 		 */
714
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
714
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-import-service.php';
715 715
 
716 716
 		/**
717 717
 		 * The WordLift URI service.
718 718
 		 */
719
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
719
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php';
720 720
 
721
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php';
721
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-listable.php';
722 722
 
723
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
723
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-factory.php';
724 724
 
725 725
 		/**
726 726
 		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
727 727
 		 */
728
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php';
728
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rebuild-service.php';
729 729
 
730
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
730
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/properties/class-wordlift-property-getter-factory.php';
731 731
 
732
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
732
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-attachment-service.php';
733 733
 
734 734
 		/**
735 735
 		 * Load the converters.
736 736
 		 */
737
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
738
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
739
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
740
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
741
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
742
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
737
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/intf-wordlift-post-converter.php';
738
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
739
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-postid-to-jsonld-converter.php';
740
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-to-jsonld-converter.php';
741
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-to-jsonld-converter.php';
742
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-website-converter.php';
743 743
 
744 744
 		/**
745 745
 		 * Load the content filter.
746 746
 		 */
747
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
747
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-content-filter-service.php';
748 748
 
749 749
 		/*
750 750
 		 * Load the excerpt helper.
751 751
 		 */
752
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
752
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-excerpt-helper.php';
753 753
 
754 754
 		/**
755 755
 		 * Load the JSON-LD service to publish entities using JSON-LD.s
756 756
 		 *
757 757
 		 * @since 3.8.0
758 758
 		 */
759
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
759
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-service.php';
760 760
 
761 761
 		// The Publisher Service and the AJAX adapter.
762
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
763
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
762
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-service.php';
763
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-ajax-adapter.php';
764 764
 
765
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
765
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-adapter.php';
766 766
 
767 767
 		/**
768 768
 		 * Load the WordLift key validation service.
769 769
 		 */
770
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
770
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php';
771 771
 
772 772
 		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
773
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
773
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php';
774 774
 
775 775
 		// Load the `Wordlift_Event_Entity_Page_Service` class definition.
776
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-event-entity-page-service.php';
777
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-analysis-service.php';
778
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-rebuild-service.php';
776
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-event-entity-page-service.php';
777
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-batch-analysis-service.php';
778
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-rebuild-service.php';
779 779
 
780 780
 		/** Adapters. */
781
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
782
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
783
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-analysis-adapter.php';
784
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-rebuild-adapter.php';
781
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php';
782
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-newrelic-adapter.php';
783
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-batch-analysis-adapter.php';
784
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-rebuild-adapter.php';
785 785
 
786 786
 		/** Async Tasks. */
787
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/wp-async-task.php';
788
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
789
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
790
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
787
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/wp-async-task.php';
788
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
789
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
790
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
791 791
 
792 792
 		/**
793 793
 		 * The class responsible for defining all actions that occur in the admin area.
794 794
 		 */
795
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
795
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php';
796 796
 
797 797
 		/**
798 798
 		 * The class to customize the entity list admin page.
799 799
 		 */
800
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
800
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php';
801 801
 
802 802
 		/**
803 803
 		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
804 804
 		 */
805
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
805
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php';
806 806
 
807 807
 		/**
808 808
 		 * The Notice service.
809 809
 		 */
810
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
810
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php';
811 811
 
812 812
 		/**
813 813
 		 * The PrimaShop adapter.
814 814
 		 */
815
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
815
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php';
816 816
 
817 817
 		/**
818 818
 		 * The WordLift Dashboard service.
819 819
 		 */
820
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
820
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php';
821 821
 
822 822
 		/**
823 823
 		 * The admin 'Install wizard' page.
824 824
 		 */
825
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
825
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php';
826 826
 
827 827
 		/**
828 828
 		 * The WordLift entity type list admin page controller.
829 829
 		 */
830
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
830
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
831 831
 
832 832
 		/**
833 833
 		 * The WordLift entity type settings admin page controller.
834 834
 		 */
835
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
835
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php';
836 836
 
837 837
 		/**
838 838
 		 * The admin 'Download Your Data' page.
839 839
 		 */
840
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
840
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php';
841 841
 
842 842
 		/**
843 843
 		 * The admin 'Download Your Data' page.
844 844
 		 */
845
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
845
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php';
846 846
 
847 847
 		/**
848 848
 		 * The admin 'WordLift Settings' page.
849 849
 		 */
850
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
851
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
852
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
853
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
854
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
855
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
856
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
857
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
858
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
859
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
860
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php';
861
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
850
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/intf-wordlift-admin-element.php';
851
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-input-element.php';
852
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-input-radio-element.php';
853
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-select2-element.php';
854
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-language-select-element.php';
855
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-tabs-element.php';
856
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-author-element.php';
857
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-publisher-element.php';
858
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php';
859
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php';
860
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-batch-analysis-page.php';
861
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php';
862 862
 
863 863
 		/** Admin Pages */
864
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
865
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
866
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
864
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php';
865
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-user-profile-page.php';
866
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-status-page.php';
867 867
 
868 868
 		/**
869 869
 		 * The class responsible for defining all actions that occur in the public-facing
870 870
 		 * side of the site.
871 871
 		 */
872
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
872
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php';
873 873
 
874 874
 		/**
875 875
 		 * The shortcode abstract class.
876 876
 		 */
877
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
877
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php';
878 878
 
879 879
 		/**
880 880
 		 * The Timeline shortcode.
881 881
 		 */
882
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
882
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php';
883 883
 
884 884
 		/**
885 885
 		 * The Navigator shortcode.
886 886
 		 */
887
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
887
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php';
888 888
 
889 889
 		/**
890 890
 		 * The chord shortcode.
891 891
 		 */
892
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
892
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php';
893 893
 
894 894
 		/**
895 895
 		 * The geomap shortcode.
896 896
 		 */
897
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
897
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php';
898 898
 
899 899
 		/**
900 900
 		 * The entity cloud shortcode.
901 901
 		 */
902
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
902
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php';
903 903
 
904 904
 		/**
905 905
 		 * The ShareThis service.
906 906
 		 */
907
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
907
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php';
908 908
 
909 909
 		/**
910 910
 		 * The SEO service.
911 911
 		 */
912
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
912
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php';
913 913
 
914 914
 		/**
915 915
 		 * The AMP service.
916 916
 		 */
917
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
917
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-amp-service.php';
918 918
 
919 919
 		/** Widgets */
920
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
921
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
920
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php';
921
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php';
922 922
 
923 923
 		$this->loader = new Wordlift_Loader();
924 924
 
925 925
 		// Instantiate a global logger.
926 926
 		global $wl_logger;
927
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
927
+		$wl_logger = Wordlift_Log_Service::get_logger('WordLift');
928 928
 
929 929
 		// Create the configuration service.
930 930
 		$this->configuration_service = new Wordlift_Configuration_Service();
931 931
 
932 932
 		// Create an entity type service instance. It'll be later bound to the init action.
933
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
933
+		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path());
934 934
 
935 935
 		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
936
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
936
+		$this->entity_link_service = new Wordlift_Entity_Link_Service($this->entity_post_type_service, $this->configuration_service->get_entity_base_path());
937 937
 
938 938
 		// Create an instance of the UI service.
939 939
 		$this->ui_service = new Wordlift_UI_Service();
@@ -944,23 +944,23 @@  discard block
 block discarded – undo
944 944
 		$this->sparql_service = new Wordlift_Sparql_Service();
945 945
 
946 946
 		// Create an instance of the Schema service.
947
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
947
+		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service($this->sparql_service);
948 948
 		$this->schema_service        = new Wordlift_Schema_Service();
949 949
 
950 950
 		// Create an instance of the Notice service.
951 951
 		$this->notice_service = new Wordlift_Notice_Service();
952 952
 
953 953
 		// Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page.
954
-		$this->entity_service = new Wordlift_Entity_Service( $this->ui_service );
954
+		$this->entity_service = new Wordlift_Entity_Service($this->ui_service);
955 955
 
956 956
 		// Create an instance of the User service.
957 957
 		$this->user_service = new Wordlift_User_Service();
958 958
 
959 959
 		// Create a new instance of the Timeline service and Timeline shortcode.
960
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
960
+		$this->timeline_service = new Wordlift_Timeline_Service($this->entity_service);
961 961
 
962 962
 		// Create a new instance of the Redirect service.
963
-		$this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service );
963
+		$this->redirect_service = new Wordlift_Redirect_Service($this->entity_service);
964 964
 
965 965
 		// Initialize the shortcodes.
966 966
 		new Wordlift_Navigator_Shortcode();
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
 		// Initialize the AMP service.
976 976
 		new Wordlift_AMP_Service();
977 977
 
978
-		$this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service );
978
+		$this->batch_analysis_service = new Wordlift_Batch_Analysis_Service($this, $this->configuration_service);
979 979
 
980 980
 		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
981 981
 
@@ -988,47 +988,47 @@  discard block
 block discarded – undo
988 988
 		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
989 989
 
990 990
 		// Create an import service instance to hook later to WP's import function.
991
-		$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() );
991
+		$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());
992 992
 
993
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
993
+		$uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']);
994 994
 
995 995
 		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
996
-		$this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service );
996
+		$this->rebuild_service = new Wordlift_Rebuild_Service($this->sparql_service, $uri_service);
997 997
 
998
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
998
+		$this->entity_type_service = new Wordlift_Entity_Type_Service($this->schema_service);
999 999
 
1000 1000
 		// Create the entity rating service.
1001
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1001
+		$this->rating_service = new Wordlift_Rating_Service($this->entity_service, $this->entity_type_service, $this->notice_service);
1002 1002
 
1003 1003
 		// Create entity list customization (wp-admin/edit.php)
1004
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1004
+		$this->entity_list_service = new Wordlift_Entity_List_Service($this->rating_service);
1005 1005
 
1006 1006
 		// Create a new instance of the Redirect service.
1007
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service );
1007
+		$this->dashboard_service = new Wordlift_Dashboard_Service($this->rating_service);
1008 1008
 
1009
-		$this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service );
1010
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1009
+		$this->property_factory = new Wordlift_Property_Factory($schema_url_property_service);
1010
+		$this->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service);
1011 1011
 
1012 1012
 		$attachment_service = new Wordlift_Attachment_Service();
1013 1013
 
1014 1014
 		// Instantiate the JSON-LD service.
1015
-		$property_getter                       = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1016
-		$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 );
1017
-		$this->post_to_jsonld_converter        = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service, $this->entity_post_to_jsonld_converter );
1018
-		$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 );
1019
-		$this->jsonld_website_converter        = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service, $this->entity_post_to_jsonld_converter );
1020
-		$this->jsonld_service                  = new Wordlift_Jsonld_Service( $this->entity_service, $this->postid_to_jsonld_converter, $this->jsonld_website_converter );
1021
-
1022
-		$this->key_validation_service   = new Wordlift_Key_Validation_Service( $this->configuration_service );
1015
+		$property_getter                       = Wordlift_Property_Getter_Factory::create($this->entity_service);
1016
+		$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);
1017
+		$this->post_to_jsonld_converter        = new Wordlift_Post_To_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service, $this->entity_post_to_jsonld_converter);
1018
+		$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);
1019
+		$this->jsonld_website_converter        = new Wordlift_Website_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service, $this->entity_post_to_jsonld_converter);
1020
+		$this->jsonld_service                  = new Wordlift_Jsonld_Service($this->entity_service, $this->postid_to_jsonld_converter, $this->jsonld_website_converter);
1021
+
1022
+		$this->key_validation_service   = new Wordlift_Key_Validation_Service($this->configuration_service);
1023 1023
 		$publisher_service              = new Wordlift_Publisher_Service();
1024
-		$this->content_filter_service   = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service );
1025
-		$this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1024
+		$this->content_filter_service   = new Wordlift_Content_Filter_Service($this->entity_service, $this->configuration_service);
1025
+		$this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service($this->content_filter_service, $this->entity_service);
1026 1026
 
1027 1027
 		/** Adapters. */
1028
-		$this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter( $publisher_service );
1029
-		$this->tinymce_adapter          = new Wordlift_Tinymce_Adapter( $this );
1030
-		$this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service );
1031
-		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1028
+		$this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter($publisher_service);
1029
+		$this->tinymce_adapter          = new Wordlift_Tinymce_Adapter($this);
1030
+		$this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter($this->batch_analysis_service);
1031
+		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter($this->relation_rebuild_service);
1032 1032
 
1033 1033
 		/** Async Tasks. */
1034 1034
 		new Wordlift_Sparql_Query_Async_Task();
@@ -1043,16 +1043,16 @@  discard block
 block discarded – undo
1043 1043
 		$this->select2_element         = new Wordlift_Admin_Select2_Element();
1044 1044
 		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1045 1045
 		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
1046
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element );
1047
-		$this->author_element          = new Wordlift_Admin_Author_Element( $publisher_service, $this->select2_element );
1046
+		$this->publisher_element       = new Wordlift_Admin_Publisher_Element($this->configuration_service, $publisher_service, $tabs_element, $this->select2_element);
1047
+		$this->author_element          = new Wordlift_Admin_Author_Element($publisher_service, $this->select2_element);
1048 1048
 
1049
-		$this->download_your_data_page   = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1050
-		$this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element );
1051
-		$this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service );
1052
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1049
+		$this->download_your_data_page   = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service);
1050
+		$this->settings_page             = new Wordlift_Admin_Settings_Page($this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element);
1051
+		$this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page($this->batch_analysis_service);
1052
+		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($this->settings_page);
1053 1053
 
1054 1054
 		// Pages.
1055
-		new Wordlift_Admin_Post_Edit_Page( $this );
1055
+		new Wordlift_Admin_Post_Edit_Page($this);
1056 1056
 
1057 1057
 		// create an instance of the entity type list admin page controller.
1058 1058
 		$this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
@@ -1064,23 +1064,23 @@  discard block
 block discarded – undo
1064 1064
 		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1065 1065
 
1066 1066
 		//** WordPress Admin */
1067
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1068
-		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1067
+		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service);
1068
+		$this->status_page             = new Wordlift_Admin_Status_Page($this->entity_service, $this->sparql_service);
1069 1069
 
1070 1070
 		// Create an instance of the install wizard.
1071
-		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1071
+		$this->admin_setup = new Wordlift_Admin_Setup($this->configuration_service, $this->key_validation_service, $this->entity_service);
1072 1072
 
1073
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1073
+		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($this->entity_post_type_service);
1074 1074
 
1075 1075
 		// User Profile.
1076
-		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1076
+		new Wordlift_Admin_User_Profile_Page($this->author_element, $this->user_service);
1077 1077
 
1078 1078
 		$this->event_entity_page_service = new Wordlift_Event_Entity_Page_Service();
1079 1079
 
1080 1080
 		// Load the debug service if WP is in debug mode.
1081
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1082
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1083
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1081
+		if (defined('WP_DEBUG') && WP_DEBUG) {
1082
+			require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php';
1083
+			new Wordlift_Debug_Service($this->entity_service, $uri_service);
1084 1084
 		}
1085 1085
 
1086 1086
 	}
@@ -1097,9 +1097,9 @@  discard block
 block discarded – undo
1097 1097
 	private function set_locale() {
1098 1098
 
1099 1099
 		$plugin_i18n = new Wordlift_i18n();
1100
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1100
+		$plugin_i18n->set_domain($this->get_plugin_name());
1101 1101
 
1102
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1102
+		$this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain');
1103 1103
 
1104 1104
 	}
1105 1105
 
@@ -1120,128 +1120,128 @@  discard block
 block discarded – undo
1120 1120
 			$this->user_service
1121 1121
 		);
1122 1122
 
1123
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1124
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1123
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles');
1124
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts');
1125 1125
 
1126 1126
 		// Hook the init action to the Topic Taxonomy service.
1127
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1127
+		$this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0);
1128 1128
 
1129 1129
 		// Hook the deleted_post_meta action to the Thumbnail service.
1130
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1130
+		$this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4);
1131 1131
 
1132 1132
 		// Hook the added_post_meta action to the Thumbnail service.
1133
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1133
+		$this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4);
1134 1134
 
1135 1135
 		// Hook the updated_post_meta action to the Thumbnail service.
1136
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1136
+		$this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4);
1137 1137
 
1138 1138
 		// Hook posts inserts (or updates) to the user service.
1139
-		$this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
1139
+		$this->loader->add_action('wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3);
1140 1140
 
1141 1141
 		// Hook the AJAX wl_timeline action to the Timeline service.
1142
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1142
+		$this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline');
1143 1143
 
1144 1144
 		// Register custom allowed redirect hosts.
1145
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1145
+		$this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts');
1146 1146
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1147
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1147
+		$this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect');
1148 1148
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1149
-		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1149
+		$this->loader->add_action('wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats');
1150 1150
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1151
-		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1151
+		$this->loader->add_action('wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets');
1152 1152
 
1153 1153
 		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1154 1154
 		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1155
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1156
-		$this->loader->add_action( 'save_post_entity', $this->rating_service, 'set_rating_for', 10, 1 );
1155
+		$this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3);
1156
+		$this->loader->add_action('save_post_entity', $this->rating_service, 'set_rating_for', 10, 1);
1157 1157
 
1158
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1159
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1158
+		$this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1);
1159
+		$this->loader->add_action('in_admin_header', $this->rating_service, 'in_admin_header');
1160 1160
 
1161 1161
 		// Entity listing customization (wp-admin/edit.php)
1162 1162
 		// Add custom columns
1163
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1164
-		$this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1163
+		$this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns');
1164
+		$this->loader->add_filter('manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2);
1165 1165
 		// Add 4W selection
1166
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1167
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1166
+		$this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope');
1167
+		$this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope');
1168 1168
 
1169
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1169
+		$this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args');
1170 1170
 
1171 1171
 		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1172 1172
 		// entities.
1173
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1173
+		$this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2);
1174 1174
 
1175 1175
 		// Filter imported post meta.
1176
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1176
+		$this->loader->add_filter('wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3);
1177 1177
 
1178 1178
 		// Notify the import service when an import starts and ends.
1179
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1180
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1179
+		$this->loader->add_action('import_start', $this->import_service, 'import_start', 10, 0);
1180
+		$this->loader->add_action('import_end', $this->import_service, 'import_end', 10, 0);
1181 1181
 
1182 1182
 		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1183
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1183
+		$this->loader->add_action('wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild');
1184 1184
 
1185 1185
 		// Hook the menu to the Download Your Data page.
1186
-		$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1187
-		$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1188
-		$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1186
+		$this->loader->add_action('admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0);
1187
+		$this->loader->add_action('admin_menu', $this->status_page, 'admin_menu', 100, 0);
1188
+		$this->loader->add_action('admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0);
1189 1189
 
1190 1190
 		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1191
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1191
+		$this->loader->add_action('wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10);
1192 1192
 
1193 1193
 		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1194
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1194
+		$this->loader->add_action('wp_ajax_wl_jsonld', $this->jsonld_service, 'get');
1195 1195
 
1196 1196
 		// Hook the AJAX wl_validate_key action to the Key Validation service.
1197
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1197
+		$this->loader->add_action('wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key');
1198 1198
 
1199 1199
 		// Hook the `admin_init` function to the Admin Setup.
1200
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1200
+		$this->loader->add_action('admin_init', $this->admin_setup, 'admin_init');
1201 1201
 
1202 1202
 		// Hook the admin_init to the settings page.
1203
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1203
+		$this->loader->add_action('admin_init', $this->settings_page, 'admin_init');
1204 1204
 
1205 1205
 		// Hook the menu creation on the general wordlift menu creation
1206
-		$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1207
-		if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) {
1206
+		$this->loader->add_action('wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2);
1207
+		if (defined('WORDLIFT_BATCH') && WORDLIFT_BATCH) {
1208 1208
 			// Add the functionality only if a flag is set in wp-config.php .
1209
-			$this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 );
1209
+			$this->loader->add_action('wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2);
1210 1210
 		}
1211 1211
 
1212 1212
 		// Hook key update.
1213
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1214
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1213
+		$this->loader->add_action('pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2);
1214
+		$this->loader->add_action('update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2);
1215 1215
 
1216 1216
 		// Add additional action links to the WordLift plugin in the plugins page.
1217
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1217
+		$this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1);
1218 1218
 
1219 1219
 		// Hook the AJAX `wl_publisher` action name.
1220
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1220
+		$this->loader->add_action('wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher');
1221 1221
 
1222 1222
 		// Hook row actions for the entity type list admin.
1223
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1223
+		$this->loader->add_filter('wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2);
1224 1224
 
1225 1225
 		// Hook capabilities manipulation to allow access to entity type admin
1226 1226
 		// page  on wordpress versions before 4.7.
1227 1227
 		global $wp_version;
1228
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1229
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1228
+		if (version_compare($wp_version, '4.7', '<')) {
1229
+			$this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4);
1230 1230
 		}
1231 1231
 
1232
-		$this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1232
+		$this->loader->add_action('wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1);
1233 1233
 
1234 1234
 		/** Adapters. */
1235
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1236
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_auto_selected_posts', $this->batch_analysis_adapter, 'submit_auto_selected_posts', 10 );
1237
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit', 10 );
1238
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel', 10 );
1239
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning', 10 );
1240
-		$this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all', 10 );
1235
+		$this->loader->add_filter('mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1);
1236
+		$this->loader->add_action('wp_ajax_wl_batch_analysis_submit_auto_selected_posts', $this->batch_analysis_adapter, 'submit_auto_selected_posts', 10);
1237
+		$this->loader->add_action('wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit', 10);
1238
+		$this->loader->add_action('wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel', 10);
1239
+		$this->loader->add_action('wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning', 10);
1240
+		$this->loader->add_action('wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all', 10);
1241 1241
 
1242 1242
 		// Hooks to restrict multisite super admin from manipulating entity types.
1243
-		if ( is_multisite() ) {
1244
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1243
+		if (is_multisite()) {
1244
+			$this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4);
1245 1245
 		}
1246 1246
 	}
1247 1247
 
@@ -1254,46 +1254,46 @@  discard block
 block discarded – undo
1254 1254
 	 */
1255 1255
 	private function define_public_hooks() {
1256 1256
 
1257
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1257
+		$plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version());
1258 1258
 
1259 1259
 		// Register the entity post type.
1260
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1260
+		$this->loader->add_action('init', $this->entity_post_type_service, 'register');
1261 1261
 
1262 1262
 		// Bind the link generation and handling hooks to the entity link service.
1263
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1264
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1265
-		$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 );
1266
-		$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 );
1263
+		$this->loader->add_filter('post_type_link', $this->entity_link_service, 'post_type_link', 10, 4);
1264
+		$this->loader->add_action('pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1);
1265
+		$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);
1266
+		$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);
1267 1267
 
1268
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1269
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1268
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles');
1269
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts');
1270 1270
 
1271 1271
 		// Hook the content filter service to add entity links.
1272
-		$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1272
+		$this->loader->add_filter('the_content', $this->content_filter_service, 'the_content');
1273 1273
 
1274 1274
 		// Hook the AJAX wl_timeline action to the Timeline service.
1275
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1275
+		$this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline');
1276 1276
 
1277 1277
 		// Hook the ShareThis service.
1278
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1279
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1278
+		$this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99);
1279
+		$this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99);
1280 1280
 
1281 1281
 		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1282
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1282
+		$this->loader->add_action('wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get');
1283 1283
 
1284 1284
 		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1285 1285
 		// in order to tweak WP's `WP_Query` to include entities in queries related
1286 1286
 		// to categories.
1287
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1287
+		$this->loader->add_action('pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1);
1288 1288
 
1289 1289
 		/*
1290 1290
 		 * Hook the `pre_get_posts` action to the `Wordlift_Event_Entity_Page_Service`
1291 1291
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1292 1292
 		 * order of start time.
1293 1293
 		 */
1294
-		$this->loader->add_action( 'pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1 );
1294
+		$this->loader->add_action('pre_get_posts', $this->event_entity_page_service, 'pre_get_posts', 10, 1);
1295 1295
 
1296
-		$this->loader->add_action( 'wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1296
+		$this->loader->add_action('wp_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1);
1297 1297
 
1298 1298
 	}
1299 1299
 
Please login to merge, or discard this patch.