@@ -615,7 +615,7 @@ |
||
615 | 615 | * |
616 | 616 | * @since TBD |
617 | 617 | * |
618 | - * @return string 'no' or 'yes' representing bool. |
|
618 | + * @return boolean 'no' or 'yes' representing bool. |
|
619 | 619 | */ |
620 | 620 | public function is_analytics_enable() { |
621 | 621 | return 'yes' === $this->get( 'wl_analytics_settings', self::ANALYTICS_ENABLE, 'no' ); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
14 | - exit; |
|
14 | + exit; |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | /** |
@@ -21,689 +21,689 @@ discard block |
||
21 | 21 | */ |
22 | 22 | class Wordlift_Configuration_Service { |
23 | 23 | |
24 | - /** |
|
25 | - * The entity base path option name. |
|
26 | - * |
|
27 | - * @since 3.6.0 |
|
28 | - */ |
|
29 | - const ENTITY_BASE_PATH_KEY = 'wl_entity_base_path'; |
|
30 | - |
|
31 | - /** |
|
32 | - * The skip wizard (admin installation wizard) option name. |
|
33 | - * |
|
34 | - * @since 3.9.0 |
|
35 | - */ |
|
36 | - const SKIP_WIZARD = 'wl_skip_wizard'; |
|
37 | - |
|
38 | - /** |
|
39 | - * WordLift's key option name. |
|
40 | - * |
|
41 | - * @since 3.9.0 |
|
42 | - */ |
|
43 | - const KEY = 'key'; |
|
44 | - |
|
45 | - /** |
|
46 | - * WordLift's configured language option name. |
|
47 | - * |
|
48 | - * @since 3.9.0 |
|
49 | - */ |
|
50 | - const LANGUAGE = 'site_language'; |
|
51 | - |
|
52 | - /** |
|
53 | - * WordLift's configured country code. |
|
54 | - * |
|
55 | - * @since 3.18.0 |
|
56 | - */ |
|
57 | - const COUNTRY_CODE = 'country_code'; |
|
58 | - |
|
59 | - /** |
|
60 | - * The publisher entity post ID option name. |
|
61 | - * |
|
62 | - * @since 3.9.0 |
|
63 | - */ |
|
64 | - const PUBLISHER_ID = 'publisher_id'; |
|
65 | - |
|
66 | - /** |
|
67 | - * The dataset URI option name |
|
68 | - * |
|
69 | - * @since 3.10.0 |
|
70 | - */ |
|
71 | - const DATASET_URI = 'redlink_dataset_uri'; |
|
72 | - |
|
73 | - /** |
|
74 | - * The link by default option name. |
|
75 | - * |
|
76 | - * @since 3.11.0 |
|
77 | - */ |
|
78 | - const LINK_BY_DEFAULT = 'link_by_default'; |
|
79 | - |
|
80 | - /** |
|
81 | - * The analytics enable option. |
|
82 | - * |
|
83 | - * @since TBD |
|
84 | - */ |
|
85 | - const ANALYTICS_ENABLE = 'analytics_enable'; |
|
86 | - |
|
87 | - /** |
|
88 | - * The analytics entity uri dimension option. |
|
89 | - * |
|
90 | - * @since TBD |
|
91 | - */ |
|
92 | - const ANALYTICS_ENTITY_URI_DIMENSION = 'analytics_entity_uri_dimension'; |
|
93 | - |
|
94 | - /** |
|
95 | - * The analytics entity type dimension option. |
|
96 | - * |
|
97 | - * @since TBD |
|
98 | - */ |
|
99 | - const ANALYTICS_ENTITY_TYPE_DIMENSION = 'analytics_entity_type_dimension'; |
|
100 | - |
|
101 | - /** |
|
102 | - * The user preferences about sharing data option. |
|
103 | - * |
|
104 | - * @since 3.19.0 |
|
105 | - */ |
|
106 | - const SEND_DIAGNOSTIC = 'send_diagnostic'; |
|
107 | - |
|
108 | - /** |
|
109 | - * The package type configuration key. |
|
110 | - * |
|
111 | - * @since 3.20.0 |
|
112 | - */ |
|
113 | - const PACKAGE_TYPE = 'package_type'; |
|
114 | - |
|
115 | - /** |
|
116 | - * The {@link Wordlift_Log_Service} instance. |
|
117 | - * |
|
118 | - * @since 3.16.0 |
|
119 | - * |
|
120 | - * @var \Wordlift_Log_Service $log The {@link Wordlift_Log_Service} instance. |
|
121 | - */ |
|
122 | - private $log; |
|
123 | - |
|
124 | - /** |
|
125 | - * The Wordlift_Configuration_Service's singleton instance. |
|
126 | - * |
|
127 | - * @since 3.6.0 |
|
128 | - * |
|
129 | - * @access private |
|
130 | - * @var \Wordlift_Configuration_Service $instance Wordlift_Configuration_Service's singleton instance. |
|
131 | - */ |
|
132 | - private static $instance; |
|
133 | - |
|
134 | - /** |
|
135 | - * Create a Wordlift_Configuration_Service's instance. |
|
136 | - * |
|
137 | - * @since 3.6.0 |
|
138 | - */ |
|
139 | - public function __construct() { |
|
140 | - |
|
141 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
142 | - |
|
143 | - self::$instance = $this; |
|
144 | - |
|
145 | - } |
|
146 | - |
|
147 | - /** |
|
148 | - * Get the singleton instance. |
|
149 | - * |
|
150 | - * @since 3.6.0 |
|
151 | - * |
|
152 | - * @return \Wordlift_Configuration_Service |
|
153 | - */ |
|
154 | - public static function get_instance() { |
|
155 | - |
|
156 | - return self::$instance; |
|
157 | - } |
|
158 | - |
|
159 | - /** |
|
160 | - * Get a configuration given the option name and a key. The option value is |
|
161 | - * expected to be an array. |
|
162 | - * |
|
163 | - * @since 3.6.0 |
|
164 | - * |
|
165 | - * @param string $option The option name. |
|
166 | - * @param string $key A key in the option value array. |
|
167 | - * @param string $default The default value in case the key is not found (by default an empty string). |
|
168 | - * |
|
169 | - * @return mixed The configuration value or the default value if not found. |
|
170 | - */ |
|
171 | - private function get( $option, $key, $default = '' ) { |
|
172 | - |
|
173 | - $options = get_option( $option, array() ); |
|
174 | - |
|
175 | - return isset( $options[ $key ] ) ? $options[ $key ] : $default; |
|
176 | - } |
|
177 | - |
|
178 | - /** |
|
179 | - * Set a configuration parameter. |
|
180 | - * |
|
181 | - * @since 3.9.0 |
|
182 | - * |
|
183 | - * @param string $option Name of option to retrieve. Expected to not be SQL-escaped. |
|
184 | - * @param string $key The value key. |
|
185 | - * @param mixed $value The value. |
|
186 | - */ |
|
187 | - private function set( $option, $key, $value ) { |
|
188 | - |
|
189 | - $values = get_option( $option ); |
|
190 | - $values = isset( $values ) ? $values : array(); |
|
191 | - $values[ $key ] = $value; |
|
192 | - update_option( $option, $values ); |
|
193 | - |
|
194 | - } |
|
195 | - |
|
196 | - /** |
|
197 | - * Get the entity base path, by default 'entity'. |
|
198 | - * |
|
199 | - * @since 3.6.0 |
|
200 | - * |
|
201 | - * @return string The entity base path. |
|
202 | - */ |
|
203 | - public function get_entity_base_path() { |
|
204 | - |
|
205 | - return $this->get( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, 'entity' ); |
|
206 | - } |
|
207 | - |
|
208 | - /** |
|
209 | - * Get the entity base path. |
|
210 | - * |
|
211 | - * @since 3.9.0 |
|
212 | - * |
|
213 | - * @param string $value The entity base path. |
|
214 | - */ |
|
215 | - public function set_entity_base_path( $value ) { |
|
216 | - |
|
217 | - $this->set( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, $value ); |
|
218 | - |
|
219 | - } |
|
220 | - |
|
221 | - /** |
|
222 | - * Whether the installation skip wizard should be skipped. |
|
223 | - * |
|
224 | - * @since 3.9.0 |
|
225 | - * |
|
226 | - * @return bool True if it should be skipped otherwise false. |
|
227 | - */ |
|
228 | - public function is_skip_wizard() { |
|
229 | - |
|
230 | - return $this->get( 'wl_general_settings', self::SKIP_WIZARD, false ); |
|
231 | - } |
|
232 | - |
|
233 | - /** |
|
234 | - * Set the skip wizard parameter. |
|
235 | - * |
|
236 | - * @since 3.9.0 |
|
237 | - * |
|
238 | - * @param bool $value True to skip the wizard. We expect a boolean value. |
|
239 | - */ |
|
240 | - public function set_skip_wizard( $value ) { |
|
241 | - |
|
242 | - $this->set( 'wl_general_settings', self::SKIP_WIZARD, true === $value ); |
|
243 | - |
|
244 | - } |
|
245 | - |
|
246 | - /** |
|
247 | - * Get WordLift's key. |
|
248 | - * |
|
249 | - * @since 3.9.0 |
|
250 | - * |
|
251 | - * @return string WordLift's key or an empty string if not set. |
|
252 | - */ |
|
253 | - public function get_key() { |
|
254 | - |
|
255 | - return $this->get( 'wl_general_settings', self::KEY, '' ); |
|
256 | - } |
|
257 | - |
|
258 | - /** |
|
259 | - * Set WordLift's key. |
|
260 | - * |
|
261 | - * @since 3.9.0 |
|
262 | - * |
|
263 | - * @param string $value WordLift's key. |
|
264 | - */ |
|
265 | - public function set_key( $value ) { |
|
266 | - |
|
267 | - $this->set( 'wl_general_settings', self::KEY, $value ); |
|
268 | - } |
|
269 | - |
|
270 | - /** |
|
271 | - * Get WordLift's configured language, by default 'en'. |
|
272 | - * |
|
273 | - * Note that WordLift's language is used when writing strings to the Linked Data dataset, not for the analysis. |
|
274 | - * |
|
275 | - * @since 3.9.0 |
|
276 | - * |
|
277 | - * @return string WordLift's configured language code ('en' by default). |
|
278 | - */ |
|
279 | - public function get_language_code() { |
|
280 | - |
|
281 | - return $this->get( 'wl_general_settings', self::LANGUAGE, 'en' ); |
|
282 | - } |
|
283 | - |
|
284 | - /** |
|
285 | - * Set WordLift's language code, used when storing strings to the Linked Data dataset. |
|
286 | - * |
|
287 | - * @since 3.9.0 |
|
288 | - * |
|
289 | - * @param string $value WordLift's language code. |
|
290 | - */ |
|
291 | - public function set_language_code( $value ) { |
|
292 | - |
|
293 | - $this->set( 'wl_general_settings', self::LANGUAGE, $value ); |
|
294 | - |
|
295 | - } |
|
296 | - |
|
297 | - /** |
|
298 | - * Set the user preferences about sharing diagnostic with us. |
|
299 | - * |
|
300 | - * @since 3.19.0 |
|
301 | - * |
|
302 | - * @param string $value The user preferences(yes/no). |
|
303 | - */ |
|
304 | - public function set_diagnostic_preferences( $value ) { |
|
305 | - |
|
306 | - $this->set( 'wl_general_settings', self::SEND_DIAGNOSTIC, $value ); |
|
307 | - |
|
308 | - } |
|
309 | - |
|
310 | - /** |
|
311 | - * Get the user preferences about sharing diagnostic. |
|
312 | - * |
|
313 | - * @since 3.19.0 |
|
314 | - */ |
|
315 | - public function get_diagnostic_preferences() { |
|
316 | - |
|
317 | - return $this->get( 'wl_general_settings', self::SEND_DIAGNOSTIC, 'no' ); |
|
318 | - } |
|
319 | - |
|
320 | - /** |
|
321 | - * Get WordLift's configured country code, by default 'us'. |
|
322 | - * |
|
323 | - * @since 3.18.0 |
|
324 | - * |
|
325 | - * @return string WordLift's configured country code ('us' by default). |
|
326 | - */ |
|
327 | - public function get_country_code() { |
|
328 | - |
|
329 | - return $this->get( 'wl_general_settings', self::COUNTRY_CODE, 'us' ); |
|
330 | - } |
|
331 | - |
|
332 | - /** |
|
333 | - * Set WordLift's country code. |
|
334 | - * |
|
335 | - * @since 3.18.0 |
|
336 | - * |
|
337 | - * @param string $value WordLift's country code. |
|
338 | - */ |
|
339 | - public function set_country_code( $value ) { |
|
340 | - |
|
341 | - $this->set( 'wl_general_settings', self::COUNTRY_CODE, $value ); |
|
342 | - |
|
343 | - } |
|
344 | - |
|
345 | - /** |
|
346 | - * Get the publisher entity post id. |
|
347 | - * |
|
348 | - * The publisher entity post id points to an entity post which contains the data for the publisher used in schema.org |
|
349 | - * Article markup. |
|
350 | - * |
|
351 | - * @since 3.9.0 |
|
352 | - * |
|
353 | - * @return int|NULL The publisher entity post id or NULL if not set. |
|
354 | - */ |
|
355 | - public function get_publisher_id() { |
|
356 | - |
|
357 | - return $this->get( 'wl_general_settings', self::PUBLISHER_ID, null ); |
|
358 | - } |
|
359 | - |
|
360 | - /** |
|
361 | - * Set the publisher entity post id. |
|
362 | - * |
|
363 | - * @since 3.9.0 |
|
364 | - * |
|
365 | - * @param int $value The publisher entity post id. |
|
366 | - */ |
|
367 | - public function set_publisher_id( $value ) { |
|
368 | - |
|
369 | - $this->set( 'wl_general_settings', self::PUBLISHER_ID, $value ); |
|
370 | - |
|
371 | - } |
|
372 | - |
|
373 | - /** |
|
374 | - * Get the dataset URI. |
|
375 | - * |
|
376 | - * @since 3.10.0 |
|
377 | - * |
|
378 | - * @return string The dataset URI or an empty string if not set. |
|
379 | - */ |
|
380 | - public function get_dataset_uri() { |
|
381 | - |
|
382 | - return $this->get( 'wl_advanced_settings', self::DATASET_URI, null ); |
|
383 | - } |
|
384 | - |
|
385 | - /** |
|
386 | - * Set the dataset URI. |
|
387 | - * |
|
388 | - * @since 3.10.0 |
|
389 | - * |
|
390 | - * @param string $value The dataset URI. |
|
391 | - */ |
|
392 | - public function set_dataset_uri( $value ) { |
|
393 | - |
|
394 | - $this->set( 'wl_advanced_settings', self::DATASET_URI, $value ); |
|
395 | - } |
|
396 | - |
|
397 | - /** |
|
398 | - * Get the package type. |
|
399 | - * |
|
400 | - * @since 3.20.0 |
|
401 | - * |
|
402 | - * @return string The package type or an empty string if not set. |
|
403 | - */ |
|
404 | - public function get_package_type() { |
|
405 | - |
|
406 | - return $this->get( 'wl_advanced_settings', self::PACKAGE_TYPE, null ); |
|
407 | - } |
|
408 | - |
|
409 | - /** |
|
410 | - * Set the package type. |
|
411 | - * |
|
412 | - * @since 3.20.0 |
|
413 | - * |
|
414 | - * @param string $value The package type. |
|
415 | - */ |
|
416 | - public function set_package_type( $value ) { |
|
417 | - |
|
418 | - $this->set( 'wl_advanced_settings', self::PACKAGE_TYPE, $value ); |
|
419 | - } |
|
420 | - |
|
421 | - /** |
|
422 | - * Intercept the change of the WordLift key in order to set the dataset URI. |
|
423 | - * |
|
424 | - * |
|
425 | - * @since 3.20.0 as of #761, we save settings every time a key is set, not only when the key changes, so to |
|
426 | - * store the configuration parameters such as country or language. |
|
427 | - * @since 3.11.0 |
|
428 | - * |
|
429 | - * @see https://github.com/insideout10/wordlift-plugin/issues/761 |
|
430 | - * |
|
431 | - * @param array $old_value The old settings. |
|
432 | - * @param array $new_value The new settings. |
|
433 | - */ |
|
434 | - public function update_key( $old_value, $new_value ) { |
|
435 | - |
|
436 | - // Check the old key value and the new one. We're going to ask for the dataset URI only if the key has changed. |
|
437 | - // $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
438 | - $new_key = isset( $new_value['key'] ) ? $new_value['key'] : ''; |
|
439 | - |
|
440 | - // If the key hasn't changed, don't do anything. |
|
441 | - // WARN The 'update_option' hook is fired only if the new and old value are not equal. |
|
442 | - // if ( $old_key === $new_key ) { |
|
443 | - // return; |
|
444 | - // } |
|
445 | - |
|
446 | - // If the key is empty, empty the dataset URI. |
|
447 | - if ( '' === $new_key ) { |
|
448 | - $this->set_dataset_uri( '' ); |
|
449 | - } |
|
450 | - |
|
451 | - // make the request to the remote server. |
|
452 | - $this->get_remote_dataset_uri( $new_key ); |
|
453 | - } |
|
454 | - |
|
455 | - /** |
|
456 | - * Handle retrieving the dataset uri from the remote server. |
|
457 | - * |
|
458 | - * If a valid dataset uri is returned it is stored in the appropriate option, |
|
459 | - * otherwise the option is set to empty string. |
|
460 | - * |
|
461 | - * @since 3.17.0 send the site URL and get the dataset URI. |
|
462 | - * @since 3.12.0 |
|
463 | - * |
|
464 | - * @param string $key The key to be used. |
|
465 | - */ |
|
466 | - public function get_remote_dataset_uri( $key ) { |
|
467 | - |
|
468 | - $this->log->trace( 'Getting the remote dataset URI and package type...' ); |
|
469 | - |
|
470 | - /** |
|
471 | - * Allow 3rd parties to change the site_url. |
|
472 | - * |
|
473 | - * @since 3.20.0 |
|
474 | - * |
|
475 | - * @see https://github.com/insideout10/wordlift-plugin/issues/850 |
|
476 | - * |
|
477 | - * @param string $site_url The site url. |
|
478 | - */ |
|
479 | - $site_url = apply_filters( 'wl_production_site_url', site_url() ); |
|
480 | - |
|
481 | - // Build the URL. |
|
482 | - $url = $this->get_accounts() |
|
483 | - . '?key=' . rawurlencode( $key ) |
|
484 | - . '&url=' . rawurlencode( $site_url ) |
|
485 | - . '&country=' . $this->get_country_code() |
|
486 | - . '&language=' . $this->get_language_code(); |
|
487 | - |
|
488 | - $args = wp_parse_args( unserialize( WL_REDLINK_API_HTTP_OPTIONS ), array( |
|
489 | - 'method' => 'PUT', |
|
490 | - ) ); |
|
491 | - $response = wp_remote_request( $url, $args ); |
|
492 | - |
|
493 | - // The response is an error. |
|
494 | - if ( is_wp_error( $response ) ) { |
|
495 | - $this->log->error( 'An error occurred setting the dataset URI: ' . $response->get_error_message() ); |
|
496 | - |
|
497 | - $this->set_dataset_uri( '' ); |
|
498 | - $this->set_package_type( null ); |
|
499 | - |
|
500 | - return; |
|
501 | - } |
|
502 | - |
|
503 | - // The response is not OK. |
|
504 | - if ( 200 !== (int) $response['response']['code'] ) { |
|
505 | - $this->log->error( "Unexpected status code when opening URL $url: " . $response['response']['code'] ); |
|
506 | - |
|
507 | - $this->set_dataset_uri( '' ); |
|
508 | - $this->set_package_type( null ); |
|
509 | - |
|
510 | - return; |
|
511 | - } |
|
512 | - |
|
513 | - /* |
|
24 | + /** |
|
25 | + * The entity base path option name. |
|
26 | + * |
|
27 | + * @since 3.6.0 |
|
28 | + */ |
|
29 | + const ENTITY_BASE_PATH_KEY = 'wl_entity_base_path'; |
|
30 | + |
|
31 | + /** |
|
32 | + * The skip wizard (admin installation wizard) option name. |
|
33 | + * |
|
34 | + * @since 3.9.0 |
|
35 | + */ |
|
36 | + const SKIP_WIZARD = 'wl_skip_wizard'; |
|
37 | + |
|
38 | + /** |
|
39 | + * WordLift's key option name. |
|
40 | + * |
|
41 | + * @since 3.9.0 |
|
42 | + */ |
|
43 | + const KEY = 'key'; |
|
44 | + |
|
45 | + /** |
|
46 | + * WordLift's configured language option name. |
|
47 | + * |
|
48 | + * @since 3.9.0 |
|
49 | + */ |
|
50 | + const LANGUAGE = 'site_language'; |
|
51 | + |
|
52 | + /** |
|
53 | + * WordLift's configured country code. |
|
54 | + * |
|
55 | + * @since 3.18.0 |
|
56 | + */ |
|
57 | + const COUNTRY_CODE = 'country_code'; |
|
58 | + |
|
59 | + /** |
|
60 | + * The publisher entity post ID option name. |
|
61 | + * |
|
62 | + * @since 3.9.0 |
|
63 | + */ |
|
64 | + const PUBLISHER_ID = 'publisher_id'; |
|
65 | + |
|
66 | + /** |
|
67 | + * The dataset URI option name |
|
68 | + * |
|
69 | + * @since 3.10.0 |
|
70 | + */ |
|
71 | + const DATASET_URI = 'redlink_dataset_uri'; |
|
72 | + |
|
73 | + /** |
|
74 | + * The link by default option name. |
|
75 | + * |
|
76 | + * @since 3.11.0 |
|
77 | + */ |
|
78 | + const LINK_BY_DEFAULT = 'link_by_default'; |
|
79 | + |
|
80 | + /** |
|
81 | + * The analytics enable option. |
|
82 | + * |
|
83 | + * @since TBD |
|
84 | + */ |
|
85 | + const ANALYTICS_ENABLE = 'analytics_enable'; |
|
86 | + |
|
87 | + /** |
|
88 | + * The analytics entity uri dimension option. |
|
89 | + * |
|
90 | + * @since TBD |
|
91 | + */ |
|
92 | + const ANALYTICS_ENTITY_URI_DIMENSION = 'analytics_entity_uri_dimension'; |
|
93 | + |
|
94 | + /** |
|
95 | + * The analytics entity type dimension option. |
|
96 | + * |
|
97 | + * @since TBD |
|
98 | + */ |
|
99 | + const ANALYTICS_ENTITY_TYPE_DIMENSION = 'analytics_entity_type_dimension'; |
|
100 | + |
|
101 | + /** |
|
102 | + * The user preferences about sharing data option. |
|
103 | + * |
|
104 | + * @since 3.19.0 |
|
105 | + */ |
|
106 | + const SEND_DIAGNOSTIC = 'send_diagnostic'; |
|
107 | + |
|
108 | + /** |
|
109 | + * The package type configuration key. |
|
110 | + * |
|
111 | + * @since 3.20.0 |
|
112 | + */ |
|
113 | + const PACKAGE_TYPE = 'package_type'; |
|
114 | + |
|
115 | + /** |
|
116 | + * The {@link Wordlift_Log_Service} instance. |
|
117 | + * |
|
118 | + * @since 3.16.0 |
|
119 | + * |
|
120 | + * @var \Wordlift_Log_Service $log The {@link Wordlift_Log_Service} instance. |
|
121 | + */ |
|
122 | + private $log; |
|
123 | + |
|
124 | + /** |
|
125 | + * The Wordlift_Configuration_Service's singleton instance. |
|
126 | + * |
|
127 | + * @since 3.6.0 |
|
128 | + * |
|
129 | + * @access private |
|
130 | + * @var \Wordlift_Configuration_Service $instance Wordlift_Configuration_Service's singleton instance. |
|
131 | + */ |
|
132 | + private static $instance; |
|
133 | + |
|
134 | + /** |
|
135 | + * Create a Wordlift_Configuration_Service's instance. |
|
136 | + * |
|
137 | + * @since 3.6.0 |
|
138 | + */ |
|
139 | + public function __construct() { |
|
140 | + |
|
141 | + $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
142 | + |
|
143 | + self::$instance = $this; |
|
144 | + |
|
145 | + } |
|
146 | + |
|
147 | + /** |
|
148 | + * Get the singleton instance. |
|
149 | + * |
|
150 | + * @since 3.6.0 |
|
151 | + * |
|
152 | + * @return \Wordlift_Configuration_Service |
|
153 | + */ |
|
154 | + public static function get_instance() { |
|
155 | + |
|
156 | + return self::$instance; |
|
157 | + } |
|
158 | + |
|
159 | + /** |
|
160 | + * Get a configuration given the option name and a key. The option value is |
|
161 | + * expected to be an array. |
|
162 | + * |
|
163 | + * @since 3.6.0 |
|
164 | + * |
|
165 | + * @param string $option The option name. |
|
166 | + * @param string $key A key in the option value array. |
|
167 | + * @param string $default The default value in case the key is not found (by default an empty string). |
|
168 | + * |
|
169 | + * @return mixed The configuration value or the default value if not found. |
|
170 | + */ |
|
171 | + private function get( $option, $key, $default = '' ) { |
|
172 | + |
|
173 | + $options = get_option( $option, array() ); |
|
174 | + |
|
175 | + return isset( $options[ $key ] ) ? $options[ $key ] : $default; |
|
176 | + } |
|
177 | + |
|
178 | + /** |
|
179 | + * Set a configuration parameter. |
|
180 | + * |
|
181 | + * @since 3.9.0 |
|
182 | + * |
|
183 | + * @param string $option Name of option to retrieve. Expected to not be SQL-escaped. |
|
184 | + * @param string $key The value key. |
|
185 | + * @param mixed $value The value. |
|
186 | + */ |
|
187 | + private function set( $option, $key, $value ) { |
|
188 | + |
|
189 | + $values = get_option( $option ); |
|
190 | + $values = isset( $values ) ? $values : array(); |
|
191 | + $values[ $key ] = $value; |
|
192 | + update_option( $option, $values ); |
|
193 | + |
|
194 | + } |
|
195 | + |
|
196 | + /** |
|
197 | + * Get the entity base path, by default 'entity'. |
|
198 | + * |
|
199 | + * @since 3.6.0 |
|
200 | + * |
|
201 | + * @return string The entity base path. |
|
202 | + */ |
|
203 | + public function get_entity_base_path() { |
|
204 | + |
|
205 | + return $this->get( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, 'entity' ); |
|
206 | + } |
|
207 | + |
|
208 | + /** |
|
209 | + * Get the entity base path. |
|
210 | + * |
|
211 | + * @since 3.9.0 |
|
212 | + * |
|
213 | + * @param string $value The entity base path. |
|
214 | + */ |
|
215 | + public function set_entity_base_path( $value ) { |
|
216 | + |
|
217 | + $this->set( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, $value ); |
|
218 | + |
|
219 | + } |
|
220 | + |
|
221 | + /** |
|
222 | + * Whether the installation skip wizard should be skipped. |
|
223 | + * |
|
224 | + * @since 3.9.0 |
|
225 | + * |
|
226 | + * @return bool True if it should be skipped otherwise false. |
|
227 | + */ |
|
228 | + public function is_skip_wizard() { |
|
229 | + |
|
230 | + return $this->get( 'wl_general_settings', self::SKIP_WIZARD, false ); |
|
231 | + } |
|
232 | + |
|
233 | + /** |
|
234 | + * Set the skip wizard parameter. |
|
235 | + * |
|
236 | + * @since 3.9.0 |
|
237 | + * |
|
238 | + * @param bool $value True to skip the wizard. We expect a boolean value. |
|
239 | + */ |
|
240 | + public function set_skip_wizard( $value ) { |
|
241 | + |
|
242 | + $this->set( 'wl_general_settings', self::SKIP_WIZARD, true === $value ); |
|
243 | + |
|
244 | + } |
|
245 | + |
|
246 | + /** |
|
247 | + * Get WordLift's key. |
|
248 | + * |
|
249 | + * @since 3.9.0 |
|
250 | + * |
|
251 | + * @return string WordLift's key or an empty string if not set. |
|
252 | + */ |
|
253 | + public function get_key() { |
|
254 | + |
|
255 | + return $this->get( 'wl_general_settings', self::KEY, '' ); |
|
256 | + } |
|
257 | + |
|
258 | + /** |
|
259 | + * Set WordLift's key. |
|
260 | + * |
|
261 | + * @since 3.9.0 |
|
262 | + * |
|
263 | + * @param string $value WordLift's key. |
|
264 | + */ |
|
265 | + public function set_key( $value ) { |
|
266 | + |
|
267 | + $this->set( 'wl_general_settings', self::KEY, $value ); |
|
268 | + } |
|
269 | + |
|
270 | + /** |
|
271 | + * Get WordLift's configured language, by default 'en'. |
|
272 | + * |
|
273 | + * Note that WordLift's language is used when writing strings to the Linked Data dataset, not for the analysis. |
|
274 | + * |
|
275 | + * @since 3.9.0 |
|
276 | + * |
|
277 | + * @return string WordLift's configured language code ('en' by default). |
|
278 | + */ |
|
279 | + public function get_language_code() { |
|
280 | + |
|
281 | + return $this->get( 'wl_general_settings', self::LANGUAGE, 'en' ); |
|
282 | + } |
|
283 | + |
|
284 | + /** |
|
285 | + * Set WordLift's language code, used when storing strings to the Linked Data dataset. |
|
286 | + * |
|
287 | + * @since 3.9.0 |
|
288 | + * |
|
289 | + * @param string $value WordLift's language code. |
|
290 | + */ |
|
291 | + public function set_language_code( $value ) { |
|
292 | + |
|
293 | + $this->set( 'wl_general_settings', self::LANGUAGE, $value ); |
|
294 | + |
|
295 | + } |
|
296 | + |
|
297 | + /** |
|
298 | + * Set the user preferences about sharing diagnostic with us. |
|
299 | + * |
|
300 | + * @since 3.19.0 |
|
301 | + * |
|
302 | + * @param string $value The user preferences(yes/no). |
|
303 | + */ |
|
304 | + public function set_diagnostic_preferences( $value ) { |
|
305 | + |
|
306 | + $this->set( 'wl_general_settings', self::SEND_DIAGNOSTIC, $value ); |
|
307 | + |
|
308 | + } |
|
309 | + |
|
310 | + /** |
|
311 | + * Get the user preferences about sharing diagnostic. |
|
312 | + * |
|
313 | + * @since 3.19.0 |
|
314 | + */ |
|
315 | + public function get_diagnostic_preferences() { |
|
316 | + |
|
317 | + return $this->get( 'wl_general_settings', self::SEND_DIAGNOSTIC, 'no' ); |
|
318 | + } |
|
319 | + |
|
320 | + /** |
|
321 | + * Get WordLift's configured country code, by default 'us'. |
|
322 | + * |
|
323 | + * @since 3.18.0 |
|
324 | + * |
|
325 | + * @return string WordLift's configured country code ('us' by default). |
|
326 | + */ |
|
327 | + public function get_country_code() { |
|
328 | + |
|
329 | + return $this->get( 'wl_general_settings', self::COUNTRY_CODE, 'us' ); |
|
330 | + } |
|
331 | + |
|
332 | + /** |
|
333 | + * Set WordLift's country code. |
|
334 | + * |
|
335 | + * @since 3.18.0 |
|
336 | + * |
|
337 | + * @param string $value WordLift's country code. |
|
338 | + */ |
|
339 | + public function set_country_code( $value ) { |
|
340 | + |
|
341 | + $this->set( 'wl_general_settings', self::COUNTRY_CODE, $value ); |
|
342 | + |
|
343 | + } |
|
344 | + |
|
345 | + /** |
|
346 | + * Get the publisher entity post id. |
|
347 | + * |
|
348 | + * The publisher entity post id points to an entity post which contains the data for the publisher used in schema.org |
|
349 | + * Article markup. |
|
350 | + * |
|
351 | + * @since 3.9.0 |
|
352 | + * |
|
353 | + * @return int|NULL The publisher entity post id or NULL if not set. |
|
354 | + */ |
|
355 | + public function get_publisher_id() { |
|
356 | + |
|
357 | + return $this->get( 'wl_general_settings', self::PUBLISHER_ID, null ); |
|
358 | + } |
|
359 | + |
|
360 | + /** |
|
361 | + * Set the publisher entity post id. |
|
362 | + * |
|
363 | + * @since 3.9.0 |
|
364 | + * |
|
365 | + * @param int $value The publisher entity post id. |
|
366 | + */ |
|
367 | + public function set_publisher_id( $value ) { |
|
368 | + |
|
369 | + $this->set( 'wl_general_settings', self::PUBLISHER_ID, $value ); |
|
370 | + |
|
371 | + } |
|
372 | + |
|
373 | + /** |
|
374 | + * Get the dataset URI. |
|
375 | + * |
|
376 | + * @since 3.10.0 |
|
377 | + * |
|
378 | + * @return string The dataset URI or an empty string if not set. |
|
379 | + */ |
|
380 | + public function get_dataset_uri() { |
|
381 | + |
|
382 | + return $this->get( 'wl_advanced_settings', self::DATASET_URI, null ); |
|
383 | + } |
|
384 | + |
|
385 | + /** |
|
386 | + * Set the dataset URI. |
|
387 | + * |
|
388 | + * @since 3.10.0 |
|
389 | + * |
|
390 | + * @param string $value The dataset URI. |
|
391 | + */ |
|
392 | + public function set_dataset_uri( $value ) { |
|
393 | + |
|
394 | + $this->set( 'wl_advanced_settings', self::DATASET_URI, $value ); |
|
395 | + } |
|
396 | + |
|
397 | + /** |
|
398 | + * Get the package type. |
|
399 | + * |
|
400 | + * @since 3.20.0 |
|
401 | + * |
|
402 | + * @return string The package type or an empty string if not set. |
|
403 | + */ |
|
404 | + public function get_package_type() { |
|
405 | + |
|
406 | + return $this->get( 'wl_advanced_settings', self::PACKAGE_TYPE, null ); |
|
407 | + } |
|
408 | + |
|
409 | + /** |
|
410 | + * Set the package type. |
|
411 | + * |
|
412 | + * @since 3.20.0 |
|
413 | + * |
|
414 | + * @param string $value The package type. |
|
415 | + */ |
|
416 | + public function set_package_type( $value ) { |
|
417 | + |
|
418 | + $this->set( 'wl_advanced_settings', self::PACKAGE_TYPE, $value ); |
|
419 | + } |
|
420 | + |
|
421 | + /** |
|
422 | + * Intercept the change of the WordLift key in order to set the dataset URI. |
|
423 | + * |
|
424 | + * |
|
425 | + * @since 3.20.0 as of #761, we save settings every time a key is set, not only when the key changes, so to |
|
426 | + * store the configuration parameters such as country or language. |
|
427 | + * @since 3.11.0 |
|
428 | + * |
|
429 | + * @see https://github.com/insideout10/wordlift-plugin/issues/761 |
|
430 | + * |
|
431 | + * @param array $old_value The old settings. |
|
432 | + * @param array $new_value The new settings. |
|
433 | + */ |
|
434 | + public function update_key( $old_value, $new_value ) { |
|
435 | + |
|
436 | + // Check the old key value and the new one. We're going to ask for the dataset URI only if the key has changed. |
|
437 | + // $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
438 | + $new_key = isset( $new_value['key'] ) ? $new_value['key'] : ''; |
|
439 | + |
|
440 | + // If the key hasn't changed, don't do anything. |
|
441 | + // WARN The 'update_option' hook is fired only if the new and old value are not equal. |
|
442 | + // if ( $old_key === $new_key ) { |
|
443 | + // return; |
|
444 | + // } |
|
445 | + |
|
446 | + // If the key is empty, empty the dataset URI. |
|
447 | + if ( '' === $new_key ) { |
|
448 | + $this->set_dataset_uri( '' ); |
|
449 | + } |
|
450 | + |
|
451 | + // make the request to the remote server. |
|
452 | + $this->get_remote_dataset_uri( $new_key ); |
|
453 | + } |
|
454 | + |
|
455 | + /** |
|
456 | + * Handle retrieving the dataset uri from the remote server. |
|
457 | + * |
|
458 | + * If a valid dataset uri is returned it is stored in the appropriate option, |
|
459 | + * otherwise the option is set to empty string. |
|
460 | + * |
|
461 | + * @since 3.17.0 send the site URL and get the dataset URI. |
|
462 | + * @since 3.12.0 |
|
463 | + * |
|
464 | + * @param string $key The key to be used. |
|
465 | + */ |
|
466 | + public function get_remote_dataset_uri( $key ) { |
|
467 | + |
|
468 | + $this->log->trace( 'Getting the remote dataset URI and package type...' ); |
|
469 | + |
|
470 | + /** |
|
471 | + * Allow 3rd parties to change the site_url. |
|
472 | + * |
|
473 | + * @since 3.20.0 |
|
474 | + * |
|
475 | + * @see https://github.com/insideout10/wordlift-plugin/issues/850 |
|
476 | + * |
|
477 | + * @param string $site_url The site url. |
|
478 | + */ |
|
479 | + $site_url = apply_filters( 'wl_production_site_url', site_url() ); |
|
480 | + |
|
481 | + // Build the URL. |
|
482 | + $url = $this->get_accounts() |
|
483 | + . '?key=' . rawurlencode( $key ) |
|
484 | + . '&url=' . rawurlencode( $site_url ) |
|
485 | + . '&country=' . $this->get_country_code() |
|
486 | + . '&language=' . $this->get_language_code(); |
|
487 | + |
|
488 | + $args = wp_parse_args( unserialize( WL_REDLINK_API_HTTP_OPTIONS ), array( |
|
489 | + 'method' => 'PUT', |
|
490 | + ) ); |
|
491 | + $response = wp_remote_request( $url, $args ); |
|
492 | + |
|
493 | + // The response is an error. |
|
494 | + if ( is_wp_error( $response ) ) { |
|
495 | + $this->log->error( 'An error occurred setting the dataset URI: ' . $response->get_error_message() ); |
|
496 | + |
|
497 | + $this->set_dataset_uri( '' ); |
|
498 | + $this->set_package_type( null ); |
|
499 | + |
|
500 | + return; |
|
501 | + } |
|
502 | + |
|
503 | + // The response is not OK. |
|
504 | + if ( 200 !== (int) $response['response']['code'] ) { |
|
505 | + $this->log->error( "Unexpected status code when opening URL $url: " . $response['response']['code'] ); |
|
506 | + |
|
507 | + $this->set_dataset_uri( '' ); |
|
508 | + $this->set_package_type( null ); |
|
509 | + |
|
510 | + return; |
|
511 | + } |
|
512 | + |
|
513 | + /* |
|
514 | 514 | * We also store the package type. |
515 | 515 | * |
516 | 516 | * @since 3.20.0 |
517 | 517 | */ |
518 | - $json = json_decode( $response['body'] ); |
|
519 | - $dataset_uri = $json->datasetURI; |
|
520 | - $package_type = isset( $json->packageType ) ? $json->packageType : null; |
|
521 | - |
|
522 | - $this->log->info( "Updating [ dataset uri :: $dataset_uri ][ package type :: $package_type ]..." ); |
|
523 | - |
|
524 | - $this->set_dataset_uri( $dataset_uri ); |
|
525 | - $this->set_package_type( $package_type ); |
|
526 | - |
|
527 | - } |
|
528 | - |
|
529 | - /** |
|
530 | - * Handle the edge case where a user submits the same key again |
|
531 | - * when he does not have the dataset uri to regain it. |
|
532 | - * |
|
533 | - * This can not be handled in the normal option update hook because |
|
534 | - * it is not being triggered when the save value equals to the one already |
|
535 | - * in the DB. |
|
536 | - * |
|
537 | - * @since 3.12.0 |
|
538 | - * |
|
539 | - * @param mixed $value The new, unserialized option value. |
|
540 | - * @param mixed $old_value The old option value. |
|
541 | - * |
|
542 | - * @return mixed The same value in the $value parameter |
|
543 | - */ |
|
544 | - function maybe_update_dataset_uri( $value, $old_value ) { |
|
545 | - |
|
546 | - // Check the old key value and the new one. Here we're only handling the |
|
547 | - // case where the key hasn't changed and the dataset URI isn't set. The |
|
548 | - // other case, i.e. a new key is inserted, is handled at `update_key`. |
|
549 | - $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
550 | - $new_key = isset( $value['key'] ) ? $value['key'] : ''; |
|
551 | - |
|
552 | - $dataset_uri = $this->get_dataset_uri(); |
|
553 | - |
|
554 | - if ( ! empty( $new_key ) && $new_key === $old_key && empty( $dataset_uri ) ) { |
|
555 | - |
|
556 | - // make the request to the remote server to try to get the dataset uri. |
|
557 | - $this->get_remote_dataset_uri( $new_key ); |
|
558 | - } |
|
559 | - |
|
560 | - return $value; |
|
561 | - } |
|
562 | - |
|
563 | - /** |
|
564 | - * Get the API URI to retrieve the dataset URI using the WordLift Key. |
|
565 | - * |
|
566 | - * @since 3.11.0 |
|
567 | - * |
|
568 | - * @param string $key The WordLift key to use. |
|
569 | - * |
|
570 | - * @return string The API URI. |
|
571 | - */ |
|
572 | - public function get_accounts_by_key_dataset_uri( $key ) { |
|
573 | - |
|
574 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "accounts/key=$key/dataset_uri"; |
|
575 | - } |
|
576 | - |
|
577 | - /** |
|
578 | - * Get the `accounts` end point. |
|
579 | - * |
|
580 | - * @since 3.16.0 |
|
581 | - * |
|
582 | - * @return string The `accounts` end point. |
|
583 | - */ |
|
584 | - public function get_accounts() { |
|
585 | - |
|
586 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'accounts'; |
|
587 | - } |
|
588 | - |
|
589 | - /** |
|
590 | - * Get the `link by default` option. |
|
591 | - * |
|
592 | - * @since 3.13.0 |
|
593 | - * |
|
594 | - * @return bool True if entities must be linked by default otherwise false. |
|
595 | - */ |
|
596 | - public function is_link_by_default() { |
|
597 | - |
|
598 | - return 'yes' === $this->get( 'wl_general_settings', self::LINK_BY_DEFAULT, 'yes' ); |
|
599 | - } |
|
600 | - |
|
601 | - /** |
|
602 | - * Set the `link by default` option. |
|
603 | - * |
|
604 | - * @since 3.13.0 |
|
605 | - * |
|
606 | - * @param bool $value True to enabling linking by default, otherwise false. |
|
607 | - */ |
|
608 | - public function set_link_by_default( $value ) { |
|
609 | - |
|
610 | - $this->set( 'wl_general_settings', self::LINK_BY_DEFAULT, true === $value ? 'yes' : 'no' ); |
|
611 | - } |
|
612 | - |
|
613 | - /** |
|
614 | - * Get the 'analytics-enable' option. |
|
615 | - * |
|
616 | - * @since TBD |
|
617 | - * |
|
618 | - * @return string 'no' or 'yes' representing bool. |
|
619 | - */ |
|
620 | - public function is_analytics_enable() { |
|
621 | - return 'yes' === $this->get( 'wl_analytics_settings', self::ANALYTICS_ENABLE, 'no' ); |
|
622 | - } |
|
623 | - |
|
624 | - /** |
|
625 | - * Set the `analytics-enable` option. |
|
626 | - * |
|
627 | - * @since TBD |
|
628 | - * |
|
629 | - * @param bool $value True to enabling analytics, otherwise false. |
|
630 | - */ |
|
631 | - public function set_is_analytics_enable( $value ) { |
|
632 | - |
|
633 | - $this->set( 'wl_general_settings', self::ANALYTICS_ENABLE, true === $value ? 'yes' : 'no' ); |
|
634 | - } |
|
635 | - |
|
636 | - /** |
|
637 | - * Get the 'analytics-entity-uri-dimention' option. |
|
638 | - * |
|
639 | - * @since TBD |
|
640 | - * |
|
641 | - * @return int |
|
642 | - */ |
|
643 | - public function get_analytics_entity_uri_dimension() { |
|
644 | - return (int) $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_URI_DIMENSION, 2 ); |
|
645 | - } |
|
646 | - |
|
647 | - /** |
|
648 | - * Get the 'analytics-entity-type-dimention' option. |
|
649 | - * |
|
650 | - * @since TBD |
|
651 | - * |
|
652 | - * @return int |
|
653 | - */ |
|
654 | - public function get_analytics_entity_type_dimension() { |
|
655 | - return $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_TYPE_DIMENSION, 1 ); |
|
656 | - } |
|
657 | - |
|
658 | - /** |
|
659 | - * Get the URL to perform batch analyses. |
|
660 | - * |
|
661 | - * @since 3.14.0 |
|
662 | - * |
|
663 | - * @return string The URL to call to perform the batch analyzes. |
|
664 | - */ |
|
665 | - public function get_batch_analysis_url() { |
|
666 | - |
|
667 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'batch-analyses'; |
|
668 | - |
|
669 | - } |
|
670 | - |
|
671 | - /** |
|
672 | - * Get the URL to perform autocomplete request. |
|
673 | - * |
|
674 | - * @since 3.15.0 |
|
675 | - * |
|
676 | - * @return string The URL to call to perform the batch analyzes. |
|
677 | - */ |
|
678 | - public function get_autocomplete_url() { |
|
679 | - |
|
680 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'autocomplete'; |
|
681 | - |
|
682 | - } |
|
683 | - |
|
684 | - /** |
|
685 | - * Get the URL to perform feedback deactivation request. |
|
686 | - * |
|
687 | - * @since 3.19.0 |
|
688 | - * |
|
689 | - * @return string The URL to call to perform the feedback deactivation request. |
|
690 | - */ |
|
691 | - public function get_deactivation_feedback_url() { |
|
692 | - |
|
693 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'feedbacks'; |
|
694 | - |
|
695 | - } |
|
696 | - |
|
697 | - /** |
|
698 | - * Get the base API URL. |
|
699 | - * |
|
700 | - * @since 3.20.0 |
|
701 | - * |
|
702 | - * @return string The base API URL. |
|
703 | - */ |
|
704 | - public function get_api_url() { |
|
705 | - |
|
706 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE; |
|
707 | - } |
|
518 | + $json = json_decode( $response['body'] ); |
|
519 | + $dataset_uri = $json->datasetURI; |
|
520 | + $package_type = isset( $json->packageType ) ? $json->packageType : null; |
|
521 | + |
|
522 | + $this->log->info( "Updating [ dataset uri :: $dataset_uri ][ package type :: $package_type ]..." ); |
|
523 | + |
|
524 | + $this->set_dataset_uri( $dataset_uri ); |
|
525 | + $this->set_package_type( $package_type ); |
|
526 | + |
|
527 | + } |
|
528 | + |
|
529 | + /** |
|
530 | + * Handle the edge case where a user submits the same key again |
|
531 | + * when he does not have the dataset uri to regain it. |
|
532 | + * |
|
533 | + * This can not be handled in the normal option update hook because |
|
534 | + * it is not being triggered when the save value equals to the one already |
|
535 | + * in the DB. |
|
536 | + * |
|
537 | + * @since 3.12.0 |
|
538 | + * |
|
539 | + * @param mixed $value The new, unserialized option value. |
|
540 | + * @param mixed $old_value The old option value. |
|
541 | + * |
|
542 | + * @return mixed The same value in the $value parameter |
|
543 | + */ |
|
544 | + function maybe_update_dataset_uri( $value, $old_value ) { |
|
545 | + |
|
546 | + // Check the old key value and the new one. Here we're only handling the |
|
547 | + // case where the key hasn't changed and the dataset URI isn't set. The |
|
548 | + // other case, i.e. a new key is inserted, is handled at `update_key`. |
|
549 | + $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
550 | + $new_key = isset( $value['key'] ) ? $value['key'] : ''; |
|
551 | + |
|
552 | + $dataset_uri = $this->get_dataset_uri(); |
|
553 | + |
|
554 | + if ( ! empty( $new_key ) && $new_key === $old_key && empty( $dataset_uri ) ) { |
|
555 | + |
|
556 | + // make the request to the remote server to try to get the dataset uri. |
|
557 | + $this->get_remote_dataset_uri( $new_key ); |
|
558 | + } |
|
559 | + |
|
560 | + return $value; |
|
561 | + } |
|
562 | + |
|
563 | + /** |
|
564 | + * Get the API URI to retrieve the dataset URI using the WordLift Key. |
|
565 | + * |
|
566 | + * @since 3.11.0 |
|
567 | + * |
|
568 | + * @param string $key The WordLift key to use. |
|
569 | + * |
|
570 | + * @return string The API URI. |
|
571 | + */ |
|
572 | + public function get_accounts_by_key_dataset_uri( $key ) { |
|
573 | + |
|
574 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "accounts/key=$key/dataset_uri"; |
|
575 | + } |
|
576 | + |
|
577 | + /** |
|
578 | + * Get the `accounts` end point. |
|
579 | + * |
|
580 | + * @since 3.16.0 |
|
581 | + * |
|
582 | + * @return string The `accounts` end point. |
|
583 | + */ |
|
584 | + public function get_accounts() { |
|
585 | + |
|
586 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'accounts'; |
|
587 | + } |
|
588 | + |
|
589 | + /** |
|
590 | + * Get the `link by default` option. |
|
591 | + * |
|
592 | + * @since 3.13.0 |
|
593 | + * |
|
594 | + * @return bool True if entities must be linked by default otherwise false. |
|
595 | + */ |
|
596 | + public function is_link_by_default() { |
|
597 | + |
|
598 | + return 'yes' === $this->get( 'wl_general_settings', self::LINK_BY_DEFAULT, 'yes' ); |
|
599 | + } |
|
600 | + |
|
601 | + /** |
|
602 | + * Set the `link by default` option. |
|
603 | + * |
|
604 | + * @since 3.13.0 |
|
605 | + * |
|
606 | + * @param bool $value True to enabling linking by default, otherwise false. |
|
607 | + */ |
|
608 | + public function set_link_by_default( $value ) { |
|
609 | + |
|
610 | + $this->set( 'wl_general_settings', self::LINK_BY_DEFAULT, true === $value ? 'yes' : 'no' ); |
|
611 | + } |
|
612 | + |
|
613 | + /** |
|
614 | + * Get the 'analytics-enable' option. |
|
615 | + * |
|
616 | + * @since TBD |
|
617 | + * |
|
618 | + * @return string 'no' or 'yes' representing bool. |
|
619 | + */ |
|
620 | + public function is_analytics_enable() { |
|
621 | + return 'yes' === $this->get( 'wl_analytics_settings', self::ANALYTICS_ENABLE, 'no' ); |
|
622 | + } |
|
623 | + |
|
624 | + /** |
|
625 | + * Set the `analytics-enable` option. |
|
626 | + * |
|
627 | + * @since TBD |
|
628 | + * |
|
629 | + * @param bool $value True to enabling analytics, otherwise false. |
|
630 | + */ |
|
631 | + public function set_is_analytics_enable( $value ) { |
|
632 | + |
|
633 | + $this->set( 'wl_general_settings', self::ANALYTICS_ENABLE, true === $value ? 'yes' : 'no' ); |
|
634 | + } |
|
635 | + |
|
636 | + /** |
|
637 | + * Get the 'analytics-entity-uri-dimention' option. |
|
638 | + * |
|
639 | + * @since TBD |
|
640 | + * |
|
641 | + * @return int |
|
642 | + */ |
|
643 | + public function get_analytics_entity_uri_dimension() { |
|
644 | + return (int) $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_URI_DIMENSION, 2 ); |
|
645 | + } |
|
646 | + |
|
647 | + /** |
|
648 | + * Get the 'analytics-entity-type-dimention' option. |
|
649 | + * |
|
650 | + * @since TBD |
|
651 | + * |
|
652 | + * @return int |
|
653 | + */ |
|
654 | + public function get_analytics_entity_type_dimension() { |
|
655 | + return $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_TYPE_DIMENSION, 1 ); |
|
656 | + } |
|
657 | + |
|
658 | + /** |
|
659 | + * Get the URL to perform batch analyses. |
|
660 | + * |
|
661 | + * @since 3.14.0 |
|
662 | + * |
|
663 | + * @return string The URL to call to perform the batch analyzes. |
|
664 | + */ |
|
665 | + public function get_batch_analysis_url() { |
|
666 | + |
|
667 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'batch-analyses'; |
|
668 | + |
|
669 | + } |
|
670 | + |
|
671 | + /** |
|
672 | + * Get the URL to perform autocomplete request. |
|
673 | + * |
|
674 | + * @since 3.15.0 |
|
675 | + * |
|
676 | + * @return string The URL to call to perform the batch analyzes. |
|
677 | + */ |
|
678 | + public function get_autocomplete_url() { |
|
679 | + |
|
680 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'autocomplete'; |
|
681 | + |
|
682 | + } |
|
683 | + |
|
684 | + /** |
|
685 | + * Get the URL to perform feedback deactivation request. |
|
686 | + * |
|
687 | + * @since 3.19.0 |
|
688 | + * |
|
689 | + * @return string The URL to call to perform the feedback deactivation request. |
|
690 | + */ |
|
691 | + public function get_deactivation_feedback_url() { |
|
692 | + |
|
693 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'feedbacks'; |
|
694 | + |
|
695 | + } |
|
696 | + |
|
697 | + /** |
|
698 | + * Get the base API URL. |
|
699 | + * |
|
700 | + * @since 3.20.0 |
|
701 | + * |
|
702 | + * @return string The base API URL. |
|
703 | + */ |
|
704 | + public function get_api_url() { |
|
705 | + |
|
706 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE; |
|
707 | + } |
|
708 | 708 | |
709 | 709 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @since 3.6.0 |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function __construct() { |
140 | 140 | |
141 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
141 | + $this->log = Wordlift_Log_Service::get_logger(get_class()); |
|
142 | 142 | |
143 | 143 | self::$instance = $this; |
144 | 144 | |
@@ -168,11 +168,11 @@ discard block |
||
168 | 168 | * |
169 | 169 | * @return mixed The configuration value or the default value if not found. |
170 | 170 | */ |
171 | - private function get( $option, $key, $default = '' ) { |
|
171 | + private function get($option, $key, $default = '') { |
|
172 | 172 | |
173 | - $options = get_option( $option, array() ); |
|
173 | + $options = get_option($option, array()); |
|
174 | 174 | |
175 | - return isset( $options[ $key ] ) ? $options[ $key ] : $default; |
|
175 | + return isset($options[$key]) ? $options[$key] : $default; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -184,12 +184,12 @@ discard block |
||
184 | 184 | * @param string $key The value key. |
185 | 185 | * @param mixed $value The value. |
186 | 186 | */ |
187 | - private function set( $option, $key, $value ) { |
|
187 | + private function set($option, $key, $value) { |
|
188 | 188 | |
189 | - $values = get_option( $option ); |
|
190 | - $values = isset( $values ) ? $values : array(); |
|
191 | - $values[ $key ] = $value; |
|
192 | - update_option( $option, $values ); |
|
189 | + $values = get_option($option); |
|
190 | + $values = isset($values) ? $values : array(); |
|
191 | + $values[$key] = $value; |
|
192 | + update_option($option, $values); |
|
193 | 193 | |
194 | 194 | } |
195 | 195 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function get_entity_base_path() { |
204 | 204 | |
205 | - return $this->get( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, 'entity' ); |
|
205 | + return $this->get('wl_general_settings', self::ENTITY_BASE_PATH_KEY, 'entity'); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -212,9 +212,9 @@ discard block |
||
212 | 212 | * |
213 | 213 | * @param string $value The entity base path. |
214 | 214 | */ |
215 | - public function set_entity_base_path( $value ) { |
|
215 | + public function set_entity_base_path($value) { |
|
216 | 216 | |
217 | - $this->set( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, $value ); |
|
217 | + $this->set('wl_general_settings', self::ENTITY_BASE_PATH_KEY, $value); |
|
218 | 218 | |
219 | 219 | } |
220 | 220 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function is_skip_wizard() { |
229 | 229 | |
230 | - return $this->get( 'wl_general_settings', self::SKIP_WIZARD, false ); |
|
230 | + return $this->get('wl_general_settings', self::SKIP_WIZARD, false); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -237,9 +237,9 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @param bool $value True to skip the wizard. We expect a boolean value. |
239 | 239 | */ |
240 | - public function set_skip_wizard( $value ) { |
|
240 | + public function set_skip_wizard($value) { |
|
241 | 241 | |
242 | - $this->set( 'wl_general_settings', self::SKIP_WIZARD, true === $value ); |
|
242 | + $this->set('wl_general_settings', self::SKIP_WIZARD, true === $value); |
|
243 | 243 | |
244 | 244 | } |
245 | 245 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | */ |
253 | 253 | public function get_key() { |
254 | 254 | |
255 | - return $this->get( 'wl_general_settings', self::KEY, '' ); |
|
255 | + return $this->get('wl_general_settings', self::KEY, ''); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -262,9 +262,9 @@ discard block |
||
262 | 262 | * |
263 | 263 | * @param string $value WordLift's key. |
264 | 264 | */ |
265 | - public function set_key( $value ) { |
|
265 | + public function set_key($value) { |
|
266 | 266 | |
267 | - $this->set( 'wl_general_settings', self::KEY, $value ); |
|
267 | + $this->set('wl_general_settings', self::KEY, $value); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | */ |
279 | 279 | public function get_language_code() { |
280 | 280 | |
281 | - return $this->get( 'wl_general_settings', self::LANGUAGE, 'en' ); |
|
281 | + return $this->get('wl_general_settings', self::LANGUAGE, 'en'); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -288,9 +288,9 @@ discard block |
||
288 | 288 | * |
289 | 289 | * @param string $value WordLift's language code. |
290 | 290 | */ |
291 | - public function set_language_code( $value ) { |
|
291 | + public function set_language_code($value) { |
|
292 | 292 | |
293 | - $this->set( 'wl_general_settings', self::LANGUAGE, $value ); |
|
293 | + $this->set('wl_general_settings', self::LANGUAGE, $value); |
|
294 | 294 | |
295 | 295 | } |
296 | 296 | |
@@ -301,9 +301,9 @@ discard block |
||
301 | 301 | * |
302 | 302 | * @param string $value The user preferences(yes/no). |
303 | 303 | */ |
304 | - public function set_diagnostic_preferences( $value ) { |
|
304 | + public function set_diagnostic_preferences($value) { |
|
305 | 305 | |
306 | - $this->set( 'wl_general_settings', self::SEND_DIAGNOSTIC, $value ); |
|
306 | + $this->set('wl_general_settings', self::SEND_DIAGNOSTIC, $value); |
|
307 | 307 | |
308 | 308 | } |
309 | 309 | |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | */ |
315 | 315 | public function get_diagnostic_preferences() { |
316 | 316 | |
317 | - return $this->get( 'wl_general_settings', self::SEND_DIAGNOSTIC, 'no' ); |
|
317 | + return $this->get('wl_general_settings', self::SEND_DIAGNOSTIC, 'no'); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | /** |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | */ |
327 | 327 | public function get_country_code() { |
328 | 328 | |
329 | - return $this->get( 'wl_general_settings', self::COUNTRY_CODE, 'us' ); |
|
329 | + return $this->get('wl_general_settings', self::COUNTRY_CODE, 'us'); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | /** |
@@ -336,9 +336,9 @@ discard block |
||
336 | 336 | * |
337 | 337 | * @param string $value WordLift's country code. |
338 | 338 | */ |
339 | - public function set_country_code( $value ) { |
|
339 | + public function set_country_code($value) { |
|
340 | 340 | |
341 | - $this->set( 'wl_general_settings', self::COUNTRY_CODE, $value ); |
|
341 | + $this->set('wl_general_settings', self::COUNTRY_CODE, $value); |
|
342 | 342 | |
343 | 343 | } |
344 | 344 | |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | */ |
355 | 355 | public function get_publisher_id() { |
356 | 356 | |
357 | - return $this->get( 'wl_general_settings', self::PUBLISHER_ID, null ); |
|
357 | + return $this->get('wl_general_settings', self::PUBLISHER_ID, null); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | /** |
@@ -364,9 +364,9 @@ discard block |
||
364 | 364 | * |
365 | 365 | * @param int $value The publisher entity post id. |
366 | 366 | */ |
367 | - public function set_publisher_id( $value ) { |
|
367 | + public function set_publisher_id($value) { |
|
368 | 368 | |
369 | - $this->set( 'wl_general_settings', self::PUBLISHER_ID, $value ); |
|
369 | + $this->set('wl_general_settings', self::PUBLISHER_ID, $value); |
|
370 | 370 | |
371 | 371 | } |
372 | 372 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | */ |
380 | 380 | public function get_dataset_uri() { |
381 | 381 | |
382 | - return $this->get( 'wl_advanced_settings', self::DATASET_URI, null ); |
|
382 | + return $this->get('wl_advanced_settings', self::DATASET_URI, null); |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | /** |
@@ -389,9 +389,9 @@ discard block |
||
389 | 389 | * |
390 | 390 | * @param string $value The dataset URI. |
391 | 391 | */ |
392 | - public function set_dataset_uri( $value ) { |
|
392 | + public function set_dataset_uri($value) { |
|
393 | 393 | |
394 | - $this->set( 'wl_advanced_settings', self::DATASET_URI, $value ); |
|
394 | + $this->set('wl_advanced_settings', self::DATASET_URI, $value); |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | /** |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | */ |
404 | 404 | public function get_package_type() { |
405 | 405 | |
406 | - return $this->get( 'wl_advanced_settings', self::PACKAGE_TYPE, null ); |
|
406 | + return $this->get('wl_advanced_settings', self::PACKAGE_TYPE, null); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | /** |
@@ -413,9 +413,9 @@ discard block |
||
413 | 413 | * |
414 | 414 | * @param string $value The package type. |
415 | 415 | */ |
416 | - public function set_package_type( $value ) { |
|
416 | + public function set_package_type($value) { |
|
417 | 417 | |
418 | - $this->set( 'wl_advanced_settings', self::PACKAGE_TYPE, $value ); |
|
418 | + $this->set('wl_advanced_settings', self::PACKAGE_TYPE, $value); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | /** |
@@ -431,11 +431,11 @@ discard block |
||
431 | 431 | * @param array $old_value The old settings. |
432 | 432 | * @param array $new_value The new settings. |
433 | 433 | */ |
434 | - public function update_key( $old_value, $new_value ) { |
|
434 | + public function update_key($old_value, $new_value) { |
|
435 | 435 | |
436 | 436 | // Check the old key value and the new one. We're going to ask for the dataset URI only if the key has changed. |
437 | 437 | // $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
438 | - $new_key = isset( $new_value['key'] ) ? $new_value['key'] : ''; |
|
438 | + $new_key = isset($new_value['key']) ? $new_value['key'] : ''; |
|
439 | 439 | |
440 | 440 | // If the key hasn't changed, don't do anything. |
441 | 441 | // WARN The 'update_option' hook is fired only if the new and old value are not equal. |
@@ -444,12 +444,12 @@ discard block |
||
444 | 444 | // } |
445 | 445 | |
446 | 446 | // If the key is empty, empty the dataset URI. |
447 | - if ( '' === $new_key ) { |
|
448 | - $this->set_dataset_uri( '' ); |
|
447 | + if ('' === $new_key) { |
|
448 | + $this->set_dataset_uri(''); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | // make the request to the remote server. |
452 | - $this->get_remote_dataset_uri( $new_key ); |
|
452 | + $this->get_remote_dataset_uri($new_key); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | /** |
@@ -463,9 +463,9 @@ discard block |
||
463 | 463 | * |
464 | 464 | * @param string $key The key to be used. |
465 | 465 | */ |
466 | - public function get_remote_dataset_uri( $key ) { |
|
466 | + public function get_remote_dataset_uri($key) { |
|
467 | 467 | |
468 | - $this->log->trace( 'Getting the remote dataset URI and package type...' ); |
|
468 | + $this->log->trace('Getting the remote dataset URI and package type...'); |
|
469 | 469 | |
470 | 470 | /** |
471 | 471 | * Allow 3rd parties to change the site_url. |
@@ -476,36 +476,36 @@ discard block |
||
476 | 476 | * |
477 | 477 | * @param string $site_url The site url. |
478 | 478 | */ |
479 | - $site_url = apply_filters( 'wl_production_site_url', site_url() ); |
|
479 | + $site_url = apply_filters('wl_production_site_url', site_url()); |
|
480 | 480 | |
481 | 481 | // Build the URL. |
482 | 482 | $url = $this->get_accounts() |
483 | - . '?key=' . rawurlencode( $key ) |
|
484 | - . '&url=' . rawurlencode( $site_url ) |
|
485 | - . '&country=' . $this->get_country_code() |
|
486 | - . '&language=' . $this->get_language_code(); |
|
483 | + . '?key='.rawurlencode($key) |
|
484 | + . '&url='.rawurlencode($site_url) |
|
485 | + . '&country='.$this->get_country_code() |
|
486 | + . '&language='.$this->get_language_code(); |
|
487 | 487 | |
488 | - $args = wp_parse_args( unserialize( WL_REDLINK_API_HTTP_OPTIONS ), array( |
|
488 | + $args = wp_parse_args(unserialize(WL_REDLINK_API_HTTP_OPTIONS), array( |
|
489 | 489 | 'method' => 'PUT', |
490 | - ) ); |
|
491 | - $response = wp_remote_request( $url, $args ); |
|
490 | + )); |
|
491 | + $response = wp_remote_request($url, $args); |
|
492 | 492 | |
493 | 493 | // The response is an error. |
494 | - if ( is_wp_error( $response ) ) { |
|
495 | - $this->log->error( 'An error occurred setting the dataset URI: ' . $response->get_error_message() ); |
|
494 | + if (is_wp_error($response)) { |
|
495 | + $this->log->error('An error occurred setting the dataset URI: '.$response->get_error_message()); |
|
496 | 496 | |
497 | - $this->set_dataset_uri( '' ); |
|
498 | - $this->set_package_type( null ); |
|
497 | + $this->set_dataset_uri(''); |
|
498 | + $this->set_package_type(null); |
|
499 | 499 | |
500 | 500 | return; |
501 | 501 | } |
502 | 502 | |
503 | 503 | // The response is not OK. |
504 | - if ( 200 !== (int) $response['response']['code'] ) { |
|
505 | - $this->log->error( "Unexpected status code when opening URL $url: " . $response['response']['code'] ); |
|
504 | + if (200 !== (int) $response['response']['code']) { |
|
505 | + $this->log->error("Unexpected status code when opening URL $url: ".$response['response']['code']); |
|
506 | 506 | |
507 | - $this->set_dataset_uri( '' ); |
|
508 | - $this->set_package_type( null ); |
|
507 | + $this->set_dataset_uri(''); |
|
508 | + $this->set_package_type(null); |
|
509 | 509 | |
510 | 510 | return; |
511 | 511 | } |
@@ -515,14 +515,14 @@ discard block |
||
515 | 515 | * |
516 | 516 | * @since 3.20.0 |
517 | 517 | */ |
518 | - $json = json_decode( $response['body'] ); |
|
518 | + $json = json_decode($response['body']); |
|
519 | 519 | $dataset_uri = $json->datasetURI; |
520 | - $package_type = isset( $json->packageType ) ? $json->packageType : null; |
|
520 | + $package_type = isset($json->packageType) ? $json->packageType : null; |
|
521 | 521 | |
522 | - $this->log->info( "Updating [ dataset uri :: $dataset_uri ][ package type :: $package_type ]..." ); |
|
522 | + $this->log->info("Updating [ dataset uri :: $dataset_uri ][ package type :: $package_type ]..."); |
|
523 | 523 | |
524 | - $this->set_dataset_uri( $dataset_uri ); |
|
525 | - $this->set_package_type( $package_type ); |
|
524 | + $this->set_dataset_uri($dataset_uri); |
|
525 | + $this->set_package_type($package_type); |
|
526 | 526 | |
527 | 527 | } |
528 | 528 | |
@@ -541,20 +541,20 @@ discard block |
||
541 | 541 | * |
542 | 542 | * @return mixed The same value in the $value parameter |
543 | 543 | */ |
544 | - function maybe_update_dataset_uri( $value, $old_value ) { |
|
544 | + function maybe_update_dataset_uri($value, $old_value) { |
|
545 | 545 | |
546 | 546 | // Check the old key value and the new one. Here we're only handling the |
547 | 547 | // case where the key hasn't changed and the dataset URI isn't set. The |
548 | 548 | // other case, i.e. a new key is inserted, is handled at `update_key`. |
549 | - $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
550 | - $new_key = isset( $value['key'] ) ? $value['key'] : ''; |
|
549 | + $old_key = isset($old_value['key']) ? $old_value['key'] : ''; |
|
550 | + $new_key = isset($value['key']) ? $value['key'] : ''; |
|
551 | 551 | |
552 | 552 | $dataset_uri = $this->get_dataset_uri(); |
553 | 553 | |
554 | - if ( ! empty( $new_key ) && $new_key === $old_key && empty( $dataset_uri ) ) { |
|
554 | + if ( ! empty($new_key) && $new_key === $old_key && empty($dataset_uri)) { |
|
555 | 555 | |
556 | 556 | // make the request to the remote server to try to get the dataset uri. |
557 | - $this->get_remote_dataset_uri( $new_key ); |
|
557 | + $this->get_remote_dataset_uri($new_key); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | return $value; |
@@ -569,9 +569,9 @@ discard block |
||
569 | 569 | * |
570 | 570 | * @return string The API URI. |
571 | 571 | */ |
572 | - public function get_accounts_by_key_dataset_uri( $key ) { |
|
572 | + public function get_accounts_by_key_dataset_uri($key) { |
|
573 | 573 | |
574 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "accounts/key=$key/dataset_uri"; |
|
574 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE."accounts/key=$key/dataset_uri"; |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | /** |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | */ |
584 | 584 | public function get_accounts() { |
585 | 585 | |
586 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'accounts'; |
|
586 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE.'accounts'; |
|
587 | 587 | } |
588 | 588 | |
589 | 589 | /** |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | */ |
596 | 596 | public function is_link_by_default() { |
597 | 597 | |
598 | - return 'yes' === $this->get( 'wl_general_settings', self::LINK_BY_DEFAULT, 'yes' ); |
|
598 | + return 'yes' === $this->get('wl_general_settings', self::LINK_BY_DEFAULT, 'yes'); |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | /** |
@@ -605,9 +605,9 @@ discard block |
||
605 | 605 | * |
606 | 606 | * @param bool $value True to enabling linking by default, otherwise false. |
607 | 607 | */ |
608 | - public function set_link_by_default( $value ) { |
|
608 | + public function set_link_by_default($value) { |
|
609 | 609 | |
610 | - $this->set( 'wl_general_settings', self::LINK_BY_DEFAULT, true === $value ? 'yes' : 'no' ); |
|
610 | + $this->set('wl_general_settings', self::LINK_BY_DEFAULT, true === $value ? 'yes' : 'no'); |
|
611 | 611 | } |
612 | 612 | |
613 | 613 | /** |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | * @return string 'no' or 'yes' representing bool. |
619 | 619 | */ |
620 | 620 | public function is_analytics_enable() { |
621 | - return 'yes' === $this->get( 'wl_analytics_settings', self::ANALYTICS_ENABLE, 'no' ); |
|
621 | + return 'yes' === $this->get('wl_analytics_settings', self::ANALYTICS_ENABLE, 'no'); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | /** |
@@ -628,9 +628,9 @@ discard block |
||
628 | 628 | * |
629 | 629 | * @param bool $value True to enabling analytics, otherwise false. |
630 | 630 | */ |
631 | - public function set_is_analytics_enable( $value ) { |
|
631 | + public function set_is_analytics_enable($value) { |
|
632 | 632 | |
633 | - $this->set( 'wl_general_settings', self::ANALYTICS_ENABLE, true === $value ? 'yes' : 'no' ); |
|
633 | + $this->set('wl_general_settings', self::ANALYTICS_ENABLE, true === $value ? 'yes' : 'no'); |
|
634 | 634 | } |
635 | 635 | |
636 | 636 | /** |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | * @return int |
642 | 642 | */ |
643 | 643 | public function get_analytics_entity_uri_dimension() { |
644 | - return (int) $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_URI_DIMENSION, 2 ); |
|
644 | + return (int) $this->get('wl_analytics_settings', self::ANALYTICS_ENTITY_URI_DIMENSION, 2); |
|
645 | 645 | } |
646 | 646 | |
647 | 647 | /** |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | * @return int |
653 | 653 | */ |
654 | 654 | public function get_analytics_entity_type_dimension() { |
655 | - return $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_TYPE_DIMENSION, 1 ); |
|
655 | + return $this->get('wl_analytics_settings', self::ANALYTICS_ENTITY_TYPE_DIMENSION, 1); |
|
656 | 656 | } |
657 | 657 | |
658 | 658 | /** |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | */ |
665 | 665 | public function get_batch_analysis_url() { |
666 | 666 | |
667 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'batch-analyses'; |
|
667 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE.'batch-analyses'; |
|
668 | 668 | |
669 | 669 | } |
670 | 670 | |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | */ |
678 | 678 | public function get_autocomplete_url() { |
679 | 679 | |
680 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'autocomplete'; |
|
680 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE.'autocomplete'; |
|
681 | 681 | |
682 | 682 | } |
683 | 683 | |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | */ |
691 | 691 | public function get_deactivation_feedback_url() { |
692 | 692 | |
693 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'feedbacks'; |
|
693 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE.'feedbacks'; |
|
694 | 694 | |
695 | 695 | } |
696 | 696 |
@@ -18,280 +18,280 @@ |
||
18 | 18 | */ |
19 | 19 | class Wordlift_Admin_Analytics_Settings_Page extends Wordlift_Admin_Page { |
20 | 20 | |
21 | - /** |
|
22 | - * A singleton instance of the Notice service. |
|
23 | - * |
|
24 | - * @since x.x.x |
|
25 | - * @access private |
|
26 | - * @var \Wordlift_Admin_Analytics_Settings_Page $instance A singleton instance of a {@link Wordlift_Admin_Analytics_Settings_Page} class. |
|
27 | - */ |
|
28 | - private static $instance; |
|
29 | - |
|
30 | - /** |
|
31 | - * A {@link Wordlift_Configuration_Service} instance. |
|
32 | - * |
|
33 | - * @since x.x.x |
|
34 | - * @access private |
|
35 | - * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
36 | - */ |
|
37 | - private $configuration_service; |
|
38 | - |
|
39 | - /** |
|
40 | - * A {@link Wordlift_Admin_Input_Element} element renderer. |
|
41 | - * |
|
42 | - * @since x.x.x |
|
43 | - * @access private |
|
44 | - * @var \Wordlift_Admin_Input_Element $input_element An {@link Wordlift_Admin_Input_Element} element renderer. |
|
45 | - */ |
|
46 | - private $input_element; |
|
47 | - |
|
48 | - /** |
|
49 | - * A {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
50 | - * |
|
51 | - * @since x.x.x |
|
52 | - * @access protected |
|
53 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element A {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
54 | - */ |
|
55 | - private $radio_input_element; |
|
56 | - |
|
57 | - /** |
|
58 | - * Create a {@link Wordlift_Admin_Settings_Page} instance. |
|
59 | - * |
|
60 | - * @since x.x.x |
|
61 | - * |
|
62 | - * @param \Wordlift_Configuration_Service $configuration_service |
|
63 | - * @param \Wordlift_Admin_Input_Element $input_element |
|
64 | - * @param \Wordlift_Admin_Radio_Input_Element $radio_input_element |
|
65 | - */ |
|
66 | - public function __construct( $configuration_service, $input_element, $radio_input_element ) { |
|
67 | - |
|
68 | - $this->configuration_service = $configuration_service; |
|
69 | - |
|
70 | - // Set a reference to the UI elements. |
|
71 | - $this->input_element = $input_element; |
|
72 | - $this->radio_input_element = $radio_input_element; |
|
73 | - |
|
74 | - self::$instance = $this; |
|
75 | - } |
|
76 | - |
|
77 | - /** |
|
78 | - * Get the singleton instance of the Notice service. |
|
79 | - * |
|
80 | - * @since x.x.x |
|
81 | - * @return \Wordlift_Admin_Settings_Page The singleton instance of the settings page service. |
|
82 | - */ |
|
83 | - public static function get_instance() { |
|
84 | - |
|
85 | - return self::$instance; |
|
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * @inheritdoc |
|
90 | - */ |
|
91 | - protected function get_parent_slug() { |
|
92 | - |
|
93 | - return 'wl_admin_menu'; |
|
94 | - } |
|
95 | - |
|
96 | - /** |
|
97 | - * @inheritdoc |
|
98 | - */ |
|
99 | - protected function get_capability() { |
|
100 | - |
|
101 | - return 'manage_options'; |
|
102 | - } |
|
103 | - |
|
104 | - /** |
|
105 | - * @inheritdoc |
|
106 | - */ |
|
107 | - public function get_page_title() { |
|
108 | - |
|
109 | - return 'WorldLift Analytics Settings'; |
|
110 | - } |
|
111 | - |
|
112 | - /** |
|
113 | - * @inheritdoc |
|
114 | - */ |
|
115 | - public function get_menu_title() { |
|
116 | - |
|
117 | - return 'Analytics Settings'; |
|
118 | - } |
|
119 | - |
|
120 | - /** |
|
121 | - * @inheritdoc |
|
122 | - */ |
|
123 | - public function get_menu_slug() { |
|
124 | - |
|
125 | - return 'wl_configuration_admin_analytics_menu'; |
|
126 | - } |
|
127 | - |
|
128 | - /** |
|
129 | - * @inheritdoc |
|
130 | - */ |
|
131 | - public function get_partial_name() { |
|
132 | - |
|
133 | - return 'wordlift-admin-analytics-settings-page.php'; |
|
134 | - } |
|
135 | - |
|
136 | - /** |
|
137 | - * Configure all the configuration parameters. |
|
138 | - * |
|
139 | - * Called by the *admin_init* hook. |
|
140 | - * |
|
141 | - * @since x.x.x |
|
142 | - */ |
|
143 | - public function admin_init() { |
|
144 | - |
|
145 | - // Register WordLift's analytics settings with our in class sanitizer. |
|
146 | - register_setting( |
|
147 | - 'wl_analytics_settings', |
|
148 | - 'wl_analytics_settings', |
|
149 | - array( $this, 'sanitize_callback' ) |
|
150 | - ); |
|
151 | - |
|
152 | - // Add the analytics settings setction. |
|
153 | - add_settings_section( |
|
154 | - 'wl_analytics_settings_section', |
|
155 | - '', |
|
156 | - '', |
|
157 | - 'wl_analytics_settings' |
|
158 | - ); |
|
159 | - |
|
160 | - // Add a toggle to determine if analytics functions are enabled or not. |
|
161 | - // NOTE: this uses yes/no rather than true/false. |
|
162 | - add_settings_field( |
|
163 | - 'wl-analytics-enabled', |
|
164 | - __( 'Enable Analytics', 'wordlift' ), |
|
165 | - array( $this->radio_input_element, 'render' ), |
|
166 | - 'wl_analytics_settings', |
|
167 | - 'wl_analytics_settings_section', |
|
168 | - array( |
|
169 | - 'id' => 'wl-analytics-enable', |
|
170 | - 'name' => 'wl_analytics_settings[' . $this->configuration_service::ANALYTICS_ENABLE . ']', |
|
171 | - 'value' => $this->configuration_service->is_analytics_enable() ? 'yes' : 'no', |
|
172 | - 'description' => __( 'Toggle on/off the default values.', 'wordlift' ), |
|
173 | - ) |
|
174 | - ); |
|
175 | - |
|
176 | - /** |
|
177 | - * A basic number field that will accept anything from 1 to 20. |
|
178 | - * |
|
179 | - * Represents the custom dim number for the uri. |
|
180 | - */ |
|
181 | - add_settings_field( |
|
182 | - 'wl-analytics-entity-uri-dimension', |
|
183 | - __( 'Entity URI dimension', 'wordlift' ), |
|
184 | - array( $this->input_element, 'render' ), |
|
185 | - 'wl_analytics_settings', |
|
186 | - 'wl_analytics_settings_section', |
|
187 | - array( |
|
188 | - 'id' => 'wl-analytics-entity-uri-dimension', |
|
189 | - 'name' => 'wl_analytics_settings[' . $this->configuration_service::ANALYTICS_ENTITY_URI_DIMENSION . ']', |
|
190 | - 'type' => 'number', |
|
191 | - 'value' => $this->configuration_service->get_analytics_entity_uri_dimension(), |
|
192 | - 'description' => __( 'Entity URI diemsion', 'wordlift' ), |
|
193 | - ) |
|
194 | - ); |
|
195 | - |
|
196 | - /** |
|
197 | - * A basic number field that will accept anything from 1 to 20. |
|
198 | - * |
|
199 | - * Represents the custom dim number for the type. |
|
200 | - */ |
|
201 | - add_settings_field( |
|
202 | - 'wl-analytics-entity-type-dimension', |
|
203 | - __( 'Entity Type dimension', 'wordlift' ), |
|
204 | - array( $this->input_element, 'render' ), |
|
205 | - 'wl_analytics_settings', |
|
206 | - 'wl_analytics_settings_section', |
|
207 | - array( |
|
208 | - 'id' => 'wl-analytics-entity-type-dimension', |
|
209 | - 'name' => 'wl_analytics_settings[' . $this->configuration_service::ANALYTICS_ENTITY_TYPE_DIMENSION . ']', |
|
210 | - 'type' => 'number', |
|
211 | - 'value' => $this->configuration_service->get_analytics_entity_type_dimension(), |
|
212 | - 'description' => __( 'Entity Type dimension', 'wordlift' ), |
|
213 | - ) |
|
214 | - ); |
|
215 | - |
|
216 | - } |
|
217 | - |
|
218 | - /** |
|
219 | - * Validates an entity uri based on an integer passed. |
|
220 | - * |
|
221 | - * TODO: Needs a feedback method to pass back error messages. |
|
222 | - * |
|
223 | - * @method validate_entity_uri |
|
224 | - * @since x.x.x |
|
225 | - * @param string $uri a sting representing an entity ID that can be converted to a uri. |
|
226 | - * @return int |
|
227 | - */ |
|
228 | - public function validate_entity_uri( $uri ) { |
|
229 | - // Basic validation is to ensure number is between 1 and 20. |
|
230 | - // NOTE: certain analytics accounts have a much higher value - as many |
|
231 | - // as 200 are allowed. |
|
232 | - if ( (int) $uri < 1 || (int) $uri > 20 ) { |
|
233 | - // if we are out of range then pass the default value. |
|
234 | - $uri = $this->configuration_service->get_analytics_entity_uri_dimension(); |
|
235 | - } |
|
236 | - return absint( $uri ); |
|
237 | - } |
|
238 | - |
|
239 | - /** |
|
240 | - * Validates an entity type. |
|
241 | - * |
|
242 | - * TODO: Needs a feedback method to pass back error messages. |
|
243 | - * |
|
244 | - * @method validate_entity_type |
|
245 | - * @since x.x.x |
|
246 | - * @param string $type This is an entity type ID in string form - really a number. |
|
247 | - * @return int |
|
248 | - */ |
|
249 | - public function validate_entity_type( $type ) { |
|
250 | - // Basic validation is to ensure number is between 1 and 20. |
|
251 | - // NOTE: certain analytics accounts have a much higher value - as many |
|
252 | - // as 200 are allowed. |
|
253 | - if ( (int) $type < 1 || (int) $type > 20 ) { |
|
254 | - // if we are out of range then pass the default value. |
|
255 | - $type = $this->configuration_service->get_analytics_entity_type_dimension(); |
|
256 | - } |
|
257 | - return absint( $type ); |
|
258 | - } |
|
259 | - |
|
260 | - /** |
|
261 | - * Sanitize the configuration settings to be stored. |
|
262 | - * |
|
263 | - * If a new entity is being created for the publisher, create it and set The |
|
264 | - * publisher setting. |
|
265 | - * |
|
266 | - * @since x.x.x |
|
267 | - * |
|
268 | - * @param array $input The configuration settings array. |
|
269 | - * |
|
270 | - * @return array The sanitized input array. |
|
271 | - */ |
|
272 | - public function sanitize_callback( $input ) { |
|
273 | - if ( ! check_admin_referer( 'wl_analytics_settings-options' ) ) { |
|
274 | - // Any failing nonce checks already die(). |
|
275 | - return; |
|
276 | - } |
|
277 | - |
|
278 | - /** |
|
279 | - * Validate and sanitize the $inputs and store them in $output saved. |
|
280 | - */ |
|
281 | - $output = array(); |
|
282 | - if ( isset( $input['analytics_enable'] ) ) { |
|
283 | - $output['analytics_enable'] = ( 'yes' === $input['analytics_enable'] ) ? 'yes' : 'no'; |
|
284 | - } |
|
285 | - if ( isset( $input['analytics_entity_uri_dimension'] ) ) { |
|
286 | - $output['analytics_entity_uri_dimension'] = (int) $this->validate_entity_uri( $input['analytics_entity_uri_dimension'] ); |
|
287 | - } |
|
288 | - if ( isset( $input['analytics_entity_type_dimension'] ) ) { |
|
289 | - $output['analytics_entity_type_dimension'] = (int) $this->validate_entity_type( $input['analytics_entity_type_dimension'] ); |
|
290 | - } |
|
291 | - |
|
292 | - // return items added to the output for saving. |
|
293 | - return $output; |
|
294 | - } |
|
21 | + /** |
|
22 | + * A singleton instance of the Notice service. |
|
23 | + * |
|
24 | + * @since x.x.x |
|
25 | + * @access private |
|
26 | + * @var \Wordlift_Admin_Analytics_Settings_Page $instance A singleton instance of a {@link Wordlift_Admin_Analytics_Settings_Page} class. |
|
27 | + */ |
|
28 | + private static $instance; |
|
29 | + |
|
30 | + /** |
|
31 | + * A {@link Wordlift_Configuration_Service} instance. |
|
32 | + * |
|
33 | + * @since x.x.x |
|
34 | + * @access private |
|
35 | + * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
36 | + */ |
|
37 | + private $configuration_service; |
|
38 | + |
|
39 | + /** |
|
40 | + * A {@link Wordlift_Admin_Input_Element} element renderer. |
|
41 | + * |
|
42 | + * @since x.x.x |
|
43 | + * @access private |
|
44 | + * @var \Wordlift_Admin_Input_Element $input_element An {@link Wordlift_Admin_Input_Element} element renderer. |
|
45 | + */ |
|
46 | + private $input_element; |
|
47 | + |
|
48 | + /** |
|
49 | + * A {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
50 | + * |
|
51 | + * @since x.x.x |
|
52 | + * @access protected |
|
53 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element A {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
54 | + */ |
|
55 | + private $radio_input_element; |
|
56 | + |
|
57 | + /** |
|
58 | + * Create a {@link Wordlift_Admin_Settings_Page} instance. |
|
59 | + * |
|
60 | + * @since x.x.x |
|
61 | + * |
|
62 | + * @param \Wordlift_Configuration_Service $configuration_service |
|
63 | + * @param \Wordlift_Admin_Input_Element $input_element |
|
64 | + * @param \Wordlift_Admin_Radio_Input_Element $radio_input_element |
|
65 | + */ |
|
66 | + public function __construct( $configuration_service, $input_element, $radio_input_element ) { |
|
67 | + |
|
68 | + $this->configuration_service = $configuration_service; |
|
69 | + |
|
70 | + // Set a reference to the UI elements. |
|
71 | + $this->input_element = $input_element; |
|
72 | + $this->radio_input_element = $radio_input_element; |
|
73 | + |
|
74 | + self::$instance = $this; |
|
75 | + } |
|
76 | + |
|
77 | + /** |
|
78 | + * Get the singleton instance of the Notice service. |
|
79 | + * |
|
80 | + * @since x.x.x |
|
81 | + * @return \Wordlift_Admin_Settings_Page The singleton instance of the settings page service. |
|
82 | + */ |
|
83 | + public static function get_instance() { |
|
84 | + |
|
85 | + return self::$instance; |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * @inheritdoc |
|
90 | + */ |
|
91 | + protected function get_parent_slug() { |
|
92 | + |
|
93 | + return 'wl_admin_menu'; |
|
94 | + } |
|
95 | + |
|
96 | + /** |
|
97 | + * @inheritdoc |
|
98 | + */ |
|
99 | + protected function get_capability() { |
|
100 | + |
|
101 | + return 'manage_options'; |
|
102 | + } |
|
103 | + |
|
104 | + /** |
|
105 | + * @inheritdoc |
|
106 | + */ |
|
107 | + public function get_page_title() { |
|
108 | + |
|
109 | + return 'WorldLift Analytics Settings'; |
|
110 | + } |
|
111 | + |
|
112 | + /** |
|
113 | + * @inheritdoc |
|
114 | + */ |
|
115 | + public function get_menu_title() { |
|
116 | + |
|
117 | + return 'Analytics Settings'; |
|
118 | + } |
|
119 | + |
|
120 | + /** |
|
121 | + * @inheritdoc |
|
122 | + */ |
|
123 | + public function get_menu_slug() { |
|
124 | + |
|
125 | + return 'wl_configuration_admin_analytics_menu'; |
|
126 | + } |
|
127 | + |
|
128 | + /** |
|
129 | + * @inheritdoc |
|
130 | + */ |
|
131 | + public function get_partial_name() { |
|
132 | + |
|
133 | + return 'wordlift-admin-analytics-settings-page.php'; |
|
134 | + } |
|
135 | + |
|
136 | + /** |
|
137 | + * Configure all the configuration parameters. |
|
138 | + * |
|
139 | + * Called by the *admin_init* hook. |
|
140 | + * |
|
141 | + * @since x.x.x |
|
142 | + */ |
|
143 | + public function admin_init() { |
|
144 | + |
|
145 | + // Register WordLift's analytics settings with our in class sanitizer. |
|
146 | + register_setting( |
|
147 | + 'wl_analytics_settings', |
|
148 | + 'wl_analytics_settings', |
|
149 | + array( $this, 'sanitize_callback' ) |
|
150 | + ); |
|
151 | + |
|
152 | + // Add the analytics settings setction. |
|
153 | + add_settings_section( |
|
154 | + 'wl_analytics_settings_section', |
|
155 | + '', |
|
156 | + '', |
|
157 | + 'wl_analytics_settings' |
|
158 | + ); |
|
159 | + |
|
160 | + // Add a toggle to determine if analytics functions are enabled or not. |
|
161 | + // NOTE: this uses yes/no rather than true/false. |
|
162 | + add_settings_field( |
|
163 | + 'wl-analytics-enabled', |
|
164 | + __( 'Enable Analytics', 'wordlift' ), |
|
165 | + array( $this->radio_input_element, 'render' ), |
|
166 | + 'wl_analytics_settings', |
|
167 | + 'wl_analytics_settings_section', |
|
168 | + array( |
|
169 | + 'id' => 'wl-analytics-enable', |
|
170 | + 'name' => 'wl_analytics_settings[' . $this->configuration_service::ANALYTICS_ENABLE . ']', |
|
171 | + 'value' => $this->configuration_service->is_analytics_enable() ? 'yes' : 'no', |
|
172 | + 'description' => __( 'Toggle on/off the default values.', 'wordlift' ), |
|
173 | + ) |
|
174 | + ); |
|
175 | + |
|
176 | + /** |
|
177 | + * A basic number field that will accept anything from 1 to 20. |
|
178 | + * |
|
179 | + * Represents the custom dim number for the uri. |
|
180 | + */ |
|
181 | + add_settings_field( |
|
182 | + 'wl-analytics-entity-uri-dimension', |
|
183 | + __( 'Entity URI dimension', 'wordlift' ), |
|
184 | + array( $this->input_element, 'render' ), |
|
185 | + 'wl_analytics_settings', |
|
186 | + 'wl_analytics_settings_section', |
|
187 | + array( |
|
188 | + 'id' => 'wl-analytics-entity-uri-dimension', |
|
189 | + 'name' => 'wl_analytics_settings[' . $this->configuration_service::ANALYTICS_ENTITY_URI_DIMENSION . ']', |
|
190 | + 'type' => 'number', |
|
191 | + 'value' => $this->configuration_service->get_analytics_entity_uri_dimension(), |
|
192 | + 'description' => __( 'Entity URI diemsion', 'wordlift' ), |
|
193 | + ) |
|
194 | + ); |
|
195 | + |
|
196 | + /** |
|
197 | + * A basic number field that will accept anything from 1 to 20. |
|
198 | + * |
|
199 | + * Represents the custom dim number for the type. |
|
200 | + */ |
|
201 | + add_settings_field( |
|
202 | + 'wl-analytics-entity-type-dimension', |
|
203 | + __( 'Entity Type dimension', 'wordlift' ), |
|
204 | + array( $this->input_element, 'render' ), |
|
205 | + 'wl_analytics_settings', |
|
206 | + 'wl_analytics_settings_section', |
|
207 | + array( |
|
208 | + 'id' => 'wl-analytics-entity-type-dimension', |
|
209 | + 'name' => 'wl_analytics_settings[' . $this->configuration_service::ANALYTICS_ENTITY_TYPE_DIMENSION . ']', |
|
210 | + 'type' => 'number', |
|
211 | + 'value' => $this->configuration_service->get_analytics_entity_type_dimension(), |
|
212 | + 'description' => __( 'Entity Type dimension', 'wordlift' ), |
|
213 | + ) |
|
214 | + ); |
|
215 | + |
|
216 | + } |
|
217 | + |
|
218 | + /** |
|
219 | + * Validates an entity uri based on an integer passed. |
|
220 | + * |
|
221 | + * TODO: Needs a feedback method to pass back error messages. |
|
222 | + * |
|
223 | + * @method validate_entity_uri |
|
224 | + * @since x.x.x |
|
225 | + * @param string $uri a sting representing an entity ID that can be converted to a uri. |
|
226 | + * @return int |
|
227 | + */ |
|
228 | + public function validate_entity_uri( $uri ) { |
|
229 | + // Basic validation is to ensure number is between 1 and 20. |
|
230 | + // NOTE: certain analytics accounts have a much higher value - as many |
|
231 | + // as 200 are allowed. |
|
232 | + if ( (int) $uri < 1 || (int) $uri > 20 ) { |
|
233 | + // if we are out of range then pass the default value. |
|
234 | + $uri = $this->configuration_service->get_analytics_entity_uri_dimension(); |
|
235 | + } |
|
236 | + return absint( $uri ); |
|
237 | + } |
|
238 | + |
|
239 | + /** |
|
240 | + * Validates an entity type. |
|
241 | + * |
|
242 | + * TODO: Needs a feedback method to pass back error messages. |
|
243 | + * |
|
244 | + * @method validate_entity_type |
|
245 | + * @since x.x.x |
|
246 | + * @param string $type This is an entity type ID in string form - really a number. |
|
247 | + * @return int |
|
248 | + */ |
|
249 | + public function validate_entity_type( $type ) { |
|
250 | + // Basic validation is to ensure number is between 1 and 20. |
|
251 | + // NOTE: certain analytics accounts have a much higher value - as many |
|
252 | + // as 200 are allowed. |
|
253 | + if ( (int) $type < 1 || (int) $type > 20 ) { |
|
254 | + // if we are out of range then pass the default value. |
|
255 | + $type = $this->configuration_service->get_analytics_entity_type_dimension(); |
|
256 | + } |
|
257 | + return absint( $type ); |
|
258 | + } |
|
259 | + |
|
260 | + /** |
|
261 | + * Sanitize the configuration settings to be stored. |
|
262 | + * |
|
263 | + * If a new entity is being created for the publisher, create it and set The |
|
264 | + * publisher setting. |
|
265 | + * |
|
266 | + * @since x.x.x |
|
267 | + * |
|
268 | + * @param array $input The configuration settings array. |
|
269 | + * |
|
270 | + * @return array The sanitized input array. |
|
271 | + */ |
|
272 | + public function sanitize_callback( $input ) { |
|
273 | + if ( ! check_admin_referer( 'wl_analytics_settings-options' ) ) { |
|
274 | + // Any failing nonce checks already die(). |
|
275 | + return; |
|
276 | + } |
|
277 | + |
|
278 | + /** |
|
279 | + * Validate and sanitize the $inputs and store them in $output saved. |
|
280 | + */ |
|
281 | + $output = array(); |
|
282 | + if ( isset( $input['analytics_enable'] ) ) { |
|
283 | + $output['analytics_enable'] = ( 'yes' === $input['analytics_enable'] ) ? 'yes' : 'no'; |
|
284 | + } |
|
285 | + if ( isset( $input['analytics_entity_uri_dimension'] ) ) { |
|
286 | + $output['analytics_entity_uri_dimension'] = (int) $this->validate_entity_uri( $input['analytics_entity_uri_dimension'] ); |
|
287 | + } |
|
288 | + if ( isset( $input['analytics_entity_type_dimension'] ) ) { |
|
289 | + $output['analytics_entity_type_dimension'] = (int) $this->validate_entity_type( $input['analytics_entity_type_dimension'] ); |
|
290 | + } |
|
291 | + |
|
292 | + // return items added to the output for saving. |
|
293 | + return $output; |
|
294 | + } |
|
295 | 295 | |
296 | 296 | |
297 | 297 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param \Wordlift_Admin_Input_Element $input_element |
64 | 64 | * @param \Wordlift_Admin_Radio_Input_Element $radio_input_element |
65 | 65 | */ |
66 | - public function __construct( $configuration_service, $input_element, $radio_input_element ) { |
|
66 | + public function __construct($configuration_service, $input_element, $radio_input_element) { |
|
67 | 67 | |
68 | 68 | $this->configuration_service = $configuration_service; |
69 | 69 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | register_setting( |
147 | 147 | 'wl_analytics_settings', |
148 | 148 | 'wl_analytics_settings', |
149 | - array( $this, 'sanitize_callback' ) |
|
149 | + array($this, 'sanitize_callback') |
|
150 | 150 | ); |
151 | 151 | |
152 | 152 | // Add the analytics settings setction. |
@@ -161,15 +161,15 @@ discard block |
||
161 | 161 | // NOTE: this uses yes/no rather than true/false. |
162 | 162 | add_settings_field( |
163 | 163 | 'wl-analytics-enabled', |
164 | - __( 'Enable Analytics', 'wordlift' ), |
|
165 | - array( $this->radio_input_element, 'render' ), |
|
164 | + __('Enable Analytics', 'wordlift'), |
|
165 | + array($this->radio_input_element, 'render'), |
|
166 | 166 | 'wl_analytics_settings', |
167 | 167 | 'wl_analytics_settings_section', |
168 | 168 | array( |
169 | 169 | 'id' => 'wl-analytics-enable', |
170 | - 'name' => 'wl_analytics_settings[' . $this->configuration_service::ANALYTICS_ENABLE . ']', |
|
170 | + 'name' => 'wl_analytics_settings['.$this->configuration_service::ANALYTICS_ENABLE.']', |
|
171 | 171 | 'value' => $this->configuration_service->is_analytics_enable() ? 'yes' : 'no', |
172 | - 'description' => __( 'Toggle on/off the default values.', 'wordlift' ), |
|
172 | + 'description' => __('Toggle on/off the default values.', 'wordlift'), |
|
173 | 173 | ) |
174 | 174 | ); |
175 | 175 | |
@@ -180,16 +180,16 @@ discard block |
||
180 | 180 | */ |
181 | 181 | add_settings_field( |
182 | 182 | 'wl-analytics-entity-uri-dimension', |
183 | - __( 'Entity URI dimension', 'wordlift' ), |
|
184 | - array( $this->input_element, 'render' ), |
|
183 | + __('Entity URI dimension', 'wordlift'), |
|
184 | + array($this->input_element, 'render'), |
|
185 | 185 | 'wl_analytics_settings', |
186 | 186 | 'wl_analytics_settings_section', |
187 | 187 | array( |
188 | 188 | 'id' => 'wl-analytics-entity-uri-dimension', |
189 | - 'name' => 'wl_analytics_settings[' . $this->configuration_service::ANALYTICS_ENTITY_URI_DIMENSION . ']', |
|
189 | + 'name' => 'wl_analytics_settings['.$this->configuration_service::ANALYTICS_ENTITY_URI_DIMENSION.']', |
|
190 | 190 | 'type' => 'number', |
191 | 191 | 'value' => $this->configuration_service->get_analytics_entity_uri_dimension(), |
192 | - 'description' => __( 'Entity URI diemsion', 'wordlift' ), |
|
192 | + 'description' => __('Entity URI diemsion', 'wordlift'), |
|
193 | 193 | ) |
194 | 194 | ); |
195 | 195 | |
@@ -200,16 +200,16 @@ discard block |
||
200 | 200 | */ |
201 | 201 | add_settings_field( |
202 | 202 | 'wl-analytics-entity-type-dimension', |
203 | - __( 'Entity Type dimension', 'wordlift' ), |
|
204 | - array( $this->input_element, 'render' ), |
|
203 | + __('Entity Type dimension', 'wordlift'), |
|
204 | + array($this->input_element, 'render'), |
|
205 | 205 | 'wl_analytics_settings', |
206 | 206 | 'wl_analytics_settings_section', |
207 | 207 | array( |
208 | 208 | 'id' => 'wl-analytics-entity-type-dimension', |
209 | - 'name' => 'wl_analytics_settings[' . $this->configuration_service::ANALYTICS_ENTITY_TYPE_DIMENSION . ']', |
|
209 | + 'name' => 'wl_analytics_settings['.$this->configuration_service::ANALYTICS_ENTITY_TYPE_DIMENSION.']', |
|
210 | 210 | 'type' => 'number', |
211 | 211 | 'value' => $this->configuration_service->get_analytics_entity_type_dimension(), |
212 | - 'description' => __( 'Entity Type dimension', 'wordlift' ), |
|
212 | + 'description' => __('Entity Type dimension', 'wordlift'), |
|
213 | 213 | ) |
214 | 214 | ); |
215 | 215 | |
@@ -225,15 +225,15 @@ discard block |
||
225 | 225 | * @param string $uri a sting representing an entity ID that can be converted to a uri. |
226 | 226 | * @return int |
227 | 227 | */ |
228 | - public function validate_entity_uri( $uri ) { |
|
228 | + public function validate_entity_uri($uri) { |
|
229 | 229 | // Basic validation is to ensure number is between 1 and 20. |
230 | 230 | // NOTE: certain analytics accounts have a much higher value - as many |
231 | 231 | // as 200 are allowed. |
232 | - if ( (int) $uri < 1 || (int) $uri > 20 ) { |
|
232 | + if ((int) $uri < 1 || (int) $uri > 20) { |
|
233 | 233 | // if we are out of range then pass the default value. |
234 | 234 | $uri = $this->configuration_service->get_analytics_entity_uri_dimension(); |
235 | 235 | } |
236 | - return absint( $uri ); |
|
236 | + return absint($uri); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | /** |
@@ -246,15 +246,15 @@ discard block |
||
246 | 246 | * @param string $type This is an entity type ID in string form - really a number. |
247 | 247 | * @return int |
248 | 248 | */ |
249 | - public function validate_entity_type( $type ) { |
|
249 | + public function validate_entity_type($type) { |
|
250 | 250 | // Basic validation is to ensure number is between 1 and 20. |
251 | 251 | // NOTE: certain analytics accounts have a much higher value - as many |
252 | 252 | // as 200 are allowed. |
253 | - if ( (int) $type < 1 || (int) $type > 20 ) { |
|
253 | + if ((int) $type < 1 || (int) $type > 20) { |
|
254 | 254 | // if we are out of range then pass the default value. |
255 | 255 | $type = $this->configuration_service->get_analytics_entity_type_dimension(); |
256 | 256 | } |
257 | - return absint( $type ); |
|
257 | + return absint($type); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return array The sanitized input array. |
271 | 271 | */ |
272 | - public function sanitize_callback( $input ) { |
|
273 | - if ( ! check_admin_referer( 'wl_analytics_settings-options' ) ) { |
|
272 | + public function sanitize_callback($input) { |
|
273 | + if ( ! check_admin_referer('wl_analytics_settings-options')) { |
|
274 | 274 | // Any failing nonce checks already die(). |
275 | 275 | return; |
276 | 276 | } |
@@ -279,14 +279,14 @@ discard block |
||
279 | 279 | * Validate and sanitize the $inputs and store them in $output saved. |
280 | 280 | */ |
281 | 281 | $output = array(); |
282 | - if ( isset( $input['analytics_enable'] ) ) { |
|
283 | - $output['analytics_enable'] = ( 'yes' === $input['analytics_enable'] ) ? 'yes' : 'no'; |
|
282 | + if (isset($input['analytics_enable'])) { |
|
283 | + $output['analytics_enable'] = ('yes' === $input['analytics_enable']) ? 'yes' : 'no'; |
|
284 | 284 | } |
285 | - if ( isset( $input['analytics_entity_uri_dimension'] ) ) { |
|
286 | - $output['analytics_entity_uri_dimension'] = (int) $this->validate_entity_uri( $input['analytics_entity_uri_dimension'] ); |
|
285 | + if (isset($input['analytics_entity_uri_dimension'])) { |
|
286 | + $output['analytics_entity_uri_dimension'] = (int) $this->validate_entity_uri($input['analytics_entity_uri_dimension']); |
|
287 | 287 | } |
288 | - if ( isset( $input['analytics_entity_type_dimension'] ) ) { |
|
289 | - $output['analytics_entity_type_dimension'] = (int) $this->validate_entity_type( $input['analytics_entity_type_dimension'] ); |
|
288 | + if (isset($input['analytics_entity_type_dimension'])) { |
|
289 | + $output['analytics_entity_type_dimension'] = (int) $this->validate_entity_type($input['analytics_entity_type_dimension']); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | // return items added to the output for saving. |
@@ -14,9 +14,9 @@ |
||
14 | 14 | |
15 | 15 | <form action="options.php" method="post"> |
16 | 16 | <?php |
17 | - settings_fields( 'wl_analytics_settings' ); |
|
18 | - do_settings_sections( 'wl_analytics_settings' ); |
|
19 | - submit_button(); |
|
20 | - ?> |
|
17 | + settings_fields( 'wl_analytics_settings' ); |
|
18 | + do_settings_sections( 'wl_analytics_settings' ); |
|
19 | + submit_button(); |
|
20 | + ?> |
|
21 | 21 | </form> |
22 | 22 | </div> |
@@ -8,14 +8,14 @@ |
||
8 | 8 | ?> |
9 | 9 | |
10 | 10 | <div class="wrap" id="wl-settings-page"> |
11 | - <h2><?php esc_html_e( 'WorldLift Analytics Settings', 'wordlift' ); ?></h2> |
|
11 | + <h2><?php esc_html_e('WorldLift Analytics Settings', 'wordlift'); ?></h2> |
|
12 | 12 | |
13 | 13 | <?php settings_errors(); ?> |
14 | 14 | |
15 | 15 | <form action="options.php" method="post"> |
16 | 16 | <?php |
17 | - settings_fields( 'wl_analytics_settings' ); |
|
18 | - do_settings_sections( 'wl_analytics_settings' ); |
|
17 | + settings_fields('wl_analytics_settings'); |
|
18 | + do_settings_sections('wl_analytics_settings'); |
|
19 | 19 | submit_button(); |
20 | 20 | ?> |
21 | 21 | </form> |
@@ -18,56 +18,56 @@ discard block |
||
18 | 18 | */ |
19 | 19 | class Wordlift_Admin_Input_Element implements Wordlift_Admin_Element { |
20 | 20 | |
21 | - /** |
|
22 | - * Output the HTML for an input box type settings_page |
|
23 | - * |
|
24 | - * @param array $args An array with the following keys: |
|
25 | - * Parameters controlling the result. |
|
26 | - * |
|
27 | - * @type string name The name attribute of the input element. Mandatory. |
|
28 | - * |
|
29 | - * @type string id The id attribute of the input element. Optional. |
|
30 | - * @type string id The id attribute of the input element. |
|
31 | - * Optional, randomly generated one is used if not supplied. |
|
32 | - * @type string value The value of the input element. |
|
33 | - * Optional, defaults to empty string. |
|
34 | - * @type bool readonly Indicates whether the input is read only. |
|
35 | - * Optional, defaults to read-write |
|
36 | - * @type string css_class The class attribute for the input element. |
|
37 | - * If empty string no class attribute will be added. |
|
38 | - * Optional, defaults to empty string. |
|
39 | - * @type string description The descriptio text to be displayed below the element. |
|
40 | - * Can include some HTML element. |
|
41 | - * If empty string no description will be displayed. |
|
42 | - * Optional, defaults to empty string. |
|
43 | - * @since *.*.* added the ability to use a $type arg. |
|
44 | - * |
|
45 | - * @return $this|Wordlift_Admin_Element |
|
46 | - */ |
|
47 | - public function render( $args ) { |
|
21 | + /** |
|
22 | + * Output the HTML for an input box type settings_page |
|
23 | + * |
|
24 | + * @param array $args An array with the following keys: |
|
25 | + * Parameters controlling the result. |
|
26 | + * |
|
27 | + * @type string name The name attribute of the input element. Mandatory. |
|
28 | + * |
|
29 | + * @type string id The id attribute of the input element. Optional. |
|
30 | + * @type string id The id attribute of the input element. |
|
31 | + * Optional, randomly generated one is used if not supplied. |
|
32 | + * @type string value The value of the input element. |
|
33 | + * Optional, defaults to empty string. |
|
34 | + * @type bool readonly Indicates whether the input is read only. |
|
35 | + * Optional, defaults to read-write |
|
36 | + * @type string css_class The class attribute for the input element. |
|
37 | + * If empty string no class attribute will be added. |
|
38 | + * Optional, defaults to empty string. |
|
39 | + * @type string description The descriptio text to be displayed below the element. |
|
40 | + * Can include some HTML element. |
|
41 | + * If empty string no description will be displayed. |
|
42 | + * Optional, defaults to empty string. |
|
43 | + * @since *.*.* added the ability to use a $type arg. |
|
44 | + * |
|
45 | + * @return $this|Wordlift_Admin_Element |
|
46 | + */ |
|
47 | + public function render( $args ) { |
|
48 | 48 | |
49 | - /* |
|
49 | + /* |
|
50 | 50 | * Parse the arguments and merge with default values. |
51 | 51 | * Name intentionally do not have a default as it has to be in SyncEvent |
52 | 52 | * with form handling code |
53 | 53 | */ |
54 | - $pre_params = wp_parse_args( $args, array( |
|
55 | - 'id' => uniqid( 'wl-input-' ), |
|
56 | - 'value' => '', |
|
57 | - 'readonly' => false, |
|
58 | - 'css_class' => '', |
|
59 | - 'description' => '', |
|
60 | - ) ); |
|
61 | - $params = apply_filters( 'wl_admin_input_element_params', $pre_params ); |
|
54 | + $pre_params = wp_parse_args( $args, array( |
|
55 | + 'id' => uniqid( 'wl-input-' ), |
|
56 | + 'value' => '', |
|
57 | + 'readonly' => false, |
|
58 | + 'css_class' => '', |
|
59 | + 'description' => '', |
|
60 | + ) ); |
|
61 | + $params = apply_filters( 'wl_admin_input_element_params', $pre_params ); |
|
62 | 62 | |
63 | - // Set the readonly and class attributes and the description. |
|
64 | - $readonly = $params['readonly'] ? ' readonly="readonly"' : ''; |
|
65 | - $css_class = ! empty( $params['css_class'] ) ? ' class="' . esc_attr( $params['css_class'] ) . '"' : ''; |
|
66 | - $description = ! empty( $params['description'] ) ? '<p>' . wp_kses( $params['description'], array( 'a' => array( 'href' => array() ) ) ) . '</p>' : ''; |
|
63 | + // Set the readonly and class attributes and the description. |
|
64 | + $readonly = $params['readonly'] ? ' readonly="readonly"' : ''; |
|
65 | + $css_class = ! empty( $params['css_class'] ) ? ' class="' . esc_attr( $params['css_class'] ) . '"' : ''; |
|
66 | + $description = ! empty( $params['description'] ) ? '<p>' . wp_kses( $params['description'], array( 'a' => array( 'href' => array() ) ) ) . '</p>' : ''; |
|
67 | 67 | |
68 | - // allow different types of input - default to 'text'. |
|
69 | - $input_type = ! empty( $params['type'] ) ? $params['type'] : 'text'; |
|
70 | - ?> |
|
68 | + // allow different types of input - default to 'text'. |
|
69 | + $input_type = ! empty( $params['type'] ) ? $params['type'] : 'text'; |
|
70 | + ?> |
|
71 | 71 | |
72 | 72 | <input type="<?php echo esc_attr( $input_type ); ?>" |
73 | 73 | id="<?php echo esc_attr( $params['id'] ); ?>" |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | <?php |
82 | 82 | |
83 | - return $this; |
|
84 | - } |
|
83 | + return $this; |
|
84 | + } |
|
85 | 85 | |
86 | 86 | } |
@@ -44,35 +44,35 @@ |
||
44 | 44 | * |
45 | 45 | * @return $this|Wordlift_Admin_Element |
46 | 46 | */ |
47 | - public function render( $args ) { |
|
47 | + public function render($args) { |
|
48 | 48 | |
49 | 49 | /* |
50 | 50 | * Parse the arguments and merge with default values. |
51 | 51 | * Name intentionally do not have a default as it has to be in SyncEvent |
52 | 52 | * with form handling code |
53 | 53 | */ |
54 | - $pre_params = wp_parse_args( $args, array( |
|
55 | - 'id' => uniqid( 'wl-input-' ), |
|
54 | + $pre_params = wp_parse_args($args, array( |
|
55 | + 'id' => uniqid('wl-input-'), |
|
56 | 56 | 'value' => '', |
57 | 57 | 'readonly' => false, |
58 | 58 | 'css_class' => '', |
59 | 59 | 'description' => '', |
60 | - ) ); |
|
61 | - $params = apply_filters( 'wl_admin_input_element_params', $pre_params ); |
|
60 | + )); |
|
61 | + $params = apply_filters('wl_admin_input_element_params', $pre_params); |
|
62 | 62 | |
63 | 63 | // Set the readonly and class attributes and the description. |
64 | 64 | $readonly = $params['readonly'] ? ' readonly="readonly"' : ''; |
65 | - $css_class = ! empty( $params['css_class'] ) ? ' class="' . esc_attr( $params['css_class'] ) . '"' : ''; |
|
66 | - $description = ! empty( $params['description'] ) ? '<p>' . wp_kses( $params['description'], array( 'a' => array( 'href' => array() ) ) ) . '</p>' : ''; |
|
65 | + $css_class = ! empty($params['css_class']) ? ' class="'.esc_attr($params['css_class']).'"' : ''; |
|
66 | + $description = ! empty($params['description']) ? '<p>'.wp_kses($params['description'], array('a' => array('href' => array()))).'</p>' : ''; |
|
67 | 67 | |
68 | 68 | // allow different types of input - default to 'text'. |
69 | - $input_type = ! empty( $params['type'] ) ? $params['type'] : 'text'; |
|
69 | + $input_type = ! empty($params['type']) ? $params['type'] : 'text'; |
|
70 | 70 | ?> |
71 | 71 | |
72 | - <input type="<?php echo esc_attr( $input_type ); ?>" |
|
73 | - id="<?php echo esc_attr( $params['id'] ); ?>" |
|
74 | - name="<?php echo esc_attr( $params['name'] ); ?>" |
|
75 | - value="<?php echo esc_attr( $params['value'] ); ?>" |
|
72 | + <input type="<?php echo esc_attr($input_type); ?>" |
|
73 | + id="<?php echo esc_attr($params['id']); ?>" |
|
74 | + name="<?php echo esc_attr($params['name']); ?>" |
|
75 | + value="<?php echo esc_attr($params['value']); ?>" |
|
76 | 76 | <?php echo $readonly; ?> |
77 | 77 | <?php echo $css_class; ?> |
78 | 78 | /> |
@@ -19,52 +19,52 @@ |
||
19 | 19 | */ |
20 | 20 | class Wordlift_Admin_Analytics_Settings_Page_Action_Link { |
21 | 21 | |
22 | - /** |
|
23 | - * The {@link Wordlift_Admin_Analytics_Settings_Page} instance. |
|
24 | - * |
|
25 | - * @since 3.11.0 |
|
26 | - * @access private |
|
27 | - * @var \Wordlift_Admin_Analytics_Settings_Page $settings_page The {@link Wordlift_Admin_Analytics_Settings_Page} instance. |
|
28 | - */ |
|
29 | - private $settings_page; |
|
22 | + /** |
|
23 | + * The {@link Wordlift_Admin_Analytics_Settings_Page} instance. |
|
24 | + * |
|
25 | + * @since 3.11.0 |
|
26 | + * @access private |
|
27 | + * @var \Wordlift_Admin_Analytics_Settings_Page $settings_page The {@link Wordlift_Admin_Analytics_Settings_Page} instance. |
|
28 | + */ |
|
29 | + private $settings_page; |
|
30 | 30 | |
31 | - /** |
|
32 | - * Create a {@link Wordlift_Admin_Analytics_Settings_Page_Action_Link} instance. |
|
33 | - * |
|
34 | - * @since 3.11.0 |
|
35 | - * |
|
36 | - * @param \Wordlift_Admin_Analytics_Settings_Page $settings_page The {@link Wordlift_Admin_Analytics_Settings_Page} instance. |
|
37 | - */ |
|
38 | - function __construct( $settings_page ) { |
|
31 | + /** |
|
32 | + * Create a {@link Wordlift_Admin_Analytics_Settings_Page_Action_Link} instance. |
|
33 | + * |
|
34 | + * @since 3.11.0 |
|
35 | + * |
|
36 | + * @param \Wordlift_Admin_Analytics_Settings_Page $settings_page The {@link Wordlift_Admin_Analytics_Settings_Page} instance. |
|
37 | + */ |
|
38 | + function __construct( $settings_page ) { |
|
39 | 39 | |
40 | - $this->settings_page = $settings_page; |
|
40 | + $this->settings_page = $settings_page; |
|
41 | 41 | |
42 | - } |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * Create a link to the WordLift settings page. |
|
46 | - * |
|
47 | - * @since 3.11.0 |
|
48 | - * |
|
49 | - * @param array $links An array of links. |
|
50 | - * |
|
51 | - * @return array An array of links including those added by the plugin. |
|
52 | - */ |
|
53 | - function action_links( $links ) { |
|
44 | + /** |
|
45 | + * Create a link to the WordLift settings page. |
|
46 | + * |
|
47 | + * @since 3.11.0 |
|
48 | + * |
|
49 | + * @param array $links An array of links. |
|
50 | + * |
|
51 | + * @return array An array of links including those added by the plugin. |
|
52 | + */ |
|
53 | + function action_links( $links ) { |
|
54 | 54 | |
55 | - // Get the menu slug from the page, then prepare the path, hence the url. |
|
56 | - $menu_slug = $this->settings_page->get_menu_slug(); |
|
57 | - $path = "admin.php?page=$menu_slug"; |
|
58 | - $url = get_admin_url( null, $path ); |
|
55 | + // Get the menu slug from the page, then prepare the path, hence the url. |
|
56 | + $menu_slug = $this->settings_page->get_menu_slug(); |
|
57 | + $path = "admin.php?page=$menu_slug"; |
|
58 | + $url = get_admin_url( null, $path ); |
|
59 | 59 | |
60 | - // Add our own link to the list of links. |
|
61 | - return array_merge( $links, array( |
|
62 | - sprintf( |
|
63 | - '<a href="%1$s">%2$s</a>', |
|
64 | - $url, |
|
65 | - __( 'Analytics Settings', 'wordlift' ) |
|
66 | - ), |
|
67 | - ) ); |
|
68 | - } |
|
60 | + // Add our own link to the list of links. |
|
61 | + return array_merge( $links, array( |
|
62 | + sprintf( |
|
63 | + '<a href="%1$s">%2$s</a>', |
|
64 | + $url, |
|
65 | + __( 'Analytics Settings', 'wordlift' ) |
|
66 | + ), |
|
67 | + ) ); |
|
68 | + } |
|
69 | 69 | |
70 | 70 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @param \Wordlift_Admin_Analytics_Settings_Page $settings_page The {@link Wordlift_Admin_Analytics_Settings_Page} instance. |
37 | 37 | */ |
38 | - function __construct( $settings_page ) { |
|
38 | + function __construct($settings_page) { |
|
39 | 39 | |
40 | 40 | $this->settings_page = $settings_page; |
41 | 41 | |
@@ -50,21 +50,21 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return array An array of links including those added by the plugin. |
52 | 52 | */ |
53 | - function action_links( $links ) { |
|
53 | + function action_links($links) { |
|
54 | 54 | |
55 | 55 | // Get the menu slug from the page, then prepare the path, hence the url. |
56 | 56 | $menu_slug = $this->settings_page->get_menu_slug(); |
57 | 57 | $path = "admin.php?page=$menu_slug"; |
58 | - $url = get_admin_url( null, $path ); |
|
58 | + $url = get_admin_url(null, $path); |
|
59 | 59 | |
60 | 60 | // Add our own link to the list of links. |
61 | - return array_merge( $links, array( |
|
61 | + return array_merge($links, array( |
|
62 | 62 | sprintf( |
63 | 63 | '<a href="%1$s">%2$s</a>', |
64 | 64 | $url, |
65 | - __( 'Analytics Settings', 'wordlift' ) |
|
65 | + __('Analytics Settings', 'wordlift') |
|
66 | 66 | ), |
67 | - ) ); |
|
67 | + )); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | } |
@@ -14,69 +14,69 @@ |
||
14 | 14 | */ |
15 | 15 | class Wordlift_Analytics_Connect { |
16 | 16 | |
17 | - /** |
|
18 | - * Gets an array of related entities with their post IDs and titles. |
|
19 | - * |
|
20 | - * @method get_analytics_event_data |
|
21 | - * @param int $post_id post id we want related data for. |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public static function get_analytics_event_data( $post_id ) { |
|
25 | - // If no ID was passed get current ID. |
|
26 | - if ( ! $post_id ) { |
|
27 | - $post_id = get_queried_object_id(); |
|
28 | - } |
|
29 | - /** |
|
30 | - * TODO: set/get this from cache. |
|
31 | - */ |
|
32 | - $related_items = array(); |
|
33 | - $related_ids = wl_core_get_related_entity_ids( $post_id ); |
|
17 | + /** |
|
18 | + * Gets an array of related entities with their post IDs and titles. |
|
19 | + * |
|
20 | + * @method get_analytics_event_data |
|
21 | + * @param int $post_id post id we want related data for. |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public static function get_analytics_event_data( $post_id ) { |
|
25 | + // If no ID was passed get current ID. |
|
26 | + if ( ! $post_id ) { |
|
27 | + $post_id = get_queried_object_id(); |
|
28 | + } |
|
29 | + /** |
|
30 | + * TODO: set/get this from cache. |
|
31 | + */ |
|
32 | + $related_items = array(); |
|
33 | + $related_ids = wl_core_get_related_entity_ids( $post_id ); |
|
34 | 34 | |
35 | - $entity_service = Wordlift_Entity_Service::get_instance(); |
|
36 | - // If the current item is also an entity then add it to the list of IDs. |
|
37 | - if ( $entity_service->is_entity( $post_id ) ) { |
|
38 | - $related_ids[] = $post_id; |
|
39 | - } |
|
40 | - $entity_type_service = Wordlift_Entity_Type_Service::get_instance(); |
|
41 | - // Get the post titles of related items and connect them in an array. |
|
42 | - foreach ( $related_ids as $related_id ) { |
|
43 | - $related_items[ $related_id ] = array( |
|
44 | - 'uri' => $entity_service->get_uri( $related_id ), |
|
45 | - 'type' => $entity_type_service->get( $related_id )['label'], |
|
46 | - 'label' => $entity_service->get_labels( $related_id )[0], |
|
47 | - ); |
|
48 | - } |
|
49 | - return $related_items; |
|
50 | - } |
|
35 | + $entity_service = Wordlift_Entity_Service::get_instance(); |
|
36 | + // If the current item is also an entity then add it to the list of IDs. |
|
37 | + if ( $entity_service->is_entity( $post_id ) ) { |
|
38 | + $related_ids[] = $post_id; |
|
39 | + } |
|
40 | + $entity_type_service = Wordlift_Entity_Type_Service::get_instance(); |
|
41 | + // Get the post titles of related items and connect them in an array. |
|
42 | + foreach ( $related_ids as $related_id ) { |
|
43 | + $related_items[ $related_id ] = array( |
|
44 | + 'uri' => $entity_service->get_uri( $related_id ), |
|
45 | + 'type' => $entity_type_service->get( $related_id )['label'], |
|
46 | + 'label' => $entity_service->get_labels( $related_id )[0], |
|
47 | + ); |
|
48 | + } |
|
49 | + return $related_items; |
|
50 | + } |
|
51 | 51 | |
52 | - public static function get_analytics_config_data() { |
|
53 | - $configuration_service = Wordlift_Configuration_Service::get_instance(); |
|
54 | - // get some values from the config service. |
|
55 | - $config = array( |
|
56 | - 'entity_uri_dimension' => $configuration_service->get_analytics_entity_uri_dimension(), |
|
57 | - 'entity_type_dimention' => $configuration_service->get_analytics_entity_type_dimension(), |
|
58 | - ); |
|
59 | - return $config; |
|
60 | - } |
|
52 | + public static function get_analytics_config_data() { |
|
53 | + $configuration_service = Wordlift_Configuration_Service::get_instance(); |
|
54 | + // get some values from the config service. |
|
55 | + $config = array( |
|
56 | + 'entity_uri_dimension' => $configuration_service->get_analytics_entity_uri_dimension(), |
|
57 | + 'entity_type_dimention' => $configuration_service->get_analytics_entity_type_dimension(), |
|
58 | + ); |
|
59 | + return $config; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Enqueues our scripts for the frontend analytics handling and attaches |
|
64 | - * any data we will want to use there. |
|
65 | - * |
|
66 | - * @method enqueue_scripts |
|
67 | - */ |
|
68 | - public function enqueue_scripts() { |
|
69 | - $entity_data = self::get_analytics_event_data( get_the_ID() ); |
|
70 | - // Bail early if there is no event data that we would send. |
|
71 | - if ( ! $entity_data ) { |
|
72 | - return; |
|
73 | - } |
|
74 | - $data = self::get_analytics_config_data(); |
|
75 | - /** |
|
76 | - * TODO: Look into using a constant for defining pase plugin url. |
|
77 | - */ |
|
78 | - wp_enqueue_script( 'wordlift-analytics', plugin_dir_url( dirname( dirname( __FILE__ ) ) ) . 'js/wordlift-analytics.js', array(), '1.0.0', true ); |
|
79 | - wp_localize_script( 'wordlift-analytics', 'wordliftAnalyticsConfigData', $data ); |
|
80 | - wp_localize_script( 'wordlift-analytics', 'wordliftAnalyticsEntityData', $entity_data ); |
|
81 | - } |
|
62 | + /** |
|
63 | + * Enqueues our scripts for the frontend analytics handling and attaches |
|
64 | + * any data we will want to use there. |
|
65 | + * |
|
66 | + * @method enqueue_scripts |
|
67 | + */ |
|
68 | + public function enqueue_scripts() { |
|
69 | + $entity_data = self::get_analytics_event_data( get_the_ID() ); |
|
70 | + // Bail early if there is no event data that we would send. |
|
71 | + if ( ! $entity_data ) { |
|
72 | + return; |
|
73 | + } |
|
74 | + $data = self::get_analytics_config_data(); |
|
75 | + /** |
|
76 | + * TODO: Look into using a constant for defining pase plugin url. |
|
77 | + */ |
|
78 | + wp_enqueue_script( 'wordlift-analytics', plugin_dir_url( dirname( dirname( __FILE__ ) ) ) . 'js/wordlift-analytics.js', array(), '1.0.0', true ); |
|
79 | + wp_localize_script( 'wordlift-analytics', 'wordliftAnalyticsConfigData', $data ); |
|
80 | + wp_localize_script( 'wordlift-analytics', 'wordliftAnalyticsEntityData', $entity_data ); |
|
81 | + } |
|
82 | 82 | } |
@@ -21,29 +21,29 @@ discard block |
||
21 | 21 | * @param int $post_id post id we want related data for. |
22 | 22 | * @return array |
23 | 23 | */ |
24 | - public static function get_analytics_event_data( $post_id ) { |
|
24 | + public static function get_analytics_event_data($post_id) { |
|
25 | 25 | // If no ID was passed get current ID. |
26 | - if ( ! $post_id ) { |
|
26 | + if ( ! $post_id) { |
|
27 | 27 | $post_id = get_queried_object_id(); |
28 | 28 | } |
29 | 29 | /** |
30 | 30 | * TODO: set/get this from cache. |
31 | 31 | */ |
32 | 32 | $related_items = array(); |
33 | - $related_ids = wl_core_get_related_entity_ids( $post_id ); |
|
33 | + $related_ids = wl_core_get_related_entity_ids($post_id); |
|
34 | 34 | |
35 | 35 | $entity_service = Wordlift_Entity_Service::get_instance(); |
36 | 36 | // If the current item is also an entity then add it to the list of IDs. |
37 | - if ( $entity_service->is_entity( $post_id ) ) { |
|
37 | + if ($entity_service->is_entity($post_id)) { |
|
38 | 38 | $related_ids[] = $post_id; |
39 | 39 | } |
40 | 40 | $entity_type_service = Wordlift_Entity_Type_Service::get_instance(); |
41 | 41 | // Get the post titles of related items and connect them in an array. |
42 | - foreach ( $related_ids as $related_id ) { |
|
43 | - $related_items[ $related_id ] = array( |
|
44 | - 'uri' => $entity_service->get_uri( $related_id ), |
|
45 | - 'type' => $entity_type_service->get( $related_id )['label'], |
|
46 | - 'label' => $entity_service->get_labels( $related_id )[0], |
|
42 | + foreach ($related_ids as $related_id) { |
|
43 | + $related_items[$related_id] = array( |
|
44 | + 'uri' => $entity_service->get_uri($related_id), |
|
45 | + 'type' => $entity_type_service->get($related_id)['label'], |
|
46 | + 'label' => $entity_service->get_labels($related_id)[0], |
|
47 | 47 | ); |
48 | 48 | } |
49 | 49 | return $related_items; |
@@ -66,17 +66,17 @@ discard block |
||
66 | 66 | * @method enqueue_scripts |
67 | 67 | */ |
68 | 68 | public function enqueue_scripts() { |
69 | - $entity_data = self::get_analytics_event_data( get_the_ID() ); |
|
69 | + $entity_data = self::get_analytics_event_data(get_the_ID()); |
|
70 | 70 | // Bail early if there is no event data that we would send. |
71 | - if ( ! $entity_data ) { |
|
71 | + if ( ! $entity_data) { |
|
72 | 72 | return; |
73 | 73 | } |
74 | 74 | $data = self::get_analytics_config_data(); |
75 | 75 | /** |
76 | 76 | * TODO: Look into using a constant for defining pase plugin url. |
77 | 77 | */ |
78 | - wp_enqueue_script( 'wordlift-analytics', plugin_dir_url( dirname( dirname( __FILE__ ) ) ) . 'js/wordlift-analytics.js', array(), '1.0.0', true ); |
|
79 | - wp_localize_script( 'wordlift-analytics', 'wordliftAnalyticsConfigData', $data ); |
|
80 | - wp_localize_script( 'wordlift-analytics', 'wordliftAnalyticsEntityData', $entity_data ); |
|
78 | + wp_enqueue_script('wordlift-analytics', plugin_dir_url(dirname(dirname(__FILE__))).'js/wordlift-analytics.js', array(), '1.0.0', true); |
|
79 | + wp_localize_script('wordlift-analytics', 'wordliftAnalyticsConfigData', $data); |
|
80 | + wp_localize_script('wordlift-analytics', 'wordliftAnalyticsEntityData', $entity_data); |
|
81 | 81 | } |
82 | 82 | } |
@@ -28,1475 +28,1475 @@ discard block |
||
28 | 28 | */ |
29 | 29 | class Wordlift { |
30 | 30 | |
31 | - //<editor-fold desc="## FIELDS"> |
|
32 | - |
|
33 | - /** |
|
34 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
35 | - * the plugin. |
|
36 | - * |
|
37 | - * @since 1.0.0 |
|
38 | - * @access protected |
|
39 | - * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
40 | - */ |
|
41 | - protected $loader; |
|
42 | - |
|
43 | - /** |
|
44 | - * The unique identifier of this plugin. |
|
45 | - * |
|
46 | - * @since 1.0.0 |
|
47 | - * @access protected |
|
48 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
49 | - */ |
|
50 | - protected $plugin_name; |
|
51 | - |
|
52 | - /** |
|
53 | - * The current version of the plugin. |
|
54 | - * |
|
55 | - * @since 1.0.0 |
|
56 | - * @access protected |
|
57 | - * @var string $version The current version of the plugin. |
|
58 | - */ |
|
59 | - protected $version; |
|
60 | - |
|
61 | - /** |
|
62 | - * The {@link Wordlift_Tinymce_Adapter} instance. |
|
63 | - * |
|
64 | - * @since 3.12.0 |
|
65 | - * @access protected |
|
66 | - * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
67 | - */ |
|
68 | - protected $tinymce_adapter; |
|
69 | - |
|
70 | - /** |
|
71 | - * The Thumbnail service. |
|
72 | - * |
|
73 | - * @since 3.1.5 |
|
74 | - * @access private |
|
75 | - * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
76 | - */ |
|
77 | - private $thumbnail_service; |
|
78 | - |
|
79 | - /** |
|
80 | - * The UI service. |
|
81 | - * |
|
82 | - * @since 3.2.0 |
|
83 | - * @access private |
|
84 | - * @var \Wordlift_UI_Service $ui_service The UI service. |
|
85 | - */ |
|
86 | - private $ui_service; |
|
87 | - |
|
88 | - /** |
|
89 | - * The Schema service. |
|
90 | - * |
|
91 | - * @since 3.3.0 |
|
92 | - * @access protected |
|
93 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
94 | - */ |
|
95 | - protected $schema_service; |
|
96 | - |
|
97 | - /** |
|
98 | - * The Entity service. |
|
99 | - * |
|
100 | - * @since 3.1.0 |
|
101 | - * @access protected |
|
102 | - * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
103 | - */ |
|
104 | - protected $entity_service; |
|
105 | - |
|
106 | - /** |
|
107 | - * The Topic Taxonomy service. |
|
108 | - * |
|
109 | - * @since 3.5.0 |
|
110 | - * @access private |
|
111 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
112 | - */ |
|
113 | - private $topic_taxonomy_service; |
|
114 | - |
|
115 | - /** |
|
116 | - * The Entity Types Taxonomy service. |
|
117 | - * |
|
118 | - * @since 3.18.0 |
|
119 | - * @access private |
|
120 | - * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
121 | - */ |
|
122 | - private $entity_types_taxonomy_service; |
|
123 | - |
|
124 | - /** |
|
125 | - * The User service. |
|
126 | - * |
|
127 | - * @since 3.1.7 |
|
128 | - * @access protected |
|
129 | - * @var \Wordlift_User_Service $user_service The User service. |
|
130 | - */ |
|
131 | - protected $user_service; |
|
132 | - |
|
133 | - /** |
|
134 | - * The Timeline service. |
|
135 | - * |
|
136 | - * @since 3.1.0 |
|
137 | - * @access private |
|
138 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
139 | - */ |
|
140 | - private $timeline_service; |
|
141 | - |
|
142 | - /** |
|
143 | - * The Redirect service. |
|
144 | - * |
|
145 | - * @since 3.2.0 |
|
146 | - * @access private |
|
147 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
148 | - */ |
|
149 | - private $redirect_service; |
|
150 | - |
|
151 | - /** |
|
152 | - * The Notice service. |
|
153 | - * |
|
154 | - * @since 3.3.0 |
|
155 | - * @access private |
|
156 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
157 | - */ |
|
158 | - private $notice_service; |
|
159 | - |
|
160 | - /** |
|
161 | - * The Entity list customization. |
|
162 | - * |
|
163 | - * @since 3.3.0 |
|
164 | - * @access protected |
|
165 | - * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
166 | - */ |
|
167 | - protected $entity_list_service; |
|
168 | - |
|
169 | - /** |
|
170 | - * The Entity Types Taxonomy Walker. |
|
171 | - * |
|
172 | - * @since 3.1.0 |
|
173 | - * @access private |
|
174 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
175 | - */ |
|
176 | - private $entity_types_taxonomy_walker; |
|
177 | - |
|
178 | - /** |
|
179 | - * The ShareThis service. |
|
180 | - * |
|
181 | - * @since 3.2.0 |
|
182 | - * @access private |
|
183 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
184 | - */ |
|
185 | - private $sharethis_service; |
|
186 | - |
|
187 | - /** |
|
188 | - * The PrimaShop adapter. |
|
189 | - * |
|
190 | - * @since 3.2.3 |
|
191 | - * @access private |
|
192 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
193 | - */ |
|
194 | - private $primashop_adapter; |
|
195 | - |
|
196 | - /** |
|
197 | - * The WordLift Dashboard adapter. |
|
198 | - * |
|
199 | - * @since 3.4.0 |
|
200 | - * @access private |
|
201 | - * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
202 | - */ |
|
203 | - private $dashboard_service; |
|
204 | - |
|
205 | - /** |
|
206 | - * The entity type service. |
|
207 | - * |
|
208 | - * @since 3.6.0 |
|
209 | - * @access private |
|
210 | - * @var \Wordlift_Entity_Post_Type_Service |
|
211 | - */ |
|
212 | - private $entity_post_type_service; |
|
213 | - |
|
214 | - /** |
|
215 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
216 | - * |
|
217 | - * @since 3.6.0 |
|
218 | - * @access private |
|
219 | - * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
220 | - */ |
|
221 | - private $entity_link_service; |
|
222 | - |
|
223 | - /** |
|
224 | - * A {@link Wordlift_Sparql_Service} instance. |
|
225 | - * |
|
226 | - * @since 3.6.0 |
|
227 | - * @access protected |
|
228 | - * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
229 | - */ |
|
230 | - protected $sparql_service; |
|
231 | - |
|
232 | - /** |
|
233 | - * A {@link Wordlift_Import_Service} instance. |
|
234 | - * |
|
235 | - * @since 3.6.0 |
|
236 | - * @access private |
|
237 | - * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
238 | - */ |
|
239 | - private $import_service; |
|
240 | - |
|
241 | - /** |
|
242 | - * A {@link Wordlift_Rebuild_Service} instance. |
|
243 | - * |
|
244 | - * @since 3.6.0 |
|
245 | - * @access private |
|
246 | - * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
247 | - */ |
|
248 | - private $rebuild_service; |
|
249 | - |
|
250 | - /** |
|
251 | - * A {@link Wordlift_Jsonld_Service} instance. |
|
252 | - * |
|
253 | - * @since 3.7.0 |
|
254 | - * @access protected |
|
255 | - * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
256 | - */ |
|
257 | - protected $jsonld_service; |
|
258 | - |
|
259 | - /** |
|
260 | - * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
261 | - * |
|
262 | - * @since 3.14.0 |
|
263 | - * @access protected |
|
264 | - * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
265 | - */ |
|
266 | - protected $jsonld_website_converter; |
|
267 | - |
|
268 | - /** |
|
269 | - * A {@link Wordlift_Property_Factory} instance. |
|
270 | - * |
|
271 | - * @since 3.7.0 |
|
272 | - * @access private |
|
273 | - * @var \Wordlift_Property_Factory $property_factory |
|
274 | - */ |
|
275 | - private $property_factory; |
|
276 | - |
|
277 | - /** |
|
278 | - * The 'Download Your Data' page. |
|
279 | - * |
|
280 | - * @since 3.6.0 |
|
281 | - * @access private |
|
282 | - * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
283 | - */ |
|
284 | - private $download_your_data_page; |
|
285 | - |
|
286 | - /** |
|
287 | - * The 'WordLift Settings' page. |
|
288 | - * |
|
289 | - * @since 3.11.0 |
|
290 | - * @access protected |
|
291 | - * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
292 | - */ |
|
293 | - protected $settings_page; |
|
294 | - |
|
295 | - /** |
|
296 | - * The 'WordLift Batch analysis' page. |
|
297 | - * |
|
298 | - * @since 3.14.0 |
|
299 | - * @access protected |
|
300 | - * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page. |
|
301 | - */ |
|
302 | - protected $batch_analysis_page; |
|
303 | - |
|
304 | - /** |
|
305 | - * The install wizard page. |
|
306 | - * |
|
307 | - * @since 3.9.0 |
|
308 | - * @access private |
|
309 | - * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
310 | - */ |
|
311 | - private $admin_setup; |
|
312 | - |
|
313 | - /** |
|
314 | - * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
315 | - * linking of entities to their pages. |
|
316 | - * |
|
317 | - * @since 3.8.0 |
|
318 | - * @access private |
|
319 | - * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
320 | - */ |
|
321 | - private $content_filter_service; |
|
322 | - |
|
323 | - /** |
|
324 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
325 | - * |
|
326 | - * @since 3.9.0 |
|
327 | - * @access private |
|
328 | - * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
329 | - */ |
|
330 | - private $key_validation_service; |
|
331 | - |
|
332 | - /** |
|
333 | - * A {@link Wordlift_Rating_Service} instance. |
|
334 | - * |
|
335 | - * @since 3.10.0 |
|
336 | - * @access private |
|
337 | - * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
338 | - */ |
|
339 | - private $rating_service; |
|
340 | - |
|
341 | - /** |
|
342 | - * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
343 | - * |
|
344 | - * @since 3.10.0 |
|
345 | - * @access protected |
|
346 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
347 | - */ |
|
348 | - protected $post_to_jsonld_converter; |
|
349 | - |
|
350 | - /** |
|
351 | - * A {@link Wordlift_Configuration_Service} instance. |
|
352 | - * |
|
353 | - * @since 3.10.0 |
|
354 | - * @access protected |
|
355 | - * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
356 | - */ |
|
357 | - protected $configuration_service; |
|
358 | - |
|
359 | - /** |
|
360 | - * A {@link Wordlift_Install_Service} instance. |
|
361 | - * |
|
362 | - * @since 3.18.0 |
|
363 | - * @access protected |
|
364 | - * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
365 | - */ |
|
366 | - protected $install_service; |
|
367 | - |
|
368 | - /** |
|
369 | - * A {@link Wordlift_Entity_Type_Service} instance. |
|
370 | - * |
|
371 | - * @since 3.10.0 |
|
372 | - * @access protected |
|
373 | - * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
374 | - */ |
|
375 | - protected $entity_type_service; |
|
376 | - |
|
377 | - /** |
|
378 | - * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
379 | - * |
|
380 | - * @since 3.10.0 |
|
381 | - * @access protected |
|
382 | - * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
383 | - */ |
|
384 | - protected $entity_post_to_jsonld_converter; |
|
385 | - |
|
386 | - /** |
|
387 | - * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
388 | - * |
|
389 | - * @since 3.10.0 |
|
390 | - * @access protected |
|
391 | - * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
392 | - */ |
|
393 | - protected $postid_to_jsonld_converter; |
|
394 | - |
|
395 | - /** |
|
396 | - * The {@link Wordlift_Admin_Status_Page} class. |
|
397 | - * |
|
398 | - * @since 3.9.8 |
|
399 | - * @access private |
|
400 | - * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
401 | - */ |
|
402 | - private $status_page; |
|
403 | - |
|
404 | - /** |
|
405 | - * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
406 | - * |
|
407 | - * @since 3.11.0 |
|
408 | - * @access protected |
|
409 | - * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
410 | - */ |
|
411 | - protected $category_taxonomy_service; |
|
412 | - |
|
413 | - /** |
|
414 | - * The {@link Wordlift_Entity_Page_Service} instance. |
|
415 | - * |
|
416 | - * @since 3.11.0 |
|
417 | - * @access protected |
|
418 | - * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
419 | - */ |
|
420 | - protected $entity_page_service; |
|
421 | - |
|
422 | - /** |
|
423 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
424 | - * |
|
425 | - * @since 3.11.0 |
|
426 | - * @access protected |
|
427 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
428 | - */ |
|
429 | - protected $settings_page_action_link; |
|
430 | - |
|
431 | - /** |
|
432 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
433 | - * |
|
434 | - * @since 3.11.0 |
|
435 | - * @access protected |
|
436 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
437 | - */ |
|
438 | - protected $analytics_settings_page_action_link; |
|
439 | - |
|
440 | - /** |
|
441 | - * The {@link Wordlift_Analytics_Connect} class. |
|
442 | - * |
|
443 | - * @since 3.11.0 |
|
444 | - * @access protected |
|
445 | - * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
446 | - */ |
|
447 | - protected $analytics_connect; |
|
448 | - |
|
449 | - /** |
|
450 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
451 | - * |
|
452 | - * @since 3.11.0 |
|
453 | - * @access protected |
|
454 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
455 | - */ |
|
456 | - protected $publisher_ajax_adapter; |
|
457 | - |
|
458 | - /** |
|
459 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
460 | - * |
|
461 | - * @since 3.11.0 |
|
462 | - * @access protected |
|
463 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
464 | - */ |
|
465 | - protected $input_element; |
|
466 | - |
|
467 | - /** |
|
468 | - * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
469 | - * |
|
470 | - * @since 3.13.0 |
|
471 | - * @access protected |
|
472 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
473 | - */ |
|
474 | - protected $radio_input_element; |
|
475 | - |
|
476 | - /** |
|
477 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
478 | - * |
|
479 | - * @since 3.11.0 |
|
480 | - * @access protected |
|
481 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
482 | - */ |
|
483 | - protected $language_select_element; |
|
484 | - |
|
485 | - /** |
|
486 | - * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
487 | - * |
|
488 | - * @since 3.18.0 |
|
489 | - * @access protected |
|
490 | - * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
491 | - */ |
|
492 | - protected $country_select_element; |
|
493 | - |
|
494 | - /** |
|
495 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
496 | - * |
|
497 | - * @since 3.11.0 |
|
498 | - * @access protected |
|
499 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
500 | - */ |
|
501 | - protected $publisher_element; |
|
502 | - |
|
503 | - /** |
|
504 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
505 | - * |
|
506 | - * @since 3.11.0 |
|
507 | - * @access protected |
|
508 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
509 | - */ |
|
510 | - protected $select2_element; |
|
511 | - |
|
512 | - /** |
|
513 | - * The controller for the entity type list admin page |
|
514 | - * |
|
515 | - * @since 3.11.0 |
|
516 | - * @access private |
|
517 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
518 | - */ |
|
519 | - private $entity_type_admin_page; |
|
520 | - |
|
521 | - /** |
|
522 | - * The controller for the entity type settings admin page |
|
523 | - * |
|
524 | - * @since 3.11.0 |
|
525 | - * @access private |
|
526 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
527 | - */ |
|
528 | - private $entity_type_settings_admin_page; |
|
529 | - |
|
530 | - /** |
|
531 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
532 | - * |
|
533 | - * @since 3.11.0 |
|
534 | - * @access protected |
|
535 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
536 | - */ |
|
537 | - protected $related_entities_cloud_widget; |
|
538 | - |
|
539 | - /** |
|
540 | - * The {@link Wordlift_Admin_Author_Element} instance. |
|
541 | - * |
|
542 | - * @since 3.14.0 |
|
543 | - * @access protected |
|
544 | - * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
545 | - */ |
|
546 | - protected $author_element; |
|
547 | - |
|
548 | - /** |
|
549 | - * The {@link Wordlift_Batch_Analysis_Service} instance. |
|
550 | - * |
|
551 | - * @since 3.14.0 |
|
552 | - * @access protected |
|
553 | - * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance. |
|
554 | - */ |
|
555 | - protected $batch_analysis_service; |
|
556 | - |
|
557 | - /** |
|
558 | - * The {@link Wordlift_Sample_Data_Service} instance. |
|
559 | - * |
|
560 | - * @since 3.12.0 |
|
561 | - * @access protected |
|
562 | - * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
563 | - */ |
|
564 | - protected $sample_data_service; |
|
565 | - |
|
566 | - /** |
|
567 | - * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
568 | - * |
|
569 | - * @since 3.12.0 |
|
570 | - * @access protected |
|
571 | - * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
572 | - */ |
|
573 | - protected $sample_data_ajax_adapter; |
|
574 | - |
|
575 | - /** |
|
576 | - * The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
577 | - * |
|
578 | - * @since 3.14.2 |
|
579 | - * @access protected |
|
580 | - * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
581 | - */ |
|
582 | - private $batch_analysis_adapter; |
|
583 | - |
|
584 | - /** |
|
585 | - * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
586 | - * |
|
587 | - * @since 3.14.3 |
|
588 | - * @access private |
|
589 | - * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
590 | - */ |
|
591 | - private $relation_rebuild_service; |
|
592 | - |
|
593 | - /** |
|
594 | - * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
595 | - * |
|
596 | - * @since 3.14.3 |
|
597 | - * @access private |
|
598 | - * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
599 | - */ |
|
600 | - private $relation_rebuild_adapter; |
|
601 | - |
|
602 | - /** |
|
603 | - * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
604 | - * |
|
605 | - * @since 3.18.0 |
|
606 | - * @access private |
|
607 | - * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
608 | - */ |
|
609 | - private $reference_rebuild_service; |
|
610 | - |
|
611 | - /** |
|
612 | - * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
613 | - * |
|
614 | - * @since 3.16.0 |
|
615 | - * @access protected |
|
616 | - * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
617 | - */ |
|
618 | - protected $google_analytics_export_service; |
|
619 | - |
|
620 | - /** |
|
621 | - * {@link Wordlift}'s singleton instance. |
|
622 | - * |
|
623 | - * @since 3.15.0 |
|
624 | - * @access protected |
|
625 | - * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
626 | - */ |
|
627 | - protected $entity_type_adapter; |
|
628 | - |
|
629 | - /** |
|
630 | - * The {@link Wordlift_Linked_Data_Service} instance. |
|
631 | - * |
|
632 | - * @since 3.15.0 |
|
633 | - * @access protected |
|
634 | - * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance. |
|
635 | - */ |
|
636 | - protected $linked_data_service; |
|
637 | - |
|
638 | - /** |
|
639 | - * The {@link Wordlift_Storage_Factory} instance. |
|
640 | - * |
|
641 | - * @since 3.15.0 |
|
642 | - * @access protected |
|
643 | - * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
644 | - */ |
|
645 | - protected $storage_factory; |
|
646 | - |
|
647 | - /** |
|
648 | - * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
649 | - * |
|
650 | - * @since 3.15.0 |
|
651 | - * @access protected |
|
652 | - * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
653 | - */ |
|
654 | - protected $rendition_factory; |
|
655 | - |
|
656 | - /** |
|
657 | - * The {@link Wordlift_Autocomplete_Service} instance. |
|
658 | - * |
|
659 | - * @since 3.15.0 |
|
660 | - * @access private |
|
661 | - * @var \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance. |
|
662 | - */ |
|
663 | - private $autocomplete_service; |
|
664 | - |
|
665 | - /** |
|
666 | - * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
667 | - * |
|
668 | - * @since 3.15.0 |
|
669 | - * @access private |
|
670 | - * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
671 | - */ |
|
672 | - private $autocomplete_adapter; |
|
673 | - |
|
674 | - /** |
|
675 | - * The {@link Wordlift_Relation_Service} instance. |
|
676 | - * |
|
677 | - * @since 3.15.0 |
|
678 | - * @access protected |
|
679 | - * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
680 | - */ |
|
681 | - protected $relation_service; |
|
682 | - |
|
683 | - /** |
|
684 | - * The {@link Wordlift_Cached_Post_Converter} instance. |
|
685 | - * |
|
686 | - * @since 3.16.0 |
|
687 | - * @access protected |
|
688 | - * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
689 | - * |
|
690 | - */ |
|
691 | - protected $cached_postid_to_jsonld_converter; |
|
692 | - |
|
693 | - /** |
|
694 | - * The {@link Wordlift_File_Cache_Service} instance. |
|
695 | - * |
|
696 | - * @since 3.16.0 |
|
697 | - * @access protected |
|
698 | - * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance. |
|
699 | - */ |
|
700 | - protected $file_cache_service; |
|
701 | - |
|
702 | - /** |
|
703 | - * The {@link Wordlift_Entity_Uri_Service} instance. |
|
704 | - * |
|
705 | - * @since 3.16.3 |
|
706 | - * @access protected |
|
707 | - * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
708 | - */ |
|
709 | - protected $entity_uri_service; |
|
710 | - |
|
711 | - /** |
|
712 | - * The {@link Wordlift_Publisher_Service} instance. |
|
713 | - * |
|
714 | - * @since 3.19.0 |
|
715 | - * @access protected |
|
716 | - * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
717 | - */ |
|
718 | - protected $publisher_service; |
|
719 | - |
|
720 | - /** |
|
721 | - * {@link Wordlift}'s singleton instance. |
|
722 | - * |
|
723 | - * @since 3.11.2 |
|
724 | - * @access private |
|
725 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
726 | - */ |
|
727 | - private static $instance; |
|
728 | - |
|
729 | - //</editor-fold> |
|
730 | - |
|
731 | - /** |
|
732 | - * Define the core functionality of the plugin. |
|
733 | - * |
|
734 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
735 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
736 | - * the public-facing side of the site. |
|
737 | - * |
|
738 | - * @since 1.0.0 |
|
739 | - */ |
|
740 | - public function __construct() { |
|
741 | - |
|
742 | - self::$instance = $this; |
|
743 | - |
|
744 | - $this->plugin_name = 'wordlift'; |
|
745 | - $this->version = '3.20.0'; |
|
746 | - $this->load_dependencies(); |
|
747 | - $this->set_locale(); |
|
748 | - $this->define_admin_hooks(); |
|
749 | - $this->define_public_hooks(); |
|
750 | - |
|
751 | - // If we're in `WP_CLI` load the related files. |
|
752 | - if ( class_exists( 'WP_CLI' ) ) { |
|
753 | - $this->load_cli_dependencies(); |
|
754 | - } |
|
755 | - |
|
756 | - } |
|
757 | - |
|
758 | - /** |
|
759 | - * Get the singleton instance. |
|
760 | - * |
|
761 | - * @since 3.11.2 |
|
762 | - * |
|
763 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
764 | - */ |
|
765 | - public static function get_instance() { |
|
766 | - |
|
767 | - return self::$instance; |
|
768 | - } |
|
769 | - |
|
770 | - /** |
|
771 | - * Load the required dependencies for this plugin. |
|
772 | - * |
|
773 | - * Include the following files that make up the plugin: |
|
774 | - * |
|
775 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
776 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
777 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
778 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
779 | - * |
|
780 | - * Create an instance of the loader which will be used to register the hooks |
|
781 | - * with WordPress. |
|
782 | - * |
|
783 | - * @since 1.0.0 |
|
784 | - * @access private |
|
785 | - */ |
|
786 | - private function load_dependencies() { |
|
787 | - |
|
788 | - /** |
|
789 | - * The class responsible for orchestrating the actions and filters of the |
|
790 | - * core plugin. |
|
791 | - */ |
|
792 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
793 | - |
|
794 | - // The class responsible for plugin uninstall. |
|
795 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
796 | - |
|
797 | - /** |
|
798 | - * The class responsible for defining internationalization functionality |
|
799 | - * of the plugin. |
|
800 | - */ |
|
801 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
802 | - |
|
803 | - /** |
|
804 | - * WordLift's supported languages. |
|
805 | - */ |
|
806 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
807 | - |
|
808 | - /** |
|
809 | - * WordLift's supported countries. |
|
810 | - */ |
|
811 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
812 | - |
|
813 | - /** |
|
814 | - * Provide support functions to sanitize data. |
|
815 | - */ |
|
816 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
817 | - |
|
818 | - /** Services. */ |
|
819 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
820 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
821 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
823 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
824 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
825 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
826 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
828 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
829 | - |
|
830 | - /** |
|
831 | - * The Query builder. |
|
832 | - */ |
|
833 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
834 | - |
|
835 | - /** |
|
836 | - * The Schema service. |
|
837 | - */ |
|
838 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
839 | - |
|
840 | - /** |
|
841 | - * The schema:url property service. |
|
842 | - */ |
|
843 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
844 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
845 | - |
|
846 | - /** |
|
847 | - * The UI service. |
|
848 | - */ |
|
849 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
850 | - |
|
851 | - /** |
|
852 | - * The Thumbnail service. |
|
853 | - */ |
|
854 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
855 | - |
|
856 | - /** |
|
857 | - * The Entity Types Taxonomy service. |
|
858 | - */ |
|
859 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
860 | - |
|
861 | - /** |
|
862 | - * The Entity service. |
|
863 | - */ |
|
864 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
865 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
866 | - |
|
867 | - // Add the entity rating service. |
|
868 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
869 | - |
|
870 | - /** |
|
871 | - * The User service. |
|
872 | - */ |
|
873 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
874 | - |
|
875 | - /** |
|
876 | - * The Timeline service. |
|
877 | - */ |
|
878 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
879 | - |
|
880 | - /** |
|
881 | - * The Topic Taxonomy service. |
|
882 | - */ |
|
883 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
884 | - |
|
885 | - /** |
|
886 | - * The SPARQL service. |
|
887 | - */ |
|
888 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
889 | - |
|
890 | - /** |
|
891 | - * The WordLift import service. |
|
892 | - */ |
|
893 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
894 | - |
|
895 | - /** |
|
896 | - * The WordLift URI service. |
|
897 | - */ |
|
898 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
899 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
900 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
901 | - |
|
902 | - /** |
|
903 | - * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
904 | - */ |
|
905 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
906 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
907 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
908 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
909 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
910 | - |
|
911 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
912 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
913 | - |
|
914 | - /** |
|
915 | - * Load the converters. |
|
916 | - */ |
|
917 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
918 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
919 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
920 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
921 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
922 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
923 | - |
|
924 | - /** |
|
925 | - * Load cache-related files. |
|
926 | - */ |
|
927 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
928 | - |
|
929 | - /** |
|
930 | - * Load the content filter. |
|
931 | - */ |
|
932 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
933 | - |
|
934 | - /* |
|
31 | + //<editor-fold desc="## FIELDS"> |
|
32 | + |
|
33 | + /** |
|
34 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
35 | + * the plugin. |
|
36 | + * |
|
37 | + * @since 1.0.0 |
|
38 | + * @access protected |
|
39 | + * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
40 | + */ |
|
41 | + protected $loader; |
|
42 | + |
|
43 | + /** |
|
44 | + * The unique identifier of this plugin. |
|
45 | + * |
|
46 | + * @since 1.0.0 |
|
47 | + * @access protected |
|
48 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
49 | + */ |
|
50 | + protected $plugin_name; |
|
51 | + |
|
52 | + /** |
|
53 | + * The current version of the plugin. |
|
54 | + * |
|
55 | + * @since 1.0.0 |
|
56 | + * @access protected |
|
57 | + * @var string $version The current version of the plugin. |
|
58 | + */ |
|
59 | + protected $version; |
|
60 | + |
|
61 | + /** |
|
62 | + * The {@link Wordlift_Tinymce_Adapter} instance. |
|
63 | + * |
|
64 | + * @since 3.12.0 |
|
65 | + * @access protected |
|
66 | + * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
67 | + */ |
|
68 | + protected $tinymce_adapter; |
|
69 | + |
|
70 | + /** |
|
71 | + * The Thumbnail service. |
|
72 | + * |
|
73 | + * @since 3.1.5 |
|
74 | + * @access private |
|
75 | + * @var \Wordlift_Thumbnail_Service $thumbnail_service The Thumbnail service. |
|
76 | + */ |
|
77 | + private $thumbnail_service; |
|
78 | + |
|
79 | + /** |
|
80 | + * The UI service. |
|
81 | + * |
|
82 | + * @since 3.2.0 |
|
83 | + * @access private |
|
84 | + * @var \Wordlift_UI_Service $ui_service The UI service. |
|
85 | + */ |
|
86 | + private $ui_service; |
|
87 | + |
|
88 | + /** |
|
89 | + * The Schema service. |
|
90 | + * |
|
91 | + * @since 3.3.0 |
|
92 | + * @access protected |
|
93 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
94 | + */ |
|
95 | + protected $schema_service; |
|
96 | + |
|
97 | + /** |
|
98 | + * The Entity service. |
|
99 | + * |
|
100 | + * @since 3.1.0 |
|
101 | + * @access protected |
|
102 | + * @var \Wordlift_Entity_Service $entity_service The Entity service. |
|
103 | + */ |
|
104 | + protected $entity_service; |
|
105 | + |
|
106 | + /** |
|
107 | + * The Topic Taxonomy service. |
|
108 | + * |
|
109 | + * @since 3.5.0 |
|
110 | + * @access private |
|
111 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
112 | + */ |
|
113 | + private $topic_taxonomy_service; |
|
114 | + |
|
115 | + /** |
|
116 | + * The Entity Types Taxonomy service. |
|
117 | + * |
|
118 | + * @since 3.18.0 |
|
119 | + * @access private |
|
120 | + * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
121 | + */ |
|
122 | + private $entity_types_taxonomy_service; |
|
123 | + |
|
124 | + /** |
|
125 | + * The User service. |
|
126 | + * |
|
127 | + * @since 3.1.7 |
|
128 | + * @access protected |
|
129 | + * @var \Wordlift_User_Service $user_service The User service. |
|
130 | + */ |
|
131 | + protected $user_service; |
|
132 | + |
|
133 | + /** |
|
134 | + * The Timeline service. |
|
135 | + * |
|
136 | + * @since 3.1.0 |
|
137 | + * @access private |
|
138 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
139 | + */ |
|
140 | + private $timeline_service; |
|
141 | + |
|
142 | + /** |
|
143 | + * The Redirect service. |
|
144 | + * |
|
145 | + * @since 3.2.0 |
|
146 | + * @access private |
|
147 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
148 | + */ |
|
149 | + private $redirect_service; |
|
150 | + |
|
151 | + /** |
|
152 | + * The Notice service. |
|
153 | + * |
|
154 | + * @since 3.3.0 |
|
155 | + * @access private |
|
156 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
157 | + */ |
|
158 | + private $notice_service; |
|
159 | + |
|
160 | + /** |
|
161 | + * The Entity list customization. |
|
162 | + * |
|
163 | + * @since 3.3.0 |
|
164 | + * @access protected |
|
165 | + * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
166 | + */ |
|
167 | + protected $entity_list_service; |
|
168 | + |
|
169 | + /** |
|
170 | + * The Entity Types Taxonomy Walker. |
|
171 | + * |
|
172 | + * @since 3.1.0 |
|
173 | + * @access private |
|
174 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
175 | + */ |
|
176 | + private $entity_types_taxonomy_walker; |
|
177 | + |
|
178 | + /** |
|
179 | + * The ShareThis service. |
|
180 | + * |
|
181 | + * @since 3.2.0 |
|
182 | + * @access private |
|
183 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
184 | + */ |
|
185 | + private $sharethis_service; |
|
186 | + |
|
187 | + /** |
|
188 | + * The PrimaShop adapter. |
|
189 | + * |
|
190 | + * @since 3.2.3 |
|
191 | + * @access private |
|
192 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
193 | + */ |
|
194 | + private $primashop_adapter; |
|
195 | + |
|
196 | + /** |
|
197 | + * The WordLift Dashboard adapter. |
|
198 | + * |
|
199 | + * @since 3.4.0 |
|
200 | + * @access private |
|
201 | + * @var \Wordlift_Dashboard_Service $dashboard_service The WordLift Dashboard service; |
|
202 | + */ |
|
203 | + private $dashboard_service; |
|
204 | + |
|
205 | + /** |
|
206 | + * The entity type service. |
|
207 | + * |
|
208 | + * @since 3.6.0 |
|
209 | + * @access private |
|
210 | + * @var \Wordlift_Entity_Post_Type_Service |
|
211 | + */ |
|
212 | + private $entity_post_type_service; |
|
213 | + |
|
214 | + /** |
|
215 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
216 | + * |
|
217 | + * @since 3.6.0 |
|
218 | + * @access private |
|
219 | + * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
220 | + */ |
|
221 | + private $entity_link_service; |
|
222 | + |
|
223 | + /** |
|
224 | + * A {@link Wordlift_Sparql_Service} instance. |
|
225 | + * |
|
226 | + * @since 3.6.0 |
|
227 | + * @access protected |
|
228 | + * @var \Wordlift_Sparql_Service $sparql_service A {@link Wordlift_Sparql_Service} instance. |
|
229 | + */ |
|
230 | + protected $sparql_service; |
|
231 | + |
|
232 | + /** |
|
233 | + * A {@link Wordlift_Import_Service} instance. |
|
234 | + * |
|
235 | + * @since 3.6.0 |
|
236 | + * @access private |
|
237 | + * @var \Wordlift_Import_Service $import_service A {@link Wordlift_Import_Service} instance. |
|
238 | + */ |
|
239 | + private $import_service; |
|
240 | + |
|
241 | + /** |
|
242 | + * A {@link Wordlift_Rebuild_Service} instance. |
|
243 | + * |
|
244 | + * @since 3.6.0 |
|
245 | + * @access private |
|
246 | + * @var \Wordlift_Rebuild_Service $rebuild_service A {@link Wordlift_Rebuild_Service} instance. |
|
247 | + */ |
|
248 | + private $rebuild_service; |
|
249 | + |
|
250 | + /** |
|
251 | + * A {@link Wordlift_Jsonld_Service} instance. |
|
252 | + * |
|
253 | + * @since 3.7.0 |
|
254 | + * @access protected |
|
255 | + * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
256 | + */ |
|
257 | + protected $jsonld_service; |
|
258 | + |
|
259 | + /** |
|
260 | + * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
261 | + * |
|
262 | + * @since 3.14.0 |
|
263 | + * @access protected |
|
264 | + * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
265 | + */ |
|
266 | + protected $jsonld_website_converter; |
|
267 | + |
|
268 | + /** |
|
269 | + * A {@link Wordlift_Property_Factory} instance. |
|
270 | + * |
|
271 | + * @since 3.7.0 |
|
272 | + * @access private |
|
273 | + * @var \Wordlift_Property_Factory $property_factory |
|
274 | + */ |
|
275 | + private $property_factory; |
|
276 | + |
|
277 | + /** |
|
278 | + * The 'Download Your Data' page. |
|
279 | + * |
|
280 | + * @since 3.6.0 |
|
281 | + * @access private |
|
282 | + * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
283 | + */ |
|
284 | + private $download_your_data_page; |
|
285 | + |
|
286 | + /** |
|
287 | + * The 'WordLift Settings' page. |
|
288 | + * |
|
289 | + * @since 3.11.0 |
|
290 | + * @access protected |
|
291 | + * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
292 | + */ |
|
293 | + protected $settings_page; |
|
294 | + |
|
295 | + /** |
|
296 | + * The 'WordLift Batch analysis' page. |
|
297 | + * |
|
298 | + * @since 3.14.0 |
|
299 | + * @access protected |
|
300 | + * @var \Wordlift_Batch_Analysis_Page $sbatch_analysis_page The 'WordLift batcch analysis' page. |
|
301 | + */ |
|
302 | + protected $batch_analysis_page; |
|
303 | + |
|
304 | + /** |
|
305 | + * The install wizard page. |
|
306 | + * |
|
307 | + * @since 3.9.0 |
|
308 | + * @access private |
|
309 | + * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
310 | + */ |
|
311 | + private $admin_setup; |
|
312 | + |
|
313 | + /** |
|
314 | + * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
315 | + * linking of entities to their pages. |
|
316 | + * |
|
317 | + * @since 3.8.0 |
|
318 | + * @access private |
|
319 | + * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
320 | + */ |
|
321 | + private $content_filter_service; |
|
322 | + |
|
323 | + /** |
|
324 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
325 | + * |
|
326 | + * @since 3.9.0 |
|
327 | + * @access private |
|
328 | + * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
329 | + */ |
|
330 | + private $key_validation_service; |
|
331 | + |
|
332 | + /** |
|
333 | + * A {@link Wordlift_Rating_Service} instance. |
|
334 | + * |
|
335 | + * @since 3.10.0 |
|
336 | + * @access private |
|
337 | + * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
338 | + */ |
|
339 | + private $rating_service; |
|
340 | + |
|
341 | + /** |
|
342 | + * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
343 | + * |
|
344 | + * @since 3.10.0 |
|
345 | + * @access protected |
|
346 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
347 | + */ |
|
348 | + protected $post_to_jsonld_converter; |
|
349 | + |
|
350 | + /** |
|
351 | + * A {@link Wordlift_Configuration_Service} instance. |
|
352 | + * |
|
353 | + * @since 3.10.0 |
|
354 | + * @access protected |
|
355 | + * @var \Wordlift_Configuration_Service $configuration_service A {@link Wordlift_Configuration_Service} instance. |
|
356 | + */ |
|
357 | + protected $configuration_service; |
|
358 | + |
|
359 | + /** |
|
360 | + * A {@link Wordlift_Install_Service} instance. |
|
361 | + * |
|
362 | + * @since 3.18.0 |
|
363 | + * @access protected |
|
364 | + * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
365 | + */ |
|
366 | + protected $install_service; |
|
367 | + |
|
368 | + /** |
|
369 | + * A {@link Wordlift_Entity_Type_Service} instance. |
|
370 | + * |
|
371 | + * @since 3.10.0 |
|
372 | + * @access protected |
|
373 | + * @var \Wordlift_Entity_Type_Service $entity_type_service A {@link Wordlift_Entity_Type_Service} instance. |
|
374 | + */ |
|
375 | + protected $entity_type_service; |
|
376 | + |
|
377 | + /** |
|
378 | + * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
379 | + * |
|
380 | + * @since 3.10.0 |
|
381 | + * @access protected |
|
382 | + * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
383 | + */ |
|
384 | + protected $entity_post_to_jsonld_converter; |
|
385 | + |
|
386 | + /** |
|
387 | + * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
388 | + * |
|
389 | + * @since 3.10.0 |
|
390 | + * @access protected |
|
391 | + * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
392 | + */ |
|
393 | + protected $postid_to_jsonld_converter; |
|
394 | + |
|
395 | + /** |
|
396 | + * The {@link Wordlift_Admin_Status_Page} class. |
|
397 | + * |
|
398 | + * @since 3.9.8 |
|
399 | + * @access private |
|
400 | + * @var \Wordlift_Admin_Status_Page $status_page The {@link Wordlift_Admin_Status_Page} class. |
|
401 | + */ |
|
402 | + private $status_page; |
|
403 | + |
|
404 | + /** |
|
405 | + * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
406 | + * |
|
407 | + * @since 3.11.0 |
|
408 | + * @access protected |
|
409 | + * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
410 | + */ |
|
411 | + protected $category_taxonomy_service; |
|
412 | + |
|
413 | + /** |
|
414 | + * The {@link Wordlift_Entity_Page_Service} instance. |
|
415 | + * |
|
416 | + * @since 3.11.0 |
|
417 | + * @access protected |
|
418 | + * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
419 | + */ |
|
420 | + protected $entity_page_service; |
|
421 | + |
|
422 | + /** |
|
423 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
424 | + * |
|
425 | + * @since 3.11.0 |
|
426 | + * @access protected |
|
427 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
428 | + */ |
|
429 | + protected $settings_page_action_link; |
|
430 | + |
|
431 | + /** |
|
432 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
433 | + * |
|
434 | + * @since 3.11.0 |
|
435 | + * @access protected |
|
436 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
437 | + */ |
|
438 | + protected $analytics_settings_page_action_link; |
|
439 | + |
|
440 | + /** |
|
441 | + * The {@link Wordlift_Analytics_Connect} class. |
|
442 | + * |
|
443 | + * @since 3.11.0 |
|
444 | + * @access protected |
|
445 | + * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
446 | + */ |
|
447 | + protected $analytics_connect; |
|
448 | + |
|
449 | + /** |
|
450 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
451 | + * |
|
452 | + * @since 3.11.0 |
|
453 | + * @access protected |
|
454 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
455 | + */ |
|
456 | + protected $publisher_ajax_adapter; |
|
457 | + |
|
458 | + /** |
|
459 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
460 | + * |
|
461 | + * @since 3.11.0 |
|
462 | + * @access protected |
|
463 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
464 | + */ |
|
465 | + protected $input_element; |
|
466 | + |
|
467 | + /** |
|
468 | + * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
469 | + * |
|
470 | + * @since 3.13.0 |
|
471 | + * @access protected |
|
472 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
473 | + */ |
|
474 | + protected $radio_input_element; |
|
475 | + |
|
476 | + /** |
|
477 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
478 | + * |
|
479 | + * @since 3.11.0 |
|
480 | + * @access protected |
|
481 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
482 | + */ |
|
483 | + protected $language_select_element; |
|
484 | + |
|
485 | + /** |
|
486 | + * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
487 | + * |
|
488 | + * @since 3.18.0 |
|
489 | + * @access protected |
|
490 | + * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
491 | + */ |
|
492 | + protected $country_select_element; |
|
493 | + |
|
494 | + /** |
|
495 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
496 | + * |
|
497 | + * @since 3.11.0 |
|
498 | + * @access protected |
|
499 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
500 | + */ |
|
501 | + protected $publisher_element; |
|
502 | + |
|
503 | + /** |
|
504 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
505 | + * |
|
506 | + * @since 3.11.0 |
|
507 | + * @access protected |
|
508 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
509 | + */ |
|
510 | + protected $select2_element; |
|
511 | + |
|
512 | + /** |
|
513 | + * The controller for the entity type list admin page |
|
514 | + * |
|
515 | + * @since 3.11.0 |
|
516 | + * @access private |
|
517 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
518 | + */ |
|
519 | + private $entity_type_admin_page; |
|
520 | + |
|
521 | + /** |
|
522 | + * The controller for the entity type settings admin page |
|
523 | + * |
|
524 | + * @since 3.11.0 |
|
525 | + * @access private |
|
526 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
527 | + */ |
|
528 | + private $entity_type_settings_admin_page; |
|
529 | + |
|
530 | + /** |
|
531 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
532 | + * |
|
533 | + * @since 3.11.0 |
|
534 | + * @access protected |
|
535 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
536 | + */ |
|
537 | + protected $related_entities_cloud_widget; |
|
538 | + |
|
539 | + /** |
|
540 | + * The {@link Wordlift_Admin_Author_Element} instance. |
|
541 | + * |
|
542 | + * @since 3.14.0 |
|
543 | + * @access protected |
|
544 | + * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
545 | + */ |
|
546 | + protected $author_element; |
|
547 | + |
|
548 | + /** |
|
549 | + * The {@link Wordlift_Batch_Analysis_Service} instance. |
|
550 | + * |
|
551 | + * @since 3.14.0 |
|
552 | + * @access protected |
|
553 | + * @var \Wordlift_Batch_Analysis_Service $batch_analysis_service The {@link Wordlift_Batch_Analysis_Service} instance. |
|
554 | + */ |
|
555 | + protected $batch_analysis_service; |
|
556 | + |
|
557 | + /** |
|
558 | + * The {@link Wordlift_Sample_Data_Service} instance. |
|
559 | + * |
|
560 | + * @since 3.12.0 |
|
561 | + * @access protected |
|
562 | + * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
563 | + */ |
|
564 | + protected $sample_data_service; |
|
565 | + |
|
566 | + /** |
|
567 | + * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
568 | + * |
|
569 | + * @since 3.12.0 |
|
570 | + * @access protected |
|
571 | + * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
572 | + */ |
|
573 | + protected $sample_data_ajax_adapter; |
|
574 | + |
|
575 | + /** |
|
576 | + * The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
577 | + * |
|
578 | + * @since 3.14.2 |
|
579 | + * @access protected |
|
580 | + * @var \Wordlift_Batch_Analysis_Adapter $batch_analysis_adapter The {@link Wordlift_Batch_Analysis_Adapter} instance. |
|
581 | + */ |
|
582 | + private $batch_analysis_adapter; |
|
583 | + |
|
584 | + /** |
|
585 | + * The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
586 | + * |
|
587 | + * @since 3.14.3 |
|
588 | + * @access private |
|
589 | + * @var \Wordlift_Relation_Rebuild_Service $relation_rebuild_service The {@link Wordlift_Relation_Rebuild_Service} instance. |
|
590 | + */ |
|
591 | + private $relation_rebuild_service; |
|
592 | + |
|
593 | + /** |
|
594 | + * The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
595 | + * |
|
596 | + * @since 3.14.3 |
|
597 | + * @access private |
|
598 | + * @var \Wordlift_Relation_Rebuild_Adapter $relation_rebuild_adapter The {@link Wordlift_Relation_Rebuild_Adapter} instance. |
|
599 | + */ |
|
600 | + private $relation_rebuild_adapter; |
|
601 | + |
|
602 | + /** |
|
603 | + * The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
604 | + * |
|
605 | + * @since 3.18.0 |
|
606 | + * @access private |
|
607 | + * @var \Wordlift_Reference_Rebuild_Service $reference_rebuild_service The {@link Wordlift_Reference_Rebuild_Service} instance. |
|
608 | + */ |
|
609 | + private $reference_rebuild_service; |
|
610 | + |
|
611 | + /** |
|
612 | + * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
613 | + * |
|
614 | + * @since 3.16.0 |
|
615 | + * @access protected |
|
616 | + * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
617 | + */ |
|
618 | + protected $google_analytics_export_service; |
|
619 | + |
|
620 | + /** |
|
621 | + * {@link Wordlift}'s singleton instance. |
|
622 | + * |
|
623 | + * @since 3.15.0 |
|
624 | + * @access protected |
|
625 | + * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
626 | + */ |
|
627 | + protected $entity_type_adapter; |
|
628 | + |
|
629 | + /** |
|
630 | + * The {@link Wordlift_Linked_Data_Service} instance. |
|
631 | + * |
|
632 | + * @since 3.15.0 |
|
633 | + * @access protected |
|
634 | + * @var \Wordlift_Linked_Data_Service $linked_data_service The {@link Wordlift_Linked_Data_Service} instance. |
|
635 | + */ |
|
636 | + protected $linked_data_service; |
|
637 | + |
|
638 | + /** |
|
639 | + * The {@link Wordlift_Storage_Factory} instance. |
|
640 | + * |
|
641 | + * @since 3.15.0 |
|
642 | + * @access protected |
|
643 | + * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
644 | + */ |
|
645 | + protected $storage_factory; |
|
646 | + |
|
647 | + /** |
|
648 | + * The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
649 | + * |
|
650 | + * @since 3.15.0 |
|
651 | + * @access protected |
|
652 | + * @var \Wordlift_Sparql_Tuple_Rendition_Factory $rendition_factory The {@link Wordlift_Sparql_Tuple_Rendition_Factory} instance. |
|
653 | + */ |
|
654 | + protected $rendition_factory; |
|
655 | + |
|
656 | + /** |
|
657 | + * The {@link Wordlift_Autocomplete_Service} instance. |
|
658 | + * |
|
659 | + * @since 3.15.0 |
|
660 | + * @access private |
|
661 | + * @var \Wordlift_Autocomplete_Service $autocomplete_service The {@link Wordlift_Autocomplete_Service} instance. |
|
662 | + */ |
|
663 | + private $autocomplete_service; |
|
664 | + |
|
665 | + /** |
|
666 | + * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
667 | + * |
|
668 | + * @since 3.15.0 |
|
669 | + * @access private |
|
670 | + * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
671 | + */ |
|
672 | + private $autocomplete_adapter; |
|
673 | + |
|
674 | + /** |
|
675 | + * The {@link Wordlift_Relation_Service} instance. |
|
676 | + * |
|
677 | + * @since 3.15.0 |
|
678 | + * @access protected |
|
679 | + * @var \Wordlift_Relation_Service $relation_service The {@link Wordlift_Relation_Service} instance. |
|
680 | + */ |
|
681 | + protected $relation_service; |
|
682 | + |
|
683 | + /** |
|
684 | + * The {@link Wordlift_Cached_Post_Converter} instance. |
|
685 | + * |
|
686 | + * @since 3.16.0 |
|
687 | + * @access protected |
|
688 | + * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
689 | + * |
|
690 | + */ |
|
691 | + protected $cached_postid_to_jsonld_converter; |
|
692 | + |
|
693 | + /** |
|
694 | + * The {@link Wordlift_File_Cache_Service} instance. |
|
695 | + * |
|
696 | + * @since 3.16.0 |
|
697 | + * @access protected |
|
698 | + * @var \Wordlift_File_Cache_Service $file_cache_service The {@link Wordlift_File_Cache_Service} instance. |
|
699 | + */ |
|
700 | + protected $file_cache_service; |
|
701 | + |
|
702 | + /** |
|
703 | + * The {@link Wordlift_Entity_Uri_Service} instance. |
|
704 | + * |
|
705 | + * @since 3.16.3 |
|
706 | + * @access protected |
|
707 | + * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
708 | + */ |
|
709 | + protected $entity_uri_service; |
|
710 | + |
|
711 | + /** |
|
712 | + * The {@link Wordlift_Publisher_Service} instance. |
|
713 | + * |
|
714 | + * @since 3.19.0 |
|
715 | + * @access protected |
|
716 | + * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
717 | + */ |
|
718 | + protected $publisher_service; |
|
719 | + |
|
720 | + /** |
|
721 | + * {@link Wordlift}'s singleton instance. |
|
722 | + * |
|
723 | + * @since 3.11.2 |
|
724 | + * @access private |
|
725 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
726 | + */ |
|
727 | + private static $instance; |
|
728 | + |
|
729 | + //</editor-fold> |
|
730 | + |
|
731 | + /** |
|
732 | + * Define the core functionality of the plugin. |
|
733 | + * |
|
734 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
735 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
736 | + * the public-facing side of the site. |
|
737 | + * |
|
738 | + * @since 1.0.0 |
|
739 | + */ |
|
740 | + public function __construct() { |
|
741 | + |
|
742 | + self::$instance = $this; |
|
743 | + |
|
744 | + $this->plugin_name = 'wordlift'; |
|
745 | + $this->version = '3.20.0'; |
|
746 | + $this->load_dependencies(); |
|
747 | + $this->set_locale(); |
|
748 | + $this->define_admin_hooks(); |
|
749 | + $this->define_public_hooks(); |
|
750 | + |
|
751 | + // If we're in `WP_CLI` load the related files. |
|
752 | + if ( class_exists( 'WP_CLI' ) ) { |
|
753 | + $this->load_cli_dependencies(); |
|
754 | + } |
|
755 | + |
|
756 | + } |
|
757 | + |
|
758 | + /** |
|
759 | + * Get the singleton instance. |
|
760 | + * |
|
761 | + * @since 3.11.2 |
|
762 | + * |
|
763 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
764 | + */ |
|
765 | + public static function get_instance() { |
|
766 | + |
|
767 | + return self::$instance; |
|
768 | + } |
|
769 | + |
|
770 | + /** |
|
771 | + * Load the required dependencies for this plugin. |
|
772 | + * |
|
773 | + * Include the following files that make up the plugin: |
|
774 | + * |
|
775 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
776 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
777 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
778 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
779 | + * |
|
780 | + * Create an instance of the loader which will be used to register the hooks |
|
781 | + * with WordPress. |
|
782 | + * |
|
783 | + * @since 1.0.0 |
|
784 | + * @access private |
|
785 | + */ |
|
786 | + private function load_dependencies() { |
|
787 | + |
|
788 | + /** |
|
789 | + * The class responsible for orchestrating the actions and filters of the |
|
790 | + * core plugin. |
|
791 | + */ |
|
792 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
793 | + |
|
794 | + // The class responsible for plugin uninstall. |
|
795 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
796 | + |
|
797 | + /** |
|
798 | + * The class responsible for defining internationalization functionality |
|
799 | + * of the plugin. |
|
800 | + */ |
|
801 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
802 | + |
|
803 | + /** |
|
804 | + * WordLift's supported languages. |
|
805 | + */ |
|
806 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
807 | + |
|
808 | + /** |
|
809 | + * WordLift's supported countries. |
|
810 | + */ |
|
811 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
812 | + |
|
813 | + /** |
|
814 | + * Provide support functions to sanitize data. |
|
815 | + */ |
|
816 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
817 | + |
|
818 | + /** Services. */ |
|
819 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
820 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
821 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
822 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
823 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
824 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
825 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
826 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
827 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
828 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
829 | + |
|
830 | + /** |
|
831 | + * The Query builder. |
|
832 | + */ |
|
833 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
834 | + |
|
835 | + /** |
|
836 | + * The Schema service. |
|
837 | + */ |
|
838 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
839 | + |
|
840 | + /** |
|
841 | + * The schema:url property service. |
|
842 | + */ |
|
843 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
844 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
845 | + |
|
846 | + /** |
|
847 | + * The UI service. |
|
848 | + */ |
|
849 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
850 | + |
|
851 | + /** |
|
852 | + * The Thumbnail service. |
|
853 | + */ |
|
854 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
855 | + |
|
856 | + /** |
|
857 | + * The Entity Types Taxonomy service. |
|
858 | + */ |
|
859 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
860 | + |
|
861 | + /** |
|
862 | + * The Entity service. |
|
863 | + */ |
|
864 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
865 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
866 | + |
|
867 | + // Add the entity rating service. |
|
868 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
869 | + |
|
870 | + /** |
|
871 | + * The User service. |
|
872 | + */ |
|
873 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
874 | + |
|
875 | + /** |
|
876 | + * The Timeline service. |
|
877 | + */ |
|
878 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
879 | + |
|
880 | + /** |
|
881 | + * The Topic Taxonomy service. |
|
882 | + */ |
|
883 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
884 | + |
|
885 | + /** |
|
886 | + * The SPARQL service. |
|
887 | + */ |
|
888 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
889 | + |
|
890 | + /** |
|
891 | + * The WordLift import service. |
|
892 | + */ |
|
893 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
894 | + |
|
895 | + /** |
|
896 | + * The WordLift URI service. |
|
897 | + */ |
|
898 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
899 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
900 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
901 | + |
|
902 | + /** |
|
903 | + * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
|
904 | + */ |
|
905 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
906 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
907 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
908 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
909 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
910 | + |
|
911 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
912 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
913 | + |
|
914 | + /** |
|
915 | + * Load the converters. |
|
916 | + */ |
|
917 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
918 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
919 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
920 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
921 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
922 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
923 | + |
|
924 | + /** |
|
925 | + * Load cache-related files. |
|
926 | + */ |
|
927 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
928 | + |
|
929 | + /** |
|
930 | + * Load the content filter. |
|
931 | + */ |
|
932 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
933 | + |
|
934 | + /* |
|
935 | 935 | * Load the excerpt helper. |
936 | 936 | */ |
937 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
938 | - |
|
939 | - /** |
|
940 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
941 | - * |
|
942 | - * @since 3.8.0 |
|
943 | - */ |
|
944 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
945 | - |
|
946 | - // The Publisher Service and the AJAX adapter. |
|
947 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
948 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
949 | - |
|
950 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
951 | - |
|
952 | - /** |
|
953 | - * Load the WordLift key validation service. |
|
954 | - */ |
|
955 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
956 | - |
|
957 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
958 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
959 | - |
|
960 | - // Load the `Wordlift_Entity_Page_Service` class definition. |
|
961 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
962 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
963 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
964 | - |
|
965 | - /** Linked Data. */ |
|
966 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
967 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
968 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
969 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
970 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
971 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
972 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
973 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
974 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
975 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
976 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
977 | - |
|
978 | - /** Linked Data Rendition. */ |
|
979 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
980 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
981 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
982 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
983 | - |
|
984 | - /** Services. */ |
|
985 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
986 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
987 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
988 | - |
|
989 | - /** Adapters. */ |
|
990 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
991 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
992 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
993 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
994 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
996 | - |
|
997 | - /** Async Tasks. */ |
|
998 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
999 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
1000 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
1001 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
1002 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
1003 | - |
|
1004 | - /** Autocomplete. */ |
|
1005 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php'; |
|
1006 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
1007 | - |
|
1008 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
1009 | - |
|
1010 | - /** Analytics **/ |
|
1011 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
1012 | - |
|
1013 | - /** |
|
1014 | - * The class responsible for defining all actions that occur in the admin area. |
|
1015 | - */ |
|
1016 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
1017 | - |
|
1018 | - /** |
|
1019 | - * The class to customize the entity list admin page. |
|
1020 | - */ |
|
1021 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
1022 | - |
|
1023 | - /** |
|
1024 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
1025 | - */ |
|
1026 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
1027 | - |
|
1028 | - /** |
|
1029 | - * The Notice service. |
|
1030 | - */ |
|
1031 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
1032 | - |
|
1033 | - /** |
|
1034 | - * The PrimaShop adapter. |
|
1035 | - */ |
|
1036 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
1037 | - |
|
1038 | - /** |
|
1039 | - * The WordLift Dashboard service. |
|
1040 | - */ |
|
1041 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
1042 | - |
|
1043 | - /** |
|
1044 | - * The admin 'Install wizard' page. |
|
1045 | - */ |
|
1046 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
1047 | - |
|
1048 | - /** |
|
1049 | - * The WordLift entity type list admin page controller. |
|
1050 | - */ |
|
1051 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
1052 | - |
|
1053 | - /** |
|
1054 | - * The WordLift entity type settings admin page controller. |
|
1055 | - */ |
|
1056 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
1057 | - |
|
1058 | - /** |
|
1059 | - * The admin 'Download Your Data' page. |
|
1060 | - */ |
|
1061 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
1062 | - |
|
1063 | - /** |
|
1064 | - * The admin 'WordLift Settings' page. |
|
1065 | - */ |
|
1066 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
1067 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
1068 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
1069 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
1070 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
1071 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
1072 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
1073 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
1074 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
1075 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
1076 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
1077 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
1078 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-analytics-settings-page.php'; |
|
1079 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
1080 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
1081 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-analytics-settings-page-action-link.php'; |
|
1082 | - |
|
1083 | - /** Admin Pages */ |
|
1084 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
1085 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
1086 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
1087 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
1088 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
1089 | - |
|
1090 | - /** |
|
1091 | - * The class responsible for defining all actions that occur in the public-facing |
|
1092 | - * side of the site. |
|
1093 | - */ |
|
1094 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
1095 | - |
|
1096 | - /** |
|
1097 | - * The shortcode abstract class. |
|
1098 | - */ |
|
1099 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
1100 | - |
|
1101 | - /** |
|
1102 | - * The Timeline shortcode. |
|
1103 | - */ |
|
1104 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
1105 | - |
|
1106 | - /** |
|
1107 | - * The Navigator shortcode. |
|
1108 | - */ |
|
1109 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
1110 | - |
|
1111 | - /** |
|
1112 | - * The chord shortcode. |
|
1113 | - */ |
|
1114 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
1115 | - |
|
1116 | - /** |
|
1117 | - * The geomap shortcode. |
|
1118 | - */ |
|
1119 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
1120 | - |
|
1121 | - /** |
|
1122 | - * The entity cloud shortcode. |
|
1123 | - */ |
|
1124 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
1125 | - |
|
1126 | - /** |
|
1127 | - * The entity glossary shortcode. |
|
1128 | - */ |
|
1129 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
1130 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
1131 | - |
|
1132 | - /** |
|
1133 | - * Faceted Search shortcode. |
|
1134 | - */ |
|
1135 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
1136 | - |
|
1137 | - /** |
|
1138 | - * The ShareThis service. |
|
1139 | - */ |
|
1140 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
1141 | - |
|
1142 | - /** |
|
1143 | - * The SEO service. |
|
1144 | - */ |
|
1145 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
1146 | - |
|
1147 | - /** |
|
1148 | - * The AMP service. |
|
1149 | - */ |
|
1150 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
1151 | - |
|
1152 | - /** Widgets */ |
|
1153 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
1154 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
1155 | - |
|
1156 | - /* |
|
937 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
938 | + |
|
939 | + /** |
|
940 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
941 | + * |
|
942 | + * @since 3.8.0 |
|
943 | + */ |
|
944 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
945 | + |
|
946 | + // The Publisher Service and the AJAX adapter. |
|
947 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
948 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
949 | + |
|
950 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
951 | + |
|
952 | + /** |
|
953 | + * Load the WordLift key validation service. |
|
954 | + */ |
|
955 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
956 | + |
|
957 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
958 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
959 | + |
|
960 | + // Load the `Wordlift_Entity_Page_Service` class definition. |
|
961 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
962 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
963 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
964 | + |
|
965 | + /** Linked Data. */ |
|
966 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
967 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
968 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
969 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
970 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
971 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
972 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
973 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
974 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
975 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
976 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
977 | + |
|
978 | + /** Linked Data Rendition. */ |
|
979 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
980 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
981 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
982 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
983 | + |
|
984 | + /** Services. */ |
|
985 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
986 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
987 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
988 | + |
|
989 | + /** Adapters. */ |
|
990 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
991 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
992 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
993 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
994 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
995 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
996 | + |
|
997 | + /** Async Tasks. */ |
|
998 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
999 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
1000 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
1001 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
1002 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
1003 | + |
|
1004 | + /** Autocomplete. */ |
|
1005 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php'; |
|
1006 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
1007 | + |
|
1008 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
1009 | + |
|
1010 | + /** Analytics **/ |
|
1011 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
1012 | + |
|
1013 | + /** |
|
1014 | + * The class responsible for defining all actions that occur in the admin area. |
|
1015 | + */ |
|
1016 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
1017 | + |
|
1018 | + /** |
|
1019 | + * The class to customize the entity list admin page. |
|
1020 | + */ |
|
1021 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
1022 | + |
|
1023 | + /** |
|
1024 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
1025 | + */ |
|
1026 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
1027 | + |
|
1028 | + /** |
|
1029 | + * The Notice service. |
|
1030 | + */ |
|
1031 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
1032 | + |
|
1033 | + /** |
|
1034 | + * The PrimaShop adapter. |
|
1035 | + */ |
|
1036 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
1037 | + |
|
1038 | + /** |
|
1039 | + * The WordLift Dashboard service. |
|
1040 | + */ |
|
1041 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
1042 | + |
|
1043 | + /** |
|
1044 | + * The admin 'Install wizard' page. |
|
1045 | + */ |
|
1046 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
1047 | + |
|
1048 | + /** |
|
1049 | + * The WordLift entity type list admin page controller. |
|
1050 | + */ |
|
1051 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
1052 | + |
|
1053 | + /** |
|
1054 | + * The WordLift entity type settings admin page controller. |
|
1055 | + */ |
|
1056 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
1057 | + |
|
1058 | + /** |
|
1059 | + * The admin 'Download Your Data' page. |
|
1060 | + */ |
|
1061 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
1062 | + |
|
1063 | + /** |
|
1064 | + * The admin 'WordLift Settings' page. |
|
1065 | + */ |
|
1066 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
1067 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
1068 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
1069 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
1070 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
1071 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
1072 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
1073 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
1074 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
1075 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
1076 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
1077 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
1078 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-analytics-settings-page.php'; |
|
1079 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
1080 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
1081 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-analytics-settings-page-action-link.php'; |
|
1082 | + |
|
1083 | + /** Admin Pages */ |
|
1084 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
1085 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
1086 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
1087 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
1088 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
1089 | + |
|
1090 | + /** |
|
1091 | + * The class responsible for defining all actions that occur in the public-facing |
|
1092 | + * side of the site. |
|
1093 | + */ |
|
1094 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
1095 | + |
|
1096 | + /** |
|
1097 | + * The shortcode abstract class. |
|
1098 | + */ |
|
1099 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
1100 | + |
|
1101 | + /** |
|
1102 | + * The Timeline shortcode. |
|
1103 | + */ |
|
1104 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
1105 | + |
|
1106 | + /** |
|
1107 | + * The Navigator shortcode. |
|
1108 | + */ |
|
1109 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
1110 | + |
|
1111 | + /** |
|
1112 | + * The chord shortcode. |
|
1113 | + */ |
|
1114 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
1115 | + |
|
1116 | + /** |
|
1117 | + * The geomap shortcode. |
|
1118 | + */ |
|
1119 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
1120 | + |
|
1121 | + /** |
|
1122 | + * The entity cloud shortcode. |
|
1123 | + */ |
|
1124 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
1125 | + |
|
1126 | + /** |
|
1127 | + * The entity glossary shortcode. |
|
1128 | + */ |
|
1129 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
1130 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
1131 | + |
|
1132 | + /** |
|
1133 | + * Faceted Search shortcode. |
|
1134 | + */ |
|
1135 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
1136 | + |
|
1137 | + /** |
|
1138 | + * The ShareThis service. |
|
1139 | + */ |
|
1140 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
1141 | + |
|
1142 | + /** |
|
1143 | + * The SEO service. |
|
1144 | + */ |
|
1145 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
1146 | + |
|
1147 | + /** |
|
1148 | + * The AMP service. |
|
1149 | + */ |
|
1150 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
1151 | + |
|
1152 | + /** Widgets */ |
|
1153 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
1154 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
1155 | + |
|
1156 | + /* |
|
1157 | 1157 | * Schema.org Services. |
1158 | 1158 | * |
1159 | 1159 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
1160 | 1160 | */ |
1161 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
1162 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
1163 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
1164 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
1165 | - new Wordlift_Schemaorg_Sync_Service(); |
|
1166 | - $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
1167 | - new Wordlift_Schemaorg_Class_Service(); |
|
1168 | - } else { |
|
1169 | - $schemaorg_property_service = null; |
|
1170 | - } |
|
1161 | + if ( WL_ALL_ENTITY_TYPES ) { |
|
1162 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
1163 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
1164 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
1165 | + new Wordlift_Schemaorg_Sync_Service(); |
|
1166 | + $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
|
1167 | + new Wordlift_Schemaorg_Class_Service(); |
|
1168 | + } else { |
|
1169 | + $schemaorg_property_service = null; |
|
1170 | + } |
|
1171 | 1171 | |
1172 | - $this->loader = new Wordlift_Loader(); |
|
1172 | + $this->loader = new Wordlift_Loader(); |
|
1173 | 1173 | |
1174 | - // Instantiate a global logger. |
|
1175 | - global $wl_logger; |
|
1176 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
1174 | + // Instantiate a global logger. |
|
1175 | + global $wl_logger; |
|
1176 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
1177 | 1177 | |
1178 | - // Load the `wl-api` end-point. |
|
1179 | - new Wordlift_Http_Api(); |
|
1178 | + // Load the `wl-api` end-point. |
|
1179 | + new Wordlift_Http_Api(); |
|
1180 | 1180 | |
1181 | - // Load the Install Service. |
|
1182 | - $this->install_service = new Wordlift_Install_Service(); |
|
1181 | + // Load the Install Service. |
|
1182 | + $this->install_service = new Wordlift_Install_Service(); |
|
1183 | 1183 | |
1184 | - /** Services. */ |
|
1185 | - // Create the configuration service. |
|
1186 | - $this->configuration_service = new Wordlift_Configuration_Service(); |
|
1187 | - $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
1184 | + /** Services. */ |
|
1185 | + // Create the configuration service. |
|
1186 | + $this->configuration_service = new Wordlift_Configuration_Service(); |
|
1187 | + $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
1188 | 1188 | |
1189 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
1190 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
1189 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
1190 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
1191 | 1191 | |
1192 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
1193 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
1192 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
1193 | + $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
1194 | 1194 | |
1195 | - // Create an instance of the UI service. |
|
1196 | - $this->ui_service = new Wordlift_UI_Service(); |
|
1195 | + // Create an instance of the UI service. |
|
1196 | + $this->ui_service = new Wordlift_UI_Service(); |
|
1197 | 1197 | |
1198 | - // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
1199 | - $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
1198 | + // Create an instance of the Thumbnail service. Later it'll be hooked to post meta events. |
|
1199 | + $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
|
1200 | 1200 | |
1201 | - $this->sparql_service = new Wordlift_Sparql_Service(); |
|
1202 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
1203 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
1204 | - $this->relation_service = new Wordlift_Relation_Service(); |
|
1201 | + $this->sparql_service = new Wordlift_Sparql_Service(); |
|
1202 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
1203 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
1204 | + $this->relation_service = new Wordlift_Relation_Service(); |
|
1205 | 1205 | |
1206 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
1207 | - $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' ); |
|
1208 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
1209 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
1210 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
1206 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
1207 | + $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' ); |
|
1208 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
1209 | + $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
1210 | + $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
1211 | 1211 | |
1212 | - // Instantiate the JSON-LD service. |
|
1213 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
1212 | + // Instantiate the JSON-LD service. |
|
1213 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
1214 | 1214 | |
1215 | - /** Linked Data. */ |
|
1216 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
1217 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
1215 | + /** Linked Data. */ |
|
1216 | + $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
1217 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
1218 | 1218 | |
1219 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
1219 | + $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
1220 | 1220 | |
1221 | - // Create a new instance of the Redirect service. |
|
1222 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service ); |
|
1223 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
1224 | - $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
1221 | + // Create a new instance of the Redirect service. |
|
1222 | + $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service ); |
|
1223 | + $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
1224 | + $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
1225 | 1225 | |
1226 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
1227 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
1226 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
1227 | + $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
1228 | 1228 | |
1229 | - $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service ); |
|
1229 | + $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service ); |
|
1230 | 1230 | |
1231 | - $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
1231 | + $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
1232 | 1232 | |
1233 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
1234 | - $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
1233 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
1234 | + $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
1235 | 1235 | |
1236 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
1237 | - $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
1236 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
1237 | + $this->sharethis_service = new Wordlift_ShareThis_Service(); |
|
1238 | 1238 | |
1239 | - // Create an instance of the PrimaShop adapter. |
|
1240 | - $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
1239 | + // Create an instance of the PrimaShop adapter. |
|
1240 | + $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
1241 | 1241 | |
1242 | - // Create an import service instance to hook later to WP's import function. |
|
1243 | - $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() ); |
|
1242 | + // Create an import service instance to hook later to WP's import function. |
|
1243 | + $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() ); |
|
1244 | 1244 | |
1245 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
1245 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
1246 | 1246 | |
1247 | - // Create the entity rating service. |
|
1248 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
1247 | + // Create the entity rating service. |
|
1248 | + $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
1249 | 1249 | |
1250 | - // Create entity list customization (wp-admin/edit.php). |
|
1251 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
1250 | + // Create entity list customization (wp-admin/edit.php). |
|
1251 | + $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
1252 | 1252 | |
1253 | - // Create a new instance of the Redirect service. |
|
1254 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
1253 | + // Create a new instance of the Redirect service. |
|
1254 | + $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
1255 | 1255 | |
1256 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
1257 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
1258 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
1259 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
1256 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
1257 | + $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
1258 | + $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
1259 | + $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
1260 | 1260 | |
1261 | - $attachment_service = new Wordlift_Attachment_Service(); |
|
1261 | + $attachment_service = new Wordlift_Attachment_Service(); |
|
1262 | 1262 | |
1263 | - // Instantiate the JSON-LD service. |
|
1264 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
1265 | - $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service ); |
|
1266 | - $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 ); |
|
1267 | - $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 ); |
|
1268 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
1269 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service ); |
|
1270 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
1263 | + // Instantiate the JSON-LD service. |
|
1264 | + $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
1265 | + $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service ); |
|
1266 | + $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 ); |
|
1267 | + $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 ); |
|
1268 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
1269 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service ); |
|
1270 | + $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
1271 | 1271 | |
1272 | 1272 | |
1273 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
1274 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
1275 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
1276 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
1277 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
1278 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service ); |
|
1273 | + $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
1274 | + $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
1275 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
1276 | + $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
1277 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
1278 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service ); |
|
1279 | 1279 | |
1280 | - // Initialize the shortcodes. |
|
1281 | - new Wordlift_Navigator_Shortcode(); |
|
1282 | - new Wordlift_Chord_Shortcode(); |
|
1283 | - new Wordlift_Geomap_Shortcode(); |
|
1284 | - new Wordlift_Timeline_Shortcode(); |
|
1285 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
1286 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
1287 | - new Wordlift_Faceted_Search_Shortcode(); |
|
1280 | + // Initialize the shortcodes. |
|
1281 | + new Wordlift_Navigator_Shortcode(); |
|
1282 | + new Wordlift_Chord_Shortcode(); |
|
1283 | + new Wordlift_Geomap_Shortcode(); |
|
1284 | + new Wordlift_Timeline_Shortcode(); |
|
1285 | + new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
1286 | + new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
1287 | + new Wordlift_Faceted_Search_Shortcode(); |
|
1288 | 1288 | |
1289 | - // Initialize the SEO service. |
|
1290 | - new Wordlift_Seo_Service(); |
|
1289 | + // Initialize the SEO service. |
|
1290 | + new Wordlift_Seo_Service(); |
|
1291 | 1291 | |
1292 | - // Initialize the AMP service. |
|
1293 | - new Wordlift_AMP_Service( $this->jsonld_service ); |
|
1292 | + // Initialize the AMP service. |
|
1293 | + new Wordlift_AMP_Service( $this->jsonld_service ); |
|
1294 | 1294 | |
1295 | - /** Services. */ |
|
1296 | - $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
1297 | - new Wordlift_Image_Service(); |
|
1295 | + /** Services. */ |
|
1296 | + $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
1297 | + new Wordlift_Image_Service(); |
|
1298 | 1298 | |
1299 | - /** Adapters. */ |
|
1300 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
1301 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
1302 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
1303 | - $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service ); |
|
1304 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
1299 | + /** Adapters. */ |
|
1300 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
1301 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
1302 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
1303 | + $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service ); |
|
1304 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
1305 | 1305 | |
1306 | - /* |
|
1306 | + /* |
|
1307 | 1307 | * Exclude our public js from WP-Rocket. |
1308 | 1308 | * |
1309 | 1309 | * @since 3.19.4 |
1310 | 1310 | * |
1311 | 1311 | * @see https://github.com/insideout10/wordlift-plugin/issues/842. |
1312 | 1312 | */ |
1313 | - new Wordlift_WpRocket_Adapter(); |
|
1313 | + new Wordlift_WpRocket_Adapter(); |
|
1314 | 1314 | |
1315 | - // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
1316 | - $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
1317 | - $this->sparql_service, |
|
1318 | - $uri_service |
|
1319 | - ); |
|
1315 | + // Create a Rebuild Service instance, which we'll later bound to an ajax call. |
|
1316 | + $this->rebuild_service = new Wordlift_Rebuild_Service( |
|
1317 | + $this->sparql_service, |
|
1318 | + $uri_service |
|
1319 | + ); |
|
1320 | 1320 | |
1321 | - /** Async Tasks. */ |
|
1322 | - new Wordlift_Sparql_Query_Async_Task(); |
|
1323 | - new Wordlift_Batch_Analysis_Request_Async_Task(); |
|
1324 | - new Wordlift_Batch_Analysis_Complete_Async_Task(); |
|
1325 | - new Wordlift_Push_References_Async_Task(); |
|
1321 | + /** Async Tasks. */ |
|
1322 | + new Wordlift_Sparql_Query_Async_Task(); |
|
1323 | + new Wordlift_Batch_Analysis_Request_Async_Task(); |
|
1324 | + new Wordlift_Batch_Analysis_Complete_Async_Task(); |
|
1325 | + new Wordlift_Push_References_Async_Task(); |
|
1326 | 1326 | |
1327 | - /** WL Autocomplete. */ |
|
1328 | - $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service ); |
|
1329 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service ); |
|
1327 | + /** WL Autocomplete. */ |
|
1328 | + $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service ); |
|
1329 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service ); |
|
1330 | 1330 | |
1331 | - /** WordPress Admin UI. */ |
|
1331 | + /** WordPress Admin UI. */ |
|
1332 | 1332 | |
1333 | - // UI elements. |
|
1334 | - $this->input_element = new Wordlift_Admin_Input_Element(); |
|
1335 | - $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
1336 | - $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
1337 | - $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
1338 | - $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
1339 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
1340 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
1341 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
1333 | + // UI elements. |
|
1334 | + $this->input_element = new Wordlift_Admin_Input_Element(); |
|
1335 | + $this->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
1336 | + $this->select2_element = new Wordlift_Admin_Select2_Element(); |
|
1337 | + $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
1338 | + $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
1339 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
1340 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
1341 | + $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
1342 | 1342 | |
1343 | - $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element ); |
|
1344 | - $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service ); |
|
1345 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
1343 | + $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element ); |
|
1344 | + $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service ); |
|
1345 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
1346 | 1346 | |
1347 | - $this->analytics_settings_page = new Wordlift_Admin_Analytics_Settings_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
1348 | - $this->analytics_settings_page_action_link = new Wordlift_Admin_Analytics_Settings_Page_Action_Link( $this->analytics_settings_page ); |
|
1349 | - $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
1347 | + $this->analytics_settings_page = new Wordlift_Admin_Analytics_Settings_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
1348 | + $this->analytics_settings_page_action_link = new Wordlift_Admin_Analytics_Settings_Page_Action_Link( $this->analytics_settings_page ); |
|
1349 | + $this->analytics_connect = new Wordlift_Analytics_Connect(); |
|
1350 | 1350 | |
1351 | - // Pages. |
|
1352 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
1353 | - new Wordlift_Entity_Type_Admin_Service(); |
|
1351 | + // Pages. |
|
1352 | + new Wordlift_Admin_Post_Edit_Page( $this ); |
|
1353 | + new Wordlift_Entity_Type_Admin_Service(); |
|
1354 | 1354 | |
1355 | - // create an instance of the entity type list admin page controller. |
|
1356 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
1355 | + // create an instance of the entity type list admin page controller. |
|
1356 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
1357 | 1357 | |
1358 | - // create an instance of the entity type setting admin page controller. |
|
1359 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
1358 | + // create an instance of the entity type setting admin page controller. |
|
1359 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
1360 | 1360 | |
1361 | - /** Widgets */ |
|
1362 | - $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
1361 | + /** Widgets */ |
|
1362 | + $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
1363 | 1363 | |
1364 | - /* WordPress Admin. */ |
|
1365 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
1366 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
1364 | + /* WordPress Admin. */ |
|
1365 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
1366 | + $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
1367 | 1367 | |
1368 | - // Create an instance of the install wizard. |
|
1369 | - $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element ); |
|
1368 | + // Create an instance of the install wizard. |
|
1369 | + $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element ); |
|
1370 | 1370 | |
1371 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
1371 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
1372 | 1372 | |
1373 | - // User Profile. |
|
1374 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
1373 | + // User Profile. |
|
1374 | + new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
1375 | 1375 | |
1376 | - $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
1376 | + $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
1377 | 1377 | |
1378 | - // Load the debug service if WP is in debug mode. |
|
1379 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
1380 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
1381 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
1382 | - } |
|
1378 | + // Load the debug service if WP is in debug mode. |
|
1379 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
1380 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
1381 | + new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
1382 | + } |
|
1383 | 1383 | |
1384 | - // Remote Image Service. |
|
1385 | - new Wordlift_Remote_Image_Service(); |
|
1384 | + // Remote Image Service. |
|
1385 | + new Wordlift_Remote_Image_Service(); |
|
1386 | 1386 | |
1387 | - /* |
|
1387 | + /* |
|
1388 | 1388 | * Provides mappings between post types and entity types. |
1389 | 1389 | * |
1390 | 1390 | * @since 3.20.0 |
1391 | 1391 | * |
1392 | 1392 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
1393 | 1393 | */ |
1394 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
1395 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
1396 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
1394 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
1395 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
1396 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
1397 | 1397 | |
1398 | - // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
1399 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
1398 | + // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
1399 | + new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
1400 | 1400 | |
1401 | - /* |
|
1401 | + /* |
|
1402 | 1402 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
1403 | 1403 | * |
1404 | 1404 | * Eventually Batch Actions will become Batch Operations. |
1405 | 1405 | * |
1406 | 1406 | * @since 3.20.0 |
1407 | 1407 | */ |
1408 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
1409 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
1408 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
1409 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
1410 | 1410 | |
1411 | - /* |
|
1411 | + /* |
|
1412 | 1412 | * Add the Search Keywords taxonomy to manage the Search Keywords on WLS. |
1413 | 1413 | * |
1414 | 1414 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
1415 | 1415 | * |
1416 | 1416 | * @since 3.20.0 |
1417 | 1417 | */ |
1418 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
1419 | - new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
1418 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
1419 | + new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
1420 | 1420 | |
1421 | - /* |
|
1421 | + /* |
|
1422 | 1422 | * Load dependencies for the front-end. |
1423 | 1423 | * |
1424 | 1424 | * @since 3.20.0 |
1425 | 1425 | */ |
1426 | - if ( ! is_admin() ) { |
|
1427 | - /* |
|
1426 | + if ( ! is_admin() ) { |
|
1427 | + /* |
|
1428 | 1428 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
1429 | 1429 | * |
1430 | 1430 | * @see https://github.com/insideout10/wordlift-plugin/issues/892 |
1431 | 1431 | * |
1432 | 1432 | * @since 3.20.0 |
1433 | 1433 | */ |
1434 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
1435 | - new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
1436 | - } |
|
1437 | - |
|
1438 | - } |
|
1439 | - |
|
1440 | - /** |
|
1441 | - * Define the locale for this plugin for internationalization. |
|
1442 | - * |
|
1443 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
1444 | - * with WordPress. |
|
1445 | - * |
|
1446 | - * @since 1.0.0 |
|
1447 | - * @access private |
|
1448 | - */ |
|
1449 | - private function set_locale() { |
|
1450 | - |
|
1451 | - $plugin_i18n = new Wordlift_i18n(); |
|
1452 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
1453 | - |
|
1454 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
1455 | - |
|
1456 | - } |
|
1457 | - |
|
1458 | - /** |
|
1459 | - * Register all of the hooks related to the admin area functionality |
|
1460 | - * of the plugin. |
|
1461 | - * |
|
1462 | - * @since 1.0.0 |
|
1463 | - * @access private |
|
1464 | - */ |
|
1465 | - private function define_admin_hooks() { |
|
1466 | - |
|
1467 | - $plugin_admin = new Wordlift_Admin( |
|
1468 | - $this->get_plugin_name(), |
|
1469 | - $this->get_version(), |
|
1470 | - $this->configuration_service, |
|
1471 | - $this->notice_service, |
|
1472 | - $this->user_service |
|
1473 | - ); |
|
1474 | - |
|
1475 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
1476 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
1477 | - |
|
1478 | - // Hook the init action to taxonomy services. |
|
1479 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
1480 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
1481 | - |
|
1482 | - // Hook the deleted_post_meta action to the Thumbnail service. |
|
1483 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
1484 | - |
|
1485 | - // Hook the added_post_meta action to the Thumbnail service. |
|
1486 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
1487 | - |
|
1488 | - // Hook the updated_post_meta action to the Thumbnail service. |
|
1489 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
1490 | - |
|
1491 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
1492 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
1493 | - |
|
1494 | - // Register custom allowed redirect hosts. |
|
1495 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
1496 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
1497 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
1498 | - |
|
1499 | - /* |
|
1434 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
1435 | + new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
1436 | + } |
|
1437 | + |
|
1438 | + } |
|
1439 | + |
|
1440 | + /** |
|
1441 | + * Define the locale for this plugin for internationalization. |
|
1442 | + * |
|
1443 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
1444 | + * with WordPress. |
|
1445 | + * |
|
1446 | + * @since 1.0.0 |
|
1447 | + * @access private |
|
1448 | + */ |
|
1449 | + private function set_locale() { |
|
1450 | + |
|
1451 | + $plugin_i18n = new Wordlift_i18n(); |
|
1452 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
1453 | + |
|
1454 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
1455 | + |
|
1456 | + } |
|
1457 | + |
|
1458 | + /** |
|
1459 | + * Register all of the hooks related to the admin area functionality |
|
1460 | + * of the plugin. |
|
1461 | + * |
|
1462 | + * @since 1.0.0 |
|
1463 | + * @access private |
|
1464 | + */ |
|
1465 | + private function define_admin_hooks() { |
|
1466 | + |
|
1467 | + $plugin_admin = new Wordlift_Admin( |
|
1468 | + $this->get_plugin_name(), |
|
1469 | + $this->get_version(), |
|
1470 | + $this->configuration_service, |
|
1471 | + $this->notice_service, |
|
1472 | + $this->user_service |
|
1473 | + ); |
|
1474 | + |
|
1475 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
1476 | + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
1477 | + |
|
1478 | + // Hook the init action to taxonomy services. |
|
1479 | + $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
1480 | + $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
1481 | + |
|
1482 | + // Hook the deleted_post_meta action to the Thumbnail service. |
|
1483 | + $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
1484 | + |
|
1485 | + // Hook the added_post_meta action to the Thumbnail service. |
|
1486 | + $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
1487 | + |
|
1488 | + // Hook the updated_post_meta action to the Thumbnail service. |
|
1489 | + $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
1490 | + |
|
1491 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
1492 | + $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
1493 | + |
|
1494 | + // Register custom allowed redirect hosts. |
|
1495 | + $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
1496 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
1497 | + $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
1498 | + |
|
1499 | + /* |
|
1500 | 1500 | * The old dashboard is replaced with dashboard v2. |
1501 | 1501 | * |
1502 | 1502 | * The old dashboard service is still loaded because its functions are used. |
@@ -1505,293 +1505,293 @@ discard block |
||
1505 | 1505 | * |
1506 | 1506 | * @since 3.20.0 |
1507 | 1507 | */ |
1508 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
1509 | - // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
1510 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
1511 | - // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
1512 | - |
|
1513 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
1514 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
1515 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
1516 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
1517 | - |
|
1518 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
1519 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
1520 | - |
|
1521 | - // Entity listing customization (wp-admin/edit.php) |
|
1522 | - // Add custom columns. |
|
1523 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
1524 | - // no explicit entity as it prevents handling of other post types. |
|
1525 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
1526 | - // Add 4W selection. |
|
1527 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
1528 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
1529 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
1530 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
1531 | - |
|
1532 | - /* |
|
1508 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
1509 | + // $this->loader->add_action( 'wp_ajax_wordlift_get_stats', $this->dashboard_service, 'ajax_get_stats' ); |
|
1510 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
1511 | + // $this->loader->add_action( 'wp_dashboard_setup', $this->dashboard_service, 'add_dashboard_widgets' ); |
|
1512 | + |
|
1513 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
1514 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
1515 | + $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
1516 | + $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
1517 | + |
|
1518 | + $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
1519 | + $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
1520 | + |
|
1521 | + // Entity listing customization (wp-admin/edit.php) |
|
1522 | + // Add custom columns. |
|
1523 | + $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
1524 | + // no explicit entity as it prevents handling of other post types. |
|
1525 | + $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
1526 | + // Add 4W selection. |
|
1527 | + $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
1528 | + $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
1529 | + $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
1530 | + $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
1531 | + |
|
1532 | + /* |
|
1533 | 1533 | * If `All Entity Types` is disable, use the radio button Walker. |
1534 | 1534 | * |
1535 | 1535 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
1536 | 1536 | */ |
1537 | - if ( ! WL_ALL_ENTITY_TYPES ) { |
|
1538 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
1539 | - } |
|
1537 | + if ( ! WL_ALL_ENTITY_TYPES ) { |
|
1538 | + $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
1539 | + } |
|
1540 | 1540 | |
1541 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
1542 | - // entities. |
|
1543 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
1541 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
1542 | + // entities. |
|
1543 | + $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
1544 | 1544 | |
1545 | - // Filter imported post meta. |
|
1546 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
1545 | + // Filter imported post meta. |
|
1546 | + $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
1547 | 1547 | |
1548 | - // Notify the import service when an import starts and ends. |
|
1549 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
1550 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
1548 | + // Notify the import service when an import starts and ends. |
|
1549 | + $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
1550 | + $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
1551 | 1551 | |
1552 | - // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
1553 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
1554 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
1552 | + // Hook the AJAX wl_rebuild action to the Rebuild Service. |
|
1553 | + $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
1554 | + $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
1555 | 1555 | |
1556 | - // Hook the menu to the Download Your Data page. |
|
1557 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
1558 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
1559 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
1556 | + // Hook the menu to the Download Your Data page. |
|
1557 | + $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
1558 | + $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
1559 | + $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
1560 | 1560 | |
1561 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
1562 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
1561 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
1562 | + $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
1563 | 1563 | |
1564 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
1565 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
1566 | - $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
1567 | - $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
1564 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
1565 | + $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
1566 | + $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
1567 | + $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
1568 | 1568 | |
1569 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
1570 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
1569 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
1570 | + $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
1571 | 1571 | |
1572 | - // Hook the AJAX wl_update_country_options action to the countries. |
|
1573 | - $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
1572 | + // Hook the AJAX wl_update_country_options action to the countries. |
|
1573 | + $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
1574 | 1574 | |
1575 | - // Hook the `admin_init` function to the Admin Setup. |
|
1576 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
1575 | + // Hook the `admin_init` function to the Admin Setup. |
|
1576 | + $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
1577 | 1577 | |
1578 | - // Hook the admin_init to the settings page. |
|
1579 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
1580 | - $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
1578 | + // Hook the admin_init to the settings page. |
|
1579 | + $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
1580 | + $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
1581 | 1581 | |
1582 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
1582 | + $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
1583 | 1583 | |
1584 | - // Hook the menu creation on the general wordlift menu creation. |
|
1585 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
1586 | - $this->loader->add_action( 'wl_admin_menu', $this->analytics_settings_page, 'admin_menu', 10, 2 ); |
|
1587 | - if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) { |
|
1588 | - // Add the functionality only if a flag is set in wp-config.php . |
|
1589 | - $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 ); |
|
1590 | - } |
|
1584 | + // Hook the menu creation on the general wordlift menu creation. |
|
1585 | + $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
1586 | + $this->loader->add_action( 'wl_admin_menu', $this->analytics_settings_page, 'admin_menu', 10, 2 ); |
|
1587 | + if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) { |
|
1588 | + // Add the functionality only if a flag is set in wp-config.php . |
|
1589 | + $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 ); |
|
1590 | + } |
|
1591 | 1591 | |
1592 | - /* |
|
1592 | + /* |
|
1593 | 1593 | * Display the `Wordlift_Admin_Search_Rankings_Page` page. |
1594 | 1594 | * |
1595 | 1595 | * @link https://github.com/insideout10/wordlift-plugin/issues/761 |
1596 | 1596 | * |
1597 | 1597 | * @since 3.20.0 |
1598 | 1598 | */ |
1599 | - if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
1600 | - $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
|
1601 | - $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
1602 | - } |
|
1603 | - |
|
1604 | - // Hook key update. |
|
1605 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
1606 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
1607 | - |
|
1608 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
1609 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
1610 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
1611 | - |
|
1612 | - // Hook the AJAX `wl_publisher` action name. |
|
1613 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
1614 | - |
|
1615 | - // Hook row actions for the entity type list admin. |
|
1616 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
1617 | - |
|
1618 | - /** Ajax actions. */ |
|
1619 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
1620 | - |
|
1621 | - // Hook capabilities manipulation to allow access to entity type admin |
|
1622 | - // page on WordPress versions before 4.7. |
|
1623 | - global $wp_version; |
|
1624 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
1625 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
1626 | - } |
|
1627 | - |
|
1628 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
1629 | - |
|
1630 | - /** Adapters. */ |
|
1631 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
1632 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' ); |
|
1633 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' ); |
|
1634 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' ); |
|
1635 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' ); |
|
1636 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
1637 | - |
|
1638 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
1639 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
1640 | - |
|
1641 | - |
|
1642 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
1643 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
1644 | - |
|
1645 | - // Handle the autocomplete request. |
|
1646 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
1647 | - $this->autocomplete_adapter, |
|
1648 | - 'wl_autocomplete', |
|
1649 | - ) ); |
|
1650 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
1651 | - $this->autocomplete_adapter, |
|
1652 | - 'wl_autocomplete', |
|
1653 | - ) ); |
|
1654 | - |
|
1655 | - // Hooks to restrict multisite super admin from manipulating entity types. |
|
1656 | - if ( is_multisite() ) { |
|
1657 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
1658 | - } |
|
1659 | - |
|
1660 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
1661 | - |
|
1662 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
1663 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
1664 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
1665 | - } |
|
1666 | - |
|
1667 | - /** |
|
1668 | - * Register all of the hooks related to the public-facing functionality |
|
1669 | - * of the plugin. |
|
1670 | - * |
|
1671 | - * @since 1.0.0 |
|
1672 | - * @access private |
|
1673 | - */ |
|
1674 | - private function define_public_hooks() { |
|
1675 | - |
|
1676 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
1677 | - |
|
1678 | - // Register the entity post type. |
|
1679 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
1680 | - $this->loader->add_action( 'init', $this->install_service, 'install' ); |
|
1681 | - |
|
1682 | - // Bind the link generation and handling hooks to the entity link service. |
|
1683 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
1684 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
1685 | - $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 ); |
|
1686 | - $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 ); |
|
1687 | - |
|
1688 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
1689 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
1690 | - |
|
1691 | - // Hook the content filter service to add entity links. |
|
1692 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
1693 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
1694 | - } |
|
1695 | - |
|
1696 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
1697 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
1698 | - |
|
1699 | - // Hook the ShareThis service. |
|
1700 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
1701 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
1702 | - |
|
1703 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
1704 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
1705 | - |
|
1706 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
1707 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
1708 | - // to categories. |
|
1709 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
1710 | - |
|
1711 | - /* |
|
1599 | + if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
1600 | + $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
|
1601 | + $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
1602 | + } |
|
1603 | + |
|
1604 | + // Hook key update. |
|
1605 | + $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
1606 | + $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
1607 | + |
|
1608 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
1609 | + $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
1610 | + $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
1611 | + |
|
1612 | + // Hook the AJAX `wl_publisher` action name. |
|
1613 | + $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
1614 | + |
|
1615 | + // Hook row actions for the entity type list admin. |
|
1616 | + $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
1617 | + |
|
1618 | + /** Ajax actions. */ |
|
1619 | + $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
1620 | + |
|
1621 | + // Hook capabilities manipulation to allow access to entity type admin |
|
1622 | + // page on WordPress versions before 4.7. |
|
1623 | + global $wp_version; |
|
1624 | + if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
1625 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
1626 | + } |
|
1627 | + |
|
1628 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
1629 | + |
|
1630 | + /** Adapters. */ |
|
1631 | + $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
1632 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' ); |
|
1633 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' ); |
|
1634 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' ); |
|
1635 | + $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' ); |
|
1636 | + $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
1637 | + |
|
1638 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
1639 | + $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
1640 | + |
|
1641 | + |
|
1642 | + $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
1643 | + $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
1644 | + |
|
1645 | + // Handle the autocomplete request. |
|
1646 | + add_action( 'wp_ajax_wl_autocomplete', array( |
|
1647 | + $this->autocomplete_adapter, |
|
1648 | + 'wl_autocomplete', |
|
1649 | + ) ); |
|
1650 | + add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
1651 | + $this->autocomplete_adapter, |
|
1652 | + 'wl_autocomplete', |
|
1653 | + ) ); |
|
1654 | + |
|
1655 | + // Hooks to restrict multisite super admin from manipulating entity types. |
|
1656 | + if ( is_multisite() ) { |
|
1657 | + $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
1658 | + } |
|
1659 | + |
|
1660 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
1661 | + |
|
1662 | + add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
1663 | + add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
1664 | + add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
1665 | + } |
|
1666 | + |
|
1667 | + /** |
|
1668 | + * Register all of the hooks related to the public-facing functionality |
|
1669 | + * of the plugin. |
|
1670 | + * |
|
1671 | + * @since 1.0.0 |
|
1672 | + * @access private |
|
1673 | + */ |
|
1674 | + private function define_public_hooks() { |
|
1675 | + |
|
1676 | + $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
1677 | + |
|
1678 | + // Register the entity post type. |
|
1679 | + $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
1680 | + $this->loader->add_action( 'init', $this->install_service, 'install' ); |
|
1681 | + |
|
1682 | + // Bind the link generation and handling hooks to the entity link service. |
|
1683 | + $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
1684 | + $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
1685 | + $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 ); |
|
1686 | + $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 ); |
|
1687 | + |
|
1688 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
1689 | + $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
1690 | + |
|
1691 | + // Hook the content filter service to add entity links. |
|
1692 | + if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
1693 | + $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
1694 | + } |
|
1695 | + |
|
1696 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
1697 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
1698 | + |
|
1699 | + // Hook the ShareThis service. |
|
1700 | + $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
1701 | + $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
1702 | + |
|
1703 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
1704 | + $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
1705 | + |
|
1706 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
1707 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
1708 | + // to categories. |
|
1709 | + $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
1710 | + |
|
1711 | + /* |
|
1712 | 1712 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
1713 | 1713 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
1714 | 1714 | * order of start time. |
1715 | 1715 | */ |
1716 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
1717 | - |
|
1718 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
1719 | - |
|
1720 | - // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
1721 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
1722 | - |
|
1723 | - // Analytics Script Frontend. |
|
1724 | - if ( $this->configuration_service->is_analytics_enable() ) { |
|
1725 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
1726 | - } |
|
1727 | - |
|
1728 | - } |
|
1729 | - |
|
1730 | - /** |
|
1731 | - * Run the loader to execute all of the hooks with WordPress. |
|
1732 | - * |
|
1733 | - * @since 1.0.0 |
|
1734 | - */ |
|
1735 | - public function run() { |
|
1736 | - $this->loader->run(); |
|
1737 | - } |
|
1738 | - |
|
1739 | - /** |
|
1740 | - * The name of the plugin used to uniquely identify it within the context of |
|
1741 | - * WordPress and to define internationalization functionality. |
|
1742 | - * |
|
1743 | - * @since 1.0.0 |
|
1744 | - * @return string The name of the plugin. |
|
1745 | - */ |
|
1746 | - public function get_plugin_name() { |
|
1747 | - return $this->plugin_name; |
|
1748 | - } |
|
1749 | - |
|
1750 | - /** |
|
1751 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
1752 | - * |
|
1753 | - * @since 1.0.0 |
|
1754 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
1755 | - */ |
|
1756 | - public function get_loader() { |
|
1757 | - return $this->loader; |
|
1758 | - } |
|
1759 | - |
|
1760 | - /** |
|
1761 | - * Retrieve the version number of the plugin. |
|
1762 | - * |
|
1763 | - * @since 1.0.0 |
|
1764 | - * @return string The version number of the plugin. |
|
1765 | - */ |
|
1766 | - public function get_version() { |
|
1767 | - return $this->version; |
|
1768 | - } |
|
1769 | - |
|
1770 | - /** |
|
1771 | - * Load dependencies for WP-CLI. |
|
1772 | - * |
|
1773 | - * @since 3.18.0 |
|
1774 | - * @throws Exception |
|
1775 | - */ |
|
1776 | - private function load_cli_dependencies() { |
|
1777 | - |
|
1778 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
1779 | - |
|
1780 | - $push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service ); |
|
1781 | - |
|
1782 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
1783 | - |
|
1784 | - } |
|
1785 | - |
|
1786 | - /** |
|
1787 | - * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
1788 | - * |
|
1789 | - * @since 3.20.0 |
|
1790 | - * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
1791 | - */ |
|
1792 | - public function get_dashboard_service() { |
|
1793 | - |
|
1794 | - return $this->dashboard_service; |
|
1795 | - } |
|
1716 | + $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
1717 | + |
|
1718 | + $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
1719 | + |
|
1720 | + // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
1721 | + $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
1722 | + |
|
1723 | + // Analytics Script Frontend. |
|
1724 | + if ( $this->configuration_service->is_analytics_enable() ) { |
|
1725 | + $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
1726 | + } |
|
1727 | + |
|
1728 | + } |
|
1729 | + |
|
1730 | + /** |
|
1731 | + * Run the loader to execute all of the hooks with WordPress. |
|
1732 | + * |
|
1733 | + * @since 1.0.0 |
|
1734 | + */ |
|
1735 | + public function run() { |
|
1736 | + $this->loader->run(); |
|
1737 | + } |
|
1738 | + |
|
1739 | + /** |
|
1740 | + * The name of the plugin used to uniquely identify it within the context of |
|
1741 | + * WordPress and to define internationalization functionality. |
|
1742 | + * |
|
1743 | + * @since 1.0.0 |
|
1744 | + * @return string The name of the plugin. |
|
1745 | + */ |
|
1746 | + public function get_plugin_name() { |
|
1747 | + return $this->plugin_name; |
|
1748 | + } |
|
1749 | + |
|
1750 | + /** |
|
1751 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
1752 | + * |
|
1753 | + * @since 1.0.0 |
|
1754 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
1755 | + */ |
|
1756 | + public function get_loader() { |
|
1757 | + return $this->loader; |
|
1758 | + } |
|
1759 | + |
|
1760 | + /** |
|
1761 | + * Retrieve the version number of the plugin. |
|
1762 | + * |
|
1763 | + * @since 1.0.0 |
|
1764 | + * @return string The version number of the plugin. |
|
1765 | + */ |
|
1766 | + public function get_version() { |
|
1767 | + return $this->version; |
|
1768 | + } |
|
1769 | + |
|
1770 | + /** |
|
1771 | + * Load dependencies for WP-CLI. |
|
1772 | + * |
|
1773 | + * @since 3.18.0 |
|
1774 | + * @throws Exception |
|
1775 | + */ |
|
1776 | + private function load_cli_dependencies() { |
|
1777 | + |
|
1778 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
1779 | + |
|
1780 | + $push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service ); |
|
1781 | + |
|
1782 | + WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
1783 | + |
|
1784 | + } |
|
1785 | + |
|
1786 | + /** |
|
1787 | + * Get the {@link \Wordlift_Dashboard_Service} to allow others to use its functions. |
|
1788 | + * |
|
1789 | + * @since 3.20.0 |
|
1790 | + * @return \Wordlift_Dashboard_Service The {@link \Wordlift_Dashboard_Service} instance. |
|
1791 | + */ |
|
1792 | + public function get_dashboard_service() { |
|
1793 | + |
|
1794 | + return $this->dashboard_service; |
|
1795 | + } |
|
1796 | 1796 | |
1797 | 1797 | } |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | $this->define_public_hooks(); |
750 | 750 | |
751 | 751 | // If we're in `WP_CLI` load the related files. |
752 | - if ( class_exists( 'WP_CLI' ) ) { |
|
752 | + if (class_exists('WP_CLI')) { |
|
753 | 753 | $this->load_cli_dependencies(); |
754 | 754 | } |
755 | 755 | |
@@ -789,379 +789,379 @@ discard block |
||
789 | 789 | * The class responsible for orchestrating the actions and filters of the |
790 | 790 | * core plugin. |
791 | 791 | */ |
792 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-loader.php'; |
|
792 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-loader.php'; |
|
793 | 793 | |
794 | 794 | // The class responsible for plugin uninstall. |
795 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
795 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-deactivator-feedback.php'; |
|
796 | 796 | |
797 | 797 | /** |
798 | 798 | * The class responsible for defining internationalization functionality |
799 | 799 | * of the plugin. |
800 | 800 | */ |
801 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-i18n.php'; |
|
801 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-i18n.php'; |
|
802 | 802 | |
803 | 803 | /** |
804 | 804 | * WordLift's supported languages. |
805 | 805 | */ |
806 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-languages.php'; |
|
806 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-languages.php'; |
|
807 | 807 | |
808 | 808 | /** |
809 | 809 | * WordLift's supported countries. |
810 | 810 | */ |
811 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-countries.php'; |
|
811 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-countries.php'; |
|
812 | 812 | |
813 | 813 | /** |
814 | 814 | * Provide support functions to sanitize data. |
815 | 815 | */ |
816 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sanitizer.php'; |
|
816 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sanitizer.php'; |
|
817 | 817 | |
818 | 818 | /** Services. */ |
819 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-log-service.php'; |
|
820 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-http-api.php'; |
|
821 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-redirect-service.php'; |
|
822 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-configuration-service.php'; |
|
823 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
824 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-service.php'; |
|
825 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-link-service.php'; |
|
826 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-linked-data-service.php'; |
|
827 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-relation-service.php'; |
|
828 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-image-service.php'; |
|
819 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-log-service.php'; |
|
820 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-http-api.php'; |
|
821 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-redirect-service.php'; |
|
822 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-configuration-service.php'; |
|
823 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-type-service.php'; |
|
824 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-service.php'; |
|
825 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-link-service.php'; |
|
826 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-linked-data-service.php'; |
|
827 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-relation-service.php'; |
|
828 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-image-service.php'; |
|
829 | 829 | |
830 | 830 | /** |
831 | 831 | * The Query builder. |
832 | 832 | */ |
833 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-query-builder.php'; |
|
833 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-query-builder.php'; |
|
834 | 834 | |
835 | 835 | /** |
836 | 836 | * The Schema service. |
837 | 837 | */ |
838 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-service.php'; |
|
838 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-service.php'; |
|
839 | 839 | |
840 | 840 | /** |
841 | 841 | * The schema:url property service. |
842 | 842 | */ |
843 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-service.php'; |
|
844 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
843 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-service.php'; |
|
844 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-schema-url-property-service.php'; |
|
845 | 845 | |
846 | 846 | /** |
847 | 847 | * The UI service. |
848 | 848 | */ |
849 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-ui-service.php'; |
|
849 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-ui-service.php'; |
|
850 | 850 | |
851 | 851 | /** |
852 | 852 | * The Thumbnail service. |
853 | 853 | */ |
854 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-thumbnail-service.php'; |
|
854 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-thumbnail-service.php'; |
|
855 | 855 | |
856 | 856 | /** |
857 | 857 | * The Entity Types Taxonomy service. |
858 | 858 | */ |
859 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
859 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
860 | 860 | |
861 | 861 | /** |
862 | 862 | * The Entity service. |
863 | 863 | */ |
864 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
865 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-service.php'; |
|
864 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-uri-service.php'; |
|
865 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-service.php'; |
|
866 | 866 | |
867 | 867 | // Add the entity rating service. |
868 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-rating-service.php'; |
|
868 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-rating-service.php'; |
|
869 | 869 | |
870 | 870 | /** |
871 | 871 | * The User service. |
872 | 872 | */ |
873 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-user-service.php'; |
|
873 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-user-service.php'; |
|
874 | 874 | |
875 | 875 | /** |
876 | 876 | * The Timeline service. |
877 | 877 | */ |
878 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-timeline-service.php'; |
|
878 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-timeline-service.php'; |
|
879 | 879 | |
880 | 880 | /** |
881 | 881 | * The Topic Taxonomy service. |
882 | 882 | */ |
883 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
883 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-topic-taxonomy-service.php'; |
|
884 | 884 | |
885 | 885 | /** |
886 | 886 | * The SPARQL service. |
887 | 887 | */ |
888 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sparql-service.php'; |
|
888 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sparql-service.php'; |
|
889 | 889 | |
890 | 890 | /** |
891 | 891 | * The WordLift import service. |
892 | 892 | */ |
893 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-import-service.php'; |
|
893 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-import-service.php'; |
|
894 | 894 | |
895 | 895 | /** |
896 | 896 | * The WordLift URI service. |
897 | 897 | */ |
898 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-uri-service.php'; |
|
899 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-property-factory.php'; |
|
900 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-service.php'; |
|
898 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-uri-service.php'; |
|
899 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-property-factory.php'; |
|
900 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-service.php'; |
|
901 | 901 | |
902 | 902 | /** |
903 | 903 | * The WordLift rebuild service, used to rebuild the remote dataset using the local data. |
904 | 904 | */ |
905 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-listable.php'; |
|
906 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
907 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
908 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
909 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
905 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-listable.php'; |
|
906 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-rebuild-service.php'; |
|
907 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-reference-rebuild-service.php'; |
|
908 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-service.php'; |
|
909 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/rebuild/class-wordlift-relation-rebuild-adapter.php'; |
|
910 | 910 | |
911 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
912 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-attachment-service.php'; |
|
911 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/properties/class-wordlift-property-getter-factory.php'; |
|
912 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-attachment-service.php'; |
|
913 | 913 | |
914 | 914 | /** |
915 | 915 | * Load the converters. |
916 | 916 | */ |
917 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/intf-wordlift-post-converter.php'; |
|
918 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
919 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
920 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
921 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
922 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-website-converter.php'; |
|
917 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/intf-wordlift-post-converter.php'; |
|
918 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
919 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
920 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
921 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
922 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-website-converter.php'; |
|
923 | 923 | |
924 | 924 | /** |
925 | 925 | * Load cache-related files. |
926 | 926 | */ |
927 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/cache/require.php'; |
|
927 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/cache/require.php'; |
|
928 | 928 | |
929 | 929 | /** |
930 | 930 | * Load the content filter. |
931 | 931 | */ |
932 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-content-filter-service.php'; |
|
932 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-content-filter-service.php'; |
|
933 | 933 | |
934 | 934 | /* |
935 | 935 | * Load the excerpt helper. |
936 | 936 | */ |
937 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
937 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-excerpt-helper.php'; |
|
938 | 938 | |
939 | 939 | /** |
940 | 940 | * Load the JSON-LD service to publish entities using JSON-LD.s |
941 | 941 | * |
942 | 942 | * @since 3.8.0 |
943 | 943 | */ |
944 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-jsonld-service.php'; |
|
944 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-jsonld-service.php'; |
|
945 | 945 | |
946 | 946 | // The Publisher Service and the AJAX adapter. |
947 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-service.php'; |
|
948 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
947 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-service.php'; |
|
948 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
949 | 949 | |
950 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-post-adapter.php'; |
|
950 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-post-adapter.php'; |
|
951 | 951 | |
952 | 952 | /** |
953 | 953 | * Load the WordLift key validation service. |
954 | 954 | */ |
955 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-key-validation-service.php'; |
|
955 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-key-validation-service.php'; |
|
956 | 956 | |
957 | 957 | // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
958 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
958 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-category-taxonomy-service.php'; |
|
959 | 959 | |
960 | 960 | // Load the `Wordlift_Entity_Page_Service` class definition. |
961 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-page-service.php'; |
|
962 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
963 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
961 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-page-service.php'; |
|
962 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-sql-helper.php'; |
|
963 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-service.php'; |
|
964 | 964 | |
965 | 965 | /** Linked Data. */ |
966 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
967 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
968 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
969 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
970 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
971 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
972 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
973 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
974 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
975 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
976 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
966 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage.php'; |
|
967 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
968 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
969 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
970 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
971 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
972 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
973 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
974 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
975 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
976 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
977 | 977 | |
978 | 978 | /** Linked Data Rendition. */ |
979 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
980 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
981 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
982 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
979 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/intf-wordlift-sparql-tuple-rendition.php'; |
|
980 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-default-sparql-tuple-rendition.php'; |
|
981 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-address-sparql-tuple-rendition.php'; |
|
982 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/linked-data/rendition/class-wordlift-sparql-tuple-rendition-factory.php'; |
|
983 | 983 | |
984 | 984 | /** Services. */ |
985 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
986 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-api-service.php'; |
|
987 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-service.php'; |
|
985 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-google-analytics-export-service.php'; |
|
986 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-api-service.php'; |
|
987 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-service.php'; |
|
988 | 988 | |
989 | 989 | /** Adapters. */ |
990 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
991 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
992 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
993 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
994 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
995 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
990 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-tinymce-adapter.php'; |
|
991 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-newrelic-adapter.php'; |
|
992 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
993 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-entity-type-adapter.php'; |
|
994 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch-analysis/class-wordlift-batch-analysis-adapter.php'; |
|
995 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-wprocket-adapter.php'; |
|
996 | 996 | |
997 | 997 | /** Async Tasks. */ |
998 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-async-task.php'; |
|
999 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
1000 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
1001 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
1002 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
998 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-async-task.php'; |
|
999 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-sparql-query-async-task.php'; |
|
1000 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-batch-analysis-request-async-task.php'; |
|
1001 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-batch-analysis-complete-async-task.php'; |
|
1002 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/wp-async-task/class-wordlift-push-references-async-task.php'; |
|
1003 | 1003 | |
1004 | 1004 | /** Autocomplete. */ |
1005 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-service.php'; |
|
1006 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
1005 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-service.php'; |
|
1006 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-autocomplete-adapter.php'; |
|
1007 | 1007 | |
1008 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-remote-image-service.php'; |
|
1008 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-remote-image-service.php'; |
|
1009 | 1009 | |
1010 | 1010 | /** Analytics **/ |
1011 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
1011 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/analytics/class-wordlift-analytics-connect.php'; |
|
1012 | 1012 | |
1013 | 1013 | /** |
1014 | 1014 | * The class responsible for defining all actions that occur in the admin area. |
1015 | 1015 | */ |
1016 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin.php'; |
|
1016 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin.php'; |
|
1017 | 1017 | |
1018 | 1018 | /** |
1019 | 1019 | * The class to customize the entity list admin page. |
1020 | 1020 | */ |
1021 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-list.php'; |
|
1021 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-list.php'; |
|
1022 | 1022 | |
1023 | 1023 | /** |
1024 | 1024 | * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
1025 | 1025 | */ |
1026 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
1026 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
1027 | 1027 | |
1028 | 1028 | /** |
1029 | 1029 | * The Notice service. |
1030 | 1030 | */ |
1031 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-notice-service.php'; |
|
1031 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-notice-service.php'; |
|
1032 | 1032 | |
1033 | 1033 | /** |
1034 | 1034 | * The PrimaShop adapter. |
1035 | 1035 | */ |
1036 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
1036 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-primashop-adapter.php'; |
|
1037 | 1037 | |
1038 | 1038 | /** |
1039 | 1039 | * The WordLift Dashboard service. |
1040 | 1040 | */ |
1041 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-dashboard.php'; |
|
1041 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-dashboard.php'; |
|
1042 | 1042 | |
1043 | 1043 | /** |
1044 | 1044 | * The admin 'Install wizard' page. |
1045 | 1045 | */ |
1046 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-setup.php'; |
|
1046 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-setup.php'; |
|
1047 | 1047 | |
1048 | 1048 | /** |
1049 | 1049 | * The WordLift entity type list admin page controller. |
1050 | 1050 | */ |
1051 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
1051 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
1052 | 1052 | |
1053 | 1053 | /** |
1054 | 1054 | * The WordLift entity type settings admin page controller. |
1055 | 1055 | */ |
1056 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-settings.php'; |
|
1056 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-settings.php'; |
|
1057 | 1057 | |
1058 | 1058 | /** |
1059 | 1059 | * The admin 'Download Your Data' page. |
1060 | 1060 | */ |
1061 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-download-your-data-page.php'; |
|
1061 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-download-your-data-page.php'; |
|
1062 | 1062 | |
1063 | 1063 | /** |
1064 | 1064 | * The admin 'WordLift Settings' page. |
1065 | 1065 | */ |
1066 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
1067 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
1068 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
1069 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
1070 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
1071 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
1072 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
1073 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
1074 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
1075 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
1076 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-page.php'; |
|
1077 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
1078 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-analytics-settings-page.php'; |
|
1079 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
1080 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
1081 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-analytics-settings-page-action-link.php'; |
|
1066 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/intf-wordlift-admin-element.php'; |
|
1067 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-element.php'; |
|
1068 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-input-radio-element.php'; |
|
1069 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select-element.php'; |
|
1070 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-select2-element.php'; |
|
1071 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
1072 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
1073 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
1074 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-author-element.php'; |
|
1075 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
1076 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-page.php'; |
|
1077 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page.php'; |
|
1078 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-analytics-settings-page.php'; |
|
1079 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-batch-analysis-page.php'; |
|
1080 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
1081 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-analytics-settings-page-action-link.php'; |
|
1082 | 1082 | |
1083 | 1083 | /** Admin Pages */ |
1084 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
1085 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
1086 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-status-page.php'; |
|
1087 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-admin-search-rankings-page.php'; |
|
1088 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
1084 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-post-edit-page.php'; |
|
1085 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-user-profile-page.php'; |
|
1086 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-status-page.php'; |
|
1087 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-admin-search-rankings-page.php'; |
|
1088 | + require_once plugin_dir_path(dirname(__FILE__)).'admin/class-wordlift-entity-type-admin-service.php'; |
|
1089 | 1089 | |
1090 | 1090 | /** |
1091 | 1091 | * The class responsible for defining all actions that occur in the public-facing |
1092 | 1092 | * side of the site. |
1093 | 1093 | */ |
1094 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-public.php'; |
|
1094 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-public.php'; |
|
1095 | 1095 | |
1096 | 1096 | /** |
1097 | 1097 | * The shortcode abstract class. |
1098 | 1098 | */ |
1099 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-shortcode.php'; |
|
1099 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-shortcode.php'; |
|
1100 | 1100 | |
1101 | 1101 | /** |
1102 | 1102 | * The Timeline shortcode. |
1103 | 1103 | */ |
1104 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
1104 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-timeline-shortcode.php'; |
|
1105 | 1105 | |
1106 | 1106 | /** |
1107 | 1107 | * The Navigator shortcode. |
1108 | 1108 | */ |
1109 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
1109 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-navigator-shortcode.php'; |
|
1110 | 1110 | |
1111 | 1111 | /** |
1112 | 1112 | * The chord shortcode. |
1113 | 1113 | */ |
1114 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-chord-shortcode.php'; |
|
1114 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-chord-shortcode.php'; |
|
1115 | 1115 | |
1116 | 1116 | /** |
1117 | 1117 | * The geomap shortcode. |
1118 | 1118 | */ |
1119 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
1119 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-geomap-shortcode.php'; |
|
1120 | 1120 | |
1121 | 1121 | /** |
1122 | 1122 | * The entity cloud shortcode. |
1123 | 1123 | */ |
1124 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
1124 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
1125 | 1125 | |
1126 | 1126 | /** |
1127 | 1127 | * The entity glossary shortcode. |
1128 | 1128 | */ |
1129 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-alphabet-service.php'; |
|
1130 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
1129 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-alphabet-service.php'; |
|
1130 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-vocabulary-shortcode.php'; |
|
1131 | 1131 | |
1132 | 1132 | /** |
1133 | 1133 | * Faceted Search shortcode. |
1134 | 1134 | */ |
1135 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
1135 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-faceted-search-shortcode.php'; |
|
1136 | 1136 | |
1137 | 1137 | /** |
1138 | 1138 | * The ShareThis service. |
1139 | 1139 | */ |
1140 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-sharethis-service.php'; |
|
1140 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-sharethis-service.php'; |
|
1141 | 1141 | |
1142 | 1142 | /** |
1143 | 1143 | * The SEO service. |
1144 | 1144 | */ |
1145 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-seo-service.php'; |
|
1145 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-seo-service.php'; |
|
1146 | 1146 | |
1147 | 1147 | /** |
1148 | 1148 | * The AMP service. |
1149 | 1149 | */ |
1150 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-amp-service.php'; |
|
1150 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-amp-service.php'; |
|
1151 | 1151 | |
1152 | 1152 | /** Widgets */ |
1153 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-widget.php'; |
|
1154 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
1153 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-widget.php'; |
|
1154 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-related-entities-cloud-widget.php'; |
|
1155 | 1155 | |
1156 | 1156 | /* |
1157 | 1157 | * Schema.org Services. |
1158 | 1158 | * |
1159 | 1159 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
1160 | 1160 | */ |
1161 | - if ( WL_ALL_ENTITY_TYPES ) { |
|
1162 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
1163 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
1164 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
1161 | + if (WL_ALL_ENTITY_TYPES) { |
|
1162 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
1163 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
1164 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
1165 | 1165 | new Wordlift_Schemaorg_Sync_Service(); |
1166 | 1166 | $schemaorg_property_service = new Wordlift_Schemaorg_Property_Service(); |
1167 | 1167 | new Wordlift_Schemaorg_Class_Service(); |
@@ -1173,7 +1173,7 @@ discard block |
||
1173 | 1173 | |
1174 | 1174 | // Instantiate a global logger. |
1175 | 1175 | global $wl_logger; |
1176 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
1176 | + $wl_logger = Wordlift_Log_Service::get_logger('WordLift'); |
|
1177 | 1177 | |
1178 | 1178 | // Load the `wl-api` end-point. |
1179 | 1179 | new Wordlift_Http_Api(); |
@@ -1184,13 +1184,13 @@ discard block |
||
1184 | 1184 | /** Services. */ |
1185 | 1185 | // Create the configuration service. |
1186 | 1186 | $this->configuration_service = new Wordlift_Configuration_Service(); |
1187 | - $api_service = new Wordlift_Api_Service( $this->configuration_service ); |
|
1187 | + $api_service = new Wordlift_Api_Service($this->configuration_service); |
|
1188 | 1188 | |
1189 | 1189 | // Create an entity type service instance. It'll be later bound to the init action. |
1190 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path() ); |
|
1190 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service(Wordlift_Entity_Service::TYPE_NAME, $this->configuration_service->get_entity_base_path()); |
|
1191 | 1191 | |
1192 | 1192 | // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
1193 | - $this->entity_link_service = new Wordlift_Entity_Link_Service( $this->entity_post_type_service, $this->configuration_service->get_entity_base_path() ); |
|
1193 | + $this->entity_link_service = new Wordlift_Entity_Link_Service($this->entity_post_type_service, $this->configuration_service->get_entity_base_path()); |
|
1194 | 1194 | |
1195 | 1195 | // Create an instance of the UI service. |
1196 | 1196 | $this->ui_service = new Wordlift_UI_Service(); |
@@ -1199,34 +1199,34 @@ discard block |
||
1199 | 1199 | $this->thumbnail_service = new Wordlift_Thumbnail_Service(); |
1200 | 1200 | |
1201 | 1201 | $this->sparql_service = new Wordlift_Sparql_Service(); |
1202 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service( $this->sparql_service ); |
|
1202 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service($this->sparql_service); |
|
1203 | 1203 | $this->notice_service = new Wordlift_Notice_Service(); |
1204 | 1204 | $this->relation_service = new Wordlift_Relation_Service(); |
1205 | 1205 | |
1206 | - $entity_uri_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'entity_uri/' ); |
|
1207 | - $this->file_cache_service = new Wordlift_File_Cache_Service( WL_TEMP_DIR . 'converter/' ); |
|
1208 | - $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service( $this->configuration_service, $entity_uri_cache_service ); |
|
1209 | - $this->entity_service = new Wordlift_Entity_Service( $this->ui_service, $this->relation_service, $this->entity_uri_service ); |
|
1210 | - $this->user_service = new Wordlift_User_Service( $this->sparql_service, $this->entity_service ); |
|
1206 | + $entity_uri_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'entity_uri/'); |
|
1207 | + $this->file_cache_service = new Wordlift_File_Cache_Service(WL_TEMP_DIR.'converter/'); |
|
1208 | + $this->entity_uri_service = new Wordlift_Cached_Entity_Uri_Service($this->configuration_service, $entity_uri_cache_service); |
|
1209 | + $this->entity_service = new Wordlift_Entity_Service($this->ui_service, $this->relation_service, $this->entity_uri_service); |
|
1210 | + $this->user_service = new Wordlift_User_Service($this->sparql_service, $this->entity_service); |
|
1211 | 1211 | |
1212 | 1212 | // Instantiate the JSON-LD service. |
1213 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
1213 | + $property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service); |
|
1214 | 1214 | |
1215 | 1215 | /** Linked Data. */ |
1216 | - $this->storage_factory = new Wordlift_Storage_Factory( $this->entity_service, $this->user_service, $property_getter ); |
|
1217 | - $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory( $this->entity_service ); |
|
1216 | + $this->storage_factory = new Wordlift_Storage_Factory($this->entity_service, $this->user_service, $property_getter); |
|
1217 | + $this->rendition_factory = new Wordlift_Sparql_Tuple_Rendition_Factory($this->entity_service); |
|
1218 | 1218 | |
1219 | - $this->schema_service = new Wordlift_Schema_Service( $this->storage_factory, $this->rendition_factory, $this->configuration_service ); |
|
1219 | + $this->schema_service = new Wordlift_Schema_Service($this->storage_factory, $this->rendition_factory, $this->configuration_service); |
|
1220 | 1220 | |
1221 | 1221 | // Create a new instance of the Redirect service. |
1222 | - $this->redirect_service = new Wordlift_Redirect_Service( $this->entity_service ); |
|
1223 | - $this->entity_type_service = new Wordlift_Entity_Type_Service( $this->schema_service ); |
|
1224 | - $this->linked_data_service = new Wordlift_Linked_Data_Service( $this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service ); |
|
1222 | + $this->redirect_service = new Wordlift_Redirect_Service($this->entity_service); |
|
1223 | + $this->entity_type_service = new Wordlift_Entity_Type_Service($this->schema_service); |
|
1224 | + $this->linked_data_service = new Wordlift_Linked_Data_Service($this->entity_service, $this->entity_type_service, $this->schema_service, $this->sparql_service); |
|
1225 | 1225 | |
1226 | 1226 | // Create a new instance of the Timeline service and Timeline shortcode. |
1227 | - $this->timeline_service = new Wordlift_Timeline_Service( $this->entity_service, $this->entity_type_service ); |
|
1227 | + $this->timeline_service = new Wordlift_Timeline_Service($this->entity_service, $this->entity_type_service); |
|
1228 | 1228 | |
1229 | - $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service( $this, $this->configuration_service, $this->file_cache_service ); |
|
1229 | + $this->batch_analysis_service = new Wordlift_Batch_Analysis_Service($this, $this->configuration_service, $this->file_cache_service); |
|
1230 | 1230 | |
1231 | 1231 | $this->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
1232 | 1232 | |
@@ -1240,68 +1240,68 @@ discard block |
||
1240 | 1240 | $this->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
1241 | 1241 | |
1242 | 1242 | // Create an import service instance to hook later to WP's import function. |
1243 | - $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() ); |
|
1243 | + $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()); |
|
1244 | 1244 | |
1245 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
1245 | + $uri_service = new Wordlift_Uri_Service($GLOBALS['wpdb']); |
|
1246 | 1246 | |
1247 | 1247 | // Create the entity rating service. |
1248 | - $this->rating_service = new Wordlift_Rating_Service( $this->entity_service, $this->entity_type_service, $this->notice_service ); |
|
1248 | + $this->rating_service = new Wordlift_Rating_Service($this->entity_service, $this->entity_type_service, $this->notice_service); |
|
1249 | 1249 | |
1250 | 1250 | // Create entity list customization (wp-admin/edit.php). |
1251 | - $this->entity_list_service = new Wordlift_Entity_List_Service( $this->rating_service ); |
|
1251 | + $this->entity_list_service = new Wordlift_Entity_List_Service($this->rating_service); |
|
1252 | 1252 | |
1253 | 1253 | // Create a new instance of the Redirect service. |
1254 | - $this->dashboard_service = new Wordlift_Dashboard_Service( $this->rating_service, $this->entity_service ); |
|
1254 | + $this->dashboard_service = new Wordlift_Dashboard_Service($this->rating_service, $this->entity_service); |
|
1255 | 1255 | |
1256 | 1256 | // Create an instance of the Publisher Service and the AJAX Adapter. |
1257 | - $this->publisher_service = new Wordlift_Publisher_Service( $this->configuration_service ); |
|
1258 | - $this->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
1259 | - $this->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
1257 | + $this->publisher_service = new Wordlift_Publisher_Service($this->configuration_service); |
|
1258 | + $this->property_factory = new Wordlift_Property_Factory($schema_url_property_service); |
|
1259 | + $this->property_factory->register(Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service); |
|
1260 | 1260 | |
1261 | 1261 | $attachment_service = new Wordlift_Attachment_Service(); |
1262 | 1262 | |
1263 | 1263 | // Instantiate the JSON-LD service. |
1264 | - $property_getter = Wordlift_Property_Getter_Factory::create( $this->entity_service ); |
|
1265 | - $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service ); |
|
1266 | - $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 ); |
|
1267 | - $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 ); |
|
1268 | - $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( $this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service ); |
|
1269 | - $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service ); |
|
1270 | - $this->jsonld_service = new Wordlift_Jsonld_Service( $this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter ); |
|
1271 | - |
|
1272 | - |
|
1273 | - $this->key_validation_service = new Wordlift_Key_Validation_Service( $this->configuration_service ); |
|
1274 | - $this->content_filter_service = new Wordlift_Content_Filter_Service( $this->entity_service, $this->configuration_service, $this->entity_uri_service ); |
|
1275 | - $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service( $this->content_filter_service, $this->entity_service ); |
|
1276 | - $this->sample_data_service = new Wordlift_Sample_Data_Service( $this->entity_type_service, $this->configuration_service, $this->user_service ); |
|
1277 | - $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $this->sample_data_service ); |
|
1278 | - $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service( $this->linked_data_service, $this->entity_service, $this->relation_service ); |
|
1264 | + $property_getter = Wordlift_Property_Getter_Factory::create($this->entity_service); |
|
1265 | + $this->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $property_getter, $schemaorg_property_service); |
|
1266 | + $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); |
|
1267 | + $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); |
|
1268 | + $this->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter($this->entity_type_service, $this->entity_service, $this->user_service, $attachment_service, $this->configuration_service); |
|
1269 | + $this->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter($this->postid_to_jsonld_converter, $this->file_cache_service, $this->configuration_service); |
|
1270 | + $this->jsonld_service = new Wordlift_Jsonld_Service($this->entity_service, $this->cached_postid_to_jsonld_converter, $this->jsonld_website_converter); |
|
1271 | + |
|
1272 | + |
|
1273 | + $this->key_validation_service = new Wordlift_Key_Validation_Service($this->configuration_service); |
|
1274 | + $this->content_filter_service = new Wordlift_Content_Filter_Service($this->entity_service, $this->configuration_service, $this->entity_uri_service); |
|
1275 | + $this->relation_rebuild_service = new Wordlift_Relation_Rebuild_Service($this->content_filter_service, $this->entity_service); |
|
1276 | + $this->sample_data_service = new Wordlift_Sample_Data_Service($this->entity_type_service, $this->configuration_service, $this->user_service); |
|
1277 | + $this->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter($this->sample_data_service); |
|
1278 | + $this->reference_rebuild_service = new Wordlift_Reference_Rebuild_Service($this->linked_data_service, $this->entity_service, $this->relation_service); |
|
1279 | 1279 | |
1280 | 1280 | // Initialize the shortcodes. |
1281 | 1281 | new Wordlift_Navigator_Shortcode(); |
1282 | 1282 | new Wordlift_Chord_Shortcode(); |
1283 | 1283 | new Wordlift_Geomap_Shortcode(); |
1284 | 1284 | new Wordlift_Timeline_Shortcode(); |
1285 | - new Wordlift_Related_Entities_Cloud_Shortcode( $this->relation_service ); |
|
1286 | - new Wordlift_Vocabulary_Shortcode( $this->configuration_service ); |
|
1285 | + new Wordlift_Related_Entities_Cloud_Shortcode($this->relation_service); |
|
1286 | + new Wordlift_Vocabulary_Shortcode($this->configuration_service); |
|
1287 | 1287 | new Wordlift_Faceted_Search_Shortcode(); |
1288 | 1288 | |
1289 | 1289 | // Initialize the SEO service. |
1290 | 1290 | new Wordlift_Seo_Service(); |
1291 | 1291 | |
1292 | 1292 | // Initialize the AMP service. |
1293 | - new Wordlift_AMP_Service( $this->jsonld_service ); |
|
1293 | + new Wordlift_AMP_Service($this->jsonld_service); |
|
1294 | 1294 | |
1295 | 1295 | /** Services. */ |
1296 | 1296 | $this->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
1297 | 1297 | new Wordlift_Image_Service(); |
1298 | 1298 | |
1299 | 1299 | /** Adapters. */ |
1300 | - $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter( $this->entity_type_service ); |
|
1301 | - $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $this->publisher_service ); |
|
1302 | - $this->tinymce_adapter = new Wordlift_Tinymce_Adapter( $this ); |
|
1303 | - $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter( $this->batch_analysis_service ); |
|
1304 | - $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter( $this->relation_rebuild_service ); |
|
1300 | + $this->entity_type_adapter = new Wordlift_Entity_Type_Adapter($this->entity_type_service); |
|
1301 | + $this->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter($this->publisher_service); |
|
1302 | + $this->tinymce_adapter = new Wordlift_Tinymce_Adapter($this); |
|
1303 | + $this->batch_analysis_adapter = new Wordlift_Batch_Analysis_Adapter($this->batch_analysis_service); |
|
1304 | + $this->relation_rebuild_adapter = new Wordlift_Relation_Rebuild_Adapter($this->relation_rebuild_service); |
|
1305 | 1305 | |
1306 | 1306 | /* |
1307 | 1307 | * Exclude our public js from WP-Rocket. |
@@ -1325,8 +1325,8 @@ discard block |
||
1325 | 1325 | new Wordlift_Push_References_Async_Task(); |
1326 | 1326 | |
1327 | 1327 | /** WL Autocomplete. */ |
1328 | - $this->autocomplete_service = new Wordlift_Autocomplete_Service( $this->configuration_service ); |
|
1329 | - $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $this->autocomplete_service ); |
|
1328 | + $this->autocomplete_service = new Wordlift_Autocomplete_Service($this->configuration_service); |
|
1329 | + $this->autocomplete_adapter = new Wordlift_Autocomplete_Adapter($this->autocomplete_service); |
|
1330 | 1330 | |
1331 | 1331 | /** WordPress Admin UI. */ |
1332 | 1332 | |
@@ -1337,19 +1337,19 @@ discard block |
||
1337 | 1337 | $this->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
1338 | 1338 | $this->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
1339 | 1339 | $tabs_element = new Wordlift_Admin_Tabs_Element(); |
1340 | - $this->publisher_element = new Wordlift_Admin_Publisher_Element( $this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element ); |
|
1341 | - $this->author_element = new Wordlift_Admin_Author_Element( $this->publisher_service, $this->select2_element ); |
|
1340 | + $this->publisher_element = new Wordlift_Admin_Publisher_Element($this->configuration_service, $this->publisher_service, $tabs_element, $this->select2_element); |
|
1341 | + $this->author_element = new Wordlift_Admin_Author_Element($this->publisher_service, $this->select2_element); |
|
1342 | 1342 | |
1343 | - $this->settings_page = new Wordlift_Admin_Settings_Page( $this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element ); |
|
1344 | - $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page( $this->batch_analysis_service ); |
|
1345 | - $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $this->settings_page ); |
|
1343 | + $this->settings_page = new Wordlift_Admin_Settings_Page($this->configuration_service, $this->entity_service, $this->input_element, $this->language_select_element, $this->country_select_element, $this->publisher_element, $this->radio_input_element); |
|
1344 | + $this->batch_analysis_page = new Wordlift_Batch_Analysis_Page($this->batch_analysis_service); |
|
1345 | + $this->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link($this->settings_page); |
|
1346 | 1346 | |
1347 | - $this->analytics_settings_page = new Wordlift_Admin_Analytics_Settings_Page( $this->configuration_service, $this->input_element, $this->radio_input_element ); |
|
1348 | - $this->analytics_settings_page_action_link = new Wordlift_Admin_Analytics_Settings_Page_Action_Link( $this->analytics_settings_page ); |
|
1347 | + $this->analytics_settings_page = new Wordlift_Admin_Analytics_Settings_Page($this->configuration_service, $this->input_element, $this->radio_input_element); |
|
1348 | + $this->analytics_settings_page_action_link = new Wordlift_Admin_Analytics_Settings_Page_Action_Link($this->analytics_settings_page); |
|
1349 | 1349 | $this->analytics_connect = new Wordlift_Analytics_Connect(); |
1350 | 1350 | |
1351 | 1351 | // Pages. |
1352 | - new Wordlift_Admin_Post_Edit_Page( $this ); |
|
1352 | + new Wordlift_Admin_Post_Edit_Page($this); |
|
1353 | 1353 | new Wordlift_Entity_Type_Admin_Service(); |
1354 | 1354 | |
1355 | 1355 | // create an instance of the entity type list admin page controller. |
@@ -1362,23 +1362,23 @@ discard block |
||
1362 | 1362 | $this->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
1363 | 1363 | |
1364 | 1364 | /* WordPress Admin. */ |
1365 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page( $this->configuration_service ); |
|
1366 | - $this->status_page = new Wordlift_Admin_Status_Page( $this->entity_service, $this->sparql_service ); |
|
1365 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page($this->configuration_service); |
|
1366 | + $this->status_page = new Wordlift_Admin_Status_Page($this->entity_service, $this->sparql_service); |
|
1367 | 1367 | |
1368 | 1368 | // Create an instance of the install wizard. |
1369 | - $this->admin_setup = new Wordlift_Admin_Setup( $this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element ); |
|
1369 | + $this->admin_setup = new Wordlift_Admin_Setup($this->configuration_service, $this->key_validation_service, $this->entity_service, $this->language_select_element, $this->country_select_element); |
|
1370 | 1370 | |
1371 | - $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $this->entity_post_type_service ); |
|
1371 | + $this->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service($this->entity_post_type_service); |
|
1372 | 1372 | |
1373 | 1373 | // User Profile. |
1374 | - new Wordlift_Admin_User_Profile_Page( $this->author_element, $this->user_service ); |
|
1374 | + new Wordlift_Admin_User_Profile_Page($this->author_element, $this->user_service); |
|
1375 | 1375 | |
1376 | 1376 | $this->entity_page_service = new Wordlift_Entity_Page_Service(); |
1377 | 1377 | |
1378 | 1378 | // Load the debug service if WP is in debug mode. |
1379 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
1380 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-debug-service.php'; |
|
1381 | - new Wordlift_Debug_Service( $this->entity_service, $uri_service ); |
|
1379 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
1380 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-debug-service.php'; |
|
1381 | + new Wordlift_Debug_Service($this->entity_service, $uri_service); |
|
1382 | 1382 | } |
1383 | 1383 | |
1384 | 1384 | // Remote Image Service. |
@@ -1391,12 +1391,12 @@ discard block |
||
1391 | 1391 | * |
1392 | 1392 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
1393 | 1393 | */ |
1394 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wordlift-batch-action.php'; |
|
1395 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
1396 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
1394 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/class-wordlift-batch-action.php'; |
|
1395 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-service.php'; |
|
1396 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
1397 | 1397 | |
1398 | 1398 | // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
1399 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
1399 | + new Wordlift_Mapping_Ajax_Adapter(new Wordlift_Mapping_Service(Wordlift_Entity_Type_Service::get_instance())); |
|
1400 | 1400 | |
1401 | 1401 | /* |
1402 | 1402 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
@@ -1405,8 +1405,8 @@ discard block |
||
1405 | 1405 | * |
1406 | 1406 | * @since 3.20.0 |
1407 | 1407 | */ |
1408 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
1409 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
1408 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/intf-wordlift-batch-operation.php'; |
|
1409 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
1410 | 1410 | |
1411 | 1411 | /* |
1412 | 1412 | * Add the Search Keywords taxonomy to manage the Search Keywords on WLS. |
@@ -1415,15 +1415,15 @@ discard block |
||
1415 | 1415 | * |
1416 | 1416 | * @since 3.20.0 |
1417 | 1417 | */ |
1418 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
1419 | - new Wordlift_Search_Keyword_Taxonomy( $api_service ); |
|
1418 | + require_once plugin_dir_path(dirname(__FILE__)).'includes/search-keywords/class-wordlift-search-keyword-taxonomy.php'; |
|
1419 | + new Wordlift_Search_Keyword_Taxonomy($api_service); |
|
1420 | 1420 | |
1421 | 1421 | /* |
1422 | 1422 | * Load dependencies for the front-end. |
1423 | 1423 | * |
1424 | 1424 | * @since 3.20.0 |
1425 | 1425 | */ |
1426 | - if ( ! is_admin() ) { |
|
1426 | + if ( ! is_admin()) { |
|
1427 | 1427 | /* |
1428 | 1428 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
1429 | 1429 | * |
@@ -1431,8 +1431,8 @@ discard block |
||
1431 | 1431 | * |
1432 | 1432 | * @since 3.20.0 |
1433 | 1433 | */ |
1434 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
1435 | - new Wordlift_Term_JsonLd_Adapter( $this->entity_uri_service, $this->jsonld_service ); |
|
1434 | + require_once plugin_dir_path(dirname(__FILE__)).'public/class-wordlift-term-jsonld-adapter.php'; |
|
1435 | + new Wordlift_Term_JsonLd_Adapter($this->entity_uri_service, $this->jsonld_service); |
|
1436 | 1436 | } |
1437 | 1437 | |
1438 | 1438 | } |
@@ -1449,9 +1449,9 @@ discard block |
||
1449 | 1449 | private function set_locale() { |
1450 | 1450 | |
1451 | 1451 | $plugin_i18n = new Wordlift_i18n(); |
1452 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
1452 | + $plugin_i18n->set_domain($this->get_plugin_name()); |
|
1453 | 1453 | |
1454 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
1454 | + $this->loader->add_action('plugins_loaded', $plugin_i18n, 'load_plugin_textdomain'); |
|
1455 | 1455 | |
1456 | 1456 | } |
1457 | 1457 | |
@@ -1472,29 +1472,29 @@ discard block |
||
1472 | 1472 | $this->user_service |
1473 | 1473 | ); |
1474 | 1474 | |
1475 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
1476 | - $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
1475 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_styles'); |
|
1476 | + $this->loader->add_action('admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11); |
|
1477 | 1477 | |
1478 | 1478 | // Hook the init action to taxonomy services. |
1479 | - $this->loader->add_action( 'init', $this->topic_taxonomy_service, 'init', 0 ); |
|
1480 | - $this->loader->add_action( 'init', $this->entity_types_taxonomy_service, 'init', 0 ); |
|
1479 | + $this->loader->add_action('init', $this->topic_taxonomy_service, 'init', 0); |
|
1480 | + $this->loader->add_action('init', $this->entity_types_taxonomy_service, 'init', 0); |
|
1481 | 1481 | |
1482 | 1482 | // Hook the deleted_post_meta action to the Thumbnail service. |
1483 | - $this->loader->add_action( 'deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4 ); |
|
1483 | + $this->loader->add_action('deleted_post_meta', $this->thumbnail_service, 'deleted_post_meta', 10, 4); |
|
1484 | 1484 | |
1485 | 1485 | // Hook the added_post_meta action to the Thumbnail service. |
1486 | - $this->loader->add_action( 'added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
1486 | + $this->loader->add_action('added_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
1487 | 1487 | |
1488 | 1488 | // Hook the updated_post_meta action to the Thumbnail service. |
1489 | - $this->loader->add_action( 'updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4 ); |
|
1489 | + $this->loader->add_action('updated_post_meta', $this->thumbnail_service, 'added_or_updated_post_meta', 10, 4); |
|
1490 | 1490 | |
1491 | 1491 | // Hook the AJAX wl_timeline action to the Timeline service. |
1492 | - $this->loader->add_action( 'wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
1492 | + $this->loader->add_action('wp_ajax_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
1493 | 1493 | |
1494 | 1494 | // Register custom allowed redirect hosts. |
1495 | - $this->loader->add_filter( 'allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts' ); |
|
1495 | + $this->loader->add_filter('allowed_redirect_hosts', $this->redirect_service, 'allowed_redirect_hosts'); |
|
1496 | 1496 | // Hook the AJAX wordlift_redirect action to the Redirect service. |
1497 | - $this->loader->add_action( 'wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect' ); |
|
1497 | + $this->loader->add_action('wp_ajax_wordlift_redirect', $this->redirect_service, 'ajax_redirect'); |
|
1498 | 1498 | |
1499 | 1499 | /* |
1500 | 1500 | * The old dashboard is replaced with dashboard v2. |
@@ -1512,81 +1512,81 @@ discard block |
||
1512 | 1512 | |
1513 | 1513 | // Hook save_post to the entity service to update custom fields (such as alternate labels). |
1514 | 1514 | // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
1515 | - $this->loader->add_action( 'save_post', $this->entity_service, 'save_post', 9, 3 ); |
|
1516 | - $this->loader->add_action( 'save_post', $this->rating_service, 'set_rating_for', 20, 1 ); |
|
1515 | + $this->loader->add_action('save_post', $this->entity_service, 'save_post', 9, 3); |
|
1516 | + $this->loader->add_action('save_post', $this->rating_service, 'set_rating_for', 20, 1); |
|
1517 | 1517 | |
1518 | - $this->loader->add_action( 'edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1 ); |
|
1519 | - $this->loader->add_action( 'in_admin_header', $this->rating_service, 'in_admin_header' ); |
|
1518 | + $this->loader->add_action('edit_form_before_permalink', $this->entity_service, 'edit_form_before_permalink', 10, 1); |
|
1519 | + $this->loader->add_action('in_admin_header', $this->rating_service, 'in_admin_header'); |
|
1520 | 1520 | |
1521 | 1521 | // Entity listing customization (wp-admin/edit.php) |
1522 | 1522 | // Add custom columns. |
1523 | - $this->loader->add_filter( 'manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns' ); |
|
1523 | + $this->loader->add_filter('manage_entity_posts_columns', $this->entity_list_service, 'register_custom_columns'); |
|
1524 | 1524 | // no explicit entity as it prevents handling of other post types. |
1525 | - $this->loader->add_filter( 'manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
1525 | + $this->loader->add_filter('manage_posts_custom_column', $this->entity_list_service, 'render_custom_columns', 10, 2); |
|
1526 | 1526 | // Add 4W selection. |
1527 | - $this->loader->add_action( 'restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
1528 | - $this->loader->add_filter( 'posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope' ); |
|
1529 | - $this->loader->add_action( 'pre_get_posts', $this->entity_list_service, 'pre_get_posts' ); |
|
1530 | - $this->loader->add_action( 'load-edit.php', $this->entity_list_service, 'load_edit' ); |
|
1527 | + $this->loader->add_action('restrict_manage_posts', $this->entity_list_service, 'restrict_manage_posts_classification_scope'); |
|
1528 | + $this->loader->add_filter('posts_clauses', $this->entity_list_service, 'posts_clauses_classification_scope'); |
|
1529 | + $this->loader->add_action('pre_get_posts', $this->entity_list_service, 'pre_get_posts'); |
|
1530 | + $this->loader->add_action('load-edit.php', $this->entity_list_service, 'load_edit'); |
|
1531 | 1531 | |
1532 | 1532 | /* |
1533 | 1533 | * If `All Entity Types` is disable, use the radio button Walker. |
1534 | 1534 | * |
1535 | 1535 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
1536 | 1536 | */ |
1537 | - if ( ! WL_ALL_ENTITY_TYPES ) { |
|
1538 | - $this->loader->add_filter( 'wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
1537 | + if ( ! WL_ALL_ENTITY_TYPES) { |
|
1538 | + $this->loader->add_filter('wp_terms_checklist_args', $this->entity_types_taxonomy_walker, 'terms_checklist_args'); |
|
1539 | 1539 | } |
1540 | 1540 | |
1541 | 1541 | // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
1542 | 1542 | // entities. |
1543 | - $this->loader->add_filter( 'prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2 ); |
|
1543 | + $this->loader->add_filter('prima_metabox_entity_header_args', $this->primashop_adapter, 'prima_metabox_entity_header_args', 10, 2); |
|
1544 | 1544 | |
1545 | 1545 | // Filter imported post meta. |
1546 | - $this->loader->add_filter( 'wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3 ); |
|
1546 | + $this->loader->add_filter('wp_import_post_meta', $this->import_service, 'wp_import_post_meta', 10, 3); |
|
1547 | 1547 | |
1548 | 1548 | // Notify the import service when an import starts and ends. |
1549 | - $this->loader->add_action( 'import_start', $this->import_service, 'import_start', 10, 0 ); |
|
1550 | - $this->loader->add_action( 'import_end', $this->import_service, 'import_end', 10, 0 ); |
|
1549 | + $this->loader->add_action('import_start', $this->import_service, 'import_start', 10, 0); |
|
1550 | + $this->loader->add_action('import_end', $this->import_service, 'import_end', 10, 0); |
|
1551 | 1551 | |
1552 | 1552 | // Hook the AJAX wl_rebuild action to the Rebuild Service. |
1553 | - $this->loader->add_action( 'wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild' ); |
|
1554 | - $this->loader->add_action( 'wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild' ); |
|
1553 | + $this->loader->add_action('wp_ajax_wl_rebuild', $this->rebuild_service, 'rebuild'); |
|
1554 | + $this->loader->add_action('wp_ajax_wl_rebuild_references', $this->reference_rebuild_service, 'rebuild'); |
|
1555 | 1555 | |
1556 | 1556 | // Hook the menu to the Download Your Data page. |
1557 | - $this->loader->add_action( 'admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0 ); |
|
1558 | - $this->loader->add_action( 'admin_menu', $this->status_page, 'admin_menu', 100, 0 ); |
|
1559 | - $this->loader->add_action( 'admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0 ); |
|
1557 | + $this->loader->add_action('admin_menu', $this->download_your_data_page, 'admin_menu', 100, 0); |
|
1558 | + $this->loader->add_action('admin_menu', $this->status_page, 'admin_menu', 100, 0); |
|
1559 | + $this->loader->add_action('admin_menu', $this->entity_type_settings_admin_page, 'admin_menu', 100, 0); |
|
1560 | 1560 | |
1561 | 1561 | // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
1562 | - $this->loader->add_action( 'wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10 ); |
|
1562 | + $this->loader->add_action('wp_ajax_wl_download_your_data', $this->download_your_data_page, 'download_your_data', 10); |
|
1563 | 1563 | |
1564 | 1564 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
1565 | - $this->loader->add_action( 'wp_ajax_wl_jsonld', $this->jsonld_service, 'get' ); |
|
1566 | - $this->loader->add_action( 'admin_post_wl_jsonld', $this->jsonld_service, 'get' ); |
|
1567 | - $this->loader->add_action( 'admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
1565 | + $this->loader->add_action('wp_ajax_wl_jsonld', $this->jsonld_service, 'get'); |
|
1566 | + $this->loader->add_action('admin_post_wl_jsonld', $this->jsonld_service, 'get'); |
|
1567 | + $this->loader->add_action('admin_post_nopriv_wl_jsonld', $this->jsonld_service, 'get'); |
|
1568 | 1568 | |
1569 | 1569 | // Hook the AJAX wl_validate_key action to the Key Validation service. |
1570 | - $this->loader->add_action( 'wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key' ); |
|
1570 | + $this->loader->add_action('wp_ajax_wl_validate_key', $this->key_validation_service, 'validate_key'); |
|
1571 | 1571 | |
1572 | 1572 | // Hook the AJAX wl_update_country_options action to the countries. |
1573 | - $this->loader->add_action( 'wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html' ); |
|
1573 | + $this->loader->add_action('wp_ajax_wl_update_country_options', $this->country_select_element, 'get_options_html'); |
|
1574 | 1574 | |
1575 | 1575 | // Hook the `admin_init` function to the Admin Setup. |
1576 | - $this->loader->add_action( 'admin_init', $this->admin_setup, 'admin_init' ); |
|
1576 | + $this->loader->add_action('admin_init', $this->admin_setup, 'admin_init'); |
|
1577 | 1577 | |
1578 | 1578 | // Hook the admin_init to the settings page. |
1579 | - $this->loader->add_action( 'admin_init', $this->settings_page, 'admin_init' ); |
|
1580 | - $this->loader->add_action( 'admin_init', $this->analytics_settings_page, 'admin_init' ); |
|
1579 | + $this->loader->add_action('admin_init', $this->settings_page, 'admin_init'); |
|
1580 | + $this->loader->add_action('admin_init', $this->analytics_settings_page, 'admin_init'); |
|
1581 | 1581 | |
1582 | - $this->loader->add_filter( 'admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction' ); |
|
1582 | + $this->loader->add_filter('admin_post_thumbnail_html', $this->publisher_service, 'add_featured_image_instruction'); |
|
1583 | 1583 | |
1584 | 1584 | // Hook the menu creation on the general wordlift menu creation. |
1585 | - $this->loader->add_action( 'wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2 ); |
|
1586 | - $this->loader->add_action( 'wl_admin_menu', $this->analytics_settings_page, 'admin_menu', 10, 2 ); |
|
1587 | - if ( defined( 'WORDLIFT_BATCH' ) && WORDLIFT_BATCH ) { |
|
1585 | + $this->loader->add_action('wl_admin_menu', $this->settings_page, 'admin_menu', 10, 2); |
|
1586 | + $this->loader->add_action('wl_admin_menu', $this->analytics_settings_page, 'admin_menu', 10, 2); |
|
1587 | + if (defined('WORDLIFT_BATCH') && WORDLIFT_BATCH) { |
|
1588 | 1588 | // Add the functionality only if a flag is set in wp-config.php . |
1589 | - $this->loader->add_action( 'wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2 ); |
|
1589 | + $this->loader->add_action('wl_admin_menu', $this->batch_analysis_page, 'admin_menu', 10, 2); |
|
1590 | 1590 | } |
1591 | 1591 | |
1592 | 1592 | /* |
@@ -1596,72 +1596,72 @@ discard block |
||
1596 | 1596 | * |
1597 | 1597 | * @since 3.20.0 |
1598 | 1598 | */ |
1599 | - if ( in_array( $this->configuration_service->get_package_type(), array( 'editorial', 'business' ) ) ) { |
|
1599 | + if (in_array($this->configuration_service->get_package_type(), array('editorial', 'business'))) { |
|
1600 | 1600 | $admin_search_rankings_page = new Wordlift_Admin_Search_Rankings_Page(); |
1601 | - $this->loader->add_action( 'wl_admin_menu', $admin_search_rankings_page, 'admin_menu' ); |
|
1601 | + $this->loader->add_action('wl_admin_menu', $admin_search_rankings_page, 'admin_menu'); |
|
1602 | 1602 | } |
1603 | 1603 | |
1604 | 1604 | // Hook key update. |
1605 | - $this->loader->add_action( 'pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2 ); |
|
1606 | - $this->loader->add_action( 'update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2 ); |
|
1605 | + $this->loader->add_action('pre_update_option_wl_general_settings', $this->configuration_service, 'maybe_update_dataset_uri', 10, 2); |
|
1606 | + $this->loader->add_action('update_option_wl_general_settings', $this->configuration_service, 'update_key', 10, 2); |
|
1607 | 1607 | |
1608 | 1608 | // Add additional action links to the WordLift plugin in the plugins page. |
1609 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1 ); |
|
1610 | - $this->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
1609 | + $this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->settings_page_action_link, 'action_links', 10, 1); |
|
1610 | + $this->loader->add_filter('plugin_action_links_wordlift/wordlift.php', $this->analytics_settings_page_action_link, 'action_links', 10, 1); |
|
1611 | 1611 | |
1612 | 1612 | // Hook the AJAX `wl_publisher` action name. |
1613 | - $this->loader->add_action( 'wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher' ); |
|
1613 | + $this->loader->add_action('wp_ajax_wl_publisher', $this->publisher_ajax_adapter, 'publisher'); |
|
1614 | 1614 | |
1615 | 1615 | // Hook row actions for the entity type list admin. |
1616 | - $this->loader->add_filter( 'wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
1616 | + $this->loader->add_filter('wl_entity_type_row_actions', $this->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2); |
|
1617 | 1617 | |
1618 | 1618 | /** Ajax actions. */ |
1619 | - $this->loader->add_action( 'wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export' ); |
|
1619 | + $this->loader->add_action('wp_ajax_wl_google_analytics_export', $this->google_analytics_export_service, 'export'); |
|
1620 | 1620 | |
1621 | 1621 | // Hook capabilities manipulation to allow access to entity type admin |
1622 | 1622 | // page on WordPress versions before 4.7. |
1623 | 1623 | global $wp_version; |
1624 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
1625 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4 ); |
|
1624 | + if (version_compare($wp_version, '4.7', '<')) { |
|
1625 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 4); |
|
1626 | 1626 | } |
1627 | 1627 | |
1628 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
1628 | + $this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
1629 | 1629 | |
1630 | 1630 | /** Adapters. */ |
1631 | - $this->loader->add_filter( 'mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
1632 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit' ); |
|
1633 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts' ); |
|
1634 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel' ); |
|
1635 | - $this->loader->add_action( 'wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning' ); |
|
1636 | - $this->loader->add_action( 'wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all' ); |
|
1631 | + $this->loader->add_filter('mce_external_plugins', $this->tinymce_adapter, 'mce_external_plugins', 10, 1); |
|
1632 | + $this->loader->add_action('wp_ajax_wl_batch_analysis_submit', $this->batch_analysis_adapter, 'submit'); |
|
1633 | + $this->loader->add_action('wp_ajax_wl_batch_analysis_submit_posts', $this->batch_analysis_adapter, 'submit_posts'); |
|
1634 | + $this->loader->add_action('wp_ajax_wl_batch_analysis_cancel', $this->batch_analysis_adapter, 'cancel'); |
|
1635 | + $this->loader->add_action('wp_ajax_wl_batch_analysis_clear_warning', $this->batch_analysis_adapter, 'clear_warning'); |
|
1636 | + $this->loader->add_action('wp_ajax_wl_relation_rebuild_process_all', $this->relation_rebuild_adapter, 'process_all'); |
|
1637 | 1637 | |
1638 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create' ); |
|
1639 | - $this->loader->add_action( 'wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete' ); |
|
1638 | + $this->loader->add_action('wp_ajax_wl_sample_data_create', $this->sample_data_ajax_adapter, 'create'); |
|
1639 | + $this->loader->add_action('wp_ajax_wl_sample_data_delete', $this->sample_data_ajax_adapter, 'delete'); |
|
1640 | 1640 | |
1641 | 1641 | |
1642 | - $this->loader->add_action( 'update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5 ); |
|
1643 | - $this->loader->add_action( 'delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5 ); |
|
1642 | + $this->loader->add_action('update_user_metadata', $this->user_service, 'update_user_metadata', 10, 5); |
|
1643 | + $this->loader->add_action('delete_user_metadata', $this->user_service, 'delete_user_metadata', 10, 5); |
|
1644 | 1644 | |
1645 | 1645 | // Handle the autocomplete request. |
1646 | - add_action( 'wp_ajax_wl_autocomplete', array( |
|
1646 | + add_action('wp_ajax_wl_autocomplete', array( |
|
1647 | 1647 | $this->autocomplete_adapter, |
1648 | 1648 | 'wl_autocomplete', |
1649 | - ) ); |
|
1650 | - add_action( 'wp_ajax_nopriv_wl_autocomplete', array( |
|
1649 | + )); |
|
1650 | + add_action('wp_ajax_nopriv_wl_autocomplete', array( |
|
1651 | 1651 | $this->autocomplete_adapter, |
1652 | 1652 | 'wl_autocomplete', |
1653 | - ) ); |
|
1653 | + )); |
|
1654 | 1654 | |
1655 | 1655 | // Hooks to restrict multisite super admin from manipulating entity types. |
1656 | - if ( is_multisite() ) { |
|
1657 | - $this->loader->add_filter( 'map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4 ); |
|
1656 | + if (is_multisite()) { |
|
1657 | + $this->loader->add_filter('map_meta_cap', $this->entity_type_admin_page, 'restrict_super_admin', 10, 4); |
|
1658 | 1658 | } |
1659 | 1659 | |
1660 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback( $this->configuration_service ); |
|
1660 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback($this->configuration_service); |
|
1661 | 1661 | |
1662 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
1663 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
1664 | - add_action( 'wp_ajax_wl_deactivation_feedback', array( $deactivator_feedback, 'wl_deactivation_feedback' ) ); |
|
1662 | + add_action('admin_footer', array($deactivator_feedback, 'render_feedback_popup')); |
|
1663 | + add_action('admin_enqueue_scripts', array($deactivator_feedback, 'enqueue_popup_scripts')); |
|
1664 | + add_action('wp_ajax_wl_deactivation_feedback', array($deactivator_feedback, 'wl_deactivation_feedback')); |
|
1665 | 1665 | } |
1666 | 1666 | |
1667 | 1667 | /** |
@@ -1673,56 +1673,56 @@ discard block |
||
1673 | 1673 | */ |
1674 | 1674 | private function define_public_hooks() { |
1675 | 1675 | |
1676 | - $plugin_public = new Wordlift_Public( $this->get_plugin_name(), $this->get_version() ); |
|
1676 | + $plugin_public = new Wordlift_Public($this->get_plugin_name(), $this->get_version()); |
|
1677 | 1677 | |
1678 | 1678 | // Register the entity post type. |
1679 | - $this->loader->add_action( 'init', $this->entity_post_type_service, 'register' ); |
|
1680 | - $this->loader->add_action( 'init', $this->install_service, 'install' ); |
|
1679 | + $this->loader->add_action('init', $this->entity_post_type_service, 'register'); |
|
1680 | + $this->loader->add_action('init', $this->install_service, 'install'); |
|
1681 | 1681 | |
1682 | 1682 | // Bind the link generation and handling hooks to the entity link service. |
1683 | - $this->loader->add_filter( 'post_type_link', $this->entity_link_service, 'post_type_link', 10, 4 ); |
|
1684 | - $this->loader->add_action( 'pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
1685 | - $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 ); |
|
1686 | - $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 ); |
|
1683 | + $this->loader->add_filter('post_type_link', $this->entity_link_service, 'post_type_link', 10, 4); |
|
1684 | + $this->loader->add_action('pre_get_posts', $this->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1); |
|
1685 | + $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); |
|
1686 | + $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); |
|
1687 | 1687 | |
1688 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
1689 | - $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
1688 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_styles'); |
|
1689 | + $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts'); |
|
1690 | 1690 | |
1691 | 1691 | // Hook the content filter service to add entity links. |
1692 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
1693 | - $this->loader->add_filter( 'the_content', $this->content_filter_service, 'the_content' ); |
|
1692 | + if ( ! defined('WL_DISABLE_CONTENT_FILTER') || ! WL_DISABLE_CONTENT_FILTER) { |
|
1693 | + $this->loader->add_filter('the_content', $this->content_filter_service, 'the_content'); |
|
1694 | 1694 | } |
1695 | 1695 | |
1696 | 1696 | // Hook the AJAX wl_timeline action to the Timeline service. |
1697 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline' ); |
|
1697 | + $this->loader->add_action('wp_ajax_nopriv_wl_timeline', $this->timeline_service, 'ajax_timeline'); |
|
1698 | 1698 | |
1699 | 1699 | // Hook the ShareThis service. |
1700 | - $this->loader->add_filter( 'the_content', $this->sharethis_service, 'the_content', 99 ); |
|
1701 | - $this->loader->add_filter( 'the_excerpt', $this->sharethis_service, 'the_excerpt', 99 ); |
|
1700 | + $this->loader->add_filter('the_content', $this->sharethis_service, 'the_content', 99); |
|
1701 | + $this->loader->add_filter('the_excerpt', $this->sharethis_service, 'the_excerpt', 99); |
|
1702 | 1702 | |
1703 | 1703 | // Hook the AJAX wl_jsonld action to the JSON-LD service. |
1704 | - $this->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get' ); |
|
1704 | + $this->loader->add_action('wp_ajax_nopriv_wl_jsonld', $this->jsonld_service, 'get'); |
|
1705 | 1705 | |
1706 | 1706 | // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
1707 | 1707 | // in order to tweak WP's `WP_Query` to include entities in queries related |
1708 | 1708 | // to categories. |
1709 | - $this->loader->add_action( 'pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
1709 | + $this->loader->add_action('pre_get_posts', $this->category_taxonomy_service, 'pre_get_posts', 10, 1); |
|
1710 | 1710 | |
1711 | 1711 | /* |
1712 | 1712 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
1713 | 1713 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
1714 | 1714 | * order of start time. |
1715 | 1715 | */ |
1716 | - $this->loader->add_action( 'pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
1716 | + $this->loader->add_action('pre_get_posts', $this->entity_page_service, 'pre_get_posts', 10, 1); |
|
1717 | 1717 | |
1718 | - $this->loader->add_action( 'wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1 ); |
|
1718 | + $this->loader->add_action('wl_async_wl_run_sparql_query', $this->sparql_service, 'run_sparql_query', 10, 1); |
|
1719 | 1719 | |
1720 | 1720 | // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
1721 | - $this->loader->add_action( 'save_post', $this->entity_type_adapter, 'save_post', 9, 3 ); |
|
1721 | + $this->loader->add_action('save_post', $this->entity_type_adapter, 'save_post', 9, 3); |
|
1722 | 1722 | |
1723 | 1723 | // Analytics Script Frontend. |
1724 | - if ( $this->configuration_service->is_analytics_enable() ) { |
|
1725 | - $this->loader->add_action( 'wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10 ); |
|
1724 | + if ($this->configuration_service->is_analytics_enable()) { |
|
1725 | + $this->loader->add_action('wp_enqueue_scripts', $this->analytics_connect, 'enqueue_scripts', 10); |
|
1726 | 1726 | } |
1727 | 1727 | |
1728 | 1728 | } |
@@ -1775,11 +1775,11 @@ discard block |
||
1775 | 1775 | */ |
1776 | 1776 | private function load_cli_dependencies() { |
1777 | 1777 | |
1778 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'cli/class-wordlift-push-reference-data-command.php'; |
|
1778 | + require_once plugin_dir_path(dirname(__FILE__)).'cli/class-wordlift-push-reference-data-command.php'; |
|
1779 | 1779 | |
1780 | - $push_reference_data_command = new Wordlift_Push_Reference_Data_Command( $this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service ); |
|
1780 | + $push_reference_data_command = new Wordlift_Push_Reference_Data_Command($this->relation_service, $this->entity_service, $this->sparql_service, $this->configuration_service, $this->entity_type_service); |
|
1781 | 1781 | |
1782 | - WP_CLI::add_command( 'wl references push', $push_reference_data_command ); |
|
1782 | + WP_CLI::add_command('wl references push', $push_reference_data_command); |
|
1783 | 1783 | |
1784 | 1784 | } |
1785 | 1785 |