Completed
Push — develop ( 1ffa16...5fba5b )
by David
03:05
created
src/public/class-wordlift-vocabulary-shortcode.php 2 patches
Indentation   +239 added lines, -239 removed lines patch added patch discarded remove patch
@@ -18,121 +18,121 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Vocabulary_Shortcode extends Wordlift_Shortcode {
20 20
 
21
-	/**
22
-	 * The shortcode.
23
-	 *
24
-	 * @since  3.17.0
25
-	 */
26
-	const SHORTCODE = 'wl_vocabulary';
27
-
28
-	/**
29
-	 * The {@link Wordlift_Configuration_Service} instance.
30
-	 *
31
-	 * @since  3.11.0
32
-	 * @access private
33
-	 * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
34
-	 */
35
-	private $configuration_service;
36
-
37
-	/**
38
-	 * A {@link Wordlift_Log_Service} instance.
39
-	 *
40
-	 * @since  3.17.0
41
-	 * @access private
42
-	 * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
43
-	 */
44
-	private $log;
45
-
46
-	/**
47
-	 * Create a {@link Wordlift_Glossary_Shortcode} instance.
48
-	 *
49
-	 * @since 3.16.0
50
-	 *
51
-	 * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
52
-	 */
53
-	public function __construct( $configuration_service ) {
54
-		parent::__construct();
55
-
56
-		$this->log = Wordlift_Log_Service::get_logger( get_class() );
57
-
58
-		$this->configuration_service = $configuration_service;
59
-
60
-	}
61
-
62
-	/**
63
-	 * Check whether the requirements for this shortcode to work are available.
64
-	 *
65
-	 * @since 3.17.0
66
-	 * @return bool True if the requirements are satisfied otherwise false.
67
-	 */
68
-	private static function are_requirements_satisfied() {
69
-
70
-		return function_exists( 'mb_strlen' ) &&
71
-			   function_exists( 'mb_substr' ) &&
72
-			   function_exists( 'mb_convert_case' );
73
-	}
74
-
75
-	/**
76
-	 * Render the shortcode.
77
-	 *
78
-	 * @since 3.16.0
79
-	 *
80
-	 * @param array $atts An array of shortcode attributes as set by the editor.
81
-	 *
82
-	 * @return string The output html code.
83
-	 */
84
-	public function render( $atts ) {
85
-
86
-		// Bail out if the requirements aren't satisfied: we need mbstring for
87
-		// the vocabulary widget to work.
88
-		if ( ! self::are_requirements_satisfied() ) {
89
-			$this->log->warn( "The vocabulary widget cannot be displayed because this WordPress installation doesn't satisfy its requirements." );
90
-
91
-			return '';
92
-		}
93
-
94
-		wp_enqueue_style( 'wl-vocabulary-shortcode', dirname( plugin_dir_url( __FILE__ ) ) . '/public/css/wordlift-vocabulary-shortcode.css' );
95
-
96
-		// Extract attributes and set default values.
97
-		$atts = shortcode_atts( array(
98
-			// The entity type, such as `person`, `organization`, ...
99
-			'type'         => 'all',
100
-			// Limit the number of posts to 100 by default. Use -1 to remove the limit.
101
-			'limit'        => 100,
102
-			// Sort by title.
103
-			'orderby'      => 'title',
104
-		), $atts );
105
-
106
-		// Get the posts. Note that if a `type` is specified before, then the
107
-		// `tax_query` from the `add_criterias` call isn't added.
108
-		$posts = $this->get_posts( $atts );
109
-
110
-		// Get the alphabet.
111
-		$language_code = $this->configuration_service->get_language_code();
112
-		$alphabet      = Wordlift_Alphabet_Service::get( $language_code );
113
-
114
-		// Add posts to the alphabet.
115
-		foreach ( $posts as $post ) {
116
-			$this->add_to_alphabet( $alphabet, $post->ID );
117
-		}
118
-
119
-		// Generate the header.
120
-		$header = array_reduce( array_keys( $alphabet ), function ( $carry, $item ) use ( $alphabet ) {
121
-			$template = ( 0 === count( $alphabet[ $item ] )
122
-				? '<span class="wl-vocabulary-widget-disabled">%s</span>'
123
-				: '<a href="#wl-vocabulary-widget-%2$s">%1$s</a>' );
124
-
125
-			return $carry . sprintf( $template, esc_html( $item ), esc_attr( $item ) );
126
-		}, '' );
127
-
128
-		// Generate the sections.
129
-		$that     = $this;
130
-		$sections = array_reduce( array_keys( $alphabet ), function ( $carry, $item ) use ( $alphabet, $that ) {
131
-			return $carry . $that->get_section( $item, $alphabet[ $item ] );
132
-		}, '' );
133
-
134
-		// Return HTML template.
135
-		return "
21
+    /**
22
+     * The shortcode.
23
+     *
24
+     * @since  3.17.0
25
+     */
26
+    const SHORTCODE = 'wl_vocabulary';
27
+
28
+    /**
29
+     * The {@link Wordlift_Configuration_Service} instance.
30
+     *
31
+     * @since  3.11.0
32
+     * @access private
33
+     * @var \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
34
+     */
35
+    private $configuration_service;
36
+
37
+    /**
38
+     * A {@link Wordlift_Log_Service} instance.
39
+     *
40
+     * @since  3.17.0
41
+     * @access private
42
+     * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
43
+     */
44
+    private $log;
45
+
46
+    /**
47
+     * Create a {@link Wordlift_Glossary_Shortcode} instance.
48
+     *
49
+     * @since 3.16.0
50
+     *
51
+     * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
52
+     */
53
+    public function __construct( $configuration_service ) {
54
+        parent::__construct();
55
+
56
+        $this->log = Wordlift_Log_Service::get_logger( get_class() );
57
+
58
+        $this->configuration_service = $configuration_service;
59
+
60
+    }
61
+
62
+    /**
63
+     * Check whether the requirements for this shortcode to work are available.
64
+     *
65
+     * @since 3.17.0
66
+     * @return bool True if the requirements are satisfied otherwise false.
67
+     */
68
+    private static function are_requirements_satisfied() {
69
+
70
+        return function_exists( 'mb_strlen' ) &&
71
+               function_exists( 'mb_substr' ) &&
72
+               function_exists( 'mb_convert_case' );
73
+    }
74
+
75
+    /**
76
+     * Render the shortcode.
77
+     *
78
+     * @since 3.16.0
79
+     *
80
+     * @param array $atts An array of shortcode attributes as set by the editor.
81
+     *
82
+     * @return string The output html code.
83
+     */
84
+    public function render( $atts ) {
85
+
86
+        // Bail out if the requirements aren't satisfied: we need mbstring for
87
+        // the vocabulary widget to work.
88
+        if ( ! self::are_requirements_satisfied() ) {
89
+            $this->log->warn( "The vocabulary widget cannot be displayed because this WordPress installation doesn't satisfy its requirements." );
90
+
91
+            return '';
92
+        }
93
+
94
+        wp_enqueue_style( 'wl-vocabulary-shortcode', dirname( plugin_dir_url( __FILE__ ) ) . '/public/css/wordlift-vocabulary-shortcode.css' );
95
+
96
+        // Extract attributes and set default values.
97
+        $atts = shortcode_atts( array(
98
+            // The entity type, such as `person`, `organization`, ...
99
+            'type'         => 'all',
100
+            // Limit the number of posts to 100 by default. Use -1 to remove the limit.
101
+            'limit'        => 100,
102
+            // Sort by title.
103
+            'orderby'      => 'title',
104
+        ), $atts );
105
+
106
+        // Get the posts. Note that if a `type` is specified before, then the
107
+        // `tax_query` from the `add_criterias` call isn't added.
108
+        $posts = $this->get_posts( $atts );
109
+
110
+        // Get the alphabet.
111
+        $language_code = $this->configuration_service->get_language_code();
112
+        $alphabet      = Wordlift_Alphabet_Service::get( $language_code );
113
+
114
+        // Add posts to the alphabet.
115
+        foreach ( $posts as $post ) {
116
+            $this->add_to_alphabet( $alphabet, $post->ID );
117
+        }
118
+
119
+        // Generate the header.
120
+        $header = array_reduce( array_keys( $alphabet ), function ( $carry, $item ) use ( $alphabet ) {
121
+            $template = ( 0 === count( $alphabet[ $item ] )
122
+                ? '<span class="wl-vocabulary-widget-disabled">%s</span>'
123
+                : '<a href="#wl-vocabulary-widget-%2$s">%1$s</a>' );
124
+
125
+            return $carry . sprintf( $template, esc_html( $item ), esc_attr( $item ) );
126
+        }, '' );
127
+
128
+        // Generate the sections.
129
+        $that     = $this;
130
+        $sections = array_reduce( array_keys( $alphabet ), function ( $carry, $item ) use ( $alphabet, $that ) {
131
+            return $carry . $that->get_section( $item, $alphabet[ $item ] );
132
+        }, '' );
133
+
134
+        // Return HTML template.
135
+        return "
136 136
 <div class='wl-vocabulary'>
137 137
 	<nav class='wl-vocabulary-alphabet-nav'>
138 138
 		$header
@@ -143,28 +143,28 @@  discard block
 block discarded – undo
143 143
 </div>
144 144
 		";
145 145
 
146
-	}
147
-
148
-	/**
149
-	 * Generate the html code for the section.
150
-	 *
151
-	 * @since 3.17.0
152
-	 *
153
-	 * @param string $letter The section's letter.
154
-	 * @param array  $posts  An array of `$post_id => $post_title` associated with
155
-	 *                       the section.
156
-	 *
157
-	 * @return string The section html code (or an empty string if the section has
158
-	 *                no posts).
159
-	 */
160
-	private function get_section( $letter, $posts ) {
161
-
162
-		// Return an empty string if there are no posts.
163
-		if ( 0 === count( $posts ) ) {
164
-			return '';
165
-		}
166
-
167
-		return sprintf( '
146
+    }
147
+
148
+    /**
149
+     * Generate the html code for the section.
150
+     *
151
+     * @since 3.17.0
152
+     *
153
+     * @param string $letter The section's letter.
154
+     * @param array  $posts  An array of `$post_id => $post_title` associated with
155
+     *                       the section.
156
+     *
157
+     * @return string The section html code (or an empty string if the section has
158
+     *                no posts).
159
+     */
160
+    private function get_section( $letter, $posts ) {
161
+
162
+        // Return an empty string if there are no posts.
163
+        if ( 0 === count( $posts ) ) {
164
+            return '';
165
+        }
166
+
167
+        return sprintf( '
168 168
 			<div class="wl-vocabulary-letter-block" id="wl-vocabulary-widget-%s">
169 169
 				<aside class="wl-vocabulary-left-column">%s</aside>
170 170
 				<div class="wl-vocabulary-right-column">
@@ -174,107 +174,107 @@  discard block
 block discarded – undo
174 174
 				</div>
175 175
 			</div>
176 176
 		', esc_attr( $letter ), esc_html( $letter ), $this->format_posts_as_list( $posts ) );
177
-	}
178
-
179
-	/**
180
-	 * Format an array post `$post_id => $post_title` as a list.
181
-	 *
182
-	 * @since 3.17.0
183
-	 *
184
-	 * @param array $posts An array of `$post_id => $post_title` key, value pairs.
185
-	 *
186
-	 * @return string A list.
187
-	 */
188
-	private function format_posts_as_list( $posts ) {
189
-
190
-		return array_reduce( array_keys( $posts ), function ( $carry, $item ) use ( $posts ) {
191
-			return $carry . sprintf( '<li><a href="%s">%s</a></li>', esc_attr( get_permalink( $item ) ), esc_html( $posts[ $item ] ) );
192
-		}, '' );
193
-	}
194
-
195
-	/**
196
-	 * Get the posts from WordPress using the provided attributes.
197
-	 *
198
-	 * @since 3.17.0
199
-	 *
200
-	 * @param array $atts The shortcode attributes.
201
-	 *
202
-	 * @return array An array of {@link WP_Post}s.
203
-	 */
204
-	private function get_posts( $atts ) {
205
-
206
-		// The default arguments for the query.
207
-		$args = array(
208
-			'numberposts'            => intval( $atts['limit'] ),
209
-			'update_post_meta_cache' => false,
210
-			'update_post_term_cache' => false,
211
-			// Exclude the publisher.
212
-			'post__not_in' => array( $this->configuration_service->get_publisher_id() ),
213
-		);
214
-
215
-		// Limit the based entity type if needed.
216
-		if ( 'all' !== $atts['type'] ) {
217
-			$args['tax_query'] = array(
218
-				array(
219
-					'taxonomy' => Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME,
220
-					'field'    => 'slug',
221
-					'terms'    => $atts['type'],
222
-				),
223
-			);
224
-		}
225
-
226
-		// Get the posts. Note that if a `type` is specified before, then the
227
-		// `tax_query` from the `add_criterias` call isn't added.
228
-		return get_posts( Wordlift_Entity_Service::add_criterias( $args ) );
229
-
230
-	}
231
-
232
-	/**
233
-	 * Populate the alphabet with posts.
234
-	 *
235
-	 * @since 3.17.0
236
-	 *
237
-	 * @param array $alphabet An array of letters.
238
-	 * @param int   $post_id  The {@link WP_Post} id.
239
-	 */
240
-	private function add_to_alphabet( &$alphabet, $post_id ) {
241
-
242
-		// Get the title without accents.
243
-		$title = remove_accents( get_the_title( $post_id ) );
244
-
245
-		// Get the initial letter.
246
-		$letter = $this->get_first_letter_in_alphabet_or_hash( $alphabet, $title );
247
-
248
-		// Add the post.
249
-		$alphabet[ $letter ][ $post_id ] = $title;
250
-
251
-	}
252
-
253
-	/**
254
-	 * Find the first letter in the alphabet.
255
-	 *
256
-	 * In some alphabets a letter is a compound of letters, therefore this function
257
-	 * will look for groups of 2 or 3 letters in the alphabet before looking for a
258
-	 * single letter. In case the letter is not found a # (hash) key is returned.
259
-	 *
260
-	 * @since 3.17.0
261
-	 *
262
-	 * @param array  $alphabet An array of alphabet letters.
263
-	 * @param string $title    The title to match.
264
-	 *
265
-	 * @return string The initial letter or a `#` key.
266
-	 */
267
-	private function get_first_letter_in_alphabet_or_hash( $alphabet, $title ) {
268
-
269
-		// Need to handle letters which consist of 3 and 2 characters.
270
-		for ( $i = 3; $i > 0; $i -- ) {
271
-			$letter = mb_convert_case( mb_substr( $title, 0, $i ), MB_CASE_UPPER );
272
-			if ( isset( $alphabet[ $letter ] ) ) {
273
-				return $letter;
274
-			}
275
-		}
276
-
277
-		return '#';
278
-	}
177
+    }
178
+
179
+    /**
180
+     * Format an array post `$post_id => $post_title` as a list.
181
+     *
182
+     * @since 3.17.0
183
+     *
184
+     * @param array $posts An array of `$post_id => $post_title` key, value pairs.
185
+     *
186
+     * @return string A list.
187
+     */
188
+    private function format_posts_as_list( $posts ) {
189
+
190
+        return array_reduce( array_keys( $posts ), function ( $carry, $item ) use ( $posts ) {
191
+            return $carry . sprintf( '<li><a href="%s">%s</a></li>', esc_attr( get_permalink( $item ) ), esc_html( $posts[ $item ] ) );
192
+        }, '' );
193
+    }
194
+
195
+    /**
196
+     * Get the posts from WordPress using the provided attributes.
197
+     *
198
+     * @since 3.17.0
199
+     *
200
+     * @param array $atts The shortcode attributes.
201
+     *
202
+     * @return array An array of {@link WP_Post}s.
203
+     */
204
+    private function get_posts( $atts ) {
205
+
206
+        // The default arguments for the query.
207
+        $args = array(
208
+            'numberposts'            => intval( $atts['limit'] ),
209
+            'update_post_meta_cache' => false,
210
+            'update_post_term_cache' => false,
211
+            // Exclude the publisher.
212
+            'post__not_in' => array( $this->configuration_service->get_publisher_id() ),
213
+        );
214
+
215
+        // Limit the based entity type if needed.
216
+        if ( 'all' !== $atts['type'] ) {
217
+            $args['tax_query'] = array(
218
+                array(
219
+                    'taxonomy' => Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME,
220
+                    'field'    => 'slug',
221
+                    'terms'    => $atts['type'],
222
+                ),
223
+            );
224
+        }
225
+
226
+        // Get the posts. Note that if a `type` is specified before, then the
227
+        // `tax_query` from the `add_criterias` call isn't added.
228
+        return get_posts( Wordlift_Entity_Service::add_criterias( $args ) );
229
+
230
+    }
231
+
232
+    /**
233
+     * Populate the alphabet with posts.
234
+     *
235
+     * @since 3.17.0
236
+     *
237
+     * @param array $alphabet An array of letters.
238
+     * @param int   $post_id  The {@link WP_Post} id.
239
+     */
240
+    private function add_to_alphabet( &$alphabet, $post_id ) {
241
+
242
+        // Get the title without accents.
243
+        $title = remove_accents( get_the_title( $post_id ) );
244
+
245
+        // Get the initial letter.
246
+        $letter = $this->get_first_letter_in_alphabet_or_hash( $alphabet, $title );
247
+
248
+        // Add the post.
249
+        $alphabet[ $letter ][ $post_id ] = $title;
250
+
251
+    }
252
+
253
+    /**
254
+     * Find the first letter in the alphabet.
255
+     *
256
+     * In some alphabets a letter is a compound of letters, therefore this function
257
+     * will look for groups of 2 or 3 letters in the alphabet before looking for a
258
+     * single letter. In case the letter is not found a # (hash) key is returned.
259
+     *
260
+     * @since 3.17.0
261
+     *
262
+     * @param array  $alphabet An array of alphabet letters.
263
+     * @param string $title    The title to match.
264
+     *
265
+     * @return string The initial letter or a `#` key.
266
+     */
267
+    private function get_first_letter_in_alphabet_or_hash( $alphabet, $title ) {
268
+
269
+        // Need to handle letters which consist of 3 and 2 characters.
270
+        for ( $i = 3; $i > 0; $i -- ) {
271
+            $letter = mb_convert_case( mb_substr( $title, 0, $i ), MB_CASE_UPPER );
272
+            if ( isset( $alphabet[ $letter ] ) ) {
273
+                return $letter;
274
+            }
275
+        }
276
+
277
+        return '#';
278
+    }
279 279
 
280 280
 }
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @param \Wordlift_Configuration_Service $configuration_service The {@link Wordlift_Configuration_Service} instance.
52 52
 	 */
53
-	public function __construct( $configuration_service ) {
53
+	public function __construct($configuration_service) {
54 54
 		parent::__construct();
55 55
 
56
-		$this->log = Wordlift_Log_Service::get_logger( get_class() );
56
+		$this->log = Wordlift_Log_Service::get_logger(get_class());
57 57
 
58 58
 		$this->configuration_service = $configuration_service;
59 59
 
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	private static function are_requirements_satisfied() {
69 69
 
70
-		return function_exists( 'mb_strlen' ) &&
71
-			   function_exists( 'mb_substr' ) &&
72
-			   function_exists( 'mb_convert_case' );
70
+		return function_exists('mb_strlen') &&
71
+			   function_exists('mb_substr') &&
72
+			   function_exists('mb_convert_case');
73 73
 	}
74 74
 
75 75
 	/**
@@ -81,55 +81,55 @@  discard block
 block discarded – undo
81 81
 	 *
82 82
 	 * @return string The output html code.
83 83
 	 */
84
-	public function render( $atts ) {
84
+	public function render($atts) {
85 85
 
86 86
 		// Bail out if the requirements aren't satisfied: we need mbstring for
87 87
 		// the vocabulary widget to work.
88
-		if ( ! self::are_requirements_satisfied() ) {
89
-			$this->log->warn( "The vocabulary widget cannot be displayed because this WordPress installation doesn't satisfy its requirements." );
88
+		if ( ! self::are_requirements_satisfied()) {
89
+			$this->log->warn("The vocabulary widget cannot be displayed because this WordPress installation doesn't satisfy its requirements.");
90 90
 
91 91
 			return '';
92 92
 		}
93 93
 
94
-		wp_enqueue_style( 'wl-vocabulary-shortcode', dirname( plugin_dir_url( __FILE__ ) ) . '/public/css/wordlift-vocabulary-shortcode.css' );
94
+		wp_enqueue_style('wl-vocabulary-shortcode', dirname(plugin_dir_url(__FILE__)).'/public/css/wordlift-vocabulary-shortcode.css');
95 95
 
96 96
 		// Extract attributes and set default values.
97
-		$atts = shortcode_atts( array(
97
+		$atts = shortcode_atts(array(
98 98
 			// The entity type, such as `person`, `organization`, ...
99 99
 			'type'         => 'all',
100 100
 			// Limit the number of posts to 100 by default. Use -1 to remove the limit.
101 101
 			'limit'        => 100,
102 102
 			// Sort by title.
103 103
 			'orderby'      => 'title',
104
-		), $atts );
104
+		), $atts);
105 105
 
106 106
 		// Get the posts. Note that if a `type` is specified before, then the
107 107
 		// `tax_query` from the `add_criterias` call isn't added.
108
-		$posts = $this->get_posts( $atts );
108
+		$posts = $this->get_posts($atts);
109 109
 
110 110
 		// Get the alphabet.
111 111
 		$language_code = $this->configuration_service->get_language_code();
112
-		$alphabet      = Wordlift_Alphabet_Service::get( $language_code );
112
+		$alphabet      = Wordlift_Alphabet_Service::get($language_code);
113 113
 
114 114
 		// Add posts to the alphabet.
115
-		foreach ( $posts as $post ) {
116
-			$this->add_to_alphabet( $alphabet, $post->ID );
115
+		foreach ($posts as $post) {
116
+			$this->add_to_alphabet($alphabet, $post->ID);
117 117
 		}
118 118
 
119 119
 		// Generate the header.
120
-		$header = array_reduce( array_keys( $alphabet ), function ( $carry, $item ) use ( $alphabet ) {
121
-			$template = ( 0 === count( $alphabet[ $item ] )
120
+		$header = array_reduce(array_keys($alphabet), function($carry, $item) use ($alphabet) {
121
+			$template = (0 === count($alphabet[$item])
122 122
 				? '<span class="wl-vocabulary-widget-disabled">%s</span>'
123
-				: '<a href="#wl-vocabulary-widget-%2$s">%1$s</a>' );
123
+				: '<a href="#wl-vocabulary-widget-%2$s">%1$s</a>');
124 124
 
125
-			return $carry . sprintf( $template, esc_html( $item ), esc_attr( $item ) );
126
-		}, '' );
125
+			return $carry.sprintf($template, esc_html($item), esc_attr($item));
126
+		}, '');
127 127
 
128 128
 		// Generate the sections.
129 129
 		$that     = $this;
130
-		$sections = array_reduce( array_keys( $alphabet ), function ( $carry, $item ) use ( $alphabet, $that ) {
131
-			return $carry . $that->get_section( $item, $alphabet[ $item ] );
132
-		}, '' );
130
+		$sections = array_reduce(array_keys($alphabet), function($carry, $item) use ($alphabet, $that) {
131
+			return $carry.$that->get_section($item, $alphabet[$item]);
132
+		}, '');
133 133
 
134 134
 		// Return HTML template.
135 135
 		return "
@@ -157,14 +157,14 @@  discard block
 block discarded – undo
157 157
 	 * @return string The section html code (or an empty string if the section has
158 158
 	 *                no posts).
159 159
 	 */
160
-	private function get_section( $letter, $posts ) {
160
+	private function get_section($letter, $posts) {
161 161
 
162 162
 		// Return an empty string if there are no posts.
163
-		if ( 0 === count( $posts ) ) {
163
+		if (0 === count($posts)) {
164 164
 			return '';
165 165
 		}
166 166
 
167
-		return sprintf( '
167
+		return sprintf('
168 168
 			<div class="wl-vocabulary-letter-block" id="wl-vocabulary-widget-%s">
169 169
 				<aside class="wl-vocabulary-left-column">%s</aside>
170 170
 				<div class="wl-vocabulary-right-column">
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 					</ul>
174 174
 				</div>
175 175
 			</div>
176
-		', esc_attr( $letter ), esc_html( $letter ), $this->format_posts_as_list( $posts ) );
176
+		', esc_attr($letter), esc_html($letter), $this->format_posts_as_list($posts));
177 177
 	}
178 178
 
179 179
 	/**
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 	 *
186 186
 	 * @return string A list.
187 187
 	 */
188
-	private function format_posts_as_list( $posts ) {
188
+	private function format_posts_as_list($posts) {
189 189
 
190
-		return array_reduce( array_keys( $posts ), function ( $carry, $item ) use ( $posts ) {
191
-			return $carry . sprintf( '<li><a href="%s">%s</a></li>', esc_attr( get_permalink( $item ) ), esc_html( $posts[ $item ] ) );
192
-		}, '' );
190
+		return array_reduce(array_keys($posts), function($carry, $item) use ($posts) {
191
+			return $carry.sprintf('<li><a href="%s">%s</a></li>', esc_attr(get_permalink($item)), esc_html($posts[$item]));
192
+		}, '');
193 193
 	}
194 194
 
195 195
 	/**
@@ -201,19 +201,19 @@  discard block
 block discarded – undo
201 201
 	 *
202 202
 	 * @return array An array of {@link WP_Post}s.
203 203
 	 */
204
-	private function get_posts( $atts ) {
204
+	private function get_posts($atts) {
205 205
 
206 206
 		// The default arguments for the query.
207 207
 		$args = array(
208
-			'numberposts'            => intval( $atts['limit'] ),
208
+			'numberposts'            => intval($atts['limit']),
209 209
 			'update_post_meta_cache' => false,
210 210
 			'update_post_term_cache' => false,
211 211
 			// Exclude the publisher.
212
-			'post__not_in' => array( $this->configuration_service->get_publisher_id() ),
212
+			'post__not_in' => array($this->configuration_service->get_publisher_id()),
213 213
 		);
214 214
 
215 215
 		// Limit the based entity type if needed.
216
-		if ( 'all' !== $atts['type'] ) {
216
+		if ('all' !== $atts['type']) {
217 217
 			$args['tax_query'] = array(
218 218
 				array(
219 219
 					'taxonomy' => Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME,
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
 		// Get the posts. Note that if a `type` is specified before, then the
227 227
 		// `tax_query` from the `add_criterias` call isn't added.
228
-		return get_posts( Wordlift_Entity_Service::add_criterias( $args ) );
228
+		return get_posts(Wordlift_Entity_Service::add_criterias($args));
229 229
 
230 230
 	}
231 231
 
@@ -237,16 +237,16 @@  discard block
 block discarded – undo
237 237
 	 * @param array $alphabet An array of letters.
238 238
 	 * @param int   $post_id  The {@link WP_Post} id.
239 239
 	 */
240
-	private function add_to_alphabet( &$alphabet, $post_id ) {
240
+	private function add_to_alphabet(&$alphabet, $post_id) {
241 241
 
242 242
 		// Get the title without accents.
243
-		$title = remove_accents( get_the_title( $post_id ) );
243
+		$title = remove_accents(get_the_title($post_id));
244 244
 
245 245
 		// Get the initial letter.
246
-		$letter = $this->get_first_letter_in_alphabet_or_hash( $alphabet, $title );
246
+		$letter = $this->get_first_letter_in_alphabet_or_hash($alphabet, $title);
247 247
 
248 248
 		// Add the post.
249
-		$alphabet[ $letter ][ $post_id ] = $title;
249
+		$alphabet[$letter][$post_id] = $title;
250 250
 
251 251
 	}
252 252
 
@@ -264,12 +264,12 @@  discard block
 block discarded – undo
264 264
 	 *
265 265
 	 * @return string The initial letter or a `#` key.
266 266
 	 */
267
-	private function get_first_letter_in_alphabet_or_hash( $alphabet, $title ) {
267
+	private function get_first_letter_in_alphabet_or_hash($alphabet, $title) {
268 268
 
269 269
 		// Need to handle letters which consist of 3 and 2 characters.
270
-		for ( $i = 3; $i > 0; $i -- ) {
271
-			$letter = mb_convert_case( mb_substr( $title, 0, $i ), MB_CASE_UPPER );
272
-			if ( isset( $alphabet[ $letter ] ) ) {
270
+		for ($i = 3; $i > 0; $i--) {
271
+			$letter = mb_convert_case(mb_substr($title, 0, $i), MB_CASE_UPPER);
272
+			if (isset($alphabet[$letter])) {
273 273
 				return $letter;
274 274
 			}
275 275
 		}
Please login to merge, or discard this patch.
src/includes/class-wordlift-entity-service.php 2 patches
Indentation   +606 added lines, -606 removed lines patch added patch discarded remove patch
@@ -7,531 +7,531 @@  discard block
 block discarded – undo
7 7
  */
8 8
 class Wordlift_Entity_Service {
9 9
 
10
-	/**
11
-	 * The Log service.
12
-	 *
13
-	 * @since  3.2.0
14
-	 * @access private
15
-	 * @var \Wordlift_Log_Service $log The Log service.
16
-	 */
17
-	private $log;
18
-
19
-	/**
20
-	 * The UI service.
21
-	 *
22
-	 * @since  3.2.0
23
-	 * @access private
24
-	 * @var \Wordlift_UI_Service $ui_service The UI service.
25
-	 */
26
-	private $ui_service;
27
-
28
-	/**
29
-	 * The {@link Wordlift_Relation_Service} instance.
30
-	 *
31
-	 * @since  3.15.0
32
-	 * @access private
33
-	 * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
34
-	 */
35
-	private $relation_service;
36
-
37
-	/**
38
-	 * The entity post type name.
39
-	 *
40
-	 * @since 3.1.0
41
-	 */
42
-	const TYPE_NAME = 'entity';
43
-
44
-	/**
45
-	 * The alternative label meta key.
46
-	 *
47
-	 * @since 3.2.0
48
-	 */
49
-	const ALTERNATIVE_LABEL_META_KEY = '_wl_alt_label';
50
-
51
-	/**
52
-	 * The alternative label input template.
53
-	 *
54
-	 * @since 3.2.0
55
-	 */
56
-	// TODO: this should be moved to a class that deals with HTML code.
57
-	const ALTERNATIVE_LABEL_INPUT_TEMPLATE = '<div class="wl-alternative-label">
10
+    /**
11
+     * The Log service.
12
+     *
13
+     * @since  3.2.0
14
+     * @access private
15
+     * @var \Wordlift_Log_Service $log The Log service.
16
+     */
17
+    private $log;
18
+
19
+    /**
20
+     * The UI service.
21
+     *
22
+     * @since  3.2.0
23
+     * @access private
24
+     * @var \Wordlift_UI_Service $ui_service The UI service.
25
+     */
26
+    private $ui_service;
27
+
28
+    /**
29
+     * The {@link Wordlift_Relation_Service} instance.
30
+     *
31
+     * @since  3.15.0
32
+     * @access private
33
+     * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
34
+     */
35
+    private $relation_service;
36
+
37
+    /**
38
+     * The entity post type name.
39
+     *
40
+     * @since 3.1.0
41
+     */
42
+    const TYPE_NAME = 'entity';
43
+
44
+    /**
45
+     * The alternative label meta key.
46
+     *
47
+     * @since 3.2.0
48
+     */
49
+    const ALTERNATIVE_LABEL_META_KEY = '_wl_alt_label';
50
+
51
+    /**
52
+     * The alternative label input template.
53
+     *
54
+     * @since 3.2.0
55
+     */
56
+    // TODO: this should be moved to a class that deals with HTML code.
57
+    const ALTERNATIVE_LABEL_INPUT_TEMPLATE = '<div class="wl-alternative-label">
58 58
                 <label class="screen-reader-text" id="wl-alternative-label-prompt-text" for="wl-alternative-label">Enter alternative label here</label>
59 59
                 <input name="wl_alternative_label[]" size="30" value="%s" id="wl-alternative-label" type="text">
60 60
                 <button class="button wl-delete-button">%s</button>
61 61
                 </div>';
62 62
 
63
-	/**
64
-	 * A singleton instance of the Entity service.
65
-	 *
66
-	 * @since  3.2.0
67
-	 * @access private
68
-	 * @var \Wordlift_Entity_Service $instance A singleton instance of the Entity service.
69
-	 */
70
-	private static $instance;
71
-
72
-	/**
73
-	 * Create a Wordlift_Entity_Service instance.
74
-	 *
75
-	 * @since 3.2.0
76
-	 *
77
-	 * @param \Wordlift_UI_Service       $ui_service       The UI service.
78
-	 * @param \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
79
-	 */
80
-	public function __construct( $ui_service, $relation_service ) {
81
-
82
-		$this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' );
83
-
84
-		$this->ui_service       = $ui_service;
85
-		$this->relation_service = $relation_service;
86
-
87
-		// Set the singleton instance.
88
-		self::$instance = $this;
89
-	}
90
-
91
-	/**
92
-	 * Get the singleton instance of the Entity service.
93
-	 *
94
-	 * @since 3.2.0
95
-	 * @return \Wordlift_Entity_Service The singleton instance of the Entity service.
96
-	 */
97
-	public static function get_instance() {
98
-
99
-		return self::$instance;
100
-	}
101
-
102
-	/**
103
-	 * Determines whether a post is an entity or not. Entity is in this context
104
-	 * something which is not an article.
105
-	 *
106
-	 * @since 3.1.0
107
-	 *
108
-	 * @param int $post_id A post id.
109
-	 *
110
-	 * @return bool Return true if the post is an entity otherwise false.
111
-	 */
112
-	public function is_entity( $post_id ) {
113
-
114
-		$terms = wp_get_object_terms( $post_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
115
-
116
-		if ( 0 === count( $terms ) ) {
117
-			return false;
118
-		}
119
-
120
-		// We don't consider an `article` to be an entity.
121
-		if ( 'article' !== $terms[0]->slug ) {
122
-			return true;
123
-		}
124
-
125
-		return false;
126
-	}
127
-
128
-	/**
129
-	 * Get the proper classification scope for a given entity post
130
-	 *
131
-	 * @since 3.5.0
132
-	 *
133
-	 * @param integer $post_id An entity post id.
134
-	 *
135
-	 * @param string  $default The default classification scope, `what` if not
136
-	 *                         provided.
137
-	 *
138
-	 * @return string Returns a classification scope (e.g. 'what').
139
-	 */
140
-	public function get_classification_scope_for( $post_id, $default = WL_WHAT_RELATION ) {
141
-
142
-		if ( false === $this->is_entity( $post_id ) ) {
143
-			return $default;
144
-		}
145
-
146
-		// Retrieve the entity type
147
-		$entity_type_arr = Wordlift_Entity_Type_Service::get_instance()->get( $post_id );
148
-		$entity_type     = str_replace( 'wl-', '', $entity_type_arr['css_class'] );
149
-		// Retrieve classification boxes configuration
150
-		$classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES );
151
-		foreach ( $classification_boxes as $cb ) {
152
-			if ( in_array( $entity_type, $cb['registeredTypes'] ) ) {
153
-				return $cb['id'];
154
-			}
155
-		}
156
-
157
-		return $default;
158
-	}
159
-
160
-	/**
161
-	 * Check whether a {@link WP_Post} is used.
162
-	 *
163
-	 * @param int $post_id The {@link WP_Post}'s id.
164
-	 *
165
-	 * @return bool|null Null if it's not an entity, otherwise true if it's used.
166
-	 */
167
-	public function is_used( $post_id ) {
168
-
169
-		if ( false === $this->is_entity( $post_id ) ) {
170
-			return null;
171
-		}
172
-		// Retrieve the post
173
-		$entity = get_post( $post_id );
174
-
175
-		global $wpdb;
176
-		// Retrieve Wordlift relation instances table name
177
-		$table_name = wl_core_get_relation_instances_table_name();
178
-
179
-		// Check is it's referenced / related to another post / entity
180
-		$stmt = $wpdb->prepare(
181
-			"SELECT COUNT(*) FROM $table_name WHERE  object_id = %d",
182
-			$entity->ID
183
-		);
184
-
185
-		// Perform the query
186
-		$relation_instances = (int) $wpdb->get_var( $stmt );
187
-		// If there is at least one relation instance for the current entity, then it's used
188
-		if ( 0 < $relation_instances ) {
189
-			return true;
190
-		}
191
-
192
-		// Check if the entity uri is used as meta_value
193
-		$stmt = $wpdb->prepare(
194
-			"SELECT COUNT(*) FROM $wpdb->postmeta WHERE post_id != %d AND meta_value = %s",
195
-			$entity->ID,
196
-			wl_get_entity_uri( $entity->ID )
197
-		);
198
-		// Perform the query
199
-		$meta_instances = (int) $wpdb->get_var( $stmt );
200
-
201
-		// If there is at least one meta that refers the current entity uri, then current entity is used
202
-		if ( 0 < $meta_instances ) {
203
-			return true;
204
-		}
205
-
206
-		// If we are here, it means the current entity is not used at the moment
207
-		return false;
208
-	}
209
-
210
-	/**
211
-	 * Determines whether a given uri is an internal uri or not.
212
-	 *
213
-	 * @since 3.3.2
214
-	 *
215
-	 * @param int $uri An uri.
216
-	 *
217
-	 * @return true if the uri internal to the current dataset otherwise false.
218
-	 */
219
-	public function is_internal_uri( $uri ) {
220
-
221
-		return ( 0 === strrpos( $uri, wl_configuration_get_redlink_dataset_uri() ) );
222
-	}
223
-
224
-	/**
225
-	 * Find entity posts by the entity URI. Entity as searched by their entity URI or same as.
226
-	 *
227
-	 * @since 3.2.0
228
-	 *
229
-	 * @param string $uri The entity URI.
230
-	 *
231
-	 * @return WP_Post|null A WP_Post instance or null if not found.
232
-	 */
233
-	public function get_entity_post_by_uri( $uri ) {
234
-
235
-		$this->log->trace( "Getting an entity post for URI $uri..." );
236
-
237
-		// Check if we've been provided with a value otherwise return null.
238
-		if ( empty( $uri ) ) {
239
-			return null;
240
-		}
241
-
242
-		$query_args = array(
243
-			// See https://github.com/insideout10/wordlift-plugin/issues/654.
244
-			'ignore_sticky_posts' => 1,
245
-			'posts_per_page'      => 1,
246
-			'post_status'         => 'any',
247
-			'post_type'           => Wordlift_Entity_Service::valid_entity_post_types(),
248
-			'meta_query'          => array(
249
-				array(
250
-					'key'     => WL_ENTITY_URL_META_NAME,
251
-					'value'   => $uri,
252
-					'compare' => '=',
253
-				),
254
-			),
255
-			// The following query can be avoided, it's superfluous since
256
-			// we're looking for a post with a specific Entity URI. This query
257
-			// may in fact consume up to 50% of the timing necessary to load a
258
-			// page.
259
-			//
260
-			// See https://github.com/insideout10/wordlift-plugin/issues/674.
261
-			//			'tax_query'           => array(
262
-			//				'relation' => 'AND',
263
-			//				array(
264
-			//					'taxonomy' => Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME,
265
-			//					'operator' => 'EXISTS',
266
-			//				),
267
-			//				array(
268
-			//					'taxonomy' => Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME,
269
-			//					'field'    => 'slug',
270
-			//					'terms'    => 'article',
271
-			//					'operator' => 'NOT IN',
272
-			//				),
273
-			//			),
274
-		);
275
-
276
-		// Only if the current uri is not an internal uri, entity search is
277
-		// performed also looking at sameAs values.
278
-		//
279
-		// This solve issues like https://github.com/insideout10/wordlift-plugin/issues/237
280
-		if ( ! $this->is_internal_uri( $uri ) ) {
281
-
282
-			$query_args['meta_query']['relation'] = 'OR';
283
-			$query_args['meta_query'][]           = array(
284
-				'key'     => Wordlift_Schema_Service::FIELD_SAME_AS,
285
-				'value'   => $uri,
286
-				'compare' => '=',
287
-			);
288
-		}
289
-
290
-		$posts = get_posts( $query_args );
63
+    /**
64
+     * A singleton instance of the Entity service.
65
+     *
66
+     * @since  3.2.0
67
+     * @access private
68
+     * @var \Wordlift_Entity_Service $instance A singleton instance of the Entity service.
69
+     */
70
+    private static $instance;
71
+
72
+    /**
73
+     * Create a Wordlift_Entity_Service instance.
74
+     *
75
+     * @since 3.2.0
76
+     *
77
+     * @param \Wordlift_UI_Service       $ui_service       The UI service.
78
+     * @param \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
79
+     */
80
+    public function __construct( $ui_service, $relation_service ) {
81
+
82
+        $this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' );
83
+
84
+        $this->ui_service       = $ui_service;
85
+        $this->relation_service = $relation_service;
86
+
87
+        // Set the singleton instance.
88
+        self::$instance = $this;
89
+    }
90
+
91
+    /**
92
+     * Get the singleton instance of the Entity service.
93
+     *
94
+     * @since 3.2.0
95
+     * @return \Wordlift_Entity_Service The singleton instance of the Entity service.
96
+     */
97
+    public static function get_instance() {
98
+
99
+        return self::$instance;
100
+    }
101
+
102
+    /**
103
+     * Determines whether a post is an entity or not. Entity is in this context
104
+     * something which is not an article.
105
+     *
106
+     * @since 3.1.0
107
+     *
108
+     * @param int $post_id A post id.
109
+     *
110
+     * @return bool Return true if the post is an entity otherwise false.
111
+     */
112
+    public function is_entity( $post_id ) {
113
+
114
+        $terms = wp_get_object_terms( $post_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
115
+
116
+        if ( 0 === count( $terms ) ) {
117
+            return false;
118
+        }
119
+
120
+        // We don't consider an `article` to be an entity.
121
+        if ( 'article' !== $terms[0]->slug ) {
122
+            return true;
123
+        }
124
+
125
+        return false;
126
+    }
127
+
128
+    /**
129
+     * Get the proper classification scope for a given entity post
130
+     *
131
+     * @since 3.5.0
132
+     *
133
+     * @param integer $post_id An entity post id.
134
+     *
135
+     * @param string  $default The default classification scope, `what` if not
136
+     *                         provided.
137
+     *
138
+     * @return string Returns a classification scope (e.g. 'what').
139
+     */
140
+    public function get_classification_scope_for( $post_id, $default = WL_WHAT_RELATION ) {
141
+
142
+        if ( false === $this->is_entity( $post_id ) ) {
143
+            return $default;
144
+        }
145
+
146
+        // Retrieve the entity type
147
+        $entity_type_arr = Wordlift_Entity_Type_Service::get_instance()->get( $post_id );
148
+        $entity_type     = str_replace( 'wl-', '', $entity_type_arr['css_class'] );
149
+        // Retrieve classification boxes configuration
150
+        $classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES );
151
+        foreach ( $classification_boxes as $cb ) {
152
+            if ( in_array( $entity_type, $cb['registeredTypes'] ) ) {
153
+                return $cb['id'];
154
+            }
155
+        }
156
+
157
+        return $default;
158
+    }
159
+
160
+    /**
161
+     * Check whether a {@link WP_Post} is used.
162
+     *
163
+     * @param int $post_id The {@link WP_Post}'s id.
164
+     *
165
+     * @return bool|null Null if it's not an entity, otherwise true if it's used.
166
+     */
167
+    public function is_used( $post_id ) {
168
+
169
+        if ( false === $this->is_entity( $post_id ) ) {
170
+            return null;
171
+        }
172
+        // Retrieve the post
173
+        $entity = get_post( $post_id );
174
+
175
+        global $wpdb;
176
+        // Retrieve Wordlift relation instances table name
177
+        $table_name = wl_core_get_relation_instances_table_name();
178
+
179
+        // Check is it's referenced / related to another post / entity
180
+        $stmt = $wpdb->prepare(
181
+            "SELECT COUNT(*) FROM $table_name WHERE  object_id = %d",
182
+            $entity->ID
183
+        );
184
+
185
+        // Perform the query
186
+        $relation_instances = (int) $wpdb->get_var( $stmt );
187
+        // If there is at least one relation instance for the current entity, then it's used
188
+        if ( 0 < $relation_instances ) {
189
+            return true;
190
+        }
191
+
192
+        // Check if the entity uri is used as meta_value
193
+        $stmt = $wpdb->prepare(
194
+            "SELECT COUNT(*) FROM $wpdb->postmeta WHERE post_id != %d AND meta_value = %s",
195
+            $entity->ID,
196
+            wl_get_entity_uri( $entity->ID )
197
+        );
198
+        // Perform the query
199
+        $meta_instances = (int) $wpdb->get_var( $stmt );
200
+
201
+        // If there is at least one meta that refers the current entity uri, then current entity is used
202
+        if ( 0 < $meta_instances ) {
203
+            return true;
204
+        }
205
+
206
+        // If we are here, it means the current entity is not used at the moment
207
+        return false;
208
+    }
209
+
210
+    /**
211
+     * Determines whether a given uri is an internal uri or not.
212
+     *
213
+     * @since 3.3.2
214
+     *
215
+     * @param int $uri An uri.
216
+     *
217
+     * @return true if the uri internal to the current dataset otherwise false.
218
+     */
219
+    public function is_internal_uri( $uri ) {
220
+
221
+        return ( 0 === strrpos( $uri, wl_configuration_get_redlink_dataset_uri() ) );
222
+    }
223
+
224
+    /**
225
+     * Find entity posts by the entity URI. Entity as searched by their entity URI or same as.
226
+     *
227
+     * @since 3.2.0
228
+     *
229
+     * @param string $uri The entity URI.
230
+     *
231
+     * @return WP_Post|null A WP_Post instance or null if not found.
232
+     */
233
+    public function get_entity_post_by_uri( $uri ) {
234
+
235
+        $this->log->trace( "Getting an entity post for URI $uri..." );
236
+
237
+        // Check if we've been provided with a value otherwise return null.
238
+        if ( empty( $uri ) ) {
239
+            return null;
240
+        }
241
+
242
+        $query_args = array(
243
+            // See https://github.com/insideout10/wordlift-plugin/issues/654.
244
+            'ignore_sticky_posts' => 1,
245
+            'posts_per_page'      => 1,
246
+            'post_status'         => 'any',
247
+            'post_type'           => Wordlift_Entity_Service::valid_entity_post_types(),
248
+            'meta_query'          => array(
249
+                array(
250
+                    'key'     => WL_ENTITY_URL_META_NAME,
251
+                    'value'   => $uri,
252
+                    'compare' => '=',
253
+                ),
254
+            ),
255
+            // The following query can be avoided, it's superfluous since
256
+            // we're looking for a post with a specific Entity URI. This query
257
+            // may in fact consume up to 50% of the timing necessary to load a
258
+            // page.
259
+            //
260
+            // See https://github.com/insideout10/wordlift-plugin/issues/674.
261
+            //			'tax_query'           => array(
262
+            //				'relation' => 'AND',
263
+            //				array(
264
+            //					'taxonomy' => Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME,
265
+            //					'operator' => 'EXISTS',
266
+            //				),
267
+            //				array(
268
+            //					'taxonomy' => Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME,
269
+            //					'field'    => 'slug',
270
+            //					'terms'    => 'article',
271
+            //					'operator' => 'NOT IN',
272
+            //				),
273
+            //			),
274
+        );
275
+
276
+        // Only if the current uri is not an internal uri, entity search is
277
+        // performed also looking at sameAs values.
278
+        //
279
+        // This solve issues like https://github.com/insideout10/wordlift-plugin/issues/237
280
+        if ( ! $this->is_internal_uri( $uri ) ) {
281
+
282
+            $query_args['meta_query']['relation'] = 'OR';
283
+            $query_args['meta_query'][]           = array(
284
+                'key'     => Wordlift_Schema_Service::FIELD_SAME_AS,
285
+                'value'   => $uri,
286
+                'compare' => '=',
287
+            );
288
+        }
289
+
290
+        $posts = get_posts( $query_args );
291 291
 
292 292
 //		$query = new WP_Query( $query_args );
293 293
 //
294 294
 //		// Get the matching entity posts.
295 295
 //		$posts = $query->get_posts();
296 296
 
297
-		// Return null if no post is found.
298
-		if ( 0 === count( $posts ) ) {
299
-			$this->log->warn( "No post for URI $uri." );
300
-
301
-			return null;
302
-		}
303
-
304
-		// Return the found post.
305
-		return current( $posts );
306
-	}
307
-
308
-	/**
309
-	 * Fires once a post has been saved. This function uses the $_REQUEST, therefore
310
-	 * we check that the post we're saving is the current post.
311
-	 *
312
-	 * @see   https://github.com/insideout10/wordlift-plugin/issues/363
313
-	 *
314
-	 * @since 3.2.0
315
-	 *
316
-	 * @param int     $post_id Post ID.
317
-	 * @param WP_Post $post    Post object.
318
-	 * @param bool    $update  Whether this is an existing post being updated or not.
319
-	 */
320
-	public function save_post( $post_id, $post, $update ) {
321
-
322
-		// Avoid doing anything if post is autosave or a revision.
323
-		if ( wp_is_post_autosave( $post ) || wp_is_post_revision( $post ) ) {
324
-			return;
325
-		}
326
-
327
-		// We're setting the alternative label that have been provided via the UI
328
-		// (in fact we're using $_REQUEST), while save_post may be also called
329
-		// programmatically by some other function: we need to check therefore if
330
-		// the $post_id in the save_post call matches the post id set in the request.
331
-		//
332
-		// If this is not the current post being saved or if it's not an entity, return.
333
-		if ( ! isset( $_REQUEST['post_ID'] ) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity( $post_id ) ) {
334
-			return;
335
-		}
336
-
337
-		// Get the alt labels from the request (or empty array).
338
-		$alt_labels = isset( $_REQUEST['wl_alternative_label'] ) ? $_REQUEST['wl_alternative_label'] : array();
339
-
340
-		// Set the alternative labels.
341
-		$this->set_alternative_labels( $post_id, $alt_labels );
342
-
343
-	}
344
-
345
-	/**
346
-	 * Set the alternative labels.
347
-	 *
348
-	 * @since 3.2.0
349
-	 *
350
-	 * @param int   $post_id    The post id.
351
-	 * @param array $alt_labels An array of labels.
352
-	 */
353
-	public function set_alternative_labels( $post_id, $alt_labels ) {
354
-
355
-		// Force $alt_labels to be an array
356
-		if ( ! is_array( $alt_labels ) ) {
357
-			$alt_labels = array( $alt_labels );
358
-		}
359
-
360
-		$this->log->debug( "Setting alternative labels [ post id :: $post_id ][ alt labels :: " . implode( ',', $alt_labels ) . " ]" );
361
-
362
-		// Delete all the existing alternate labels.
363
-		delete_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
364
-
365
-		// Set the alternative labels.
366
-		foreach ( $alt_labels as $alt_label ) {
367
-			if ( ! empty( $alt_label ) ) {
368
-				add_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label );
369
-			}
370
-		}
371
-
372
-	}
373
-
374
-	/**
375
-	 * Retrieve the alternate labels.
376
-	 *
377
-	 * @since 3.2.0
378
-	 *
379
-	 * @param int $post_id Post id.
380
-	 *
381
-	 * @return mixed An array  of alternative labels.
382
-	 */
383
-	public function get_alternative_labels( $post_id ) {
384
-
385
-		return get_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
386
-	}
387
-
388
-	/**
389
-	 * Retrieve the labels for an entity, i.e. the title + the synonyms.
390
-	 *
391
-	 * @since 3.12.0
392
-	 *
393
-	 * @param int $post_id The entity {@link WP_Post} id.
394
-	 *
395
-	 * @return array An array with the entity title and labels.
396
-	 */
397
-	public function get_labels( $post_id ) {
398
-
399
-		return array_merge( (array) get_the_title( $post_id ), $this->get_alternative_labels( $post_id ) );
400
-	}
401
-
402
-	/**
403
-	 * Fires before the permalink field in the edit form (this event is available in WP from 4.1.0).
404
-	 *
405
-	 * @since 3.2.0
406
-	 *
407
-	 * @param WP_Post $post Post object.
408
-	 */
409
-	public function edit_form_before_permalink( $post ) {
410
-
411
-		// If it's not an entity, return.
412
-		if ( ! $this->is_entity( $post->ID ) ) {
413
-			return;
414
-		}
415
-
416
-		// Print the input template.
417
-		$this->ui_service->print_template( 'wl-tmpl-alternative-label-input', $this->get_alternative_label_input() );
418
-
419
-		// Print all the currently set alternative labels.
420
-		foreach ( $this->get_alternative_labels( $post->ID ) as $alt_label ) {
421
-
422
-			echo $this->get_alternative_label_input( $alt_label );
423
-
424
-		};
425
-
426
-		// Print the button.
427
-		$this->ui_service->print_button( 'wl-add-alternative-labels-button', __( 'Add more titles', 'wordlift' ) );
428
-
429
-	}
430
-
431
-	/**
432
-	 * Get the URI for the entity with the specified post id.
433
-	 *
434
-	 * @since 3.6.0
435
-	 *
436
-	 * @param int $post_id The entity post id.
437
-	 *
438
-	 * @return null|string The entity URI or NULL if not found or the dataset URI is not configured.
439
-	 */
440
-	public function get_uri( $post_id ) {
441
-
442
-		// If a null is given, nothing to do
443
-		if ( null == $post_id ) {
444
-			return null;
445
-		}
446
-
447
-		$uri = get_post_meta( $post_id, WL_ENTITY_URL_META_NAME, true );
448
-
449
-		// If the dataset uri is not properly configured, null is returned
450
-		if ( '' === wl_configuration_get_redlink_dataset_uri() ) {
451
-			return null;
452
-		}
453
-
454
-		// Set the URI if it isn't set yet.
455
-		$post_status = get_post_status( $post_id );
456
-		if ( empty( $uri ) && 'auto-draft' !== $post_status && 'revision' !== $post_status ) {
457
-			$uri = wl_build_entity_uri( $post_id );
458
-			wl_set_entity_uri( $post_id, $uri );
459
-		}
460
-
461
-		return $uri;
462
-	}
463
-
464
-
465
-	/**
466
-	 * Get the alternative label input HTML code.
467
-	 *
468
-	 * @since 3.2.0
469
-	 *
470
-	 * @param string $value The input value.
471
-	 *
472
-	 * @return string The input HTML code.
473
-	 */
474
-	private function get_alternative_label_input( $value = '' ) {
475
-
476
-		return sprintf( self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr( $value ), __( 'Delete', 'wordlift' ) );
477
-	}
478
-
479
-	/**
480
-	 * Get the number of entity posts published in this blog.
481
-	 *
482
-	 * @since 3.6.0
483
-	 *
484
-	 * @return int The number of published entity posts.
485
-	 */
486
-	public function count() {
487
-
488
-		$posts = get_posts( $this->add_criterias( array(
489
-			'post_status' => 'any',
490
-			'numberposts' => - 1,
491
-		) ) );
492
-
493
-		return count( $posts );
494
-	}
495
-
496
-	/**
497
-	 * Add the entity filtering criterias to the arguments for a `get_posts`
498
-	 * call.
499
-	 *
500
-	 * @since 3.15.0
501
-	 *
502
-	 * @param array $args The arguments for a `get_posts` call.
503
-	 *
504
-	 * @return array The arguments for a `get_posts` call.
505
-	 */
506
-	public static function add_criterias( $args ) {
507
-
508
-		// Build an optimal tax-query.
509
-		$tax_query = array(
510
-			'relation' => 'AND',
511
-			array(
512
-				'taxonomy' => Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME,
513
-				'operator' => 'EXISTS',
514
-			),
515
-			array(
516
-				'taxonomy' => Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME,
517
-				'field'    => 'slug',
518
-				'terms'    => 'article',
519
-				'operator' => 'NOT IN',
520
-			),
521
-		);
522
-
523
-		return $args + array(
524
-				'post_type' => Wordlift_Entity_Service::valid_entity_post_types(),
525
-				// Since 3.17.0: should this be faster?
526
-				'tax_query' => $tax_query,
527
-				//				'tax_query' => array(
528
-				//					array(
529
-				//						'taxonomy' => Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME,
530
-				//						'terms'    => self::get_entity_terms(),
531
-				//					),
532
-				//				),
533
-			);
534
-	}
297
+        // Return null if no post is found.
298
+        if ( 0 === count( $posts ) ) {
299
+            $this->log->warn( "No post for URI $uri." );
300
+
301
+            return null;
302
+        }
303
+
304
+        // Return the found post.
305
+        return current( $posts );
306
+    }
307
+
308
+    /**
309
+     * Fires once a post has been saved. This function uses the $_REQUEST, therefore
310
+     * we check that the post we're saving is the current post.
311
+     *
312
+     * @see   https://github.com/insideout10/wordlift-plugin/issues/363
313
+     *
314
+     * @since 3.2.0
315
+     *
316
+     * @param int     $post_id Post ID.
317
+     * @param WP_Post $post    Post object.
318
+     * @param bool    $update  Whether this is an existing post being updated or not.
319
+     */
320
+    public function save_post( $post_id, $post, $update ) {
321
+
322
+        // Avoid doing anything if post is autosave or a revision.
323
+        if ( wp_is_post_autosave( $post ) || wp_is_post_revision( $post ) ) {
324
+            return;
325
+        }
326
+
327
+        // We're setting the alternative label that have been provided via the UI
328
+        // (in fact we're using $_REQUEST), while save_post may be also called
329
+        // programmatically by some other function: we need to check therefore if
330
+        // the $post_id in the save_post call matches the post id set in the request.
331
+        //
332
+        // If this is not the current post being saved or if it's not an entity, return.
333
+        if ( ! isset( $_REQUEST['post_ID'] ) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity( $post_id ) ) {
334
+            return;
335
+        }
336
+
337
+        // Get the alt labels from the request (or empty array).
338
+        $alt_labels = isset( $_REQUEST['wl_alternative_label'] ) ? $_REQUEST['wl_alternative_label'] : array();
339
+
340
+        // Set the alternative labels.
341
+        $this->set_alternative_labels( $post_id, $alt_labels );
342
+
343
+    }
344
+
345
+    /**
346
+     * Set the alternative labels.
347
+     *
348
+     * @since 3.2.0
349
+     *
350
+     * @param int   $post_id    The post id.
351
+     * @param array $alt_labels An array of labels.
352
+     */
353
+    public function set_alternative_labels( $post_id, $alt_labels ) {
354
+
355
+        // Force $alt_labels to be an array
356
+        if ( ! is_array( $alt_labels ) ) {
357
+            $alt_labels = array( $alt_labels );
358
+        }
359
+
360
+        $this->log->debug( "Setting alternative labels [ post id :: $post_id ][ alt labels :: " . implode( ',', $alt_labels ) . " ]" );
361
+
362
+        // Delete all the existing alternate labels.
363
+        delete_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
364
+
365
+        // Set the alternative labels.
366
+        foreach ( $alt_labels as $alt_label ) {
367
+            if ( ! empty( $alt_label ) ) {
368
+                add_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label );
369
+            }
370
+        }
371
+
372
+    }
373
+
374
+    /**
375
+     * Retrieve the alternate labels.
376
+     *
377
+     * @since 3.2.0
378
+     *
379
+     * @param int $post_id Post id.
380
+     *
381
+     * @return mixed An array  of alternative labels.
382
+     */
383
+    public function get_alternative_labels( $post_id ) {
384
+
385
+        return get_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
386
+    }
387
+
388
+    /**
389
+     * Retrieve the labels for an entity, i.e. the title + the synonyms.
390
+     *
391
+     * @since 3.12.0
392
+     *
393
+     * @param int $post_id The entity {@link WP_Post} id.
394
+     *
395
+     * @return array An array with the entity title and labels.
396
+     */
397
+    public function get_labels( $post_id ) {
398
+
399
+        return array_merge( (array) get_the_title( $post_id ), $this->get_alternative_labels( $post_id ) );
400
+    }
401
+
402
+    /**
403
+     * Fires before the permalink field in the edit form (this event is available in WP from 4.1.0).
404
+     *
405
+     * @since 3.2.0
406
+     *
407
+     * @param WP_Post $post Post object.
408
+     */
409
+    public function edit_form_before_permalink( $post ) {
410
+
411
+        // If it's not an entity, return.
412
+        if ( ! $this->is_entity( $post->ID ) ) {
413
+            return;
414
+        }
415
+
416
+        // Print the input template.
417
+        $this->ui_service->print_template( 'wl-tmpl-alternative-label-input', $this->get_alternative_label_input() );
418
+
419
+        // Print all the currently set alternative labels.
420
+        foreach ( $this->get_alternative_labels( $post->ID ) as $alt_label ) {
421
+
422
+            echo $this->get_alternative_label_input( $alt_label );
423
+
424
+        };
425
+
426
+        // Print the button.
427
+        $this->ui_service->print_button( 'wl-add-alternative-labels-button', __( 'Add more titles', 'wordlift' ) );
428
+
429
+    }
430
+
431
+    /**
432
+     * Get the URI for the entity with the specified post id.
433
+     *
434
+     * @since 3.6.0
435
+     *
436
+     * @param int $post_id The entity post id.
437
+     *
438
+     * @return null|string The entity URI or NULL if not found or the dataset URI is not configured.
439
+     */
440
+    public function get_uri( $post_id ) {
441
+
442
+        // If a null is given, nothing to do
443
+        if ( null == $post_id ) {
444
+            return null;
445
+        }
446
+
447
+        $uri = get_post_meta( $post_id, WL_ENTITY_URL_META_NAME, true );
448
+
449
+        // If the dataset uri is not properly configured, null is returned
450
+        if ( '' === wl_configuration_get_redlink_dataset_uri() ) {
451
+            return null;
452
+        }
453
+
454
+        // Set the URI if it isn't set yet.
455
+        $post_status = get_post_status( $post_id );
456
+        if ( empty( $uri ) && 'auto-draft' !== $post_status && 'revision' !== $post_status ) {
457
+            $uri = wl_build_entity_uri( $post_id );
458
+            wl_set_entity_uri( $post_id, $uri );
459
+        }
460
+
461
+        return $uri;
462
+    }
463
+
464
+
465
+    /**
466
+     * Get the alternative label input HTML code.
467
+     *
468
+     * @since 3.2.0
469
+     *
470
+     * @param string $value The input value.
471
+     *
472
+     * @return string The input HTML code.
473
+     */
474
+    private function get_alternative_label_input( $value = '' ) {
475
+
476
+        return sprintf( self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr( $value ), __( 'Delete', 'wordlift' ) );
477
+    }
478
+
479
+    /**
480
+     * Get the number of entity posts published in this blog.
481
+     *
482
+     * @since 3.6.0
483
+     *
484
+     * @return int The number of published entity posts.
485
+     */
486
+    public function count() {
487
+
488
+        $posts = get_posts( $this->add_criterias( array(
489
+            'post_status' => 'any',
490
+            'numberposts' => - 1,
491
+        ) ) );
492
+
493
+        return count( $posts );
494
+    }
495
+
496
+    /**
497
+     * Add the entity filtering criterias to the arguments for a `get_posts`
498
+     * call.
499
+     *
500
+     * @since 3.15.0
501
+     *
502
+     * @param array $args The arguments for a `get_posts` call.
503
+     *
504
+     * @return array The arguments for a `get_posts` call.
505
+     */
506
+    public static function add_criterias( $args ) {
507
+
508
+        // Build an optimal tax-query.
509
+        $tax_query = array(
510
+            'relation' => 'AND',
511
+            array(
512
+                'taxonomy' => Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME,
513
+                'operator' => 'EXISTS',
514
+            ),
515
+            array(
516
+                'taxonomy' => Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME,
517
+                'field'    => 'slug',
518
+                'terms'    => 'article',
519
+                'operator' => 'NOT IN',
520
+            ),
521
+        );
522
+
523
+        return $args + array(
524
+                'post_type' => Wordlift_Entity_Service::valid_entity_post_types(),
525
+                // Since 3.17.0: should this be faster?
526
+                'tax_query' => $tax_query,
527
+                //				'tax_query' => array(
528
+                //					array(
529
+                //						'taxonomy' => Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME,
530
+                //						'terms'    => self::get_entity_terms(),
531
+                //					),
532
+                //				),
533
+            );
534
+    }
535 535
 
536 536
 //	/**
537 537
 //	 * Get the entity terms IDs which represent an entity.
@@ -561,97 +561,97 @@  discard block
 block discarded – undo
561 561
 //		} ) );
562 562
 //	}
563 563
 
564
-	/**
565
-	 * Create a new entity.
566
-	 *
567
-	 * @since 3.9.0
568
-	 *
569
-	 * @param string $name     The entity name.
570
-	 * @param string $type_uri The entity's type URI.
571
-	 * @param null   $logo     The entity logo id (or NULL if none).
572
-	 * @param string $status   The post status, by default 'publish'.
573
-	 *
574
-	 * @return int|WP_Error The entity post id or a {@link WP_Error} in case the `wp_insert_post` call fails.
575
-	 */
576
-	public function create( $name, $type_uri, $logo = null, $status = 'publish' ) {
577
-
578
-		// Create an entity for the publisher.
579
-		$post_id = wp_insert_post( array(
580
-			'post_type'    => self::TYPE_NAME,
581
-			'post_title'   => $name,
582
-			'post_status'  => $status,
583
-			'post_content' => '',
584
-		) );
585
-
586
-		// Return the error if any.
587
-		if ( is_wp_error( $post_id ) ) {
588
-			return $post_id;
589
-		}
590
-
591
-		// Set the entity logo.
592
-		if ( $logo && is_numeric( $logo ) ) {
593
-			set_post_thumbnail( $post_id, $logo );
594
-		}
595
-
596
-		// Set the entity type.
597
-		Wordlift_Entity_Type_Service::get_instance()->set( $post_id, $type_uri );
598
-
599
-		return $post_id;
600
-	}
601
-
602
-	/**
603
-	 * Get the entities related to the one with the specified id. By default only
604
-	 * published entities will be returned.
605
-	 *
606
-	 * @since 3.10.0
607
-	 *
608
-	 * @param int    $id          The post id.
609
-	 * @param string $post_status The target post status (default = publish).
610
-	 *
611
-	 * @return array An array of post ids.
612
-	 */
613
-	public function get_related_entities( $id, $post_status = 'publish' ) {
614
-
615
-		return $this->relation_service->get_objects( $id, 'ids', null, $post_status );
616
-	}
617
-
618
-	/**
619
-	 * Get the list of entities.
620
-	 *
621
-	 * @since 3.12.2
622
-	 *
623
-	 * @param array $params Custom parameters for WordPress' own {@link get_posts} function.
624
-	 *
625
-	 * @return array An array of entity posts.
626
-	 */
627
-	public function get( $params = array() ) {
628
-
629
-		// Set the defaults.
630
-		$defaults = array( 'post_type' => 'entity' );
631
-
632
-		// Merge the defaults with the provided parameters.
633
-		$args = wp_parse_args( $params, $defaults );
634
-
635
-		// Call the `get_posts` function.
636
-		return get_posts( $args );
637
-	}
638
-
639
-	/**
640
-	 * The list of post type names which can be used for entities
641
-	 *
642
-	 * Criteria is that the post type is public. The list of valid post types
643
-	 * can be overridden with a filter.
644
-	 *
645
-	 * @since 3.15.0
646
-	 *
647
-	 * @return array Array containing the names of the valid post types.
648
-	 */
649
-	static function valid_entity_post_types() {
650
-
651
-		// Ignore builtins in the call to avoid getting attachments.
652
-		$post_types = array( 'post', 'page', self::TYPE_NAME );
653
-
654
-		return apply_filters( 'wl_valid_entity_post_types', $post_types );
655
-	}
564
+    /**
565
+     * Create a new entity.
566
+     *
567
+     * @since 3.9.0
568
+     *
569
+     * @param string $name     The entity name.
570
+     * @param string $type_uri The entity's type URI.
571
+     * @param null   $logo     The entity logo id (or NULL if none).
572
+     * @param string $status   The post status, by default 'publish'.
573
+     *
574
+     * @return int|WP_Error The entity post id or a {@link WP_Error} in case the `wp_insert_post` call fails.
575
+     */
576
+    public function create( $name, $type_uri, $logo = null, $status = 'publish' ) {
577
+
578
+        // Create an entity for the publisher.
579
+        $post_id = wp_insert_post( array(
580
+            'post_type'    => self::TYPE_NAME,
581
+            'post_title'   => $name,
582
+            'post_status'  => $status,
583
+            'post_content' => '',
584
+        ) );
585
+
586
+        // Return the error if any.
587
+        if ( is_wp_error( $post_id ) ) {
588
+            return $post_id;
589
+        }
590
+
591
+        // Set the entity logo.
592
+        if ( $logo && is_numeric( $logo ) ) {
593
+            set_post_thumbnail( $post_id, $logo );
594
+        }
595
+
596
+        // Set the entity type.
597
+        Wordlift_Entity_Type_Service::get_instance()->set( $post_id, $type_uri );
598
+
599
+        return $post_id;
600
+    }
601
+
602
+    /**
603
+     * Get the entities related to the one with the specified id. By default only
604
+     * published entities will be returned.
605
+     *
606
+     * @since 3.10.0
607
+     *
608
+     * @param int    $id          The post id.
609
+     * @param string $post_status The target post status (default = publish).
610
+     *
611
+     * @return array An array of post ids.
612
+     */
613
+    public function get_related_entities( $id, $post_status = 'publish' ) {
614
+
615
+        return $this->relation_service->get_objects( $id, 'ids', null, $post_status );
616
+    }
617
+
618
+    /**
619
+     * Get the list of entities.
620
+     *
621
+     * @since 3.12.2
622
+     *
623
+     * @param array $params Custom parameters for WordPress' own {@link get_posts} function.
624
+     *
625
+     * @return array An array of entity posts.
626
+     */
627
+    public function get( $params = array() ) {
628
+
629
+        // Set the defaults.
630
+        $defaults = array( 'post_type' => 'entity' );
631
+
632
+        // Merge the defaults with the provided parameters.
633
+        $args = wp_parse_args( $params, $defaults );
634
+
635
+        // Call the `get_posts` function.
636
+        return get_posts( $args );
637
+    }
638
+
639
+    /**
640
+     * The list of post type names which can be used for entities
641
+     *
642
+     * Criteria is that the post type is public. The list of valid post types
643
+     * can be overridden with a filter.
644
+     *
645
+     * @since 3.15.0
646
+     *
647
+     * @return array Array containing the names of the valid post types.
648
+     */
649
+    static function valid_entity_post_types() {
650
+
651
+        // Ignore builtins in the call to avoid getting attachments.
652
+        $post_types = array( 'post', 'page', self::TYPE_NAME );
653
+
654
+        return apply_filters( 'wl_valid_entity_post_types', $post_types );
655
+    }
656 656
 
657 657
 }
Please login to merge, or discard this patch.
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 	 * @param \Wordlift_UI_Service       $ui_service       The UI service.
78 78
 	 * @param \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
79 79
 	 */
80
-	public function __construct( $ui_service, $relation_service ) {
80
+	public function __construct($ui_service, $relation_service) {
81 81
 
82
-		$this->log = Wordlift_Log_Service::get_logger( 'Wordlift_Entity_Service' );
82
+		$this->log = Wordlift_Log_Service::get_logger('Wordlift_Entity_Service');
83 83
 
84 84
 		$this->ui_service       = $ui_service;
85 85
 		$this->relation_service = $relation_service;
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @return bool Return true if the post is an entity otherwise false.
111 111
 	 */
112
-	public function is_entity( $post_id ) {
112
+	public function is_entity($post_id) {
113 113
 
114
-		$terms = wp_get_object_terms( $post_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME );
114
+		$terms = wp_get_object_terms($post_id, Wordlift_Entity_Types_Taxonomy_Service::TAXONOMY_NAME);
115 115
 
116
-		if ( 0 === count( $terms ) ) {
116
+		if (0 === count($terms)) {
117 117
 			return false;
118 118
 		}
119 119
 
120 120
 		// We don't consider an `article` to be an entity.
121
-		if ( 'article' !== $terms[0]->slug ) {
121
+		if ('article' !== $terms[0]->slug) {
122 122
 			return true;
123 123
 		}
124 124
 
@@ -137,19 +137,19 @@  discard block
 block discarded – undo
137 137
 	 *
138 138
 	 * @return string Returns a classification scope (e.g. 'what').
139 139
 	 */
140
-	public function get_classification_scope_for( $post_id, $default = WL_WHAT_RELATION ) {
140
+	public function get_classification_scope_for($post_id, $default = WL_WHAT_RELATION) {
141 141
 
142
-		if ( false === $this->is_entity( $post_id ) ) {
142
+		if (false === $this->is_entity($post_id)) {
143 143
 			return $default;
144 144
 		}
145 145
 
146 146
 		// Retrieve the entity type
147
-		$entity_type_arr = Wordlift_Entity_Type_Service::get_instance()->get( $post_id );
148
-		$entity_type     = str_replace( 'wl-', '', $entity_type_arr['css_class'] );
147
+		$entity_type_arr = Wordlift_Entity_Type_Service::get_instance()->get($post_id);
148
+		$entity_type     = str_replace('wl-', '', $entity_type_arr['css_class']);
149 149
 		// Retrieve classification boxes configuration
150
-		$classification_boxes = unserialize( WL_CORE_POST_CLASSIFICATION_BOXES );
151
-		foreach ( $classification_boxes as $cb ) {
152
-			if ( in_array( $entity_type, $cb['registeredTypes'] ) ) {
150
+		$classification_boxes = unserialize(WL_CORE_POST_CLASSIFICATION_BOXES);
151
+		foreach ($classification_boxes as $cb) {
152
+			if (in_array($entity_type, $cb['registeredTypes'])) {
153 153
 				return $cb['id'];
154 154
 			}
155 155
 		}
@@ -164,13 +164,13 @@  discard block
 block discarded – undo
164 164
 	 *
165 165
 	 * @return bool|null Null if it's not an entity, otherwise true if it's used.
166 166
 	 */
167
-	public function is_used( $post_id ) {
167
+	public function is_used($post_id) {
168 168
 
169
-		if ( false === $this->is_entity( $post_id ) ) {
169
+		if (false === $this->is_entity($post_id)) {
170 170
 			return null;
171 171
 		}
172 172
 		// Retrieve the post
173
-		$entity = get_post( $post_id );
173
+		$entity = get_post($post_id);
174 174
 
175 175
 		global $wpdb;
176 176
 		// Retrieve Wordlift relation instances table name
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
 		);
184 184
 
185 185
 		// Perform the query
186
-		$relation_instances = (int) $wpdb->get_var( $stmt );
186
+		$relation_instances = (int) $wpdb->get_var($stmt);
187 187
 		// If there is at least one relation instance for the current entity, then it's used
188
-		if ( 0 < $relation_instances ) {
188
+		if (0 < $relation_instances) {
189 189
 			return true;
190 190
 		}
191 191
 
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
 		$stmt = $wpdb->prepare(
194 194
 			"SELECT COUNT(*) FROM $wpdb->postmeta WHERE post_id != %d AND meta_value = %s",
195 195
 			$entity->ID,
196
-			wl_get_entity_uri( $entity->ID )
196
+			wl_get_entity_uri($entity->ID)
197 197
 		);
198 198
 		// Perform the query
199
-		$meta_instances = (int) $wpdb->get_var( $stmt );
199
+		$meta_instances = (int) $wpdb->get_var($stmt);
200 200
 
201 201
 		// If there is at least one meta that refers the current entity uri, then current entity is used
202
-		if ( 0 < $meta_instances ) {
202
+		if (0 < $meta_instances) {
203 203
 			return true;
204 204
 		}
205 205
 
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 	 *
217 217
 	 * @return true if the uri internal to the current dataset otherwise false.
218 218
 	 */
219
-	public function is_internal_uri( $uri ) {
219
+	public function is_internal_uri($uri) {
220 220
 
221
-		return ( 0 === strrpos( $uri, wl_configuration_get_redlink_dataset_uri() ) );
221
+		return (0 === strrpos($uri, wl_configuration_get_redlink_dataset_uri()));
222 222
 	}
223 223
 
224 224
 	/**
@@ -230,12 +230,12 @@  discard block
 block discarded – undo
230 230
 	 *
231 231
 	 * @return WP_Post|null A WP_Post instance or null if not found.
232 232
 	 */
233
-	public function get_entity_post_by_uri( $uri ) {
233
+	public function get_entity_post_by_uri($uri) {
234 234
 
235
-		$this->log->trace( "Getting an entity post for URI $uri..." );
235
+		$this->log->trace("Getting an entity post for URI $uri...");
236 236
 
237 237
 		// Check if we've been provided with a value otherwise return null.
238
-		if ( empty( $uri ) ) {
238
+		if (empty($uri)) {
239 239
 			return null;
240 240
 		}
241 241
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 		// performed also looking at sameAs values.
278 278
 		//
279 279
 		// This solve issues like https://github.com/insideout10/wordlift-plugin/issues/237
280
-		if ( ! $this->is_internal_uri( $uri ) ) {
280
+		if ( ! $this->is_internal_uri($uri)) {
281 281
 
282 282
 			$query_args['meta_query']['relation'] = 'OR';
283 283
 			$query_args['meta_query'][]           = array(
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 			);
288 288
 		}
289 289
 
290
-		$posts = get_posts( $query_args );
290
+		$posts = get_posts($query_args);
291 291
 
292 292
 //		$query = new WP_Query( $query_args );
293 293
 //
@@ -295,14 +295,14 @@  discard block
 block discarded – undo
295 295
 //		$posts = $query->get_posts();
296 296
 
297 297
 		// Return null if no post is found.
298
-		if ( 0 === count( $posts ) ) {
299
-			$this->log->warn( "No post for URI $uri." );
298
+		if (0 === count($posts)) {
299
+			$this->log->warn("No post for URI $uri.");
300 300
 
301 301
 			return null;
302 302
 		}
303 303
 
304 304
 		// Return the found post.
305
-		return current( $posts );
305
+		return current($posts);
306 306
 	}
307 307
 
308 308
 	/**
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
 	 * @param WP_Post $post    Post object.
318 318
 	 * @param bool    $update  Whether this is an existing post being updated or not.
319 319
 	 */
320
-	public function save_post( $post_id, $post, $update ) {
320
+	public function save_post($post_id, $post, $update) {
321 321
 
322 322
 		// Avoid doing anything if post is autosave or a revision.
323
-		if ( wp_is_post_autosave( $post ) || wp_is_post_revision( $post ) ) {
323
+		if (wp_is_post_autosave($post) || wp_is_post_revision($post)) {
324 324
 			return;
325 325
 		}
326 326
 
@@ -330,15 +330,15 @@  discard block
 block discarded – undo
330 330
 		// the $post_id in the save_post call matches the post id set in the request.
331 331
 		//
332 332
 		// If this is not the current post being saved or if it's not an entity, return.
333
-		if ( ! isset( $_REQUEST['post_ID'] ) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity( $post_id ) ) {
333
+		if ( ! isset($_REQUEST['post_ID']) || $_REQUEST['post_ID'] != $post_id || ! $this->is_entity($post_id)) {
334 334
 			return;
335 335
 		}
336 336
 
337 337
 		// Get the alt labels from the request (or empty array).
338
-		$alt_labels = isset( $_REQUEST['wl_alternative_label'] ) ? $_REQUEST['wl_alternative_label'] : array();
338
+		$alt_labels = isset($_REQUEST['wl_alternative_label']) ? $_REQUEST['wl_alternative_label'] : array();
339 339
 
340 340
 		// Set the alternative labels.
341
-		$this->set_alternative_labels( $post_id, $alt_labels );
341
+		$this->set_alternative_labels($post_id, $alt_labels);
342 342
 
343 343
 	}
344 344
 
@@ -350,22 +350,22 @@  discard block
 block discarded – undo
350 350
 	 * @param int   $post_id    The post id.
351 351
 	 * @param array $alt_labels An array of labels.
352 352
 	 */
353
-	public function set_alternative_labels( $post_id, $alt_labels ) {
353
+	public function set_alternative_labels($post_id, $alt_labels) {
354 354
 
355 355
 		// Force $alt_labels to be an array
356
-		if ( ! is_array( $alt_labels ) ) {
357
-			$alt_labels = array( $alt_labels );
356
+		if ( ! is_array($alt_labels)) {
357
+			$alt_labels = array($alt_labels);
358 358
 		}
359 359
 
360
-		$this->log->debug( "Setting alternative labels [ post id :: $post_id ][ alt labels :: " . implode( ',', $alt_labels ) . " ]" );
360
+		$this->log->debug("Setting alternative labels [ post id :: $post_id ][ alt labels :: ".implode(',', $alt_labels)." ]");
361 361
 
362 362
 		// Delete all the existing alternate labels.
363
-		delete_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
363
+		delete_post_meta($post_id, self::ALTERNATIVE_LABEL_META_KEY);
364 364
 
365 365
 		// Set the alternative labels.
366
-		foreach ( $alt_labels as $alt_label ) {
367
-			if ( ! empty( $alt_label ) ) {
368
-				add_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label );
366
+		foreach ($alt_labels as $alt_label) {
367
+			if ( ! empty($alt_label)) {
368
+				add_post_meta($post_id, self::ALTERNATIVE_LABEL_META_KEY, $alt_label);
369 369
 			}
370 370
 		}
371 371
 
@@ -380,9 +380,9 @@  discard block
 block discarded – undo
380 380
 	 *
381 381
 	 * @return mixed An array  of alternative labels.
382 382
 	 */
383
-	public function get_alternative_labels( $post_id ) {
383
+	public function get_alternative_labels($post_id) {
384 384
 
385
-		return get_post_meta( $post_id, self::ALTERNATIVE_LABEL_META_KEY );
385
+		return get_post_meta($post_id, self::ALTERNATIVE_LABEL_META_KEY);
386 386
 	}
387 387
 
388 388
 	/**
@@ -394,9 +394,9 @@  discard block
 block discarded – undo
394 394
 	 *
395 395
 	 * @return array An array with the entity title and labels.
396 396
 	 */
397
-	public function get_labels( $post_id ) {
397
+	public function get_labels($post_id) {
398 398
 
399
-		return array_merge( (array) get_the_title( $post_id ), $this->get_alternative_labels( $post_id ) );
399
+		return array_merge((array) get_the_title($post_id), $this->get_alternative_labels($post_id));
400 400
 	}
401 401
 
402 402
 	/**
@@ -406,25 +406,25 @@  discard block
 block discarded – undo
406 406
 	 *
407 407
 	 * @param WP_Post $post Post object.
408 408
 	 */
409
-	public function edit_form_before_permalink( $post ) {
409
+	public function edit_form_before_permalink($post) {
410 410
 
411 411
 		// If it's not an entity, return.
412
-		if ( ! $this->is_entity( $post->ID ) ) {
412
+		if ( ! $this->is_entity($post->ID)) {
413 413
 			return;
414 414
 		}
415 415
 
416 416
 		// Print the input template.
417
-		$this->ui_service->print_template( 'wl-tmpl-alternative-label-input', $this->get_alternative_label_input() );
417
+		$this->ui_service->print_template('wl-tmpl-alternative-label-input', $this->get_alternative_label_input());
418 418
 
419 419
 		// Print all the currently set alternative labels.
420
-		foreach ( $this->get_alternative_labels( $post->ID ) as $alt_label ) {
420
+		foreach ($this->get_alternative_labels($post->ID) as $alt_label) {
421 421
 
422
-			echo $this->get_alternative_label_input( $alt_label );
422
+			echo $this->get_alternative_label_input($alt_label);
423 423
 
424 424
 		};
425 425
 
426 426
 		// Print the button.
427
-		$this->ui_service->print_button( 'wl-add-alternative-labels-button', __( 'Add more titles', 'wordlift' ) );
427
+		$this->ui_service->print_button('wl-add-alternative-labels-button', __('Add more titles', 'wordlift'));
428 428
 
429 429
 	}
430 430
 
@@ -437,25 +437,25 @@  discard block
 block discarded – undo
437 437
 	 *
438 438
 	 * @return null|string The entity URI or NULL if not found or the dataset URI is not configured.
439 439
 	 */
440
-	public function get_uri( $post_id ) {
440
+	public function get_uri($post_id) {
441 441
 
442 442
 		// If a null is given, nothing to do
443
-		if ( null == $post_id ) {
443
+		if (null == $post_id) {
444 444
 			return null;
445 445
 		}
446 446
 
447
-		$uri = get_post_meta( $post_id, WL_ENTITY_URL_META_NAME, true );
447
+		$uri = get_post_meta($post_id, WL_ENTITY_URL_META_NAME, true);
448 448
 
449 449
 		// If the dataset uri is not properly configured, null is returned
450
-		if ( '' === wl_configuration_get_redlink_dataset_uri() ) {
450
+		if ('' === wl_configuration_get_redlink_dataset_uri()) {
451 451
 			return null;
452 452
 		}
453 453
 
454 454
 		// Set the URI if it isn't set yet.
455
-		$post_status = get_post_status( $post_id );
456
-		if ( empty( $uri ) && 'auto-draft' !== $post_status && 'revision' !== $post_status ) {
457
-			$uri = wl_build_entity_uri( $post_id );
458
-			wl_set_entity_uri( $post_id, $uri );
455
+		$post_status = get_post_status($post_id);
456
+		if (empty($uri) && 'auto-draft' !== $post_status && 'revision' !== $post_status) {
457
+			$uri = wl_build_entity_uri($post_id);
458
+			wl_set_entity_uri($post_id, $uri);
459 459
 		}
460 460
 
461 461
 		return $uri;
@@ -471,9 +471,9 @@  discard block
 block discarded – undo
471 471
 	 *
472 472
 	 * @return string The input HTML code.
473 473
 	 */
474
-	private function get_alternative_label_input( $value = '' ) {
474
+	private function get_alternative_label_input($value = '') {
475 475
 
476
-		return sprintf( self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr( $value ), __( 'Delete', 'wordlift' ) );
476
+		return sprintf(self::ALTERNATIVE_LABEL_INPUT_TEMPLATE, esc_attr($value), __('Delete', 'wordlift'));
477 477
 	}
478 478
 
479 479
 	/**
@@ -485,12 +485,12 @@  discard block
 block discarded – undo
485 485
 	 */
486 486
 	public function count() {
487 487
 
488
-		$posts = get_posts( $this->add_criterias( array(
488
+		$posts = get_posts($this->add_criterias(array(
489 489
 			'post_status' => 'any',
490
-			'numberposts' => - 1,
491
-		) ) );
490
+			'numberposts' => -1,
491
+		)));
492 492
 
493
-		return count( $posts );
493
+		return count($posts);
494 494
 	}
495 495
 
496 496
 	/**
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 	 *
504 504
 	 * @return array The arguments for a `get_posts` call.
505 505
 	 */
506
-	public static function add_criterias( $args ) {
506
+	public static function add_criterias($args) {
507 507
 
508 508
 		// Build an optimal tax-query.
509 509
 		$tax_query = array(
@@ -573,28 +573,28 @@  discard block
 block discarded – undo
573 573
 	 *
574 574
 	 * @return int|WP_Error The entity post id or a {@link WP_Error} in case the `wp_insert_post` call fails.
575 575
 	 */
576
-	public function create( $name, $type_uri, $logo = null, $status = 'publish' ) {
576
+	public function create($name, $type_uri, $logo = null, $status = 'publish') {
577 577
 
578 578
 		// Create an entity for the publisher.
579
-		$post_id = wp_insert_post( array(
579
+		$post_id = wp_insert_post(array(
580 580
 			'post_type'    => self::TYPE_NAME,
581 581
 			'post_title'   => $name,
582 582
 			'post_status'  => $status,
583 583
 			'post_content' => '',
584
-		) );
584
+		));
585 585
 
586 586
 		// Return the error if any.
587
-		if ( is_wp_error( $post_id ) ) {
587
+		if (is_wp_error($post_id)) {
588 588
 			return $post_id;
589 589
 		}
590 590
 
591 591
 		// Set the entity logo.
592
-		if ( $logo && is_numeric( $logo ) ) {
593
-			set_post_thumbnail( $post_id, $logo );
592
+		if ($logo && is_numeric($logo)) {
593
+			set_post_thumbnail($post_id, $logo);
594 594
 		}
595 595
 
596 596
 		// Set the entity type.
597
-		Wordlift_Entity_Type_Service::get_instance()->set( $post_id, $type_uri );
597
+		Wordlift_Entity_Type_Service::get_instance()->set($post_id, $type_uri);
598 598
 
599 599
 		return $post_id;
600 600
 	}
@@ -610,9 +610,9 @@  discard block
 block discarded – undo
610 610
 	 *
611 611
 	 * @return array An array of post ids.
612 612
 	 */
613
-	public function get_related_entities( $id, $post_status = 'publish' ) {
613
+	public function get_related_entities($id, $post_status = 'publish') {
614 614
 
615
-		return $this->relation_service->get_objects( $id, 'ids', null, $post_status );
615
+		return $this->relation_service->get_objects($id, 'ids', null, $post_status);
616 616
 	}
617 617
 
618 618
 	/**
@@ -624,16 +624,16 @@  discard block
 block discarded – undo
624 624
 	 *
625 625
 	 * @return array An array of entity posts.
626 626
 	 */
627
-	public function get( $params = array() ) {
627
+	public function get($params = array()) {
628 628
 
629 629
 		// Set the defaults.
630
-		$defaults = array( 'post_type' => 'entity' );
630
+		$defaults = array('post_type' => 'entity');
631 631
 
632 632
 		// Merge the defaults with the provided parameters.
633
-		$args = wp_parse_args( $params, $defaults );
633
+		$args = wp_parse_args($params, $defaults);
634 634
 
635 635
 		// Call the `get_posts` function.
636
-		return get_posts( $args );
636
+		return get_posts($args);
637 637
 	}
638 638
 
639 639
 	/**
@@ -649,9 +649,9 @@  discard block
 block discarded – undo
649 649
 	static function valid_entity_post_types() {
650 650
 
651 651
 		// Ignore builtins in the call to avoid getting attachments.
652
-		$post_types = array( 'post', 'page', self::TYPE_NAME );
652
+		$post_types = array('post', 'page', self::TYPE_NAME);
653 653
 
654
-		return apply_filters( 'wl_valid_entity_post_types', $post_types );
654
+		return apply_filters('wl_valid_entity_post_types', $post_types);
655 655
 	}
656 656
 
657 657
 }
Please login to merge, or discard this patch.
src/includes/class-wordlift.php 2 patches
Indentation   +1431 added lines, -1431 removed lines patch added patch discarded remove patch
@@ -28,1475 +28,1475 @@
 block discarded – undo
28 28
  */
29 29
 class Wordlift {
30 30
 
31
-	/**
32
-	 * The loader that's responsible for maintaining and registering all hooks that power
33
-	 * the plugin.
34
-	 *
35
-	 * @since    1.0.0
36
-	 * @access   protected
37
-	 * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
38
-	 */
39
-	protected $loader;
40
-
41
-	/**
42
-	 * The unique identifier of this plugin.
43
-	 *
44
-	 * @since    1.0.0
45
-	 * @access   protected
46
-	 * @var      string $plugin_name The string used to uniquely identify this plugin.
47
-	 */
48
-	protected $plugin_name;
49
-
50
-	/**
51
-	 * The current version of the plugin.
52
-	 *
53
-	 * @since    1.0.0
54
-	 * @access   protected
55
-	 * @var      string $version The current version of the plugin.
56
-	 */
57
-	protected $version;
58
-
59
-	/**
60
-	 * The {@link Wordlift_Tinymce_Adapter} instance.
61
-	 *
62
-	 * @since  3.12.0
63
-	 * @access protected
64
-	 * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
65
-	 */
66
-	protected $tinymce_adapter;
67
-
68
-	/**
69
-	 * The Thumbnail service.
70
-	 *
71
-	 * @since  3.1.5
72
-	 * @access private
73
-	 * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
74
-	 */
75
-	private $thumbnail_service;
76
-
77
-	/**
78
-	 * The UI service.
79
-	 *
80
-	 * @since  3.2.0
81
-	 * @access private
82
-	 * @var \Wordlift_UI_Service $ui_service The UI service.
83
-	 */
84
-	private $ui_service;
85
-
86
-	/**
87
-	 * The Schema service.
88
-	 *
89
-	 * @since  3.3.0
90
-	 * @access protected
91
-	 * @var \Wordlift_Schema_Service $schema_service The Schema service.
92
-	 */
93
-	protected $schema_service;
94
-
95
-	/**
96
-	 * The Entity service.
97
-	 *
98
-	 * @since  3.1.0
99
-	 * @access protected
100
-	 * @var \Wordlift_Entity_Service $entity_service The Entity service.
101
-	 */
102
-	protected $entity_service;
103
-
104
-	/**
105
-	 * The Topic Taxonomy service.
106
-	 *
107
-	 * @since  3.5.0
108
-	 * @access private
109
-	 * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
110
-	 */
111
-	private $topic_taxonomy_service;
112
-
113
-	/**
114
-	 * The User service.
115
-	 *
116
-	 * @since  3.1.7
117
-	 * @access protected
118
-	 * @var \Wordlift_User_Service $user_service The User service.
119
-	 */
120
-	protected $user_service;
121
-
122
-	/**
123
-	 * The Timeline service.
124
-	 *
125
-	 * @since  3.1.0
126
-	 * @access private
127
-	 * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
128
-	 */
129
-	private $timeline_service;
130
-
131
-	/**
132
-	 * The Redirect service.
133
-	 *
134
-	 * @since  3.2.0
135
-	 * @access private
136
-	 * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
137
-	 */
138
-	private $redirect_service;
139
-
140
-	/**
141
-	 * The Notice service.
142
-	 *
143
-	 * @since  3.3.0
144
-	 * @access private
145
-	 * @var \Wordlift_Notice_Service $notice_service The Notice service.
146
-	 */
147
-	private $notice_service;
148
-
149
-	/**
150
-	 * The Entity list customization.
151
-	 *
152
-	 * @since  3.3.0
153
-	 * @access protected
154
-	 * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
155
-	 */
156
-	protected $entity_list_service;
157
-
158
-	/**
159
-	 * The Entity Types Taxonomy Walker.
160
-	 *
161
-	 * @since  3.1.0
162
-	 * @access private
163
-	 * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
164
-	 */
165
-	private $entity_types_taxonomy_walker;
166
-
167
-	/**
168
-	 * The ShareThis service.
169
-	 *
170
-	 * @since  3.2.0
171
-	 * @access private
172
-	 * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
173
-	 */
174
-	private $sharethis_service;
175
-
176
-	/**
177
-	 * The PrimaShop adapter.
178
-	 *
179
-	 * @since  3.2.3
180
-	 * @access private
181
-	 * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
182
-	 */
183
-	private $primashop_adapter;
184
-
185
-	/**
186
-	 * The WordLift Dashboard adapter.
187
-	 *
188
-	 * @since  3.4.0
189
-	 * @access private
190
-	 * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
191
-	 */
192
-	private $dashboard_service;
193
-
194
-	/**
195
-	 * The entity type service.
196
-	 *
197
-	 * @since  3.6.0
198
-	 * @access private
199
-	 * @var \Wordlift_Entity_Post_Type_Service
200
-	 */
201
-	private $entity_post_type_service;
202
-
203
-	/**
204
-	 * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
205
-	 *
206
-	 * @since  3.6.0
207
-	 * @access private
208
-	 * @var \Wordlift_Entity_Link_Service
209
-	 */
210
-	private $entity_link_service;
211
-
212
-	/**
213
-	 * A {@link Wordlift_Sparql_Service} instance.
214
-	 *
215
-	 * @since    3.6.0
216
-	 * @access   protected
217
-	 * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
218
-	 */
219
-	protected $sparql_service;
220
-
221
-	/**
222
-	 * A {@link Wordlift_Import_Service} instance.
223
-	 *
224
-	 * @since  3.6.0
225
-	 * @access private
226
-	 * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
227
-	 */
228
-	private $import_service;
229
-
230
-	/**
231
-	 * A {@link Wordlift_Rebuild_Service} instance.
232
-	 *
233
-	 * @since  3.6.0
234
-	 * @access private
235
-	 * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
236
-	 */
237
-	private $rebuild_service;
238
-
239
-	/**
240
-	 * A {@link Wordlift_Jsonld_Service} instance.
241
-	 *
242
-	 * @since  3.7.0
243
-	 * @access protected
244
-	 * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
245
-	 */
246
-	protected $jsonld_service;
247
-
248
-	/**
249
-	 * A {@link Wordlift_Website_Jsonld_Converter} instance.
250
-	 *
251
-	 * @since  3.14.0
252
-	 * @access protected
253
-	 * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance.
254
-	 */
255
-	protected $jsonld_website_converter;
256
-
257
-	/**
258
-	 * A {@link Wordlift_Property_Factory} instance.
259
-	 *
260
-	 * @since  3.7.0
261
-	 * @access private
262
-	 * @var \Wordlift_Property_Factory $property_factory
263
-	 */
264
-	private $property_factory;
265
-
266
-	/**
267
-	 * The 'Download Your Data' page.
268
-	 *
269
-	 * @since  3.6.0
270
-	 * @access private
271
-	 * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
272
-	 */
273
-	private $download_your_data_page;
274
-
275
-	/**
276
-	 * The 'WordLift Settings' page.
277
-	 *
278
-	 * @since  3.11.0
279
-	 * @access protected
280
-	 * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
281
-	 */
282
-	protected $settings_page;
283
-
284
-	/**
285
-	 * The 'WordLift Batch analysis' page.
286
-	 *
287
-	 * @since  3.14.0
288
-	 * @access protected
289
-	 * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page.
290
-	 */
291
-	protected $batch_analysis_page;
292
-
293
-	/**
294
-	 * The install wizard page.
295
-	 *
296
-	 * @since  3.9.0
297
-	 * @access private
298
-	 * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
299
-	 */
300
-	private $admin_setup;
301
-
302
-	/**
303
-	 * The Content Filter Service hooks up to the 'the_content' filter and provides
304
-	 * linking of entities to their pages.
305
-	 *
306
-	 * @since  3.8.0
307
-	 * @access private
308
-	 * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
309
-	 */
310
-	private $content_filter_service;
311
-
312
-	/**
313
-	 * A {@link Wordlift_Key_Validation_Service} instance.
314
-	 *
315
-	 * @since  3.9.0
316
-	 * @access private
317
-	 * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
318
-	 */
319
-	private $key_validation_service;
320
-
321
-	/**
322
-	 * A {@link Wordlift_Rating_Service} instance.
323
-	 *
324
-	 * @since  3.10.0
325
-	 * @access private
326
-	 * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
327
-	 */
328
-	private $rating_service;
329
-
330
-	/**
331
-	 * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
332
-	 *
333
-	 * @since  3.10.0
334
-	 * @access protected
335
-	 * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
336
-	 */
337
-	protected $post_to_jsonld_converter;
338
-
339
-	/**
340
-	 * A {@link Wordlift_Configuration_Service} instance.
341
-	 *
342
-	 * @since  3.10.0
343
-	 * @access protected
344
-	 * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
345
-	 */
346
-	protected $configuration_service;
347
-
348
-	/**
349
-	 * A {@link Wordlift_Entity_Type_Service} instance.
350
-	 *
351
-	 * @since  3.10.0
352
-	 * @access protected
353
-	 * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
354
-	 */
355
-	protected $entity_type_service;
356
-
357
-	/**
358
-	 * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
359
-	 *
360
-	 * @since  3.10.0
361
-	 * @access protected
362
-	 * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
363
-	 */
364
-	protected $entity_post_to_jsonld_converter;
365
-
366
-	/**
367
-	 * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
368
-	 *
369
-	 * @since  3.10.0
370
-	 * @access protected
371
-	 * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
372
-	 */
373
-	protected $postid_to_jsonld_converter;
374
-
375
-	/**
376
-	 * The {@link Wordlift_Admin_Status_Page} class.
377
-	 *
378
-	 * @since  3.9.8
379
-	 * @access private
380
-	 * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
381
-	 */
382
-	private $status_page;
383
-
384
-	/**
385
-	 * The {@link Wordlift_Category_Taxonomy_Service} instance.
386
-	 *
387
-	 * @since  3.11.0
388
-	 * @access protected
389
-	 * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
390
-	 */
391
-	protected $category_taxonomy_service;
392
-
393
-	/**
394
-	 * The {@link Wordlift_Entity_Page_Service} instance.
395
-	 *
396
-	 * @since  3.11.0
397
-	 * @access protected
398
-	 * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance.
399
-	 */
400
-	protected $entity_page_service;
401
-
402
-	/**
403
-	 * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
404
-	 *
405
-	 * @since  3.11.0
406
-	 * @access protected
407
-	 * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
408
-	 */
409
-	protected $settings_page_action_link;
410
-
411
-	/**
412
-	 * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
413
-	 *
414
-	 * @since  3.11.0
415
-	 * @access protected
416
-	 * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
417
-	 */
418
-	protected $publisher_ajax_adapter;
419
-
420
-	/**
421
-	 * The {@link Wordlift_Admin_Input_Element} element renderer.
422
-	 *
423
-	 * @since  3.11.0
424
-	 * @access protected
425
-	 * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
426
-	 */
427
-	protected $input_element;
428
-
429
-	/**
430
-	 * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
431
-	 *
432
-	 * @since  3.13.0
433
-	 * @access protected
434
-	 * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
435
-	 */
436
-	protected $radio_input_element;
437
-
438
-	/**
439
-	 * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
440
-	 *
441
-	 * @since  3.11.0
442
-	 * @access protected
443
-	 * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
444
-	 */
445
-	protected $language_select_element;
446
-
447
-	/**
448
-	 * The {@link Wordlift_Admin_Publisher_Element} element renderer.
449
-	 *
450
-	 * @since  3.11.0
451
-	 * @access protected
452
-	 * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
453
-	 */
454
-	protected $publisher_element;
455
-
456
-	/**
457
-	 * The {@link Wordlift_Admin_Select2_Element} element renderer.
458
-	 *
459
-	 * @since  3.11.0
460
-	 * @access protected
461
-	 * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
462
-	 */
463
-	protected $select2_element;
464
-
465
-	/**
466
-	 * The controller for the entity type list admin page
467
-	 *
468
-	 * @since  3.11.0
469
-	 * @access private
470
-	 * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
471
-	 */
472
-	private $entity_type_admin_page;
473
-
474
-	/**
475
-	 * The controller for the entity type settings admin page
476
-	 *
477
-	 * @since  3.11.0
478
-	 * @access private
479
-	 * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
480
-	 */
481
-	private $entity_type_settings_admin_page;
482
-
483
-	/**
484
-	 * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
485
-	 *
486
-	 * @since  3.11.0
487
-	 * @access protected
488
-	 * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
489
-	 */
490
-	protected $related_entities_cloud_widget;
491
-
492
-	/**
493
-	 * The {@link Wordlift_Admin_Author_Element} instance.
494
-	 *
495
-	 * @since  3.14.0
496
-	 * @access protected
497
-	 * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
498
-	 */
499
-	protected $author_element;
500
-
501
-	/**
502
-	 * The {@link Wordlift_Batch_Analysis_Service} instance.
503
-	 *
504
-	 * @since  3.14.0
505
-	 * @access protected
506
-	 * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance.
507
-	 */
508
-	protected $batch_analysis_service;
509
-
510
-	/**
511
-	 * The {@link Wordlift_Sample_Data_Service} instance.
512
-	 *
513
-	 * @since  3.12.0
514
-	 * @access protected
515
-	 * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
516
-	 */
517
-	protected $sample_data_service;
518
-
519
-	/**
520
-	 * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
521
-	 *
522
-	 * @since  3.12.0
523
-	 * @access protected
524
-	 * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
525
-	 */
526
-	protected $sample_data_ajax_adapter;
527
-
528
-	/**
529
-	 * The {@link Wordlift_Batch_Analysis_Adapter} instance.
530
-	 *
531
-	 * @since  3.14.2
532
-	 * @access protected
533
-	 * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance.
534
-	 */
535
-	private $batch_analysis_adapter;
536
-
537
-	/**
538
-	 * The {@link Wordlift_Relation_Rebuild_Service} instance.
539
-	 *
540
-	 * @since  3.14.3
541
-	 * @access private
542
-	 * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance.
543
-	 */
544
-	private $relation_rebuild_service;
545
-
546
-	/**
547
-	 * The {@link Wordlift_Relation_Rebuild_Adapter} instance.
548
-	 *
549
-	 * @since  3.14.3
550
-	 * @access private
551
-	 * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance.
552
-	 */
553
-	private $relation_rebuild_adapter;
554
-
555
-	/**
556
-	 * The {@link Wordlift_Google_Analytics_Export_Service} instance.
557
-	 *
558
-	 * @since  3.16.0
559
-	 * @access protected
560
-	 * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance.
561
-	 */
562
-	protected $google_analytics_export_service;
563
-
564
-	/**
565
-	 * {@link Wordlift}'s singleton instance.
566
-	 *
567
-	 * @since  3.15.0
568
-	 * @access protected
569
-	 * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance.
570
-	 */
571
-	protected $entity_type_adapter;
572
-
573
-	/**
574
-	 * The {@link Wordlift_Linked_Data_Service} instance.
575
-	 *
576
-	 * @since  3.15.0
577
-	 * @access protected
578
-	 * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance.
579
-	 */
580
-	protected $linked_data_service;
581
-
582
-	/**
583
-	 * The {@link Wordlift_Storage_Factory} instance.
584
-	 *
585
-	 * @since  3.15.0
586
-	 * @access protected
587
-	 * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance.
588
-	 */
589
-	protected $storage_factory;
590
-
591
-	/**
592
-	 * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
593
-	 *
594
-	 * @since  3.15.0
595
-	 * @access protected
596
-	 * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
597
-	 */
598
-	protected $rendition_factory;
599
-
600
-	/**
601
-	 * The {@link Wordlift_Autocomplete_Service} instance.
602
-	 *
603
-	 * @since  3.15.0
604
-	 * @access private
605
-	 * @var \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance.
606
-	 */
607
-	private $autocomplete_service;
608
-
609
-	/**
610
-	 * The {@link Wordlift_Autocomplete_Adapter} instance.
611
-	 *
612
-	 * @since  3.15.0
613
-	 * @access private
614
-	 * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance.
615
-	 */
616
-	private $autocomplete_adapter;
617
-
618
-	/**
619
-	 * The {@link Wordlift_Relation_Service} instance.
620
-	 *
621
-	 * @since  3.15.0
622
-	 * @access protected
623
-	 * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
624
-	 */
625
-	protected $relation_service;
626
-
627
-	/**
628
-	 * The {@link Wordlift_Cached_Post_Converter} instance.
629
-	 *
630
-	 * @since  3.16.0
631
-	 * @access protected
632
-	 * @var  \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance.
633
-	 *
634
-	 */
635
-	protected $cached_postid_to_jsonld_converter;
636
-
637
-	/**
638
-	 * The {@link Wordlift_File_Cache_Service} instance.
639
-	 *
640
-	 * @since  3.16.0
641
-	 * @access protected
642
-	 * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance.
643
-	 */
644
-	protected $file_cache_service;
645
-
646
-	/**
647
-	 * {@link Wordlift}'s singleton instance.
648
-	 *
649
-	 * @since  3.11.2
650
-	 * @access private
651
-	 * @var Wordlift $instance {@link Wordlift}'s singleton instance.
652
-	 */
653
-	private static $instance;
654
-
655
-
656
-	/**
657
-	 * Define the core functionality of the plugin.
658
-	 *
659
-	 * Set the plugin name and the plugin version that can be used throughout the plugin.
660
-	 * Load the dependencies, define the locale, and set the hooks for the admin area and
661
-	 * the public-facing side of the site.
662
-	 *
663
-	 * @since    1.0.0
664
-	 */
665
-	public function __construct() {
666
-
667
-		$this->plugin_name = 'wordlift';
668
-		$this->version     = '3.17.0-dev';
669
-		$this->load_dependencies();
670
-		$this->set_locale();
671
-		$this->define_admin_hooks();
672
-		$this->define_public_hooks();
673
-
674
-		self::$instance = $this;
675
-
676
-	}
677
-
678
-	/**
679
-	 * Get the singleton instance.
680
-	 *
681
-	 * @since 3.11.2
682
-	 *
683
-	 * @return Wordlift The {@link Wordlift} singleton instance.
684
-	 */
685
-	public static function get_instance() {
686
-
687
-		return self::$instance;
688
-	}
689
-
690
-	/**
691
-	 * Load the required dependencies for this plugin.
692
-	 *
693
-	 * Include the following files that make up the plugin:
694
-	 *
695
-	 * - Wordlift_Loader. Orchestrates the hooks of the plugin.
696
-	 * - Wordlift_i18n. Defines internationalization functionality.
697
-	 * - Wordlift_Admin. Defines all hooks for the admin area.
698
-	 * - Wordlift_Public. Defines all hooks for the public side of the site.
699
-	 *
700
-	 * Create an instance of the loader which will be used to register the hooks
701
-	 * with WordPress.
702
-	 *
703
-	 * @since    1.0.0
704
-	 * @access   private
705
-	 */
706
-	private function load_dependencies() {
707
-
708
-		/**
709
-		 * The class responsible for orchestrating the actions and filters of the
710
-		 * core plugin.
711
-		 */
712
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
713
-
714
-		/**
715
-		 * The class responsible for defining internationalization functionality
716
-		 * of the plugin.
717
-		 */
718
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
719
-
720
-		/**
721
-		 * WordLift's supported languages.
722
-		 */
723
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
724
-
725
-		/**
726
-		 * Provide support functions to sanitize data.
727
-		 */
728
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
729
-
730
-		/** Services. */
731
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
732
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
733
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
734
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
735
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
736
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
737
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
738
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
739
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
740
-
741
-		/**
742
-		 * The Query builder.
743
-		 */
744
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
745
-
746
-		/**
747
-		 * The Schema service.
748
-		 */
749
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
750
-
751
-		/**
752
-		 * The schema:url property service.
753
-		 */
754
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
755
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
756
-
757
-		/**
758
-		 * The UI service.
759
-		 */
760
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
761
-
762
-		/**
763
-		 * The Thumbnail service.
764
-		 */
765
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
766
-
767
-		/**
768
-		 * The Entity Types Taxonomy service.
769
-		 */
770
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
771
-
772
-		/**
773
-		 * The Entity service.
774
-		 */
775
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
776
-
777
-		// Add the entity rating service.
778
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
779
-
780
-		/**
781
-		 * The User service.
782
-		 */
783
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
784
-
785
-		/**
786
-		 * The Timeline service.
787
-		 */
788
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
789
-
790
-		/**
791
-		 * The Topic Taxonomy service.
792
-		 */
793
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
794
-
795
-		/**
796
-		 * The SPARQL service.
797
-		 */
798
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
799
-
800
-		/**
801
-		 * The WordLift import service.
802
-		 */
803
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
804
-
805
-		/**
806
-		 * The WordLift URI service.
807
-		 */
808
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
809
-
810
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php';
811
-
812
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
813
-
814
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
815
-
816
-		/**
817
-		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
818
-		 */
819
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php';
820
-
821
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
822
-
823
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
824
-
825
-		/**
826
-		 * Load the converters.
827
-		 */
828
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
829
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
830
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
831
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
832
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
833
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
834
-
835
-		/**
836
-		 * Load cache-related files.
837
-		 */
838
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
839
-
840
-		/**
841
-		 * Load the content filter.
842
-		 */
843
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
844
-
845
-		/*
31
+    /**
32
+     * The loader that's responsible for maintaining and registering all hooks that power
33
+     * the plugin.
34
+     *
35
+     * @since    1.0.0
36
+     * @access   protected
37
+     * @var      Wordlift_Loader $loader Maintains and registers all hooks for the plugin.
38
+     */
39
+    protected $loader;
40
+
41
+    /**
42
+     * The unique identifier of this plugin.
43
+     *
44
+     * @since    1.0.0
45
+     * @access   protected
46
+     * @var      string $plugin_name The string used to uniquely identify this plugin.
47
+     */
48
+    protected $plugin_name;
49
+
50
+    /**
51
+     * The current version of the plugin.
52
+     *
53
+     * @since    1.0.0
54
+     * @access   protected
55
+     * @var      string $version The current version of the plugin.
56
+     */
57
+    protected $version;
58
+
59
+    /**
60
+     * The {@link Wordlift_Tinymce_Adapter} instance.
61
+     *
62
+     * @since  3.12.0
63
+     * @access protected
64
+     * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance.
65
+     */
66
+    protected $tinymce_adapter;
67
+
68
+    /**
69
+     * The Thumbnail service.
70
+     *
71
+     * @since  3.1.5
72
+     * @access private
73
+     * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service.
74
+     */
75
+    private $thumbnail_service;
76
+
77
+    /**
78
+     * The UI service.
79
+     *
80
+     * @since  3.2.0
81
+     * @access private
82
+     * @var \Wordlift_UI_Service $ui_service The UI service.
83
+     */
84
+    private $ui_service;
85
+
86
+    /**
87
+     * The Schema service.
88
+     *
89
+     * @since  3.3.0
90
+     * @access protected
91
+     * @var \Wordlift_Schema_Service $schema_service The Schema service.
92
+     */
93
+    protected $schema_service;
94
+
95
+    /**
96
+     * The Entity service.
97
+     *
98
+     * @since  3.1.0
99
+     * @access protected
100
+     * @var \Wordlift_Entity_Service $entity_service The Entity service.
101
+     */
102
+    protected $entity_service;
103
+
104
+    /**
105
+     * The Topic Taxonomy service.
106
+     *
107
+     * @since  3.5.0
108
+     * @access private
109
+     * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service.
110
+     */
111
+    private $topic_taxonomy_service;
112
+
113
+    /**
114
+     * The User service.
115
+     *
116
+     * @since  3.1.7
117
+     * @access protected
118
+     * @var \Wordlift_User_Service $user_service The User service.
119
+     */
120
+    protected $user_service;
121
+
122
+    /**
123
+     * The Timeline service.
124
+     *
125
+     * @since  3.1.0
126
+     * @access private
127
+     * @var \Wordlift_Timeline_Service $timeline_service The Timeline service.
128
+     */
129
+    private $timeline_service;
130
+
131
+    /**
132
+     * The Redirect service.
133
+     *
134
+     * @since  3.2.0
135
+     * @access private
136
+     * @var \Wordlift_Redirect_Service $redirect_service The Redirect service.
137
+     */
138
+    private $redirect_service;
139
+
140
+    /**
141
+     * The Notice service.
142
+     *
143
+     * @since  3.3.0
144
+     * @access private
145
+     * @var \Wordlift_Notice_Service $notice_service The Notice service.
146
+     */
147
+    private $notice_service;
148
+
149
+    /**
150
+     * The Entity list customization.
151
+     *
152
+     * @since  3.3.0
153
+     * @access protected
154
+     * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service.
155
+     */
156
+    protected $entity_list_service;
157
+
158
+    /**
159
+     * The Entity Types Taxonomy Walker.
160
+     *
161
+     * @since  3.1.0
162
+     * @access private
163
+     * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker
164
+     */
165
+    private $entity_types_taxonomy_walker;
166
+
167
+    /**
168
+     * The ShareThis service.
169
+     *
170
+     * @since  3.2.0
171
+     * @access private
172
+     * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service.
173
+     */
174
+    private $sharethis_service;
175
+
176
+    /**
177
+     * The PrimaShop adapter.
178
+     *
179
+     * @since  3.2.3
180
+     * @access private
181
+     * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter.
182
+     */
183
+    private $primashop_adapter;
184
+
185
+    /**
186
+     * The WordLift Dashboard adapter.
187
+     *
188
+     * @since  3.4.0
189
+     * @access private
190
+     * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service;
191
+     */
192
+    private $dashboard_service;
193
+
194
+    /**
195
+     * The entity type service.
196
+     *
197
+     * @since  3.6.0
198
+     * @access private
199
+     * @var \Wordlift_Entity_Post_Type_Service
200
+     */
201
+    private $entity_post_type_service;
202
+
203
+    /**
204
+     * The entity link service used to mangle links to entities with a custom slug or even w/o a slug.
205
+     *
206
+     * @since  3.6.0
207
+     * @access private
208
+     * @var \Wordlift_Entity_Link_Service
209
+     */
210
+    private $entity_link_service;
211
+
212
+    /**
213
+     * A {@link Wordlift_Sparql_Service} instance.
214
+     *
215
+     * @since    3.6.0
216
+     * @access   protected
217
+     * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance.
218
+     */
219
+    protected $sparql_service;
220
+
221
+    /**
222
+     * A {@link Wordlift_Import_Service} instance.
223
+     *
224
+     * @since  3.6.0
225
+     * @access private
226
+     * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance.
227
+     */
228
+    private $import_service;
229
+
230
+    /**
231
+     * A {@link Wordlift_Rebuild_Service} instance.
232
+     *
233
+     * @since  3.6.0
234
+     * @access private
235
+     * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance.
236
+     */
237
+    private $rebuild_service;
238
+
239
+    /**
240
+     * A {@link Wordlift_Jsonld_Service} instance.
241
+     *
242
+     * @since  3.7.0
243
+     * @access protected
244
+     * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance.
245
+     */
246
+    protected $jsonld_service;
247
+
248
+    /**
249
+     * A {@link Wordlift_Website_Jsonld_Converter} instance.
250
+     *
251
+     * @since  3.14.0
252
+     * @access protected
253
+     * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance.
254
+     */
255
+    protected $jsonld_website_converter;
256
+
257
+    /**
258
+     * A {@link Wordlift_Property_Factory} instance.
259
+     *
260
+     * @since  3.7.0
261
+     * @access private
262
+     * @var \Wordlift_Property_Factory $property_factory
263
+     */
264
+    private $property_factory;
265
+
266
+    /**
267
+     * The 'Download Your Data' page.
268
+     *
269
+     * @since  3.6.0
270
+     * @access private
271
+     * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page.
272
+     */
273
+    private $download_your_data_page;
274
+
275
+    /**
276
+     * The 'WordLift Settings' page.
277
+     *
278
+     * @since  3.11.0
279
+     * @access protected
280
+     * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page.
281
+     */
282
+    protected $settings_page;
283
+
284
+    /**
285
+     * The 'WordLift Batch analysis' page.
286
+     *
287
+     * @since  3.14.0
288
+     * @access protected
289
+     * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page.
290
+     */
291
+    protected $batch_analysis_page;
292
+
293
+    /**
294
+     * The install wizard page.
295
+     *
296
+     * @since  3.9.0
297
+     * @access private
298
+     * @var \Wordlift_Admin_Setup $admin_setup The Install wizard.
299
+     */
300
+    private $admin_setup;
301
+
302
+    /**
303
+     * The Content Filter Service hooks up to the 'the_content' filter and provides
304
+     * linking of entities to their pages.
305
+     *
306
+     * @since  3.8.0
307
+     * @access private
308
+     * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance.
309
+     */
310
+    private $content_filter_service;
311
+
312
+    /**
313
+     * A {@link Wordlift_Key_Validation_Service} instance.
314
+     *
315
+     * @since  3.9.0
316
+     * @access private
317
+     * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance.
318
+     */
319
+    private $key_validation_service;
320
+
321
+    /**
322
+     * A {@link Wordlift_Rating_Service} instance.
323
+     *
324
+     * @since  3.10.0
325
+     * @access private
326
+     * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance.
327
+     */
328
+    private $rating_service;
329
+
330
+    /**
331
+     * A {@link Wordlift_Post_To_Jsonld_Converter} instance.
332
+     *
333
+     * @since  3.10.0
334
+     * @access protected
335
+     * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance.
336
+     */
337
+    protected $post_to_jsonld_converter;
338
+
339
+    /**
340
+     * A {@link Wordlift_Configuration_Service} instance.
341
+     *
342
+     * @since  3.10.0
343
+     * @access protected
344
+     * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance.
345
+     */
346
+    protected $configuration_service;
347
+
348
+    /**
349
+     * A {@link Wordlift_Entity_Type_Service} instance.
350
+     *
351
+     * @since  3.10.0
352
+     * @access protected
353
+     * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance.
354
+     */
355
+    protected $entity_type_service;
356
+
357
+    /**
358
+     * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
359
+     *
360
+     * @since  3.10.0
361
+     * @access protected
362
+     * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance.
363
+     */
364
+    protected $entity_post_to_jsonld_converter;
365
+
366
+    /**
367
+     * A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
368
+     *
369
+     * @since  3.10.0
370
+     * @access protected
371
+     * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance.
372
+     */
373
+    protected $postid_to_jsonld_converter;
374
+
375
+    /**
376
+     * The {@link Wordlift_Admin_Status_Page} class.
377
+     *
378
+     * @since  3.9.8
379
+     * @access private
380
+     * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class.
381
+     */
382
+    private $status_page;
383
+
384
+    /**
385
+     * The {@link Wordlift_Category_Taxonomy_Service} instance.
386
+     *
387
+     * @since  3.11.0
388
+     * @access protected
389
+     * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance.
390
+     */
391
+    protected $category_taxonomy_service;
392
+
393
+    /**
394
+     * The {@link Wordlift_Entity_Page_Service} instance.
395
+     *
396
+     * @since  3.11.0
397
+     * @access protected
398
+     * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance.
399
+     */
400
+    protected $entity_page_service;
401
+
402
+    /**
403
+     * The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
404
+     *
405
+     * @since  3.11.0
406
+     * @access protected
407
+     * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class.
408
+     */
409
+    protected $settings_page_action_link;
410
+
411
+    /**
412
+     * The {@link Wordlift_Publisher_Ajax_Adapter} instance.
413
+     *
414
+     * @since  3.11.0
415
+     * @access protected
416
+     * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance.
417
+     */
418
+    protected $publisher_ajax_adapter;
419
+
420
+    /**
421
+     * The {@link Wordlift_Admin_Input_Element} element renderer.
422
+     *
423
+     * @since  3.11.0
424
+     * @access protected
425
+     * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer.
426
+     */
427
+    protected $input_element;
428
+
429
+    /**
430
+     * The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
431
+     *
432
+     * @since  3.13.0
433
+     * @access protected
434
+     * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer.
435
+     */
436
+    protected $radio_input_element;
437
+
438
+    /**
439
+     * The {@link Wordlift_Admin_Language_Select_Element} element renderer.
440
+     *
441
+     * @since  3.11.0
442
+     * @access protected
443
+     * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer.
444
+     */
445
+    protected $language_select_element;
446
+
447
+    /**
448
+     * The {@link Wordlift_Admin_Publisher_Element} element renderer.
449
+     *
450
+     * @since  3.11.0
451
+     * @access protected
452
+     * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer.
453
+     */
454
+    protected $publisher_element;
455
+
456
+    /**
457
+     * The {@link Wordlift_Admin_Select2_Element} element renderer.
458
+     *
459
+     * @since  3.11.0
460
+     * @access protected
461
+     * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer.
462
+     */
463
+    protected $select2_element;
464
+
465
+    /**
466
+     * The controller for the entity type list admin page
467
+     *
468
+     * @since  3.11.0
469
+     * @access private
470
+     * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class.
471
+     */
472
+    private $entity_type_admin_page;
473
+
474
+    /**
475
+     * The controller for the entity type settings admin page
476
+     *
477
+     * @since  3.11.0
478
+     * @access private
479
+     * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class.
480
+     */
481
+    private $entity_type_settings_admin_page;
482
+
483
+    /**
484
+     * The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
485
+     *
486
+     * @since  3.11.0
487
+     * @access protected
488
+     * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance.
489
+     */
490
+    protected $related_entities_cloud_widget;
491
+
492
+    /**
493
+     * The {@link Wordlift_Admin_Author_Element} instance.
494
+     *
495
+     * @since  3.14.0
496
+     * @access protected
497
+     * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance.
498
+     */
499
+    protected $author_element;
500
+
501
+    /**
502
+     * The {@link Wordlift_Batch_Analysis_Service} instance.
503
+     *
504
+     * @since  3.14.0
505
+     * @access protected
506
+     * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance.
507
+     */
508
+    protected $batch_analysis_service;
509
+
510
+    /**
511
+     * The {@link Wordlift_Sample_Data_Service} instance.
512
+     *
513
+     * @since  3.12.0
514
+     * @access protected
515
+     * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance.
516
+     */
517
+    protected $sample_data_service;
518
+
519
+    /**
520
+     * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
521
+     *
522
+     * @since  3.12.0
523
+     * @access protected
524
+     * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance.
525
+     */
526
+    protected $sample_data_ajax_adapter;
527
+
528
+    /**
529
+     * The {@link Wordlift_Batch_Analysis_Adapter} instance.
530
+     *
531
+     * @since  3.14.2
532
+     * @access protected
533
+     * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance.
534
+     */
535
+    private $batch_analysis_adapter;
536
+
537
+    /**
538
+     * The {@link Wordlift_Relation_Rebuild_Service} instance.
539
+     *
540
+     * @since  3.14.3
541
+     * @access private
542
+     * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance.
543
+     */
544
+    private $relation_rebuild_service;
545
+
546
+    /**
547
+     * The {@link Wordlift_Relation_Rebuild_Adapter} instance.
548
+     *
549
+     * @since  3.14.3
550
+     * @access private
551
+     * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance.
552
+     */
553
+    private $relation_rebuild_adapter;
554
+
555
+    /**
556
+     * The {@link Wordlift_Google_Analytics_Export_Service} instance.
557
+     *
558
+     * @since  3.16.0
559
+     * @access protected
560
+     * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance.
561
+     */
562
+    protected $google_analytics_export_service;
563
+
564
+    /**
565
+     * {@link Wordlift}'s singleton instance.
566
+     *
567
+     * @since  3.15.0
568
+     * @access protected
569
+     * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance.
570
+     */
571
+    protected $entity_type_adapter;
572
+
573
+    /**
574
+     * The {@link Wordlift_Linked_Data_Service} instance.
575
+     *
576
+     * @since  3.15.0
577
+     * @access protected
578
+     * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance.
579
+     */
580
+    protected $linked_data_service;
581
+
582
+    /**
583
+     * The {@link Wordlift_Storage_Factory} instance.
584
+     *
585
+     * @since  3.15.0
586
+     * @access protected
587
+     * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance.
588
+     */
589
+    protected $storage_factory;
590
+
591
+    /**
592
+     * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
593
+     *
594
+     * @since  3.15.0
595
+     * @access protected
596
+     * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance.
597
+     */
598
+    protected $rendition_factory;
599
+
600
+    /**
601
+     * The {@link Wordlift_Autocomplete_Service} instance.
602
+     *
603
+     * @since  3.15.0
604
+     * @access private
605
+     * @var \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance.
606
+     */
607
+    private $autocomplete_service;
608
+
609
+    /**
610
+     * The {@link Wordlift_Autocomplete_Adapter} instance.
611
+     *
612
+     * @since  3.15.0
613
+     * @access private
614
+     * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance.
615
+     */
616
+    private $autocomplete_adapter;
617
+
618
+    /**
619
+     * The {@link Wordlift_Relation_Service} instance.
620
+     *
621
+     * @since  3.15.0
622
+     * @access protected
623
+     * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance.
624
+     */
625
+    protected $relation_service;
626
+
627
+    /**
628
+     * The {@link Wordlift_Cached_Post_Converter} instance.
629
+     *
630
+     * @since  3.16.0
631
+     * @access protected
632
+     * @var  \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance.
633
+     *
634
+     */
635
+    protected $cached_postid_to_jsonld_converter;
636
+
637
+    /**
638
+     * The {@link Wordlift_File_Cache_Service} instance.
639
+     *
640
+     * @since  3.16.0
641
+     * @access protected
642
+     * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance.
643
+     */
644
+    protected $file_cache_service;
645
+
646
+    /**
647
+     * {@link Wordlift}'s singleton instance.
648
+     *
649
+     * @since  3.11.2
650
+     * @access private
651
+     * @var Wordlift $instance {@link Wordlift}'s singleton instance.
652
+     */
653
+    private static $instance;
654
+
655
+
656
+    /**
657
+     * Define the core functionality of the plugin.
658
+     *
659
+     * Set the plugin name and the plugin version that can be used throughout the plugin.
660
+     * Load the dependencies, define the locale, and set the hooks for the admin area and
661
+     * the public-facing side of the site.
662
+     *
663
+     * @since    1.0.0
664
+     */
665
+    public function __construct() {
666
+
667
+        $this->plugin_name = 'wordlift';
668
+        $this->version     = '3.17.0-dev';
669
+        $this->load_dependencies();
670
+        $this->set_locale();
671
+        $this->define_admin_hooks();
672
+        $this->define_public_hooks();
673
+
674
+        self::$instance = $this;
675
+
676
+    }
677
+
678
+    /**
679
+     * Get the singleton instance.
680
+     *
681
+     * @since 3.11.2
682
+     *
683
+     * @return Wordlift The {@link Wordlift} singleton instance.
684
+     */
685
+    public static function get_instance() {
686
+
687
+        return self::$instance;
688
+    }
689
+
690
+    /**
691
+     * Load the required dependencies for this plugin.
692
+     *
693
+     * Include the following files that make up the plugin:
694
+     *
695
+     * - Wordlift_Loader. Orchestrates the hooks of the plugin.
696
+     * - Wordlift_i18n. Defines internationalization functionality.
697
+     * - Wordlift_Admin. Defines all hooks for the admin area.
698
+     * - Wordlift_Public. Defines all hooks for the public side of the site.
699
+     *
700
+     * Create an instance of the loader which will be used to register the hooks
701
+     * with WordPress.
702
+     *
703
+     * @since    1.0.0
704
+     * @access   private
705
+     */
706
+    private function load_dependencies() {
707
+
708
+        /**
709
+         * The class responsible for orchestrating the actions and filters of the
710
+         * core plugin.
711
+         */
712
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
713
+
714
+        /**
715
+         * The class responsible for defining internationalization functionality
716
+         * of the plugin.
717
+         */
718
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
719
+
720
+        /**
721
+         * WordLift's supported languages.
722
+         */
723
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
724
+
725
+        /**
726
+         * Provide support functions to sanitize data.
727
+         */
728
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
729
+
730
+        /** Services. */
731
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
732
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
733
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
734
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
735
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
736
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
737
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
738
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
739
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
740
+
741
+        /**
742
+         * The Query builder.
743
+         */
744
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
745
+
746
+        /**
747
+         * The Schema service.
748
+         */
749
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
750
+
751
+        /**
752
+         * The schema:url property service.
753
+         */
754
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
755
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
756
+
757
+        /**
758
+         * The UI service.
759
+         */
760
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
761
+
762
+        /**
763
+         * The Thumbnail service.
764
+         */
765
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
766
+
767
+        /**
768
+         * The Entity Types Taxonomy service.
769
+         */
770
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
771
+
772
+        /**
773
+         * The Entity service.
774
+         */
775
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
776
+
777
+        // Add the entity rating service.
778
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
779
+
780
+        /**
781
+         * The User service.
782
+         */
783
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
784
+
785
+        /**
786
+         * The Timeline service.
787
+         */
788
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
789
+
790
+        /**
791
+         * The Topic Taxonomy service.
792
+         */
793
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
794
+
795
+        /**
796
+         * The SPARQL service.
797
+         */
798
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
799
+
800
+        /**
801
+         * The WordLift import service.
802
+         */
803
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
804
+
805
+        /**
806
+         * The WordLift URI service.
807
+         */
808
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
809
+
810
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php';
811
+
812
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
813
+
814
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
815
+
816
+        /**
817
+         * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
818
+         */
819
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php';
820
+
821
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
822
+
823
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
824
+
825
+        /**
826
+         * Load the converters.
827
+         */
828
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
829
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
830
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
831
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
832
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
833
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
834
+
835
+        /**
836
+         * Load cache-related files.
837
+         */
838
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
839
+
840
+        /**
841
+         * Load the content filter.
842
+         */
843
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
844
+
845
+        /*
846 846
 		 * Load the excerpt helper.
847 847
 		 */
848
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
849
-
850
-		/**
851
-		 * Load the JSON-LD service to publish entities using JSON-LD.s
852
-		 *
853
-		 * @since 3.8.0
854
-		 */
855
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
856
-
857
-		// The Publisher Service and the AJAX adapter.
858
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
859
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
860
-
861
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
862
-
863
-		/**
864
-		 * Load the WordLift key validation service.
865
-		 */
866
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
867
-
868
-		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
869
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
870
-
871
-		// Load the `Wordlift_Entity_Page_Service` class definition.
872
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
873
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-analysis-service.php';
874
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-rebuild-service.php';
875
-
876
-		/** Linked Data. */
877
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
878
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
879
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
880
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
881
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
882
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
883
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
884
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
885
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
886
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
887
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
888
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition.php';
889
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
890
-
891
-		/** Services. */
892
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
893
-
894
-		/** Adapters. */
895
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
896
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
897
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
898
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
899
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-analysis-adapter.php';
900
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-rebuild-adapter.php';
901
-
902
-		/** Async Tasks. */
903
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
904
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
905
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
906
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
907
-
908
-		/** Async Tasks. */
909
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php';
910
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
911
-
912
-		/**
913
-		 * The class responsible for defining all actions that occur in the admin area.
914
-		 */
915
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
916
-
917
-		/**
918
-		 * The class to customize the entity list admin page.
919
-		 */
920
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
921
-
922
-		/**
923
-		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
924
-		 */
925
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
926
-
927
-		/**
928
-		 * The Notice service.
929
-		 */
930
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
931
-
932
-		/**
933
-		 * The PrimaShop adapter.
934
-		 */
935
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
936
-
937
-		/**
938
-		 * The WordLift Dashboard service.
939
-		 */
940
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
941
-
942
-		/**
943
-		 * The admin 'Install wizard' page.
944
-		 */
945
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
946
-
947
-		/**
948
-		 * The WordLift entity type list admin page controller.
949
-		 */
950
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
951
-
952
-		/**
953
-		 * The WordLift entity type settings admin page controller.
954
-		 */
955
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
956
-
957
-		/**
958
-		 * The admin 'Download Your Data' page.
959
-		 */
960
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
961
-
962
-		/**
963
-		 * The admin 'WordLift Settings' page.
964
-		 */
965
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
966
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
967
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
968
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
969
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
970
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
971
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
972
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
973
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
974
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
975
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php';
976
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
977
-
978
-		/** Admin Pages */
979
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
980
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
981
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
982
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
983
-
984
-		/**
985
-		 * The class responsible for defining all actions that occur in the public-facing
986
-		 * side of the site.
987
-		 */
988
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
989
-
990
-		/**
991
-		 * The shortcode abstract class.
992
-		 */
993
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
994
-
995
-		/**
996
-		 * The Timeline shortcode.
997
-		 */
998
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
999
-
1000
-		/**
1001
-		 * The Navigator shortcode.
1002
-		 */
1003
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1004
-
1005
-		/**
1006
-		 * The chord shortcode.
1007
-		 */
1008
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1009
-
1010
-		/**
1011
-		 * The geomap shortcode.
1012
-		 */
1013
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1014
-
1015
-		/**
1016
-		 * The entity cloud shortcode.
1017
-		 */
1018
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1019
-
1020
-		/**
1021
-		 * The entity glossary shortcode.
1022
-		 */
1023
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1024
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1025
-
1026
-		/**
1027
-		 * The ShareThis service.
1028
-		 */
1029
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1030
-
1031
-		/**
1032
-		 * The SEO service.
1033
-		 */
1034
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1035
-
1036
-		/**
1037
-		 * The AMP service.
1038
-		 */
1039
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1040
-
1041
-		/** Widgets */
1042
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1043
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1044
-
1045
-		$this->loader = new Wordlift_Loader();
1046
-
1047
-		// Instantiate a global logger.
1048
-		global $wl_logger;
1049
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1050
-
1051
-		// Load the `wl-api` end-point.
1052
-		new Wordlift_Http_Api();
1053
-
1054
-		/** Services. */
1055
-		// Create the configuration service.
1056
-		$this->configuration_service = new Wordlift_Configuration_Service();
1057
-
1058
-		// Create an entity type service instance. It'll be later bound to the init action.
1059
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1060
-
1061
-		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1062
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1063
-
1064
-		// Create an instance of the UI service.
1065
-		$this->ui_service = new Wordlift_UI_Service();
1066
-
1067
-		// Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
1068
-		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
1069
-
1070
-		$this->sparql_service        = new Wordlift_Sparql_Service();
1071
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1072
-		$this->notice_service        = new Wordlift_Notice_Service();
1073
-		$this->relation_service      = new Wordlift_Relation_Service();
1074
-		$this->entity_service        = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service );
1075
-		$this->user_service          = new Wordlift_User_Service();
848
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
849
+
850
+        /**
851
+         * Load the JSON-LD service to publish entities using JSON-LD.s
852
+         *
853
+         * @since 3.8.0
854
+         */
855
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
856
+
857
+        // The Publisher Service and the AJAX adapter.
858
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
859
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
860
+
861
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
862
+
863
+        /**
864
+         * Load the WordLift key validation service.
865
+         */
866
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
867
+
868
+        // Load the `Wordlift_Category_Taxonomy_Service` class definition.
869
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
870
+
871
+        // Load the `Wordlift_Entity_Page_Service` class definition.
872
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
873
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-analysis-service.php';
874
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-rebuild-service.php';
875
+
876
+        /** Linked Data. */
877
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
878
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
879
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
880
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
881
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
882
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
883
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
884
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
885
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
886
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
887
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
888
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition.php';
889
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
890
+
891
+        /** Services. */
892
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
893
+
894
+        /** Adapters. */
895
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
896
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
897
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
898
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
899
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-analysis-adapter.php';
900
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-rebuild-adapter.php';
901
+
902
+        /** Async Tasks. */
903
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
904
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
905
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
906
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
907
+
908
+        /** Async Tasks. */
909
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php';
910
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
911
+
912
+        /**
913
+         * The class responsible for defining all actions that occur in the admin area.
914
+         */
915
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
916
+
917
+        /**
918
+         * The class to customize the entity list admin page.
919
+         */
920
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
921
+
922
+        /**
923
+         * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
924
+         */
925
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
926
+
927
+        /**
928
+         * The Notice service.
929
+         */
930
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
931
+
932
+        /**
933
+         * The PrimaShop adapter.
934
+         */
935
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
936
+
937
+        /**
938
+         * The WordLift Dashboard service.
939
+         */
940
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
941
+
942
+        /**
943
+         * The admin 'Install wizard' page.
944
+         */
945
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
946
+
947
+        /**
948
+         * The WordLift entity type list admin page controller.
949
+         */
950
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
951
+
952
+        /**
953
+         * The WordLift entity type settings admin page controller.
954
+         */
955
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
956
+
957
+        /**
958
+         * The admin 'Download Your Data' page.
959
+         */
960
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
961
+
962
+        /**
963
+         * The admin 'WordLift Settings' page.
964
+         */
965
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
966
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
967
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
968
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
969
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
970
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
971
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
972
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
973
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
974
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
975
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php';
976
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
977
+
978
+        /** Admin Pages */
979
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
980
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
981
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
982
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
983
+
984
+        /**
985
+         * The class responsible for defining all actions that occur in the public-facing
986
+         * side of the site.
987
+         */
988
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
989
+
990
+        /**
991
+         * The shortcode abstract class.
992
+         */
993
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
994
+
995
+        /**
996
+         * The Timeline shortcode.
997
+         */
998
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
999
+
1000
+        /**
1001
+         * The Navigator shortcode.
1002
+         */
1003
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1004
+
1005
+        /**
1006
+         * The chord shortcode.
1007
+         */
1008
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1009
+
1010
+        /**
1011
+         * The geomap shortcode.
1012
+         */
1013
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1014
+
1015
+        /**
1016
+         * The entity cloud shortcode.
1017
+         */
1018
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1019
+
1020
+        /**
1021
+         * The entity glossary shortcode.
1022
+         */
1023
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1024
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1025
+
1026
+        /**
1027
+         * The ShareThis service.
1028
+         */
1029
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1030
+
1031
+        /**
1032
+         * The SEO service.
1033
+         */
1034
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1035
+
1036
+        /**
1037
+         * The AMP service.
1038
+         */
1039
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1040
+
1041
+        /** Widgets */
1042
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1043
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1044
+
1045
+        $this->loader = new Wordlift_Loader();
1046
+
1047
+        // Instantiate a global logger.
1048
+        global $wl_logger;
1049
+        $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1050
+
1051
+        // Load the `wl-api` end-point.
1052
+        new Wordlift_Http_Api();
1053
+
1054
+        /** Services. */
1055
+        // Create the configuration service.
1056
+        $this->configuration_service = new Wordlift_Configuration_Service();
1057
+
1058
+        // Create an entity type service instance. It'll be later bound to the init action.
1059
+        $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1060
+
1061
+        // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1062
+        $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1063
+
1064
+        // Create an instance of the UI service.
1065
+        $this->ui_service = new Wordlift_UI_Service();
1066
+
1067
+        // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events.
1068
+        $this->thumbnail_service = new Wordlift_Thumbnail_Service();
1069
+
1070
+        $this->sparql_service        = new Wordlift_Sparql_Service();
1071
+        $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1072
+        $this->notice_service        = new Wordlift_Notice_Service();
1073
+        $this->relation_service      = new Wordlift_Relation_Service();
1074
+        $this->entity_service        = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service );
1075
+        $this->user_service          = new Wordlift_User_Service();
1076 1076
 
1077
-		// Instantiate the JSON-LD service.
1078
-		$property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1077
+        // Instantiate the JSON-LD service.
1078
+        $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1079 1079
 
1080
-		/** Linked Data. */
1081
-		$this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1082
-		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1080
+        /** Linked Data. */
1081
+        $this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1082
+        $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1083 1083
 
1084
-		$this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1084
+        $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1085 1085
 
1086
-		// Create a new instance of the Redirect service.
1087
-		$this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_service );
1088
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1089
-		$this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service );
1086
+        // Create a new instance of the Redirect service.
1087
+        $this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_service );
1088
+        $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1089
+        $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service );
1090 1090
 
1091
-		// Create a new instance of the Timeline service and Timeline shortcode.
1092
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1091
+        // Create a new instance of the Timeline service and Timeline shortcode.
1092
+        $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1093 1093
 
1094
-		$this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service );
1094
+        $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service );
1095 1095
 
1096
-		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1096
+        $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1097 1097
 
1098
-		$this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service();
1098
+        $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service();
1099 1099
 
1100
-		// Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1101
-		$this->sharethis_service = new Wordlift_ShareThis_Service();
1100
+        // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters.
1101
+        $this->sharethis_service = new Wordlift_ShareThis_Service();
1102 1102
 
1103
-		// Create an instance of the PrimaShop adapter.
1104
-		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1103
+        // Create an instance of the PrimaShop adapter.
1104
+        $this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1105 1105
 
1106
-		// Create an import service instance to hook later to WP's import function.
1107
-		$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() );
1106
+        // Create an import service instance to hook later to WP's import function.
1107
+        $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() );
1108 1108
 
1109
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1109
+        $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1110 1110
 
1111
-		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
1112
-		$this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service );
1111
+        // Create a Rebuild Service instance, which we'll later bound to an ajax call.
1112
+        $this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service );
1113 1113
 
1114
-		// Create the entity rating service.
1115
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1114
+        // Create the entity rating service.
1115
+        $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1116 1116
 
1117
-		// Create entity list customization (wp-admin/edit.php).
1118
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1117
+        // Create entity list customization (wp-admin/edit.php).
1118
+        $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1119 1119
 
1120
-		// Create a new instance of the Redirect service.
1121
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1120
+        // Create a new instance of the Redirect service.
1121
+        $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1122 1122
 
1123
-		// Create an instance of the Publisher Service and the AJAX Adapter.
1124
-		$publisher_service      = new Wordlift_Publisher_Service();
1125
-		$this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service );
1126
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1123
+        // Create an instance of the Publisher Service and the AJAX Adapter.
1124
+        $publisher_service      = new Wordlift_Publisher_Service();
1125
+        $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service );
1126
+        $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1127 1127
 
1128
-		$attachment_service = new Wordlift_Attachment_Service();
1128
+        $attachment_service = new Wordlift_Attachment_Service();
1129 1129
 
1130
-		// Instantiate the JSON-LD service.
1131
-		$property_getter                         = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1132
-		$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 );
1133
-		$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 );
1134
-		$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 );
1135
-		$this->jsonld_website_converter          = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1136
-		$this->file_cache_service                = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' );
1137
-		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service );
1138
-		$this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1130
+        // Instantiate the JSON-LD service.
1131
+        $property_getter                         = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1132
+        $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 );
1133
+        $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 );
1134
+        $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 );
1135
+        $this->jsonld_website_converter          = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1136
+        $this->file_cache_service                = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' );
1137
+        $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service );
1138
+        $this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1139 1139
 
1140 1140
 
1141
-		$this->key_validation_service   = new Wordlift_Key_Validation_Service( $this->configuration_service );
1142
-		$this->content_filter_service   = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service );
1143
-		$this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1144
-		$this->sample_data_service      = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1145
-		$this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1141
+        $this->key_validation_service   = new Wordlift_Key_Validation_Service( $this->configuration_service );
1142
+        $this->content_filter_service   = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service );
1143
+        $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1144
+        $this->sample_data_service      = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1145
+        $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1146 1146
 
1147
-		// Initialize the shortcodes.
1148
-		new Wordlift_Navigator_Shortcode();
1149
-		new Wordlift_Chord_Shortcode();
1150
-		new Wordlift_Geomap_Shortcode();
1151
-		new Wordlift_Timeline_Shortcode();
1152
-		new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1153
-		new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1147
+        // Initialize the shortcodes.
1148
+        new Wordlift_Navigator_Shortcode();
1149
+        new Wordlift_Chord_Shortcode();
1150
+        new Wordlift_Geomap_Shortcode();
1151
+        new Wordlift_Timeline_Shortcode();
1152
+        new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1153
+        new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1154 1154
 
1155
-		// Initialize the SEO service.
1156
-		new Wordlift_Seo_Service();
1155
+        // Initialize the SEO service.
1156
+        new Wordlift_Seo_Service();
1157 1157
 
1158
-		// Initialize the AMP service.
1159
-		new Wordlift_AMP_Service();
1158
+        // Initialize the AMP service.
1159
+        new Wordlift_AMP_Service();
1160 1160
 
1161
-		/** Services. */
1162
-		$this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1161
+        /** Services. */
1162
+        $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1163 1163
 
1164
-		/** Adapters. */
1165
-		$this->entity_type_adapter      = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1166
-		$this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter( $publisher_service );
1167
-		$this->tinymce_adapter          = new Wordlift_Tinymce_Adapter( $this );
1168
-		$this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service );
1169
-		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1164
+        /** Adapters. */
1165
+        $this->entity_type_adapter      = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1166
+        $this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter( $publisher_service );
1167
+        $this->tinymce_adapter          = new Wordlift_Tinymce_Adapter( $this );
1168
+        $this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service );
1169
+        $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1170 1170
 
1171
-		/** Async Tasks. */
1172
-		new Wordlift_Sparql_Query_Async_Task();
1173
-		new Wordlift_Batch_Analysis_Request_Async_Task();
1174
-		new Wordlift_Batch_Analysis_Complete_Async_Task();
1171
+        /** Async Tasks. */
1172
+        new Wordlift_Sparql_Query_Async_Task();
1173
+        new Wordlift_Batch_Analysis_Request_Async_Task();
1174
+        new Wordlift_Batch_Analysis_Complete_Async_Task();
1175 1175
 
1176
-		/** WL Autocomplete. */
1177
-		$this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service );
1178
-		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service );
1176
+        /** WL Autocomplete. */
1177
+        $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service );
1178
+        $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service );
1179 1179
 
1180
-		/** WordPress Admin UI. */
1180
+        /** WordPress Admin UI. */
1181 1181
 
1182
-		// UI elements.
1183
-		$this->input_element           = new Wordlift_Admin_Input_Element();
1184
-		$this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1185
-		$this->select2_element         = new Wordlift_Admin_Select2_Element();
1186
-		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1187
-		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
1188
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element );
1189
-		$this->author_element          = new Wordlift_Admin_Author_Element( $publisher_service, $this->select2_element );
1182
+        // UI elements.
1183
+        $this->input_element           = new Wordlift_Admin_Input_Element();
1184
+        $this->radio_input_element     = new Wordlift_Admin_Radio_Input_Element();
1185
+        $this->select2_element         = new Wordlift_Admin_Select2_Element();
1186
+        $this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1187
+        $tabs_element                  = new Wordlift_Admin_Tabs_Element();
1188
+        $this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element );
1189
+        $this->author_element          = new Wordlift_Admin_Author_Element( $publisher_service, $this->select2_element );
1190 1190
 
1191
-		$this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element );
1192
-		$this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service );
1193
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1191
+        $this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element );
1192
+        $this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service );
1193
+        $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1194 1194
 
1195
-		// Pages.
1196
-		new Wordlift_Admin_Post_Edit_Page( $this );
1197
-		new Wordlift_Entity_Type_Admin_Service();
1198
-
1199
-		// create an instance of the entity type list admin page controller.
1200
-		$this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1201
-
1202
-		// create an instance of the entity type etting admin page controller.
1203
-		$this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1204
-
1205
-		/** Widgets */
1206
-		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1207
-
1208
-		/* WordPress Admin. */
1209
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1210
-		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1211
-
1212
-		// Create an instance of the install wizard.
1213
-		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1214
-
1215
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1216
-
1217
-		// User Profile.
1218
-		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1219
-
1220
-		$this->entity_page_service = new Wordlift_Entity_Page_Service();
1221
-
1222
-		// Load the debug service if WP is in debug mode.
1223
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1224
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1225
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1226
-		}
1227
-
1228
-	}
1229
-
1230
-	/**
1231
-	 * Define the locale for this plugin for internationalization.
1232
-	 *
1233
-	 * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1234
-	 * with WordPress.
1235
-	 *
1236
-	 * @since    1.0.0
1237
-	 * @access   private
1238
-	 */
1239
-	private function set_locale() {
1240
-
1241
-		$plugin_i18n = new Wordlift_i18n();
1242
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1243
-
1244
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1245
-
1246
-	}
1247
-
1248
-	/**
1249
-	 * Register all of the hooks related to the admin area functionality
1250
-	 * of the plugin.
1251
-	 *
1252
-	 * @since    1.0.0
1253
-	 * @access   private
1254
-	 */
1255
-	private function define_admin_hooks() {
1256
-
1257
-		$plugin_admin = new Wordlift_Admin(
1258
-			$this->get_plugin_name(),
1259
-			$this->get_version(),
1260
-			$this->configuration_service,
1261
-			$this->notice_service,
1262
-			$this->user_service
1263
-		);
1264
-
1265
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1266
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1267
-
1268
-		// Hook the init action to the Topic Taxonomy service.
1269
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1270
-
1271
-		// Hook the deleted_post_meta action to the Thumbnail service.
1272
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1273
-
1274
-		// Hook the added_post_meta action to the Thumbnail service.
1275
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1276
-
1277
-		// Hook the updated_post_meta action to the Thumbnail service.
1278
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1279
-
1280
-		// Hook the AJAX wl_timeline action to the Timeline service.
1281
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1282
-
1283
-		// Register custom allowed redirect hosts.
1284
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1285
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1286
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1287
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1288
-		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1289
-		// Hook the AJAX wordlift_redirect action to the Redirect service.
1290
-		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1291
-
1292
-		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1293
-		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1294
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1295
-		$this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1296
-
1297
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1298
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1299
-
1300
-		// Entity listing customization (wp-admin/edit.php)
1301
-		// Add custom columns.
1302
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1303
-		// no explicit entity as it prevents handling of other post types.
1304
-		$this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1305
-		// Add 4W selection.
1306
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1307
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1308
-		$this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1309
-		$this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1310
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1311
-
1312
-		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1313
-		// entities.
1314
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1315
-
1316
-		// Filter imported post meta.
1317
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1318
-
1319
-		// Notify the import service when an import starts and ends.
1320
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1321
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1322
-
1323
-		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1324
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1325
-
1326
-		// Hook the menu to the Download Your Data page.
1327
-		$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1328
-		$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1329
-		$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1330
-
1331
-		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1332
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1333
-
1334
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1335
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1336
-
1337
-		// Hook the AJAX wl_validate_key action to the Key Validation service.
1338
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1339
-
1340
-		// Hook the `admin_init` function to the Admin Setup.
1341
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1342
-
1343
-		// Hook the admin_init to the settings page.
1344
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1345
-
1346
-		// Hook the menu creation on the general wordlift menu creation.
1347
-		$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1348
-		if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) {
1349
-			// Add the functionality only if a flag is set in wp-config.php .
1350
-			$this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 );
1351
-		}
1352
-
1353
-		// Hook key update.
1354
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1355
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1356
-
1357
-		// Add additional action links to the WordLift plugin in the plugins page.
1358
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1359
-
1360
-		// Hook the AJAX `wl_publisher` action name.
1361
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1362
-
1363
-		// Hook row actions for the entity type list admin.
1364
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1365
-
1366
-		/** Ajax actions. */
1367
-		$this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1368
-
1369
-		// Hook capabilities manipulation to allow access to entity type admin
1370
-		// page  on WordPress versions before 4.7.
1371
-		global $wp_version;
1372
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1373
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1374
-		}
1375
-
1376
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1377
-
1378
-		/** Adapters. */
1379
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1380
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_auto_selected_posts', $this->batch_analysis_adapter, 'submit_auto_selected_posts', 10 );
1381
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_all_posts', $this->batch_analysis_adapter, 'submit_all_posts', 10 );
1382
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit', 10 );
1383
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel', 10 );
1384
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning', 10 );
1385
-		$this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all', 10 );
1386
-
1387
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1388
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1389
-
1390
-		// Handle the autocomplete request.
1391
-		add_action( 'wp_ajax_wl_autocomplete', array(
1392
-			$this->autocomplete_adapter,
1393
-			'wl_autocomplete',
1394
-		) );
1395
-		add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1396
-			$this->autocomplete_adapter,
1397
-			'wl_autocomplete',
1398
-		) );
1399
-
1400
-		// Hooks to restrict multisite super admin from manipulating entity types.
1401
-		if ( is_multisite() ) {
1402
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1403
-		}
1404
-
1405
-	}
1406
-
1407
-	/**
1408
-	 * Register all of the hooks related to the public-facing functionality
1409
-	 * of the plugin.
1410
-	 *
1411
-	 * @since    1.0.0
1412
-	 * @access   private
1413
-	 */
1414
-	private function define_public_hooks() {
1195
+        // Pages.
1196
+        new Wordlift_Admin_Post_Edit_Page( $this );
1197
+        new Wordlift_Entity_Type_Admin_Service();
1198
+
1199
+        // create an instance of the entity type list admin page controller.
1200
+        $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page();
1201
+
1202
+        // create an instance of the entity type etting admin page controller.
1203
+        $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings();
1204
+
1205
+        /** Widgets */
1206
+        $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1207
+
1208
+        /* WordPress Admin. */
1209
+        $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1210
+        $this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1211
+
1212
+        // Create an instance of the install wizard.
1213
+        $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1214
+
1215
+        $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1216
+
1217
+        // User Profile.
1218
+        new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1219
+
1220
+        $this->entity_page_service = new Wordlift_Entity_Page_Service();
1221
+
1222
+        // Load the debug service if WP is in debug mode.
1223
+        if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1224
+            require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1225
+            new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1226
+        }
1227
+
1228
+    }
1229
+
1230
+    /**
1231
+     * Define the locale for this plugin for internationalization.
1232
+     *
1233
+     * Uses the Wordlift_i18n class in order to set the domain and to register the hook
1234
+     * with WordPress.
1235
+     *
1236
+     * @since    1.0.0
1237
+     * @access   private
1238
+     */
1239
+    private function set_locale() {
1240
+
1241
+        $plugin_i18n = new Wordlift_i18n();
1242
+        $plugin_i18n->set_domain( $this->get_plugin_name() );
1243
+
1244
+        $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1245
+
1246
+    }
1247
+
1248
+    /**
1249
+     * Register all of the hooks related to the admin area functionality
1250
+     * of the plugin.
1251
+     *
1252
+     * @since    1.0.0
1253
+     * @access   private
1254
+     */
1255
+    private function define_admin_hooks() {
1256
+
1257
+        $plugin_admin = new Wordlift_Admin(
1258
+            $this->get_plugin_name(),
1259
+            $this->get_version(),
1260
+            $this->configuration_service,
1261
+            $this->notice_service,
1262
+            $this->user_service
1263
+        );
1264
+
1265
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1266
+        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1267
+
1268
+        // Hook the init action to the Topic Taxonomy service.
1269
+        $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1270
+
1271
+        // Hook the deleted_post_meta action to the Thumbnail service.
1272
+        $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1273
+
1274
+        // Hook the added_post_meta action to the Thumbnail service.
1275
+        $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1276
+
1277
+        // Hook the updated_post_meta action to the Thumbnail service.
1278
+        $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1279
+
1280
+        // Hook the AJAX wl_timeline action to the Timeline service.
1281
+        $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1282
+
1283
+        // Register custom allowed redirect hosts.
1284
+        $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1285
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1286
+        $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1287
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1288
+        $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1289
+        // Hook the AJAX wordlift_redirect action to the Redirect service.
1290
+        $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1291
+
1292
+        // Hook save_post to the entity service to update custom fields (such as alternate labels).
1293
+        // We have a priority of 9 because we want to be executed before data is sent to Redlink.
1294
+        $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1295
+        $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1296
+
1297
+        $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1298
+        $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1299
+
1300
+        // Entity listing customization (wp-admin/edit.php)
1301
+        // Add custom columns.
1302
+        $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1303
+        // no explicit entity as it prevents handling of other post types.
1304
+        $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1305
+        // Add 4W selection.
1306
+        $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1307
+        $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1308
+        $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1309
+        $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1310
+        $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1311
+
1312
+        // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1313
+        // entities.
1314
+        $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1315
+
1316
+        // Filter imported post meta.
1317
+        $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1318
+
1319
+        // Notify the import service when an import starts and ends.
1320
+        $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1321
+        $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1322
+
1323
+        // Hook the AJAX wl_rebuild action to the Rebuild Service.
1324
+        $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1325
+
1326
+        // Hook the menu to the Download Your Data page.
1327
+        $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1328
+        $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1329
+        $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1330
+
1331
+        // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1332
+        $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1333
+
1334
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1335
+        $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1336
+
1337
+        // Hook the AJAX wl_validate_key action to the Key Validation service.
1338
+        $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1339
+
1340
+        // Hook the `admin_init` function to the Admin Setup.
1341
+        $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1342
+
1343
+        // Hook the admin_init to the settings page.
1344
+        $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1345
+
1346
+        // Hook the menu creation on the general wordlift menu creation.
1347
+        $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1348
+        if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) {
1349
+            // Add the functionality only if a flag is set in wp-config.php .
1350
+            $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 );
1351
+        }
1352
+
1353
+        // Hook key update.
1354
+        $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1355
+        $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1356
+
1357
+        // Add additional action links to the WordLift plugin in the plugins page.
1358
+        $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1359
+
1360
+        // Hook the AJAX `wl_publisher` action name.
1361
+        $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1362
+
1363
+        // Hook row actions for the entity type list admin.
1364
+        $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1365
+
1366
+        /** Ajax actions. */
1367
+        $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1368
+
1369
+        // Hook capabilities manipulation to allow access to entity type admin
1370
+        // page  on WordPress versions before 4.7.
1371
+        global $wp_version;
1372
+        if ( version_compare( $wp_version, '4.7', '<' ) ) {
1373
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1374
+        }
1375
+
1376
+        $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1377
+
1378
+        /** Adapters. */
1379
+        $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1380
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_auto_selected_posts', $this->batch_analysis_adapter, 'submit_auto_selected_posts', 10 );
1381
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_all_posts', $this->batch_analysis_adapter, 'submit_all_posts', 10 );
1382
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit', 10 );
1383
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel', 10 );
1384
+        $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning', 10 );
1385
+        $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all', 10 );
1386
+
1387
+        $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1388
+        $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1389
+
1390
+        // Handle the autocomplete request.
1391
+        add_action( 'wp_ajax_wl_autocomplete', array(
1392
+            $this->autocomplete_adapter,
1393
+            'wl_autocomplete',
1394
+        ) );
1395
+        add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1396
+            $this->autocomplete_adapter,
1397
+            'wl_autocomplete',
1398
+        ) );
1399
+
1400
+        // Hooks to restrict multisite super admin from manipulating entity types.
1401
+        if ( is_multisite() ) {
1402
+            $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1403
+        }
1404
+
1405
+    }
1406
+
1407
+    /**
1408
+     * Register all of the hooks related to the public-facing functionality
1409
+     * of the plugin.
1410
+     *
1411
+     * @since    1.0.0
1412
+     * @access   private
1413
+     */
1414
+    private function define_public_hooks() {
1415 1415
 
1416
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1417
-
1418
-		// Register the entity post type.
1419
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1420
-
1421
-		// Bind the link generation and handling hooks to the entity link service.
1422
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1423
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1424
-		$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 );
1425
-		$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 );
1426
-
1427
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1428
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1429
-
1430
-		// Hook the content filter service to add entity links.
1431
-		$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1432
-
1433
-		// Hook the AJAX wl_timeline action to the Timeline service.
1434
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1435
-
1436
-		// Hook the ShareThis service.
1437
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1438
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1439
-
1440
-		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1441
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1442
-
1443
-		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1444
-		// in order to tweak WP's `WP_Query` to include entities in queries related
1445
-		// to categories.
1446
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1447
-
1448
-		/*
1416
+        $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1417
+
1418
+        // Register the entity post type.
1419
+        $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1420
+
1421
+        // Bind the link generation and handling hooks to the entity link service.
1422
+        $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1423
+        $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1424
+        $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 );
1425
+        $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 );
1426
+
1427
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1428
+        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1429
+
1430
+        // Hook the content filter service to add entity links.
1431
+        $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1432
+
1433
+        // Hook the AJAX wl_timeline action to the Timeline service.
1434
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1435
+
1436
+        // Hook the ShareThis service.
1437
+        $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1438
+        $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1439
+
1440
+        // Hook the AJAX wl_jsonld action to the JSON-LD service.
1441
+        $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1442
+
1443
+        // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1444
+        // in order to tweak WP's `WP_Query` to include entities in queries related
1445
+        // to categories.
1446
+        $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1447
+
1448
+        /*
1449 1449
 		 * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service`
1450 1450
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1451 1451
 		 * order of start time.
1452 1452
 		 */
1453
-		$this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1454
-
1455
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1456
-
1457
-		// This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1458
-		$this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1459
-
1460
-	}
1461
-
1462
-	/**
1463
-	 * Run the loader to execute all of the hooks with WordPress.
1464
-	 *
1465
-	 * @since    1.0.0
1466
-	 */
1467
-	public function run() {
1468
-		$this->loader->run();
1469
-	}
1470
-
1471
-	/**
1472
-	 * The name of the plugin used to uniquely identify it within the context of
1473
-	 * WordPress and to define internationalization functionality.
1474
-	 *
1475
-	 * @since     1.0.0
1476
-	 * @return    string    The name of the plugin.
1477
-	 */
1478
-	public function get_plugin_name() {
1479
-		return $this->plugin_name;
1480
-	}
1481
-
1482
-	/**
1483
-	 * The reference to the class that orchestrates the hooks with the plugin.
1484
-	 *
1485
-	 * @since     1.0.0
1486
-	 * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1487
-	 */
1488
-	public function get_loader() {
1489
-		return $this->loader;
1490
-	}
1491
-
1492
-	/**
1493
-	 * Retrieve the version number of the plugin.
1494
-	 *
1495
-	 * @since     1.0.0
1496
-	 * @return    string    The version number of the plugin.
1497
-	 */
1498
-	public function get_version() {
1499
-		return $this->version;
1500
-	}
1453
+        $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1454
+
1455
+        $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1456
+
1457
+        // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1458
+        $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1459
+
1460
+    }
1461
+
1462
+    /**
1463
+     * Run the loader to execute all of the hooks with WordPress.
1464
+     *
1465
+     * @since    1.0.0
1466
+     */
1467
+    public function run() {
1468
+        $this->loader->run();
1469
+    }
1470
+
1471
+    /**
1472
+     * The name of the plugin used to uniquely identify it within the context of
1473
+     * WordPress and to define internationalization functionality.
1474
+     *
1475
+     * @since     1.0.0
1476
+     * @return    string    The name of the plugin.
1477
+     */
1478
+    public function get_plugin_name() {
1479
+        return $this->plugin_name;
1480
+    }
1481
+
1482
+    /**
1483
+     * The reference to the class that orchestrates the hooks with the plugin.
1484
+     *
1485
+     * @since     1.0.0
1486
+     * @return    Wordlift_Loader    Orchestrates the hooks of the plugin.
1487
+     */
1488
+    public function get_loader() {
1489
+        return $this->loader;
1490
+    }
1491
+
1492
+    /**
1493
+     * Retrieve the version number of the plugin.
1494
+     *
1495
+     * @since     1.0.0
1496
+     * @return    string    The version number of the plugin.
1497
+     */
1498
+    public function get_version() {
1499
+        return $this->version;
1500
+    }
1501 1501
 
1502 1502
 }
Please login to merge, or discard this patch.
Spacing   +259 added lines, -259 removed lines patch added patch discarded remove patch
@@ -709,344 +709,344 @@  discard block
 block discarded – undo
709 709
 		 * The class responsible for orchestrating the actions and filters of the
710 710
 		 * core plugin.
711 711
 		 */
712
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php';
712
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php';
713 713
 
714 714
 		/**
715 715
 		 * The class responsible for defining internationalization functionality
716 716
 		 * of the plugin.
717 717
 		 */
718
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php';
718
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php';
719 719
 
720 720
 		/**
721 721
 		 * WordLift's supported languages.
722 722
 		 */
723
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php';
723
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-languages.php';
724 724
 
725 725
 		/**
726 726
 		 * Provide support functions to sanitize data.
727 727
 		 */
728
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php';
728
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php';
729 729
 
730 730
 		/** Services. */
731
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php';
732
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php';
733
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php';
734
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php';
735
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php';
736
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php';
737
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php';
738
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php';
739
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php';
731
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php';
732
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-http-api.php';
733
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php';
734
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php';
735
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-type-service.php';
736
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php';
737
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php';
738
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-linked-data-service.php';
739
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-service.php';
740 740
 
741 741
 		/**
742 742
 		 * The Query builder.
743 743
 		 */
744
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php';
744
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php';
745 745
 
746 746
 		/**
747 747
 		 * The Schema service.
748 748
 		 */
749
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php';
749
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php';
750 750
 
751 751
 		/**
752 752
 		 * The schema:url property service.
753 753
 		 */
754
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php';
755
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php';
754
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php';
755
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php';
756 756
 
757 757
 		/**
758 758
 		 * The UI service.
759 759
 		 */
760
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php';
760
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php';
761 761
 
762 762
 		/**
763 763
 		 * The Thumbnail service.
764 764
 		 */
765
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php';
765
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php';
766 766
 
767 767
 		/**
768 768
 		 * The Entity Types Taxonomy service.
769 769
 		 */
770
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-types-taxonomy-service.php';
770
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-types-taxonomy-service.php';
771 771
 
772 772
 		/**
773 773
 		 * The Entity service.
774 774
 		 */
775
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php';
775
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php';
776 776
 
777 777
 		// Add the entity rating service.
778
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php';
778
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rating-service.php';
779 779
 
780 780
 		/**
781 781
 		 * The User service.
782 782
 		 */
783
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php';
783
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php';
784 784
 
785 785
 		/**
786 786
 		 * The Timeline service.
787 787
 		 */
788
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php';
788
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php';
789 789
 
790 790
 		/**
791 791
 		 * The Topic Taxonomy service.
792 792
 		 */
793
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php';
793
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php';
794 794
 
795 795
 		/**
796 796
 		 * The SPARQL service.
797 797
 		 */
798
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php';
798
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sparql-service.php';
799 799
 
800 800
 		/**
801 801
 		 * The WordLift import service.
802 802
 		 */
803
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php';
803
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-import-service.php';
804 804
 
805 805
 		/**
806 806
 		 * The WordLift URI service.
807 807
 		 */
808
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php';
808
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php';
809 809
 
810
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-listable.php';
810
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-listable.php';
811 811
 
812
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php';
812
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-factory.php';
813 813
 
814
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php';
814
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-service.php';
815 815
 
816 816
 		/**
817 817
 		 * The WordLift rebuild service, used to rebuild the remote dataset using the local data.
818 818
 		 */
819
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rebuild-service.php';
819
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rebuild-service.php';
820 820
 
821
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php';
821
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/properties/class-wordlift-property-getter-factory.php';
822 822
 
823
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php';
823
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-attachment-service.php';
824 824
 
825 825
 		/**
826 826
 		 * Load the converters.
827 827
 		 */
828
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php';
829
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
830
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php';
831
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php';
832
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php';
833
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php';
828
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/intf-wordlift-post-converter.php';
829
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-abstract-post-to-jsonld-converter.php';
830
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-postid-to-jsonld-converter.php';
831
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-to-jsonld-converter.php';
832
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-to-jsonld-converter.php';
833
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-website-converter.php';
834 834
 
835 835
 		/**
836 836
 		 * Load cache-related files.
837 837
 		 */
838
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php';
838
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/cache/require.php';
839 839
 
840 840
 		/**
841 841
 		 * Load the content filter.
842 842
 		 */
843
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php';
843
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-content-filter-service.php';
844 844
 
845 845
 		/*
846 846
 		 * Load the excerpt helper.
847 847
 		 */
848
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php';
848
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-excerpt-helper.php';
849 849
 
850 850
 		/**
851 851
 		 * Load the JSON-LD service to publish entities using JSON-LD.s
852 852
 		 *
853 853
 		 * @since 3.8.0
854 854
 		 */
855
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php';
855
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-service.php';
856 856
 
857 857
 		// The Publisher Service and the AJAX adapter.
858
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php';
859
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php';
858
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-service.php';
859
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-ajax-adapter.php';
860 860
 
861
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php';
861
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-adapter.php';
862 862
 
863 863
 		/**
864 864
 		 * Load the WordLift key validation service.
865 865
 		 */
866
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php';
866
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php';
867 867
 
868 868
 		// Load the `Wordlift_Category_Taxonomy_Service` class definition.
869
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php';
869
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php';
870 870
 
871 871
 		// Load the `Wordlift_Entity_Page_Service` class definition.
872
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php';
873
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-analysis-service.php';
874
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-rebuild-service.php';
872
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-page-service.php';
873
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-batch-analysis-service.php';
874
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-rebuild-service.php';
875 875
 
876 876
 		/** Linked Data. */
877
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php';
878
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
879
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php';
880
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
881
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
882
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php';
883
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
884
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php';
885
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php';
886
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php';
887
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php';
888
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition.php';
889
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
877
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage.php';
878
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-storage.php';
879
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-property-storage.php';
880
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php';
881
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php';
882
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-author-storage.php';
883
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php';
884
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-image-storage.php';
885
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-related-storage.php';
886
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-url-property-storage.php';
887
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage-factory.php';
888
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition.php';
889
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php';
890 890
 
891 891
 		/** Services. */
892
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php';
892
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-google-analytics-export-service.php';
893 893
 
894 894
 		/** Adapters. */
895
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php';
896
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php';
897
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php';
898
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php';
899
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-analysis-adapter.php';
900
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-rebuild-adapter.php';
895
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php';
896
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-newrelic-adapter.php';
897
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-ajax-adapter.php';
898
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-adapter.php';
899
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-batch-analysis-adapter.php';
900
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-rebuild-adapter.php';
901 901
 
902 902
 		/** Async Tasks. */
903
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php';
904
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
905
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
906
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
903
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-async-task.php';
904
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-sparql-query-async-task.php';
905
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php';
906
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php';
907 907
 
908 908
 		/** Async Tasks. */
909
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php';
910
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php';
909
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-service.php';
910
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-adapter.php';
911 911
 
912 912
 		/**
913 913
 		 * The class responsible for defining all actions that occur in the admin area.
914 914
 		 */
915
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php';
915
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php';
916 916
 
917 917
 		/**
918 918
 		 * The class to customize the entity list admin page.
919 919
 		 */
920
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php';
920
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php';
921 921
 
922 922
 		/**
923 923
 		 * The Entity Types Taxonomy Walker (transforms checkboxes into radios).
924 924
 		 */
925
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php';
925
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php';
926 926
 
927 927
 		/**
928 928
 		 * The Notice service.
929 929
 		 */
930
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php';
930
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php';
931 931
 
932 932
 		/**
933 933
 		 * The PrimaShop adapter.
934 934
 		 */
935
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php';
935
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php';
936 936
 
937 937
 		/**
938 938
 		 * The WordLift Dashboard service.
939 939
 		 */
940
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php';
940
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php';
941 941
 
942 942
 		/**
943 943
 		 * The admin 'Install wizard' page.
944 944
 		 */
945
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php';
945
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php';
946 946
 
947 947
 		/**
948 948
 		 * The WordLift entity type list admin page controller.
949 949
 		 */
950
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
950
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php';
951 951
 
952 952
 		/**
953 953
 		 * The WordLift entity type settings admin page controller.
954 954
 		 */
955
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php';
955
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php';
956 956
 
957 957
 		/**
958 958
 		 * The admin 'Download Your Data' page.
959 959
 		 */
960
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php';
960
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php';
961 961
 
962 962
 		/**
963 963
 		 * The admin 'WordLift Settings' page.
964 964
 		 */
965
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/intf-wordlift-admin-element.php';
966
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-element.php';
967
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-input-radio-element.php';
968
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-select2-element.php';
969
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-language-select-element.php';
970
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-tabs-element.php';
971
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-author-element.php';
972
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-publisher-element.php';
973
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php';
974
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php';
975
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php';
976
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php';
965
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/intf-wordlift-admin-element.php';
966
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-input-element.php';
967
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-input-radio-element.php';
968
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-select2-element.php';
969
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-language-select-element.php';
970
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-tabs-element.php';
971
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-author-element.php';
972
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-publisher-element.php';
973
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php';
974
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php';
975
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-batch-analysis-page.php';
976
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php';
977 977
 
978 978
 		/** Admin Pages */
979
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php';
980
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php';
981
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php';
982
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php';
979
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php';
980
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-user-profile-page.php';
981
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-status-page.php';
982
+		require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-admin-service.php';
983 983
 
984 984
 		/**
985 985
 		 * The class responsible for defining all actions that occur in the public-facing
986 986
 		 * side of the site.
987 987
 		 */
988
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php';
988
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php';
989 989
 
990 990
 		/**
991 991
 		 * The shortcode abstract class.
992 992
 		 */
993
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php';
993
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php';
994 994
 
995 995
 		/**
996 996
 		 * The Timeline shortcode.
997 997
 		 */
998
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php';
998
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php';
999 999
 
1000 1000
 		/**
1001 1001
 		 * The Navigator shortcode.
1002 1002
 		 */
1003
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php';
1003
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php';
1004 1004
 
1005 1005
 		/**
1006 1006
 		 * The chord shortcode.
1007 1007
 		 */
1008
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php';
1008
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php';
1009 1009
 
1010 1010
 		/**
1011 1011
 		 * The geomap shortcode.
1012 1012
 		 */
1013
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php';
1013
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php';
1014 1014
 
1015 1015
 		/**
1016 1016
 		 * The entity cloud shortcode.
1017 1017
 		 */
1018
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php';
1018
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php';
1019 1019
 
1020 1020
 		/**
1021 1021
 		 * The entity glossary shortcode.
1022 1022
 		 */
1023
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php';
1024
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php';
1023
+		require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-alphabet-service.php';
1024
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-vocabulary-shortcode.php';
1025 1025
 
1026 1026
 		/**
1027 1027
 		 * The ShareThis service.
1028 1028
 		 */
1029
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php';
1029
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php';
1030 1030
 
1031 1031
 		/**
1032 1032
 		 * The SEO service.
1033 1033
 		 */
1034
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php';
1034
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php';
1035 1035
 
1036 1036
 		/**
1037 1037
 		 * The AMP service.
1038 1038
 		 */
1039
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php';
1039
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-amp-service.php';
1040 1040
 
1041 1041
 		/** Widgets */
1042
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php';
1043
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php';
1042
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php';
1043
+		require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php';
1044 1044
 
1045 1045
 		$this->loader = new Wordlift_Loader();
1046 1046
 
1047 1047
 		// Instantiate a global logger.
1048 1048
 		global $wl_logger;
1049
-		$wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' );
1049
+		$wl_logger = Wordlift_Log_Service::get_logger('WordLift');
1050 1050
 
1051 1051
 		// Load the `wl-api` end-point.
1052 1052
 		new Wordlift_Http_Api();
@@ -1056,10 +1056,10 @@  discard block
 block discarded – undo
1056 1056
 		$this->configuration_service = new Wordlift_Configuration_Service();
1057 1057
 
1058 1058
 		// Create an entity type service instance. It'll be later bound to the init action.
1059
-		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() );
1059
+		$this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path());
1060 1060
 
1061 1061
 		// Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions.
1062
-		$this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() );
1062
+		$this->entity_link_service = new Wordlift_Entity_Link_Service($this->entity_post_type_service, $this->configuration_service->get_entity_base_path());
1063 1063
 
1064 1064
 		// Create an instance of the UI service.
1065 1065
 		$this->ui_service = new Wordlift_UI_Service();
@@ -1068,30 +1068,30 @@  discard block
 block discarded – undo
1068 1068
 		$this->thumbnail_service = new Wordlift_Thumbnail_Service();
1069 1069
 
1070 1070
 		$this->sparql_service        = new Wordlift_Sparql_Service();
1071
-		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service );
1071
+		$schema_url_property_service = new Wordlift_Schema_Url_Property_Service($this->sparql_service);
1072 1072
 		$this->notice_service        = new Wordlift_Notice_Service();
1073 1073
 		$this->relation_service      = new Wordlift_Relation_Service();
1074
-		$this->entity_service        = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service );
1074
+		$this->entity_service        = new Wordlift_Entity_Service($this->ui_service, $this->relation_service);
1075 1075
 		$this->user_service          = new Wordlift_User_Service();
1076 1076
 
1077 1077
 		// Instantiate the JSON-LD service.
1078
-		$property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1078
+		$property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service);
1079 1079
 
1080 1080
 		/** Linked Data. */
1081
-		$this->storage_factory   = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter );
1082
-		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service );
1081
+		$this->storage_factory   = new Wordlift_Storage_Factory($this->entity_service, $this->user_service, $property_getter);
1082
+		$this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory($this->entity_service);
1083 1083
 
1084
-		$this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service );
1084
+		$this->schema_service = new Wordlift_Schema_Service($this->storage_factory, $this->rendition_factory, $this->configuration_service);
1085 1085
 
1086 1086
 		// Create a new instance of the Redirect service.
1087
-		$this->redirect_service    = new Wordlift_Redirect_Service( $this->entity_service );
1088
-		$this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service );
1089
-		$this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service );
1087
+		$this->redirect_service    = new Wordlift_Redirect_Service($this->entity_service);
1088
+		$this->entity_type_service = new Wordlift_Entity_Type_Service($this->schema_service);
1089
+		$this->linked_data_service = new Wordlift_Linked_Data_Service($this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service);
1090 1090
 
1091 1091
 		// Create a new instance of the Timeline service and Timeline shortcode.
1092
-		$this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service );
1092
+		$this->timeline_service = new Wordlift_Timeline_Service($this->entity_service, $this->entity_type_service);
1093 1093
 
1094
-		$this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service );
1094
+		$this->batch_analysis_service = new Wordlift_Batch_Analysis_Service($this, $this->configuration_service);
1095 1095
 
1096 1096
 		$this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker();
1097 1097
 
@@ -1104,53 +1104,53 @@  discard block
 block discarded – undo
1104 1104
 		$this->primashop_adapter = new Wordlift_PrimaShop_Adapter();
1105 1105
 
1106 1106
 		// Create an import service instance to hook later to WP's import function.
1107
-		$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() );
1107
+		$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());
1108 1108
 
1109
-		$uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] );
1109
+		$uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']);
1110 1110
 
1111 1111
 		// Create a Rebuild Service instance, which we'll later bound to an ajax call.
1112
-		$this->rebuild_service = new Wordlift_Rebuild_Service( $this->sparql_service, $uri_service );
1112
+		$this->rebuild_service = new Wordlift_Rebuild_Service($this->sparql_service, $uri_service);
1113 1113
 
1114 1114
 		// Create the entity rating service.
1115
-		$this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service );
1115
+		$this->rating_service = new Wordlift_Rating_Service($this->entity_service, $this->entity_type_service, $this->notice_service);
1116 1116
 
1117 1117
 		// Create entity list customization (wp-admin/edit.php).
1118
-		$this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service );
1118
+		$this->entity_list_service = new Wordlift_Entity_List_Service($this->rating_service);
1119 1119
 
1120 1120
 		// Create a new instance of the Redirect service.
1121
-		$this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service );
1121
+		$this->dashboard_service = new Wordlift_Dashboard_Service($this->rating_service, $this->entity_service);
1122 1122
 
1123 1123
 		// Create an instance of the Publisher Service and the AJAX Adapter.
1124 1124
 		$publisher_service      = new Wordlift_Publisher_Service();
1125
-		$this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service );
1126
-		$this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service );
1125
+		$this->property_factory = new Wordlift_Property_Factory($schema_url_property_service);
1126
+		$this->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service);
1127 1127
 
1128 1128
 		$attachment_service = new Wordlift_Attachment_Service();
1129 1129
 
1130 1130
 		// Instantiate the JSON-LD service.
1131
-		$property_getter                         = Wordlift_Property_Getter_Factory::create( $this->entity_service );
1132
-		$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 );
1133
-		$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 );
1134
-		$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 );
1135
-		$this->jsonld_website_converter          = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service );
1136
-		$this->file_cache_service                = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' );
1137
-		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service );
1138
-		$this->jsonld_service                    = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter );
1139
-
1140
-
1141
-		$this->key_validation_service   = new Wordlift_Key_Validation_Service( $this->configuration_service );
1142
-		$this->content_filter_service   = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service );
1143
-		$this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service );
1144
-		$this->sample_data_service      = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service );
1145
-		$this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service );
1131
+		$property_getter                         = Wordlift_Property_Getter_Factory::create($this->entity_service);
1132
+		$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);
1133
+		$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);
1134
+		$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);
1135
+		$this->jsonld_website_converter          = new Wordlift_Website_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service);
1136
+		$this->file_cache_service                = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'converter/');
1137
+		$this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter($this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service);
1138
+		$this->jsonld_service                    = new Wordlift_Jsonld_Service($this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter);
1139
+
1140
+
1141
+		$this->key_validation_service   = new Wordlift_Key_Validation_Service($this->configuration_service);
1142
+		$this->content_filter_service   = new Wordlift_Content_Filter_Service($this->entity_service, $this->configuration_service);
1143
+		$this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service($this->content_filter_service, $this->entity_service);
1144
+		$this->sample_data_service      = new Wordlift_Sample_Data_Service($this->entity_type_service, $this->configuration_service, $this->user_service);
1145
+		$this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter($this->sample_data_service);
1146 1146
 
1147 1147
 		// Initialize the shortcodes.
1148 1148
 		new Wordlift_Navigator_Shortcode();
1149 1149
 		new Wordlift_Chord_Shortcode();
1150 1150
 		new Wordlift_Geomap_Shortcode();
1151 1151
 		new Wordlift_Timeline_Shortcode();
1152
-		new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service );
1153
-		new Wordlift_Vocabulary_Shortcode( $this->configuration_service );
1152
+		new Wordlift_Related_Entities_Cloud_Shortcode($this->relation_service);
1153
+		new Wordlift_Vocabulary_Shortcode($this->configuration_service);
1154 1154
 
1155 1155
 		// Initialize the SEO service.
1156 1156
 		new Wordlift_Seo_Service();
@@ -1162,11 +1162,11 @@  discard block
 block discarded – undo
1162 1162
 		$this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service();
1163 1163
 
1164 1164
 		/** Adapters. */
1165
-		$this->entity_type_adapter      = new Wordlift_Entity_Type_Adapter( $this->entity_type_service );
1166
-		$this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter( $publisher_service );
1167
-		$this->tinymce_adapter          = new Wordlift_Tinymce_Adapter( $this );
1168
-		$this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service );
1169
-		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service );
1165
+		$this->entity_type_adapter      = new Wordlift_Entity_Type_Adapter($this->entity_type_service);
1166
+		$this->publisher_ajax_adapter   = new Wordlift_Publisher_Ajax_Adapter($publisher_service);
1167
+		$this->tinymce_adapter          = new Wordlift_Tinymce_Adapter($this);
1168
+		$this->batch_analysis_adapter   = new Wordlift_Batch_Analysis_Adapter($this->batch_analysis_service);
1169
+		$this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter($this->relation_rebuild_service);
1170 1170
 
1171 1171
 		/** Async Tasks. */
1172 1172
 		new Wordlift_Sparql_Query_Async_Task();
@@ -1174,8 +1174,8 @@  discard block
 block discarded – undo
1174 1174
 		new Wordlift_Batch_Analysis_Complete_Async_Task();
1175 1175
 
1176 1176
 		/** WL Autocomplete. */
1177
-		$this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service );
1178
-		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service );
1177
+		$this->autocomplete_service = new Wordlift_Autocomplete_Service($this->configuration_service);
1178
+		$this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter($this->autocomplete_service);
1179 1179
 
1180 1180
 		/** WordPress Admin UI. */
1181 1181
 
@@ -1185,15 +1185,15 @@  discard block
 block discarded – undo
1185 1185
 		$this->select2_element         = new Wordlift_Admin_Select2_Element();
1186 1186
 		$this->language_select_element = new Wordlift_Admin_Language_Select_Element();
1187 1187
 		$tabs_element                  = new Wordlift_Admin_Tabs_Element();
1188
-		$this->publisher_element       = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $publisher_service, $tabs_element, $this->select2_element );
1189
-		$this->author_element          = new Wordlift_Admin_Author_Element( $publisher_service, $this->select2_element );
1188
+		$this->publisher_element       = new Wordlift_Admin_Publisher_Element($this->configuration_service, $publisher_service, $tabs_element, $this->select2_element);
1189
+		$this->author_element          = new Wordlift_Admin_Author_Element($publisher_service, $this->select2_element);
1190 1190
 
1191
-		$this->settings_page             = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element );
1192
-		$this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service );
1193
-		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page );
1191
+		$this->settings_page             = new Wordlift_Admin_Settings_Page($this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->publisher_element, $this->radio_input_element);
1192
+		$this->batch_analysis_page       = new Wordlift_Batch_Analysis_Page($this->batch_analysis_service);
1193
+		$this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($this->settings_page);
1194 1194
 
1195 1195
 		// Pages.
1196
-		new Wordlift_Admin_Post_Edit_Page( $this );
1196
+		new Wordlift_Admin_Post_Edit_Page($this);
1197 1197
 		new Wordlift_Entity_Type_Admin_Service();
1198 1198
 
1199 1199
 		// create an instance of the entity type list admin page controller.
@@ -1206,23 +1206,23 @@  discard block
 block discarded – undo
1206 1206
 		$this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget();
1207 1207
 
1208 1208
 		/* WordPress Admin. */
1209
-		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service );
1210
-		$this->status_page             = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service );
1209
+		$this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service);
1210
+		$this->status_page             = new Wordlift_Admin_Status_Page($this->entity_service, $this->sparql_service);
1211 1211
 
1212 1212
 		// Create an instance of the install wizard.
1213
-		$this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service );
1213
+		$this->admin_setup = new Wordlift_Admin_Setup($this->configuration_service, $this->key_validation_service, $this->entity_service);
1214 1214
 
1215
-		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service );
1215
+		$this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($this->entity_post_type_service);
1216 1216
 
1217 1217
 		// User Profile.
1218
-		new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service );
1218
+		new Wordlift_Admin_User_Profile_Page($this->author_element, $this->user_service);
1219 1219
 
1220 1220
 		$this->entity_page_service = new Wordlift_Entity_Page_Service();
1221 1221
 
1222 1222
 		// Load the debug service if WP is in debug mode.
1223
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
1224
-			require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php';
1225
-			new Wordlift_Debug_Service( $this->entity_service, $uri_service );
1223
+		if (defined('WP_DEBUG') && WP_DEBUG) {
1224
+			require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php';
1225
+			new Wordlift_Debug_Service($this->entity_service, $uri_service);
1226 1226
 		}
1227 1227
 
1228 1228
 	}
@@ -1239,9 +1239,9 @@  discard block
 block discarded – undo
1239 1239
 	private function set_locale() {
1240 1240
 
1241 1241
 		$plugin_i18n = new Wordlift_i18n();
1242
-		$plugin_i18n->set_domain( $this->get_plugin_name() );
1242
+		$plugin_i18n->set_domain($this->get_plugin_name());
1243 1243
 
1244
-		$this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
1244
+		$this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain');
1245 1245
 
1246 1246
 	}
1247 1247
 
@@ -1262,144 +1262,144 @@  discard block
 block discarded – undo
1262 1262
 			$this->user_service
1263 1263
 		);
1264 1264
 
1265
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
1266
-		$this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
1265
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles');
1266
+		$this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts');
1267 1267
 
1268 1268
 		// Hook the init action to the Topic Taxonomy service.
1269
-		$this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 );
1269
+		$this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0);
1270 1270
 
1271 1271
 		// Hook the deleted_post_meta action to the Thumbnail service.
1272
-		$this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 );
1272
+		$this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4);
1273 1273
 
1274 1274
 		// Hook the added_post_meta action to the Thumbnail service.
1275
-		$this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1275
+		$this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4);
1276 1276
 
1277 1277
 		// Hook the updated_post_meta action to the Thumbnail service.
1278
-		$this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 );
1278
+		$this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4);
1279 1279
 
1280 1280
 		// Hook the AJAX wl_timeline action to the Timeline service.
1281
-		$this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1281
+		$this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline');
1282 1282
 
1283 1283
 		// Register custom allowed redirect hosts.
1284
-		$this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' );
1284
+		$this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts');
1285 1285
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1286
-		$this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' );
1286
+		$this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect');
1287 1287
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1288
-		$this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' );
1288
+		$this->loader->add_action('wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats');
1289 1289
 		// Hook the AJAX wordlift_redirect action to the Redirect service.
1290
-		$this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' );
1290
+		$this->loader->add_action('wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets');
1291 1291
 
1292 1292
 		// Hook save_post to the entity service to update custom fields (such as alternate labels).
1293 1293
 		// We have a priority of 9 because we want to be executed before data is sent to Redlink.
1294
-		$this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 );
1295
-		$this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 );
1294
+		$this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3);
1295
+		$this->loader->add_action('save_post', $this->rating_service, 'set_rating_for', 20, 1);
1296 1296
 
1297
-		$this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 );
1298
-		$this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' );
1297
+		$this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1);
1298
+		$this->loader->add_action('in_admin_header', $this->rating_service, 'in_admin_header');
1299 1299
 
1300 1300
 		// Entity listing customization (wp-admin/edit.php)
1301 1301
 		// Add custom columns.
1302
-		$this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' );
1302
+		$this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns');
1303 1303
 		// no explicit entity as it prevents handling of other post types.
1304
-		$this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 );
1304
+		$this->loader->add_filter('manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2);
1305 1305
 		// Add 4W selection.
1306
-		$this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' );
1307
-		$this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' );
1308
-		$this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' );
1309
-		$this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' );
1310
-		$this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' );
1306
+		$this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope');
1307
+		$this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope');
1308
+		$this->loader->add_action('pre_get_posts', $this->entity_list_service, 'pre_get_posts');
1309
+		$this->loader->add_action('load-edit.php', $this->entity_list_service, 'load_edit');
1310
+		$this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args');
1311 1311
 
1312 1312
 		// Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for
1313 1313
 		// entities.
1314
-		$this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 );
1314
+		$this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2);
1315 1315
 
1316 1316
 		// Filter imported post meta.
1317
-		$this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 );
1317
+		$this->loader->add_filter('wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3);
1318 1318
 
1319 1319
 		// Notify the import service when an import starts and ends.
1320
-		$this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 );
1321
-		$this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 );
1320
+		$this->loader->add_action('import_start', $this->import_service, 'import_start', 10, 0);
1321
+		$this->loader->add_action('import_end', $this->import_service, 'import_end', 10, 0);
1322 1322
 
1323 1323
 		// Hook the AJAX wl_rebuild action to the Rebuild Service.
1324
-		$this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' );
1324
+		$this->loader->add_action('wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild');
1325 1325
 
1326 1326
 		// Hook the menu to the Download Your Data page.
1327
-		$this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 );
1328
-		$this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 );
1329
-		$this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 );
1327
+		$this->loader->add_action('admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0);
1328
+		$this->loader->add_action('admin_menu', $this->status_page, 'admin_menu', 100, 0);
1329
+		$this->loader->add_action('admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0);
1330 1330
 
1331 1331
 		// Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links.
1332
-		$this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 );
1332
+		$this->loader->add_action('wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10);
1333 1333
 
1334 1334
 		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1335
-		$this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' );
1335
+		$this->loader->add_action('wp_ajax_wl_jsonld', $this->jsonld_service, 'get');
1336 1336
 
1337 1337
 		// Hook the AJAX wl_validate_key action to the Key Validation service.
1338
-		$this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' );
1338
+		$this->loader->add_action('wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key');
1339 1339
 
1340 1340
 		// Hook the `admin_init` function to the Admin Setup.
1341
-		$this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' );
1341
+		$this->loader->add_action('admin_init', $this->admin_setup, 'admin_init');
1342 1342
 
1343 1343
 		// Hook the admin_init to the settings page.
1344
-		$this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' );
1344
+		$this->loader->add_action('admin_init', $this->settings_page, 'admin_init');
1345 1345
 
1346 1346
 		// Hook the menu creation on the general wordlift menu creation.
1347
-		$this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 );
1348
-		if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) {
1347
+		$this->loader->add_action('wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2);
1348
+		if (defined('WORDLIFT_BATCH') && WORDLIFT_BATCH) {
1349 1349
 			// Add the functionality only if a flag is set in wp-config.php .
1350
-			$this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 );
1350
+			$this->loader->add_action('wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2);
1351 1351
 		}
1352 1352
 
1353 1353
 		// Hook key update.
1354
-		$this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 );
1355
-		$this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 );
1354
+		$this->loader->add_action('pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2);
1355
+		$this->loader->add_action('update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2);
1356 1356
 
1357 1357
 		// Add additional action links to the WordLift plugin in the plugins page.
1358
-		$this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 );
1358
+		$this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1);
1359 1359
 
1360 1360
 		// Hook the AJAX `wl_publisher` action name.
1361
-		$this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' );
1361
+		$this->loader->add_action('wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher');
1362 1362
 
1363 1363
 		// Hook row actions for the entity type list admin.
1364
-		$this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 );
1364
+		$this->loader->add_filter('wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2);
1365 1365
 
1366 1366
 		/** Ajax actions. */
1367
-		$this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' );
1367
+		$this->loader->add_action('wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export');
1368 1368
 
1369 1369
 		// Hook capabilities manipulation to allow access to entity type admin
1370 1370
 		// page  on WordPress versions before 4.7.
1371 1371
 		global $wp_version;
1372
-		if ( version_compare( $wp_version, '4.7', '<' ) ) {
1373
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 );
1372
+		if (version_compare($wp_version, '4.7', '<')) {
1373
+			$this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4);
1374 1374
 		}
1375 1375
 
1376
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1376
+		$this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1);
1377 1377
 
1378 1378
 		/** Adapters. */
1379
-		$this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 );
1380
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_auto_selected_posts', $this->batch_analysis_adapter, 'submit_auto_selected_posts', 10 );
1381
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_all_posts', $this->batch_analysis_adapter, 'submit_all_posts', 10 );
1382
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit', 10 );
1383
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel', 10 );
1384
-		$this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning', 10 );
1385
-		$this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all', 10 );
1379
+		$this->loader->add_filter('mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1);
1380
+		$this->loader->add_action('wp_ajax_wl_batch_analysis_submit_auto_selected_posts', $this->batch_analysis_adapter, 'submit_auto_selected_posts', 10);
1381
+		$this->loader->add_action('wp_ajax_wl_batch_analysis_submit_all_posts', $this->batch_analysis_adapter, 'submit_all_posts', 10);
1382
+		$this->loader->add_action('wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit', 10);
1383
+		$this->loader->add_action('wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel', 10);
1384
+		$this->loader->add_action('wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning', 10);
1385
+		$this->loader->add_action('wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all', 10);
1386 1386
 
1387
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' );
1388
-		$this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' );
1387
+		$this->loader->add_action('wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create');
1388
+		$this->loader->add_action('wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete');
1389 1389
 
1390 1390
 		// Handle the autocomplete request.
1391
-		add_action( 'wp_ajax_wl_autocomplete', array(
1391
+		add_action('wp_ajax_wl_autocomplete', array(
1392 1392
 			$this->autocomplete_adapter,
1393 1393
 			'wl_autocomplete',
1394
-		) );
1395
-		add_action( 'wp_ajax_nopriv_wl_autocomplete', array(
1394
+		));
1395
+		add_action('wp_ajax_nopriv_wl_autocomplete', array(
1396 1396
 			$this->autocomplete_adapter,
1397 1397
 			'wl_autocomplete',
1398
-		) );
1398
+		));
1399 1399
 
1400 1400
 		// Hooks to restrict multisite super admin from manipulating entity types.
1401
-		if ( is_multisite() ) {
1402
-			$this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 );
1401
+		if (is_multisite()) {
1402
+			$this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4);
1403 1403
 		}
1404 1404
 
1405 1405
 	}
@@ -1413,49 +1413,49 @@  discard block
 block discarded – undo
1413 1413
 	 */
1414 1414
 	private function define_public_hooks() {
1415 1415
 
1416
-		$plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() );
1416
+		$plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version());
1417 1417
 
1418 1418
 		// Register the entity post type.
1419
-		$this->loader->add_action( 'init', $this->entity_post_type_service, 'register' );
1419
+		$this->loader->add_action('init', $this->entity_post_type_service, 'register');
1420 1420
 
1421 1421
 		// Bind the link generation and handling hooks to the entity link service.
1422
-		$this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 );
1423
-		$this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 );
1424
-		$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 );
1425
-		$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 );
1422
+		$this->loader->add_filter('post_type_link', $this->entity_link_service, 'post_type_link', 10, 4);
1423
+		$this->loader->add_action('pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1);
1424
+		$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);
1425
+		$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);
1426 1426
 
1427
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
1428
-		$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
1427
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles');
1428
+		$this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts');
1429 1429
 
1430 1430
 		// Hook the content filter service to add entity links.
1431
-		$this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' );
1431
+		$this->loader->add_filter('the_content', $this->content_filter_service, 'the_content');
1432 1432
 
1433 1433
 		// Hook the AJAX wl_timeline action to the Timeline service.
1434
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' );
1434
+		$this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline');
1435 1435
 
1436 1436
 		// Hook the ShareThis service.
1437
-		$this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 );
1438
-		$this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 );
1437
+		$this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99);
1438
+		$this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99);
1439 1439
 
1440 1440
 		// Hook the AJAX wl_jsonld action to the JSON-LD service.
1441
-		$this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' );
1441
+		$this->loader->add_action('wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get');
1442 1442
 
1443 1443
 		// Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service`
1444 1444
 		// in order to tweak WP's `WP_Query` to include entities in queries related
1445 1445
 		// to categories.
1446
-		$this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 );
1446
+		$this->loader->add_action('pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1);
1447 1447
 
1448 1448
 		/*
1449 1449
 		 * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service`
1450 1450
 		 * in order to tweak WP's `WP_Query` to show event related entities in reverse
1451 1451
 		 * order of start time.
1452 1452
 		 */
1453
-		$this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 );
1453
+		$this->loader->add_action('pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1);
1454 1454
 
1455
-		$this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 );
1455
+		$this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1);
1456 1456
 
1457 1457
 		// This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done.
1458
-		$this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 );
1458
+		$this->loader->add_action('save_post', $this->entity_type_adapter, 'save_post', 9, 3);
1459 1459
 
1460 1460
 	}
1461 1461
 
Please login to merge, or discard this patch.
src/includes/class-wordlift-alphabet-service.php 2 patches
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -17,140 +17,140 @@
 block discarded – undo
17 17
  */
18 18
 class Wordlift_Alphabet_Service {
19 19
 
20
-	/**
21
-	 * Get the alphabet for the specified language code.
22
-	 *
23
-	 * @since 3.17.0
24
-	 *
25
-	 * @param string $language_code A two-letter language code.
26
-	 *
27
-	 * @return array The letters array or an empty array if the language isn't supported.
28
-	 */
29
-	public static function get( $language_code ) {
30
-
31
-		switch ( $language_code ) {
32
-			case '' :
33
-			case 'en' :
34
-			case 'fr' :
35
-			case 'de' :
36
-			case 'ca' :
37
-			case 'nl' :
38
-			case 'id' :
39
-			case 'it' :
40
-			case 'pt' :
41
-			case 'uk' :
42
-			case 'zh-cn' :
43
-				return self::reset( range( 'A', 'Z' ) );
44
-
45
-			case 'be' :
46
-				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/be_utf8/langconfig.php .
47
-				return self::reset( explode( ',', 'А,Б,В,Г,Д,ДЖ,ДЗ,Е,Ё,Ж,З,І,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ў,Ф,Х,Ц,Ч,Ш,Ы,Ь,Э,Ю,Я' ) );
48
-
49
-			case 'no' :
50
-			case 'da' :
51
-				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/nn_utf8/langconfig.php .
52
-				return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Æ,Ø,Å' ) );
53
-
54
-			case 'bg' :
55
-				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/bg_utf8/langconfig.php .
56
-				return self::reset( explode( ',', 'А,Б,В,Г,Д,Е,Ж,З,И,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ъ,Ь,Ю,Я' ) );
57
-
58
-			case 'cs' :
59
-				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/cs_utf8/langconfig.php .
60
-				return self::reset( explode( ',', 'A,Á,B,C,Č,D,Ď,E,É,Ě,F,G,H,I,Í,J,K,L,M,N,Ň,O,Ó,P,Q,R,Ř,S,Š,T,Ť,U,Ú,Ů,V,W,X,Y,Ý,Z,Ž' ) );
61
-
62
-			case 'es' :
63
-				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/es_utf8/langconfig.php .
64
-				return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,Ñ,O,P,Q,R,S,T,U,V,W,X,Y,Z' ) );
65
-
66
-			case 'et' :
67
-				// @see https://en.wikipedia.org/wiki/Estonian_orthography#Alphabet .
68
-				return self::reset( explode( ',', 'A,B,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,Š,Z,Ž,T,U,V,Õ,Ä,Ö,Ü' ) );
69
-
70
-			case 'fi' :
71
-				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/fi_utf8/langconfig.php .
72
-				return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Å,Ä,Ö' ) );
73
-
74
-			case 'hr' :
75
-				// @see https://github.com/dismine/Valentina_sonar/blob/2930a1c51406255001331bf6013f85fc340b91f7/scripts/alphabets.py .
76
-				return self::reset( explode( ',', 'A.B.C.Č.Ć.D.DŽ.Ð.E.F.G.H.I.J.K,L,LJ,M,N,NJ,O,P,R,S,Š,T,U,V,Z,Ž' ) );
77
-
78
-			case 'hu' :
79
-				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/hu_utf8/langconfig.php .
80
-				return self::reset( explode( ',', 'A,Á,B,C,CS,D,DZ,DZS,E,É,F,G,GY,H,I,Í,J,K,L,M,N,NY,O,Ó,Ö,Ő,P,Q,R,S,SZ,T,TY,U,Ú,Ü,Ű,V,W,X,Y,Z,ZS' ) );
81
-
82
-			case 'is' :
83
-				// @see https://en.wikipedia.org/wiki/Icelandic_orthography .
84
-				return self::reset( explode( ',', 'A,Á,B,D,Ð,E,É,F,G,H,I,Í,J,K,L,M,N,O,Ó,P,R,S,T,U,Ú,V,X,Y,Ý,Þ,Æ,Ö' ) );
85
-
86
-			case 'lt' :
87
-				// @see https://en.wikipedia.org/wiki/Lithuanian_orthography#Alphabet .
88
-				return self::reset( explode( ',', 'A,Ą,B,C,Č,D,E,Ę,Ė,F,G,H,I,Į,Y,J,K,L,M,N,O,P,R,S,Š,T,U,Ų,Ū,V,Z,Ž' ) );
89
-
90
-			case 'lv' :
91
-				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/lv_utf8/langconfig.php .
92
-				return self::reset( explode( ',', 'A,Ā,B,C,Č,D,E,Ē,F,G,Ģ,H,I,Ī,J,K,Ķ,L,Ļ,M,N,Ņ,O,P,Q,R,S,Š,T,U,Ū,V,W,X,Y,Z,Ž' ) );
93
-
94
-			case 'pl' :
95
-				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/pl_utf8/langconfig.php .
96
-				return self::reset( explode( ',', 'A,Ą,B,C,Ć,D,E,Ę,F,G,H,I,J,K,L,Ł,M,N,Ń,O,Ó,P,Q,R,S,Ś,T,U,V,W,X,Y,Z,Ź,Ż' ) );
97
-
98
-			case 'ro' :
99
-				// @see https://github.com/dismine/Valentina_sonar/blob/2930a1c51406255001331bf6013f85fc340b91f7/scripts/alphabets.py .
100
-				return self::reset( explode( ',', 'A,Ă,Â,B,C,D,E,F,G,H,I,Î,J,K,L,M,N,O,P,Q,R,S,Ș,T,Ț,U,V,W,X,Y,Z' ) );
101
-
102
-			case 'ru' :
103
-				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/ru_utf8/langconfig.php .
104
-				return self::reset( explode( ',', 'А,Б,В,Г,Д,Е,Ё,Ж,З,И,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Э,Ю,Я' ) );
105
-
106
-			case 'sk' :
107
-				// @see https://github.com/dismine/Valentina_sonar/blob/2930a1c51406255001331bf6013f85fc340b91f7/scripts/alphabets.py .
108
-				return self::reset( explode( ',', 'A,Á,Ä,B,C,Č,D,Ď,DZ,DŽ,E,É,F,G,H,CH,I,Í,J,K,L,Ĺ,Ľ,M,N,Ň,O,Ó,Ô,P,Q,R,Ŕ,S,Š,T,Ť,U,Ú,V,W,X,Y,Ý,Z,Ž' ) );
109
-
110
-			case 'sl' :
111
-				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sl_utf8/langconfig.php .
112
-				return self::reset( explode( ',', 'A,B,C,Č,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,Š,T,U,V,Z,Ž' ) );
113
-
114
-			case 'sq' :
115
-				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sq_utf8/langconfig.php .
116
-				return self::reset( explode( ',', 'A,B,C,Ç,D,E,Ë,F,G,GJ,H,I,J,K,L,LL,M,N,O,P,Q,R,RR,S,SH,T,TH,U,V,X,XH,Y,Z,ZH' ) );
117
-
118
-			case 'sr' :
119
-				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sr_cr_utf8/langconfig.php .
120
-				return self::reset( explode( ',', 'А,Б,В,Г,Д,Ђ,Е,Ж,З,И,J,K,Л,Љ,М,Н,Њ,O,П,Р,С,Т,Ћ,У,Ф,Х,Ц,Ч,Џ,Ш' ) );
121
-
122
-			case 'sv' :
123
-				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sv_utf8/langconfig.php .
124
-				return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Å,Ä,Ö' ) );
125
-
126
-			case 'tr' :
127
-				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/tr_utf8/langconfig.php .
128
-				return self::reset( explode( ',', 'A,B,C,Ç,D,E,F,G,H,I,İ,J,K,L,M,N,O,Ö,P,R,S,Ş,T,U,Ü,V,Y,Z,Q,W,X' ) );
129
-
130
-		}
131
-
132
-		// If we got here, we don't support the language, then return an empty array.
133
-		return self::reset( array() );
134
-	}
135
-
136
-	/**
137
-	 * Reset the alphabet array by assigning an empty array to each key.
138
-	 *
139
-	 * @since 3.17.0
140
-	 *
141
-	 * @param array $alphabet The alphabet array.
142
-	 *
143
-	 * @return array The alphabet array with letters as keys and empty arrays as values.
144
-	 */
145
-	private static function reset( $alphabet ) {
146
-
147
-		$letters = array_flip( $alphabet );
20
+    /**
21
+     * Get the alphabet for the specified language code.
22
+     *
23
+     * @since 3.17.0
24
+     *
25
+     * @param string $language_code A two-letter language code.
26
+     *
27
+     * @return array The letters array or an empty array if the language isn't supported.
28
+     */
29
+    public static function get( $language_code ) {
30
+
31
+        switch ( $language_code ) {
32
+            case '' :
33
+            case 'en' :
34
+            case 'fr' :
35
+            case 'de' :
36
+            case 'ca' :
37
+            case 'nl' :
38
+            case 'id' :
39
+            case 'it' :
40
+            case 'pt' :
41
+            case 'uk' :
42
+            case 'zh-cn' :
43
+                return self::reset( range( 'A', 'Z' ) );
44
+
45
+            case 'be' :
46
+                // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/be_utf8/langconfig.php .
47
+                return self::reset( explode( ',', 'А,Б,В,Г,Д,ДЖ,ДЗ,Е,Ё,Ж,З,І,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ў,Ф,Х,Ц,Ч,Ш,Ы,Ь,Э,Ю,Я' ) );
48
+
49
+            case 'no' :
50
+            case 'da' :
51
+                // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/nn_utf8/langconfig.php .
52
+                return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Æ,Ø,Å' ) );
53
+
54
+            case 'bg' :
55
+                // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/bg_utf8/langconfig.php .
56
+                return self::reset( explode( ',', 'А,Б,В,Г,Д,Е,Ж,З,И,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ъ,Ь,Ю,Я' ) );
57
+
58
+            case 'cs' :
59
+                // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/cs_utf8/langconfig.php .
60
+                return self::reset( explode( ',', 'A,Á,B,C,Č,D,Ď,E,É,Ě,F,G,H,I,Í,J,K,L,M,N,Ň,O,Ó,P,Q,R,Ř,S,Š,T,Ť,U,Ú,Ů,V,W,X,Y,Ý,Z,Ž' ) );
61
+
62
+            case 'es' :
63
+                // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/es_utf8/langconfig.php .
64
+                return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,Ñ,O,P,Q,R,S,T,U,V,W,X,Y,Z' ) );
65
+
66
+            case 'et' :
67
+                // @see https://en.wikipedia.org/wiki/Estonian_orthography#Alphabet .
68
+                return self::reset( explode( ',', 'A,B,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,Š,Z,Ž,T,U,V,Õ,Ä,Ö,Ü' ) );
69
+
70
+            case 'fi' :
71
+                // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/fi_utf8/langconfig.php .
72
+                return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Å,Ä,Ö' ) );
73
+
74
+            case 'hr' :
75
+                // @see https://github.com/dismine/Valentina_sonar/blob/2930a1c51406255001331bf6013f85fc340b91f7/scripts/alphabets.py .
76
+                return self::reset( explode( ',', 'A.B.C.Č.Ć.D.DŽ.Ð.E.F.G.H.I.J.K,L,LJ,M,N,NJ,O,P,R,S,Š,T,U,V,Z,Ž' ) );
77
+
78
+            case 'hu' :
79
+                // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/hu_utf8/langconfig.php .
80
+                return self::reset( explode( ',', 'A,Á,B,C,CS,D,DZ,DZS,E,É,F,G,GY,H,I,Í,J,K,L,M,N,NY,O,Ó,Ö,Ő,P,Q,R,S,SZ,T,TY,U,Ú,Ü,Ű,V,W,X,Y,Z,ZS' ) );
81
+
82
+            case 'is' :
83
+                // @see https://en.wikipedia.org/wiki/Icelandic_orthography .
84
+                return self::reset( explode( ',', 'A,Á,B,D,Ð,E,É,F,G,H,I,Í,J,K,L,M,N,O,Ó,P,R,S,T,U,Ú,V,X,Y,Ý,Þ,Æ,Ö' ) );
85
+
86
+            case 'lt' :
87
+                // @see https://en.wikipedia.org/wiki/Lithuanian_orthography#Alphabet .
88
+                return self::reset( explode( ',', 'A,Ą,B,C,Č,D,E,Ę,Ė,F,G,H,I,Į,Y,J,K,L,M,N,O,P,R,S,Š,T,U,Ų,Ū,V,Z,Ž' ) );
89
+
90
+            case 'lv' :
91
+                // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/lv_utf8/langconfig.php .
92
+                return self::reset( explode( ',', 'A,Ā,B,C,Č,D,E,Ē,F,G,Ģ,H,I,Ī,J,K,Ķ,L,Ļ,M,N,Ņ,O,P,Q,R,S,Š,T,U,Ū,V,W,X,Y,Z,Ž' ) );
93
+
94
+            case 'pl' :
95
+                // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/pl_utf8/langconfig.php .
96
+                return self::reset( explode( ',', 'A,Ą,B,C,Ć,D,E,Ę,F,G,H,I,J,K,L,Ł,M,N,Ń,O,Ó,P,Q,R,S,Ś,T,U,V,W,X,Y,Z,Ź,Ż' ) );
97
+
98
+            case 'ro' :
99
+                // @see https://github.com/dismine/Valentina_sonar/blob/2930a1c51406255001331bf6013f85fc340b91f7/scripts/alphabets.py .
100
+                return self::reset( explode( ',', 'A,Ă,Â,B,C,D,E,F,G,H,I,Î,J,K,L,M,N,O,P,Q,R,S,Ș,T,Ț,U,V,W,X,Y,Z' ) );
101
+
102
+            case 'ru' :
103
+                // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/ru_utf8/langconfig.php .
104
+                return self::reset( explode( ',', 'А,Б,В,Г,Д,Е,Ё,Ж,З,И,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Э,Ю,Я' ) );
105
+
106
+            case 'sk' :
107
+                // @see https://github.com/dismine/Valentina_sonar/blob/2930a1c51406255001331bf6013f85fc340b91f7/scripts/alphabets.py .
108
+                return self::reset( explode( ',', 'A,Á,Ä,B,C,Č,D,Ď,DZ,DŽ,E,É,F,G,H,CH,I,Í,J,K,L,Ĺ,Ľ,M,N,Ň,O,Ó,Ô,P,Q,R,Ŕ,S,Š,T,Ť,U,Ú,V,W,X,Y,Ý,Z,Ž' ) );
109
+
110
+            case 'sl' :
111
+                // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sl_utf8/langconfig.php .
112
+                return self::reset( explode( ',', 'A,B,C,Č,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,Š,T,U,V,Z,Ž' ) );
113
+
114
+            case 'sq' :
115
+                // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sq_utf8/langconfig.php .
116
+                return self::reset( explode( ',', 'A,B,C,Ç,D,E,Ë,F,G,GJ,H,I,J,K,L,LL,M,N,O,P,Q,R,RR,S,SH,T,TH,U,V,X,XH,Y,Z,ZH' ) );
117
+
118
+            case 'sr' :
119
+                // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sr_cr_utf8/langconfig.php .
120
+                return self::reset( explode( ',', 'А,Б,В,Г,Д,Ђ,Е,Ж,З,И,J,K,Л,Љ,М,Н,Њ,O,П,Р,С,Т,Ћ,У,Ф,Х,Ц,Ч,Џ,Ш' ) );
121
+
122
+            case 'sv' :
123
+                // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sv_utf8/langconfig.php .
124
+                return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Å,Ä,Ö' ) );
125
+
126
+            case 'tr' :
127
+                // @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/tr_utf8/langconfig.php .
128
+                return self::reset( explode( ',', 'A,B,C,Ç,D,E,F,G,H,I,İ,J,K,L,M,N,O,Ö,P,R,S,Ş,T,U,Ü,V,Y,Z,Q,W,X' ) );
129
+
130
+        }
131
+
132
+        // If we got here, we don't support the language, then return an empty array.
133
+        return self::reset( array() );
134
+    }
135
+
136
+    /**
137
+     * Reset the alphabet array by assigning an empty array to each key.
138
+     *
139
+     * @since 3.17.0
140
+     *
141
+     * @param array $alphabet The alphabet array.
142
+     *
143
+     * @return array The alphabet array with letters as keys and empty arrays as values.
144
+     */
145
+    private static function reset( $alphabet ) {
146
+
147
+        $letters = array_flip( $alphabet );
148 148
 
149
-		foreach ( $letters as $key => $value ) {
150
-			$letters[ $key ] = array();
151
-		}
149
+        foreach ( $letters as $key => $value ) {
150
+            $letters[ $key ] = array();
151
+        }
152 152
 
153
-		return $letters + array( '#' => array() );
154
-	}
153
+        return $letters + array( '#' => array() );
154
+    }
155 155
 
156 156
 }
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 	 *
27 27
 	 * @return array The letters array or an empty array if the language isn't supported.
28 28
 	 */
29
-	public static function get( $language_code ) {
29
+	public static function get($language_code) {
30 30
 
31
-		switch ( $language_code ) {
31
+		switch ($language_code) {
32 32
 			case '' :
33 33
 			case 'en' :
34 34
 			case 'fr' :
@@ -40,97 +40,97 @@  discard block
 block discarded – undo
40 40
 			case 'pt' :
41 41
 			case 'uk' :
42 42
 			case 'zh-cn' :
43
-				return self::reset( range( 'A', 'Z' ) );
43
+				return self::reset(range('A', 'Z'));
44 44
 
45 45
 			case 'be' :
46 46
 				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/be_utf8/langconfig.php .
47
-				return self::reset( explode( ',', 'А,Б,В,Г,Д,ДЖ,ДЗ,Е,Ё,Ж,З,І,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ў,Ф,Х,Ц,Ч,Ш,Ы,Ь,Э,Ю,Я' ) );
47
+				return self::reset(explode(',', 'А,Б,В,Г,Д,ДЖ,ДЗ,Е,Ё,Ж,З,І,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ў,Ф,Х,Ц,Ч,Ш,Ы,Ь,Э,Ю,Я'));
48 48
 
49 49
 			case 'no' :
50 50
 			case 'da' :
51 51
 				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/nn_utf8/langconfig.php .
52
-				return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Æ,Ø,Å' ) );
52
+				return self::reset(explode(',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Æ,Ø,Å'));
53 53
 
54 54
 			case 'bg' :
55 55
 				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/bg_utf8/langconfig.php .
56
-				return self::reset( explode( ',', 'А,Б,В,Г,Д,Е,Ж,З,И,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ъ,Ь,Ю,Я' ) );
56
+				return self::reset(explode(',', 'А,Б,В,Г,Д,Е,Ж,З,И,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ъ,Ь,Ю,Я'));
57 57
 
58 58
 			case 'cs' :
59 59
 				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/cs_utf8/langconfig.php .
60
-				return self::reset( explode( ',', 'A,Á,B,C,Č,D,Ď,E,É,Ě,F,G,H,I,Í,J,K,L,M,N,Ň,O,Ó,P,Q,R,Ř,S,Š,T,Ť,U,Ú,Ů,V,W,X,Y,Ý,Z,Ž' ) );
60
+				return self::reset(explode(',', 'A,Á,B,C,Č,D,Ď,E,É,Ě,F,G,H,I,Í,J,K,L,M,N,Ň,O,Ó,P,Q,R,Ř,S,Š,T,Ť,U,Ú,Ů,V,W,X,Y,Ý,Z,Ž'));
61 61
 
62 62
 			case 'es' :
63 63
 				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/es_utf8/langconfig.php .
64
-				return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,Ñ,O,P,Q,R,S,T,U,V,W,X,Y,Z' ) );
64
+				return self::reset(explode(',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,Ñ,O,P,Q,R,S,T,U,V,W,X,Y,Z'));
65 65
 
66 66
 			case 'et' :
67 67
 				// @see https://en.wikipedia.org/wiki/Estonian_orthography#Alphabet .
68
-				return self::reset( explode( ',', 'A,B,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,Š,Z,Ž,T,U,V,Õ,Ä,Ö,Ü' ) );
68
+				return self::reset(explode(',', 'A,B,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,Š,Z,Ž,T,U,V,Õ,Ä,Ö,Ü'));
69 69
 
70 70
 			case 'fi' :
71 71
 				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/fi_utf8/langconfig.php .
72
-				return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Å,Ä,Ö' ) );
72
+				return self::reset(explode(',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Å,Ä,Ö'));
73 73
 
74 74
 			case 'hr' :
75 75
 				// @see https://github.com/dismine/Valentina_sonar/blob/2930a1c51406255001331bf6013f85fc340b91f7/scripts/alphabets.py .
76
-				return self::reset( explode( ',', 'A.B.C.Č.Ć.D.DŽ.Ð.E.F.G.H.I.J.K,L,LJ,M,N,NJ,O,P,R,S,Š,T,U,V,Z,Ž' ) );
76
+				return self::reset(explode(',', 'A.B.C.Č.Ć.D.DŽ.Ð.E.F.G.H.I.J.K,L,LJ,M,N,NJ,O,P,R,S,Š,T,U,V,Z,Ž'));
77 77
 
78 78
 			case 'hu' :
79 79
 				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/hu_utf8/langconfig.php .
80
-				return self::reset( explode( ',', 'A,Á,B,C,CS,D,DZ,DZS,E,É,F,G,GY,H,I,Í,J,K,L,M,N,NY,O,Ó,Ö,Ő,P,Q,R,S,SZ,T,TY,U,Ú,Ü,Ű,V,W,X,Y,Z,ZS' ) );
80
+				return self::reset(explode(',', 'A,Á,B,C,CS,D,DZ,DZS,E,É,F,G,GY,H,I,Í,J,K,L,M,N,NY,O,Ó,Ö,Ő,P,Q,R,S,SZ,T,TY,U,Ú,Ü,Ű,V,W,X,Y,Z,ZS'));
81 81
 
82 82
 			case 'is' :
83 83
 				// @see https://en.wikipedia.org/wiki/Icelandic_orthography .
84
-				return self::reset( explode( ',', 'A,Á,B,D,Ð,E,É,F,G,H,I,Í,J,K,L,M,N,O,Ó,P,R,S,T,U,Ú,V,X,Y,Ý,Þ,Æ,Ö' ) );
84
+				return self::reset(explode(',', 'A,Á,B,D,Ð,E,É,F,G,H,I,Í,J,K,L,M,N,O,Ó,P,R,S,T,U,Ú,V,X,Y,Ý,Þ,Æ,Ö'));
85 85
 
86 86
 			case 'lt' :
87 87
 				// @see https://en.wikipedia.org/wiki/Lithuanian_orthography#Alphabet .
88
-				return self::reset( explode( ',', 'A,Ą,B,C,Č,D,E,Ę,Ė,F,G,H,I,Į,Y,J,K,L,M,N,O,P,R,S,Š,T,U,Ų,Ū,V,Z,Ž' ) );
88
+				return self::reset(explode(',', 'A,Ą,B,C,Č,D,E,Ę,Ė,F,G,H,I,Į,Y,J,K,L,M,N,O,P,R,S,Š,T,U,Ų,Ū,V,Z,Ž'));
89 89
 
90 90
 			case 'lv' :
91 91
 				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/lv_utf8/langconfig.php .
92
-				return self::reset( explode( ',', 'A,Ā,B,C,Č,D,E,Ē,F,G,Ģ,H,I,Ī,J,K,Ķ,L,Ļ,M,N,Ņ,O,P,Q,R,S,Š,T,U,Ū,V,W,X,Y,Z,Ž' ) );
92
+				return self::reset(explode(',', 'A,Ā,B,C,Č,D,E,Ē,F,G,Ģ,H,I,Ī,J,K,Ķ,L,Ļ,M,N,Ņ,O,P,Q,R,S,Š,T,U,Ū,V,W,X,Y,Z,Ž'));
93 93
 
94 94
 			case 'pl' :
95 95
 				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/pl_utf8/langconfig.php .
96
-				return self::reset( explode( ',', 'A,Ą,B,C,Ć,D,E,Ę,F,G,H,I,J,K,L,Ł,M,N,Ń,O,Ó,P,Q,R,S,Ś,T,U,V,W,X,Y,Z,Ź,Ż' ) );
96
+				return self::reset(explode(',', 'A,Ą,B,C,Ć,D,E,Ę,F,G,H,I,J,K,L,Ł,M,N,Ń,O,Ó,P,Q,R,S,Ś,T,U,V,W,X,Y,Z,Ź,Ż'));
97 97
 
98 98
 			case 'ro' :
99 99
 				// @see https://github.com/dismine/Valentina_sonar/blob/2930a1c51406255001331bf6013f85fc340b91f7/scripts/alphabets.py .
100
-				return self::reset( explode( ',', 'A,Ă,Â,B,C,D,E,F,G,H,I,Î,J,K,L,M,N,O,P,Q,R,S,Ș,T,Ț,U,V,W,X,Y,Z' ) );
100
+				return self::reset(explode(',', 'A,Ă,Â,B,C,D,E,F,G,H,I,Î,J,K,L,M,N,O,P,Q,R,S,Ș,T,Ț,U,V,W,X,Y,Z'));
101 101
 
102 102
 			case 'ru' :
103 103
 				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/ru_utf8/langconfig.php .
104
-				return self::reset( explode( ',', 'А,Б,В,Г,Д,Е,Ё,Ж,З,И,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Э,Ю,Я' ) );
104
+				return self::reset(explode(',', 'А,Б,В,Г,Д,Е,Ё,Ж,З,И,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Э,Ю,Я'));
105 105
 
106 106
 			case 'sk' :
107 107
 				// @see https://github.com/dismine/Valentina_sonar/blob/2930a1c51406255001331bf6013f85fc340b91f7/scripts/alphabets.py .
108
-				return self::reset( explode( ',', 'A,Á,Ä,B,C,Č,D,Ď,DZ,DŽ,E,É,F,G,H,CH,I,Í,J,K,L,Ĺ,Ľ,M,N,Ň,O,Ó,Ô,P,Q,R,Ŕ,S,Š,T,Ť,U,Ú,V,W,X,Y,Ý,Z,Ž' ) );
108
+				return self::reset(explode(',', 'A,Á,Ä,B,C,Č,D,Ď,DZ,DŽ,E,É,F,G,H,CH,I,Í,J,K,L,Ĺ,Ľ,M,N,Ň,O,Ó,Ô,P,Q,R,Ŕ,S,Š,T,Ť,U,Ú,V,W,X,Y,Ý,Z,Ž'));
109 109
 
110 110
 			case 'sl' :
111 111
 				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sl_utf8/langconfig.php .
112
-				return self::reset( explode( ',', 'A,B,C,Č,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,Š,T,U,V,Z,Ž' ) );
112
+				return self::reset(explode(',', 'A,B,C,Č,D,E,F,G,H,I,J,K,L,M,N,O,P,R,S,Š,T,U,V,Z,Ž'));
113 113
 
114 114
 			case 'sq' :
115 115
 				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sq_utf8/langconfig.php .
116
-				return self::reset( explode( ',', 'A,B,C,Ç,D,E,Ë,F,G,GJ,H,I,J,K,L,LL,M,N,O,P,Q,R,RR,S,SH,T,TH,U,V,X,XH,Y,Z,ZH' ) );
116
+				return self::reset(explode(',', 'A,B,C,Ç,D,E,Ë,F,G,GJ,H,I,J,K,L,LL,M,N,O,P,Q,R,RR,S,SH,T,TH,U,V,X,XH,Y,Z,ZH'));
117 117
 
118 118
 			case 'sr' :
119 119
 				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sr_cr_utf8/langconfig.php .
120
-				return self::reset( explode( ',', 'А,Б,В,Г,Д,Ђ,Е,Ж,З,И,J,K,Л,Љ,М,Н,Њ,O,П,Р,С,Т,Ћ,У,Ф,Х,Ц,Ч,Џ,Ш' ) );
120
+				return self::reset(explode(',', 'А,Б,В,Г,Д,Ђ,Е,Ж,З,И,J,K,Л,Љ,М,Н,Њ,O,П,Р,С,Т,Ћ,У,Ф,Х,Ц,Ч,Џ,Ш'));
121 121
 
122 122
 			case 'sv' :
123 123
 				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/sv_utf8/langconfig.php .
124
-				return self::reset( explode( ',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Å,Ä,Ö' ) );
124
+				return self::reset(explode(',', 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,Å,Ä,Ö'));
125 125
 
126 126
 			case 'tr' :
127 127
 				// @see https://github.com/mudrd8mz/moodle-lang/blob/9f43e2c74953545f2ff836159cbec9fb7a710fcd/tr_utf8/langconfig.php .
128
-				return self::reset( explode( ',', 'A,B,C,Ç,D,E,F,G,H,I,İ,J,K,L,M,N,O,Ö,P,R,S,Ş,T,U,Ü,V,Y,Z,Q,W,X' ) );
128
+				return self::reset(explode(',', 'A,B,C,Ç,D,E,F,G,H,I,İ,J,K,L,M,N,O,Ö,P,R,S,Ş,T,U,Ü,V,Y,Z,Q,W,X'));
129 129
 
130 130
 		}
131 131
 
132 132
 		// If we got here, we don't support the language, then return an empty array.
133
-		return self::reset( array() );
133
+		return self::reset(array());
134 134
 	}
135 135
 
136 136
 	/**
@@ -142,15 +142,15 @@  discard block
 block discarded – undo
142 142
 	 *
143 143
 	 * @return array The alphabet array with letters as keys and empty arrays as values.
144 144
 	 */
145
-	private static function reset( $alphabet ) {
145
+	private static function reset($alphabet) {
146 146
 
147
-		$letters = array_flip( $alphabet );
147
+		$letters = array_flip($alphabet);
148 148
 
149
-		foreach ( $letters as $key => $value ) {
150
-			$letters[ $key ] = array();
149
+		foreach ($letters as $key => $value) {
150
+			$letters[$key] = array();
151 151
 		}
152 152
 
153
-		return $letters + array( '#' => array() );
153
+		return $letters + array('#' => array());
154 154
 	}
155 155
 
156 156
 }
Please login to merge, or discard this patch.