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