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