Completed
Push — master ( c2ab66...fc2fb1 )
by David
03:14
created
src/admin/wordlift_admin_ajax_related_posts.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -16,54 +16,54 @@
 block discarded – undo
16 16
  */
17 17
 function wordlift_ajax_related_posts( $http_raw_data = null ) {
18 18
 
19
-	// Extract filtering conditions
20
-	if ( ! isset( $_GET["post_id"] ) || ! is_numeric( $_GET["post_id"] ) ) {
21
-		wp_die( 'Post id missing or invalid!' );
19
+    // Extract filtering conditions
20
+    if ( ! isset( $_GET["post_id"] ) || ! is_numeric( $_GET["post_id"] ) ) {
21
+        wp_die( 'Post id missing or invalid!' );
22 22
 
23
-		return;
24
-	}
23
+        return;
24
+    }
25 25
 
26
-	// Get the current post
27
-	$post_id = $_GET["post_id"];
28
-	$post    = get_post( $post_id );
26
+    // Get the current post
27
+    $post_id = $_GET["post_id"];
28
+    $post    = get_post( $post_id );
29 29
 
30
-	Wordlift_Log_Service::get_logger( 'wordlift_ajax_related_posts' )->trace( "Going to find posts related to current with post id: $post_id ..." );
30
+    Wordlift_Log_Service::get_logger( 'wordlift_ajax_related_posts' )->trace( "Going to find posts related to current with post id: $post_id ..." );
31 31
 
32
-	// Extract filtering conditions
33
-	$filtering_entity_uris = ( null == $http_raw_data ) ? file_get_contents( "php://input" ) : $http_raw_data;
34
-	$filtering_entity_uris = json_decode( $filtering_entity_uris );
32
+    // Extract filtering conditions
33
+    $filtering_entity_uris = ( null == $http_raw_data ) ? file_get_contents( "php://input" ) : $http_raw_data;
34
+    $filtering_entity_uris = json_decode( $filtering_entity_uris );
35 35
 
36
-	$filtering_entity_ids = wl_get_entity_post_ids_by_uris( $filtering_entity_uris );
37
-	$related_posts        = array();
36
+    $filtering_entity_ids = wl_get_entity_post_ids_by_uris( $filtering_entity_uris );
37
+    $related_posts        = array();
38 38
 
39
-	// If the current post is an entity, related posts to the current entity are
40
-	// returned.
41
-	$entity_service = Wordlift_Entity_Service::get_instance();
39
+    // If the current post is an entity, related posts to the current entity are
40
+    // returned.
41
+    $entity_service = Wordlift_Entity_Service::get_instance();
42 42
 
43
-	if ( $entity_service->is_entity( $post->ID ) ) {
44
-		$filtering_entity_ids = array( $post_id );
45
-	}
43
+    if ( $entity_service->is_entity( $post->ID ) ) {
44
+        $filtering_entity_ids = array( $post_id );
45
+    }
46 46
 
47
-	if ( ! empty( $filtering_entity_ids ) ) {
47
+    if ( ! empty( $filtering_entity_ids ) ) {
48 48
 
49
-		$related_posts = Wordlift_Relation_Service::get_instance()
50
-		                                          ->get_article_subjects( $filtering_entity_ids, '*', null, 'publish', array( $post_id ), 5 );
49
+        $related_posts = Wordlift_Relation_Service::get_instance()
50
+                                                    ->get_article_subjects( $filtering_entity_ids, '*', null, 'publish', array( $post_id ), 5 );
51 51
 
52
-		foreach ( $related_posts as $post_obj ) {
52
+        foreach ( $related_posts as $post_obj ) {
53 53
 
54
-			/**
55
-			 * Use the thumbnail.
56
-			 *
57
-			 * @see https://github.com/insideout10/wordlift-plugin/issues/825 related issue.
58
-			 */
59
-			$thumbnail           = get_the_post_thumbnail_url( $post_obj, 'thumbnail' );
60
-			$post_obj->thumbnail = ( $thumbnail ) ? $thumbnail : WL_DEFAULT_THUMBNAIL_PATH;
61
-			$post_obj->link      = get_edit_post_link( $post_obj->ID, 'none' );
62
-			$post_obj->permalink = get_post_permalink( $post_obj->ID );
63
-		}
64
-	}
54
+            /**
55
+             * Use the thumbnail.
56
+             *
57
+             * @see https://github.com/insideout10/wordlift-plugin/issues/825 related issue.
58
+             */
59
+            $thumbnail           = get_the_post_thumbnail_url( $post_obj, 'thumbnail' );
60
+            $post_obj->thumbnail = ( $thumbnail ) ? $thumbnail : WL_DEFAULT_THUMBNAIL_PATH;
61
+            $post_obj->link      = get_edit_post_link( $post_obj->ID, 'none' );
62
+            $post_obj->permalink = get_post_permalink( $post_obj->ID );
63
+        }
64
+    }
65 65
 
66
-	wl_core_send_json( $related_posts );
66
+    wl_core_send_json( $related_posts );
67 67
 
68 68
 }
69 69
 
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -14,57 +14,57 @@
 block discarded – undo
14 14
  *
15 15
  * @param null $http_raw_data
16 16
  */
17
-function wordlift_ajax_related_posts( $http_raw_data = null ) {
17
+function wordlift_ajax_related_posts($http_raw_data = null) {
18 18
 
19 19
 	// Extract filtering conditions
20
-	if ( ! isset( $_GET["post_id"] ) || ! is_numeric( $_GET["post_id"] ) ) {
21
-		wp_die( 'Post id missing or invalid!' );
20
+	if ( ! isset($_GET["post_id"]) || ! is_numeric($_GET["post_id"])) {
21
+		wp_die('Post id missing or invalid!');
22 22
 
23 23
 		return;
24 24
 	}
25 25
 
26 26
 	// Get the current post
27 27
 	$post_id = $_GET["post_id"];
28
-	$post    = get_post( $post_id );
28
+	$post    = get_post($post_id);
29 29
 
30
-	Wordlift_Log_Service::get_logger( 'wordlift_ajax_related_posts' )->trace( "Going to find posts related to current with post id: $post_id ..." );
30
+	Wordlift_Log_Service::get_logger('wordlift_ajax_related_posts')->trace("Going to find posts related to current with post id: $post_id ...");
31 31
 
32 32
 	// Extract filtering conditions
33
-	$filtering_entity_uris = ( null == $http_raw_data ) ? file_get_contents( "php://input" ) : $http_raw_data;
34
-	$filtering_entity_uris = json_decode( $filtering_entity_uris );
33
+	$filtering_entity_uris = (null == $http_raw_data) ? file_get_contents("php://input") : $http_raw_data;
34
+	$filtering_entity_uris = json_decode($filtering_entity_uris);
35 35
 
36
-	$filtering_entity_ids = wl_get_entity_post_ids_by_uris( $filtering_entity_uris );
36
+	$filtering_entity_ids = wl_get_entity_post_ids_by_uris($filtering_entity_uris);
37 37
 	$related_posts        = array();
38 38
 
39 39
 	// If the current post is an entity, related posts to the current entity are
40 40
 	// returned.
41 41
 	$entity_service = Wordlift_Entity_Service::get_instance();
42 42
 
43
-	if ( $entity_service->is_entity( $post->ID ) ) {
44
-		$filtering_entity_ids = array( $post_id );
43
+	if ($entity_service->is_entity($post->ID)) {
44
+		$filtering_entity_ids = array($post_id);
45 45
 	}
46 46
 
47
-	if ( ! empty( $filtering_entity_ids ) ) {
47
+	if ( ! empty($filtering_entity_ids)) {
48 48
 
49 49
 		$related_posts = Wordlift_Relation_Service::get_instance()
50
-		                                          ->get_article_subjects( $filtering_entity_ids, '*', null, 'publish', array( $post_id ), 5 );
50
+		                                          ->get_article_subjects($filtering_entity_ids, '*', null, 'publish', array($post_id), 5);
51 51
 
52
-		foreach ( $related_posts as $post_obj ) {
52
+		foreach ($related_posts as $post_obj) {
53 53
 
54 54
 			/**
55 55
 			 * Use the thumbnail.
56 56
 			 *
57 57
 			 * @see https://github.com/insideout10/wordlift-plugin/issues/825 related issue.
58 58
 			 */
59
-			$thumbnail           = get_the_post_thumbnail_url( $post_obj, 'thumbnail' );
60
-			$post_obj->thumbnail = ( $thumbnail ) ? $thumbnail : WL_DEFAULT_THUMBNAIL_PATH;
61
-			$post_obj->link      = get_edit_post_link( $post_obj->ID, 'none' );
62
-			$post_obj->permalink = get_post_permalink( $post_obj->ID );
59
+			$thumbnail           = get_the_post_thumbnail_url($post_obj, 'thumbnail');
60
+			$post_obj->thumbnail = ($thumbnail) ? $thumbnail : WL_DEFAULT_THUMBNAIL_PATH;
61
+			$post_obj->link      = get_edit_post_link($post_obj->ID, 'none');
62
+			$post_obj->permalink = get_post_permalink($post_obj->ID);
63 63
 		}
64 64
 	}
65 65
 
66
-	wl_core_send_json( $related_posts );
66
+	wl_core_send_json($related_posts);
67 67
 
68 68
 }
69 69
 
70
-add_action( 'wp_ajax_wordlift_related_posts', 'wordlift_ajax_related_posts' );
70
+add_action('wp_ajax_wordlift_related_posts', 'wordlift_ajax_related_posts');
Please login to merge, or discard this patch.
src/wordlift.php 2 patches
Indentation   +140 added lines, -140 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.
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
  */
49 49
 function wl_write_log( $log ) {
50 50
 
51
-	Wordlift_Log_Service::get_instance()->debug( $log );
51
+    Wordlift_Log_Service::get_instance()->debug( $log );
52 52
 
53 53
 }
54 54
 
@@ -64,20 +64,20 @@  discard block
 block discarded – undo
64 64
  */
65 65
 function wl_write_log_handler( $log, $caller = null ) {
66 66
 
67
-	global $wl_logger;
67
+    global $wl_logger;
68 68
 
69
-	if ( true === WP_DEBUG ) {
69
+    if ( true === WP_DEBUG ) {
70 70
 
71
-		$message = ( isset( $caller ) ? sprintf( '[%-40.40s] ', $caller ) : '' ) .
72
-		           ( is_array( $log ) || is_object( $log ) ? print_r( $log, true ) : wl_write_log_hide_key( $log ) );
71
+        $message = ( isset( $caller ) ? sprintf( '[%-40.40s] ', $caller ) : '' ) .
72
+                    ( is_array( $log ) || is_object( $log ) ? print_r( $log, true ) : wl_write_log_hide_key( $log ) );
73 73
 
74
-		if ( isset( $wl_logger ) ) {
75
-			$wl_logger->info( $message );
76
-		} else {
77
-			error_log( $message );
78
-		}
74
+        if ( isset( $wl_logger ) ) {
75
+            $wl_logger->info( $message );
76
+        } else {
77
+            error_log( $message );
78
+        }
79 79
 
80
-	}
80
+    }
81 81
 
82 82
 }
83 83
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
  */
95 95
 function wl_write_log_hide_key( $text ) {
96 96
 
97
-	return str_ireplace( wl_configuration_get_key(), '<hidden>', $text );
97
+    return str_ireplace( wl_configuration_get_key(), '<hidden>', $text );
98 98
 }
99 99
 
100 100
 /**
@@ -102,21 +102,21 @@  discard block
 block discarded – undo
102 102
  * see http://vip.wordpress.com/documentation/register-additional-html-attributes-for-tinymce-and-wp-kses/
103 103
  */
104 104
 function wordlift_allowed_post_tags() {
105
-	global $allowedposttags;
106
-
107
-	$tags           = array( 'span' );
108
-	$new_attributes = array(
109
-		'itemscope' => array(),
110
-		'itemtype'  => array(),
111
-		'itemprop'  => array(),
112
-		'itemid'    => array(),
113
-	);
114
-
115
-	foreach ( $tags as $tag ) {
116
-		if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) {
117
-			$allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes );
118
-		}
119
-	}
105
+    global $allowedposttags;
106
+
107
+    $tags           = array( 'span' );
108
+    $new_attributes = array(
109
+        'itemscope' => array(),
110
+        'itemtype'  => array(),
111
+        'itemprop'  => array(),
112
+        'itemid'    => array(),
113
+    );
114
+
115
+    foreach ( $tags as $tag ) {
116
+        if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) {
117
+            $allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes );
118
+        }
119
+    }
120 120
 }
121 121
 
122 122
 // add allowed post tags.
@@ -127,39 +127,39 @@  discard block
 block discarded – undo
127 127
  */
128 128
 function wordlift_admin_enqueue_scripts() {
129 129
 
130
-	// Added for compatibility with WordPress 3.9 (see http://make.wordpress.org/core/2014/04/16/jquery-ui-and-wpdialogs-in-wordpress-3-9/)
131
-	wp_enqueue_script( 'wpdialogs' );
132
-	wp_enqueue_style( 'wp-jquery-ui-dialog' );
130
+    // Added for compatibility with WordPress 3.9 (see http://make.wordpress.org/core/2014/04/16/jquery-ui-and-wpdialogs-in-wordpress-3-9/)
131
+    wp_enqueue_script( 'wpdialogs' );
132
+    wp_enqueue_style( 'wp-jquery-ui-dialog' );
133 133
 
134
-	wp_enqueue_style( 'wordlift-reloaded', plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css' );
134
+    wp_enqueue_style( 'wordlift-reloaded', plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css' );
135 135
 
136
-	wp_enqueue_script( 'jquery-ui-autocomplete' );
136
+    wp_enqueue_script( 'jquery-ui-autocomplete' );
137 137
 
138
-	$log = Wordlift_Log_Service::get_logger( 'wordlift_admin_enqueue_scripts' );
139
-	$log->trace( 'Registering admin scripts...' );
138
+    $log = Wordlift_Log_Service::get_logger( 'wordlift_admin_enqueue_scripts' );
139
+    $log->trace( 'Registering admin scripts...' );
140 140
 
141
-	// We now register angular scripts and have dependent scripts (currently
142
-	// only the edit post page) depend on them, to avoid potential conflicts.
143
-	//
144
-	// See https://github.com/insideout10/wordlift-plugin/issues/691.
145
-	$result = wp_register_script( 'wl-angular', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js' )
146
-	          && wp_register_script( 'wl-angular-geolocation', plugin_dir_url( __FILE__ ) . 'bower_components/angularjs-geolocation/dist/angularjs-geolocation.min.js' )
147
-	          && wp_register_script( 'wl-angular-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js' )
148
-	          && wp_register_script( 'wl-angular-animate', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-animate.min.js' );
141
+    // We now register angular scripts and have dependent scripts (currently
142
+    // only the edit post page) depend on them, to avoid potential conflicts.
143
+    //
144
+    // See https://github.com/insideout10/wordlift-plugin/issues/691.
145
+    $result = wp_register_script( 'wl-angular', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js' )
146
+              && wp_register_script( 'wl-angular-geolocation', plugin_dir_url( __FILE__ ) . 'bower_components/angularjs-geolocation/dist/angularjs-geolocation.min.js' )
147
+              && wp_register_script( 'wl-angular-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js' )
148
+              && wp_register_script( 'wl-angular-animate', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-animate.min.js' );
149 149
 
150
-	$log->debug( 'Registering angular scripts was ' . ( $result ? 'successful.' : 'unsuccessful.' ) );
150
+    $log->debug( 'Registering angular scripts was ' . ( $result ? 'successful.' : 'unsuccessful.' ) );
151 151
 
152
-	// Disable auto-save for custom entity posts only
153
-	if ( Wordlift_Entity_Service::TYPE_NAME === get_post_type() ) {
154
-		wp_dequeue_script( 'autosave' );
155
-	}
152
+    // Disable auto-save for custom entity posts only
153
+    if ( Wordlift_Entity_Service::TYPE_NAME === get_post_type() ) {
154
+        wp_dequeue_script( 'autosave' );
155
+    }
156 156
 
157 157
 }
158 158
 
159 159
 add_action( 'admin_enqueue_scripts', 'wordlift_admin_enqueue_scripts' );
160 160
 
161 161
 function wl_enqueue_scripts() {
162
-	wp_enqueue_style( 'wordlift-ui', plugin_dir_url( __FILE__ ) . 'css/wordlift-ui.min.css' );
162
+    wp_enqueue_style( 'wordlift-ui', plugin_dir_url( __FILE__ ) . 'css/wordlift-ui.min.css' );
163 163
 }
164 164
 
165 165
 add_action( 'wp_enqueue_scripts', 'wl_enqueue_scripts' );
@@ -174,18 +174,18 @@  discard block
 block discarded – undo
174 174
  */
175 175
 function wordlift_allowed_html( $allowedtags, $context ) {
176 176
 
177
-	if ( 'post' !== $context ) {
178
-		return $allowedtags;
179
-	}
180
-
181
-	return array_merge_recursive( $allowedtags, array(
182
-		'span' => array(
183
-			'itemscope' => true,
184
-			'itemtype'  => true,
185
-			'itemid'    => true,
186
-			'itemprop'  => true,
187
-		),
188
-	) );
177
+    if ( 'post' !== $context ) {
178
+        return $allowedtags;
179
+    }
180
+
181
+    return array_merge_recursive( $allowedtags, array(
182
+        'span' => array(
183
+            'itemscope' => true,
184
+            'itemtype'  => true,
185
+            'itemid'    => true,
186
+            'itemprop'  => true,
187
+        ),
188
+    ) );
189 189
 }
190 190
 
191 191
 add_filter( 'wp_kses_allowed_html', 'wordlift_allowed_html', 10, 2 );
@@ -199,16 +199,16 @@  discard block
 block discarded – undo
199 199
  */
200 200
 function wl_get_coordinates( $post_id ) {
201 201
 
202
-	$latitude  = wl_schema_get_value( $post_id, 'latitude' );
203
-	$longitude = wl_schema_get_value( $post_id, 'longitude' );
202
+    $latitude  = wl_schema_get_value( $post_id, 'latitude' );
203
+    $longitude = wl_schema_get_value( $post_id, 'longitude' );
204 204
 
205
-	// DO NOT set latitude/longitude to 0/0 as default values. It's a specific
206
-	// place on the globe:"The zero/zero point of this system is located in the
207
-	// Gulf of Guinea about 625 km (390 mi) south of Tema, Ghana."
208
-	return array(
209
-		'latitude'  => isset( $latitude[0] ) && is_numeric( $latitude[0] ) ? $latitude[0] : '',
210
-		'longitude' => isset( $longitude[0] ) && is_numeric( $longitude[0] ) ? $longitude[0] : '',
211
-	);
205
+    // DO NOT set latitude/longitude to 0/0 as default values. It's a specific
206
+    // place on the globe:"The zero/zero point of this system is located in the
207
+    // Gulf of Guinea about 625 km (390 mi) south of Tema, Ghana."
208
+    return array(
209
+        'latitude'  => isset( $latitude[0] ) && is_numeric( $latitude[0] ) ? $latitude[0] : '',
210
+        'longitude' => isset( $longitude[0] ) && is_numeric( $longitude[0] ) ? $longitude[0] : '',
211
+    );
212 212
 }
213 213
 
214 214
 /**
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
  */
223 223
 function wl_get_image_urls( $post_id ) {
224 224
 
225
-	return Wordlift_Storage_Factory::get_instance()
226
-	                               ->post_images()
227
-	                               ->get( $post_id );
225
+    return Wordlift_Storage_Factory::get_instance()
226
+                                    ->post_images()
227
+                                    ->get( $post_id );
228 228
 
229 229
 //	// If there is a featured image it has the priority.
230 230
 //	$featured_image_id = get_post_thumbnail_id( $post_id );
@@ -272,24 +272,24 @@  discard block
 block discarded – undo
272 272
  */
273 273
 function wl_get_attachment_for_source_url( $parent_post_id, $source_url ) {
274 274
 
275
-	// wl_write_log( "wl_get_attachment_for_source_url [ parent post id :: $parent_post_id ][ source url :: $source_url ]" );
275
+    // wl_write_log( "wl_get_attachment_for_source_url [ parent post id :: $parent_post_id ][ source url :: $source_url ]" );
276 276
 
277
-	$posts = get_posts( array(
278
-		'post_type'      => 'attachment',
279
-		'posts_per_page' => 1,
280
-		'post_status'    => 'any',
281
-		'post_parent'    => $parent_post_id,
282
-		'meta_key'       => 'wl_source_url',
283
-		'meta_value'     => $source_url,
284
-	) );
277
+    $posts = get_posts( array(
278
+        'post_type'      => 'attachment',
279
+        'posts_per_page' => 1,
280
+        'post_status'    => 'any',
281
+        'post_parent'    => $parent_post_id,
282
+        'meta_key'       => 'wl_source_url',
283
+        'meta_value'     => $source_url,
284
+    ) );
285 285
 
286
-	// Return the found post.
287
-	if ( 1 === count( $posts ) ) {
288
-		return $posts[0];
289
-	}
286
+    // Return the found post.
287
+    if ( 1 === count( $posts ) ) {
288
+        return $posts[0];
289
+    }
290 290
 
291
-	// Return null.
292
-	return null;
291
+    // Return null.
292
+    return null;
293 293
 }
294 294
 
295 295
 /**
@@ -300,8 +300,8 @@  discard block
 block discarded – undo
300 300
  */
301 301
 function wl_set_source_url( $post_id, $source_url ) {
302 302
 
303
-	delete_post_meta( $post_id, 'wl_source_url' );
304
-	add_post_meta( $post_id, 'wl_source_url', $source_url );
303
+    delete_post_meta( $post_id, 'wl_source_url' );
304
+    add_post_meta( $post_id, 'wl_source_url', $source_url );
305 305
 }
306 306
 
307 307
 /**
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
  */
318 318
 function wl_sanitize_uri_path( $path, $char = '_' ) {
319 319
 
320
-	return Wordlift_Uri_Service::get_instance()->sanitize_path( $path, $char );
320
+    return Wordlift_Uri_Service::get_instance()->sanitize_path( $path, $char );
321 321
 }
322 322
 
323 323
 ///**
@@ -358,47 +358,47 @@  discard block
 block discarded – undo
358 358
  */
359 359
 function wl_replace_item_id_with_uri( $content ) {
360 360
 
361
-	$log = Wordlift_Log_Service::get_logger( 'wl_replace_item_id_with_uri' );
362
-	$log->trace( 'Replacing item IDs with URIs...' );
361
+    $log = Wordlift_Log_Service::get_logger( 'wl_replace_item_id_with_uri' );
362
+    $log->trace( 'Replacing item IDs with URIs...' );
363 363
 
364
-	// Strip slashes, see https://core.trac.wordpress.org/ticket/21767
365
-	$content = stripslashes( $content );
364
+    // Strip slashes, see https://core.trac.wordpress.org/ticket/21767
365
+    $content = stripslashes( $content );
366 366
 
367
-	// If any match are found.
368
-	$matches = array();
369
-	if ( 0 < preg_match_all( '/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER ) ) {
367
+    // If any match are found.
368
+    $matches = array();
369
+    if ( 0 < preg_match_all( '/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER ) ) {
370 370
 
371
-		foreach ( $matches as $match ) {
371
+        foreach ( $matches as $match ) {
372 372
 
373
-			// Get the item ID.
374
-			$item_id = $match[1];
373
+            // Get the item ID.
374
+            $item_id = $match[1];
375 375
 
376
-			// Get the post bound to that item ID (looking both in the 'official' URI and in the 'same-as' .
377
-			$post = Wordlift_Entity_Service::get_instance()
378
-			                               ->get_entity_post_by_uri( $item_id );
376
+            // Get the post bound to that item ID (looking both in the 'official' URI and in the 'same-as' .
377
+            $post = Wordlift_Entity_Service::get_instance()
378
+                                            ->get_entity_post_by_uri( $item_id );
379 379
 
380
-			// If no entity is found, continue to the next one.
381
-			if ( null === $post ) {
382
-				continue;
383
-			}
380
+            // If no entity is found, continue to the next one.
381
+            if ( null === $post ) {
382
+                continue;
383
+            }
384 384
 
385
-			// Get the URI for that post.
386
-			$uri = wl_get_entity_uri( $post->ID );
385
+            // Get the URI for that post.
386
+            $uri = wl_get_entity_uri( $post->ID );
387 387
 
388
-			// wl_write_log( "wl_replace_item_id_with_uri [ item id :: $item_id ][ uri :: $uri ]" );
388
+            // wl_write_log( "wl_replace_item_id_with_uri [ item id :: $item_id ][ uri :: $uri ]" );
389 389
 
390
-			// If the item ID and the URI differ, replace the item ID with the URI saved in WordPress.
391
-			if ( $item_id !== $uri ) {
392
-				$uri_e   = esc_html( $uri );
393
-				$content = str_replace( " itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content );
394
-			}
395
-		}
396
-	}
390
+            // If the item ID and the URI differ, replace the item ID with the URI saved in WordPress.
391
+            if ( $item_id !== $uri ) {
392
+                $uri_e   = esc_html( $uri );
393
+                $content = str_replace( " itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content );
394
+            }
395
+        }
396
+    }
397 397
 
398
-	// Reapply slashes.
399
-	$content = addslashes( $content );
398
+    // Reapply slashes.
399
+    $content = addslashes( $content );
400 400
 
401
-	return $content;
401
+    return $content;
402 402
 }
403 403
 
404 404
 add_filter( 'content_save_pre', 'wl_replace_item_id_with_uri', 1, 1 );
@@ -459,24 +459,24 @@  discard block
 block discarded – undo
459 459
  */
460 460
 function activate_wordlift() {
461 461
 
462
-	$log = Wordlift_Log_Service::get_logger( 'activate_wordlift' );
462
+    $log = Wordlift_Log_Service::get_logger( 'activate_wordlift' );
463 463
 
464
-	$log->info( 'Activating WordLift...' );
464
+    $log->info( 'Activating WordLift...' );
465 465
 
466
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php';
467
-	Wordlift_Activator::activate();
466
+    require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php';
467
+    Wordlift_Activator::activate();
468 468
 
469
-	/**
470
-	 * Tell the {@link Wordlift_Http_Api} class that we're activating, to let it run activation tasks.
471
-	 *
472
-	 * @see https://github.com/insideout10/wordlift-plugin/issues/820 related issue.
473
-	 * @since 3.19.2
474
-	 */
475
-	Wordlift_Http_Api::activate();
469
+    /**
470
+     * Tell the {@link Wordlift_Http_Api} class that we're activating, to let it run activation tasks.
471
+     *
472
+     * @see https://github.com/insideout10/wordlift-plugin/issues/820 related issue.
473
+     * @since 3.19.2
474
+     */
475
+    Wordlift_Http_Api::activate();
476 476
 
477
-	// Ensure the post type is registered before flushing the rewrite rules.
478
-	Wordlift_Entity_Post_Type_Service::get_instance()->register();
479
-	flush_rewrite_rules();
477
+    // Ensure the post type is registered before flushing the rewrite rules.
478
+    Wordlift_Entity_Post_Type_Service::get_instance()->register();
479
+    flush_rewrite_rules();
480 480
 
481 481
 }
482 482
 
@@ -486,9 +486,9 @@  discard block
 block discarded – undo
486 486
  */
487 487
 function deactivate_wordlift() {
488 488
 
489
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php';
490
-	Wordlift_Deactivator::deactivate();
491
-	flush_rewrite_rules();
489
+    require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php';
490
+    Wordlift_Deactivator::deactivate();
491
+    flush_rewrite_rules();
492 492
 
493 493
 }
494 494
 
@@ -512,8 +512,8 @@  discard block
 block discarded – undo
512 512
  */
513 513
 function run_wordlift() {
514 514
 
515
-	$plugin = new Wordlift();
516
-	$plugin->run();
515
+    $plugin = new Wordlift();
516
+    $plugin->run();
517 517
 
518 518
 }
519 519
 
Please login to merge, or discard this patch.
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -25,15 +25,15 @@  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' );
36
+require_once('modules/core/wordlift_core.php');
37 37
 
38 38
 /**
39 39
  * Log to the debug.log file.
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
  *
47 47
  * @param string|mixed $log The log data.
48 48
  */
49
-function wl_write_log( $log ) {
49
+function wl_write_log($log) {
50 50
 
51
-	Wordlift_Log_Service::get_instance()->debug( $log );
51
+	Wordlift_Log_Service::get_instance()->debug($log);
52 52
 
53 53
 }
54 54
 
@@ -62,19 +62,19 @@  discard block
 block discarded – undo
62 62
  * @param string|array $log The log data.
63 63
  * @param string       $caller The calling function.
64 64
  */
65
-function wl_write_log_handler( $log, $caller = null ) {
65
+function wl_write_log_handler($log, $caller = null) {
66 66
 
67 67
 	global $wl_logger;
68 68
 
69
-	if ( true === WP_DEBUG ) {
69
+	if (true === WP_DEBUG) {
70 70
 
71
-		$message = ( isset( $caller ) ? sprintf( '[%-40.40s] ', $caller ) : '' ) .
72
-		           ( is_array( $log ) || is_object( $log ) ? print_r( $log, true ) : wl_write_log_hide_key( $log ) );
71
+		$message = (isset($caller) ? sprintf('[%-40.40s] ', $caller) : '').
72
+		           (is_array($log) || is_object($log) ? print_r($log, true) : wl_write_log_hide_key($log));
73 73
 
74
-		if ( isset( $wl_logger ) ) {
75
-			$wl_logger->info( $message );
74
+		if (isset($wl_logger)) {
75
+			$wl_logger->info($message);
76 76
 		} else {
77
-			error_log( $message );
77
+			error_log($message);
78 78
 		}
79 79
 
80 80
 	}
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
  *
93 93
  * @return string A text with the key hidden.
94 94
  */
95
-function wl_write_log_hide_key( $text ) {
95
+function wl_write_log_hide_key($text) {
96 96
 
97
-	return str_ireplace( wl_configuration_get_key(), '<hidden>', $text );
97
+	return str_ireplace(wl_configuration_get_key(), '<hidden>', $text);
98 98
 }
99 99
 
100 100
 /**
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 function wordlift_allowed_post_tags() {
105 105
 	global $allowedposttags;
106 106
 
107
-	$tags           = array( 'span' );
107
+	$tags           = array('span');
108 108
 	$new_attributes = array(
109 109
 		'itemscope' => array(),
110 110
 		'itemtype'  => array(),
@@ -112,15 +112,15 @@  discard block
 block discarded – undo
112 112
 		'itemid'    => array(),
113 113
 	);
114 114
 
115
-	foreach ( $tags as $tag ) {
116
-		if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) {
117
-			$allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes );
115
+	foreach ($tags as $tag) {
116
+		if (isset($allowedposttags[$tag]) && is_array($allowedposttags[$tag])) {
117
+			$allowedposttags[$tag] = array_merge($allowedposttags[$tag], $new_attributes);
118 118
 		}
119 119
 	}
120 120
 }
121 121
 
122 122
 // add allowed post tags.
123
-add_action( 'init', 'wordlift_allowed_post_tags' );
123
+add_action('init', 'wordlift_allowed_post_tags');
124 124
 
125 125
 /**
126 126
  * Register additional scripts for the admin UI.
@@ -128,41 +128,41 @@  discard block
 block discarded – undo
128 128
 function wordlift_admin_enqueue_scripts() {
129 129
 
130 130
 	// Added for compatibility with WordPress 3.9 (see http://make.wordpress.org/core/2014/04/16/jquery-ui-and-wpdialogs-in-wordpress-3-9/)
131
-	wp_enqueue_script( 'wpdialogs' );
132
-	wp_enqueue_style( 'wp-jquery-ui-dialog' );
131
+	wp_enqueue_script('wpdialogs');
132
+	wp_enqueue_style('wp-jquery-ui-dialog');
133 133
 
134
-	wp_enqueue_style( 'wordlift-reloaded', plugin_dir_url( __FILE__ ) . 'css/wordlift-reloaded.min.css' );
134
+	wp_enqueue_style('wordlift-reloaded', plugin_dir_url(__FILE__).'css/wordlift-reloaded.min.css');
135 135
 
136
-	wp_enqueue_script( 'jquery-ui-autocomplete' );
136
+	wp_enqueue_script('jquery-ui-autocomplete');
137 137
 
138
-	$log = Wordlift_Log_Service::get_logger( 'wordlift_admin_enqueue_scripts' );
139
-	$log->trace( 'Registering admin scripts...' );
138
+	$log = Wordlift_Log_Service::get_logger('wordlift_admin_enqueue_scripts');
139
+	$log->trace('Registering admin scripts...');
140 140
 
141 141
 	// We now register angular scripts and have dependent scripts (currently
142 142
 	// only the edit post page) depend on them, to avoid potential conflicts.
143 143
 	//
144 144
 	// See https://github.com/insideout10/wordlift-plugin/issues/691.
145
-	$result = wp_register_script( 'wl-angular', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js' )
146
-	          && wp_register_script( 'wl-angular-geolocation', plugin_dir_url( __FILE__ ) . 'bower_components/angularjs-geolocation/dist/angularjs-geolocation.min.js' )
147
-	          && wp_register_script( 'wl-angular-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js' )
148
-	          && wp_register_script( 'wl-angular-animate', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-animate.min.js' );
145
+	$result = wp_register_script('wl-angular', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js')
146
+	          && wp_register_script('wl-angular-geolocation', plugin_dir_url(__FILE__).'bower_components/angularjs-geolocation/dist/angularjs-geolocation.min.js')
147
+	          && wp_register_script('wl-angular-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js')
148
+	          && wp_register_script('wl-angular-animate', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-animate.min.js');
149 149
 
150
-	$log->debug( 'Registering angular scripts was ' . ( $result ? 'successful.' : 'unsuccessful.' ) );
150
+	$log->debug('Registering angular scripts was '.($result ? 'successful.' : 'unsuccessful.'));
151 151
 
152 152
 	// Disable auto-save for custom entity posts only
153
-	if ( Wordlift_Entity_Service::TYPE_NAME === get_post_type() ) {
154
-		wp_dequeue_script( 'autosave' );
153
+	if (Wordlift_Entity_Service::TYPE_NAME === get_post_type()) {
154
+		wp_dequeue_script('autosave');
155 155
 	}
156 156
 
157 157
 }
158 158
 
159
-add_action( 'admin_enqueue_scripts', 'wordlift_admin_enqueue_scripts' );
159
+add_action('admin_enqueue_scripts', 'wordlift_admin_enqueue_scripts');
160 160
 
161 161
 function wl_enqueue_scripts() {
162
-	wp_enqueue_style( 'wordlift-ui', plugin_dir_url( __FILE__ ) . 'css/wordlift-ui.min.css' );
162
+	wp_enqueue_style('wordlift-ui', plugin_dir_url(__FILE__).'css/wordlift-ui.min.css');
163 163
 }
164 164
 
165
-add_action( 'wp_enqueue_scripts', 'wl_enqueue_scripts' );
165
+add_action('wp_enqueue_scripts', 'wl_enqueue_scripts');
166 166
 
167 167
 /**
168 168
  * Hooked to *wp_kses_allowed_html* filter, adds microdata attributes.
@@ -172,23 +172,23 @@  discard block
 block discarded – undo
172 172
  *
173 173
  * @return array An array which contains allowed microdata attributes.
174 174
  */
175
-function wordlift_allowed_html( $allowedtags, $context ) {
175
+function wordlift_allowed_html($allowedtags, $context) {
176 176
 
177
-	if ( 'post' !== $context ) {
177
+	if ('post' !== $context) {
178 178
 		return $allowedtags;
179 179
 	}
180 180
 
181
-	return array_merge_recursive( $allowedtags, array(
181
+	return array_merge_recursive($allowedtags, array(
182 182
 		'span' => array(
183 183
 			'itemscope' => true,
184 184
 			'itemtype'  => true,
185 185
 			'itemid'    => true,
186 186
 			'itemprop'  => true,
187 187
 		),
188
-	) );
188
+	));
189 189
 }
190 190
 
191
-add_filter( 'wp_kses_allowed_html', 'wordlift_allowed_html', 10, 2 );
191
+add_filter('wp_kses_allowed_html', 'wordlift_allowed_html', 10, 2);
192 192
 
193 193
 /**
194 194
  * Get the coordinates for the specified post ID.
@@ -197,17 +197,17 @@  discard block
 block discarded – undo
197 197
  *
198 198
  * @return array|null An array of coordinates or null.
199 199
  */
200
-function wl_get_coordinates( $post_id ) {
200
+function wl_get_coordinates($post_id) {
201 201
 
202
-	$latitude  = wl_schema_get_value( $post_id, 'latitude' );
203
-	$longitude = wl_schema_get_value( $post_id, 'longitude' );
202
+	$latitude  = wl_schema_get_value($post_id, 'latitude');
203
+	$longitude = wl_schema_get_value($post_id, 'longitude');
204 204
 
205 205
 	// DO NOT set latitude/longitude to 0/0 as default values. It's a specific
206 206
 	// place on the globe:"The zero/zero point of this system is located in the
207 207
 	// Gulf of Guinea about 625 km (390 mi) south of Tema, Ghana."
208 208
 	return array(
209
-		'latitude'  => isset( $latitude[0] ) && is_numeric( $latitude[0] ) ? $latitude[0] : '',
210
-		'longitude' => isset( $longitude[0] ) && is_numeric( $longitude[0] ) ? $longitude[0] : '',
209
+		'latitude'  => isset($latitude[0]) && is_numeric($latitude[0]) ? $latitude[0] : '',
210
+		'longitude' => isset($longitude[0]) && is_numeric($longitude[0]) ? $longitude[0] : '',
211 211
 	);
212 212
 }
213 213
 
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
  *
221 221
  * @return array An array of image URLs.
222 222
  */
223
-function wl_get_image_urls( $post_id ) {
223
+function wl_get_image_urls($post_id) {
224 224
 
225 225
 	return Wordlift_Storage_Factory::get_instance()
226 226
 	                               ->post_images()
227
-	                               ->get( $post_id );
227
+	                               ->get($post_id);
228 228
 
229 229
 //	// If there is a featured image it has the priority.
230 230
 //	$featured_image_id = get_post_thumbnail_id( $post_id );
@@ -270,21 +270,21 @@  discard block
 block discarded – undo
270 270
  *
271 271
  * @return WP_Post|null A post instance or null if not found.
272 272
  */
273
-function wl_get_attachment_for_source_url( $parent_post_id, $source_url ) {
273
+function wl_get_attachment_for_source_url($parent_post_id, $source_url) {
274 274
 
275 275
 	// wl_write_log( "wl_get_attachment_for_source_url [ parent post id :: $parent_post_id ][ source url :: $source_url ]" );
276 276
 
277
-	$posts = get_posts( array(
277
+	$posts = get_posts(array(
278 278
 		'post_type'      => 'attachment',
279 279
 		'posts_per_page' => 1,
280 280
 		'post_status'    => 'any',
281 281
 		'post_parent'    => $parent_post_id,
282 282
 		'meta_key'       => 'wl_source_url',
283 283
 		'meta_value'     => $source_url,
284
-	) );
284
+	));
285 285
 
286 286
 	// Return the found post.
287
-	if ( 1 === count( $posts ) ) {
287
+	if (1 === count($posts)) {
288 288
 		return $posts[0];
289 289
 	}
290 290
 
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
  * @param int    $post_id The post ID.
299 299
  * @param string $source_url The source URL.
300 300
  */
301
-function wl_set_source_url( $post_id, $source_url ) {
301
+function wl_set_source_url($post_id, $source_url) {
302 302
 
303
-	delete_post_meta( $post_id, 'wl_source_url' );
304
-	add_post_meta( $post_id, 'wl_source_url', $source_url );
303
+	delete_post_meta($post_id, 'wl_source_url');
304
+	add_post_meta($post_id, 'wl_source_url', $source_url);
305 305
 }
306 306
 
307 307
 /**
@@ -315,9 +315,9 @@  discard block
 block discarded – undo
315 315
  *
316 316
  * @return string The sanitized path.
317 317
  */
318
-function wl_sanitize_uri_path( $path, $char = '_' ) {
318
+function wl_sanitize_uri_path($path, $char = '_') {
319 319
 
320
-	return Wordlift_Uri_Service::get_instance()->sanitize_path( $path, $char );
320
+	return Wordlift_Uri_Service::get_instance()->sanitize_path($path, $char);
321 321
 }
322 322
 
323 323
 ///**
@@ -356,102 +356,102 @@  discard block
 block discarded – undo
356 356
  *
357 357
  * @return string The updated post content.
358 358
  */
359
-function wl_replace_item_id_with_uri( $content ) {
359
+function wl_replace_item_id_with_uri($content) {
360 360
 
361
-	$log = Wordlift_Log_Service::get_logger( 'wl_replace_item_id_with_uri' );
362
-	$log->trace( 'Replacing item IDs with URIs...' );
361
+	$log = Wordlift_Log_Service::get_logger('wl_replace_item_id_with_uri');
362
+	$log->trace('Replacing item IDs with URIs...');
363 363
 
364 364
 	// Strip slashes, see https://core.trac.wordpress.org/ticket/21767
365
-	$content = stripslashes( $content );
365
+	$content = stripslashes($content);
366 366
 
367 367
 	// If any match are found.
368 368
 	$matches = array();
369
-	if ( 0 < preg_match_all( '/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER ) ) {
369
+	if (0 < preg_match_all('/ itemid="([^"]+)"/i', $content, $matches, PREG_SET_ORDER)) {
370 370
 
371
-		foreach ( $matches as $match ) {
371
+		foreach ($matches as $match) {
372 372
 
373 373
 			// Get the item ID.
374 374
 			$item_id = $match[1];
375 375
 
376 376
 			// Get the post bound to that item ID (looking both in the 'official' URI and in the 'same-as' .
377 377
 			$post = Wordlift_Entity_Service::get_instance()
378
-			                               ->get_entity_post_by_uri( $item_id );
378
+			                               ->get_entity_post_by_uri($item_id);
379 379
 
380 380
 			// If no entity is found, continue to the next one.
381
-			if ( null === $post ) {
381
+			if (null === $post) {
382 382
 				continue;
383 383
 			}
384 384
 
385 385
 			// Get the URI for that post.
386
-			$uri = wl_get_entity_uri( $post->ID );
386
+			$uri = wl_get_entity_uri($post->ID);
387 387
 
388 388
 			// wl_write_log( "wl_replace_item_id_with_uri [ item id :: $item_id ][ uri :: $uri ]" );
389 389
 
390 390
 			// If the item ID and the URI differ, replace the item ID with the URI saved in WordPress.
391
-			if ( $item_id !== $uri ) {
392
-				$uri_e   = esc_html( $uri );
393
-				$content = str_replace( " itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content );
391
+			if ($item_id !== $uri) {
392
+				$uri_e   = esc_html($uri);
393
+				$content = str_replace(" itemid=\"$item_id\"", " itemid=\"$uri_e\"", $content);
394 394
 			}
395 395
 		}
396 396
 	}
397 397
 
398 398
 	// Reapply slashes.
399
-	$content = addslashes( $content );
399
+	$content = addslashes($content);
400 400
 
401 401
 	return $content;
402 402
 }
403 403
 
404
-add_filter( 'content_save_pre', 'wl_replace_item_id_with_uri', 1, 1 );
404
+add_filter('content_save_pre', 'wl_replace_item_id_with_uri', 1, 1);
405 405
 
406
-require_once( 'wordlift_entity_functions.php' );
406
+require_once('wordlift_entity_functions.php');
407 407
 
408 408
 // add editor related methods.
409
-require_once( 'wordlift_editor.php' );
409
+require_once('wordlift_editor.php');
410 410
 
411 411
 // add the WordLift entity custom type.
412
-require_once( 'wordlift_entity_type.php' );
412
+require_once('wordlift_entity_type.php');
413 413
 
414 414
 // add callbacks on post save to notify data changes from wp to redlink triple store
415
-require_once( 'wordlift_to_redlink_data_push_callbacks.php' );
415
+require_once('wordlift_to_redlink_data_push_callbacks.php');
416 416
 
417
-require_once( 'modules/configuration/wordlift_configuration_settings.php' );
417
+require_once('modules/configuration/wordlift_configuration_settings.php');
418 418
 
419 419
 // Load modules
420
-require_once( 'modules/analyzer/wordlift_analyzer.php' );
421
-require_once( 'modules/linked_data/wordlift_linked_data.php' );
422
-require_once( 'modules/prefixes/wordlift_prefixes.php' );
420
+require_once('modules/analyzer/wordlift_analyzer.php');
421
+require_once('modules/linked_data/wordlift_linked_data.php');
422
+require_once('modules/prefixes/wordlift_prefixes.php');
423 423
 
424 424
 // Shortcodes
425 425
 
426
-require_once( 'modules/geo_widget/wordlift_geo_widget.php' );
427
-require_once( 'shortcodes/wordlift_shortcode_chord.php' );
428
-require_once( 'shortcodes/wordlift_shortcode_geomap.php' );
429
-require_once( 'shortcodes/wordlift_shortcode_field.php' );
430
-require_once( 'shortcodes/wordlift_shortcode_faceted_search.php' );
431
-require_once( 'shortcodes/wordlift_shortcode_navigator.php' );
426
+require_once('modules/geo_widget/wordlift_geo_widget.php');
427
+require_once('shortcodes/wordlift_shortcode_chord.php');
428
+require_once('shortcodes/wordlift_shortcode_geomap.php');
429
+require_once('shortcodes/wordlift_shortcode_field.php');
430
+require_once('shortcodes/wordlift_shortcode_faceted_search.php');
431
+require_once('shortcodes/wordlift_shortcode_navigator.php');
432 432
 
433
-require_once( 'widgets/wordlift_widget_geo.php' );
434
-require_once( 'widgets/class-wordlift-chord-widget.php' );
435
-require_once( 'widgets/wordlift_widget_timeline.php' );
433
+require_once('widgets/wordlift_widget_geo.php');
434
+require_once('widgets/class-wordlift-chord-widget.php');
435
+require_once('widgets/wordlift_widget_timeline.php');
436 436
 
437
-require_once( 'wordlift_redlink.php' );
437
+require_once('wordlift_redlink.php');
438 438
 
439 439
 // Add admin functions.
440 440
 // TODO: find a way to make 'admin' UI tests work.
441 441
 //if ( is_admin() ) {
442 442
 
443
-require_once( 'admin/wordlift_admin.php' );
444
-require_once( 'admin/wordlift_admin_edit_post.php' );
445
-require_once( 'admin/wordlift_admin_save_post.php' );
443
+require_once('admin/wordlift_admin.php');
444
+require_once('admin/wordlift_admin_edit_post.php');
445
+require_once('admin/wordlift_admin_save_post.php');
446 446
 
447 447
 // add the entities meta box.
448
-require_once( 'admin/wordlift_admin_meta_box_entities.php' );
448
+require_once('admin/wordlift_admin_meta_box_entities.php');
449 449
 
450 450
 // add the entity creation AJAX.
451
-require_once( 'admin/wordlift_admin_ajax_related_posts.php' );
451
+require_once('admin/wordlift_admin_ajax_related_posts.php');
452 452
 
453 453
 // Load the wl_chord TinyMCE button and configuration dialog.
454
-require_once( 'admin/wordlift_admin_shortcodes.php' );
454
+require_once('admin/wordlift_admin_shortcodes.php');
455 455
 
456 456
 /**
457 457
  * The code that runs during plugin activation.
@@ -459,11 +459,11 @@  discard block
 block discarded – undo
459 459
  */
460 460
 function activate_wordlift() {
461 461
 
462
-	$log = Wordlift_Log_Service::get_logger( 'activate_wordlift' );
462
+	$log = Wordlift_Log_Service::get_logger('activate_wordlift');
463 463
 
464
-	$log->info( 'Activating WordLift...' );
464
+	$log->info('Activating WordLift...');
465 465
 
466
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php';
466
+	require_once plugin_dir_path(__FILE__).'includes/class-wordlift-activator.php';
467 467
 	Wordlift_Activator::activate();
468 468
 
469 469
 	/**
@@ -486,20 +486,20 @@  discard block
 block discarded – undo
486 486
  */
487 487
 function deactivate_wordlift() {
488 488
 
489
-	require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php';
489
+	require_once plugin_dir_path(__FILE__).'includes/class-wordlift-deactivator.php';
490 490
 	Wordlift_Deactivator::deactivate();
491 491
 	flush_rewrite_rules();
492 492
 
493 493
 }
494 494
 
495
-register_activation_hook( __FILE__, 'activate_wordlift' );
496
-register_deactivation_hook( __FILE__, 'deactivate_wordlift' );
495
+register_activation_hook(__FILE__, 'activate_wordlift');
496
+register_deactivation_hook(__FILE__, 'deactivate_wordlift');
497 497
 
498 498
 /**
499 499
  * The core plugin class that is used to define internationalization,
500 500
  * admin-specific hooks, and public-facing site hooks.
501 501
  */
502
-require plugin_dir_path( __FILE__ ) . 'includes/class-wordlift.php';
502
+require plugin_dir_path(__FILE__).'includes/class-wordlift.php';
503 503
 
504 504
 /**
505 505
  * Begins execution of the plugin.
Please login to merge, or discard this patch.
src/modules/core/wordlift_core_constants.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -14,53 +14,53 @@
 block discarded – undo
14 14
 // Mapping options / validations rules used by wl_core_get_posts to perform validation on args
15 15
 // The array is serialized because array constants are only from php 5.6 on.
16 16
 define( 'WL_CORE_GET_POSTS_VALIDATION_RULES', serialize( array(
17
-	'get'            => array( 'posts', 'post_ids' ),
18
-	'as'             => array( 'object', 'subject' ),
19
-	'post_type'      => array( 'post', 'entity' ),
20
-	'post_status'    => array( 'draft', 'trash', 'publish' ),
21
-	'with_predicate' => array(
22
-		WL_WHAT_RELATION,
23
-		WL_WHEN_RELATION,
24
-		WL_WHERE_RELATION,
25
-		WL_WHO_RELATION,
26
-	),
17
+    'get'            => array( 'posts', 'post_ids' ),
18
+    'as'             => array( 'object', 'subject' ),
19
+    'post_type'      => array( 'post', 'entity' ),
20
+    'post_status'    => array( 'draft', 'trash', 'publish' ),
21
+    'with_predicate' => array(
22
+        WL_WHAT_RELATION,
23
+        WL_WHEN_RELATION,
24
+        WL_WHERE_RELATION,
25
+        WL_WHO_RELATION,
26
+    ),
27 27
 ) ) );
28 28
 
29 29
 // Classification boxes configuration for angularjs edit-post widget
30 30
 // The array is serialized because array constants are only from php 5.6 on.
31 31
 
32 32
 define( 'WL_CORE_POST_CLASSIFICATION_BOXES', serialize( array(
33
-	array(
34
-		'id'               => WL_WHAT_RELATION,
35
-		'label'            => 'What',
36
-		'registeredTypes'  => array(
37
-			'thing',
38
-			'creative-work',
39
-			'recipe',
40
-		),
41
-		'selectedEntities' => array(),
42
-	),
43
-	array(
44
-		'id'               => WL_WHO_RELATION,
45
-		'label'            => 'Who',
46
-		'registeredTypes'  => array(
47
-			'organization',
48
-			'person',
49
-			'local-business',
50
-			'localbusiness',
51
-		),
52
-		'selectedEntities' => array(),
53
-	),
54
-	array(
55
-		'id'               => WL_WHERE_RELATION,
56
-		'label'            => 'Where',
57
-		'registeredTypes'  => array( 'place' ),
58
-		'selectedEntities' => array(),
59
-	),
60
-	array(
61
-		'id'               => WL_WHEN_RELATION,
62
-		'label'            => 'When',
63
-		'registeredTypes'  => array( 'event' ),
64
-		'selectedEntities' => array(),
65
-	),
33
+    array(
34
+        'id'               => WL_WHAT_RELATION,
35
+        'label'            => 'What',
36
+        'registeredTypes'  => array(
37
+            'thing',
38
+            'creative-work',
39
+            'recipe',
40
+        ),
41
+        'selectedEntities' => array(),
42
+    ),
43
+    array(
44
+        'id'               => WL_WHO_RELATION,
45
+        'label'            => 'Who',
46
+        'registeredTypes'  => array(
47
+            'organization',
48
+            'person',
49
+            'local-business',
50
+            'localbusiness',
51
+        ),
52
+        'selectedEntities' => array(),
53
+    ),
54
+    array(
55
+        'id'               => WL_WHERE_RELATION,
56
+        'label'            => 'Where',
57
+        'registeredTypes'  => array( 'place' ),
58
+        'selectedEntities' => array(),
59
+    ),
60
+    array(
61
+        'id'               => WL_WHEN_RELATION,
62
+        'label'            => 'When',
63
+        'registeredTypes'  => array( 'event' ),
64
+        'selectedEntities' => array(),
65
+    ),
66 66
 ) ) );
Please login to merge, or discard this patch.
src/public/class-wordlift-public.php 2 patches
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -22,134 +22,134 @@
 block discarded – undo
22 22
  */
23 23
 class Wordlift_Public {
24 24
 
25
-	/**
26
-	 * The ID of this plugin.
27
-	 *
28
-	 * @since    1.0.0
29
-	 * @access   private
30
-	 * @var      string $plugin_name The ID of this plugin.
31
-	 */
32
-	private $plugin_name;
33
-
34
-	/**
35
-	 * The version of this plugin.
36
-	 *
37
-	 * @since    1.0.0
38
-	 * @access   private
39
-	 * @var      string $version The current version of this plugin.
40
-	 */
41
-	private $version;
42
-
43
-	/**
44
-	 * Initialize the class and set its properties.
45
-	 *
46
-	 * @since    1.0.0
47
-	 *
48
-	 * @param      string $plugin_name The name of the plugin.
49
-	 * @param      string $version The version of this plugin.
50
-	 */
51
-	public function __construct( $plugin_name, $version ) {
52
-
53
-		$this->plugin_name = $plugin_name;
54
-		$this->version     = $version;
55
-
56
-	}
57
-
58
-	/**
59
-	 * Register the stylesheets for the public-facing side of the site.
60
-	 *
61
-	 * @since 3.19.2 The call to this function is commented out in `class-wordlift.php` because `wordlift-public.css`
62
-	 *               is empty.
63
-	 * @since 1.0.0
64
-	 */
65
-	public function enqueue_styles() {
66
-
67
-		/**
68
-		 * This function is provided for demonstration purposes only.
69
-		 *
70
-		 * An instance of this class should be passed to the run() function
71
-		 * defined in Wordlift_Loader as all of the hooks are defined
72
-		 * in that particular class.
73
-		 *
74
-		 * The Wordlift_Loader will then create the relationship
75
-		 * between the defined hooks and the functions defined in this
76
-		 * class.
77
-		 */
78
-
79
-		// You need to re-enable the enqueue_styles in `class-wordlift.php` to make this effective.
80
-		//
81
-		// @see https://github.com/insideout10/wordlift-plugin/issues/821
82
-		//
83
-		// wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-public.css', array(), $this->version, 'all' );
84
-
85
-	}
86
-
87
-	/**
88
-	 * Register the stylesheets for the public-facing side of the site.
89
-	 *
90
-	 * @since    1.0.0
91
-	 */
92
-	public function enqueue_scripts() {
93
-
94
-		/**
95
-		 * This function is provided for demonstration purposes only.
96
-		 *
97
-		 * An instance of this class should be passed to the run() function
98
-		 * defined in Wordlift_Loader as all of the hooks are defined
99
-		 * in that particular class.
100
-		 *
101
-		 * The Wordlift_Loader will then create the relationship
102
-		 * between the defined hooks and the functions defined in this
103
-		 * class.
104
-		 */
105
-
106
-		$settings = self::get_settings();
107
-
108
-		// Note that we switched the js to be loaded in footer, since it is loading
109
-		// the json-ld representation.
110
-		wp_enqueue_script( $this->plugin_name, plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/bundle.js', array(), $this->version, true );
111
-		wp_localize_script( $this->plugin_name, 'wlSettings', $settings );
112
-
113
-	}
114
-
115
-	/**
116
-	 * Get the settings array.
117
-	 *
118
-	 * @since 3.19.1
119
-	 *
120
-	 * @return array An array with the settings.
121
-	 */
122
-	public static function get_settings() {
123
-
124
-		// Prepare a settings array for client-side functions.
125
-		$settings = array(
126
-			'ajaxUrl' => admin_url( 'admin-ajax.php' ),
127
-			'apiUrl'  => get_site_url( null, 'wl-api/' ),
128
-		);
129
-
130
-		// If we're in a single page, then print out the post id.
131
-		if ( is_singular() ) {
132
-			$settings['postId'] = get_the_ID();
133
-		}
134
-
135
-		// Add flag that we are on home/blog page.
136
-		if ( is_home() || is_front_page() ) {
137
-			$settings['isHome'] = true;
138
-		}
139
-
140
-		// By default only enable JSON-LD on supported entity pages (includes
141
-		// `page`, `post` and `entity` by default) and on the home page.
142
-		//
143
-		// @see https://github.com/insideout10/wordlift-plugin/issues/733
144
-		$jsonld_enabled = is_home() || is_front_page() || Wordlift_Entity_Type_Service::is_valid_entity_post_type( get_post_type() );
145
-
146
-		// Add the JSON-LD enabled flag, when set to false, the JSON-lD won't
147
-		// be loaded.
148
-		//
149
-		// @see https://github.com/insideout10/wordlift-plugin/issues/642.
150
-		$settings['jsonld_enabled'] = apply_filters( 'wl_jsonld_enabled', $jsonld_enabled );
151
-
152
-		return $settings;
153
-	}
25
+    /**
26
+     * The ID of this plugin.
27
+     *
28
+     * @since    1.0.0
29
+     * @access   private
30
+     * @var      string $plugin_name The ID of this plugin.
31
+     */
32
+    private $plugin_name;
33
+
34
+    /**
35
+     * The version of this plugin.
36
+     *
37
+     * @since    1.0.0
38
+     * @access   private
39
+     * @var      string $version The current version of this plugin.
40
+     */
41
+    private $version;
42
+
43
+    /**
44
+     * Initialize the class and set its properties.
45
+     *
46
+     * @since    1.0.0
47
+     *
48
+     * @param      string $plugin_name The name of the plugin.
49
+     * @param      string $version The version of this plugin.
50
+     */
51
+    public function __construct( $plugin_name, $version ) {
52
+
53
+        $this->plugin_name = $plugin_name;
54
+        $this->version     = $version;
55
+
56
+    }
57
+
58
+    /**
59
+     * Register the stylesheets for the public-facing side of the site.
60
+     *
61
+     * @since 3.19.2 The call to this function is commented out in `class-wordlift.php` because `wordlift-public.css`
62
+     *               is empty.
63
+     * @since 1.0.0
64
+     */
65
+    public function enqueue_styles() {
66
+
67
+        /**
68
+         * This function is provided for demonstration purposes only.
69
+         *
70
+         * An instance of this class should be passed to the run() function
71
+         * defined in Wordlift_Loader as all of the hooks are defined
72
+         * in that particular class.
73
+         *
74
+         * The Wordlift_Loader will then create the relationship
75
+         * between the defined hooks and the functions defined in this
76
+         * class.
77
+         */
78
+
79
+        // You need to re-enable the enqueue_styles in `class-wordlift.php` to make this effective.
80
+        //
81
+        // @see https://github.com/insideout10/wordlift-plugin/issues/821
82
+        //
83
+        // wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wordlift-public.css', array(), $this->version, 'all' );
84
+
85
+    }
86
+
87
+    /**
88
+     * Register the stylesheets for the public-facing side of the site.
89
+     *
90
+     * @since    1.0.0
91
+     */
92
+    public function enqueue_scripts() {
93
+
94
+        /**
95
+         * This function is provided for demonstration purposes only.
96
+         *
97
+         * An instance of this class should be passed to the run() function
98
+         * defined in Wordlift_Loader as all of the hooks are defined
99
+         * in that particular class.
100
+         *
101
+         * The Wordlift_Loader will then create the relationship
102
+         * between the defined hooks and the functions defined in this
103
+         * class.
104
+         */
105
+
106
+        $settings = self::get_settings();
107
+
108
+        // Note that we switched the js to be loaded in footer, since it is loading
109
+        // the json-ld representation.
110
+        wp_enqueue_script( $this->plugin_name, plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/bundle.js', array(), $this->version, true );
111
+        wp_localize_script( $this->plugin_name, 'wlSettings', $settings );
112
+
113
+    }
114
+
115
+    /**
116
+     * Get the settings array.
117
+     *
118
+     * @since 3.19.1
119
+     *
120
+     * @return array An array with the settings.
121
+     */
122
+    public static function get_settings() {
123
+
124
+        // Prepare a settings array for client-side functions.
125
+        $settings = array(
126
+            'ajaxUrl' => admin_url( 'admin-ajax.php' ),
127
+            'apiUrl'  => get_site_url( null, 'wl-api/' ),
128
+        );
129
+
130
+        // If we're in a single page, then print out the post id.
131
+        if ( is_singular() ) {
132
+            $settings['postId'] = get_the_ID();
133
+        }
134
+
135
+        // Add flag that we are on home/blog page.
136
+        if ( is_home() || is_front_page() ) {
137
+            $settings['isHome'] = true;
138
+        }
139
+
140
+        // By default only enable JSON-LD on supported entity pages (includes
141
+        // `page`, `post` and `entity` by default) and on the home page.
142
+        //
143
+        // @see https://github.com/insideout10/wordlift-plugin/issues/733
144
+        $jsonld_enabled = is_home() || is_front_page() || Wordlift_Entity_Type_Service::is_valid_entity_post_type( get_post_type() );
145
+
146
+        // Add the JSON-LD enabled flag, when set to false, the JSON-lD won't
147
+        // be loaded.
148
+        //
149
+        // @see https://github.com/insideout10/wordlift-plugin/issues/642.
150
+        $settings['jsonld_enabled'] = apply_filters( 'wl_jsonld_enabled', $jsonld_enabled );
151
+
152
+        return $settings;
153
+    }
154 154
 
155 155
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * @param      string $plugin_name The name of the plugin.
49 49
 	 * @param      string $version The version of this plugin.
50 50
 	 */
51
-	public function __construct( $plugin_name, $version ) {
51
+	public function __construct($plugin_name, $version) {
52 52
 
53 53
 		$this->plugin_name = $plugin_name;
54 54
 		$this->version     = $version;
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 
108 108
 		// Note that we switched the js to be loaded in footer, since it is loading
109 109
 		// the json-ld representation.
110
-		wp_enqueue_script( $this->plugin_name, plugin_dir_url( dirname( __FILE__ ) ) . 'js/dist/bundle.js', array(), $this->version, true );
111
-		wp_localize_script( $this->plugin_name, 'wlSettings', $settings );
110
+		wp_enqueue_script($this->plugin_name, plugin_dir_url(dirname(__FILE__)).'js/dist/bundle.js', array(), $this->version, true);
111
+		wp_localize_script($this->plugin_name, 'wlSettings', $settings);
112 112
 
113 113
 	}
114 114
 
@@ -123,17 +123,17 @@  discard block
 block discarded – undo
123 123
 
124 124
 		// Prepare a settings array for client-side functions.
125 125
 		$settings = array(
126
-			'ajaxUrl' => admin_url( 'admin-ajax.php' ),
127
-			'apiUrl'  => get_site_url( null, 'wl-api/' ),
126
+			'ajaxUrl' => admin_url('admin-ajax.php'),
127
+			'apiUrl'  => get_site_url(null, 'wl-api/'),
128 128
 		);
129 129
 
130 130
 		// If we're in a single page, then print out the post id.
131
-		if ( is_singular() ) {
131
+		if (is_singular()) {
132 132
 			$settings['postId'] = get_the_ID();
133 133
 		}
134 134
 
135 135
 		// Add flag that we are on home/blog page.
136
-		if ( is_home() || is_front_page() ) {
136
+		if (is_home() || is_front_page()) {
137 137
 			$settings['isHome'] = true;
138 138
 		}
139 139
 
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 		// `page`, `post` and `entity` by default) and on the home page.
142 142
 		//
143 143
 		// @see https://github.com/insideout10/wordlift-plugin/issues/733
144
-		$jsonld_enabled = is_home() || is_front_page() || Wordlift_Entity_Type_Service::is_valid_entity_post_type( get_post_type() );
144
+		$jsonld_enabled = is_home() || is_front_page() || Wordlift_Entity_Type_Service::is_valid_entity_post_type(get_post_type());
145 145
 
146 146
 		// Add the JSON-LD enabled flag, when set to false, the JSON-lD won't
147 147
 		// be loaded.
148 148
 		//
149 149
 		// @see https://github.com/insideout10/wordlift-plugin/issues/642.
150
-		$settings['jsonld_enabled'] = apply_filters( 'wl_jsonld_enabled', $jsonld_enabled );
150
+		$settings['jsonld_enabled'] = apply_filters('wl_jsonld_enabled', $jsonld_enabled);
151 151
 
152 152
 		return $settings;
153 153
 	}
Please login to merge, or discard this patch.
src/shortcodes/wordlift_shortcode_faceted_search.php 2 patches
Indentation   +185 added lines, -185 removed lines patch added patch discarded remove patch
@@ -14,74 +14,74 @@  discard block
 block discarded – undo
14 14
  */
15 15
 function wl_shortcode_faceted_search( $atts ) {
16 16
 
17
-	// Extract attributes and set default values.
18
-	$shortcode_atts = shortcode_atts( array(
19
-		'title'          => __( 'Related articles', 'wordlift' ),
20
-		'show_facets'    => true,
21
-		'with_carousel'  => true,
22
-		'squared_thumbs' => false,
23
-		'limit'          => 20,
24
-
25
-	), $atts );
26
-
27
-	foreach (
28
-		array(
29
-			'show_facets',
30
-			'with_carousel',
31
-			'squared_thumbs',
32
-		) as $att
33
-	) {
34
-
35
-		// See http://wordpress.stackexchange.com/questions/119294/pass-boolean-value-in-shortcode.
36
-		$shortcode_atts[ $att ] = filter_var(
37
-			$shortcode_atts[ $att ], FILTER_VALIDATE_BOOLEAN
38
-		);
39
-	}
40
-
41
-	// If the current post is not an entity and has no related entities
42
-	// than the shortcode cannot be rendered
43
-	// TODO Add an alert visibile only for connected admin users.
44
-	$current_post = get_post();
45
-
46
-	$entity_service = Wordlift_Entity_Service::get_instance();
47
-	$entity_ids     = $entity_service->is_entity( $current_post->ID ) ?
48
-		array( $current_post->ID ) :
49
-		wl_core_get_related_entity_ids( $current_post->ID );
50
-
51
-	// Bail if there are no entity ids.
52
-	if ( 0 === count( $entity_ids ) ) {
53
-		return '';
54
-	}
55
-
56
-	$div_id = 'wordlift-faceted-entity-search-widget';
57
-
58
-	wp_enqueue_style( 'wordlift-faceted-search', dirname( plugin_dir_url( __FILE__ ) ) . '/css/wordlift-faceted-entity-search-widget.min.css' );
59
-	wp_enqueue_script( 'angularjs', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js' );
60
-	wp_enqueue_script( 'angularjs-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js' );
61
-
62
-	wp_enqueue_script( 'wordlift-faceted-search', dirname( plugin_dir_url( __FILE__ ) ) . '/js/wordlift-faceted-entity-search-widget.min.js' );
63
-
64
-	wp_localize_script(
65
-		'wordlift-faceted-search',
66
-		'wl_faceted_search_params', array(
67
-			'ajax_url'             => admin_url( 'admin-ajax.php' ),
68
-			'action'               => 'wl_faceted_search',
69
-			'post_id'              => $current_post->ID,
70
-			'entity_ids'           => $entity_ids,
71
-			'limit'                => apply_filters( 'wl_faceted_search_limit', $shortcode_atts['limit'] ),
72
-			'div_id'               => $div_id,
73
-			'defaultThumbnailPath' => WL_DEFAULT_THUMBNAIL_PATH,
74
-			'attrs'                => $shortcode_atts,
75
-			'l10n'                 => array(
76
-				'what'  => _x( 'What', 'Faceted Search Widget', 'wordlift' ),
77
-				'who'   => _x( 'Who', 'Faceted Search Widget', 'wordlift' ),
78
-				'where' => _x( 'Where', 'Faceted Search Widget', 'wordlift' ),
79
-				'when'  => _x( 'When', 'Faceted Search Widget', 'wordlift' ),
80
-			),
81
-		)
82
-	);
83
-
84
-	return '<div id="' . $div_id . '" style="width:100%"></div>';
17
+    // Extract attributes and set default values.
18
+    $shortcode_atts = shortcode_atts( array(
19
+        'title'          => __( 'Related articles', 'wordlift' ),
20
+        'show_facets'    => true,
21
+        'with_carousel'  => true,
22
+        'squared_thumbs' => false,
23
+        'limit'          => 20,
24
+
25
+    ), $atts );
26
+
27
+    foreach (
28
+        array(
29
+            'show_facets',
30
+            'with_carousel',
31
+            'squared_thumbs',
32
+        ) as $att
33
+    ) {
34
+
35
+        // See http://wordpress.stackexchange.com/questions/119294/pass-boolean-value-in-shortcode.
36
+        $shortcode_atts[ $att ] = filter_var(
37
+            $shortcode_atts[ $att ], FILTER_VALIDATE_BOOLEAN
38
+        );
39
+    }
40
+
41
+    // If the current post is not an entity and has no related entities
42
+    // than the shortcode cannot be rendered
43
+    // TODO Add an alert visibile only for connected admin users.
44
+    $current_post = get_post();
45
+
46
+    $entity_service = Wordlift_Entity_Service::get_instance();
47
+    $entity_ids     = $entity_service->is_entity( $current_post->ID ) ?
48
+        array( $current_post->ID ) :
49
+        wl_core_get_related_entity_ids( $current_post->ID );
50
+
51
+    // Bail if there are no entity ids.
52
+    if ( 0 === count( $entity_ids ) ) {
53
+        return '';
54
+    }
55
+
56
+    $div_id = 'wordlift-faceted-entity-search-widget';
57
+
58
+    wp_enqueue_style( 'wordlift-faceted-search', dirname( plugin_dir_url( __FILE__ ) ) . '/css/wordlift-faceted-entity-search-widget.min.css' );
59
+    wp_enqueue_script( 'angularjs', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js' );
60
+    wp_enqueue_script( 'angularjs-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js' );
61
+
62
+    wp_enqueue_script( 'wordlift-faceted-search', dirname( plugin_dir_url( __FILE__ ) ) . '/js/wordlift-faceted-entity-search-widget.min.js' );
63
+
64
+    wp_localize_script(
65
+        'wordlift-faceted-search',
66
+        'wl_faceted_search_params', array(
67
+            'ajax_url'             => admin_url( 'admin-ajax.php' ),
68
+            'action'               => 'wl_faceted_search',
69
+            'post_id'              => $current_post->ID,
70
+            'entity_ids'           => $entity_ids,
71
+            'limit'                => apply_filters( 'wl_faceted_search_limit', $shortcode_atts['limit'] ),
72
+            'div_id'               => $div_id,
73
+            'defaultThumbnailPath' => WL_DEFAULT_THUMBNAIL_PATH,
74
+            'attrs'                => $shortcode_atts,
75
+            'l10n'                 => array(
76
+                'what'  => _x( 'What', 'Faceted Search Widget', 'wordlift' ),
77
+                'who'   => _x( 'Who', 'Faceted Search Widget', 'wordlift' ),
78
+                'where' => _x( 'Where', 'Faceted Search Widget', 'wordlift' ),
79
+                'when'  => _x( 'When', 'Faceted Search Widget', 'wordlift' ),
80
+            ),
81
+        )
82
+    );
83
+
84
+    return '<div id="' . $div_id . '" style="width:100%"></div>';
85 85
 }
86 86
 
87 87
 add_shortcode( 'wl_faceted_search', 'wl_shortcode_faceted_search' );
@@ -92,111 +92,111 @@  discard block
 block discarded – undo
92 92
  */
93 93
 function wl_shortcode_faceted_search_ajax( $http_raw_data = null ) {
94 94
 
95
-	// Post ID must be defined.
96
-	if ( ! isset( $_GET['post_id'] ) ) { // WPCS: input var ok; CSRF ok.
97
-		wp_die( 'No post_id given' );
98
-
99
-		return;
100
-	}
101
-
102
-	// Extract filtering conditions.
103
-	$filtering_entity_uris = ( null == $http_raw_data ) ? file_get_contents( 'php://input' ) : $http_raw_data;
104
-	$filtering_entity_uris = json_decode( $filtering_entity_uris );
105
-
106
-	$current_post_id = $_GET['post_id']; // WPCS: input var ok; CSRF ok.
107
-	$current_post    = get_post( $current_post_id );
108
-
109
-	// Post ID has to match an existing item.
110
-	if ( null === $current_post ) {
111
-		wp_die( 'No valid post_id given' );
112
-
113
-		return;
114
-	}
115
-
116
-	// If the current post is an entity,
117
-	// the current post is used as main entity.
118
-	// Otherwise, current post related entities are used.
119
-	$entity_service = Wordlift_Entity_Service::get_instance();
120
-	$entity_ids     = $entity_service->is_entity( $current_post->ID ) ?
121
-		array( $current_post->ID ) :
122
-		wl_core_get_related_entity_ids( $current_post->ID );
123
-
124
-	// If there are no entities we cannot render the widget.
125
-	if ( 0 === count( $entity_ids ) ) {
126
-		wp_die( 'No entities available' );
127
-
128
-		return;
129
-	}
130
-
131
-	// Retrieve requested type
132
-	$required_type = ( isset( $_GET['type'] ) ) ? $_GET['type'] : null; // WPCS: input var ok; CSRF ok.
133
-
134
-	$limit = ( isset( $_GET['limit'] ) ) ? (int) $_GET['limit'] : 20;  // WPCS: input var ok; CSRF ok.
135
-
136
-	$referencing_posts = Wordlift_Relation_Service::get_instance()->get_article_subjects(
137
-		$entity_ids,
138
-		'*',
139
-		null,
140
-		'publish',
141
-		array( $current_post_id ),
142
-		$limit
143
-	);
144
-
145
-	$referencing_post_ids = array_map( function ( $p ) {
146
-		return $p->ID;
147
-	}, $referencing_posts );
148
-	$results              = array();
149
-
150
-	if ( 'posts' === $required_type ) {
151
-
152
-		// Required filtered posts.
153
-		wl_write_log( "Going to find related posts for the current post [ post ID :: $current_post_id ]" );
154
-
155
-		$filtered_posts = ( empty( $filtering_entity_uris ) ) ?
156
-			$referencing_posts :
157
-			Wordlift_Relation_Service::get_instance()->get_article_subjects(
158
-				wl_get_entity_post_ids_by_uris( $filtering_entity_uris ),
159
-				'*',
160
-				null,
161
-				null,
162
-				array(),
163
-				null,
164
-				$referencing_post_ids
165
-			);
166
-
167
-		if ( $filtered_posts ) {
168
-			foreach ( $filtered_posts as $post_obj ) {
169
-
170
-				/**
171
-				 * Use the thumbnail.
172
-				 *
173
-				 * @see https://github.com/insideout10/wordlift-plugin/issues/825 related issue.
174
-				 */
175
-				$thumbnail           = get_the_post_thumbnail_url( $post_obj, 'thumbnail' );
176
-				$post_obj->thumbnail = ( $thumbnail ) ?
177
-					$thumbnail : WL_DEFAULT_THUMBNAIL_PATH;
178
-				$post_obj->permalink = get_post_permalink( $post_obj->ID );
179
-
180
-				$results[] = $post_obj;
181
-			}
182
-		}
183
-	} else {
184
-
185
-		global $wpdb;
186
-
187
-		wl_write_log( "Going to find related entities for the current post [ post ID :: $current_post_id ]" );
188
-
189
-		// Retrieve Wordlift relation instances table name.
190
-		$table_name = wl_core_get_relation_instances_table_name();
191
-
192
-		/*
95
+    // Post ID must be defined.
96
+    if ( ! isset( $_GET['post_id'] ) ) { // WPCS: input var ok; CSRF ok.
97
+        wp_die( 'No post_id given' );
98
+
99
+        return;
100
+    }
101
+
102
+    // Extract filtering conditions.
103
+    $filtering_entity_uris = ( null == $http_raw_data ) ? file_get_contents( 'php://input' ) : $http_raw_data;
104
+    $filtering_entity_uris = json_decode( $filtering_entity_uris );
105
+
106
+    $current_post_id = $_GET['post_id']; // WPCS: input var ok; CSRF ok.
107
+    $current_post    = get_post( $current_post_id );
108
+
109
+    // Post ID has to match an existing item.
110
+    if ( null === $current_post ) {
111
+        wp_die( 'No valid post_id given' );
112
+
113
+        return;
114
+    }
115
+
116
+    // If the current post is an entity,
117
+    // the current post is used as main entity.
118
+    // Otherwise, current post related entities are used.
119
+    $entity_service = Wordlift_Entity_Service::get_instance();
120
+    $entity_ids     = $entity_service->is_entity( $current_post->ID ) ?
121
+        array( $current_post->ID ) :
122
+        wl_core_get_related_entity_ids( $current_post->ID );
123
+
124
+    // If there are no entities we cannot render the widget.
125
+    if ( 0 === count( $entity_ids ) ) {
126
+        wp_die( 'No entities available' );
127
+
128
+        return;
129
+    }
130
+
131
+    // Retrieve requested type
132
+    $required_type = ( isset( $_GET['type'] ) ) ? $_GET['type'] : null; // WPCS: input var ok; CSRF ok.
133
+
134
+    $limit = ( isset( $_GET['limit'] ) ) ? (int) $_GET['limit'] : 20;  // WPCS: input var ok; CSRF ok.
135
+
136
+    $referencing_posts = Wordlift_Relation_Service::get_instance()->get_article_subjects(
137
+        $entity_ids,
138
+        '*',
139
+        null,
140
+        'publish',
141
+        array( $current_post_id ),
142
+        $limit
143
+    );
144
+
145
+    $referencing_post_ids = array_map( function ( $p ) {
146
+        return $p->ID;
147
+    }, $referencing_posts );
148
+    $results              = array();
149
+
150
+    if ( 'posts' === $required_type ) {
151
+
152
+        // Required filtered posts.
153
+        wl_write_log( "Going to find related posts for the current post [ post ID :: $current_post_id ]" );
154
+
155
+        $filtered_posts = ( empty( $filtering_entity_uris ) ) ?
156
+            $referencing_posts :
157
+            Wordlift_Relation_Service::get_instance()->get_article_subjects(
158
+                wl_get_entity_post_ids_by_uris( $filtering_entity_uris ),
159
+                '*',
160
+                null,
161
+                null,
162
+                array(),
163
+                null,
164
+                $referencing_post_ids
165
+            );
166
+
167
+        if ( $filtered_posts ) {
168
+            foreach ( $filtered_posts as $post_obj ) {
169
+
170
+                /**
171
+                 * Use the thumbnail.
172
+                 *
173
+                 * @see https://github.com/insideout10/wordlift-plugin/issues/825 related issue.
174
+                 */
175
+                $thumbnail           = get_the_post_thumbnail_url( $post_obj, 'thumbnail' );
176
+                $post_obj->thumbnail = ( $thumbnail ) ?
177
+                    $thumbnail : WL_DEFAULT_THUMBNAIL_PATH;
178
+                $post_obj->permalink = get_post_permalink( $post_obj->ID );
179
+
180
+                $results[] = $post_obj;
181
+            }
182
+        }
183
+    } else {
184
+
185
+        global $wpdb;
186
+
187
+        wl_write_log( "Going to find related entities for the current post [ post ID :: $current_post_id ]" );
188
+
189
+        // Retrieve Wordlift relation instances table name.
190
+        $table_name = wl_core_get_relation_instances_table_name();
191
+
192
+        /*
193 193
 		 * Make sure we have some referenced post, otherwise the IN parts of
194 194
 		 * the SQL will produce an SQL error.
195 195
 		 */
196
-		if ( ! empty( $referencing_post_ids ) ) {
197
-			$subject_ids = implode( ',', $referencing_post_ids );
196
+        if ( ! empty( $referencing_post_ids ) ) {
197
+            $subject_ids = implode( ',', $referencing_post_ids );
198 198
 
199
-			$query = "
199
+            $query = "
200 200
 				SELECT
201 201
 					object_id AS ID,
202 202
 					count( object_id ) AS counter
@@ -208,30 +208,30 @@  discard block
 block discarded – undo
208 208
 				LIMIT $limit;
209 209
 			";
210 210
 
211
-			wl_write_log( "Going to find related entities for the current post [ post ID :: $current_post_id ] [ query :: $query ]" );
211
+            wl_write_log( "Going to find related entities for the current post [ post ID :: $current_post_id ] [ query :: $query ]" );
212 212
 
213
-			$entities = $wpdb->get_results( $query, OBJECT ); // No cache ok.
213
+            $entities = $wpdb->get_results( $query, OBJECT ); // No cache ok.
214 214
 
215
-			wl_write_log( 'Entities found ' . count( $entities ) );
215
+            wl_write_log( 'Entities found ' . count( $entities ) );
216 216
 
217
-			foreach ( $entities as $obj ) {
217
+            foreach ( $entities as $obj ) {
218 218
 
219
-				$entity = get_post( $obj->ID );
219
+                $entity = get_post( $obj->ID );
220 220
 
221
-				// Ensure only valid and published entities are returned.
222
-				if ( ( null !== $entity ) && ( 'publish' === $entity->post_status ) ) {
221
+                // Ensure only valid and published entities are returned.
222
+                if ( ( null !== $entity ) && ( 'publish' === $entity->post_status ) ) {
223 223
 
224
-					$serialized_entity              = wl_serialize_entity( $entity );
225
-					$serialized_entity['counter']   = $obj->counter;
226
-					$serialized_entity['createdAt'] = $entity->post_date;
224
+                    $serialized_entity              = wl_serialize_entity( $entity );
225
+                    $serialized_entity['counter']   = $obj->counter;
226
+                    $serialized_entity['createdAt'] = $entity->post_date;
227 227
 
228
-					$results[] = $serialized_entity;
229
-				}
230
-			}
231
-		}
232
-	}
228
+                    $results[] = $serialized_entity;
229
+                }
230
+            }
231
+        }
232
+    }
233 233
 
234
-	wl_core_send_json( $results );
234
+    wl_core_send_json( $results );
235 235
 
236 236
 }
237 237
 
Please login to merge, or discard this patch.
Spacing   +61 added lines, -64 removed lines patch added patch discarded remove patch
@@ -12,17 +12,17 @@  discard block
 block discarded – undo
12 12
  *
13 13
  * @param array $atts Shortcode attributes.
14 14
  */
15
-function wl_shortcode_faceted_search( $atts ) {
15
+function wl_shortcode_faceted_search($atts) {
16 16
 
17 17
 	// Extract attributes and set default values.
18
-	$shortcode_atts = shortcode_atts( array(
19
-		'title'          => __( 'Related articles', 'wordlift' ),
18
+	$shortcode_atts = shortcode_atts(array(
19
+		'title'          => __('Related articles', 'wordlift'),
20 20
 		'show_facets'    => true,
21 21
 		'with_carousel'  => true,
22 22
 		'squared_thumbs' => false,
23 23
 		'limit'          => 20,
24 24
 
25
-	), $atts );
25
+	), $atts);
26 26
 
27 27
 	foreach (
28 28
 		array(
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 	) {
34 34
 
35 35
 		// See http://wordpress.stackexchange.com/questions/119294/pass-boolean-value-in-shortcode.
36
-		$shortcode_atts[ $att ] = filter_var(
37
-			$shortcode_atts[ $att ], FILTER_VALIDATE_BOOLEAN
36
+		$shortcode_atts[$att] = filter_var(
37
+			$shortcode_atts[$att], FILTER_VALIDATE_BOOLEAN
38 38
 		);
39 39
 	}
40 40
 
@@ -44,71 +44,70 @@  discard block
 block discarded – undo
44 44
 	$current_post = get_post();
45 45
 
46 46
 	$entity_service = Wordlift_Entity_Service::get_instance();
47
-	$entity_ids     = $entity_service->is_entity( $current_post->ID ) ?
48
-		array( $current_post->ID ) :
49
-		wl_core_get_related_entity_ids( $current_post->ID );
47
+	$entity_ids     = $entity_service->is_entity($current_post->ID) ?
48
+		array($current_post->ID) : wl_core_get_related_entity_ids($current_post->ID);
50 49
 
51 50
 	// Bail if there are no entity ids.
52
-	if ( 0 === count( $entity_ids ) ) {
51
+	if (0 === count($entity_ids)) {
53 52
 		return '';
54 53
 	}
55 54
 
56 55
 	$div_id = 'wordlift-faceted-entity-search-widget';
57 56
 
58
-	wp_enqueue_style( 'wordlift-faceted-search', dirname( plugin_dir_url( __FILE__ ) ) . '/css/wordlift-faceted-entity-search-widget.min.css' );
59
-	wp_enqueue_script( 'angularjs', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js' );
60
-	wp_enqueue_script( 'angularjs-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js' );
57
+	wp_enqueue_style('wordlift-faceted-search', dirname(plugin_dir_url(__FILE__)).'/css/wordlift-faceted-entity-search-widget.min.css');
58
+	wp_enqueue_script('angularjs', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular.min.js');
59
+	wp_enqueue_script('angularjs-touch', 'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.11/angular-touch.min.js');
61 60
 
62
-	wp_enqueue_script( 'wordlift-faceted-search', dirname( plugin_dir_url( __FILE__ ) ) . '/js/wordlift-faceted-entity-search-widget.min.js' );
61
+	wp_enqueue_script('wordlift-faceted-search', dirname(plugin_dir_url(__FILE__)).'/js/wordlift-faceted-entity-search-widget.min.js');
63 62
 
64 63
 	wp_localize_script(
65 64
 		'wordlift-faceted-search',
66 65
 		'wl_faceted_search_params', array(
67
-			'ajax_url'             => admin_url( 'admin-ajax.php' ),
66
+			'ajax_url'             => admin_url('admin-ajax.php'),
68 67
 			'action'               => 'wl_faceted_search',
69 68
 			'post_id'              => $current_post->ID,
70 69
 			'entity_ids'           => $entity_ids,
71
-			'limit'                => apply_filters( 'wl_faceted_search_limit', $shortcode_atts['limit'] ),
70
+			'limit'                => apply_filters('wl_faceted_search_limit', $shortcode_atts['limit']),
72 71
 			'div_id'               => $div_id,
73 72
 			'defaultThumbnailPath' => WL_DEFAULT_THUMBNAIL_PATH,
74 73
 			'attrs'                => $shortcode_atts,
75 74
 			'l10n'                 => array(
76
-				'what'  => _x( 'What', 'Faceted Search Widget', 'wordlift' ),
77
-				'who'   => _x( 'Who', 'Faceted Search Widget', 'wordlift' ),
78
-				'where' => _x( 'Where', 'Faceted Search Widget', 'wordlift' ),
79
-				'when'  => _x( 'When', 'Faceted Search Widget', 'wordlift' ),
75
+				'what'  => _x('What', 'Faceted Search Widget', 'wordlift'),
76
+				'who'   => _x('Who', 'Faceted Search Widget', 'wordlift'),
77
+				'where' => _x('Where', 'Faceted Search Widget', 'wordlift'),
78
+				'when'  => _x('When', 'Faceted Search Widget', 'wordlift'),
80 79
 			),
81 80
 		)
82 81
 	);
83 82
 
84
-	return '<div id="' . $div_id . '" style="width:100%"></div>';
83
+	return '<div id="'.$div_id.'" style="width:100%"></div>';
85 84
 }
86 85
 
87
-add_shortcode( 'wl_faceted_search', 'wl_shortcode_faceted_search' );
86
+add_shortcode('wl_faceted_search', 'wl_shortcode_faceted_search');
88 87
 
89 88
 
90 89
 /**
91 90
  * Ajax call for the faceted search widget
92 91
  */
93
-function wl_shortcode_faceted_search_ajax( $http_raw_data = null ) {
92
+function wl_shortcode_faceted_search_ajax($http_raw_data = null) {
94 93
 
95 94
 	// Post ID must be defined.
96
-	if ( ! isset( $_GET['post_id'] ) ) { // WPCS: input var ok; CSRF ok.
97
-		wp_die( 'No post_id given' );
95
+	if ( ! isset($_GET['post_id'])) { // WPCS: input var ok; CSRF ok.
96
+		wp_die('No post_id given');
98 97
 
99 98
 		return;
100 99
 	}
101 100
 
102 101
 	// Extract filtering conditions.
103
-	$filtering_entity_uris = ( null == $http_raw_data ) ? file_get_contents( 'php://input' ) : $http_raw_data;
104
-	$filtering_entity_uris = json_decode( $filtering_entity_uris );
102
+	$filtering_entity_uris = (null == $http_raw_data) ? file_get_contents('php://input') : $http_raw_data;
103
+	$filtering_entity_uris = json_decode($filtering_entity_uris);
105 104
 
106 105
 	$current_post_id = $_GET['post_id']; // WPCS: input var ok; CSRF ok.
107
-	$current_post    = get_post( $current_post_id );
106
+	$current_post    = get_post($current_post_id);
108 107
 
109 108
 	// Post ID has to match an existing item.
110
-	if ( null === $current_post ) {
111
-		wp_die( 'No valid post_id given' );
109
+	if (null === $current_post) {
110
+		wp_die('No valid post_id given');
112 111
 
113 112
 		return;
114 113
 	}
@@ -117,45 +116,43 @@  discard block
 block discarded – undo
117 116
 	// the current post is used as main entity.
118 117
 	// Otherwise, current post related entities are used.
119 118
 	$entity_service = Wordlift_Entity_Service::get_instance();
120
-	$entity_ids     = $entity_service->is_entity( $current_post->ID ) ?
121
-		array( $current_post->ID ) :
122
-		wl_core_get_related_entity_ids( $current_post->ID );
119
+	$entity_ids     = $entity_service->is_entity($current_post->ID) ?
120
+		array($current_post->ID) : wl_core_get_related_entity_ids($current_post->ID);
123 121
 
124 122
 	// If there are no entities we cannot render the widget.
125
-	if ( 0 === count( $entity_ids ) ) {
126
-		wp_die( 'No entities available' );
123
+	if (0 === count($entity_ids)) {
124
+		wp_die('No entities available');
127 125
 
128 126
 		return;
129 127
 	}
130 128
 
131 129
 	// Retrieve requested type
132
-	$required_type = ( isset( $_GET['type'] ) ) ? $_GET['type'] : null; // WPCS: input var ok; CSRF ok.
130
+	$required_type = (isset($_GET['type'])) ? $_GET['type'] : null; // WPCS: input var ok; CSRF ok.
133 131
 
134
-	$limit = ( isset( $_GET['limit'] ) ) ? (int) $_GET['limit'] : 20;  // WPCS: input var ok; CSRF ok.
132
+	$limit = (isset($_GET['limit'])) ? (int) $_GET['limit'] : 20; // WPCS: input var ok; CSRF ok.
135 133
 
136 134
 	$referencing_posts = Wordlift_Relation_Service::get_instance()->get_article_subjects(
137 135
 		$entity_ids,
138 136
 		'*',
139 137
 		null,
140 138
 		'publish',
141
-		array( $current_post_id ),
139
+		array($current_post_id),
142 140
 		$limit
143 141
 	);
144 142
 
145
-	$referencing_post_ids = array_map( function ( $p ) {
143
+	$referencing_post_ids = array_map(function($p) {
146 144
 		return $p->ID;
147
-	}, $referencing_posts );
145
+	}, $referencing_posts);
148 146
 	$results              = array();
149 147
 
150
-	if ( 'posts' === $required_type ) {
148
+	if ('posts' === $required_type) {
151 149
 
152 150
 		// Required filtered posts.
153
-		wl_write_log( "Going to find related posts for the current post [ post ID :: $current_post_id ]" );
151
+		wl_write_log("Going to find related posts for the current post [ post ID :: $current_post_id ]");
154 152
 
155
-		$filtered_posts = ( empty( $filtering_entity_uris ) ) ?
156
-			$referencing_posts :
157
-			Wordlift_Relation_Service::get_instance()->get_article_subjects(
158
-				wl_get_entity_post_ids_by_uris( $filtering_entity_uris ),
153
+		$filtered_posts = (empty($filtering_entity_uris)) ?
154
+			$referencing_posts : Wordlift_Relation_Service::get_instance()->get_article_subjects(
155
+				wl_get_entity_post_ids_by_uris($filtering_entity_uris),
159 156
 				'*',
160 157
 				null,
161 158
 				null,
@@ -164,18 +161,18 @@  discard block
 block discarded – undo
164 161
 				$referencing_post_ids
165 162
 			);
166 163
 
167
-		if ( $filtered_posts ) {
168
-			foreach ( $filtered_posts as $post_obj ) {
164
+		if ($filtered_posts) {
165
+			foreach ($filtered_posts as $post_obj) {
169 166
 
170 167
 				/**
171 168
 				 * Use the thumbnail.
172 169
 				 *
173 170
 				 * @see https://github.com/insideout10/wordlift-plugin/issues/825 related issue.
174 171
 				 */
175
-				$thumbnail           = get_the_post_thumbnail_url( $post_obj, 'thumbnail' );
176
-				$post_obj->thumbnail = ( $thumbnail ) ?
172
+				$thumbnail           = get_the_post_thumbnail_url($post_obj, 'thumbnail');
173
+				$post_obj->thumbnail = ($thumbnail) ?
177 174
 					$thumbnail : WL_DEFAULT_THUMBNAIL_PATH;
178
-				$post_obj->permalink = get_post_permalink( $post_obj->ID );
175
+				$post_obj->permalink = get_post_permalink($post_obj->ID);
179 176
 
180 177
 				$results[] = $post_obj;
181 178
 			}
@@ -184,7 +181,7 @@  discard block
 block discarded – undo
184 181
 
185 182
 		global $wpdb;
186 183
 
187
-		wl_write_log( "Going to find related entities for the current post [ post ID :: $current_post_id ]" );
184
+		wl_write_log("Going to find related entities for the current post [ post ID :: $current_post_id ]");
188 185
 
189 186
 		// Retrieve Wordlift relation instances table name.
190 187
 		$table_name = wl_core_get_relation_instances_table_name();
@@ -193,8 +190,8 @@  discard block
 block discarded – undo
193 190
 		 * Make sure we have some referenced post, otherwise the IN parts of
194 191
 		 * the SQL will produce an SQL error.
195 192
 		 */
196
-		if ( ! empty( $referencing_post_ids ) ) {
197
-			$subject_ids = implode( ',', $referencing_post_ids );
193
+		if ( ! empty($referencing_post_ids)) {
194
+			$subject_ids = implode(',', $referencing_post_ids);
198 195
 
199 196
 			$query = "
200 197
 				SELECT
@@ -208,20 +205,20 @@  discard block
 block discarded – undo
208 205
 				LIMIT $limit;
209 206
 			";
210 207
 
211
-			wl_write_log( "Going to find related entities for the current post [ post ID :: $current_post_id ] [ query :: $query ]" );
208
+			wl_write_log("Going to find related entities for the current post [ post ID :: $current_post_id ] [ query :: $query ]");
212 209
 
213
-			$entities = $wpdb->get_results( $query, OBJECT ); // No cache ok.
210
+			$entities = $wpdb->get_results($query, OBJECT); // No cache ok.
214 211
 
215
-			wl_write_log( 'Entities found ' . count( $entities ) );
212
+			wl_write_log('Entities found '.count($entities));
216 213
 
217
-			foreach ( $entities as $obj ) {
214
+			foreach ($entities as $obj) {
218 215
 
219
-				$entity = get_post( $obj->ID );
216
+				$entity = get_post($obj->ID);
220 217
 
221 218
 				// Ensure only valid and published entities are returned.
222
-				if ( ( null !== $entity ) && ( 'publish' === $entity->post_status ) ) {
219
+				if ((null !== $entity) && ('publish' === $entity->post_status)) {
223 220
 
224
-					$serialized_entity              = wl_serialize_entity( $entity );
221
+					$serialized_entity              = wl_serialize_entity($entity);
225 222
 					$serialized_entity['counter']   = $obj->counter;
226 223
 					$serialized_entity['createdAt'] = $entity->post_date;
227 224
 
@@ -231,9 +228,9 @@  discard block
 block discarded – undo
231 228
 		}
232 229
 	}
233 230
 
234
-	wl_core_send_json( $results );
231
+	wl_core_send_json($results);
235 232
 
236 233
 }
237 234
 
238
-add_action( 'wp_ajax_wl_faceted_search', 'wl_shortcode_faceted_search_ajax' );
239
-add_action( 'wp_ajax_nopriv_wl_faceted_search', 'wl_shortcode_faceted_search_ajax' );
235
+add_action('wp_ajax_wl_faceted_search', 'wl_shortcode_faceted_search_ajax');
236
+add_action('wp_ajax_nopriv_wl_faceted_search', 'wl_shortcode_faceted_search_ajax');
Please login to merge, or discard this patch.
src/shortcodes/wordlift_shortcode_navigator.php 2 patches
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -14,99 +14,99 @@
 block discarded – undo
14 14
  */
15 15
 function wl_shortcode_navigator_ajax() {
16 16
 
17
-	// Post ID must be defined
18
-	if ( ! isset( $_GET['post_id'] ) ) {
19
-		wp_die( 'No post_id given' );
17
+    // Post ID must be defined
18
+    if ( ! isset( $_GET['post_id'] ) ) {
19
+        wp_die( 'No post_id given' );
20 20
 
21
-		return;
22
-	}
21
+        return;
22
+    }
23 23
 
24
-	$current_post_id = $_GET['post_id'];
25
-	$current_post    = get_post( $current_post_id );
24
+    $current_post_id = $_GET['post_id'];
25
+    $current_post    = get_post( $current_post_id );
26 26
 
27
-	// Post ID has to match an existing item
28
-	if ( null === $current_post ) {
29
-		wp_die( 'No valid post_id given' );
27
+    // Post ID has to match an existing item
28
+    if ( null === $current_post ) {
29
+        wp_die( 'No valid post_id given' );
30 30
 
31
-		return;
32
-	}
31
+        return;
32
+    }
33 33
 
34
-	// prepare structures to memorize other related posts
35
-	$results          = array();
36
-	$blacklist_ids    = array( $current_post_id );
37
-	$related_entities = array();
34
+    // prepare structures to memorize other related posts
35
+    $results          = array();
36
+    $blacklist_ids    = array( $current_post_id );
37
+    $related_entities = array();
38 38
 
39 39
 
40
-	$relation_service = Wordlift_Relation_Service::get_instance();
40
+    $relation_service = Wordlift_Relation_Service::get_instance();
41 41
 
42
-	// Get the related entities, ordering them by WHO, WHAT, WHERE, WHEN 
43
-	// TODO Replace with a single query if it is possible
44
-	// We select in inverse order to give priority to less used entities 
45
-	foreach (
46
-		array(
47
-			WL_WHEN_RELATION,
48
-			WL_WHERE_RELATION,
49
-			WL_WHAT_RELATION,
50
-			WL_WHO_RELATION,
51
-		) as $predicate
52
-	) {
42
+    // Get the related entities, ordering them by WHO, WHAT, WHERE, WHEN 
43
+    // TODO Replace with a single query if it is possible
44
+    // We select in inverse order to give priority to less used entities 
45
+    foreach (
46
+        array(
47
+            WL_WHEN_RELATION,
48
+            WL_WHERE_RELATION,
49
+            WL_WHAT_RELATION,
50
+            WL_WHO_RELATION,
51
+        ) as $predicate
52
+    ) {
53 53
 
54
-		$related_entities = array_merge( $related_entities,
55
-			$relation_service->get_objects( $current_post_id, '*', $predicate, 'publish' )
54
+        $related_entities = array_merge( $related_entities,
55
+            $relation_service->get_objects( $current_post_id, '*', $predicate, 'publish' )
56 56
 //			wl_core_get_related_entities( $current_post_id, array(
57 57
 //					'predicate' => $predicate,
58 58
 //					'status'    => 'publish',
59 59
 //				)
60
-		);
61
-
62
-	}
63
-
64
-	foreach ( $related_entities as $related_entity ) {
65
-
66
-		// take the id of posts referencing the entity
67
-		$referencing_posts = Wordlift_Relation_Service::get_instance()->get_article_subjects( $related_entity->ID, '*', null, 'publish' );
68
-
69
-		// loop over them and take the first one which is not already in the $related_posts
70
-		foreach ( $referencing_posts as $referencing_post ) {
71
-
72
-			if ( ! in_array( $referencing_post->ID, $blacklist_ids ) ) {
73
-
74
-				$blacklist_ids[]   = $referencing_post->ID;
75
-				$serialized_entity = wl_serialize_entity( $related_entity );
76
-
77
-				/**
78
-				 * Use the thumbnail.
79
-				 *
80
-				 * @see https://github.com/insideout10/wordlift-plugin/issues/825 related issue.
81
-				 */
82
-				$thumbnail           = get_the_post_thumbnail_url( $referencing_post, 'thumbnail' );
83
-
84
-				if ( $thumbnail ) {
85
-
86
-					$results[] = array(
87
-						'post'   => array(
88
-							'permalink' => get_post_permalink( $referencing_post->ID ),
89
-							'title'     => $referencing_post->post_title,
90
-							'thumbnail' => $thumbnail,
91
-						),
92
-						'entity' => array(
93
-							'label'     => $serialized_entity['label'],
94
-							'mainType'  => $serialized_entity['mainType'],
95
-							'permalink' => get_post_permalink( $related_entity->ID ),
96
-						),
97
-					);
98
-
99
-					// Be sure no more than 1 post for entity is returned
100
-					break;
101
-				}
102
-			}
103
-		}
104
-	}
105
-
106
-	// Return first 4 results in json accordingly to 4 columns layout
107
-	wl_core_send_json(
108
-		array_slice( array_reverse( $results ), 0, 4 )
109
-	);
60
+        );
61
+
62
+    }
63
+
64
+    foreach ( $related_entities as $related_entity ) {
65
+
66
+        // take the id of posts referencing the entity
67
+        $referencing_posts = Wordlift_Relation_Service::get_instance()->get_article_subjects( $related_entity->ID, '*', null, 'publish' );
68
+
69
+        // loop over them and take the first one which is not already in the $related_posts
70
+        foreach ( $referencing_posts as $referencing_post ) {
71
+
72
+            if ( ! in_array( $referencing_post->ID, $blacklist_ids ) ) {
73
+
74
+                $blacklist_ids[]   = $referencing_post->ID;
75
+                $serialized_entity = wl_serialize_entity( $related_entity );
76
+
77
+                /**
78
+                 * Use the thumbnail.
79
+                 *
80
+                 * @see https://github.com/insideout10/wordlift-plugin/issues/825 related issue.
81
+                 */
82
+                $thumbnail           = get_the_post_thumbnail_url( $referencing_post, 'thumbnail' );
83
+
84
+                if ( $thumbnail ) {
85
+
86
+                    $results[] = array(
87
+                        'post'   => array(
88
+                            'permalink' => get_post_permalink( $referencing_post->ID ),
89
+                            'title'     => $referencing_post->post_title,
90
+                            'thumbnail' => $thumbnail,
91
+                        ),
92
+                        'entity' => array(
93
+                            'label'     => $serialized_entity['label'],
94
+                            'mainType'  => $serialized_entity['mainType'],
95
+                            'permalink' => get_post_permalink( $related_entity->ID ),
96
+                        ),
97
+                    );
98
+
99
+                    // Be sure no more than 1 post for entity is returned
100
+                    break;
101
+                }
102
+            }
103
+        }
104
+    }
105
+
106
+    // Return first 4 results in json accordingly to 4 columns layout
107
+    wl_core_send_json(
108
+        array_slice( array_reverse( $results ), 0, 4 )
109
+    );
110 110
 }
111 111
 
112 112
 ///**
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -15,25 +15,25 @@  discard block
 block discarded – undo
15 15
 function wl_shortcode_navigator_ajax() {
16 16
 
17 17
 	// Post ID must be defined
18
-	if ( ! isset( $_GET['post_id'] ) ) {
19
-		wp_die( 'No post_id given' );
18
+	if ( ! isset($_GET['post_id'])) {
19
+		wp_die('No post_id given');
20 20
 
21 21
 		return;
22 22
 	}
23 23
 
24 24
 	$current_post_id = $_GET['post_id'];
25
-	$current_post    = get_post( $current_post_id );
25
+	$current_post    = get_post($current_post_id);
26 26
 
27 27
 	// Post ID has to match an existing item
28
-	if ( null === $current_post ) {
29
-		wp_die( 'No valid post_id given' );
28
+	if (null === $current_post) {
29
+		wp_die('No valid post_id given');
30 30
 
31 31
 		return;
32 32
 	}
33 33
 
34 34
 	// prepare structures to memorize other related posts
35 35
 	$results          = array();
36
-	$blacklist_ids    = array( $current_post_id );
36
+	$blacklist_ids    = array($current_post_id);
37 37
 	$related_entities = array();
38 38
 
39 39
 
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 		) as $predicate
52 52
 	) {
53 53
 
54
-		$related_entities = array_merge( $related_entities,
55
-			$relation_service->get_objects( $current_post_id, '*', $predicate, 'publish' )
54
+		$related_entities = array_merge($related_entities,
55
+			$relation_service->get_objects($current_post_id, '*', $predicate, 'publish')
56 56
 //			wl_core_get_related_entities( $current_post_id, array(
57 57
 //					'predicate' => $predicate,
58 58
 //					'status'    => 'publish',
@@ -61,38 +61,38 @@  discard block
 block discarded – undo
61 61
 
62 62
 	}
63 63
 
64
-	foreach ( $related_entities as $related_entity ) {
64
+	foreach ($related_entities as $related_entity) {
65 65
 
66 66
 		// take the id of posts referencing the entity
67
-		$referencing_posts = Wordlift_Relation_Service::get_instance()->get_article_subjects( $related_entity->ID, '*', null, 'publish' );
67
+		$referencing_posts = Wordlift_Relation_Service::get_instance()->get_article_subjects($related_entity->ID, '*', null, 'publish');
68 68
 
69 69
 		// loop over them and take the first one which is not already in the $related_posts
70
-		foreach ( $referencing_posts as $referencing_post ) {
70
+		foreach ($referencing_posts as $referencing_post) {
71 71
 
72
-			if ( ! in_array( $referencing_post->ID, $blacklist_ids ) ) {
72
+			if ( ! in_array($referencing_post->ID, $blacklist_ids)) {
73 73
 
74 74
 				$blacklist_ids[]   = $referencing_post->ID;
75
-				$serialized_entity = wl_serialize_entity( $related_entity );
75
+				$serialized_entity = wl_serialize_entity($related_entity);
76 76
 
77 77
 				/**
78 78
 				 * Use the thumbnail.
79 79
 				 *
80 80
 				 * @see https://github.com/insideout10/wordlift-plugin/issues/825 related issue.
81 81
 				 */
82
-				$thumbnail           = get_the_post_thumbnail_url( $referencing_post, 'thumbnail' );
82
+				$thumbnail = get_the_post_thumbnail_url($referencing_post, 'thumbnail');
83 83
 
84
-				if ( $thumbnail ) {
84
+				if ($thumbnail) {
85 85
 
86 86
 					$results[] = array(
87 87
 						'post'   => array(
88
-							'permalink' => get_post_permalink( $referencing_post->ID ),
88
+							'permalink' => get_post_permalink($referencing_post->ID),
89 89
 							'title'     => $referencing_post->post_title,
90 90
 							'thumbnail' => $thumbnail,
91 91
 						),
92 92
 						'entity' => array(
93 93
 							'label'     => $serialized_entity['label'],
94 94
 							'mainType'  => $serialized_entity['mainType'],
95
-							'permalink' => get_post_permalink( $related_entity->ID ),
95
+							'permalink' => get_post_permalink($related_entity->ID),
96 96
 						),
97 97
 					);
98 98
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 
106 106
 	// Return first 4 results in json accordingly to 4 columns layout
107 107
 	wl_core_send_json(
108
-		array_slice( array_reverse( $results ), 0, 4 )
108
+		array_slice(array_reverse($results), 0, 4)
109 109
 	);
110 110
 }
111 111
 
@@ -161,6 +161,6 @@  discard block
 block discarded – undo
161 161
 //}
162 162
 
163 163
 //add_action( 'init', 'wordlift_register_shortcode_navigator' );
164
-add_action( 'wp_ajax_wl_navigator', 'wl_shortcode_navigator_ajax' );
165
-add_action( 'wp_ajax_nopriv_wl_navigator', 'wl_shortcode_navigator_ajax' );
164
+add_action('wp_ajax_wl_navigator', 'wl_shortcode_navigator_ajax');
165
+add_action('wp_ajax_nopriv_wl_navigator', 'wl_shortcode_navigator_ajax');
166 166
 
Please login to merge, or discard this patch.
src/includes/class-wordlift-http-api.php 2 patches
Indentation   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -16,163 +16,163 @@
 block discarded – undo
16 16
  */
17 17
 class Wordlift_Http_Api {
18 18
 
19
-	/**
20
-	 * A {@link Wordlift_Log_Service} instance.
21
-	 *
22
-	 * @since 3.15.3
23
-	 *
24
-	 * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
25
-	 */
26
-	private $log;
27
-
28
-	/**
29
-	 * Create a {@link Wordlift_End_Point} instance.
30
-	 *
31
-	 * @since 3.15.3
32
-	 */
33
-	public function __construct() {
34
-
35
-		$this->log = Wordlift_Log_Service::get_logger( get_class() );
36
-
37
-		add_action( 'init', array( $this, 'add_rewrite_endpoint' ) );
38
-		add_action( 'template_redirect', array( $this, 'template_redirect' ) );
39
-
40
-		//region SAMPLE ACTIONS.
41
-		add_action( 'admin_post_wl_hello_world', array(
42
-			$this,
43
-			'hello_world',
44
-		) );
45
-		add_action( 'admin_post_nopriv_wl_hello_world', array(
46
-			$this,
47
-			'nopriv_hello_world',
48
-		) );
49
-		//endregion
50
-
51
-	}
52
-
53
-	/**
54
-	 * Add the `wl-api` rewrite end-point.
55
-	 *
56
-	 * @since 3.15.3
57
-	 */
58
-	public function add_rewrite_endpoint() {
59
-
60
-		add_rewrite_endpoint( 'wl-api', EP_ROOT );
61
-		$this->ensure_rewrite_rules_are_flushed();
62
-
63
-	}
64
-
65
-	/**
66
-	 * Handle `template_redirect` hooks.
67
-	 *
68
-	 * @since 3.15.3
69
-	 */
70
-	public function template_redirect() {
71
-
72
-		global $wp_query;
73
-
74
-		if ( ! isset( $wp_query->query_vars['wl-api'] ) ) {
75
-			$this->log->trace( 'Skipping, not a `wl-api` call.' );
76
-
77
-			return;
78
-		}
79
-
80
-		$this->do_action( $_REQUEST['action'] );
81
-
82
-		exit;
83
-
84
-	}
85
-
86
-	/**
87
-	 * Do the requested action.
88
-	 *
89
-	 * @since 3.15.3
90
-	 *
91
-	 * @param string $action The action to execute.
92
-	 */
93
-	private function do_action( $action ) {
94
-
95
-		if ( empty( $action ) ) {
96
-			return;
97
-		}
98
-
99
-		if ( ! wp_validate_auth_cookie( '', 'logged_in' ) ) {
100
-			/**
101
-			 * Fires on a non-authenticated admin post request for the given action.
102
-			 *
103
-			 * The dynamic portion of the hook name, `$action`, refers to the given
104
-			 * request action.
105
-			 *
106
-			 * @since 2.6.0
107
-			 */
108
-			do_action( "admin_post_nopriv_{$action}" );
109
-		} else {
110
-			/**
111
-			 * Fires on an authenticated admin post request for the given action.
112
-			 *
113
-			 * The dynamic portion of the hook name, `$action`, refers to the given
114
-			 * request action.
115
-			 *
116
-			 * @since 2.6.0
117
-			 */
118
-			do_action( "admin_post_{$action}" );
119
-		}
120
-
121
-	}
122
-
123
-	/**
124
-	 * Test function, anonymous.
125
-	 *
126
-	 * @since 3.15.3
127
-	 */
128
-	public function nopriv_hello_world() {
129
-
130
-		wp_die( 'Hello World! (from anonymous)' );
131
-
132
-	}
133
-
134
-	/**
135
-	 * Test function, authenticated.
136
-	 *
137
-	 * @since 3.15.3
138
-	 */
139
-	public function hello_world() {
140
-
141
-		wp_die( 'Hello World! (from authenticated)' );
142
-
143
-	}
144
-
145
-	/**
146
-	 * Ensure that the rewrite rules are flushed the first time.
147
-	 *
148
-	 * @since 3.16.0 changed the value from 1 to `yes` to avoid type juggling issues.
149
-	 * @since 3.15.3
150
-	 */
151
-	public static function ensure_rewrite_rules_are_flushed() {
152
-
153
-		// See https://github.com/insideout10/wordlift-plugin/issues/698.
154
-		if ( 'yes' !== get_option( 'wl_http_api' ) ) {
155
-			update_option( 'wl_http_api', 'yes' );
156
-			add_action( 'wp_loaded', function () {
157
-				flush_rewrite_rules();
158
-			} );
159
-		}
160
-
161
-	}
162
-
163
-	/**
164
-	 * Called by {@see activate_wordlift}, resets the `wl_http_api` option flag in order to force WordLift to
165
-	 * reinitialize the `wl-api` route.
166
-	 *
167
-	 * @see https://github.com/insideout10/wordlift-plugin/issues/820 related issue.
168
-	 *
169
-	 * @since 3.19.2
170
-	 */
171
-	public static function activate() {
172
-
173
-		// Force the plugin to reinitialize the rewrite rules.
174
-		update_option( 'wl_http_api', 'no' );
175
-
176
-	}
19
+    /**
20
+     * A {@link Wordlift_Log_Service} instance.
21
+     *
22
+     * @since 3.15.3
23
+     *
24
+     * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
25
+     */
26
+    private $log;
27
+
28
+    /**
29
+     * Create a {@link Wordlift_End_Point} instance.
30
+     *
31
+     * @since 3.15.3
32
+     */
33
+    public function __construct() {
34
+
35
+        $this->log = Wordlift_Log_Service::get_logger( get_class() );
36
+
37
+        add_action( 'init', array( $this, 'add_rewrite_endpoint' ) );
38
+        add_action( 'template_redirect', array( $this, 'template_redirect' ) );
39
+
40
+        //region SAMPLE ACTIONS.
41
+        add_action( 'admin_post_wl_hello_world', array(
42
+            $this,
43
+            'hello_world',
44
+        ) );
45
+        add_action( 'admin_post_nopriv_wl_hello_world', array(
46
+            $this,
47
+            'nopriv_hello_world',
48
+        ) );
49
+        //endregion
50
+
51
+    }
52
+
53
+    /**
54
+     * Add the `wl-api` rewrite end-point.
55
+     *
56
+     * @since 3.15.3
57
+     */
58
+    public function add_rewrite_endpoint() {
59
+
60
+        add_rewrite_endpoint( 'wl-api', EP_ROOT );
61
+        $this->ensure_rewrite_rules_are_flushed();
62
+
63
+    }
64
+
65
+    /**
66
+     * Handle `template_redirect` hooks.
67
+     *
68
+     * @since 3.15.3
69
+     */
70
+    public function template_redirect() {
71
+
72
+        global $wp_query;
73
+
74
+        if ( ! isset( $wp_query->query_vars['wl-api'] ) ) {
75
+            $this->log->trace( 'Skipping, not a `wl-api` call.' );
76
+
77
+            return;
78
+        }
79
+
80
+        $this->do_action( $_REQUEST['action'] );
81
+
82
+        exit;
83
+
84
+    }
85
+
86
+    /**
87
+     * Do the requested action.
88
+     *
89
+     * @since 3.15.3
90
+     *
91
+     * @param string $action The action to execute.
92
+     */
93
+    private function do_action( $action ) {
94
+
95
+        if ( empty( $action ) ) {
96
+            return;
97
+        }
98
+
99
+        if ( ! wp_validate_auth_cookie( '', 'logged_in' ) ) {
100
+            /**
101
+             * Fires on a non-authenticated admin post request for the given action.
102
+             *
103
+             * The dynamic portion of the hook name, `$action`, refers to the given
104
+             * request action.
105
+             *
106
+             * @since 2.6.0
107
+             */
108
+            do_action( "admin_post_nopriv_{$action}" );
109
+        } else {
110
+            /**
111
+             * Fires on an authenticated admin post request for the given action.
112
+             *
113
+             * The dynamic portion of the hook name, `$action`, refers to the given
114
+             * request action.
115
+             *
116
+             * @since 2.6.0
117
+             */
118
+            do_action( "admin_post_{$action}" );
119
+        }
120
+
121
+    }
122
+
123
+    /**
124
+     * Test function, anonymous.
125
+     *
126
+     * @since 3.15.3
127
+     */
128
+    public function nopriv_hello_world() {
129
+
130
+        wp_die( 'Hello World! (from anonymous)' );
131
+
132
+    }
133
+
134
+    /**
135
+     * Test function, authenticated.
136
+     *
137
+     * @since 3.15.3
138
+     */
139
+    public function hello_world() {
140
+
141
+        wp_die( 'Hello World! (from authenticated)' );
142
+
143
+    }
144
+
145
+    /**
146
+     * Ensure that the rewrite rules are flushed the first time.
147
+     *
148
+     * @since 3.16.0 changed the value from 1 to `yes` to avoid type juggling issues.
149
+     * @since 3.15.3
150
+     */
151
+    public static function ensure_rewrite_rules_are_flushed() {
152
+
153
+        // See https://github.com/insideout10/wordlift-plugin/issues/698.
154
+        if ( 'yes' !== get_option( 'wl_http_api' ) ) {
155
+            update_option( 'wl_http_api', 'yes' );
156
+            add_action( 'wp_loaded', function () {
157
+                flush_rewrite_rules();
158
+            } );
159
+        }
160
+
161
+    }
162
+
163
+    /**
164
+     * Called by {@see activate_wordlift}, resets the `wl_http_api` option flag in order to force WordLift to
165
+     * reinitialize the `wl-api` route.
166
+     *
167
+     * @see https://github.com/insideout10/wordlift-plugin/issues/820 related issue.
168
+     *
169
+     * @since 3.19.2
170
+     */
171
+    public static function activate() {
172
+
173
+        // Force the plugin to reinitialize the rewrite rules.
174
+        update_option( 'wl_http_api', 'no' );
175
+
176
+    }
177 177
 
178 178
 }
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -32,20 +32,20 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public function __construct() {
34 34
 
35
-		$this->log = Wordlift_Log_Service::get_logger( get_class() );
35
+		$this->log = Wordlift_Log_Service::get_logger(get_class());
36 36
 
37
-		add_action( 'init', array( $this, 'add_rewrite_endpoint' ) );
38
-		add_action( 'template_redirect', array( $this, 'template_redirect' ) );
37
+		add_action('init', array($this, 'add_rewrite_endpoint'));
38
+		add_action('template_redirect', array($this, 'template_redirect'));
39 39
 
40 40
 		//region SAMPLE ACTIONS.
41
-		add_action( 'admin_post_wl_hello_world', array(
41
+		add_action('admin_post_wl_hello_world', array(
42 42
 			$this,
43 43
 			'hello_world',
44
-		) );
45
-		add_action( 'admin_post_nopriv_wl_hello_world', array(
44
+		));
45
+		add_action('admin_post_nopriv_wl_hello_world', array(
46 46
 			$this,
47 47
 			'nopriv_hello_world',
48
-		) );
48
+		));
49 49
 		//endregion
50 50
 
51 51
 	}
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function add_rewrite_endpoint() {
59 59
 
60
-		add_rewrite_endpoint( 'wl-api', EP_ROOT );
60
+		add_rewrite_endpoint('wl-api', EP_ROOT);
61 61
 		$this->ensure_rewrite_rules_are_flushed();
62 62
 
63 63
 	}
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
 
72 72
 		global $wp_query;
73 73
 
74
-		if ( ! isset( $wp_query->query_vars['wl-api'] ) ) {
75
-			$this->log->trace( 'Skipping, not a `wl-api` call.' );
74
+		if ( ! isset($wp_query->query_vars['wl-api'])) {
75
+			$this->log->trace('Skipping, not a `wl-api` call.');
76 76
 
77 77
 			return;
78 78
 		}
79 79
 
80
-		$this->do_action( $_REQUEST['action'] );
80
+		$this->do_action($_REQUEST['action']);
81 81
 
82 82
 		exit;
83 83
 
@@ -90,13 +90,13 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @param string $action The action to execute.
92 92
 	 */
93
-	private function do_action( $action ) {
93
+	private function do_action($action) {
94 94
 
95
-		if ( empty( $action ) ) {
95
+		if (empty($action)) {
96 96
 			return;
97 97
 		}
98 98
 
99
-		if ( ! wp_validate_auth_cookie( '', 'logged_in' ) ) {
99
+		if ( ! wp_validate_auth_cookie('', 'logged_in')) {
100 100
 			/**
101 101
 			 * Fires on a non-authenticated admin post request for the given action.
102 102
 			 *
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 			 *
106 106
 			 * @since 2.6.0
107 107
 			 */
108
-			do_action( "admin_post_nopriv_{$action}" );
108
+			do_action("admin_post_nopriv_{$action}");
109 109
 		} else {
110 110
 			/**
111 111
 			 * Fires on an authenticated admin post request for the given action.
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 			 *
116 116
 			 * @since 2.6.0
117 117
 			 */
118
-			do_action( "admin_post_{$action}" );
118
+			do_action("admin_post_{$action}");
119 119
 		}
120 120
 
121 121
 	}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	public function nopriv_hello_world() {
129 129
 
130
-		wp_die( 'Hello World! (from anonymous)' );
130
+		wp_die('Hello World! (from anonymous)');
131 131
 
132 132
 	}
133 133
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function hello_world() {
140 140
 
141
-		wp_die( 'Hello World! (from authenticated)' );
141
+		wp_die('Hello World! (from authenticated)');
142 142
 
143 143
 	}
144 144
 
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 	public static function ensure_rewrite_rules_are_flushed() {
152 152
 
153 153
 		// See https://github.com/insideout10/wordlift-plugin/issues/698.
154
-		if ( 'yes' !== get_option( 'wl_http_api' ) ) {
155
-			update_option( 'wl_http_api', 'yes' );
156
-			add_action( 'wp_loaded', function () {
154
+		if ('yes' !== get_option('wl_http_api')) {
155
+			update_option('wl_http_api', 'yes');
156
+			add_action('wp_loaded', function() {
157 157
 				flush_rewrite_rules();
158 158
 			} );
159 159
 		}
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	public static function activate() {
172 172
 
173 173
 		// Force the plugin to reinitialize the rewrite rules.
174
-		update_option( 'wl_http_api', 'no' );
174
+		update_option('wl_http_api', 'no');
175 175
 
176 176
 	}
177 177
 
Please login to merge, or discard this patch.
src/includes/class-wordlift.php 2 patches
Indentation   +1569 added lines, -1569 removed lines patch added patch discarded remove patch
@@ -28,1602 +28,1602 @@
 block discarded – undo
28 28
  */
29 29
 class Wordlift {
30 30
 
31
-	//<editor-fold desc="## FIELDS">
32
-
33
-	/**
34
-	 * The loader that's responsible for maintaining and registering all hooks that power
35
-	 * the plugin.
36
-	 *
37
-	 * @since    1.0.0
38
-	 * @access   protected
39
-	 * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
40
-	 */
41
-	protected $loader;
42
-
43
-	/**
44
-	 * The unique identifier of this plugin.
45
-	 *
46
-	 * @since    1.0.0
47
-	 * @access   protected
48
-	 * @var      string $plugin_name The string used to uniquely identify this plugin.
49
-	 */
50
-	protected $plugin_name;
51
-
52
-	/**
53
-	 * The current version of the plugin.
54
-	 *
55
-	 * @since    1.0.0
56
-	 * @access   protected
57
-	 * @var      string $version The current version of the plugin.
58
-	 */
59
-	protected $version;
60
-
61
-	/**
62
-	 * The {@link Wordlift_Tinymce_Adapter} instance.
63
-	 *
64
-	 * @since  3.12.0
65
-	 * @access protected
66
-	 * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
67
-	 */
68
-	protected $tinymce_adapter;
69
-
70
-	/**
71
-	 * The Thumbnail service.
72
-	 *
73
-	 * @since  3.1.5
74
-	 * @access private
75
-	 * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
76
-	 */
77
-	private $thumbnail_service;
78
-
79
-	/**
80
-	 * The UI service.
81
-	 *
82
-	 * @since  3.2.0
83
-	 * @access private
84
-	 * @var \Wordlift_UI_Service $ui_service The UI service.
85
-	 */
86
-	private $ui_service;
87
-
88
-	/**
89
-	 * The Schema service.
90
-	 *
91
-	 * @since  3.3.0
92
-	 * @access protected
93
-	 * @var \Wordlift_Schema_Service $schema_service The Schema service.
94
-	 */
95
-	protected $schema_service;
96
-
97
-	/**
98
-	 * The Entity service.
99
-	 *
100
-	 * @since  3.1.0
101
-	 * @access protected
102
-	 * @var \Wordlift_Entity_Service $entity_service The Entity service.
103
-	 */
104
-	protected $entity_service;
105
-
106
-	/**
107
-	 * The Topic Taxonomy service.
108
-	 *
109
-	 * @since  3.5.0
110
-	 * @access private
111
-	 * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
112
-	 */
113
-	private $topic_taxonomy_service;
114
-
115
-	/**
116
-	 * The Entity Types Taxonomy service.
117
-	 *
118
-	 * @since  3.18.0
119
-	 * @access private
120
-	 * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service.
121
-	 */
122
-	private $entity_types_taxonomy_service;
123
-
124
-	/**
125
-	 * The User service.
126
-	 *
127
-	 * @since  3.1.7
128
-	 * @access protected
129
-	 * @var \Wordlift_User_Service $user_service The User service.
130
-	 */
131
-	protected $user_service;
132
-
133
-	/**
134
-	 * The Timeline service.
135
-	 *
136
-	 * @since  3.1.0
137
-	 * @access private
138
-	 * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
139
-	 */
140
-	private $timeline_service;
141
-
142
-	/**
143
-	 * The Redirect service.
144
-	 *
145
-	 * @since  3.2.0
146
-	 * @access private
147
-	 * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
148
-	 */
149
-	private $redirect_service;
150
-
151
-	/**
152
-	 * The Notice service.
153
-	 *
154
-	 * @since  3.3.0
155
-	 * @access private
156
-	 * @var \Wordlift_Notice_Service $notice_service The Notice service.
157
-	 */
158
-	private $notice_service;
159
-
160
-	/**
161
-	 * The Entity list customization.
162
-	 *
163
-	 * @since  3.3.0
164
-	 * @access protected
165
-	 * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
166
-	 */
167
-	protected $entity_list_service;
168
-
169
-	/**
170
-	 * The Entity Types Taxonomy Walker.
171
-	 *
172
-	 * @since  3.1.0
173
-	 * @access private
174
-	 * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
175
-	 */
176
-	private $entity_types_taxonomy_walker;
177
-
178
-	/**
179
-	 * The ShareThis service.
180
-	 *
181
-	 * @since  3.2.0
182
-	 * @access private
183
-	 * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
184
-	 */
185
-	private $sharethis_service;
186
-
187
-	/**
188
-	 * The PrimaShop adapter.
189
-	 *
190
-	 * @since  3.2.3
191
-	 * @access private
192
-	 * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
193
-	 */
194
-	private $primashop_adapter;
195
-
196
-	/**
197
-	 * The WordLift Dashboard adapter.
198
-	 *
199
-	 * @since  3.4.0
200
-	 * @access private
201
-	 * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
202
-	 */
203
-	private $dashboard_service;
204
-
205
-	/**
206
-	 * The entity type service.
207
-	 *
208
-	 * @since  3.6.0
209
-	 * @access private
210
-	 * @var \Wordlift_Entity_Post_Type_Service
211
-	 */
212
-	private $entity_post_type_service;
213
-
214
-	/**
215
-	 * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
216
-	 *
217
-	 * @since  3.6.0
218
-	 * @access private
219
-	 * @var \Wordlift_Entity_Link_Service
220
-	 */
221
-	private $entity_link_service;
222
-
223
-	/**
224
-	 * A {@link Wordlift_Sparql_Service} instance.
225
-	 *
226
-	 * @since    3.6.0
227
-	 * @access   protected
228
-	 * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
229
-	 */
230
-	protected $sparql_service;
231
-
232
-	/**
233
-	 * A {@link Wordlift_Import_Service} instance.
234
-	 *
235
-	 * @since  3.6.0
236
-	 * @access private
237
-	 * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
238
-	 */
239
-	private $import_service;
240
-
241
-	/**
242
-	 * A {@link Wordlift_Rebuild_Service} instance.
243
-	 *
244
-	 * @since  3.6.0
245
-	 * @access private
246
-	 * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
247
-	 */
248
-	private $rebuild_service;
249
-
250
-	/**
251
-	 * A {@link Wordlift_Jsonld_Service} instance.
252
-	 *
253
-	 * @since  3.7.0
254
-	 * @access protected
255
-	 * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
256
-	 */
257
-	protected $jsonld_service;
258
-
259
-	/**
260
-	 * A {@link Wordlift_Website_Jsonld_Converter} instance.
261
-	 *
262
-	 * @since  3.14.0
263
-	 * @access protected
264
-	 * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance.
265
-	 */
266
-	protected $jsonld_website_converter;
267
-
268
-	/**
269
-	 * A {@link Wordlift_Property_Factory} instance.
270
-	 *
271
-	 * @since  3.7.0
272
-	 * @access private
273
-	 * @var \Wordlift_Property_Factory $property_factory
274
-	 */
275
-	private $property_factory;
276
-
277
-	/**
278
-	 * The 'Download Your Data' page.
279
-	 *
280
-	 * @since  3.6.0
281
-	 * @access private
282
-	 * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
283
-	 */
284
-	private $download_your_data_page;
285
-
286
-	/**
287
-	 * The 'WordLift Settings' page.
288
-	 *
289
-	 * @since  3.11.0
290
-	 * @access protected
291
-	 * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
292
-	 */
293
-	protected $settings_page;
294
-
295
-	/**
296
-	 * The 'WordLift Batch analysis' page.
297
-	 *
298
-	 * @since  3.14.0
299
-	 * @access protected
300
-	 * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page.
301
-	 */
302
-	protected $batch_analysis_page;
303
-
304
-	/**
305
-	 * The install wizard page.
306
-	 *
307
-	 * @since  3.9.0
308
-	 * @access private
309
-	 * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
310
-	 */
311
-	private $admin_setup;
312
-
313
-	/**
314
-	 * The Content Filter Service hooks up to the 'the_content' filter and provides
315
-	 * linking of entities to their pages.
316
-	 *
317
-	 * @since  3.8.0
318
-	 * @access private
319
-	 * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
320
-	 */
321
-	private $content_filter_service;
322
-
323
-	/**
324
-	 * A {@link Wordlift_Key_Validation_Service} instance.
325
-	 *
326
-	 * @since  3.9.0
327
-	 * @access private
328
-	 * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
329
-	 */
330
-	private $key_validation_service;
331
-
332
-	/**
333
-	 * A {@link Wordlift_Rating_Service} instance.
334
-	 *
335
-	 * @since  3.10.0
336
-	 * @access private
337
-	 * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
338
-	 */
339
-	private $rating_service;
340
-
341
-	/**
342
-	 * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
343
-	 *
344
-	 * @since  3.10.0
345
-	 * @access protected
346
-	 * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
347
-	 */
348
-	protected $post_to_jsonld_converter;
349
-
350
-	/**
351
-	 * A {@link Wordlift_Configuration_Service} instance.
352
-	 *
353
-	 * @since  3.10.0
354
-	 * @access protected
355
-	 * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
356
-	 */
357
-	protected $configuration_service;
358
-
359
-	/**
360
-	 * A {@link Wordlift_Install_Service} instance.
361
-	 *
362
-	 * @since  3.18.0
363
-	 * @access protected
364
-	 * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance.
365
-	 */
366
-	protected $install_service;
367
-
368
-	/**
369
-	 * A {@link Wordlift_Entity_Type_Service} instance.
370
-	 *
371
-	 * @since  3.10.0
372
-	 * @access protected
373
-	 * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
374
-	 */
375
-	protected $entity_type_service;
376
-
377
-	/**
378
-	 * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
379
-	 *
380
-	 * @since  3.10.0
381
-	 * @access protected
382
-	 * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
383
-	 */
384
-	protected $entity_post_to_jsonld_converter;
385
-
386
-	/**
387
-	 * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
388
-	 *
389
-	 * @since  3.10.0
390
-	 * @access protected
391
-	 * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
392
-	 */
393
-	protected $postid_to_jsonld_converter;
394
-
395
-	/**
396
-	 * The {@link Wordlift_Admin_Status_Page} class.
397
-	 *
398
-	 * @since  3.9.8
399
-	 * @access private
400
-	 * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
401
-	 */
402
-	private $status_page;
403
-
404
-	/**
405
-	 * The {@link Wordlift_Category_Taxonomy_Service} instance.
406
-	 *
407
-	 * @since  3.11.0
408
-	 * @access protected
409
-	 * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
410
-	 */
411
-	protected $category_taxonomy_service;
412
-
413
-	/**
414
-	 * The {@link Wordlift_Entity_Page_Service} instance.
415
-	 *
416
-	 * @since  3.11.0
417
-	 * @access protected
418
-	 * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance.
419
-	 */
420
-	protected $entity_page_service;
421
-
422
-	/**
423
-	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
424
-	 *
425
-	 * @since  3.11.0
426
-	 * @access protected
427
-	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
428
-	 */
429
-	protected $settings_page_action_link;
430
-
431
-	/**
432
-	 * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
433
-	 *
434
-	 * @since  3.11.0
435
-	 * @access protected
436
-	 * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
437
-	 */
438
-	protected $publisher_ajax_adapter;
439
-
440
-	/**
441
-	 * The {@link Wordlift_Admin_Input_Element} element renderer.
442
-	 *
443
-	 * @since  3.11.0
444
-	 * @access protected
445
-	 * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
446
-	 */
447
-	protected $input_element;
448
-
449
-	/**
450
-	 * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
451
-	 *
452
-	 * @since  3.13.0
453
-	 * @access protected
454
-	 * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
455
-	 */
456
-	protected $radio_input_element;
457
-
458
-	/**
459
-	 * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
460
-	 *
461
-	 * @since  3.11.0
462
-	 * @access protected
463
-	 * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
464
-	 */
465
-	protected $language_select_element;
466
-
467
-	/**
468
-	 * The {@link Wordlift_Admin_Publisher_Element} element renderer.
469
-	 *
470
-	 * @since  3.11.0
471
-	 * @access protected
472
-	 * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
473
-	 */
474
-	protected $publisher_element;
475
-
476
-	/**
477
-	 * The {@link Wordlift_Admin_Select2_Element} element renderer.
478
-	 *
479
-	 * @since  3.11.0
480
-	 * @access protected
481
-	 * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
482
-	 */
483
-	protected $select2_element;
484
-
485
-	/**
486
-	 * The controller for the entity type list admin page
487
-	 *
488
-	 * @since  3.11.0
489
-	 * @access private
490
-	 * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
491
-	 */
492
-	private $entity_type_admin_page;
493
-
494
-	/**
495
-	 * The controller for the entity type settings admin page
496
-	 *
497
-	 * @since  3.11.0
498
-	 * @access private
499
-	 * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
500
-	 */
501
-	private $entity_type_settings_admin_page;
502
-
503
-	/**
504
-	 * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
505
-	 *
506
-	 * @since  3.11.0
507
-	 * @access protected
508
-	 * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
509
-	 */
510
-	protected $related_entities_cloud_widget;
511
-
512
-	/**
513
-	 * The {@link Wordlift_Admin_Author_Element} instance.
514
-	 *
515
-	 * @since  3.14.0
516
-	 * @access protected
517
-	 * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
518
-	 */
519
-	protected $author_element;
520
-
521
-	/**
522
-	 * The {@link Wordlift_Batch_Analysis_Service} instance.
523
-	 *
524
-	 * @since  3.14.0
525
-	 * @access protected
526
-	 * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance.
527
-	 */
528
-	protected $batch_analysis_service;
529
-
530
-	/**
531
-	 * The {@link Wordlift_Sample_Data_Service} instance.
532
-	 *
533
-	 * @since  3.12.0
534
-	 * @access protected
535
-	 * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
536
-	 */
537
-	protected $sample_data_service;
538
-
539
-	/**
540
-	 * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
541
-	 *
542
-	 * @since  3.12.0
543
-	 * @access protected
544
-	 * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
545
-	 */
546
-	protected $sample_data_ajax_adapter;
547
-
548
-	/**
549
-	 * The {@link Wordlift_Batch_Analysis_Adapter} instance.
550
-	 *
551
-	 * @since  3.14.2
552
-	 * @access protected
553
-	 * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance.
554
-	 */
555
-	private $batch_analysis_adapter;
556
-
557
-	/**
558
-	 * The {@link Wordlift_Relation_Rebuild_Service} instance.
559
-	 *
560
-	 * @since  3.14.3
561
-	 * @access private
562
-	 * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance.
563
-	 */
564
-	private $relation_rebuild_service;
565
-
566
-	/**
567
-	 * The {@link Wordlift_Relation_Rebuild_Adapter} instance.
568
-	 *
569
-	 * @since  3.14.3
570
-	 * @access private
571
-	 * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance.
572
-	 */
573
-	private $relation_rebuild_adapter;
574
-
575
-	/**
576
-	 * The {@link Wordlift_Reference_Rebuild_Service} instance.
577
-	 *
578
-	 * @since  3.18.0
579
-	 * @access private
580
-	 * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance.
581
-	 */
582
-	private $reference_rebuild_service;
583
-
584
-	/**
585
-	 * The {@link Wordlift_Google_Analytics_Export_Service} instance.
586
-	 *
587
-	 * @since  3.16.0
588
-	 * @access protected
589
-	 * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance.
590
-	 */
591
-	protected $google_analytics_export_service;
592
-
593
-	/**
594
-	 * {@link Wordlift}'s singleton instance.
595
-	 *
596
-	 * @since  3.15.0
597
-	 * @access protected
598
-	 * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance.
599
-	 */
600
-	protected $entity_type_adapter;
601
-
602
-	/**
603
-	 * The {@link Wordlift_Linked_Data_Service} instance.
604
-	 *
605
-	 * @since  3.15.0
606
-	 * @access protected
607
-	 * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance.
608
-	 */
609
-	protected $linked_data_service;
610
-
611
-	/**
612
-	 * The {@link Wordlift_Storage_Factory} instance.
613
-	 *
614
-	 * @since  3.15.0
615
-	 * @access protected
616
-	 * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance.
617
-	 */
618
-	protected $storage_factory;
619
-
620
-	/**
621
-	 * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
622
-	 *
623
-	 * @since  3.15.0
624
-	 * @access protected
625
-	 * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
626
-	 */
627
-	protected $rendition_factory;
628
-
629
-	/**
630
-	 * The {@link Wordlift_Autocomplete_Service} instance.
631
-	 *
632
-	 * @since  3.15.0
633
-	 * @access private
634
-	 * @var \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance.
635
-	 */
636
-	private $autocomplete_service;
637
-
638
-	/**
639
-	 * The {@link Wordlift_Autocomplete_Adapter} instance.
640
-	 *
641
-	 * @since  3.15.0
642
-	 * @access private
643
-	 * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance.
644
-	 */
645
-	private $autocomplete_adapter;
646
-
647
-	/**
648
-	 * The {@link Wordlift_Relation_Service} instance.
649
-	 *
650
-	 * @since  3.15.0
651
-	 * @access protected
652
-	 * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
653
-	 */
654
-	protected $relation_service;
655
-
656
-	/**
657
-	 * The {@link Wordlift_Cached_Post_Converter} instance.
658
-	 *
659
-	 * @since  3.16.0
660
-	 * @access protected
661
-	 * @var  \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance.
662
-	 *
663
-	 */
664
-	protected $cached_postid_to_jsonld_converter;
665
-
666
-	/**
667
-	 * The {@link Wordlift_File_Cache_Service} instance.
668
-	 *
669
-	 * @since  3.16.0
670
-	 * @access protected
671
-	 * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance.
672
-	 */
673
-	protected $file_cache_service;
674
-
675
-	/**
676
-	 * The {@link Wordlift_Entity_Uri_Service} instance.
677
-	 *
678
-	 * @since  3.16.3
679
-	 * @access protected
680
-	 * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
681
-	 */
682
-	protected $entity_uri_service;
683
-
684
-	/**
685
-	 * The {@link Wordlift_Publisher_Service} instance.
686
-	 *
687
-	 * @since  3.19.0
688
-	 * @access protected
689
-	 * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
690
-	 */
691
-	protected $publisher_service;
692
-
693
-	/**
694
-	 * {@link Wordlift}'s singleton instance.
695
-	 *
696
-	 * @since  3.11.2
697
-	 * @access private
698
-	 * @var Wordlift $instance {@link Wordlift}'s singleton instance.
699
-	 */
700
-	private static $instance;
701
-	//</editor-fold>
702
-
703
-	/**
704
-	 * Define the core functionality of the plugin.
705
-	 *
706
-	 * Set the plugin name and the plugin version that can be used throughout the plugin.
707
-	 * Load the dependencies, define the locale, and set the hooks for the admin area and
708
-	 * the public-facing side of the site.
709
-	 *
710
-	 * @since    1.0.0
711
-	 */
712
-	public function __construct() {
713
-
714
-		$this->plugin_name = 'wordlift';
715
-		$this->version     = '3.19.2';
716
-		$this->load_dependencies();
717
-		$this->set_locale();
718
-		$this->define_admin_hooks();
719
-		$this->define_public_hooks();
720
-
721
-		// If we're in `WP_CLI` load the related files.
722
-		if ( class_exists( 'WP_CLI' ) ) {
723
-			$this->load_cli_dependencies();
724
-		}
725
-
726
-		self::$instance = $this;
727
-
728
-	}
729
-
730
-	/**
731
-	 * Get the singleton instance.
732
-	 *
733
-	 * @since 3.11.2
734
-	 *
735
-	 * @return Wordlift The {@link Wordlift} singleton instance.
736
-	 */
737
-	public static function get_instance() {
738
-
739
-		return self::$instance;
740
-	}
741
-
742
-	/**
743
-	 * Load the required dependencies for this plugin.
744
-	 *
745
-	 * Include the following files that make up the plugin:
746
-	 *
747
-	 * - Wordlift_Loader. Orchestrates the hooks of the plugin.
748
-	 * - Wordlift_i18n. Defines internationalization functionality.
749
-	 * - Wordlift_Admin. Defines all hooks for the admin area.
750
-	 * - Wordlift_Public. Defines all hooks for the public side of the site.
751
-	 *
752
-	 * Create an instance of the loader which will be used to register the hooks
753
-	 * with WordPress.
754
-	 *
755
-	 * @since    1.0.0
756
-	 * @access   private
757
-	 */
758
-	private function load_dependencies() {
759
-
760
-		/**
761
-		 * The class responsible for orchestrating the actions and filters of the
762
-		 * core plugin.
763
-		 */
764
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
765
-
766
-		// The class responsible for plugin uninstall.
767
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php';
768
-
769
-		/**
770
-		 * The class responsible for defining internationalization functionality
771
-		 * of the plugin.
772
-		 */
773
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
774
-
775
-		/**
776
-		 * WordLift's supported languages.
777
-		 */
778
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
779
-
780
-		/**
781
-		 * Provide support functions to sanitize data.
782
-		 */
783
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
784
-
785
-		/** Installs. */
786
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install.php';
787
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
788
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-1-0-0.php';
789
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-10-0.php';
790
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-12-0.php';
791
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-14-0.php';
792
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-15-0.php';
793
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-0.php';
794
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-3.php';
795
-
796
-		/** Services. */
797
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
798
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
799
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
800
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
801
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
802
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
803
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
804
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
805
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
806
-
807
-		/**
808
-		 * The Query builder.
809
-		 */
810
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
811
-
812
-		/**
813
-		 * The Schema service.
814
-		 */
815
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
816
-
817
-		/**
818
-		 * The schema:url property service.
819
-		 */
820
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
821
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
822
-
823
-		/**
824
-		 * The UI service.
825
-		 */
826
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
827
-
828
-		/**
829
-		 * The Thumbnail service.
830
-		 */
831
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
832
-
833
-		/**
834
-		 * The Entity Types Taxonomy service.
835
-		 */
836
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
837
-
838
-		/**
839
-		 * The Entity service.
840
-		 */
841
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
842
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
843
-
844
-		// Add the entity rating service.
845
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
846
-
847
-		/**
848
-		 * The User service.
849
-		 */
850
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
851
-
852
-		/**
853
-		 * The Timeline service.
854
-		 */
855
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
856
-
857
-		/**
858
-		 * The Topic Taxonomy service.
859
-		 */
860
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
861
-
862
-		/**
863
-		 * The SPARQL service.
864
-		 */
865
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
866
-
867
-		/**
868
-		 * The WordLift import service.
869
-		 */
870
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
871
-
872
-		/**
873
-		 * The WordLift URI service.
874
-		 */
875
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
876
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
877
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
878
-
879
-		/**
880
-		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
881
-		 */
882
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php';
883
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php';
884
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php';
885
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php';
886
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
887
-
888
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
889
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
890
-
891
-		/**
892
-		 * Load the converters.
893
-		 */
894
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
895
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
896
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
897
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
898
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
899
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
900
-
901
-		/**
902
-		 * Load cache-related files.
903
-		 */
904
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
905
-
906
-		/**
907
-		 * Load the content filter.
908
-		 */
909
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
910
-
911
-		/*
31
+    //<editor-fold desc="## FIELDS">
32
+
33
+    /**
34
+     * The loader that's responsible for maintaining and registering all hooks that power
35
+     * the plugin.
36
+     *
37
+     * @since    1.0.0
38
+     * @access   protected
39
+     * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
40
+     */
41
+    protected $loader;
42
+
43
+    /**
44
+     * The unique identifier of this plugin.
45
+     *
46
+     * @since    1.0.0
47
+     * @access   protected
48
+     * @var      string $plugin_name The string used to uniquely identify this plugin.
49
+     */
50
+    protected $plugin_name;
51
+
52
+    /**
53
+     * The current version of the plugin.
54
+     *
55
+     * @since    1.0.0
56
+     * @access   protected
57
+     * @var      string $version The current version of the plugin.
58
+     */
59
+    protected $version;
60
+
61
+    /**
62
+     * The {@link Wordlift_Tinymce_Adapter} instance.
63
+     *
64
+     * @since  3.12.0
65
+     * @access protected
66
+     * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
67
+     */
68
+    protected $tinymce_adapter;
69
+
70
+    /**
71
+     * The Thumbnail service.
72
+     *
73
+     * @since  3.1.5
74
+     * @access private
75
+     * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
76
+     */
77
+    private $thumbnail_service;
78
+
79
+    /**
80
+     * The UI service.
81
+     *
82
+     * @since  3.2.0
83
+     * @access private
84
+     * @var \Wordlift_UI_Service $ui_service The UI service.
85
+     */
86
+    private $ui_service;
87
+
88
+    /**
89
+     * The Schema service.
90
+     *
91
+     * @since  3.3.0
92
+     * @access protected
93
+     * @var \Wordlift_Schema_Service $schema_service The Schema service.
94
+     */
95
+    protected $schema_service;
96
+
97
+    /**
98
+     * The Entity service.
99
+     *
100
+     * @since  3.1.0
101
+     * @access protected
102
+     * @var \Wordlift_Entity_Service $entity_service The Entity service.
103
+     */
104
+    protected $entity_service;
105
+
106
+    /**
107
+     * The Topic Taxonomy service.
108
+     *
109
+     * @since  3.5.0
110
+     * @access private
111
+     * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
112
+     */
113
+    private $topic_taxonomy_service;
114
+
115
+    /**
116
+     * The Entity Types Taxonomy service.
117
+     *
118
+     * @since  3.18.0
119
+     * @access private
120
+     * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service.
121
+     */
122
+    private $entity_types_taxonomy_service;
123
+
124
+    /**
125
+     * The User service.
126
+     *
127
+     * @since  3.1.7
128
+     * @access protected
129
+     * @var \Wordlift_User_Service $user_service The User service.
130
+     */
131
+    protected $user_service;
132
+
133
+    /**
134
+     * The Timeline service.
135
+     *
136
+     * @since  3.1.0
137
+     * @access private
138
+     * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
139
+     */
140
+    private $timeline_service;
141
+
142
+    /**
143
+     * The Redirect service.
144
+     *
145
+     * @since  3.2.0
146
+     * @access private
147
+     * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
148
+     */
149
+    private $redirect_service;
150
+
151
+    /**
152
+     * The Notice service.
153
+     *
154
+     * @since  3.3.0
155
+     * @access private
156
+     * @var \Wordlift_Notice_Service $notice_service The Notice service.
157
+     */
158
+    private $notice_service;
159
+
160
+    /**
161
+     * The Entity list customization.
162
+     *
163
+     * @since  3.3.0
164
+     * @access protected
165
+     * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
166
+     */
167
+    protected $entity_list_service;
168
+
169
+    /**
170
+     * The Entity Types Taxonomy Walker.
171
+     *
172
+     * @since  3.1.0
173
+     * @access private
174
+     * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
175
+     */
176
+    private $entity_types_taxonomy_walker;
177
+
178
+    /**
179
+     * The ShareThis service.
180
+     *
181
+     * @since  3.2.0
182
+     * @access private
183
+     * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
184
+     */
185
+    private $sharethis_service;
186
+
187
+    /**
188
+     * The PrimaShop adapter.
189
+     *
190
+     * @since  3.2.3
191
+     * @access private
192
+     * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
193
+     */
194
+    private $primashop_adapter;
195
+
196
+    /**
197
+     * The WordLift Dashboard adapter.
198
+     *
199
+     * @since  3.4.0
200
+     * @access private
201
+     * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
202
+     */
203
+    private $dashboard_service;
204
+
205
+    /**
206
+     * The entity type service.
207
+     *
208
+     * @since  3.6.0
209
+     * @access private
210
+     * @var \Wordlift_Entity_Post_Type_Service
211
+     */
212
+    private $entity_post_type_service;
213
+
214
+    /**
215
+     * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
216
+     *
217
+     * @since  3.6.0
218
+     * @access private
219
+     * @var \Wordlift_Entity_Link_Service
220
+     */
221
+    private $entity_link_service;
222
+
223
+    /**
224
+     * A {@link Wordlift_Sparql_Service} instance.
225
+     *
226
+     * @since    3.6.0
227
+     * @access   protected
228
+     * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
229
+     */
230
+    protected $sparql_service;
231
+
232
+    /**
233
+     * A {@link Wordlift_Import_Service} instance.
234
+     *
235
+     * @since  3.6.0
236
+     * @access private
237
+     * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
238
+     */
239
+    private $import_service;
240
+
241
+    /**
242
+     * A {@link Wordlift_Rebuild_Service} instance.
243
+     *
244
+     * @since  3.6.0
245
+     * @access private
246
+     * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
247
+     */
248
+    private $rebuild_service;
249
+
250
+    /**
251
+     * A {@link Wordlift_Jsonld_Service} instance.
252
+     *
253
+     * @since  3.7.0
254
+     * @access protected
255
+     * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
256
+     */
257
+    protected $jsonld_service;
258
+
259
+    /**
260
+     * A {@link Wordlift_Website_Jsonld_Converter} instance.
261
+     *
262
+     * @since  3.14.0
263
+     * @access protected
264
+     * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance.
265
+     */
266
+    protected $jsonld_website_converter;
267
+
268
+    /**
269
+     * A {@link Wordlift_Property_Factory} instance.
270
+     *
271
+     * @since  3.7.0
272
+     * @access private
273
+     * @var \Wordlift_Property_Factory $property_factory
274
+     */
275
+    private $property_factory;
276
+
277
+    /**
278
+     * The 'Download Your Data' page.
279
+     *
280
+     * @since  3.6.0
281
+     * @access private
282
+     * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
283
+     */
284
+    private $download_your_data_page;
285
+
286
+    /**
287
+     * The 'WordLift Settings' page.
288
+     *
289
+     * @since  3.11.0
290
+     * @access protected
291
+     * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
292
+     */
293
+    protected $settings_page;
294
+
295
+    /**
296
+     * The 'WordLift Batch analysis' page.
297
+     *
298
+     * @since  3.14.0
299
+     * @access protected
300
+     * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page.
301
+     */
302
+    protected $batch_analysis_page;
303
+
304
+    /**
305
+     * The install wizard page.
306
+     *
307
+     * @since  3.9.0
308
+     * @access private
309
+     * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
310
+     */
311
+    private $admin_setup;
312
+
313
+    /**
314
+     * The Content Filter Service hooks up to the 'the_content' filter and provides
315
+     * linking of entities to their pages.
316
+     *
317
+     * @since  3.8.0
318
+     * @access private
319
+     * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
320
+     */
321
+    private $content_filter_service;
322
+
323
+    /**
324
+     * A {@link Wordlift_Key_Validation_Service} instance.
325
+     *
326
+     * @since  3.9.0
327
+     * @access private
328
+     * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
329
+     */
330
+    private $key_validation_service;
331
+
332
+    /**
333
+     * A {@link Wordlift_Rating_Service} instance.
334
+     *
335
+     * @since  3.10.0
336
+     * @access private
337
+     * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
338
+     */
339
+    private $rating_service;
340
+
341
+    /**
342
+     * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
343
+     *
344
+     * @since  3.10.0
345
+     * @access protected
346
+     * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
347
+     */
348
+    protected $post_to_jsonld_converter;
349
+
350
+    /**
351
+     * A {@link Wordlift_Configuration_Service} instance.
352
+     *
353
+     * @since  3.10.0
354
+     * @access protected
355
+     * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
356
+     */
357
+    protected $configuration_service;
358
+
359
+    /**
360
+     * A {@link Wordlift_Install_Service} instance.
361
+     *
362
+     * @since  3.18.0
363
+     * @access protected
364
+     * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance.
365
+     */
366
+    protected $install_service;
367
+
368
+    /**
369
+     * A {@link Wordlift_Entity_Type_Service} instance.
370
+     *
371
+     * @since  3.10.0
372
+     * @access protected
373
+     * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
374
+     */
375
+    protected $entity_type_service;
376
+
377
+    /**
378
+     * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
379
+     *
380
+     * @since  3.10.0
381
+     * @access protected
382
+     * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
383
+     */
384
+    protected $entity_post_to_jsonld_converter;
385
+
386
+    /**
387
+     * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
388
+     *
389
+     * @since  3.10.0
390
+     * @access protected
391
+     * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
392
+     */
393
+    protected $postid_to_jsonld_converter;
394
+
395
+    /**
396
+     * The {@link Wordlift_Admin_Status_Page} class.
397
+     *
398
+     * @since  3.9.8
399
+     * @access private
400
+     * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
401
+     */
402
+    private $status_page;
403
+
404
+    /**
405
+     * The {@link Wordlift_Category_Taxonomy_Service} instance.
406
+     *
407
+     * @since  3.11.0
408
+     * @access protected
409
+     * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
410
+     */
411
+    protected $category_taxonomy_service;
412
+
413
+    /**
414
+     * The {@link Wordlift_Entity_Page_Service} instance.
415
+     *
416
+     * @since  3.11.0
417
+     * @access protected
418
+     * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance.
419
+     */
420
+    protected $entity_page_service;
421
+
422
+    /**
423
+     * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
424
+     *
425
+     * @since  3.11.0
426
+     * @access protected
427
+     * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
428
+     */
429
+    protected $settings_page_action_link;
430
+
431
+    /**
432
+     * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
433
+     *
434
+     * @since  3.11.0
435
+     * @access protected
436
+     * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
437
+     */
438
+    protected $publisher_ajax_adapter;
439
+
440
+    /**
441
+     * The {@link Wordlift_Admin_Input_Element} element renderer.
442
+     *
443
+     * @since  3.11.0
444
+     * @access protected
445
+     * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
446
+     */
447
+    protected $input_element;
448
+
449
+    /**
450
+     * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
451
+     *
452
+     * @since  3.13.0
453
+     * @access protected
454
+     * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
455
+     */
456
+    protected $radio_input_element;
457
+
458
+    /**
459
+     * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
460
+     *
461
+     * @since  3.11.0
462
+     * @access protected
463
+     * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
464
+     */
465
+    protected $language_select_element;
466
+
467
+    /**
468
+     * The {@link Wordlift_Admin_Publisher_Element} element renderer.
469
+     *
470
+     * @since  3.11.0
471
+     * @access protected
472
+     * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
473
+     */
474
+    protected $publisher_element;
475
+
476
+    /**
477
+     * The {@link Wordlift_Admin_Select2_Element} element renderer.
478
+     *
479
+     * @since  3.11.0
480
+     * @access protected
481
+     * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
482
+     */
483
+    protected $select2_element;
484
+
485
+    /**
486
+     * The controller for the entity type list admin page
487
+     *
488
+     * @since  3.11.0
489
+     * @access private
490
+     * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
491
+     */
492
+    private $entity_type_admin_page;
493
+
494
+    /**
495
+     * The controller for the entity type settings admin page
496
+     *
497
+     * @since  3.11.0
498
+     * @access private
499
+     * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
500
+     */
501
+    private $entity_type_settings_admin_page;
502
+
503
+    /**
504
+     * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
505
+     *
506
+     * @since  3.11.0
507
+     * @access protected
508
+     * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
509
+     */
510
+    protected $related_entities_cloud_widget;
511
+
512
+    /**
513
+     * The {@link Wordlift_Admin_Author_Element} instance.
514
+     *
515
+     * @since  3.14.0
516
+     * @access protected
517
+     * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
518
+     */
519
+    protected $author_element;
520
+
521
+    /**
522
+     * The {@link Wordlift_Batch_Analysis_Service} instance.
523
+     *
524
+     * @since  3.14.0
525
+     * @access protected
526
+     * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance.
527
+     */
528
+    protected $batch_analysis_service;
529
+
530
+    /**
531
+     * The {@link Wordlift_Sample_Data_Service} instance.
532
+     *
533
+     * @since  3.12.0
534
+     * @access protected
535
+     * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
536
+     */
537
+    protected $sample_data_service;
538
+
539
+    /**
540
+     * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
541
+     *
542
+     * @since  3.12.0
543
+     * @access protected
544
+     * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
545
+     */
546
+    protected $sample_data_ajax_adapter;
547
+
548
+    /**
549
+     * The {@link Wordlift_Batch_Analysis_Adapter} instance.
550
+     *
551
+     * @since  3.14.2
552
+     * @access protected
553
+     * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance.
554
+     */
555
+    private $batch_analysis_adapter;
556
+
557
+    /**
558
+     * The {@link Wordlift_Relation_Rebuild_Service} instance.
559
+     *
560
+     * @since  3.14.3
561
+     * @access private
562
+     * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance.
563
+     */
564
+    private $relation_rebuild_service;
565
+
566
+    /**
567
+     * The {@link Wordlift_Relation_Rebuild_Adapter} instance.
568
+     *
569
+     * @since  3.14.3
570
+     * @access private
571
+     * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance.
572
+     */
573
+    private $relation_rebuild_adapter;
574
+
575
+    /**
576
+     * The {@link Wordlift_Reference_Rebuild_Service} instance.
577
+     *
578
+     * @since  3.18.0
579
+     * @access private
580
+     * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance.
581
+     */
582
+    private $reference_rebuild_service;
583
+
584
+    /**
585
+     * The {@link Wordlift_Google_Analytics_Export_Service} instance.
586
+     *
587
+     * @since  3.16.0
588
+     * @access protected
589
+     * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance.
590
+     */
591
+    protected $google_analytics_export_service;
592
+
593
+    /**
594
+     * {@link Wordlift}'s singleton instance.
595
+     *
596
+     * @since  3.15.0
597
+     * @access protected
598
+     * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance.
599
+     */
600
+    protected $entity_type_adapter;
601
+
602
+    /**
603
+     * The {@link Wordlift_Linked_Data_Service} instance.
604
+     *
605
+     * @since  3.15.0
606
+     * @access protected
607
+     * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance.
608
+     */
609
+    protected $linked_data_service;
610
+
611
+    /**
612
+     * The {@link Wordlift_Storage_Factory} instance.
613
+     *
614
+     * @since  3.15.0
615
+     * @access protected
616
+     * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance.
617
+     */
618
+    protected $storage_factory;
619
+
620
+    /**
621
+     * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
622
+     *
623
+     * @since  3.15.0
624
+     * @access protected
625
+     * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
626
+     */
627
+    protected $rendition_factory;
628
+
629
+    /**
630
+     * The {@link Wordlift_Autocomplete_Service} instance.
631
+     *
632
+     * @since  3.15.0
633
+     * @access private
634
+     * @var \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance.
635
+     */
636
+    private $autocomplete_service;
637
+
638
+    /**
639
+     * The {@link Wordlift_Autocomplete_Adapter} instance.
640
+     *
641
+     * @since  3.15.0
642
+     * @access private
643
+     * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance.
644
+     */
645
+    private $autocomplete_adapter;
646
+
647
+    /**
648
+     * The {@link Wordlift_Relation_Service} instance.
649
+     *
650
+     * @since  3.15.0
651
+     * @access protected
652
+     * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
653
+     */
654
+    protected $relation_service;
655
+
656
+    /**
657
+     * The {@link Wordlift_Cached_Post_Converter} instance.
658
+     *
659
+     * @since  3.16.0
660
+     * @access protected
661
+     * @var  \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance.
662
+     *
663
+     */
664
+    protected $cached_postid_to_jsonld_converter;
665
+
666
+    /**
667
+     * The {@link Wordlift_File_Cache_Service} instance.
668
+     *
669
+     * @since  3.16.0
670
+     * @access protected
671
+     * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance.
672
+     */
673
+    protected $file_cache_service;
674
+
675
+    /**
676
+     * The {@link Wordlift_Entity_Uri_Service} instance.
677
+     *
678
+     * @since  3.16.3
679
+     * @access protected
680
+     * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance.
681
+     */
682
+    protected $entity_uri_service;
683
+
684
+    /**
685
+     * The {@link Wordlift_Publisher_Service} instance.
686
+     *
687
+     * @since  3.19.0
688
+     * @access protected
689
+     * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance.
690
+     */
691
+    protected $publisher_service;
692
+
693
+    /**
694
+     * {@link Wordlift}'s singleton instance.
695
+     *
696
+     * @since  3.11.2
697
+     * @access private
698
+     * @var Wordlift $instance {@link Wordlift}'s singleton instance.
699
+     */
700
+    private static $instance;
701
+    //</editor-fold>
702
+
703
+    /**
704
+     * Define the core functionality of the plugin.
705
+     *
706
+     * Set the plugin name and the plugin version that can be used throughout the plugin.
707
+     * Load the dependencies, define the locale, and set the hooks for the admin area and
708
+     * the public-facing side of the site.
709
+     *
710
+     * @since    1.0.0
711
+     */
712
+    public function __construct() {
713
+
714
+        $this->plugin_name = 'wordlift';
715
+        $this->version     = '3.19.2';
716
+        $this->load_dependencies();
717
+        $this->set_locale();
718
+        $this->define_admin_hooks();
719
+        $this->define_public_hooks();
720
+
721
+        // If we're in `WP_CLI` load the related files.
722
+        if ( class_exists( 'WP_CLI' ) ) {
723
+            $this->load_cli_dependencies();
724
+        }
725
+
726
+        self::$instance = $this;
727
+
728
+    }
729
+
730
+    /**
731
+     * Get the singleton instance.
732
+     *
733
+     * @since 3.11.2
734
+     *
735
+     * @return Wordlift The {@link Wordlift} singleton instance.
736
+     */
737
+    public static function get_instance() {
738
+
739
+        return self::$instance;
740
+    }
741
+
742
+    /**
743
+     * Load the required dependencies for this plugin.
744
+     *
745
+     * Include the following files that make up the plugin:
746
+     *
747
+     * - Wordlift_Loader. Orchestrates the hooks of the plugin.
748
+     * - Wordlift_i18n. Defines internationalization functionality.
749
+     * - Wordlift_Admin. Defines all hooks for the admin area.
750
+     * - Wordlift_Public. Defines all hooks for the public side of the site.
751
+     *
752
+     * Create an instance of the loader which will be used to register the hooks
753
+     * with WordPress.
754
+     *
755
+     * @since    1.0.0
756
+     * @access   private
757
+     */
758
+    private function load_dependencies() {
759
+
760
+        /**
761
+         * The class responsible for orchestrating the actions and filters of the
762
+         * core plugin.
763
+         */
764
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
765
+
766
+        // The class responsible for plugin uninstall.
767
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php';
768
+
769
+        /**
770
+         * The class responsible for defining internationalization functionality
771
+         * of the plugin.
772
+         */
773
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
774
+
775
+        /**
776
+         * WordLift's supported languages.
777
+         */
778
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
779
+
780
+        /**
781
+         * Provide support functions to sanitize data.
782
+         */
783
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
784
+
785
+        /** Installs. */
786
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install.php';
787
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
788
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-1-0-0.php';
789
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-10-0.php';
790
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-12-0.php';
791
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-14-0.php';
792
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-15-0.php';
793
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-0.php';
794
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-3.php';
795
+
796
+        /** Services. */
797
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
798
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
799
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
800
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
801
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
802
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
803
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
804
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
805
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
806
+
807
+        /**
808
+         * The Query builder.
809
+         */
810
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
811
+
812
+        /**
813
+         * The Schema service.
814
+         */
815
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
816
+
817
+        /**
818
+         * The schema:url property service.
819
+         */
820
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
821
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
822
+
823
+        /**
824
+         * The UI service.
825
+         */
826
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
827
+
828
+        /**
829
+         * The Thumbnail service.
830
+         */
831
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
832
+
833
+        /**
834
+         * The Entity Types Taxonomy service.
835
+         */
836
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
837
+
838
+        /**
839
+         * The Entity service.
840
+         */
841
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
842
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
843
+
844
+        // Add the entity rating service.
845
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
846
+
847
+        /**
848
+         * The User service.
849
+         */
850
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
851
+
852
+        /**
853
+         * The Timeline service.
854
+         */
855
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
856
+
857
+        /**
858
+         * The Topic Taxonomy service.
859
+         */
860
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
861
+
862
+        /**
863
+         * The SPARQL service.
864
+         */
865
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
866
+
867
+        /**
868
+         * The WordLift import service.
869
+         */
870
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
871
+
872
+        /**
873
+         * The WordLift URI service.
874
+         */
875
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
876
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
877
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
878
+
879
+        /**
880
+         * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
881
+         */
882
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php';
883
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php';
884
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php';
885
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php';
886
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
887
+
888
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
889
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
890
+
891
+        /**
892
+         * Load the converters.
893
+         */
894
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
895
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
896
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
897
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
898
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
899
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
900
+
901
+        /**
902
+         * Load cache-related files.
903
+         */
904
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
905
+
906
+        /**
907
+         * Load the content filter.
908
+         */
909
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
910
+
911
+        /*
912 912
 		 * Load the excerpt helper.
913 913
 		 */
914
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
914
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
915
+
916
+        /**
917
+         * Load the JSON-LD service to publish entities using JSON-LD.s
918
+         *
919
+         * @since 3.8.0
920
+         */
921
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
922
+
923
+        // The Publisher Service and the AJAX adapter.
924
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
925
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
926
+
927
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
928
+
929
+        /**
930
+         * Load the WordLift key validation service.
931
+         */
932
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
933
+
934
+        // Load the `Wordlift_Category_Taxonomy_Service` class definition.
935
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
936
+
937
+        // Load the `Wordlift_Entity_Page_Service` class definition.
938
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
939
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php';
940
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php';
941
+
942
+        /** Linked Data. */
943
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
944
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
945
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
946
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
947
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
948
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
949
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
950
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
951
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
952
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
953
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
954
+
955
+        /** Linked Data Rendition. */
956
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
957
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
958
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
959
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
960
+
961
+        /** Services. */
962
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
963
+
964
+        /** Adapters. */
965
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
966
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
967
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
968
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
969
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php';
970
+
971
+        /** Async Tasks. */
972
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
973
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
974
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
975
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
976
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php';
977
+
978
+        /** Async Tasks. */
979
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php';
980
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
981
+
982
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
983
+
984
+        /**
985
+         * The class responsible for defining all actions that occur in the admin area.
986
+         */
987
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
988
+
989
+        /**
990
+         * The class to customize the entity list admin page.
991
+         */
992
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
993
+
994
+        /**
995
+         * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
996
+         */
997
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
998
+
999
+        /**
1000
+         * The Notice service.
1001
+         */
1002
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
1003
+
1004
+        /**
1005
+         * The PrimaShop adapter.
1006
+         */
1007
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
1008
+
1009
+        /**
1010
+         * The WordLift Dashboard service.
1011
+         */
1012
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
1013
+
1014
+        /**
1015
+         * The admin 'Install wizard' page.
1016
+         */
1017
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
1018
+
1019
+        /**
1020
+         * The WordLift entity type list admin page controller.
1021
+         */
1022
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1023
+
1024
+        /**
1025
+         * The WordLift entity type settings admin page controller.
1026
+         */
1027
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
1028
+
1029
+        /**
1030
+         * The admin 'Download Your Data' page.
1031
+         */
1032
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
1033
+
1034
+        /**
1035
+         * The admin 'WordLift Settings' page.
1036
+         */
1037
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
1038
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
1039
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
1040
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
1041
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
1042
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
1043
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
1044
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
1045
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
1046
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
1047
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php';
1048
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
1049
+
1050
+        /** Admin Pages */
1051
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1052
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
1053
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
1054
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
1055
+
1056
+        /**
1057
+         * The class responsible for defining all actions that occur in the public-facing
1058
+         * side of the site.
1059
+         */
1060
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1061
+
1062
+        /**
1063
+         * The shortcode abstract class.
1064
+         */
1065
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1066
+
1067
+        /**
1068
+         * The Timeline shortcode.
1069
+         */
1070
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1071
+
1072
+        /**
1073
+         * The Navigator shortcode.
1074
+         */
1075
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1076
+
1077
+        /**
1078
+         * The chord shortcode.
1079
+         */
1080
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1081
+
1082
+        /**
1083
+         * The geomap shortcode.
1084
+         */
1085
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1086
+
1087
+        /**
1088
+         * The entity cloud shortcode.
1089
+         */
1090
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1091
+
1092
+        /**
1093
+         * The entity glossary shortcode.
1094
+         */
1095
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1096
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1097
+
1098
+        /**
1099
+         * The ShareThis service.
1100
+         */
1101
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1102
+
1103
+        /**
1104
+         * The SEO service.
1105
+         */
1106
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1107
+
1108
+        /**
1109
+         * The AMP service.
1110
+         */
1111
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1112
+
1113
+        /** Widgets */
1114
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1115
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1116
+
1117
+        $this->loader = new Wordlift_Loader();
1118
+
1119
+        // Instantiate a global logger.
1120
+        global $wl_logger;
1121
+        $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1122
+
1123
+        // Load the `wl-api` end-point.
1124
+        new Wordlift_Http_Api();
1125
+
1126
+        // Load the Install Service.
1127
+        $this->install_service = new Wordlift_Install_Service();
1128
+
1129
+        /** Services. */
1130
+        // Create the configuration service.
1131
+        $this->configuration_service = new Wordlift_Configuration_Service();
1132
+
1133
+        // Create an entity type service instance. It'll be later bound to the init action.
1134
+        $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1135
+
1136
+        // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1137
+        $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1138
+
1139
+        // Create an instance of the UI service.
1140
+        $this->ui_service = new Wordlift_UI_Service();
1141
+
1142
+        // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
1143
+        $this->thumbnail_service = new Wordlift_Thumbnail_Service();
1144
+
1145
+        $this->sparql_service        = new Wordlift_Sparql_Service();
1146
+        $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1147
+        $this->notice_service        = new Wordlift_Notice_Service();
1148
+        $this->relation_service      = new Wordlift_Relation_Service();
915 1149
 
916
-		/**
917
-		 * Load the JSON-LD service to publish entities using JSON-LD.s
918
-		 *
919
-		 * @since 3.8.0
920
-		 */
921
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
1150
+        $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1151
+        $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' );
1152
+        $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1153
+        $this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1154
+        $this->user_service       = new Wordlift_User_Service( $this->sparql_service, $this->entity_service );
922 1155
 
923
-		// The Publisher Service and the AJAX adapter.
924
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
925
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
1156
+        // Instantiate the JSON-LD service.
1157
+        $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1158
+
1159
+        /** Linked Data. */
1160
+        $this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1161
+        $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1162
+
1163
+        $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
926 1164
 
927
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
1165
+        // Create a new instance of the Redirect service.
1166
+        $this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_service );
1167
+        $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1168
+        $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service );
928 1169
 
929
-		/**
930
-		 * Load the WordLift key validation service.
931
-		 */
932
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
933
-
934
-		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
935
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
936
-
937
-		// Load the `Wordlift_Entity_Page_Service` class definition.
938
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
939
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php';
940
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php';
941
-
942
-		/** Linked Data. */
943
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
944
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
945
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
946
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
947
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
948
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
949
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
950
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
951
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
952
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
953
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
954
-
955
-		/** Linked Data Rendition. */
956
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
957
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
958
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
959
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
960
-
961
-		/** Services. */
962
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
963
-
964
-		/** Adapters. */
965
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
966
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
967
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
968
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
969
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php';
970
-
971
-		/** Async Tasks. */
972
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
973
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
974
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
975
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
976
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php';
977
-
978
-		/** Async Tasks. */
979
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php';
980
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
981
-
982
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
983
-
984
-		/**
985
-		 * The class responsible for defining all actions that occur in the admin area.
986
-		 */
987
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
1170
+        // Create a new instance of the Timeline service and Timeline shortcode.
1171
+        $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1172
+
1173
+        $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service );
1174
+
1175
+        $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
988 1176
 
989
-		/**
990
-		 * The class to customize the entity list admin page.
991
-		 */
992
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
1177
+        $this->topic_taxonomy_service        = new Wordlift_Topic_Taxonomy_Service();
1178
+        $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service();
993 1179
 
994
-		/**
995
-		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
996
-		 */
997
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
1180
+        // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1181
+        $this->sharethis_service = new Wordlift_ShareThis_Service();
1182
+
1183
+        // Create an instance of the PrimaShop adapter.
1184
+        $this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
998 1185
 
999
-		/**
1000
-		 * The Notice service.
1001
-		 */
1002
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
1186
+        // Create an import service instance to hook later to WP's import function.
1187
+        $this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() );
1003 1188
 
1004
-		/**
1005
-		 * The PrimaShop adapter.
1006
-		 */
1007
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
1189
+        $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1008 1190
 
1009
-		/**
1010
-		 * The WordLift Dashboard service.
1011
-		 */
1012
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
1191
+        // Create the entity rating service.
1192
+        $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1013 1193
 
1014
-		/**
1015
-		 * The admin 'Install wizard' page.
1016
-		 */
1017
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
1194
+        // Create entity list customization (wp-admin/edit.php).
1195
+        $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1018 1196
 
1019
-		/**
1020
-		 * The WordLift entity type list admin page controller.
1021
-		 */
1022
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1197
+        // Create a new instance of the Redirect service.
1198
+        $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1023 1199
 
1024
-		/**
1025
-		 * The WordLift entity type settings admin page controller.
1026
-		 */
1027
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
1200
+        // Create an instance of the Publisher Service and the AJAX Adapter.
1201
+        $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service );
1202
+        $this->property_factory  = new Wordlift_Property_Factory( $schema_url_property_service );
1203
+        $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1028 1204
 
1029
-		/**
1030
-		 * The admin 'Download Your Data' page.
1031
-		 */
1032
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
1205
+        $attachment_service = new Wordlift_Attachment_Service();
1033 1206
 
1034
-		/**
1035
-		 * The admin 'WordLift Settings' page.
1036
-		 */
1037
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
1038
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
1039
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
1040
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
1041
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
1042
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
1043
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
1044
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
1045
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
1046
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
1047
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php';
1048
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
1049
-
1050
-		/** Admin Pages */
1051
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1052
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
1053
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
1054
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
1055
-
1056
-		/**
1057
-		 * The class responsible for defining all actions that occur in the public-facing
1058
-		 * side of the site.
1059
-		 */
1060
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1207
+        // Instantiate the JSON-LD service.
1208
+        $property_getter                         = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1209
+        $this->entity_post_to_jsonld_converter   = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter );
1210
+        $this->post_to_jsonld_converter          = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1211
+        $this->postid_to_jsonld_converter        = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter );
1212
+        $this->jsonld_website_converter          = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1213
+        $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service );
1214
+        $this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1061 1215
 
1062
-		/**
1063
-		 * The shortcode abstract class.
1064
-		 */
1065
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1066
-
1067
-		/**
1068
-		 * The Timeline shortcode.
1069
-		 */
1070
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1071
-
1072
-		/**
1073
-		 * The Navigator shortcode.
1074
-		 */
1075
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1076
-
1077
-		/**
1078
-		 * The chord shortcode.
1079
-		 */
1080
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1081
-
1082
-		/**
1083
-		 * The geomap shortcode.
1084
-		 */
1085
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1086
-
1087
-		/**
1088
-		 * The entity cloud shortcode.
1089
-		 */
1090
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1091
-
1092
-		/**
1093
-		 * The entity glossary shortcode.
1094
-		 */
1095
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1096
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1097
-
1098
-		/**
1099
-		 * The ShareThis service.
1100
-		 */
1101
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1102
-
1103
-		/**
1104
-		 * The SEO service.
1105
-		 */
1106
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1107
-
1108
-		/**
1109
-		 * The AMP service.
1110
-		 */
1111
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1112
-
1113
-		/** Widgets */
1114
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1115
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1116
-
1117
-		$this->loader = new Wordlift_Loader();
1118
-
1119
-		// Instantiate a global logger.
1120
-		global $wl_logger;
1121
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1122
-
1123
-		// Load the `wl-api` end-point.
1124
-		new Wordlift_Http_Api();
1125
-
1126
-		// Load the Install Service.
1127
-		$this->install_service = new Wordlift_Install_Service();
1128
-
1129
-		/** Services. */
1130
-		// Create the configuration service.
1131
-		$this->configuration_service = new Wordlift_Configuration_Service();
1132
-
1133
-		// Create an entity type service instance. It'll be later bound to the init action.
1134
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1135
-
1136
-		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1137
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1138
-
1139
-		// Create an instance of the UI service.
1140
-		$this->ui_service = new Wordlift_UI_Service();
1141
-
1142
-		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
1143
-		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
1144
-
1145
-		$this->sparql_service        = new Wordlift_Sparql_Service();
1146
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1147
-		$this->notice_service        = new Wordlift_Notice_Service();
1148
-		$this->relation_service      = new Wordlift_Relation_Service();
1149
-
1150
-		$entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1151
-		$this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' );
1152
-		$this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1153
-		$this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1154
-		$this->user_service       = new Wordlift_User_Service( $this->sparql_service, $this->entity_service );
1155
-
1156
-		// Instantiate the JSON-LD service.
1157
-		$property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1158
-
1159
-		/** Linked Data. */
1160
-		$this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1161
-		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1162
-
1163
-		$this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1164
-
1165
-		// Create a new instance of the Redirect service.
1166
-		$this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_service );
1167
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1168
-		$this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service );
1169
-
1170
-		// Create a new instance of the Timeline service and Timeline shortcode.
1171
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1172
-
1173
-		$this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service );
1174
-
1175
-		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1176
-
1177
-		$this->topic_taxonomy_service        = new Wordlift_Topic_Taxonomy_Service();
1178
-		$this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service();
1179
-
1180
-		// Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1181
-		$this->sharethis_service = new Wordlift_ShareThis_Service();
1182
-
1183
-		// Create an instance of the PrimaShop adapter.
1184
-		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1185
-
1186
-		// Create an import service instance to hook later to WP's import function.
1187
-		$this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() );
1188
-
1189
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1190
-
1191
-		// Create the entity rating service.
1192
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1193
-
1194
-		// Create entity list customization (wp-admin/edit.php).
1195
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1196
-
1197
-		// Create a new instance of the Redirect service.
1198
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1199
-
1200
-		// Create an instance of the Publisher Service and the AJAX Adapter.
1201
-		$this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service );
1202
-		$this->property_factory  = new Wordlift_Property_Factory( $schema_url_property_service );
1203
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1204
-
1205
-		$attachment_service = new Wordlift_Attachment_Service();
1206
-
1207
-		// Instantiate the JSON-LD service.
1208
-		$property_getter                         = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1209
-		$this->entity_post_to_jsonld_converter   = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter );
1210
-		$this->post_to_jsonld_converter          = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1211
-		$this->postid_to_jsonld_converter        = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter );
1212
-		$this->jsonld_website_converter          = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1213
-		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service );
1214
-		$this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1215
-
1216
-
1217
-		$this->key_validation_service    = new Wordlift_Key_Validation_Service( $this->configuration_service );
1218
-		$this->content_filter_service    = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1219
-		$this->relation_rebuild_service  = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1220
-		$this->sample_data_service       = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1221
-		$this->sample_data_ajax_adapter  = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1222
-		$this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service );
1223
-
1224
-		// Initialize the shortcodes.
1225
-		new Wordlift_Navigator_Shortcode();
1226
-		new Wordlift_Chord_Shortcode();
1227
-		new Wordlift_Geomap_Shortcode();
1228
-		new Wordlift_Timeline_Shortcode();
1229
-		new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1230
-		new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1231
-
1232
-		// Initialize the SEO service.
1233
-		new Wordlift_Seo_Service();
1234
-
1235
-		// Initialize the AMP service.
1236
-		new Wordlift_AMP_Service( $this->jsonld_service );
1237
-
1238
-		/** Services. */
1239
-		$this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1240
-
1241
-		/** Adapters. */
1242
-		$this->entity_type_adapter      = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1243
-		$this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service );
1244
-		$this->tinymce_adapter          = new Wordlift_Tinymce_Adapter( $this );
1245
-		$this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service );
1246
-		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1247
-
1248
-		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
1249
-		$this->rebuild_service = new Wordlift_Rebuild_Service(
1250
-			$this->sparql_service,
1251
-			$uri_service
1252
-		);
1253
-
1254
-		/** Async Tasks. */
1255
-		new Wordlift_Sparql_Query_Async_Task();
1256
-		new Wordlift_Batch_Analysis_Request_Async_Task();
1257
-		new Wordlift_Batch_Analysis_Complete_Async_Task();
1258
-		new Wordlift_Batch_Analysis_Complete_Async_Task();
1259
-		new Wordlift_Push_References_Async_Task();
1260
-
1261
-		/** WL Autocomplete. */
1262
-		$this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service );
1263
-		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service );
1264
-
1265
-		/** WordPress Admin UI. */
1266
-
1267
-		// UI elements.
1268
-		$this->input_element           = new Wordlift_Admin_Input_Element();
1269
-		$this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1270
-		$this->select2_element         = new Wordlift_Admin_Select2_Element();
1271
-		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1272
-		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
1273
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element );
1274
-		$this->author_element          = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element );
1275
-
1276
-		$this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element );
1277
-		$this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service );
1278
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1279
-
1280
-		// Pages.
1281
-		new Wordlift_Admin_Post_Edit_Page( $this );
1282
-		new Wordlift_Entity_Type_Admin_Service();
1283
-
1284
-		// create an instance of the entity type list admin page controller.
1285
-		$this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1286
-
1287
-		// create an instance of the entity type etting admin page controller.
1288
-		$this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1289
-
1290
-		/** Widgets */
1291
-		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1292
-
1293
-		/* WordPress Admin. */
1294
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1295
-		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1296
-
1297
-		// Create an instance of the install wizard.
1298
-		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1299
-
1300
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1301
-
1302
-		// User Profile.
1303
-		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1304
-
1305
-		$this->entity_page_service = new Wordlift_Entity_Page_Service();
1306
-
1307
-		// Load the debug service if WP is in debug mode.
1308
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1309
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1310
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1311
-		}
1312
-
1313
-		// Remote Image Service.
1314
-		new Wordlift_Remote_Image_Service();
1315
-	}
1316
-
1317
-	/**
1318
-	 * Define the locale for this plugin for internationalization.
1319
-	 *
1320
-	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1321
-	 * with WordPress.
1322
-	 *
1323
-	 * @since    1.0.0
1324
-	 * @access   private
1325
-	 */
1326
-	private function set_locale() {
1327
-
1328
-		$plugin_i18n = new Wordlift_i18n();
1329
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1330
-
1331
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1332
-
1333
-	}
1334
-
1335
-	/**
1336
-	 * Register all of the hooks related to the admin area functionality
1337
-	 * of the plugin.
1338
-	 *
1339
-	 * @since    1.0.0
1340
-	 * @access   private
1341
-	 */
1342
-	private function define_admin_hooks() {
1343
-
1344
-		$plugin_admin = new Wordlift_Admin(
1345
-			$this->get_plugin_name(),
1346
-			$this->get_version(),
1347
-			$this->configuration_service,
1348
-			$this->notice_service,
1349
-			$this->user_service
1350
-		);
1351
-
1352
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1353
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1354
-
1355
-		// Hook the init action to taxonomy services.
1356
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1357
-		$this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 );
1358
-
1359
-		// Hook the deleted_post_meta action to the Thumbnail service.
1360
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1361
-
1362
-		// Hook the added_post_meta action to the Thumbnail service.
1363
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1364
-
1365
-		// Hook the updated_post_meta action to the Thumbnail service.
1366
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1367
-
1368
-		// Hook the AJAX wl_timeline action to the Timeline service.
1369
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1370
-
1371
-		// Register custom allowed redirect hosts.
1372
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1373
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1374
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1375
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1376
-		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1377
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1378
-		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1379
-
1380
-		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1381
-		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1382
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1383
-		$this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1384
-
1385
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1386
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1387
-
1388
-		// Entity listing customization (wp-admin/edit.php)
1389
-		// Add custom columns.
1390
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1391
-		// no explicit entity as it prevents handling of other post types.
1392
-		$this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1393
-		// Add 4W selection.
1394
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1395
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1396
-		$this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1397
-		$this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1398
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1399
-
1400
-		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1401
-		// entities.
1402
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1403
-
1404
-		// Filter imported post meta.
1405
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1406
-
1407
-		// Notify the import service when an import starts and ends.
1408
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1409
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1410
-
1411
-		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1412
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1413
-		$this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' );
1414
-
1415
-		// Hook the menu to the Download Your Data page.
1416
-		$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1417
-		$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1418
-		$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1419
-
1420
-		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1421
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1422
-
1423
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1424
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1425
-		$this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' );
1426
-		$this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1427
-
1428
-		// Hook the AJAX wl_validate_key action to the Key Validation service.
1429
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1430
-
1431
-		// Hook the `admin_init` function to the Admin Setup.
1432
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1433
-
1434
-		// Hook the admin_init to the settings page.
1435
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1436
-
1437
-		$this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' );
1438
-
1439
-		// Hook the menu creation on the general wordlift menu creation.
1440
-		$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1441
-		if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) {
1442
-			// Add the functionality only if a flag is set in wp-config.php .
1443
-			$this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 );
1444
-		}
1445
-
1446
-		// Hook key update.
1447
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1448
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1449
-
1450
-		// Add additional action links to the WordLift plugin in the plugins page.
1451
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1452
-
1453
-		// Hook the AJAX `wl_publisher` action name.
1454
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1455
-
1456
-		// Hook row actions for the entity type list admin.
1457
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1458
-
1459
-		/** Ajax actions. */
1460
-		$this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1461
-
1462
-		// Hook capabilities manipulation to allow access to entity type admin
1463
-		// page  on WordPress versions before 4.7.
1464
-		global $wp_version;
1465
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1466
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1467
-		}
1468
-
1469
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1470
-
1471
-		/** Adapters. */
1472
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1473
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' );
1474
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' );
1475
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' );
1476
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' );
1477
-		$this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1478
-
1479
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1480
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1481
-
1482
-
1483
-		$this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 );
1484
-		$this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 );
1485
-
1486
-		// Handle the autocomplete request.
1487
-		add_action( 'wp_ajax_wl_autocomplete', array(
1488
-			$this->autocomplete_adapter,
1489
-			'wl_autocomplete',
1490
-		) );
1491
-		add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1492
-			$this->autocomplete_adapter,
1493
-			'wl_autocomplete',
1494
-		) );
1495
-
1496
-		// Hooks to restrict multisite super admin from manipulating entity types.
1497
-		if ( is_multisite() ) {
1498
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1499
-		}
1500
-
1501
-		$deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service );
1502
-
1503
-		add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) );
1504
-		add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) );
1505
-		add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) );
1506
-	}
1507
-
1508
-	/**
1509
-	 * Register all of the hooks related to the public-facing functionality
1510
-	 * of the plugin.
1511
-	 *
1512
-	 * @since    1.0.0
1513
-	 * @access   private
1514
-	 */
1515
-	private function define_public_hooks() {
1516
-
1517
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1518
-
1519
-		// Register the entity post type.
1520
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1521
-		$this->loader->add_action( 'init', $this->install_service, 'install' );
1522
-
1523
-		// Bind the link generation and handling hooks to the entity link service.
1524
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1525
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1526
-		$this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 );
1527
-		$this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 );
1528
-
1529
-		/**
1530
-		 * Disable the `enqueue_styles` call since we don't have styles to load.
1531
-		 *
1532
-		 * @see https://github.com/insideout10/wordlift-plugin/issues/821 related issue.
1533
-		 * @since 3.19.2
1534
-		 */
1535
-		// $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1536 1216
 
1537
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1217
+        $this->key_validation_service    = new Wordlift_Key_Validation_Service( $this->configuration_service );
1218
+        $this->content_filter_service    = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1219
+        $this->relation_rebuild_service  = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1220
+        $this->sample_data_service       = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1221
+        $this->sample_data_ajax_adapter  = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1222
+        $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service );
1538 1223
 
1539
-		// Hook the content filter service to add entity links.
1540
-		if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1541
-			$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1542
-		}
1224
+        // Initialize the shortcodes.
1225
+        new Wordlift_Navigator_Shortcode();
1226
+        new Wordlift_Chord_Shortcode();
1227
+        new Wordlift_Geomap_Shortcode();
1228
+        new Wordlift_Timeline_Shortcode();
1229
+        new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1230
+        new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1543 1231
 
1544
-		// Hook the AJAX wl_timeline action to the Timeline service.
1545
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1232
+        // Initialize the SEO service.
1233
+        new Wordlift_Seo_Service();
1546 1234
 
1547
-		// Hook the ShareThis service.
1548
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1549
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1235
+        // Initialize the AMP service.
1236
+        new Wordlift_AMP_Service( $this->jsonld_service );
1550 1237
 
1551
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1552
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1238
+        /** Services. */
1239
+        $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1553 1240
 
1554
-		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1555
-		// in order to tweak WP's `WP_Query` to include entities in queries related
1556
-		// to categories.
1557
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1241
+        /** Adapters. */
1242
+        $this->entity_type_adapter      = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1243
+        $this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service );
1244
+        $this->tinymce_adapter          = new Wordlift_Tinymce_Adapter( $this );
1245
+        $this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service );
1246
+        $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1247
+
1248
+        // Create a Rebuild Service instance, which we'll later bound to an ajax call.
1249
+        $this->rebuild_service = new Wordlift_Rebuild_Service(
1250
+            $this->sparql_service,
1251
+            $uri_service
1252
+        );
1253
+
1254
+        /** Async Tasks. */
1255
+        new Wordlift_Sparql_Query_Async_Task();
1256
+        new Wordlift_Batch_Analysis_Request_Async_Task();
1257
+        new Wordlift_Batch_Analysis_Complete_Async_Task();
1258
+        new Wordlift_Batch_Analysis_Complete_Async_Task();
1259
+        new Wordlift_Push_References_Async_Task();
1260
+
1261
+        /** WL Autocomplete. */
1262
+        $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service );
1263
+        $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service );
1558 1264
 
1559
-		/*
1265
+        /** WordPress Admin UI. */
1266
+
1267
+        // UI elements.
1268
+        $this->input_element           = new Wordlift_Admin_Input_Element();
1269
+        $this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1270
+        $this->select2_element         = new Wordlift_Admin_Select2_Element();
1271
+        $this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1272
+        $tabs_element                  = new Wordlift_Admin_Tabs_Element();
1273
+        $this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element );
1274
+        $this->author_element          = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element );
1275
+
1276
+        $this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element );
1277
+        $this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service );
1278
+        $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1279
+
1280
+        // Pages.
1281
+        new Wordlift_Admin_Post_Edit_Page( $this );
1282
+        new Wordlift_Entity_Type_Admin_Service();
1283
+
1284
+        // create an instance of the entity type list admin page controller.
1285
+        $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1286
+
1287
+        // create an instance of the entity type etting admin page controller.
1288
+        $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1289
+
1290
+        /** Widgets */
1291
+        $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1292
+
1293
+        /* WordPress Admin. */
1294
+        $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1295
+        $this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1296
+
1297
+        // Create an instance of the install wizard.
1298
+        $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1299
+
1300
+        $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1301
+
1302
+        // User Profile.
1303
+        new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1304
+
1305
+        $this->entity_page_service = new Wordlift_Entity_Page_Service();
1306
+
1307
+        // Load the debug service if WP is in debug mode.
1308
+        if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1309
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1310
+            new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1311
+        }
1312
+
1313
+        // Remote Image Service.
1314
+        new Wordlift_Remote_Image_Service();
1315
+    }
1316
+
1317
+    /**
1318
+     * Define the locale for this plugin for internationalization.
1319
+     *
1320
+     * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1321
+     * with WordPress.
1322
+     *
1323
+     * @since    1.0.0
1324
+     * @access   private
1325
+     */
1326
+    private function set_locale() {
1327
+
1328
+        $plugin_i18n = new Wordlift_i18n();
1329
+        $plugin_i18n->set_domain( $this->get_plugin_name() );
1330
+
1331
+        $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1332
+
1333
+    }
1334
+
1335
+    /**
1336
+     * Register all of the hooks related to the admin area functionality
1337
+     * of the plugin.
1338
+     *
1339
+     * @since    1.0.0
1340
+     * @access   private
1341
+     */
1342
+    private function define_admin_hooks() {
1343
+
1344
+        $plugin_admin = new Wordlift_Admin(
1345
+            $this->get_plugin_name(),
1346
+            $this->get_version(),
1347
+            $this->configuration_service,
1348
+            $this->notice_service,
1349
+            $this->user_service
1350
+        );
1351
+
1352
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1353
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1354
+
1355
+        // Hook the init action to taxonomy services.
1356
+        $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1357
+        $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 );
1358
+
1359
+        // Hook the deleted_post_meta action to the Thumbnail service.
1360
+        $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1361
+
1362
+        // Hook the added_post_meta action to the Thumbnail service.
1363
+        $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1364
+
1365
+        // Hook the updated_post_meta action to the Thumbnail service.
1366
+        $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1367
+
1368
+        // Hook the AJAX wl_timeline action to the Timeline service.
1369
+        $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1370
+
1371
+        // Register custom allowed redirect hosts.
1372
+        $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1373
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1374
+        $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1375
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1376
+        $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1377
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1378
+        $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1379
+
1380
+        // Hook save_post to the entity service to update custom fields (such as alternate labels).
1381
+        // We have a priority of 9 because we want to be executed before data is sent to Redlink.
1382
+        $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1383
+        $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1384
+
1385
+        $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1386
+        $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1387
+
1388
+        // Entity listing customization (wp-admin/edit.php)
1389
+        // Add custom columns.
1390
+        $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1391
+        // no explicit entity as it prevents handling of other post types.
1392
+        $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1393
+        // Add 4W selection.
1394
+        $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1395
+        $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1396
+        $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1397
+        $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1398
+        $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1399
+
1400
+        // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1401
+        // entities.
1402
+        $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1403
+
1404
+        // Filter imported post meta.
1405
+        $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1406
+
1407
+        // Notify the import service when an import starts and ends.
1408
+        $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1409
+        $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1410
+
1411
+        // Hook the AJAX wl_rebuild action to the Rebuild Service.
1412
+        $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1413
+        $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' );
1414
+
1415
+        // Hook the menu to the Download Your Data page.
1416
+        $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1417
+        $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1418
+        $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1419
+
1420
+        // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1421
+        $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1422
+
1423
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1424
+        $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1425
+        $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' );
1426
+        $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1427
+
1428
+        // Hook the AJAX wl_validate_key action to the Key Validation service.
1429
+        $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1430
+
1431
+        // Hook the `admin_init` function to the Admin Setup.
1432
+        $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1433
+
1434
+        // Hook the admin_init to the settings page.
1435
+        $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1436
+
1437
+        $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' );
1438
+
1439
+        // Hook the menu creation on the general wordlift menu creation.
1440
+        $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1441
+        if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) {
1442
+            // Add the functionality only if a flag is set in wp-config.php .
1443
+            $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 );
1444
+        }
1445
+
1446
+        // Hook key update.
1447
+        $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1448
+        $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1449
+
1450
+        // Add additional action links to the WordLift plugin in the plugins page.
1451
+        $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1452
+
1453
+        // Hook the AJAX `wl_publisher` action name.
1454
+        $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1455
+
1456
+        // Hook row actions for the entity type list admin.
1457
+        $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1458
+
1459
+        /** Ajax actions. */
1460
+        $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1461
+
1462
+        // Hook capabilities manipulation to allow access to entity type admin
1463
+        // page  on WordPress versions before 4.7.
1464
+        global $wp_version;
1465
+        if ( version_compare( $wp_version, '4.7', '<' ) ) {
1466
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1467
+        }
1468
+
1469
+        $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1470
+
1471
+        /** Adapters. */
1472
+        $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1473
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' );
1474
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' );
1475
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' );
1476
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' );
1477
+        $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1478
+
1479
+        $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1480
+        $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1481
+
1482
+
1483
+        $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 );
1484
+        $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 );
1485
+
1486
+        // Handle the autocomplete request.
1487
+        add_action( 'wp_ajax_wl_autocomplete', array(
1488
+            $this->autocomplete_adapter,
1489
+            'wl_autocomplete',
1490
+        ) );
1491
+        add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1492
+            $this->autocomplete_adapter,
1493
+            'wl_autocomplete',
1494
+        ) );
1495
+
1496
+        // Hooks to restrict multisite super admin from manipulating entity types.
1497
+        if ( is_multisite() ) {
1498
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1499
+        }
1500
+
1501
+        $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service );
1502
+
1503
+        add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) );
1504
+        add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) );
1505
+        add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) );
1506
+    }
1507
+
1508
+    /**
1509
+     * Register all of the hooks related to the public-facing functionality
1510
+     * of the plugin.
1511
+     *
1512
+     * @since    1.0.0
1513
+     * @access   private
1514
+     */
1515
+    private function define_public_hooks() {
1516
+
1517
+        $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1518
+
1519
+        // Register the entity post type.
1520
+        $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1521
+        $this->loader->add_action( 'init', $this->install_service, 'install' );
1522
+
1523
+        // Bind the link generation and handling hooks to the entity link service.
1524
+        $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1525
+        $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1526
+        $this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 );
1527
+        $this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 );
1528
+
1529
+        /**
1530
+         * Disable the `enqueue_styles` call since we don't have styles to load.
1531
+         *
1532
+         * @see https://github.com/insideout10/wordlift-plugin/issues/821 related issue.
1533
+         * @since 3.19.2
1534
+         */
1535
+        // $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1536
+
1537
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1538
+
1539
+        // Hook the content filter service to add entity links.
1540
+        if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1541
+            $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1542
+        }
1543
+
1544
+        // Hook the AJAX wl_timeline action to the Timeline service.
1545
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1546
+
1547
+        // Hook the ShareThis service.
1548
+        $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1549
+        $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1550
+
1551
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1552
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1553
+
1554
+        // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1555
+        // in order to tweak WP's `WP_Query` to include entities in queries related
1556
+        // to categories.
1557
+        $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1558
+
1559
+        /*
1560 1560
 		 * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service`
1561 1561
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1562 1562
 		 * order of start time.
1563 1563
 		 */
1564
-		$this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1565
-
1566
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1567
-
1568
-		// This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1569
-		$this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1570
-
1571
-	}
1572
-
1573
-	/**
1574
-	 * Run the loader to execute all of the hooks with WordPress.
1575
-	 *
1576
-	 * @since    1.0.0
1577
-	 */
1578
-	public function run() {
1579
-		$this->loader->run();
1580
-	}
1581
-
1582
-	/**
1583
-	 * The name of the plugin used to uniquely identify it within the context of
1584
-	 * WordPress and to define internationalization functionality.
1585
-	 *
1586
-	 * @since     1.0.0
1587
-	 * @return    string    The name of the plugin.
1588
-	 */
1589
-	public function get_plugin_name() {
1590
-		return $this->plugin_name;
1591
-	}
1592
-
1593
-	/**
1594
-	 * The reference to the class that orchestrates the hooks with the plugin.
1595
-	 *
1596
-	 * @since     1.0.0
1597
-	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1598
-	 */
1599
-	public function get_loader() {
1600
-		return $this->loader;
1601
-	}
1602
-
1603
-	/**
1604
-	 * Retrieve the version number of the plugin.
1605
-	 *
1606
-	 * @since     1.0.0
1607
-	 * @return    string    The version number of the plugin.
1608
-	 */
1609
-	public function get_version() {
1610
-		return $this->version;
1611
-	}
1612
-
1613
-	/**
1614
-	 * Load dependencies for WP-CLI.
1615
-	 *
1616
-	 * @since 3.18.0
1617
-	 * @throws Exception
1618
-	 */
1619
-	private function load_cli_dependencies() {
1620
-
1621
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php';
1622
-
1623
-		$push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service );
1624
-
1625
-		WP_CLI::add_command( 'wl references push', $push_reference_data_command );
1626
-
1627
-	}
1564
+        $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1565
+
1566
+        $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1567
+
1568
+        // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1569
+        $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1570
+
1571
+    }
1572
+
1573
+    /**
1574
+     * Run the loader to execute all of the hooks with WordPress.
1575
+     *
1576
+     * @since    1.0.0
1577
+     */
1578
+    public function run() {
1579
+        $this->loader->run();
1580
+    }
1581
+
1582
+    /**
1583
+     * The name of the plugin used to uniquely identify it within the context of
1584
+     * WordPress and to define internationalization functionality.
1585
+     *
1586
+     * @since     1.0.0
1587
+     * @return    string    The name of the plugin.
1588
+     */
1589
+    public function get_plugin_name() {
1590
+        return $this->plugin_name;
1591
+    }
1592
+
1593
+    /**
1594
+     * The reference to the class that orchestrates the hooks with the plugin.
1595
+     *
1596
+     * @since     1.0.0
1597
+     * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1598
+     */
1599
+    public function get_loader() {
1600
+        return $this->loader;
1601
+    }
1602
+
1603
+    /**
1604
+     * Retrieve the version number of the plugin.
1605
+     *
1606
+     * @since     1.0.0
1607
+     * @return    string    The version number of the plugin.
1608
+     */
1609
+    public function get_version() {
1610
+        return $this->version;
1611
+    }
1612
+
1613
+    /**
1614
+     * Load dependencies for WP-CLI.
1615
+     *
1616
+     * @since 3.18.0
1617
+     * @throws Exception
1618
+     */
1619
+    private function load_cli_dependencies() {
1620
+
1621
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php';
1622
+
1623
+        $push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service );
1624
+
1625
+        WP_CLI::add_command( 'wl references push', $push_reference_data_command );
1626
+
1627
+    }
1628 1628
 
1629 1629
 }
Please login to merge, or discard this patch.
Spacing   +296 added lines, -296 removed lines patch added patch discarded remove patch
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 		$this->define_public_hooks();
720 720
 
721 721
 		// If we're in `WP_CLI` load the related files.
722
-		if ( class_exists( 'WP_CLI' ) ) {
722
+		if (class_exists('WP_CLI')) {
723 723
 			$this->load_cli_dependencies();
724 724
 		}
725 725
 
@@ -761,364 +761,364 @@  discard block
 block discarded – undo
761 761
 		 * The class responsible for orchestrating the actions and filters of the
762 762
 		 * core plugin.
763 763
 		 */
764
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
764
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php';
765 765
 
766 766
 		// The class responsible for plugin uninstall.
767
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php';
767
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-deactivator-feedback.php';
768 768
 
769 769
 		/**
770 770
 		 * The class responsible for defining internationalization functionality
771 771
 		 * of the plugin.
772 772
 		 */
773
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
773
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php';
774 774
 
775 775
 		/**
776 776
 		 * WordLift's supported languages.
777 777
 		 */
778
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
778
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-languages.php';
779 779
 
780 780
 		/**
781 781
 		 * Provide support functions to sanitize data.
782 782
 		 */
783
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
783
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php';
784 784
 
785 785
 		/** Installs. */
786
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install.php';
787
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php';
788
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-1-0-0.php';
789
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-10-0.php';
790
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-12-0.php';
791
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-14-0.php';
792
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-15-0.php';
793
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-0.php';
794
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-3.php';
786
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install.php';
787
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-service.php';
788
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-1-0-0.php';
789
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-10-0.php';
790
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-12-0.php';
791
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-14-0.php';
792
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-15-0.php';
793
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-18-0.php';
794
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-18-3.php';
795 795
 
796 796
 		/** Services. */
797
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
798
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
799
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
800
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
801
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
802
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
803
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
804
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
805
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
797
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php';
798
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-http-api.php';
799
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php';
800
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php';
801
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-type-service.php';
802
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php';
803
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php';
804
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-linked-data-service.php';
805
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-service.php';
806 806
 
807 807
 		/**
808 808
 		 * The Query builder.
809 809
 		 */
810
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
810
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php';
811 811
 
812 812
 		/**
813 813
 		 * The Schema service.
814 814
 		 */
815
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
815
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php';
816 816
 
817 817
 		/**
818 818
 		 * The schema:url property service.
819 819
 		 */
820
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
821
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
820
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php';
821
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php';
822 822
 
823 823
 		/**
824 824
 		 * The UI service.
825 825
 		 */
826
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
826
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php';
827 827
 
828 828
 		/**
829 829
 		 * The Thumbnail service.
830 830
 		 */
831
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
831
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php';
832 832
 
833 833
 		/**
834 834
 		 * The Entity Types Taxonomy service.
835 835
 		 */
836
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php';
836
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-taxonomy-service.php';
837 837
 
838 838
 		/**
839 839
 		 * The Entity service.
840 840
 		 */
841
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php';
842
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
841
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-uri-service.php';
842
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php';
843 843
 
844 844
 		// Add the entity rating service.
845
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
845
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rating-service.php';
846 846
 
847 847
 		/**
848 848
 		 * The User service.
849 849
 		 */
850
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
850
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php';
851 851
 
852 852
 		/**
853 853
 		 * The Timeline service.
854 854
 		 */
855
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
855
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php';
856 856
 
857 857
 		/**
858 858
 		 * The Topic Taxonomy service.
859 859
 		 */
860
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
860
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php';
861 861
 
862 862
 		/**
863 863
 		 * The SPARQL service.
864 864
 		 */
865
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
865
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sparql-service.php';
866 866
 
867 867
 		/**
868 868
 		 * The WordLift import service.
869 869
 		 */
870
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
870
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-import-service.php';
871 871
 
872 872
 		/**
873 873
 		 * The WordLift URI service.
874 874
 		 */
875
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
876
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
877
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
875
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php';
876
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-factory.php';
877
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-service.php';
878 878
 
879 879
 		/**
880 880
 		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
881 881
 		 */
882
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php';
883
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php';
884
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php';
885
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php';
886
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
882
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-listable.php';
883
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-rebuild-service.php';
884
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-reference-rebuild-service.php';
885
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-service.php';
886
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-adapter.php';
887 887
 
888
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
889
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
888
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/properties/class-wordlift-property-getter-factory.php';
889
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-attachment-service.php';
890 890
 
891 891
 		/**
892 892
 		 * Load the converters.
893 893
 		 */
894
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
895
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
896
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
897
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
898
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
899
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
894
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/intf-wordlift-post-converter.php';
895
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
896
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-postid-to-jsonld-converter.php';
897
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-to-jsonld-converter.php';
898
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-to-jsonld-converter.php';
899
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-website-converter.php';
900 900
 
901 901
 		/**
902 902
 		 * Load cache-related files.
903 903
 		 */
904
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
904
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/cache/require.php';
905 905
 
906 906
 		/**
907 907
 		 * Load the content filter.
908 908
 		 */
909
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
909
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-content-filter-service.php';
910 910
 
911 911
 		/*
912 912
 		 * Load the excerpt helper.
913 913
 		 */
914
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
914
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-excerpt-helper.php';
915 915
 
916 916
 		/**
917 917
 		 * Load the JSON-LD service to publish entities using JSON-LD.s
918 918
 		 *
919 919
 		 * @since 3.8.0
920 920
 		 */
921
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
921
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-service.php';
922 922
 
923 923
 		// The Publisher Service and the AJAX adapter.
924
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
925
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
924
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-service.php';
925
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-ajax-adapter.php';
926 926
 
927
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
927
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-adapter.php';
928 928
 
929 929
 		/**
930 930
 		 * Load the WordLift key validation service.
931 931
 		 */
932
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
932
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php';
933 933
 
934 934
 		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
935
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
935
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php';
936 936
 
937 937
 		// Load the `Wordlift_Entity_Page_Service` class definition.
938
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
939
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php';
940
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php';
938
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-page-service.php';
939
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php';
940
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-service.php';
941 941
 
942 942
 		/** Linked Data. */
943
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
944
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
945
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
946
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
947
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
948
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
949
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
950
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
951
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
952
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
953
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
943
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage.php';
944
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
945
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-property-storage.php';
946
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
947
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
948
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-author-storage.php';
949
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
950
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-image-storage.php';
951
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-related-storage.php';
952
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-url-property-storage.php';
953
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage-factory.php';
954 954
 
955 955
 		/** Linked Data Rendition. */
956
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
957
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
958
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
959
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
956
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php';
957
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php';
958
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php';
959
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
960 960
 
961 961
 		/** Services. */
962
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
962
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-google-analytics-export-service.php';
963 963
 
964 964
 		/** Adapters. */
965
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
966
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
967
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
968
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
969
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php';
965
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php';
966
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-newrelic-adapter.php';
967
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-ajax-adapter.php';
968
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-adapter.php';
969
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php';
970 970
 
971 971
 		/** Async Tasks. */
972
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
973
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
974
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
975
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
976
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php';
972
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-async-task.php';
973
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
974
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
975
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
976
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-push-references-async-task.php';
977 977
 
978 978
 		/** Async Tasks. */
979
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php';
980
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
979
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-service.php';
980
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-adapter.php';
981 981
 
982
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php';
982
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-remote-image-service.php';
983 983
 
984 984
 		/**
985 985
 		 * The class responsible for defining all actions that occur in the admin area.
986 986
 		 */
987
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
987
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php';
988 988
 
989 989
 		/**
990 990
 		 * The class to customize the entity list admin page.
991 991
 		 */
992
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
992
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php';
993 993
 
994 994
 		/**
995 995
 		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
996 996
 		 */
997
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
997
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php';
998 998
 
999 999
 		/**
1000 1000
 		 * The Notice service.
1001 1001
 		 */
1002
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
1002
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php';
1003 1003
 
1004 1004
 		/**
1005 1005
 		 * The PrimaShop adapter.
1006 1006
 		 */
1007
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
1007
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php';
1008 1008
 
1009 1009
 		/**
1010 1010
 		 * The WordLift Dashboard service.
1011 1011
 		 */
1012
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
1012
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php';
1013 1013
 
1014 1014
 		/**
1015 1015
 		 * The admin 'Install wizard' page.
1016 1016
 		 */
1017
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
1017
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php';
1018 1018
 
1019 1019
 		/**
1020 1020
 		 * The WordLift entity type list admin page controller.
1021 1021
 		 */
1022
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1022
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
1023 1023
 
1024 1024
 		/**
1025 1025
 		 * The WordLift entity type settings admin page controller.
1026 1026
 		 */
1027
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
1027
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php';
1028 1028
 
1029 1029
 		/**
1030 1030
 		 * The admin 'Download Your Data' page.
1031 1031
 		 */
1032
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
1032
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php';
1033 1033
 
1034 1034
 		/**
1035 1035
 		 * The admin 'WordLift Settings' page.
1036 1036
 		 */
1037
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
1038
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
1039
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
1040
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
1041
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
1042
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
1043
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
1044
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
1045
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
1046
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
1047
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php';
1048
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
1037
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/intf-wordlift-admin-element.php';
1038
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-input-element.php';
1039
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-input-radio-element.php';
1040
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-select2-element.php';
1041
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-language-select-element.php';
1042
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-tabs-element.php';
1043
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-author-element.php';
1044
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-publisher-element.php';
1045
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php';
1046
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php';
1047
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-batch-analysis-page.php';
1048
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php';
1049 1049
 
1050 1050
 		/** Admin Pages */
1051
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
1052
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
1053
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
1054
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
1051
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php';
1052
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-user-profile-page.php';
1053
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-status-page.php';
1054
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-admin-service.php';
1055 1055
 
1056 1056
 		/**
1057 1057
 		 * The class responsible for defining all actions that occur in the public-facing
1058 1058
 		 * side of the site.
1059 1059
 		 */
1060
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
1060
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php';
1061 1061
 
1062 1062
 		/**
1063 1063
 		 * The shortcode abstract class.
1064 1064
 		 */
1065
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
1065
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php';
1066 1066
 
1067 1067
 		/**
1068 1068
 		 * The Timeline shortcode.
1069 1069
 		 */
1070
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
1070
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php';
1071 1071
 
1072 1072
 		/**
1073 1073
 		 * The Navigator shortcode.
1074 1074
 		 */
1075
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1075
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php';
1076 1076
 
1077 1077
 		/**
1078 1078
 		 * The chord shortcode.
1079 1079
 		 */
1080
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1080
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php';
1081 1081
 
1082 1082
 		/**
1083 1083
 		 * The geomap shortcode.
1084 1084
 		 */
1085
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1085
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php';
1086 1086
 
1087 1087
 		/**
1088 1088
 		 * The entity cloud shortcode.
1089 1089
 		 */
1090
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1090
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php';
1091 1091
 
1092 1092
 		/**
1093 1093
 		 * The entity glossary shortcode.
1094 1094
 		 */
1095
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1096
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1095
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-alphabet-service.php';
1096
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-vocabulary-shortcode.php';
1097 1097
 
1098 1098
 		/**
1099 1099
 		 * The ShareThis service.
1100 1100
 		 */
1101
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1101
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php';
1102 1102
 
1103 1103
 		/**
1104 1104
 		 * The SEO service.
1105 1105
 		 */
1106
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1106
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php';
1107 1107
 
1108 1108
 		/**
1109 1109
 		 * The AMP service.
1110 1110
 		 */
1111
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1111
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-amp-service.php';
1112 1112
 
1113 1113
 		/** Widgets */
1114
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1115
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1114
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php';
1115
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php';
1116 1116
 
1117 1117
 		$this->loader = new Wordlift_Loader();
1118 1118
 
1119 1119
 		// Instantiate a global logger.
1120 1120
 		global $wl_logger;
1121
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1121
+		$wl_logger = Wordlift_Log_Service::get_logger('WordLift');
1122 1122
 
1123 1123
 		// Load the `wl-api` end-point.
1124 1124
 		new Wordlift_Http_Api();
@@ -1131,10 +1131,10 @@  discard block
 block discarded – undo
1131 1131
 		$this->configuration_service = new Wordlift_Configuration_Service();
1132 1132
 
1133 1133
 		// Create an entity type service instance. It'll be later bound to the init action.
1134
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1134
+		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path());
1135 1135
 
1136 1136
 		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1137
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1137
+		$this->entity_link_service = new Wordlift_Entity_Link_Service($this->entity_post_type_service, $this->configuration_service->get_entity_base_path());
1138 1138
 
1139 1139
 		// Create an instance of the UI service.
1140 1140
 		$this->ui_service = new Wordlift_UI_Service();
@@ -1143,34 +1143,34 @@  discard block
 block discarded – undo
1143 1143
 		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
1144 1144
 
1145 1145
 		$this->sparql_service        = new Wordlift_Sparql_Service();
1146
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1146
+		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service($this->sparql_service);
1147 1147
 		$this->notice_service        = new Wordlift_Notice_Service();
1148 1148
 		$this->relation_service      = new Wordlift_Relation_Service();
1149 1149
 
1150
-		$entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' );
1151
-		$this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' );
1152
-		$this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service );
1153
-		$this->entity_service     = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service );
1154
-		$this->user_service       = new Wordlift_User_Service( $this->sparql_service, $this->entity_service );
1150
+		$entity_uri_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'entity_uri/');
1151
+		$this->file_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'converter/');
1152
+		$this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service($this->configuration_service, $entity_uri_cache_service);
1153
+		$this->entity_service     = new Wordlift_Entity_Service($this->ui_service, $this->relation_service, $this->entity_uri_service);
1154
+		$this->user_service       = new Wordlift_User_Service($this->sparql_service, $this->entity_service);
1155 1155
 
1156 1156
 		// Instantiate the JSON-LD service.
1157
-		$property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1157
+		$property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service);
1158 1158
 
1159 1159
 		/** Linked Data. */
1160
-		$this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1161
-		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1160
+		$this->storage_factory   = new Wordlift_Storage_Factory($this->entity_service, $this->user_service, $property_getter);
1161
+		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory($this->entity_service);
1162 1162
 
1163
-		$this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1163
+		$this->schema_service = new Wordlift_Schema_Service($this->storage_factory, $this->rendition_factory, $this->configuration_service);
1164 1164
 
1165 1165
 		// Create a new instance of the Redirect service.
1166
-		$this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_service );
1167
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1168
-		$this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service );
1166
+		$this->redirect_service    = new Wordlift_Redirect_Service($this->entity_service);
1167
+		$this->entity_type_service = new Wordlift_Entity_Type_Service($this->schema_service);
1168
+		$this->linked_data_service = new Wordlift_Linked_Data_Service($this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service);
1169 1169
 
1170 1170
 		// Create a new instance of the Timeline service and Timeline shortcode.
1171
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1171
+		$this->timeline_service = new Wordlift_Timeline_Service($this->entity_service, $this->entity_type_service);
1172 1172
 
1173
-		$this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service );
1173
+		$this->batch_analysis_service = new Wordlift_Batch_Analysis_Service($this, $this->configuration_service, $this->file_cache_service);
1174 1174
 
1175 1175
 		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1176 1176
 
@@ -1184,66 +1184,66 @@  discard block
 block discarded – undo
1184 1184
 		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1185 1185
 
1186 1186
 		// Create an import service instance to hook later to WP's import function.
1187
-		$this->import_service = new Wordlift_Import_Service( $this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri() );
1187
+		$this->import_service = new Wordlift_Import_Service($this->entity_post_type_service, $this->entity_service, $this->schema_service, $this->sparql_service, $this->configuration_service->get_dataset_uri());
1188 1188
 
1189
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1189
+		$uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']);
1190 1190
 
1191 1191
 		// Create the entity rating service.
1192
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1192
+		$this->rating_service = new Wordlift_Rating_Service($this->entity_service, $this->entity_type_service, $this->notice_service);
1193 1193
 
1194 1194
 		// Create entity list customization (wp-admin/edit.php).
1195
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1195
+		$this->entity_list_service = new Wordlift_Entity_List_Service($this->rating_service);
1196 1196
 
1197 1197
 		// Create a new instance of the Redirect service.
1198
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1198
+		$this->dashboard_service = new Wordlift_Dashboard_Service($this->rating_service, $this->entity_service);
1199 1199
 
1200 1200
 		// Create an instance of the Publisher Service and the AJAX Adapter.
1201
-		$this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service );
1202
-		$this->property_factory  = new Wordlift_Property_Factory( $schema_url_property_service );
1203
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1201
+		$this->publisher_service = new Wordlift_Publisher_Service($this->configuration_service);
1202
+		$this->property_factory  = new Wordlift_Property_Factory($schema_url_property_service);
1203
+		$this->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service);
1204 1204
 
1205 1205
 		$attachment_service = new Wordlift_Attachment_Service();
1206 1206
 
1207 1207
 		// Instantiate the JSON-LD service.
1208
-		$property_getter                         = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1209
-		$this->entity_post_to_jsonld_converter   = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter );
1210
-		$this->post_to_jsonld_converter          = new Wordlift_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1211
-		$this->postid_to_jsonld_converter        = new Wordlift_Postid_To_Jsonld_Converter( $this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter );
1212
-		$this->jsonld_website_converter          = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1213
-		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service );
1214
-		$this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1215
-
1216
-
1217
-		$this->key_validation_service    = new Wordlift_Key_Validation_Service( $this->configuration_service );
1218
-		$this->content_filter_service    = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service );
1219
-		$this->relation_rebuild_service  = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1220
-		$this->sample_data_service       = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1221
-		$this->sample_data_ajax_adapter  = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1222
-		$this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service );
1208
+		$property_getter                         = Wordlift_Property_Getter_Factory::create($this->entity_service);
1209
+		$this->entity_post_to_jsonld_converter   = new Wordlift_Entity_Post_To_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter);
1210
+		$this->post_to_jsonld_converter          = new Wordlift_Post_To_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service);
1211
+		$this->postid_to_jsonld_converter        = new Wordlift_Postid_To_Jsonld_Converter($this->entity_service, $this->entity_post_to_jsonld_converter, $this->post_to_jsonld_converter);
1212
+		$this->jsonld_website_converter          = new Wordlift_Website_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service);
1213
+		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter($this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service);
1214
+		$this->jsonld_service                    = new Wordlift_Jsonld_Service($this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter);
1215
+
1216
+
1217
+		$this->key_validation_service    = new Wordlift_Key_Validation_Service($this->configuration_service);
1218
+		$this->content_filter_service    = new Wordlift_Content_Filter_Service($this->entity_service, $this->configuration_service, $this->entity_uri_service);
1219
+		$this->relation_rebuild_service  = new Wordlift_Relation_Rebuild_Service($this->content_filter_service, $this->entity_service);
1220
+		$this->sample_data_service       = new Wordlift_Sample_Data_Service($this->entity_type_service, $this->configuration_service, $this->user_service);
1221
+		$this->sample_data_ajax_adapter  = new Wordlift_Sample_Data_Ajax_Adapter($this->sample_data_service);
1222
+		$this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service($this->linked_data_service, $this->entity_service, $this->relation_service);
1223 1223
 
1224 1224
 		// Initialize the shortcodes.
1225 1225
 		new Wordlift_Navigator_Shortcode();
1226 1226
 		new Wordlift_Chord_Shortcode();
1227 1227
 		new Wordlift_Geomap_Shortcode();
1228 1228
 		new Wordlift_Timeline_Shortcode();
1229
-		new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1230
-		new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1229
+		new Wordlift_Related_Entities_Cloud_Shortcode($this->relation_service);
1230
+		new Wordlift_Vocabulary_Shortcode($this->configuration_service);
1231 1231
 
1232 1232
 		// Initialize the SEO service.
1233 1233
 		new Wordlift_Seo_Service();
1234 1234
 
1235 1235
 		// Initialize the AMP service.
1236
-		new Wordlift_AMP_Service( $this->jsonld_service );
1236
+		new Wordlift_AMP_Service($this->jsonld_service);
1237 1237
 
1238 1238
 		/** Services. */
1239 1239
 		$this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1240 1240
 
1241 1241
 		/** Adapters. */
1242
-		$this->entity_type_adapter      = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1243
-		$this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service );
1244
-		$this->tinymce_adapter          = new Wordlift_Tinymce_Adapter( $this );
1245
-		$this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service );
1246
-		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1242
+		$this->entity_type_adapter      = new Wordlift_Entity_Type_Adapter($this->entity_type_service);
1243
+		$this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter($this->publisher_service);
1244
+		$this->tinymce_adapter          = new Wordlift_Tinymce_Adapter($this);
1245
+		$this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter($this->batch_analysis_service);
1246
+		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter($this->relation_rebuild_service);
1247 1247
 
1248 1248
 		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
1249 1249
 		$this->rebuild_service = new Wordlift_Rebuild_Service(
@@ -1259,8 +1259,8 @@  discard block
 block discarded – undo
1259 1259
 		new Wordlift_Push_References_Async_Task();
1260 1260
 
1261 1261
 		/** WL Autocomplete. */
1262
-		$this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service );
1263
-		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service );
1262
+		$this->autocomplete_service = new Wordlift_Autocomplete_Service($this->configuration_service);
1263
+		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter($this->autocomplete_service);
1264 1264
 
1265 1265
 		/** WordPress Admin UI. */
1266 1266
 
@@ -1270,15 +1270,15 @@  discard block
 block discarded – undo
1270 1270
 		$this->select2_element         = new Wordlift_Admin_Select2_Element();
1271 1271
 		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1272 1272
 		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
1273
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element );
1274
-		$this->author_element          = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element );
1273
+		$this->publisher_element       = new Wordlift_Admin_Publisher_Element($this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element);
1274
+		$this->author_element          = new Wordlift_Admin_Author_Element($this->publisher_service, $this->select2_element);
1275 1275
 
1276
-		$this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element );
1277
-		$this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service );
1278
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1276
+		$this->settings_page             = new Wordlift_Admin_Settings_Page($this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element);
1277
+		$this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page($this->batch_analysis_service);
1278
+		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($this->settings_page);
1279 1279
 
1280 1280
 		// Pages.
1281
-		new Wordlift_Admin_Post_Edit_Page( $this );
1281
+		new Wordlift_Admin_Post_Edit_Page($this);
1282 1282
 		new Wordlift_Entity_Type_Admin_Service();
1283 1283
 
1284 1284
 		// create an instance of the entity type list admin page controller.
@@ -1291,23 +1291,23 @@  discard block
 block discarded – undo
1291 1291
 		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1292 1292
 
1293 1293
 		/* WordPress Admin. */
1294
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1295
-		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1294
+		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service);
1295
+		$this->status_page             = new Wordlift_Admin_Status_Page($this->entity_service, $this->sparql_service);
1296 1296
 
1297 1297
 		// Create an instance of the install wizard.
1298
-		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1298
+		$this->admin_setup = new Wordlift_Admin_Setup($this->configuration_service, $this->key_validation_service, $this->entity_service);
1299 1299
 
1300
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1300
+		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($this->entity_post_type_service);
1301 1301
 
1302 1302
 		// User Profile.
1303
-		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1303
+		new Wordlift_Admin_User_Profile_Page($this->author_element, $this->user_service);
1304 1304
 
1305 1305
 		$this->entity_page_service = new Wordlift_Entity_Page_Service();
1306 1306
 
1307 1307
 		// Load the debug service if WP is in debug mode.
1308
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1309
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1310
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1308
+		if (defined('WP_DEBUG') && WP_DEBUG) {
1309
+			require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php';
1310
+			new Wordlift_Debug_Service($this->entity_service, $uri_service);
1311 1311
 		}
1312 1312
 
1313 1313
 		// Remote Image Service.
@@ -1326,9 +1326,9 @@  discard block
 block discarded – undo
1326 1326
 	private function set_locale() {
1327 1327
 
1328 1328
 		$plugin_i18n = new Wordlift_i18n();
1329
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1329
+		$plugin_i18n->set_domain($this->get_plugin_name());
1330 1330
 
1331
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1331
+		$this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain');
1332 1332
 
1333 1333
 	}
1334 1334
 
@@ -1349,160 +1349,160 @@  discard block
 block discarded – undo
1349 1349
 			$this->user_service
1350 1350
 		);
1351 1351
 
1352
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1353
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1352
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles');
1353
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts');
1354 1354
 
1355 1355
 		// Hook the init action to taxonomy services.
1356
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1357
-		$this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 );
1356
+		$this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0);
1357
+		$this->loader->add_action('init', $this->entity_types_taxonomy_service, 'init', 0);
1358 1358
 
1359 1359
 		// Hook the deleted_post_meta action to the Thumbnail service.
1360
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1360
+		$this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4);
1361 1361
 
1362 1362
 		// Hook the added_post_meta action to the Thumbnail service.
1363
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1363
+		$this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4);
1364 1364
 
1365 1365
 		// Hook the updated_post_meta action to the Thumbnail service.
1366
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1366
+		$this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4);
1367 1367
 
1368 1368
 		// Hook the AJAX wl_timeline action to the Timeline service.
1369
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1369
+		$this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline');
1370 1370
 
1371 1371
 		// Register custom allowed redirect hosts.
1372
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1372
+		$this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts');
1373 1373
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1374
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1374
+		$this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect');
1375 1375
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1376
-		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1376
+		$this->loader->add_action('wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats');
1377 1377
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1378
-		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1378
+		$this->loader->add_action('wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets');
1379 1379
 
1380 1380
 		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1381 1381
 		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1382
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1383
-		$this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1382
+		$this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3);
1383
+		$this->loader->add_action('save_post', $this->rating_service, 'set_rating_for', 20, 1);
1384 1384
 
1385
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1386
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1385
+		$this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1);
1386
+		$this->loader->add_action('in_admin_header', $this->rating_service, 'in_admin_header');
1387 1387
 
1388 1388
 		// Entity listing customization (wp-admin/edit.php)
1389 1389
 		// Add custom columns.
1390
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1390
+		$this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns');
1391 1391
 		// no explicit entity as it prevents handling of other post types.
1392
-		$this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1392
+		$this->loader->add_filter('manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2);
1393 1393
 		// Add 4W selection.
1394
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1395
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1396
-		$this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1397
-		$this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1398
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1394
+		$this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope');
1395
+		$this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope');
1396
+		$this->loader->add_action('pre_get_posts', $this->entity_list_service, 'pre_get_posts');
1397
+		$this->loader->add_action('load-edit.php', $this->entity_list_service, 'load_edit');
1398
+		$this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args');
1399 1399
 
1400 1400
 		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1401 1401
 		// entities.
1402
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1402
+		$this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2);
1403 1403
 
1404 1404
 		// Filter imported post meta.
1405
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1405
+		$this->loader->add_filter('wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3);
1406 1406
 
1407 1407
 		// Notify the import service when an import starts and ends.
1408
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1409
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1408
+		$this->loader->add_action('import_start', $this->import_service, 'import_start', 10, 0);
1409
+		$this->loader->add_action('import_end', $this->import_service, 'import_end', 10, 0);
1410 1410
 
1411 1411
 		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1412
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1413
-		$this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' );
1412
+		$this->loader->add_action('wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild');
1413
+		$this->loader->add_action('wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild');
1414 1414
 
1415 1415
 		// Hook the menu to the Download Your Data page.
1416
-		$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1417
-		$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1418
-		$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1416
+		$this->loader->add_action('admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0);
1417
+		$this->loader->add_action('admin_menu', $this->status_page, 'admin_menu', 100, 0);
1418
+		$this->loader->add_action('admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0);
1419 1419
 
1420 1420
 		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1421
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1421
+		$this->loader->add_action('wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10);
1422 1422
 
1423 1423
 		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1424
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1425
-		$this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' );
1426
-		$this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1424
+		$this->loader->add_action('wp_ajax_wl_jsonld', $this->jsonld_service, 'get');
1425
+		$this->loader->add_action('admin_post_wl_jsonld', $this->jsonld_service, 'get');
1426
+		$this->loader->add_action('admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get');
1427 1427
 
1428 1428
 		// Hook the AJAX wl_validate_key action to the Key Validation service.
1429
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1429
+		$this->loader->add_action('wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key');
1430 1430
 
1431 1431
 		// Hook the `admin_init` function to the Admin Setup.
1432
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1432
+		$this->loader->add_action('admin_init', $this->admin_setup, 'admin_init');
1433 1433
 
1434 1434
 		// Hook the admin_init to the settings page.
1435
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1435
+		$this->loader->add_action('admin_init', $this->settings_page, 'admin_init');
1436 1436
 
1437
-		$this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' );
1437
+		$this->loader->add_filter('admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction');
1438 1438
 
1439 1439
 		// Hook the menu creation on the general wordlift menu creation.
1440
-		$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1441
-		if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) {
1440
+		$this->loader->add_action('wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2);
1441
+		if (defined('WORDLIFT_BATCH') && WORDLIFT_BATCH) {
1442 1442
 			// Add the functionality only if a flag is set in wp-config.php .
1443
-			$this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 );
1443
+			$this->loader->add_action('wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2);
1444 1444
 		}
1445 1445
 
1446 1446
 		// Hook key update.
1447
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1448
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1447
+		$this->loader->add_action('pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2);
1448
+		$this->loader->add_action('update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2);
1449 1449
 
1450 1450
 		// Add additional action links to the WordLift plugin in the plugins page.
1451
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1451
+		$this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1);
1452 1452
 
1453 1453
 		// Hook the AJAX `wl_publisher` action name.
1454
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1454
+		$this->loader->add_action('wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher');
1455 1455
 
1456 1456
 		// Hook row actions for the entity type list admin.
1457
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1457
+		$this->loader->add_filter('wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2);
1458 1458
 
1459 1459
 		/** Ajax actions. */
1460
-		$this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1460
+		$this->loader->add_action('wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export');
1461 1461
 
1462 1462
 		// Hook capabilities manipulation to allow access to entity type admin
1463 1463
 		// page  on WordPress versions before 4.7.
1464 1464
 		global $wp_version;
1465
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1466
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1465
+		if (version_compare($wp_version, '4.7', '<')) {
1466
+			$this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4);
1467 1467
 		}
1468 1468
 
1469
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1469
+		$this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1);
1470 1470
 
1471 1471
 		/** Adapters. */
1472
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1473
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' );
1474
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' );
1475
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' );
1476
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' );
1477
-		$this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' );
1472
+		$this->loader->add_filter('mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1);
1473
+		$this->loader->add_action('wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit');
1474
+		$this->loader->add_action('wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts');
1475
+		$this->loader->add_action('wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel');
1476
+		$this->loader->add_action('wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning');
1477
+		$this->loader->add_action('wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all');
1478 1478
 
1479
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1480
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1479
+		$this->loader->add_action('wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create');
1480
+		$this->loader->add_action('wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete');
1481 1481
 
1482 1482
 
1483
-		$this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 );
1484
-		$this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 );
1483
+		$this->loader->add_action('update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5);
1484
+		$this->loader->add_action('delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5);
1485 1485
 
1486 1486
 		// Handle the autocomplete request.
1487
-		add_action( 'wp_ajax_wl_autocomplete', array(
1487
+		add_action('wp_ajax_wl_autocomplete', array(
1488 1488
 			$this->autocomplete_adapter,
1489 1489
 			'wl_autocomplete',
1490
-		) );
1491
-		add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1490
+		));
1491
+		add_action('wp_ajax_nopriv_wl_autocomplete', array(
1492 1492
 			$this->autocomplete_adapter,
1493 1493
 			'wl_autocomplete',
1494
-		) );
1494
+		));
1495 1495
 
1496 1496
 		// Hooks to restrict multisite super admin from manipulating entity types.
1497
-		if ( is_multisite() ) {
1498
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1497
+		if (is_multisite()) {
1498
+			$this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4);
1499 1499
 		}
1500 1500
 
1501
-		$deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service );
1501
+		$deactivator_feedback = new Wordlift_Deactivator_Feedback($this->configuration_service);
1502 1502
 
1503
-		add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) );
1504
-		add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) );
1505
-		add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) );
1503
+		add_action('admin_footer', array($deactivator_feedback, 'render_feedback_popup'));
1504
+		add_action('admin_enqueue_scripts', array($deactivator_feedback, 'enqueue_popup_scripts'));
1505
+		add_action('wp_ajax_wl_deactivation_feedback', array($deactivator_feedback, 'wl_deactivation_feedback'));
1506 1506
 	}
1507 1507
 
1508 1508
 	/**
@@ -1514,17 +1514,17 @@  discard block
 block discarded – undo
1514 1514
 	 */
1515 1515
 	private function define_public_hooks() {
1516 1516
 
1517
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1517
+		$plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version());
1518 1518
 
1519 1519
 		// Register the entity post type.
1520
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1521
-		$this->loader->add_action( 'init', $this->install_service, 'install' );
1520
+		$this->loader->add_action('init', $this->entity_post_type_service, 'register');
1521
+		$this->loader->add_action('init', $this->install_service, 'install');
1522 1522
 
1523 1523
 		// Bind the link generation and handling hooks to the entity link service.
1524
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1525
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1526
-		$this->loader->add_filter( 'wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3 );
1527
-		$this->loader->add_filter( 'wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4 );
1524
+		$this->loader->add_filter('post_type_link', $this->entity_link_service, 'post_type_link', 10, 4);
1525
+		$this->loader->add_action('pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1);
1526
+		$this->loader->add_filter('wp_unique_post_slug_is_bad_flat_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_flat_slug', 10, 3);
1527
+		$this->loader->add_filter('wp_unique_post_slug_is_bad_hierarchical_slug', $this->entity_link_service, 'wp_unique_post_slug_is_bad_hierarchical_slug', 10, 4);
1528 1528
 
1529 1529
 		/**
1530 1530
 		 * Disable the `enqueue_styles` call since we don't have styles to load.
@@ -1534,39 +1534,39 @@  discard block
 block discarded – undo
1534 1534
 		 */
1535 1535
 		// $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1536 1536
 
1537
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1537
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts');
1538 1538
 
1539 1539
 		// Hook the content filter service to add entity links.
1540
-		if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) {
1541
-			$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1540
+		if ( ! defined('WL_DISABLE_CONTENT_FILTER') || ! WL_DISABLE_CONTENT_FILTER) {
1541
+			$this->loader->add_filter('the_content', $this->content_filter_service, 'the_content');
1542 1542
 		}
1543 1543
 
1544 1544
 		// Hook the AJAX wl_timeline action to the Timeline service.
1545
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1545
+		$this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline');
1546 1546
 
1547 1547
 		// Hook the ShareThis service.
1548
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1549
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1548
+		$this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99);
1549
+		$this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99);
1550 1550
 
1551 1551
 		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1552
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1552
+		$this->loader->add_action('wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get');
1553 1553
 
1554 1554
 		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1555 1555
 		// in order to tweak WP's `WP_Query` to include entities in queries related
1556 1556
 		// to categories.
1557
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1557
+		$this->loader->add_action('pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1);
1558 1558
 
1559 1559
 		/*
1560 1560
 		 * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service`
1561 1561
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1562 1562
 		 * order of start time.
1563 1563
 		 */
1564
-		$this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1564
+		$this->loader->add_action('pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1);
1565 1565
 
1566
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1566
+		$this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1);
1567 1567
 
1568 1568
 		// This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1569
-		$this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1569
+		$this->loader->add_action('save_post', $this->entity_type_adapter, 'save_post', 9, 3);
1570 1570
 
1571 1571
 	}
1572 1572
 
@@ -1618,11 +1618,11 @@  discard block
 block discarded – undo
1618 1618
 	 */
1619 1619
 	private function load_cli_dependencies() {
1620 1620
 
1621
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php';
1621
+		require_once plugin_dir_path(dirname(__FILE__)).'cli/class-wordlift-push-reference-data-command.php';
1622 1622
 
1623
-		$push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service );
1623
+		$push_reference_data_command = new Wordlift_Push_Reference_Data_Command($this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service);
1624 1624
 
1625
-		WP_CLI::add_command( 'wl references push', $push_reference_data_command );
1625
+		WP_CLI::add_command('wl references push', $push_reference_data_command);
1626 1626
 
1627 1627
 	}
1628 1628
 
Please login to merge, or discard this patch.
src/includes/class-wordlift-post-to-jsonld-converter.php 2 patches
Indentation   +338 added lines, -338 removed lines patch added patch discarded remove patch
@@ -15,343 +15,343 @@
 block discarded – undo
15 15
  */
16 16
 class Wordlift_Post_To_Jsonld_Converter extends Wordlift_Abstract_Post_To_Jsonld_Converter {
17 17
 
18
-	/**
19
-	 * A {@link Wordlift_Configuration_Service} instance.
20
-	 *
21
-	 * @since  3.10.0
22
-	 * @access private
23
-	 * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
24
-	 */
25
-	private $configuration_service;
26
-
27
-	/**
28
-	 * A {@link Wordlift_Log_Service} instance.
29
-	 *
30
-	 * @since  3.10.0
31
-	 * @access private
32
-	 * @var Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
33
-	 */
34
-	private $log;
35
-
36
-	/**
37
-	 * Wordlift_Post_To_Jsonld_Converter constructor.
38
-	 *
39
-	 * @since 3.10.0
40
-	 *
41
-	 * @param \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
42
-	 * @param \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance.
43
-	 * @param \Wordlift_User_Service $user_service A {@link Wordlift_User_Service} instance.
44
-	 * @param \Wordlift_Attachment_Service $attachment_service A {@link Wordlift_Attachment_Service} instance.
45
-	 * @param \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
46
-	 */
47
-	public function __construct( $entity_type_service, $entity_service, $user_service, $attachment_service, $configuration_service ) {
48
-		parent::__construct( $entity_type_service, $entity_service, $user_service, $attachment_service );
49
-
50
-		$this->configuration_service = $configuration_service;
51
-
52
-		// Set a reference to the logger.
53
-		$this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Post_To_Jsonld_Converter' );
54
-	}
55
-
56
-	/**
57
-	 * Convert the provided {@link WP_Post} to a JSON-LD array. Any entity reference
58
-	 * found while processing the post is set in the $references array.
59
-	 *
60
-	 * @since 3.10.0
61
-	 *
62
-	 * @param int $post_id The post id.
63
-	 * @param array $references An array of entity references.
64
-	 *
65
-	 * @return array A JSON-LD array.
66
-	 */
67
-	public function convert( $post_id, &$references = array() ) {
68
-
69
-		// Get the post instance.
70
-		if ( null === $post = get_post( $post_id ) ) {
71
-			// Post not found.
72
-			return null;
73
-		}
74
-
75
-		// Get the base JSON-LD and the list of entities referenced by this entity.
76
-		$jsonld = parent::convert( $post_id, $references );
77
-
78
-		// Get the entity name.
79
-		$jsonld['headline'] = $post->post_title;
80
-
81
-		// Set the published and modified dates.
82
-		$jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i', true, $post, false );
83
-		$jsonld['dateModified']  = get_post_modified_time( 'Y-m-d\TH:i', true, $post, false );
84
-
85
-		// Get the word count for the post.
86
-		$post_adapter        = new Wordlift_Post_Adapter( $post_id );
87
-		$jsonld['wordCount'] = $post_adapter->word_count();
88
-
89
-		// Set the publisher.
90
-		$this->set_publisher( $jsonld );
91
-
92
-		// Process the references if any.
93
-		if ( 0 < count( $references ) ) {
94
-
95
-			// Prepare the `about` and `mentions` array.
96
-			$about = $mentions = array();
97
-
98
-			// If the entity is in the title, then it should be an `about`.
99
-			foreach ( $references as $reference ) {
100
-
101
-				// Get the entity labels.
102
-				$labels = $this->entity_service->get_labels( $reference );
103
-
104
-				// Get the entity URI.
105
-				$item = array(
106
-					'@id' => $this->entity_service->get_uri( $reference ),
107
-				);
108
-
109
-				$escaped_lables = array_map(
110
-					function ( $value ) {
111
-						return preg_quote( $value, '/' );
112
-					}, $labels
113
-				);
114
-
115
-				// Check if the labels match any part of the title.
116
-				$matches = 1 === preg_match( '/' . implode( '|', $escaped_lables ) . '/', $post->post_title );
117
-
118
-				// If the title matches, assign the entity to the about, otherwise to the mentions.
119
-				if ( $matches ) {
120
-					$about[] = $item;
121
-				} else {
122
-					$mentions[] = $item;
123
-				}
124
-			}
125
-
126
-			// If we have abouts, assign them to the JSON-LD.
127
-			if ( 0 < count( $about ) ) {
128
-				$jsonld['about'] = $about;
129
-			}
130
-
131
-			// If we have mentions, assign them to the JSON-LD.
132
-			if ( 0 < count( $mentions ) ) {
133
-				$jsonld['mentions'] = $mentions;
134
-			}
135
-		}
136
-
137
-		// Finally set the author.
138
-		$jsonld['author'] = $this->get_author( $post->post_author, $references );
139
-
140
-		/**
141
-		 * Call the `wl_post_jsonld` filter.
142
-		 *
143
-		 * @api
144
-		 *
145
-		 * @since 3.14.0
146
-		 *
147
-		 * @param array $jsonld The JSON-LD structure.
148
-		 * @param int $post_id The {@link WP_Post} `id`.
149
-		 * @param array $references The array of referenced entities.
150
-		 */
151
-		return apply_filters( 'wl_post_jsonld', $jsonld, $post_id, $references );
152
-	}
153
-
154
-	/**
155
-	 * Get the author's JSON-LD fragment.
156
-	 *
157
-	 * The JSON-LD fragment is generated using the {@link WP_User}'s data or
158
-	 * the referenced entity if configured for the {@link WP_User}.
159
-	 *
160
-	 * @since 3.14.0
161
-	 *
162
-	 * @param int $author_id The author {@link WP_User}'s `id`.
163
-	 * @param array $references An array of referenced entities.
164
-	 *
165
-	 * @return string|array A JSON-LD structure.
166
-	 */
167
-	private function get_author( $author_id, &$references ) {
168
-
169
-		// Get the entity bound to this user.
170
-		$entity_id = $this->user_service->get_entity( $author_id );
171
-
172
-		// If there's no entity bound return a simple author structure.
173
-		if ( empty( $entity_id ) || 'publish' !== get_post_status( $entity_id ) ) {
174
-
175
-			$author     = get_the_author_meta( 'display_name', $author_id );
176
-			$author_uri = $this->user_service->get_uri( $author_id );
177
-
178
-			return array(
179
-				'@type' => 'Person',
180
-				'@id'   => $author_uri,
181
-				'name'  => $author,
182
-			);
183
-		}
184
-
185
-		// Add the author to the references.
186
-		$author_uri   = $this->entity_service->get_uri( $entity_id );
187
-		$references[] = $entity_id;
188
-
189
-		// Return the JSON-LD for the referenced entity.
190
-		return array(
191
-			'@id' => $author_uri,
192
-		);
193
-	}
194
-
195
-	/**
196
-	 * Enrich the provided params array with publisher data, if available.
197
-	 *
198
-	 * @since 3.10.0
199
-	 *
200
-	 * @param array $params The parameters array.
201
-	 */
202
-	protected function set_publisher( &$params ) {
203
-
204
-		// If the publisher id isn't set don't do anything.
205
-		if ( null === $publisher_id = $this->configuration_service->get_publisher_id() ) {
206
-			return;
207
-		}
208
-
209
-		// Get the post instance.
210
-		if ( null === $post = get_post( $publisher_id ) ) {
211
-			// Publisher not found.
212
-			return;
213
-		}
214
-
215
-		// Get the item id.
216
-		$id = $this->entity_service->get_uri( $publisher_id );
217
-
218
-		// Get the type.
219
-		$type = $this->entity_type_service->get( $publisher_id );
220
-
221
-		// Get the name.
222
-		$name = $post->post_title;
223
-
224
-		// Set the publisher data.
225
-		$params['publisher'] = array(
226
-			'@type' => $this->relative_to_context( $type['uri'] ),
227
-			'@id'   => $id,
228
-			'name'  => $name,
229
-		);
230
-
231
-		// Add the sameAs values associated with the publisher.
232
-		$storage_factory = Wordlift_Storage_Factory::get_instance();
233
-		$sameas          = $storage_factory->post_meta( Wordlift_Schema_Service::FIELD_SAME_AS )->get( $publisher_id );
234
-		if ( ! empty( $sameas ) ) {
235
-			$params['publisher']['sameAs'] = $sameas;
236
-		}
237
-
238
-		// Set the logo, only for http://schema.org/Organization as Person doesn't
239
-		// support the logo property.
240
-		//
241
-		// See http://schema.org/logo.
242
-		if ( 'http://schema.org/Organization' !== $type['uri'] ) {
243
-			return;
244
-		}
245
-
246
-		// Get the publisher logo.
247
-		$publisher_logo = $this->get_publisher_logo( $post->ID );
248
-
249
-		// Bail out if the publisher logo isn't set.
250
-		if ( false === $publisher_logo ) {
251
-			return;
252
-		}
253
-
254
-		// Copy over some useful properties.
255
-		//
256
-		// See https://developers.google.com/search/docs/data-types/articles.
257
-		$params['publisher']['logo']['@type'] = 'ImageObject';
258
-		$params['publisher']['logo']['url']   = $publisher_logo['url'];
259
-
260
-		// If you specify a "width" or "height" value you should leave out
261
-		// 'px'. For example: "width":"4608px" should be "width":"4608".
262
-		//
263
-		// See https://github.com/insideout10/wordlift-plugin/issues/451.
264
-		$params['publisher']['logo']['width']  = $publisher_logo['width'];
265
-		$params['publisher']['logo']['height'] = $publisher_logo['height'];
266
-
267
-	}
268
-
269
-	/**
270
-	 * Get the publisher logo structure.
271
-	 *
272
-	 * The function returns false when the publisher logo cannot be determined, i.e.:
273
-	 *  - the post has no featured image.
274
-	 *  - the featured image has no file.
275
-	 *  - a wp_image_editor instance cannot be instantiated on the original file or on the publisher logo file.
276
-	 *
277
-	 * @param int $post_id The post id.
278
-	 *
279
-	 * @see https://github.com/insideout10/wordlift-plugin/issues/823 related issue.
280
-	 *
281
-	 * @since 3.19.2
282
-	 * @return array|false Returns an array with the `url`, `width` and `height` for the publisher logo or false in case
283
-	 *  of errors.
284
-	 */
285
-	private function get_publisher_logo( $post_id ) {
286
-
287
-		// Get the featured image for the post.
288
-		$thumbnail_id = get_post_thumbnail_id( $post_id );
289
-
290
-		// Bail out if thumbnail not available.
291
-		if ( empty( $thumbnail_id ) ) {
292
-			$this->log->info( "Featured image not set for post $post_id." );
293
-
294
-			return false;
295
-		}
296
-
297
-		// Get the uploads base URL.
298
-		$uploads_dir = wp_upload_dir();
299
-
300
-		// Get the attachment metadata.
301
-		$metadata = wp_get_attachment_metadata( $thumbnail_id );
302
-
303
-		// Bail out if the file isn't set.
304
-		if ( ! isset( $metadata['file'] ) ) {
305
-			$this->log->warn( "Featured image file not found for post $post_id." );
306
-
307
-			return false;
308
-		}
309
-
310
-		// Retrieve the relative filename, e.g. "2018/05/logo_publisher.png"
311
-		$path = $uploads_dir['basedir'] . DIRECTORY_SEPARATOR . $metadata['file'];
312
-
313
-		// Bail out if the file isn't found.
314
-		if ( ! file_exists( $path ) ) {
315
-			$this->log->warn( "Featured image file $path doesn't exist for post $post_id." );
316
-
317
-			return false;
318
-		}
319
-
320
-		// Try to get the image editor and bail out if the editor cannot be instantiated.
321
-		$original_file_editor = wp_get_image_editor( $path );
322
-		if ( is_wp_error( $original_file_editor ) ) {
323
-			$this->log->warn( "Cannot instantiate WP Image Editor on file $path for post $post_id." );
324
-
325
-			return false;
326
-		}
327
-
328
-		// Generate the publisher logo filename, we cannot use the `width` and `height` because we're scaling
329
-		// and we don't actually know the end values.
330
-		$publisher_logo_path = $original_file_editor->generate_filename( '-publisher-logo' );
331
-
332
-		// If the file doesn't exist yet, create it.
333
-		if ( ! file_exists( $publisher_logo_path ) ) {
334
-			$original_file_editor->resize( 600, 60 );
335
-			$original_file_editor->save( $publisher_logo_path );
336
-		}
337
-
338
-		// Try to get the image editor and bail out if the editor cannot be instantiated.
339
-		$publisher_logo_editor = wp_get_image_editor( $publisher_logo_path );
340
-		if ( is_wp_error( $publisher_logo_editor ) ) {
341
-			$this->log->warn( "Cannot instantiate WP Image Editor on file $publisher_logo_path for post $post_id." );
342
-
343
-			return false;
344
-		}
345
-
346
-		// Get the actual size.
347
-		$size = $publisher_logo_editor->get_size();
348
-
349
-		// Finally return the array with data.
350
-		return array(
351
-			'url'    => $uploads_dir['baseurl'] . substr( $publisher_logo_path, strlen( $uploads_dir['basedir'] ) ),
352
-			'width'  => $size['width'],
353
-			'height' => $size['height'],
354
-		);
355
-	}
18
+    /**
19
+     * A {@link Wordlift_Configuration_Service} instance.
20
+     *
21
+     * @since  3.10.0
22
+     * @access private
23
+     * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
24
+     */
25
+    private $configuration_service;
26
+
27
+    /**
28
+     * A {@link Wordlift_Log_Service} instance.
29
+     *
30
+     * @since  3.10.0
31
+     * @access private
32
+     * @var Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
33
+     */
34
+    private $log;
35
+
36
+    /**
37
+     * Wordlift_Post_To_Jsonld_Converter constructor.
38
+     *
39
+     * @since 3.10.0
40
+     *
41
+     * @param \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
42
+     * @param \Wordlift_Entity_Service $entity_service A {@link Wordlift_Entity_Service} instance.
43
+     * @param \Wordlift_User_Service $user_service A {@link Wordlift_User_Service} instance.
44
+     * @param \Wordlift_Attachment_Service $attachment_service A {@link Wordlift_Attachment_Service} instance.
45
+     * @param \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
46
+     */
47
+    public function __construct( $entity_type_service, $entity_service, $user_service, $attachment_service, $configuration_service ) {
48
+        parent::__construct( $entity_type_service, $entity_service, $user_service, $attachment_service );
49
+
50
+        $this->configuration_service = $configuration_service;
51
+
52
+        // Set a reference to the logger.
53
+        $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Post_To_Jsonld_Converter' );
54
+    }
55
+
56
+    /**
57
+     * Convert the provided {@link WP_Post} to a JSON-LD array. Any entity reference
58
+     * found while processing the post is set in the $references array.
59
+     *
60
+     * @since 3.10.0
61
+     *
62
+     * @param int $post_id The post id.
63
+     * @param array $references An array of entity references.
64
+     *
65
+     * @return array A JSON-LD array.
66
+     */
67
+    public function convert( $post_id, &$references = array() ) {
68
+
69
+        // Get the post instance.
70
+        if ( null === $post = get_post( $post_id ) ) {
71
+            // Post not found.
72
+            return null;
73
+        }
74
+
75
+        // Get the base JSON-LD and the list of entities referenced by this entity.
76
+        $jsonld = parent::convert( $post_id, $references );
77
+
78
+        // Get the entity name.
79
+        $jsonld['headline'] = $post->post_title;
80
+
81
+        // Set the published and modified dates.
82
+        $jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i', true, $post, false );
83
+        $jsonld['dateModified']  = get_post_modified_time( 'Y-m-d\TH:i', true, $post, false );
84
+
85
+        // Get the word count for the post.
86
+        $post_adapter        = new Wordlift_Post_Adapter( $post_id );
87
+        $jsonld['wordCount'] = $post_adapter->word_count();
88
+
89
+        // Set the publisher.
90
+        $this->set_publisher( $jsonld );
91
+
92
+        // Process the references if any.
93
+        if ( 0 < count( $references ) ) {
94
+
95
+            // Prepare the `about` and `mentions` array.
96
+            $about = $mentions = array();
97
+
98
+            // If the entity is in the title, then it should be an `about`.
99
+            foreach ( $references as $reference ) {
100
+
101
+                // Get the entity labels.
102
+                $labels = $this->entity_service->get_labels( $reference );
103
+
104
+                // Get the entity URI.
105
+                $item = array(
106
+                    '@id' => $this->entity_service->get_uri( $reference ),
107
+                );
108
+
109
+                $escaped_lables = array_map(
110
+                    function ( $value ) {
111
+                        return preg_quote( $value, '/' );
112
+                    }, $labels
113
+                );
114
+
115
+                // Check if the labels match any part of the title.
116
+                $matches = 1 === preg_match( '/' . implode( '|', $escaped_lables ) . '/', $post->post_title );
117
+
118
+                // If the title matches, assign the entity to the about, otherwise to the mentions.
119
+                if ( $matches ) {
120
+                    $about[] = $item;
121
+                } else {
122
+                    $mentions[] = $item;
123
+                }
124
+            }
125
+
126
+            // If we have abouts, assign them to the JSON-LD.
127
+            if ( 0 < count( $about ) ) {
128
+                $jsonld['about'] = $about;
129
+            }
130
+
131
+            // If we have mentions, assign them to the JSON-LD.
132
+            if ( 0 < count( $mentions ) ) {
133
+                $jsonld['mentions'] = $mentions;
134
+            }
135
+        }
136
+
137
+        // Finally set the author.
138
+        $jsonld['author'] = $this->get_author( $post->post_author, $references );
139
+
140
+        /**
141
+         * Call the `wl_post_jsonld` filter.
142
+         *
143
+         * @api
144
+         *
145
+         * @since 3.14.0
146
+         *
147
+         * @param array $jsonld The JSON-LD structure.
148
+         * @param int $post_id The {@link WP_Post} `id`.
149
+         * @param array $references The array of referenced entities.
150
+         */
151
+        return apply_filters( 'wl_post_jsonld', $jsonld, $post_id, $references );
152
+    }
153
+
154
+    /**
155
+     * Get the author's JSON-LD fragment.
156
+     *
157
+     * The JSON-LD fragment is generated using the {@link WP_User}'s data or
158
+     * the referenced entity if configured for the {@link WP_User}.
159
+     *
160
+     * @since 3.14.0
161
+     *
162
+     * @param int $author_id The author {@link WP_User}'s `id`.
163
+     * @param array $references An array of referenced entities.
164
+     *
165
+     * @return string|array A JSON-LD structure.
166
+     */
167
+    private function get_author( $author_id, &$references ) {
168
+
169
+        // Get the entity bound to this user.
170
+        $entity_id = $this->user_service->get_entity( $author_id );
171
+
172
+        // If there's no entity bound return a simple author structure.
173
+        if ( empty( $entity_id ) || 'publish' !== get_post_status( $entity_id ) ) {
174
+
175
+            $author     = get_the_author_meta( 'display_name', $author_id );
176
+            $author_uri = $this->user_service->get_uri( $author_id );
177
+
178
+            return array(
179
+                '@type' => 'Person',
180
+                '@id'   => $author_uri,
181
+                'name'  => $author,
182
+            );
183
+        }
184
+
185
+        // Add the author to the references.
186
+        $author_uri   = $this->entity_service->get_uri( $entity_id );
187
+        $references[] = $entity_id;
188
+
189
+        // Return the JSON-LD for the referenced entity.
190
+        return array(
191
+            '@id' => $author_uri,
192
+        );
193
+    }
194
+
195
+    /**
196
+     * Enrich the provided params array with publisher data, if available.
197
+     *
198
+     * @since 3.10.0
199
+     *
200
+     * @param array $params The parameters array.
201
+     */
202
+    protected function set_publisher( &$params ) {
203
+
204
+        // If the publisher id isn't set don't do anything.
205
+        if ( null === $publisher_id = $this->configuration_service->get_publisher_id() ) {
206
+            return;
207
+        }
208
+
209
+        // Get the post instance.
210
+        if ( null === $post = get_post( $publisher_id ) ) {
211
+            // Publisher not found.
212
+            return;
213
+        }
214
+
215
+        // Get the item id.
216
+        $id = $this->entity_service->get_uri( $publisher_id );
217
+
218
+        // Get the type.
219
+        $type = $this->entity_type_service->get( $publisher_id );
220
+
221
+        // Get the name.
222
+        $name = $post->post_title;
223
+
224
+        // Set the publisher data.
225
+        $params['publisher'] = array(
226
+            '@type' => $this->relative_to_context( $type['uri'] ),
227
+            '@id'   => $id,
228
+            'name'  => $name,
229
+        );
230
+
231
+        // Add the sameAs values associated with the publisher.
232
+        $storage_factory = Wordlift_Storage_Factory::get_instance();
233
+        $sameas          = $storage_factory->post_meta( Wordlift_Schema_Service::FIELD_SAME_AS )->get( $publisher_id );
234
+        if ( ! empty( $sameas ) ) {
235
+            $params['publisher']['sameAs'] = $sameas;
236
+        }
237
+
238
+        // Set the logo, only for http://schema.org/Organization as Person doesn't
239
+        // support the logo property.
240
+        //
241
+        // See http://schema.org/logo.
242
+        if ( 'http://schema.org/Organization' !== $type['uri'] ) {
243
+            return;
244
+        }
245
+
246
+        // Get the publisher logo.
247
+        $publisher_logo = $this->get_publisher_logo( $post->ID );
248
+
249
+        // Bail out if the publisher logo isn't set.
250
+        if ( false === $publisher_logo ) {
251
+            return;
252
+        }
253
+
254
+        // Copy over some useful properties.
255
+        //
256
+        // See https://developers.google.com/search/docs/data-types/articles.
257
+        $params['publisher']['logo']['@type'] = 'ImageObject';
258
+        $params['publisher']['logo']['url']   = $publisher_logo['url'];
259
+
260
+        // If you specify a "width" or "height" value you should leave out
261
+        // 'px'. For example: "width":"4608px" should be "width":"4608".
262
+        //
263
+        // See https://github.com/insideout10/wordlift-plugin/issues/451.
264
+        $params['publisher']['logo']['width']  = $publisher_logo['width'];
265
+        $params['publisher']['logo']['height'] = $publisher_logo['height'];
266
+
267
+    }
268
+
269
+    /**
270
+     * Get the publisher logo structure.
271
+     *
272
+     * The function returns false when the publisher logo cannot be determined, i.e.:
273
+     *  - the post has no featured image.
274
+     *  - the featured image has no file.
275
+     *  - a wp_image_editor instance cannot be instantiated on the original file or on the publisher logo file.
276
+     *
277
+     * @param int $post_id The post id.
278
+     *
279
+     * @see https://github.com/insideout10/wordlift-plugin/issues/823 related issue.
280
+     *
281
+     * @since 3.19.2
282
+     * @return array|false Returns an array with the `url`, `width` and `height` for the publisher logo or false in case
283
+     *  of errors.
284
+     */
285
+    private function get_publisher_logo( $post_id ) {
286
+
287
+        // Get the featured image for the post.
288
+        $thumbnail_id = get_post_thumbnail_id( $post_id );
289
+
290
+        // Bail out if thumbnail not available.
291
+        if ( empty( $thumbnail_id ) ) {
292
+            $this->log->info( "Featured image not set for post $post_id." );
293
+
294
+            return false;
295
+        }
296
+
297
+        // Get the uploads base URL.
298
+        $uploads_dir = wp_upload_dir();
299
+
300
+        // Get the attachment metadata.
301
+        $metadata = wp_get_attachment_metadata( $thumbnail_id );
302
+
303
+        // Bail out if the file isn't set.
304
+        if ( ! isset( $metadata['file'] ) ) {
305
+            $this->log->warn( "Featured image file not found for post $post_id." );
306
+
307
+            return false;
308
+        }
309
+
310
+        // Retrieve the relative filename, e.g. "2018/05/logo_publisher.png"
311
+        $path = $uploads_dir['basedir'] . DIRECTORY_SEPARATOR . $metadata['file'];
312
+
313
+        // Bail out if the file isn't found.
314
+        if ( ! file_exists( $path ) ) {
315
+            $this->log->warn( "Featured image file $path doesn't exist for post $post_id." );
316
+
317
+            return false;
318
+        }
319
+
320
+        // Try to get the image editor and bail out if the editor cannot be instantiated.
321
+        $original_file_editor = wp_get_image_editor( $path );
322
+        if ( is_wp_error( $original_file_editor ) ) {
323
+            $this->log->warn( "Cannot instantiate WP Image Editor on file $path for post $post_id." );
324
+
325
+            return false;
326
+        }
327
+
328
+        // Generate the publisher logo filename, we cannot use the `width` and `height` because we're scaling
329
+        // and we don't actually know the end values.
330
+        $publisher_logo_path = $original_file_editor->generate_filename( '-publisher-logo' );
331
+
332
+        // If the file doesn't exist yet, create it.
333
+        if ( ! file_exists( $publisher_logo_path ) ) {
334
+            $original_file_editor->resize( 600, 60 );
335
+            $original_file_editor->save( $publisher_logo_path );
336
+        }
337
+
338
+        // Try to get the image editor and bail out if the editor cannot be instantiated.
339
+        $publisher_logo_editor = wp_get_image_editor( $publisher_logo_path );
340
+        if ( is_wp_error( $publisher_logo_editor ) ) {
341
+            $this->log->warn( "Cannot instantiate WP Image Editor on file $publisher_logo_path for post $post_id." );
342
+
343
+            return false;
344
+        }
345
+
346
+        // Get the actual size.
347
+        $size = $publisher_logo_editor->get_size();
348
+
349
+        // Finally return the array with data.
350
+        return array(
351
+            'url'    => $uploads_dir['baseurl'] . substr( $publisher_logo_path, strlen( $uploads_dir['basedir'] ) ),
352
+            'width'  => $size['width'],
353
+            'height' => $size['height'],
354
+        );
355
+    }
356 356
 
357 357
 }
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
 	 * @param \Wordlift_Attachment_Service $attachment_service A {@link Wordlift_Attachment_Service} instance.
45 45
 	 * @param \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
46 46
 	 */
47
-	public function __construct( $entity_type_service, $entity_service, $user_service, $attachment_service, $configuration_service ) {
48
-		parent::__construct( $entity_type_service, $entity_service, $user_service, $attachment_service );
47
+	public function __construct($entity_type_service, $entity_service, $user_service, $attachment_service, $configuration_service) {
48
+		parent::__construct($entity_type_service, $entity_service, $user_service, $attachment_service);
49 49
 
50 50
 		$this->configuration_service = $configuration_service;
51 51
 
52 52
 		// Set a reference to the logger.
53
-		$this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Post_To_Jsonld_Converter' );
53
+		$this->log = Wordlift_Log_Service::get_logger('Wordlift_Post_To_Jsonld_Converter');
54 54
 	}
55 55
 
56 56
 	/**
@@ -64,59 +64,59 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return array A JSON-LD array.
66 66
 	 */
67
-	public function convert( $post_id, &$references = array() ) {
67
+	public function convert($post_id, &$references = array()) {
68 68
 
69 69
 		// Get the post instance.
70
-		if ( null === $post = get_post( $post_id ) ) {
70
+		if (null === $post = get_post($post_id)) {
71 71
 			// Post not found.
72 72
 			return null;
73 73
 		}
74 74
 
75 75
 		// Get the base JSON-LD and the list of entities referenced by this entity.
76
-		$jsonld = parent::convert( $post_id, $references );
76
+		$jsonld = parent::convert($post_id, $references);
77 77
 
78 78
 		// Get the entity name.
79 79
 		$jsonld['headline'] = $post->post_title;
80 80
 
81 81
 		// Set the published and modified dates.
82
-		$jsonld['datePublished'] = get_post_time( 'Y-m-d\TH:i', true, $post, false );
83
-		$jsonld['dateModified']  = get_post_modified_time( 'Y-m-d\TH:i', true, $post, false );
82
+		$jsonld['datePublished'] = get_post_time('Y-m-d\TH:i', true, $post, false);
83
+		$jsonld['dateModified']  = get_post_modified_time('Y-m-d\TH:i', true, $post, false);
84 84
 
85 85
 		// Get the word count for the post.
86
-		$post_adapter        = new Wordlift_Post_Adapter( $post_id );
86
+		$post_adapter        = new Wordlift_Post_Adapter($post_id);
87 87
 		$jsonld['wordCount'] = $post_adapter->word_count();
88 88
 
89 89
 		// Set the publisher.
90
-		$this->set_publisher( $jsonld );
90
+		$this->set_publisher($jsonld);
91 91
 
92 92
 		// Process the references if any.
93
-		if ( 0 < count( $references ) ) {
93
+		if (0 < count($references)) {
94 94
 
95 95
 			// Prepare the `about` and `mentions` array.
96 96
 			$about = $mentions = array();
97 97
 
98 98
 			// If the entity is in the title, then it should be an `about`.
99
-			foreach ( $references as $reference ) {
99
+			foreach ($references as $reference) {
100 100
 
101 101
 				// Get the entity labels.
102
-				$labels = $this->entity_service->get_labels( $reference );
102
+				$labels = $this->entity_service->get_labels($reference);
103 103
 
104 104
 				// Get the entity URI.
105 105
 				$item = array(
106
-					'@id' => $this->entity_service->get_uri( $reference ),
106
+					'@id' => $this->entity_service->get_uri($reference),
107 107
 				);
108 108
 
109 109
 				$escaped_lables = array_map(
110
-					function ( $value ) {
111
-						return preg_quote( $value, '/' );
110
+					function($value) {
111
+						return preg_quote($value, '/');
112 112
 					}, $labels
113 113
 				);
114 114
 
115 115
 				// Check if the labels match any part of the title.
116
-				$matches = 1 === preg_match( '/' . implode( '|', $escaped_lables ) . '/', $post->post_title );
116
+				$matches = 1 === preg_match('/'.implode('|', $escaped_lables).'/', $post->post_title);
117 117
 
118 118
 				// If the title matches, assign the entity to the about, otherwise to the mentions.
119
-				if ( $matches ) {
119
+				if ($matches) {
120 120
 					$about[] = $item;
121 121
 				} else {
122 122
 					$mentions[] = $item;
@@ -124,18 +124,18 @@  discard block
 block discarded – undo
124 124
 			}
125 125
 
126 126
 			// If we have abouts, assign them to the JSON-LD.
127
-			if ( 0 < count( $about ) ) {
127
+			if (0 < count($about)) {
128 128
 				$jsonld['about'] = $about;
129 129
 			}
130 130
 
131 131
 			// If we have mentions, assign them to the JSON-LD.
132
-			if ( 0 < count( $mentions ) ) {
132
+			if (0 < count($mentions)) {
133 133
 				$jsonld['mentions'] = $mentions;
134 134
 			}
135 135
 		}
136 136
 
137 137
 		// Finally set the author.
138
-		$jsonld['author'] = $this->get_author( $post->post_author, $references );
138
+		$jsonld['author'] = $this->get_author($post->post_author, $references);
139 139
 
140 140
 		/**
141 141
 		 * Call the `wl_post_jsonld` filter.
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		 * @param int $post_id The {@link WP_Post} `id`.
149 149
 		 * @param array $references The array of referenced entities.
150 150
 		 */
151
-		return apply_filters( 'wl_post_jsonld', $jsonld, $post_id, $references );
151
+		return apply_filters('wl_post_jsonld', $jsonld, $post_id, $references);
152 152
 	}
153 153
 
154 154
 	/**
@@ -164,16 +164,16 @@  discard block
 block discarded – undo
164 164
 	 *
165 165
 	 * @return string|array A JSON-LD structure.
166 166
 	 */
167
-	private function get_author( $author_id, &$references ) {
167
+	private function get_author($author_id, &$references) {
168 168
 
169 169
 		// Get the entity bound to this user.
170
-		$entity_id = $this->user_service->get_entity( $author_id );
170
+		$entity_id = $this->user_service->get_entity($author_id);
171 171
 
172 172
 		// If there's no entity bound return a simple author structure.
173
-		if ( empty( $entity_id ) || 'publish' !== get_post_status( $entity_id ) ) {
173
+		if (empty($entity_id) || 'publish' !== get_post_status($entity_id)) {
174 174
 
175
-			$author     = get_the_author_meta( 'display_name', $author_id );
176
-			$author_uri = $this->user_service->get_uri( $author_id );
175
+			$author     = get_the_author_meta('display_name', $author_id);
176
+			$author_uri = $this->user_service->get_uri($author_id);
177 177
 
178 178
 			return array(
179 179
 				'@type' => 'Person',
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 		}
184 184
 
185 185
 		// Add the author to the references.
186
-		$author_uri   = $this->entity_service->get_uri( $entity_id );
186
+		$author_uri   = $this->entity_service->get_uri($entity_id);
187 187
 		$references[] = $entity_id;
188 188
 
189 189
 		// Return the JSON-LD for the referenced entity.
@@ -199,39 +199,39 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @param array $params The parameters array.
201 201
 	 */
202
-	protected function set_publisher( &$params ) {
202
+	protected function set_publisher(&$params) {
203 203
 
204 204
 		// If the publisher id isn't set don't do anything.
205
-		if ( null === $publisher_id = $this->configuration_service->get_publisher_id() ) {
205
+		if (null === $publisher_id = $this->configuration_service->get_publisher_id()) {
206 206
 			return;
207 207
 		}
208 208
 
209 209
 		// Get the post instance.
210
-		if ( null === $post = get_post( $publisher_id ) ) {
210
+		if (null === $post = get_post($publisher_id)) {
211 211
 			// Publisher not found.
212 212
 			return;
213 213
 		}
214 214
 
215 215
 		// Get the item id.
216
-		$id = $this->entity_service->get_uri( $publisher_id );
216
+		$id = $this->entity_service->get_uri($publisher_id);
217 217
 
218 218
 		// Get the type.
219
-		$type = $this->entity_type_service->get( $publisher_id );
219
+		$type = $this->entity_type_service->get($publisher_id);
220 220
 
221 221
 		// Get the name.
222 222
 		$name = $post->post_title;
223 223
 
224 224
 		// Set the publisher data.
225 225
 		$params['publisher'] = array(
226
-			'@type' => $this->relative_to_context( $type['uri'] ),
226
+			'@type' => $this->relative_to_context($type['uri']),
227 227
 			'@id'   => $id,
228 228
 			'name'  => $name,
229 229
 		);
230 230
 
231 231
 		// Add the sameAs values associated with the publisher.
232 232
 		$storage_factory = Wordlift_Storage_Factory::get_instance();
233
-		$sameas          = $storage_factory->post_meta( Wordlift_Schema_Service::FIELD_SAME_AS )->get( $publisher_id );
234
-		if ( ! empty( $sameas ) ) {
233
+		$sameas          = $storage_factory->post_meta(Wordlift_Schema_Service::FIELD_SAME_AS)->get($publisher_id);
234
+		if ( ! empty($sameas)) {
235 235
 			$params['publisher']['sameAs'] = $sameas;
236 236
 		}
237 237
 
@@ -239,15 +239,15 @@  discard block
 block discarded – undo
239 239
 		// support the logo property.
240 240
 		//
241 241
 		// See http://schema.org/logo.
242
-		if ( 'http://schema.org/Organization' !== $type['uri'] ) {
242
+		if ('http://schema.org/Organization' !== $type['uri']) {
243 243
 			return;
244 244
 		}
245 245
 
246 246
 		// Get the publisher logo.
247
-		$publisher_logo = $this->get_publisher_logo( $post->ID );
247
+		$publisher_logo = $this->get_publisher_logo($post->ID);
248 248
 
249 249
 		// Bail out if the publisher logo isn't set.
250
-		if ( false === $publisher_logo ) {
250
+		if (false === $publisher_logo) {
251 251
 			return;
252 252
 		}
253 253
 
@@ -282,14 +282,14 @@  discard block
 block discarded – undo
282 282
 	 * @return array|false Returns an array with the `url`, `width` and `height` for the publisher logo or false in case
283 283
 	 *  of errors.
284 284
 	 */
285
-	private function get_publisher_logo( $post_id ) {
285
+	private function get_publisher_logo($post_id) {
286 286
 
287 287
 		// Get the featured image for the post.
288
-		$thumbnail_id = get_post_thumbnail_id( $post_id );
288
+		$thumbnail_id = get_post_thumbnail_id($post_id);
289 289
 
290 290
 		// Bail out if thumbnail not available.
291
-		if ( empty( $thumbnail_id ) ) {
292
-			$this->log->info( "Featured image not set for post $post_id." );
291
+		if (empty($thumbnail_id)) {
292
+			$this->log->info("Featured image not set for post $post_id.");
293 293
 
294 294
 			return false;
295 295
 		}
@@ -298,47 +298,47 @@  discard block
 block discarded – undo
298 298
 		$uploads_dir = wp_upload_dir();
299 299
 
300 300
 		// Get the attachment metadata.
301
-		$metadata = wp_get_attachment_metadata( $thumbnail_id );
301
+		$metadata = wp_get_attachment_metadata($thumbnail_id);
302 302
 
303 303
 		// Bail out if the file isn't set.
304
-		if ( ! isset( $metadata['file'] ) ) {
305
-			$this->log->warn( "Featured image file not found for post $post_id." );
304
+		if ( ! isset($metadata['file'])) {
305
+			$this->log->warn("Featured image file not found for post $post_id.");
306 306
 
307 307
 			return false;
308 308
 		}
309 309
 
310 310
 		// Retrieve the relative filename, e.g. "2018/05/logo_publisher.png"
311
-		$path = $uploads_dir['basedir'] . DIRECTORY_SEPARATOR . $metadata['file'];
311
+		$path = $uploads_dir['basedir'].DIRECTORY_SEPARATOR.$metadata['file'];
312 312
 
313 313
 		// Bail out if the file isn't found.
314
-		if ( ! file_exists( $path ) ) {
315
-			$this->log->warn( "Featured image file $path doesn't exist for post $post_id." );
314
+		if ( ! file_exists($path)) {
315
+			$this->log->warn("Featured image file $path doesn't exist for post $post_id.");
316 316
 
317 317
 			return false;
318 318
 		}
319 319
 
320 320
 		// Try to get the image editor and bail out if the editor cannot be instantiated.
321
-		$original_file_editor = wp_get_image_editor( $path );
322
-		if ( is_wp_error( $original_file_editor ) ) {
323
-			$this->log->warn( "Cannot instantiate WP Image Editor on file $path for post $post_id." );
321
+		$original_file_editor = wp_get_image_editor($path);
322
+		if (is_wp_error($original_file_editor)) {
323
+			$this->log->warn("Cannot instantiate WP Image Editor on file $path for post $post_id.");
324 324
 
325 325
 			return false;
326 326
 		}
327 327
 
328 328
 		// Generate the publisher logo filename, we cannot use the `width` and `height` because we're scaling
329 329
 		// and we don't actually know the end values.
330
-		$publisher_logo_path = $original_file_editor->generate_filename( '-publisher-logo' );
330
+		$publisher_logo_path = $original_file_editor->generate_filename('-publisher-logo');
331 331
 
332 332
 		// If the file doesn't exist yet, create it.
333
-		if ( ! file_exists( $publisher_logo_path ) ) {
334
-			$original_file_editor->resize( 600, 60 );
335
-			$original_file_editor->save( $publisher_logo_path );
333
+		if ( ! file_exists($publisher_logo_path)) {
334
+			$original_file_editor->resize(600, 60);
335
+			$original_file_editor->save($publisher_logo_path);
336 336
 		}
337 337
 
338 338
 		// Try to get the image editor and bail out if the editor cannot be instantiated.
339
-		$publisher_logo_editor = wp_get_image_editor( $publisher_logo_path );
340
-		if ( is_wp_error( $publisher_logo_editor ) ) {
341
-			$this->log->warn( "Cannot instantiate WP Image Editor on file $publisher_logo_path for post $post_id." );
339
+		$publisher_logo_editor = wp_get_image_editor($publisher_logo_path);
340
+		if (is_wp_error($publisher_logo_editor)) {
341
+			$this->log->warn("Cannot instantiate WP Image Editor on file $publisher_logo_path for post $post_id.");
342 342
 
343 343
 			return false;
344 344
 		}
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 
349 349
 		// Finally return the array with data.
350 350
 		return array(
351
-			'url'    => $uploads_dir['baseurl'] . substr( $publisher_logo_path, strlen( $uploads_dir['basedir'] ) ),
351
+			'url'    => $uploads_dir['baseurl'].substr($publisher_logo_path, strlen($uploads_dir['basedir'])),
352 352
 			'width'  => $size['width'],
353 353
 			'height' => $size['height'],
354 354
 		);
Please login to merge, or discard this patch.