Completed
Push — master ( 869d34...bbf050 )
by David
03:41
created
src/wordlift.php 2 patches
Indentation   +253 added lines, -253 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,10 +170,10 @@  discard block
 block discarded – undo
170 170
  */
171 171
 function wordlift_register_tinymce_javascript( $plugin_array ) {
172 172
 
173
-	// add the wordlift plugin.
174
-	$plugin_array['wordlift'] = plugin_dir_url( __FILE__ ) . 'js/wordlift-reloaded.js';
173
+    // add the wordlift plugin.
174
+    $plugin_array['wordlift'] = plugin_dir_url( __FILE__ ) . 'js/wordlift-reloaded.js';
175 175
 
176
-	return $plugin_array;
176
+    return $plugin_array;
177 177
 }
178 178
 
179 179
 /**
@@ -181,21 +181,21 @@  discard block
 block discarded – undo
181 181
  * see http://vip.wordpress.com/documentation/register-additional-html-attributes-for-tinymce-and-wp-kses/
182 182
  */
183 183
 function wordlift_allowed_post_tags() {
184
-	global $allowedposttags;
185
-
186
-	$tags           = array( 'span' );
187
-	$new_attributes = array(
188
-		'itemscope' => array(),
189
-		'itemtype'  => array(),
190
-		'itemprop'  => array(),
191
-		'itemid'    => array()
192
-	);
193
-
194
-	foreach ( $tags as $tag ) {
195
-		if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) {
196
-			$allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes );
197
-		}
198
-	}
184
+    global $allowedposttags;
185
+
186
+    $tags           = array( 'span' );
187
+    $new_attributes = array(
188
+        'itemscope' => array(),
189
+        'itemtype'  => array(),
190
+        'itemprop'  => array(),
191
+        'itemid'    => array()
192
+    );
193
+
194
+    foreach ( $tags as $tag ) {
195
+        if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) {
196
+            $allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes );
197
+        }
198
+    }
199 199
 }
200 200
 
201 201
 // init process for button control
@@ -209,28 +209,28 @@  discard block
 block discarded – undo
209 209
  */
210 210
 function wordlift_admin_enqueue_scripts() {
211 211
 
212
-	// Added for compatibility with WordPress 3.9 (see http://make.wordpress.org/core/2014/04/16/jquery-ui-and-wpdialogs-in-wordpress-3-9/)
213
-	wp_enqueue_script( 'wpdialogs' );
214
-	wp_enqueue_style( 'wp-jquery-ui-dialog' );
212
+    // Added for compatibility with WordPress 3.9 (see http://make.wordpress.org/core/2014/04/16/jquery-ui-and-wpdialogs-in-wordpress-3-9/)
213
+    wp_enqueue_script( 'wpdialogs' );
214
+    wp_enqueue_style( 'wp-jquery-ui-dialog' );
215 215
 
216
-	wp_enqueue_style( 'wordlift-reloaded', plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css' );
216
+    wp_enqueue_style( 'wordlift-reloaded', plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css' );
217 217
 
218
-	wp_enqueue_script( 'jquery-ui-autocomplete' );
219
-	wp_enqueue_script( 'angularjs', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js' );
220
-	wp_enqueue_script( 'angularjs-geolocation', plugin_dir_url( __FILE__ ) . '/bower_components/angularjs-geolocation/dist/angularjs-geolocation.min.js' );
221
-	wp_enqueue_script( 'angularjs-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js' );
222
-	wp_enqueue_script( 'angularjs-animate', 'https://code.angularjs.org/1.3.11/angular-animate.min.js' );
218
+    wp_enqueue_script( 'jquery-ui-autocomplete' );
219
+    wp_enqueue_script( 'angularjs', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js' );
220
+    wp_enqueue_script( 'angularjs-geolocation', plugin_dir_url( __FILE__ ) . '/bower_components/angularjs-geolocation/dist/angularjs-geolocation.min.js' );
221
+    wp_enqueue_script( 'angularjs-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js' );
222
+    wp_enqueue_script( 'angularjs-animate', 'https://code.angularjs.org/1.3.11/angular-animate.min.js' );
223 223
 
224
-	// Disable auto-save for custom entity posts only
225
-	if ( Wordlift_Entity_Service::TYPE_NAME === get_post_type() ) {
226
-		wp_dequeue_script( 'autosave' );
227
-	}
224
+    // Disable auto-save for custom entity posts only
225
+    if ( Wordlift_Entity_Service::TYPE_NAME === get_post_type() ) {
226
+        wp_dequeue_script( 'autosave' );
227
+    }
228 228
 }
229 229
 
230 230
 add_action( 'admin_enqueue_scripts', 'wordlift_admin_enqueue_scripts' );
231 231
 
232 232
 function wl_enqueue_scripts() {
233
-	wp_enqueue_style( 'wordlift-ui', plugin_dir_url( __FILE__ ) . 'css/wordlift-ui.min.css' );
233
+    wp_enqueue_style( 'wordlift-ui', plugin_dir_url( __FILE__ ) . 'css/wordlift-ui.min.css' );
234 234
 }
235 235
 
236 236
 add_action( 'wp_enqueue_scripts', 'wl_enqueue_scripts' );
@@ -245,18 +245,18 @@  discard block
 block discarded – undo
245 245
  */
246 246
 function wordlift_allowed_html( $allowedtags, $context ) {
247 247
 
248
-	if ( 'post' !== $context ) {
249
-		return $allowedtags;
250
-	}
251
-
252
-	return array_merge_recursive( $allowedtags, array(
253
-		'span' => array(
254
-			'itemscope' => TRUE,
255
-			'itemtype'  => TRUE,
256
-			'itemid'    => TRUE,
257
-			'itemprop'  => TRUE
258
-		)
259
-	) );
248
+    if ( 'post' !== $context ) {
249
+        return $allowedtags;
250
+    }
251
+
252
+    return array_merge_recursive( $allowedtags, array(
253
+        'span' => array(
254
+            'itemscope' => TRUE,
255
+            'itemtype'  => TRUE,
256
+            'itemid'    => TRUE,
257
+            'itemprop'  => TRUE
258
+        )
259
+    ) );
260 260
 }
261 261
 
262 262
 add_filter( 'wp_kses_allowed_html', 'wordlift_allowed_html', 10, 2 );
@@ -270,15 +270,15 @@  discard block
 block discarded – undo
270 270
  */
271 271
 function wl_get_coordinates( $post_id ) {
272 272
 
273
-	$latitude  = wl_schema_get_value( $post_id, 'latitude' );
274
-	$longitude = wl_schema_get_value( $post_id, 'longitude' );
273
+    $latitude  = wl_schema_get_value( $post_id, 'latitude' );
274
+    $longitude = wl_schema_get_value( $post_id, 'longitude' );
275 275
 
276
-	// DO NOT set latitude/longitude to 0/0 as default values. It's a specific place on the globe:
277
-	// "The zero/zero point of this system is located in the Gulf of Guinea about 625 km (390 mi) south of Tema, Ghana."
278
-	return array(
279
-		'latitude'  => isset( $latitude[0] ) && is_numeric( $latitude[0] ) ? $latitude[0] : '',
280
-		'longitude' => isset( $longitude[0] ) && is_numeric( $longitude[0] ) ? $longitude[0] : ''
281
-	);
276
+    // DO NOT set latitude/longitude to 0/0 as default values. It's a specific place on the globe:
277
+    // "The zero/zero point of this system is located in the Gulf of Guinea about 625 km (390 mi) south of Tema, Ghana."
278
+    return array(
279
+        'latitude'  => isset( $latitude[0] ) && is_numeric( $latitude[0] ) ? $latitude[0] : '',
280
+        'longitude' => isset( $longitude[0] ) && is_numeric( $longitude[0] ) ? $longitude[0] : ''
281
+    );
282 282
 }
283 283
 
284 284
 /**
@@ -290,13 +290,13 @@  discard block
 block discarded – undo
290 290
  */
291 291
 function wl_get_post_modified_time( $post ) {
292 292
 
293
-	$date_modified = get_post_modified_time( 'c', TRUE, $post );
293
+    $date_modified = get_post_modified_time( 'c', TRUE, $post );
294 294
 
295
-	if ( '-' === substr( $date_modified, 0, 1 ) ) {
296
-		return get_the_time( 'c', $post );
297
-	}
295
+    if ( '-' === substr( $date_modified, 0, 1 ) ) {
296
+        return get_the_time( 'c', $post );
297
+    }
298 298
 
299
-	return $date_modified;
299
+    return $date_modified;
300 300
 }
301 301
 
302 302
 /**
@@ -309,42 +309,42 @@  discard block
 block discarded – undo
309 309
 function wl_get_image_urls( $post_id ) {
310 310
 
311 311
 
312
-	// If there is a featured image it has the priority
313
-	$featured_image_id = get_post_thumbnail_id( $post_id );
314
-	if ( is_numeric( $featured_image_id ) ) {
315
-		$image_url = wp_get_attachment_url( $featured_image_id );
312
+    // If there is a featured image it has the priority
313
+    $featured_image_id = get_post_thumbnail_id( $post_id );
314
+    if ( is_numeric( $featured_image_id ) ) {
315
+        $image_url = wp_get_attachment_url( $featured_image_id );
316 316
 
317
-		return array( $image_url );
318
-	}
317
+        return array( $image_url );
318
+    }
319 319
 
320
-	// wl_write_log( "wl_get_image_urls [ post id :: $post_id ]" );
320
+    // wl_write_log( "wl_get_image_urls [ post id :: $post_id ]" );
321 321
 
322
-	$images = get_children( array(
323
-		'post_parent'    => $post_id,
324
-		'post_type'      => 'attachment',
325
-		'post_mime_type' => 'image'
326
-	) );
322
+    $images = get_children( array(
323
+        'post_parent'    => $post_id,
324
+        'post_type'      => 'attachment',
325
+        'post_mime_type' => 'image'
326
+    ) );
327 327
 
328
-	// Return an empty array if no image is found.
329
-	if ( empty( $images ) ) {
330
-		return array();
331
-	}
328
+    // Return an empty array if no image is found.
329
+    if ( empty( $images ) ) {
330
+        return array();
331
+    }
332 332
 
333
-	// Prepare the return array.
334
-	$image_urls = array();
333
+    // Prepare the return array.
334
+    $image_urls = array();
335 335
 
336
-	// Collect the URLs.
337
-	foreach ( $images as $attachment_id => $attachment ) {
338
-		$image_url = wp_get_attachment_url( $attachment_id );
339
-		// Ensure the URL isn't collected already.
340
-		if ( ! in_array( $image_url, $image_urls ) ) {
341
-			array_push( $image_urls, $image_url );
342
-		}
343
-	}
336
+    // Collect the URLs.
337
+    foreach ( $images as $attachment_id => $attachment ) {
338
+        $image_url = wp_get_attachment_url( $attachment_id );
339
+        // Ensure the URL isn't collected already.
340
+        if ( ! in_array( $image_url, $image_urls ) ) {
341
+            array_push( $image_urls, $image_url );
342
+        }
343
+    }
344 344
 
345
-	// wl_write_log( "wl_get_image_urls [ post id :: $post_id ][ image urls count :: " . count( $image_urls ) . " ]" );
345
+    // wl_write_log( "wl_get_image_urls [ post id :: $post_id ][ image urls count :: " . count( $image_urls ) . " ]" );
346 346
 
347
-	return $image_urls;
347
+    return $image_urls;
348 348
 }
349 349
 
350 350
 /**
@@ -357,19 +357,19 @@  discard block
 block discarded – undo
357 357
  */
358 358
 function wl_get_sparql_images( $uri, $post_id ) {
359 359
 
360
-	$sparql = '';
360
+    $sparql = '';
361 361
 
362
-	// Get the escaped URI.
363
-	$uri_e = esc_html( $uri );
362
+    // Get the escaped URI.
363
+    $uri_e = esc_html( $uri );
364 364
 
365
-	// Add SPARQL stmts to write the schema:image.
366
-	$image_urls = wl_get_image_urls( $post_id );
367
-	foreach ( $image_urls as $image_url ) {
368
-		$image_url_esc = wl_sparql_escape_uri( $image_url );
369
-		$sparql .= " <$uri_e> schema:image <$image_url_esc> . \n";
370
-	}
365
+    // Add SPARQL stmts to write the schema:image.
366
+    $image_urls = wl_get_image_urls( $post_id );
367
+    foreach ( $image_urls as $image_url ) {
368
+        $image_url_esc = wl_sparql_escape_uri( $image_url );
369
+        $sparql .= " <$uri_e> schema:image <$image_url_esc> . \n";
370
+    }
371 371
 
372
-	return $sparql;
372
+    return $sparql;
373 373
 }
374 374
 
375 375
 /**
@@ -382,24 +382,24 @@  discard block
 block discarded – undo
382 382
  */
383 383
 function wl_get_attachment_for_source_url( $parent_post_id, $source_url ) {
384 384
 
385
-	// wl_write_log( "wl_get_attachment_for_source_url [ parent post id :: $parent_post_id ][ source url :: $source_url ]" );
385
+    // wl_write_log( "wl_get_attachment_for_source_url [ parent post id :: $parent_post_id ][ source url :: $source_url ]" );
386 386
 
387
-	$posts = get_posts( array(
388
-		'post_type'      => 'attachment',
389
-		'posts_per_page' => 1,
390
-		'post_status'    => 'any',
391
-		'post_parent'    => $parent_post_id,
392
-		'meta_key'       => 'wl_source_url',
393
-		'meta_value'     => $source_url
394
-	) );
387
+    $posts = get_posts( array(
388
+        'post_type'      => 'attachment',
389
+        'posts_per_page' => 1,
390
+        'post_status'    => 'any',
391
+        'post_parent'    => $parent_post_id,
392
+        'meta_key'       => 'wl_source_url',
393
+        'meta_value'     => $source_url
394
+    ) );
395 395
 
396
-	// Return the found post.
397
-	if ( 1 === count( $posts ) ) {
398
-		return $posts[0];
399
-	}
396
+    // Return the found post.
397
+    if ( 1 === count( $posts ) ) {
398
+        return $posts[0];
399
+    }
400 400
 
401
-	// Return null.
402
-	return NULL;
401
+    // Return null.
402
+    return NULL;
403 403
 }
404 404
 
405 405
 /**
@@ -410,8 +410,8 @@  discard block
 block discarded – undo
410 410
  */
411 411
 function wl_set_source_url( $post_id, $source_url ) {
412 412
 
413
-	delete_post_meta( $post_id, 'wl_source_url' );
414
-	add_post_meta( $post_id, 'wl_source_url', $source_url );
413
+    delete_post_meta( $post_id, 'wl_source_url' );
414
+    add_post_meta( $post_id, 'wl_source_url', $source_url );
415 415
 }
416 416
 
417 417
 
@@ -429,59 +429,59 @@  discard block
 block discarded – undo
429 429
  */
430 430
 function wl_flush_rewrite_rules_hard( $hard ) {
431 431
 
432
-	// If WL is not yet configured, we cannot perform any update, so we exit.
433
-	if ( '' === wl_configuration_get_key() ) {
434
-		return;
435
-	}
432
+    // If WL is not yet configured, we cannot perform any update, so we exit.
433
+    if ( '' === wl_configuration_get_key() ) {
434
+        return;
435
+    }
436 436
 
437
-	// Set the initial offset and limit each call to 100 posts to avoid memory errors.
438
-	$offset = 0;
439
-	$limit  = 100;
437
+    // Set the initial offset and limit each call to 100 posts to avoid memory errors.
438
+    $offset = 0;
439
+    $limit  = 100;
440 440
 
441
-	// Get more posts if the number of returned posts matches the limit.
442
-	while ( $limit === ( $posts = get_posts( array(
443
-			'offset'      => $offset,
444
-			'numberposts' => $limit,
445
-			'orderby'     => 'ID',
446
-			'post_type'   => 'any',
447
-			'post_status' => 'publish'
448
-		) ) ) ) {
441
+    // Get more posts if the number of returned posts matches the limit.
442
+    while ( $limit === ( $posts = get_posts( array(
443
+            'offset'      => $offset,
444
+            'numberposts' => $limit,
445
+            'orderby'     => 'ID',
446
+            'post_type'   => 'any',
447
+            'post_status' => 'publish'
448
+        ) ) ) ) {
449 449
 
450
-		// Holds the delete part of the query.
451
-		$delete_query = rl_sparql_prefixes();
450
+        // Holds the delete part of the query.
451
+        $delete_query = rl_sparql_prefixes();
452 452
 
453
-		// Holds the insert part of the query.
454
-		$insert_query = 'INSERT DATA { ';
453
+        // Holds the insert part of the query.
454
+        $insert_query = 'INSERT DATA { ';
455 455
 
456
-		// Cycle in each post to build the query.
457
-		foreach ( $posts as $post ) {
456
+        // Cycle in each post to build the query.
457
+        foreach ( $posts as $post ) {
458 458
 
459
-			// Ignore revisions.
460
-			if ( wp_is_post_revision( $post->ID ) ) {
461
-				continue;
462
-			}
459
+            // Ignore revisions.
460
+            if ( wp_is_post_revision( $post->ID ) ) {
461
+                continue;
462
+            }
463 463
 
464
-			// Get the entity URI.
465
-			$uri = wl_sparql_escape_uri( wl_get_entity_uri( $post->ID ) );
464
+            // Get the entity URI.
465
+            $uri = wl_sparql_escape_uri( wl_get_entity_uri( $post->ID ) );
466 466
 
467
-			// Get the post URL.
468
-			$url = wl_sparql_escape_uri( get_permalink( $post->ID ) );
467
+            // Get the post URL.
468
+            $url = wl_sparql_escape_uri( get_permalink( $post->ID ) );
469 469
 
470
-			// Prepare the DELETE and INSERT commands.
471
-			$delete_query .= "DELETE { <$uri> schema:url ?u . } WHERE  { <$uri> schema:url ?u . };\n";
472
-			$insert_query .= " <$uri> schema:url <$url> . \n";
470
+            // Prepare the DELETE and INSERT commands.
471
+            $delete_query .= "DELETE { <$uri> schema:url ?u . } WHERE  { <$uri> schema:url ?u . };\n";
472
+            $insert_query .= " <$uri> schema:url <$url> . \n";
473 473
 
474
-		}
474
+        }
475 475
 
476
-		$insert_query .= ' };';
476
+        $insert_query .= ' };';
477 477
 
478
-		// Execute the query.
479
-		rl_execute_sparql_update_query( $delete_query . $insert_query );
478
+        // Execute the query.
479
+        rl_execute_sparql_update_query( $delete_query . $insert_query );
480 480
 
481
-		// Advance to the next posts.
482
-		$offset += $limit;
481
+        // Advance to the next posts.
482
+        $offset += $limit;
483 483
 
484
-	}
484
+    }
485 485
 
486 486
 //	// Get all published posts.
487 487
 //	$posts = get_posts( array(
@@ -506,15 +506,15 @@  discard block
 block discarded – undo
506 506
  */
507 507
 function wl_sanitize_uri_path( $path, $char = '_' ) {
508 508
 
509
-	// wl_write_log( "wl_sanitize_uri_path [ path :: $path ][ char :: $char ]" );
509
+    // wl_write_log( "wl_sanitize_uri_path [ path :: $path ][ char :: $char ]" );
510 510
 
511
-	// According to RFC2396 (http://www.ietf.org/rfc/rfc2396.txt) these characters are reserved:
512
-	// ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
513
-	// "$" | ","
514
-	// Plus the ' ' (space).
515
-	// TODO: We shall use the same regex used by MediaWiki (http://stackoverflow.com/questions/23114983/mediawiki-wikipedia-url-sanitization-regex)
511
+    // According to RFC2396 (http://www.ietf.org/rfc/rfc2396.txt) these characters are reserved:
512
+    // ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
513
+    // "$" | ","
514
+    // Plus the ' ' (space).
515
+    // TODO: We shall use the same regex used by MediaWiki (http://stackoverflow.com/questions/23114983/mediawiki-wikipedia-url-sanitization-regex)
516 516
 
517
-	return sanitize_title( preg_replace( '/[;\/?:@&=+$,\s]/', $char, stripslashes( $path ) ) );
517
+    return sanitize_title( preg_replace( '/[;\/?:@&=+$,\s]/', $char, stripslashes( $path ) ) );
518 518
 }
519 519
 
520 520
 /**
@@ -526,11 +526,11 @@  discard block
 block discarded – undo
526 526
  */
527 527
 function wl_force_to_array( $value ) {
528 528
 
529
-	if ( ! is_array( $value ) ) {
530
-		return array( $value );
531
-	}
529
+    if ( ! is_array( $value ) ) {
530
+        return array( $value );
531
+    }
532 532
 
533
-	return $value;
533
+    return $value;
534 534
 }
535 535
 
536 536
 /**
@@ -538,26 +538,26 @@  discard block
 block discarded – undo
538 538
  */
539 539
 function wl_shutdown() {
540 540
 
541
-	// Get the filename to the temporary SPARQL file.
542
-	$filename = WL_TEMP_DIR . WL_REQUEST_ID . '.sparql';
541
+    // Get the filename to the temporary SPARQL file.
542
+    $filename = WL_TEMP_DIR . WL_REQUEST_ID . '.sparql';
543 543
 
544
-	// If WordLift is buffering SPARQL queries, we're admins and a buffer exists, then schedule it.
545
-	if ( WL_ENABLE_SPARQL_UPDATE_QUERIES_BUFFERING && is_admin() && file_exists( $filename ) ) {
544
+    // If WordLift is buffering SPARQL queries, we're admins and a buffer exists, then schedule it.
545
+    if ( WL_ENABLE_SPARQL_UPDATE_QUERIES_BUFFERING && is_admin() && file_exists( $filename ) ) {
546 546
 
547
-		// The request ID.
548
-		$args = array( WL_REQUEST_ID );
547
+        // The request ID.
548
+        $args = array( WL_REQUEST_ID );
549 549
 
550
-		// Schedule the execution of the SPARQL query with the request ID.
551
-		wp_schedule_single_event( time(), 'wl_execute_saved_sparql_update_query', $args );
550
+        // Schedule the execution of the SPARQL query with the request ID.
551
+        wp_schedule_single_event( time(), 'wl_execute_saved_sparql_update_query', $args );
552 552
 
553
-		// Check that the request is scheduled.
554
-		$timestamp = wp_next_scheduled( 'wl_execute_saved_sparql_update_query', $args );
553
+        // Check that the request is scheduled.
554
+        $timestamp = wp_next_scheduled( 'wl_execute_saved_sparql_update_query', $args );
555 555
 
556
-		// Spawn the cron.
557
-		spawn_cron();
556
+        // Spawn the cron.
557
+        spawn_cron();
558 558
 
559
-		wl_write_log( "wl_shutdown [ request id :: " . WL_REQUEST_ID . " ][ timestamp :: $timestamp ]" );
560
-	}
559
+        wl_write_log( "wl_shutdown [ request id :: " . WL_REQUEST_ID . " ][ timestamp :: $timestamp ]" );
560
+    }
561 561
 }
562 562
 
563 563
 add_action( 'shutdown', 'wl_shutdown' );
@@ -571,46 +571,46 @@  discard block
 block discarded – undo
571 571
  */
572 572
 function wl_replace_item_id_with_uri( $content ) {
573 573
 
574
-	// wl_write_log( "wl_replace_item_id_with_uri" );
574
+    // wl_write_log( "wl_replace_item_id_with_uri" );
575 575
 
576
-	// Strip slashes, see https://core.trac.wordpress.org/ticket/21767
577
-	$content = stripslashes( $content );
576
+    // Strip slashes, see https://core.trac.wordpress.org/ticket/21767
577
+    $content = stripslashes( $content );
578 578
 
579
-	// If any match are found.
580
-	$matches = array();
581
-	if ( 0 < preg_match_all( '/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER ) ) {
579
+    // If any match are found.
580
+    $matches = array();
581
+    if ( 0 < preg_match_all( '/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER ) ) {
582 582
 
583
-		foreach ( $matches as $match ) {
583
+        foreach ( $matches as $match ) {
584 584
 
585
-			// Get the item ID.
586
-			$item_id = $match[1];
585
+            // Get the item ID.
586
+            $item_id = $match[1];
587 587
 
588
-			// Get the post bound to that item ID (looking both in the 'official' URI and in the 'same-as' .
589
-			$post = Wordlift_Entity_Service::get_instance()
590
-			                               ->get_entity_post_by_uri( $item_id );
588
+            // Get the post bound to that item ID (looking both in the 'official' URI and in the 'same-as' .
589
+            $post = Wordlift_Entity_Service::get_instance()
590
+                                            ->get_entity_post_by_uri( $item_id );
591 591
 
592
-			// If no entity is found, continue to the next one.
593
-			if ( NULL === $post ) {
594
-				continue;
595
-			}
592
+            // If no entity is found, continue to the next one.
593
+            if ( NULL === $post ) {
594
+                continue;
595
+            }
596 596
 
597
-			// Get the URI for that post.
598
-			$uri = wl_get_entity_uri( $post->ID );
597
+            // Get the URI for that post.
598
+            $uri = wl_get_entity_uri( $post->ID );
599 599
 
600
-			// wl_write_log( "wl_replace_item_id_with_uri [ item id :: $item_id ][ uri :: $uri ]" );
600
+            // wl_write_log( "wl_replace_item_id_with_uri [ item id :: $item_id ][ uri :: $uri ]" );
601 601
 
602
-			// If the item ID and the URI differ, replace the item ID with the URI saved in WordPress.
603
-			if ( $item_id !== $uri ) {
604
-				$uri_e   = esc_html( $uri );
605
-				$content = str_replace( " itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content );
606
-			}
607
-		}
608
-	}
602
+            // If the item ID and the URI differ, replace the item ID with the URI saved in WordPress.
603
+            if ( $item_id !== $uri ) {
604
+                $uri_e   = esc_html( $uri );
605
+                $content = str_replace( " itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content );
606
+            }
607
+        }
608
+    }
609 609
 
610
-	// Reapply slashes.
611
-	$content = addslashes( $content );
610
+    // Reapply slashes.
611
+    $content = addslashes( $content );
612 612
 
613
-	return $content;
613
+    return $content;
614 614
 }
615 615
 
616 616
 add_filter( 'content_save_pre', 'wl_replace_item_id_with_uri', 1, 1 );
@@ -688,8 +688,8 @@  discard block
 block discarded – undo
688 688
  * This action is documented in includes/class-wordlift-activator.php
689 689
  */
690 690
 function activate_wordlift() {
691
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php';
692
-	Wordlift_Activator::activate();
691
+    require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php';
692
+    Wordlift_Activator::activate();
693 693
 }
694 694
 
695 695
 /**
@@ -697,8 +697,8 @@  discard block
 block discarded – undo
697 697
  * This action is documented in includes/class-wordlift-deactivator.php
698 698
  */
699 699
 function deactivate_wordlift() {
700
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php';
701
-	Wordlift_Deactivator::deactivate();
700
+    require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php';
701
+    Wordlift_Deactivator::deactivate();
702 702
 }
703 703
 
704 704
 register_activation_hook( __FILE__, 'activate_wordlift' );
@@ -721,8 +721,8 @@  discard block
 block discarded – undo
721 721
  */
722 722
 function run_wordlift() {
723 723
 
724
-	$plugin = new Wordlift();
725
-	$plugin->run();
724
+    $plugin = new Wordlift();
725
+    $plugin->run();
726 726
 
727 727
 }
728 728
 
Please login to merge, or discard this patch.
Spacing   +162 added lines, -162 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,10 +168,10 @@  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
-	$plugin_array['wordlift'] = plugin_dir_url( __FILE__ ) . 'js/wordlift-reloaded.js';
174
+	$plugin_array['wordlift'] = plugin_dir_url(__FILE__).'js/wordlift-reloaded.js';
175 175
 
176 176
 	return $plugin_array;
177 177
 }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 function wordlift_allowed_post_tags() {
184 184
 	global $allowedposttags;
185 185
 
186
-	$tags           = array( 'span' );
186
+	$tags           = array('span');
187 187
 	$new_attributes = array(
188 188
 		'itemscope' => array(),
189 189
 		'itemtype'  => array(),
@@ -191,17 +191,17 @@  discard block
 block discarded – undo
191 191
 		'itemid'    => array()
192 192
 	);
193 193
 
194
-	foreach ( $tags as $tag ) {
195
-		if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) {
196
-			$allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes );
194
+	foreach ($tags as $tag) {
195
+		if (isset($allowedposttags[$tag]) && is_array($allowedposttags[$tag])) {
196
+			$allowedposttags[$tag] = array_merge($allowedposttags[$tag], $new_attributes);
197 197
 		}
198 198
 	}
199 199
 }
200 200
 
201 201
 // init process for button control
202
-add_action( 'init', 'wordlift_buttonhooks' );
202
+add_action('init', 'wordlift_buttonhooks');
203 203
 // add allowed post tags.
204
-add_action( 'init', 'wordlift_allowed_post_tags' );
204
+add_action('init', 'wordlift_allowed_post_tags');
205 205
 
206 206
 
207 207
 /**
@@ -210,30 +210,30 @@  discard block
 block discarded – undo
210 210
 function wordlift_admin_enqueue_scripts() {
211 211
 
212 212
 	// Added for compatibility with WordPress 3.9 (see http://make.wordpress.org/core/2014/04/16/jquery-ui-and-wpdialogs-in-wordpress-3-9/)
213
-	wp_enqueue_script( 'wpdialogs' );
214
-	wp_enqueue_style( 'wp-jquery-ui-dialog' );
213
+	wp_enqueue_script('wpdialogs');
214
+	wp_enqueue_style('wp-jquery-ui-dialog');
215 215
 
216
-	wp_enqueue_style( 'wordlift-reloaded', plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css' );
216
+	wp_enqueue_style('wordlift-reloaded', plugin_dir_url(__FILE__).'css/wordlift-reloaded.min.css');
217 217
 
218
-	wp_enqueue_script( 'jquery-ui-autocomplete' );
219
-	wp_enqueue_script( 'angularjs', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js' );
220
-	wp_enqueue_script( 'angularjs-geolocation', plugin_dir_url( __FILE__ ) . '/bower_components/angularjs-geolocation/dist/angularjs-geolocation.min.js' );
221
-	wp_enqueue_script( 'angularjs-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js' );
222
-	wp_enqueue_script( 'angularjs-animate', 'https://code.angularjs.org/1.3.11/angular-animate.min.js' );
218
+	wp_enqueue_script('jquery-ui-autocomplete');
219
+	wp_enqueue_script('angularjs', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js');
220
+	wp_enqueue_script('angularjs-geolocation', plugin_dir_url(__FILE__).'/bower_components/angularjs-geolocation/dist/angularjs-geolocation.min.js');
221
+	wp_enqueue_script('angularjs-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js');
222
+	wp_enqueue_script('angularjs-animate', 'https://code.angularjs.org/1.3.11/angular-animate.min.js');
223 223
 
224 224
 	// Disable auto-save for custom entity posts only
225
-	if ( Wordlift_Entity_Service::TYPE_NAME === get_post_type() ) {
226
-		wp_dequeue_script( 'autosave' );
225
+	if (Wordlift_Entity_Service::TYPE_NAME === get_post_type()) {
226
+		wp_dequeue_script('autosave');
227 227
 	}
228 228
 }
229 229
 
230
-add_action( 'admin_enqueue_scripts', 'wordlift_admin_enqueue_scripts' );
230
+add_action('admin_enqueue_scripts', 'wordlift_admin_enqueue_scripts');
231 231
 
232 232
 function wl_enqueue_scripts() {
233
-	wp_enqueue_style( 'wordlift-ui', plugin_dir_url( __FILE__ ) . 'css/wordlift-ui.min.css' );
233
+	wp_enqueue_style('wordlift-ui', plugin_dir_url(__FILE__).'css/wordlift-ui.min.css');
234 234
 }
235 235
 
236
-add_action( 'wp_enqueue_scripts', 'wl_enqueue_scripts' );
236
+add_action('wp_enqueue_scripts', 'wl_enqueue_scripts');
237 237
 
238 238
 /**
239 239
  * Hooked to *wp_kses_allowed_html* filter, adds microdata attributes.
@@ -243,23 +243,23 @@  discard block
 block discarded – undo
243 243
  *
244 244
  * @return array An array which contains allowed microdata attributes.
245 245
  */
246
-function wordlift_allowed_html( $allowedtags, $context ) {
246
+function wordlift_allowed_html($allowedtags, $context) {
247 247
 
248
-	if ( 'post' !== $context ) {
248
+	if ('post' !== $context) {
249 249
 		return $allowedtags;
250 250
 	}
251 251
 
252
-	return array_merge_recursive( $allowedtags, array(
252
+	return array_merge_recursive($allowedtags, array(
253 253
 		'span' => array(
254 254
 			'itemscope' => TRUE,
255 255
 			'itemtype'  => TRUE,
256 256
 			'itemid'    => TRUE,
257 257
 			'itemprop'  => TRUE
258 258
 		)
259
-	) );
259
+	));
260 260
 }
261 261
 
262
-add_filter( 'wp_kses_allowed_html', 'wordlift_allowed_html', 10, 2 );
262
+add_filter('wp_kses_allowed_html', 'wordlift_allowed_html', 10, 2);
263 263
 
264 264
 /**
265 265
  * Get the coordinates for the specified post ID.
@@ -268,16 +268,16 @@  discard block
 block discarded – undo
268 268
  *
269 269
  * @return array|null An array of coordinates or null.
270 270
  */
271
-function wl_get_coordinates( $post_id ) {
271
+function wl_get_coordinates($post_id) {
272 272
 
273
-	$latitude  = wl_schema_get_value( $post_id, 'latitude' );
274
-	$longitude = wl_schema_get_value( $post_id, 'longitude' );
273
+	$latitude  = wl_schema_get_value($post_id, 'latitude');
274
+	$longitude = wl_schema_get_value($post_id, 'longitude');
275 275
 
276 276
 	// DO NOT set latitude/longitude to 0/0 as default values. It's a specific place on the globe:
277 277
 	// "The zero/zero point of this system is located in the Gulf of Guinea about 625 km (390 mi) south of Tema, Ghana."
278 278
 	return array(
279
-		'latitude'  => isset( $latitude[0] ) && is_numeric( $latitude[0] ) ? $latitude[0] : '',
280
-		'longitude' => isset( $longitude[0] ) && is_numeric( $longitude[0] ) ? $longitude[0] : ''
279
+		'latitude'  => isset($latitude[0]) && is_numeric($latitude[0]) ? $latitude[0] : '',
280
+		'longitude' => isset($longitude[0]) && is_numeric($longitude[0]) ? $longitude[0] : ''
281 281
 	);
282 282
 }
283 283
 
@@ -288,12 +288,12 @@  discard block
 block discarded – undo
288 288
  *
289 289
  * @return string A datetime.
290 290
  */
291
-function wl_get_post_modified_time( $post ) {
291
+function wl_get_post_modified_time($post) {
292 292
 
293
-	$date_modified = get_post_modified_time( 'c', TRUE, $post );
293
+	$date_modified = get_post_modified_time('c', TRUE, $post);
294 294
 
295
-	if ( '-' === substr( $date_modified, 0, 1 ) ) {
296
-		return get_the_time( 'c', $post );
295
+	if ('-' === substr($date_modified, 0, 1)) {
296
+		return get_the_time('c', $post);
297 297
 	}
298 298
 
299 299
 	return $date_modified;
@@ -306,27 +306,27 @@  discard block
 block discarded – undo
306 306
  *
307 307
  * @return array An array of image URLs.
308 308
  */
309
-function wl_get_image_urls( $post_id ) {
309
+function wl_get_image_urls($post_id) {
310 310
 
311 311
 
312 312
 	// If there is a featured image it has the priority
313
-	$featured_image_id = get_post_thumbnail_id( $post_id );
314
-	if ( is_numeric( $featured_image_id ) ) {
315
-		$image_url = wp_get_attachment_url( $featured_image_id );
313
+	$featured_image_id = get_post_thumbnail_id($post_id);
314
+	if (is_numeric($featured_image_id)) {
315
+		$image_url = wp_get_attachment_url($featured_image_id);
316 316
 
317
-		return array( $image_url );
317
+		return array($image_url);
318 318
 	}
319 319
 
320 320
 	// wl_write_log( "wl_get_image_urls [ post id :: $post_id ]" );
321 321
 
322
-	$images = get_children( array(
322
+	$images = get_children(array(
323 323
 		'post_parent'    => $post_id,
324 324
 		'post_type'      => 'attachment',
325 325
 		'post_mime_type' => 'image'
326
-	) );
326
+	));
327 327
 
328 328
 	// Return an empty array if no image is found.
329
-	if ( empty( $images ) ) {
329
+	if (empty($images)) {
330 330
 		return array();
331 331
 	}
332 332
 
@@ -334,11 +334,11 @@  discard block
 block discarded – undo
334 334
 	$image_urls = array();
335 335
 
336 336
 	// Collect the URLs.
337
-	foreach ( $images as $attachment_id => $attachment ) {
338
-		$image_url = wp_get_attachment_url( $attachment_id );
337
+	foreach ($images as $attachment_id => $attachment) {
338
+		$image_url = wp_get_attachment_url($attachment_id);
339 339
 		// Ensure the URL isn't collected already.
340
-		if ( ! in_array( $image_url, $image_urls ) ) {
341
-			array_push( $image_urls, $image_url );
340
+		if ( ! in_array($image_url, $image_urls)) {
341
+			array_push($image_urls, $image_url);
342 342
 		}
343 343
 	}
344 344
 
@@ -355,17 +355,17 @@  discard block
 block discarded – undo
355 355
  *
356 356
  * @return string The SPARQL fragment.
357 357
  */
358
-function wl_get_sparql_images( $uri, $post_id ) {
358
+function wl_get_sparql_images($uri, $post_id) {
359 359
 
360 360
 	$sparql = '';
361 361
 
362 362
 	// Get the escaped URI.
363
-	$uri_e = esc_html( $uri );
363
+	$uri_e = esc_html($uri);
364 364
 
365 365
 	// Add SPARQL stmts to write the schema:image.
366
-	$image_urls = wl_get_image_urls( $post_id );
367
-	foreach ( $image_urls as $image_url ) {
368
-		$image_url_esc = wl_sparql_escape_uri( $image_url );
366
+	$image_urls = wl_get_image_urls($post_id);
367
+	foreach ($image_urls as $image_url) {
368
+		$image_url_esc = wl_sparql_escape_uri($image_url);
369 369
 		$sparql .= " <$uri_e> schema:image <$image_url_esc> . \n";
370 370
 	}
371 371
 
@@ -380,21 +380,21 @@  discard block
 block discarded – undo
380 380
  *
381 381
  * @return WP_Post|null A post instance or null if not found.
382 382
  */
383
-function wl_get_attachment_for_source_url( $parent_post_id, $source_url ) {
383
+function wl_get_attachment_for_source_url($parent_post_id, $source_url) {
384 384
 
385 385
 	// wl_write_log( "wl_get_attachment_for_source_url [ parent post id :: $parent_post_id ][ source url :: $source_url ]" );
386 386
 
387
-	$posts = get_posts( array(
387
+	$posts = get_posts(array(
388 388
 		'post_type'      => 'attachment',
389 389
 		'posts_per_page' => 1,
390 390
 		'post_status'    => 'any',
391 391
 		'post_parent'    => $parent_post_id,
392 392
 		'meta_key'       => 'wl_source_url',
393 393
 		'meta_value'     => $source_url
394
-	) );
394
+	));
395 395
 
396 396
 	// Return the found post.
397
-	if ( 1 === count( $posts ) ) {
397
+	if (1 === count($posts)) {
398 398
 		return $posts[0];
399 399
 	}
400 400
 
@@ -408,10 +408,10 @@  discard block
 block discarded – undo
408 408
  * @param int $post_id The post ID.
409 409
  * @param string $source_url The source URL.
410 410
  */
411
-function wl_set_source_url( $post_id, $source_url ) {
411
+function wl_set_source_url($post_id, $source_url) {
412 412
 
413
-	delete_post_meta( $post_id, 'wl_source_url' );
414
-	add_post_meta( $post_id, 'wl_source_url', $source_url );
413
+	delete_post_meta($post_id, 'wl_source_url');
414
+	add_post_meta($post_id, 'wl_source_url', $source_url);
415 415
 }
416 416
 
417 417
 
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
  *
428 428
  * @param bool $hard True if the rewrite involves configuration updates in Apache/IIS.
429 429
  */
430
-function wl_flush_rewrite_rules_hard( $hard ) {
430
+function wl_flush_rewrite_rules_hard($hard) {
431 431
 
432 432
 	// If WL is not yet configured, we cannot perform any update, so we exit.
433
-	if ( '' === wl_configuration_get_key() ) {
433
+	if ('' === wl_configuration_get_key()) {
434 434
 		return;
435 435
 	}
436 436
 
@@ -439,13 +439,13 @@  discard block
 block discarded – undo
439 439
 	$limit  = 100;
440 440
 
441 441
 	// Get more posts if the number of returned posts matches the limit.
442
-	while ( $limit === ( $posts = get_posts( array(
442
+	while ($limit === ($posts = get_posts(array(
443 443
 			'offset'      => $offset,
444 444
 			'numberposts' => $limit,
445 445
 			'orderby'     => 'ID',
446 446
 			'post_type'   => 'any',
447 447
 			'post_status' => 'publish'
448
-		) ) ) ) {
448
+		)))) {
449 449
 
450 450
 		// Holds the delete part of the query.
451 451
 		$delete_query = rl_sparql_prefixes();
@@ -454,18 +454,18 @@  discard block
 block discarded – undo
454 454
 		$insert_query = 'INSERT DATA { ';
455 455
 
456 456
 		// Cycle in each post to build the query.
457
-		foreach ( $posts as $post ) {
457
+		foreach ($posts as $post) {
458 458
 
459 459
 			// Ignore revisions.
460
-			if ( wp_is_post_revision( $post->ID ) ) {
460
+			if (wp_is_post_revision($post->ID)) {
461 461
 				continue;
462 462
 			}
463 463
 
464 464
 			// Get the entity URI.
465
-			$uri = wl_sparql_escape_uri( wl_get_entity_uri( $post->ID ) );
465
+			$uri = wl_sparql_escape_uri(wl_get_entity_uri($post->ID));
466 466
 
467 467
 			// Get the post URL.
468
-			$url = wl_sparql_escape_uri( get_permalink( $post->ID ) );
468
+			$url = wl_sparql_escape_uri(get_permalink($post->ID));
469 469
 
470 470
 			// Prepare the DELETE and INSERT commands.
471 471
 			$delete_query .= "DELETE { <$uri> schema:url ?u . } WHERE  { <$uri> schema:url ?u . };\n";
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 		$insert_query .= ' };';
477 477
 
478 478
 		// Execute the query.
479
-		rl_execute_sparql_update_query( $delete_query . $insert_query );
479
+		rl_execute_sparql_update_query($delete_query.$insert_query);
480 480
 
481 481
 		// Advance to the next posts.
482 482
 		$offset += $limit;
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 
493 493
 }
494 494
 
495
-add_filter( 'flush_rewrite_rules_hard', 'wl_flush_rewrite_rules_hard', 10, 1 );
495
+add_filter('flush_rewrite_rules_hard', 'wl_flush_rewrite_rules_hard', 10, 1);
496 496
 
497 497
 /**
498 498
  * Sanitizes an URI path by replacing the non allowed characters with an underscore.
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
  *
505 505
  * @return The sanitized path.
506 506
  */
507
-function wl_sanitize_uri_path( $path, $char = '_' ) {
507
+function wl_sanitize_uri_path($path, $char = '_') {
508 508
 
509 509
 	// wl_write_log( "wl_sanitize_uri_path [ path :: $path ][ char :: $char ]" );
510 510
 
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 	// Plus the ' ' (space).
515 515
 	// TODO: We shall use the same regex used by MediaWiki (http://stackoverflow.com/questions/23114983/mediawiki-wikipedia-url-sanitization-regex)
516 516
 
517
-	return sanitize_title( preg_replace( '/[;\/?:@&=+$,\s]/', $char, stripslashes( $path ) ) );
517
+	return sanitize_title(preg_replace('/[;\/?:@&=+$,\s]/', $char, stripslashes($path)));
518 518
 }
519 519
 
520 520
 /**
@@ -524,10 +524,10 @@  discard block
 block discarded – undo
524 524
  *
525 525
  * @return array Array containing $value (if $value was not an array)
526 526
  */
527
-function wl_force_to_array( $value ) {
527
+function wl_force_to_array($value) {
528 528
 
529
-	if ( ! is_array( $value ) ) {
530
-		return array( $value );
529
+	if ( ! is_array($value)) {
530
+		return array($value);
531 531
 	}
532 532
 
533 533
 	return $value;
@@ -539,28 +539,28 @@  discard block
 block discarded – undo
539 539
 function wl_shutdown() {
540 540
 
541 541
 	// Get the filename to the temporary SPARQL file.
542
-	$filename = WL_TEMP_DIR . WL_REQUEST_ID . '.sparql';
542
+	$filename = WL_TEMP_DIR.WL_REQUEST_ID.'.sparql';
543 543
 
544 544
 	// If WordLift is buffering SPARQL queries, we're admins and a buffer exists, then schedule it.
545
-	if ( WL_ENABLE_SPARQL_UPDATE_QUERIES_BUFFERING && is_admin() && file_exists( $filename ) ) {
545
+	if (WL_ENABLE_SPARQL_UPDATE_QUERIES_BUFFERING && is_admin() && file_exists($filename)) {
546 546
 
547 547
 		// The request ID.
548
-		$args = array( WL_REQUEST_ID );
548
+		$args = array(WL_REQUEST_ID);
549 549
 
550 550
 		// Schedule the execution of the SPARQL query with the request ID.
551
-		wp_schedule_single_event( time(), 'wl_execute_saved_sparql_update_query', $args );
551
+		wp_schedule_single_event(time(), 'wl_execute_saved_sparql_update_query', $args);
552 552
 
553 553
 		// Check that the request is scheduled.
554
-		$timestamp = wp_next_scheduled( 'wl_execute_saved_sparql_update_query', $args );
554
+		$timestamp = wp_next_scheduled('wl_execute_saved_sparql_update_query', $args);
555 555
 
556 556
 		// Spawn the cron.
557 557
 		spawn_cron();
558 558
 
559
-		wl_write_log( "wl_shutdown [ request id :: " . WL_REQUEST_ID . " ][ timestamp :: $timestamp ]" );
559
+		wl_write_log("wl_shutdown [ request id :: ".WL_REQUEST_ID." ][ timestamp :: $timestamp ]");
560 560
 	}
561 561
 }
562 562
 
563
-add_action( 'shutdown', 'wl_shutdown' );
563
+add_action('shutdown', 'wl_shutdown');
564 564
 
565 565
 /**
566 566
  * Replaces the *itemid* attributes URIs with the WordLift URIs.
@@ -569,118 +569,118 @@  discard block
 block discarded – undo
569 569
  *
570 570
  * @return string The updated post content.
571 571
  */
572
-function wl_replace_item_id_with_uri( $content ) {
572
+function wl_replace_item_id_with_uri($content) {
573 573
 
574 574
 	// wl_write_log( "wl_replace_item_id_with_uri" );
575 575
 
576 576
 	// Strip slashes, see https://core.trac.wordpress.org/ticket/21767
577
-	$content = stripslashes( $content );
577
+	$content = stripslashes($content);
578 578
 
579 579
 	// If any match are found.
580 580
 	$matches = array();
581
-	if ( 0 < preg_match_all( '/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER ) ) {
581
+	if (0 < preg_match_all('/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER)) {
582 582
 
583
-		foreach ( $matches as $match ) {
583
+		foreach ($matches as $match) {
584 584
 
585 585
 			// Get the item ID.
586 586
 			$item_id = $match[1];
587 587
 
588 588
 			// Get the post bound to that item ID (looking both in the 'official' URI and in the 'same-as' .
589 589
 			$post = Wordlift_Entity_Service::get_instance()
590
-			                               ->get_entity_post_by_uri( $item_id );
590
+			                               ->get_entity_post_by_uri($item_id);
591 591
 
592 592
 			// If no entity is found, continue to the next one.
593
-			if ( NULL === $post ) {
593
+			if (NULL === $post) {
594 594
 				continue;
595 595
 			}
596 596
 
597 597
 			// Get the URI for that post.
598
-			$uri = wl_get_entity_uri( $post->ID );
598
+			$uri = wl_get_entity_uri($post->ID);
599 599
 
600 600
 			// wl_write_log( "wl_replace_item_id_with_uri [ item id :: $item_id ][ uri :: $uri ]" );
601 601
 
602 602
 			// If the item ID and the URI differ, replace the item ID with the URI saved in WordPress.
603
-			if ( $item_id !== $uri ) {
604
-				$uri_e   = esc_html( $uri );
605
-				$content = str_replace( " itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content );
603
+			if ($item_id !== $uri) {
604
+				$uri_e   = esc_html($uri);
605
+				$content = str_replace(" itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content);
606 606
 			}
607 607
 		}
608 608
 	}
609 609
 
610 610
 	// Reapply slashes.
611
-	$content = addslashes( $content );
611
+	$content = addslashes($content);
612 612
 
613 613
 	return $content;
614 614
 }
615 615
 
616
-add_filter( 'content_save_pre', 'wl_replace_item_id_with_uri', 1, 1 );
616
+add_filter('content_save_pre', 'wl_replace_item_id_with_uri', 1, 1);
617 617
 
618
-require_once( 'wordlift_entity_functions.php' );
618
+require_once('wordlift_entity_functions.php');
619 619
 
620 620
 // add editor related methods.
621
-require_once( 'wordlift_editor.php' );
621
+require_once('wordlift_editor.php');
622 622
 
623 623
 // add the WordLift entity custom type.
624
-require_once( 'wordlift_entity_type.php' );
625
-require_once( 'wordlift_entity_type_taxonomy.php' );
624
+require_once('wordlift_entity_type.php');
625
+require_once('wordlift_entity_type_taxonomy.php');
626 626
 
627 627
 // filters the post content when saving posts.
628
-require_once( 'wordlift_content_filter.php' );
628
+require_once('wordlift_content_filter.php');
629 629
 // add callbacks on post save to notify data changes from wp to redlink triple store
630
-require_once( 'wordlift_to_redlink_data_push_callbacks.php' );
630
+require_once('wordlift_to_redlink_data_push_callbacks.php');
631 631
 
632 632
 // Load modules
633
-require_once( 'modules/analyzer/wordlift_analyzer.php' );
634
-require_once( 'modules/linked_data/wordlift_linked_data.php' );
635
-require_once( 'modules/prefixes/wordlift_prefixes.php' );
636
-require_once( 'modules/caching/wordlift_caching.php' );
637
-require_once( 'modules/redirector/wordlift_redirector.php' );
638
-require_once( 'modules/freebase_image_proxy/wordlift_freebase_image_proxy.php' );
633
+require_once('modules/analyzer/wordlift_analyzer.php');
634
+require_once('modules/linked_data/wordlift_linked_data.php');
635
+require_once('modules/prefixes/wordlift_prefixes.php');
636
+require_once('modules/caching/wordlift_caching.php');
637
+require_once('modules/redirector/wordlift_redirector.php');
638
+require_once('modules/freebase_image_proxy/wordlift_freebase_image_proxy.php');
639 639
 
640 640
 // Shortcodes
641 641
 
642
-require_once( 'modules/geo_widget/wordlift_geo_widget.php' );
643
-require_once( 'shortcodes/wordlift_shortcode_chord.php' );
644
-require_once( 'shortcodes/wordlift_shortcode_geomap.php' );
645
-require_once( 'shortcodes/wordlift_shortcode_field.php' );
646
-require_once( 'shortcodes/wordlift_shortcode_faceted_search.php' );
647
-require_once( 'shortcodes/wordlift_shortcode_navigator.php' );
642
+require_once('modules/geo_widget/wordlift_geo_widget.php');
643
+require_once('shortcodes/wordlift_shortcode_chord.php');
644
+require_once('shortcodes/wordlift_shortcode_geomap.php');
645
+require_once('shortcodes/wordlift_shortcode_field.php');
646
+require_once('shortcodes/wordlift_shortcode_faceted_search.php');
647
+require_once('shortcodes/wordlift_shortcode_navigator.php');
648 648
 
649 649
 // disable In-Depth Articles
650 650
 //require_once('wordlift_indepth_articles.php');
651 651
 
652
-require_once( 'widgets/wordlift_widget_geo.php' );
653
-require_once( 'widgets/wordlift_widget_chord.php' );
654
-require_once( 'widgets/wordlift_widget_timeline.php' );
652
+require_once('widgets/wordlift_widget_geo.php');
653
+require_once('widgets/wordlift_widget_chord.php');
654
+require_once('widgets/wordlift_widget_timeline.php');
655 655
 
656
-require_once( 'wordlift_sparql.php' );
657
-require_once( 'wordlift_redlink.php' );
656
+require_once('wordlift_sparql.php');
657
+require_once('wordlift_redlink.php');
658 658
 
659 659
 // Add admin functions.
660 660
 // TODO: find a way to make 'admin' UI tests work.
661 661
 //if ( is_admin() ) {
662 662
 
663
-require_once( 'admin/wordlift_admin.php' );
664
-require_once( 'admin/wordlift_admin_edit_post.php' );
665
-require_once( 'admin/wordlift_admin_save_post.php' );
663
+require_once('admin/wordlift_admin.php');
664
+require_once('admin/wordlift_admin_edit_post.php');
665
+require_once('admin/wordlift_admin_save_post.php');
666 666
 
667 667
 // add the entities meta box.
668
-require_once( 'admin/wordlift_admin_meta_box_entities.php' );
668
+require_once('admin/wordlift_admin_meta_box_entities.php');
669 669
 
670 670
 // add the entity creation AJAX.
671
-require_once( 'admin/wordlift_admin_ajax_related_posts.php' );
671
+require_once('admin/wordlift_admin_ajax_related_posts.php');
672 672
 
673 673
 // Load the wl_chord TinyMCE button and configuration dialog.
674
-require_once( 'admin/wordlift_admin_shortcodes.php' );
674
+require_once('admin/wordlift_admin_shortcodes.php');
675 675
 
676 676
 // Provide syncing features.
677
-require_once( 'admin/wordlift_admin_sync.php' );
677
+require_once('admin/wordlift_admin_sync.php');
678 678
 //}
679 679
 
680 680
 // load languages.
681 681
 // TODO: the following call gives for granted that the plugin is in the wordlift directory,
682 682
 //       we're currently doing this because wordlift is symbolic linked.
683
-load_plugin_textdomain( 'wordlift', FALSE, '/wordlift/languages' );
683
+load_plugin_textdomain('wordlift', FALSE, '/wordlift/languages');
684 684
 
685 685
 
686 686
 /**
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
  * This action is documented in includes/class-wordlift-activator.php
689 689
  */
690 690
 function activate_wordlift() {
691
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php';
691
+	require_once plugin_dir_path(__FILE__).'includes/class-wordlift-activator.php';
692 692
 	Wordlift_Activator::activate();
693 693
 }
694 694
 
@@ -697,18 +697,18 @@  discard block
 block discarded – undo
697 697
  * This action is documented in includes/class-wordlift-deactivator.php
698 698
  */
699 699
 function deactivate_wordlift() {
700
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php';
700
+	require_once plugin_dir_path(__FILE__).'includes/class-wordlift-deactivator.php';
701 701
 	Wordlift_Deactivator::deactivate();
702 702
 }
703 703
 
704
-register_activation_hook( __FILE__, 'activate_wordlift' );
705
-register_deactivation_hook( __FILE__, 'deactivate_wordlift' );
704
+register_activation_hook(__FILE__, 'activate_wordlift');
705
+register_deactivation_hook(__FILE__, 'deactivate_wordlift');
706 706
 
707 707
 /**
708 708
  * The core plugin class that is used to define internationalization,
709 709
  * admin-specific hooks, and public-facing site hooks.
710 710
  */
711
-require plugin_dir_path( __FILE__ ) . 'includes/class-wordlift.php';
711
+require plugin_dir_path(__FILE__).'includes/class-wordlift.php';
712 712
 
713 713
 /**
714 714
  * Begins execution of the plugin.
Please login to merge, or discard this patch.
src/includes/class-wordlift.php 1 patch
Indentation   +460 added lines, -460 removed lines patch added patch discarded remove patch
@@ -29,504 +29,504 @@
 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;
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 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
-	 * Define the core functionality of the plugin.
188
-	 *
189
-	 * Set the plugin name and the plugin version that can be used throughout the plugin.
190
-	 * Load the dependencies, define the locale, and set the hooks for the admin area and
191
-	 * the public-facing side of the site.
192
-	 *
193
-	 * @since    1.0.0
194
-	 */
195
-	public function __construct() {
196
-
197
-		$this->plugin_name = 'wordlift';
198
-		$this->version = '3.5.2';
199
-		$this->load_dependencies();
200
-		$this->set_locale();
201
-		$this->define_admin_hooks();
202
-		$this->define_public_hooks();
203
-
204
-	}
205
-
206
-	/**
207
-	 * Load the required dependencies for this plugin.
208
-	 *
209
-	 * Include the following files that make up the plugin:
210
-	 *
211
-	 * - Wordlift_Loader. Orchestrates the hooks of the plugin.
212
-	 * - Wordlift_i18n. Defines internationalization functionality.
213
-	 * - Wordlift_Admin. Defines all hooks for the admin area.
214
-	 * - Wordlift_Public. Defines all hooks for the public side of the site.
215
-	 *
216
-	 * Create an instance of the loader which will be used to register the hooks
217
-	 * with WordPress.
218
-	 *
219
-	 * @since    1.0.0
220
-	 * @access   private
221
-	 */
222
-	private function load_dependencies() {
223
-
224
-		/**
225
-		 * The class responsible for orchestrating the actions and filters of the
226
-		 * core plugin.
227
-		 */
228
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
229
-
230
-		/**
231
-		 * The class responsible for defining internationalization functionality
232
-		 * of the plugin.
233
-		 */
234
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
235
-
236
-		/**
237
-		 * The Redirect service.
238
-		 */
239
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
240
-
241
-		/**
242
-		 * The Log service.
243
-		 */
244
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
245
-
246
-		/**
247
-		 * The Query builder.
248
-		 */
249
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
250
-
251
-		/**
252
-		 * The Schema service.
253
-		 */
254
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
255
-
256
-		/**
257
-		 * The UI service.
258
-		 */
259
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
260
-
261
-		/**
262
-		 * The Thumbnail service.
263
-		 */
264
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
265
-
266
-		/**
267
-		 * The Entity Types Taxonomy service.
268
-		 */
269
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
270
-
271
-		/**
272
-		 * The Entity service.
273
-		 */
274
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
275
-
276
-		/**
277
-		 * The User service.
278
-		 */
279
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
280
-
281
-		/**
282
-		 * The Timeline service.
283
-		 */
284
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
285
-
286
-		/**
287
-		 * The Topic Taxonomy service.
288
-		 */
289
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
290
-
291
-		/**
292
-		 * The class responsible for defining all actions that occur in the admin area.
293
-		 */
294
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
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
+     * Define the core functionality of the plugin.
188
+     *
189
+     * Set the plugin name and the plugin version that can be used throughout the plugin.
190
+     * Load the dependencies, define the locale, and set the hooks for the admin area and
191
+     * the public-facing side of the site.
192
+     *
193
+     * @since    1.0.0
194
+     */
195
+    public function __construct() {
196
+
197
+        $this->plugin_name = 'wordlift';
198
+        $this->version = '3.5.2';
199
+        $this->load_dependencies();
200
+        $this->set_locale();
201
+        $this->define_admin_hooks();
202
+        $this->define_public_hooks();
203
+
204
+    }
205
+
206
+    /**
207
+     * Load the required dependencies for this plugin.
208
+     *
209
+     * Include the following files that make up the plugin:
210
+     *
211
+     * - Wordlift_Loader. Orchestrates the hooks of the plugin.
212
+     * - Wordlift_i18n. Defines internationalization functionality.
213
+     * - Wordlift_Admin. Defines all hooks for the admin area.
214
+     * - Wordlift_Public. Defines all hooks for the public side of the site.
215
+     *
216
+     * Create an instance of the loader which will be used to register the hooks
217
+     * with WordPress.
218
+     *
219
+     * @since    1.0.0
220
+     * @access   private
221
+     */
222
+    private function load_dependencies() {
223
+
224
+        /**
225
+         * The class responsible for orchestrating the actions and filters of the
226
+         * core plugin.
227
+         */
228
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
229
+
230
+        /**
231
+         * The class responsible for defining internationalization functionality
232
+         * of the plugin.
233
+         */
234
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
235
+
236
+        /**
237
+         * The Redirect service.
238
+         */
239
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
240
+
241
+        /**
242
+         * The Log service.
243
+         */
244
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
245
+
246
+        /**
247
+         * The Query builder.
248
+         */
249
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
250
+
251
+        /**
252
+         * The Schema service.
253
+         */
254
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
255
+
256
+        /**
257
+         * The UI service.
258
+         */
259
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
260
+
261
+        /**
262
+         * The Thumbnail service.
263
+         */
264
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
265
+
266
+        /**
267
+         * The Entity Types Taxonomy service.
268
+         */
269
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
270
+
271
+        /**
272
+         * The Entity service.
273
+         */
274
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
275
+
276
+        /**
277
+         * The User service.
278
+         */
279
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
280
+
281
+        /**
282
+         * The Timeline service.
283
+         */
284
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
285
+
286
+        /**
287
+         * The Topic Taxonomy service.
288
+         */
289
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
290
+
291
+        /**
292
+         * The class responsible for defining all actions that occur in the admin area.
293
+         */
294
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
295 295
 		
296
-		/**
297
-		 * The class to customize the entity list admin page.
298
-		 */
299
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
296
+        /**
297
+         * The class to customize the entity list admin page.
298
+         */
299
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
300 300
 
301
-		/**
302
-		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
303
-		 */
304
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
301
+        /**
302
+         * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
303
+         */
304
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
305 305
 
306
-		/**
307
-		 * The Notice service.
308
-		 */
309
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
306
+        /**
307
+         * The Notice service.
308
+         */
309
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
310 310
 
311
-		/**
312
-		 * The PrimaShop adapter.
313
-		 */
314
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
311
+        /**
312
+         * The PrimaShop adapter.
313
+         */
314
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
315 315
 
316
-		/**
317
-		 * The WordLift Dashboard service.
318
-		 */
319
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
316
+        /**
317
+         * The WordLift Dashboard service.
318
+         */
319
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
320 320
 
321
-		/**
322
-		 * The class responsible for defining all actions that occur in the public-facing
323
-		 * side of the site.
324
-		 */
325
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
321
+        /**
322
+         * The class responsible for defining all actions that occur in the public-facing
323
+         * side of the site.
324
+         */
325
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
326 326
 
327
-		/**
328
-		 * The Timeline shortcode.
329
-		 */
330
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
327
+        /**
328
+         * The Timeline shortcode.
329
+         */
330
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
331 331
 
332
-		/**
333
-		 * The ShareThis service.
334
-		 */
335
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
332
+        /**
333
+         * The ShareThis service.
334
+         */
335
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
336 336
 
337
-		$this->loader = new Wordlift_Loader();
337
+        $this->loader = new Wordlift_Loader();
338 338
 
339
-		// Instantiate a global logger.
340
-		global $wl_logger;
341
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
339
+        // Instantiate a global logger.
340
+        global $wl_logger;
341
+        $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
342 342
 
343
-		// Create an instance of the UI service.
344
-		$this->ui_service = new Wordlift_UI_Service();
343
+        // Create an instance of the UI service.
344
+        $this->ui_service = new Wordlift_UI_Service();
345 345
 
346
-		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
347
-		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
346
+        // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
347
+        $this->thumbnail_service = new Wordlift_Thumbnail_Service();
348 348
 
349
-		// Create an instance of the Schema service.
350
-		$this->schema_service = new Wordlift_Schema_Service();
349
+        // Create an instance of the Schema service.
350
+        $this->schema_service = new Wordlift_Schema_Service();
351 351
 
352
-		// Create an instance of the Notice service.
353
-		$this->notice_service = new Wordlift_Notice_Service();
352
+        // Create an instance of the Notice service.
353
+        $this->notice_service = new Wordlift_Notice_Service();
354 354
 
355
-		// Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page.
356
-		$this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->schema_service, $this->notice_service );
355
+        // Create an instance of the Entity service, passing the UI service to draw parts of the Entity admin page.
356
+        $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->schema_service, $this->notice_service );
357 357
 
358
-		// Create an instance of the User service.
359
-		$this->user_service = new Wordlift_User_Service();
358
+        // Create an instance of the User service.
359
+        $this->user_service = new Wordlift_User_Service();
360 360
 
361
-		// Create a new instance of the Timeline service and Timeline shortcode.
362
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
361
+        // Create a new instance of the Timeline service and Timeline shortcode.
362
+        $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service );
363 363
 
364
-		// Create a new instance of the Redirect service.
365
-		$this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service );
364
+        // Create a new instance of the Redirect service.
365
+        $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service );
366 366
 
367
-		// Create a new instance of the Redirect service.
368
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->entity_service );
367
+        // Create a new instance of the Redirect service.
368
+        $this->dashboard_service = new Wordlift_Dashboard_Service( $this->entity_service );
369 369
 
370
-		// Create an instance of the Timeline shortcode.
371
-		new Wordlift_Timeline_Shortcode();
370
+        // Create an instance of the Timeline shortcode.
371
+        new Wordlift_Timeline_Shortcode();
372 372
 		
373
-		// Create entity list customization (wp-admin/edit.php)
374
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->entity_service );
373
+        // Create entity list customization (wp-admin/edit.php)
374
+        $this->entity_list_service = new Wordlift_Entity_List_Service( $this->entity_service );
375 375
 
376
-		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
376
+        $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
377 377
 
378
-		$this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service();
378
+        $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service();
379 379
 
380
-		// Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
381
-		$this->sharethis_service = new Wordlift_ShareThis_Service();
380
+        // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
381
+        $this->sharethis_service = new Wordlift_ShareThis_Service();
382 382
 
383
-		// Create an instance of the PrimaShop adapter.
384
-		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
385
-	}
383
+        // Create an instance of the PrimaShop adapter.
384
+        $this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
385
+    }
386 386
 
387
-	/**
388
-	 * Define the locale for this plugin for internationalization.
389
-	 *
390
-	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
391
-	 * with WordPress.
392
-	 *
393
-	 * @since    1.0.0
394
-	 * @access   private
395
-	 */
396
-	private function set_locale() {
387
+    /**
388
+     * Define the locale for this plugin for internationalization.
389
+     *
390
+     * Uses the Wordlift_i18n class in order to set the domain and to register the hook
391
+     * with WordPress.
392
+     *
393
+     * @since    1.0.0
394
+     * @access   private
395
+     */
396
+    private function set_locale() {
397 397
 
398
-		$plugin_i18n = new Wordlift_i18n();
399
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
398
+        $plugin_i18n = new Wordlift_i18n();
399
+        $plugin_i18n->set_domain( $this->get_plugin_name() );
400 400
 
401
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
401
+        $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
402 402
 
403
-	}
403
+    }
404 404
 
405
-	/**
406
-	 * Register all of the hooks related to the admin area functionality
407
-	 * of the plugin.
408
-	 *
409
-	 * @since    1.0.0
410
-	 * @access   private
411
-	 */
412
-	private function define_admin_hooks() {
405
+    /**
406
+     * Register all of the hooks related to the admin area functionality
407
+     * of the plugin.
408
+     *
409
+     * @since    1.0.0
410
+     * @access   private
411
+     */
412
+    private function define_admin_hooks() {
413 413
 
414
-		$plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() );
414
+        $plugin_admin = new Wordlift_Admin( $this->get_plugin_name(), $this->get_version() );
415 415
 
416
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
417
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
416
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
417
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
418 418
 
419
-		// Hook the init action to the Topic Taxonomy service.
420
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
419
+        // Hook the init action to the Topic Taxonomy service.
420
+        $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
421 421
 
422
-		// Hook the deleted_post_meta action to the Thumbnail service.
423
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
422
+        // Hook the deleted_post_meta action to the Thumbnail service.
423
+        $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
424 424
 
425
-		// Hook the added_post_meta action to the Thumbnail service.
426
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
425
+        // Hook the added_post_meta action to the Thumbnail service.
426
+        $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
427 427
 		
428
-		// Hook the updated_post_meta action to the Thumbnail service.
429
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
430
-
431
-		// Hook posts inserts (or updates) to the user service.
432
-		$this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
433
-
434
-		// Hook the AJAX wl_timeline action to the Timeline service.
435
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
436
-
437
-		// Register custom allowed redirect hosts.
438
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
439
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
440
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
441
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
442
-		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
443
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
444
-		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
445
-
446
-		// Hook save_post to the entity service to update custom fields (such as alternate labels).
447
-		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
448
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
449
-		$this->loader->add_action( 'save_post_entity', $this->entity_service, 'set_rating_for', 10, 1 );
428
+        // Hook the updated_post_meta action to the Thumbnail service.
429
+        $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
430
+
431
+        // Hook posts inserts (or updates) to the user service.
432
+        $this->loader->add_action( 'wp_insert_post', $this->user_service, 'wp_insert_post', 10, 3 );
433
+
434
+        // Hook the AJAX wl_timeline action to the Timeline service.
435
+        $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
436
+
437
+        // Register custom allowed redirect hosts.
438
+        $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
439
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
440
+        $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
441
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
442
+        $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
443
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
444
+        $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
445
+
446
+        // Hook save_post to the entity service to update custom fields (such as alternate labels).
447
+        // We have a priority of 9 because we want to be executed before data is sent to Redlink.
448
+        $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
449
+        $this->loader->add_action( 'save_post_entity', $this->entity_service, 'set_rating_for', 10, 1 );
450 450
 		
451
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
452
-		$this->loader->add_action( 'in_admin_header', $this->entity_service, 'in_admin_header' );
453
-
454
-		// Entity listing customization (wp-admin/edit.php)
455
-		// Add custom columns
456
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
457
-		$this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
458
-		// Add 4W selection
459
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
460
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
451
+        $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
452
+        $this->loader->add_action( 'in_admin_header', $this->entity_service, 'in_admin_header' );
453
+
454
+        // Entity listing customization (wp-admin/edit.php)
455
+        // Add custom columns
456
+        $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
457
+        $this->loader->add_filter( 'manage_entity_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
458
+        // Add 4W selection
459
+        $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
460
+        $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
461 461
 		
462
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
463
-
464
-		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
465
-		// entities.
466
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
467
-	}
468
-
469
-	/**
470
-	 * Register all of the hooks related to the public-facing functionality
471
-	 * of the plugin.
472
-	 *
473
-	 * @since    1.0.0
474
-	 * @access   private
475
-	 */
476
-	private function define_public_hooks() {
477
-
478
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
479
-
480
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
481
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
482
-
483
-		// Hook the AJAX wl_timeline action to the Timeline service.
484
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
485
-
486
-		// Hook the ShareThis service.
487
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
488
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
489
-
490
-	}
491
-
492
-	/**
493
-	 * Run the loader to execute all of the hooks with WordPress.
494
-	 *
495
-	 * @since    1.0.0
496
-	 */
497
-	public function run() {
498
-		$this->loader->run();
499
-	}
500
-
501
-	/**
502
-	 * The name of the plugin used to uniquely identify it within the context of
503
-	 * WordPress and to define internationalization functionality.
504
-	 *
505
-	 * @since     1.0.0
506
-	 * @return    string    The name of the plugin.
507
-	 */
508
-	public function get_plugin_name() {
509
-		return $this->plugin_name;
510
-	}
511
-
512
-	/**
513
-	 * The reference to the class that orchestrates the hooks with the plugin.
514
-	 *
515
-	 * @since     1.0.0
516
-	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
517
-	 */
518
-	public function get_loader() {
519
-		return $this->loader;
520
-	}
521
-
522
-	/**
523
-	 * Retrieve the version number of the plugin.
524
-	 *
525
-	 * @since     1.0.0
526
-	 * @return    string    The version number of the plugin.
527
-	 */
528
-	public function get_version() {
529
-		return $this->version;
530
-	}
462
+        $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
463
+
464
+        // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
465
+        // entities.
466
+        $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
467
+    }
468
+
469
+    /**
470
+     * Register all of the hooks related to the public-facing functionality
471
+     * of the plugin.
472
+     *
473
+     * @since    1.0.0
474
+     * @access   private
475
+     */
476
+    private function define_public_hooks() {
477
+
478
+        $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
479
+
480
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
481
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
482
+
483
+        // Hook the AJAX wl_timeline action to the Timeline service.
484
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
485
+
486
+        // Hook the ShareThis service.
487
+        $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
488
+        $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
489
+
490
+    }
491
+
492
+    /**
493
+     * Run the loader to execute all of the hooks with WordPress.
494
+     *
495
+     * @since    1.0.0
496
+     */
497
+    public function run() {
498
+        $this->loader->run();
499
+    }
500
+
501
+    /**
502
+     * The name of the plugin used to uniquely identify it within the context of
503
+     * WordPress and to define internationalization functionality.
504
+     *
505
+     * @since     1.0.0
506
+     * @return    string    The name of the plugin.
507
+     */
508
+    public function get_plugin_name() {
509
+        return $this->plugin_name;
510
+    }
511
+
512
+    /**
513
+     * The reference to the class that orchestrates the hooks with the plugin.
514
+     *
515
+     * @since     1.0.0
516
+     * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
517
+     */
518
+    public function get_loader() {
519
+        return $this->loader;
520
+    }
521
+
522
+    /**
523
+     * Retrieve the version number of the plugin.
524
+     *
525
+     * @since     1.0.0
526
+     * @return    string    The version number of the plugin.
527
+     */
528
+    public function get_version() {
529
+        return $this->version;
530
+    }
531 531
 
532 532
 }
Please login to merge, or discard this patch.