@@ -9,18 +9,18 @@ |
||
9 | 9 | */ |
10 | 10 | class Wordlift_Install_3_40_2 extends Wordlift_Install { |
11 | 11 | |
12 | - /** |
|
13 | - * {@inheritdoc} |
|
14 | - */ |
|
15 | - protected static $version = '3.40.2'; |
|
12 | + /** |
|
13 | + * {@inheritdoc} |
|
14 | + */ |
|
15 | + protected static $version = '3.40.2'; |
|
16 | 16 | |
17 | - public function install() { |
|
18 | - if ( ! wp_next_scheduled( 'wl_daily_cron' ) ) { |
|
19 | - wp_schedule_event( time(), 'daily', 'wl_daily_cron' ); |
|
20 | - } |
|
17 | + public function install() { |
|
18 | + if ( ! wp_next_scheduled( 'wl_daily_cron' ) ) { |
|
19 | + wp_schedule_event( time(), 'daily', 'wl_daily_cron' ); |
|
20 | + } |
|
21 | 21 | |
22 | - do_action( 'update_option_wl_exclude_include_urls_settings' ); |
|
22 | + do_action( 'update_option_wl_exclude_include_urls_settings' ); |
|
23 | 23 | |
24 | - Ttl_Cache::flush_all(); |
|
25 | - } |
|
24 | + Ttl_Cache::flush_all(); |
|
25 | + } |
|
26 | 26 | } |
@@ -10,33 +10,33 @@ |
||
10 | 10 | |
11 | 11 | class Term_Jsonld { |
12 | 12 | |
13 | - public function init() { |
|
14 | - add_filter( 'wl_term_jsonld_array', array( $this, 'wl_term_jsonld_array' ), 10, 2 ); |
|
15 | - } |
|
13 | + public function init() { |
|
14 | + add_filter( 'wl_term_jsonld_array', array( $this, 'wl_term_jsonld_array' ), 10, 2 ); |
|
15 | + } |
|
16 | 16 | |
17 | - public function wl_term_jsonld_array( $jsonld_array, $term_id ) { |
|
17 | + public function wl_term_jsonld_array( $jsonld_array, $term_id ) { |
|
18 | 18 | |
19 | - $entities = Jsonld_Utils::get_matched_entities_for_term( $term_id ); |
|
19 | + $entities = Jsonld_Utils::get_matched_entities_for_term( $term_id ); |
|
20 | 20 | |
21 | - if ( count( $entities ) > 0 ) { |
|
22 | - $entity = array_shift( $entities ); |
|
23 | - $entity['@context'] = 'http://schema.org'; |
|
21 | + if ( count( $entities ) > 0 ) { |
|
22 | + $entity = array_shift( $entities ); |
|
23 | + $entity['@context'] = 'http://schema.org'; |
|
24 | 24 | |
25 | - $term_link = get_term_link( $term_id ); |
|
26 | - if ( is_wp_error( $term_link ) ) { |
|
27 | - Wordlift_Log_Service::get_logger( get_class() ) |
|
28 | - ->error( "Term $term_id returned an error: " . $term_link->get_error_message() ); |
|
25 | + $term_link = get_term_link( $term_id ); |
|
26 | + if ( is_wp_error( $term_link ) ) { |
|
27 | + Wordlift_Log_Service::get_logger( get_class() ) |
|
28 | + ->error( "Term $term_id returned an error: " . $term_link->get_error_message() ); |
|
29 | 29 | |
30 | - return $jsonld_array; |
|
31 | - } |
|
30 | + return $jsonld_array; |
|
31 | + } |
|
32 | 32 | |
33 | - $entity['@id'] = $term_link . '/#id'; |
|
34 | - $entity['url'] = $term_link; |
|
35 | - $entity['mainEntityOfPage'] = $term_link; |
|
36 | - $jsonld_array['jsonld'][] = $entity; |
|
37 | - } |
|
33 | + $entity['@id'] = $term_link . '/#id'; |
|
34 | + $entity['url'] = $term_link; |
|
35 | + $entity['mainEntityOfPage'] = $term_link; |
|
36 | + $jsonld_array['jsonld'][] = $entity; |
|
37 | + } |
|
38 | 38 | |
39 | - return $jsonld_array; |
|
40 | - } |
|
39 | + return $jsonld_array; |
|
40 | + } |
|
41 | 41 | |
42 | 42 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | use Wordlift\Api\Default_Api_Service; |
14 | 14 | |
15 | 15 | if ( ! defined( 'ABSPATH' ) ) { |
16 | - exit; |
|
16 | + exit; |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
@@ -23,786 +23,786 @@ discard block |
||
23 | 23 | */ |
24 | 24 | class Wordlift_Configuration_Service { |
25 | 25 | |
26 | - /** |
|
27 | - * The entity base path option name. |
|
28 | - * |
|
29 | - * @since 3.6.0 |
|
30 | - */ |
|
31 | - const ENTITY_BASE_PATH_KEY = 'wl_entity_base_path'; |
|
32 | - |
|
33 | - /** |
|
34 | - * The skip wizard (admin installation wizard) option name. |
|
35 | - * |
|
36 | - * @since 3.9.0 |
|
37 | - */ |
|
38 | - const SKIP_WIZARD = 'wl_skip_wizard'; |
|
39 | - |
|
40 | - /** |
|
41 | - * The skip installation notice. |
|
42 | - * |
|
43 | - * @since 3.40.3 |
|
44 | - */ |
|
45 | - const SKIP_INSTALLATION_NOTICE = 'wl_skip_installation_notice'; |
|
46 | - |
|
47 | - /** |
|
48 | - * WordLift's key option name. |
|
49 | - * |
|
50 | - * @since 3.9.0 |
|
51 | - */ |
|
52 | - const KEY = 'key'; |
|
53 | - |
|
54 | - /** |
|
55 | - * WordLift's configured language option name. |
|
56 | - * |
|
57 | - * @since 3.9.0 |
|
58 | - */ |
|
59 | - const LANGUAGE = 'site_language'; |
|
60 | - |
|
61 | - /** |
|
62 | - * WordLift's configured country code. |
|
63 | - * |
|
64 | - * @since 3.18.0 |
|
65 | - */ |
|
66 | - const COUNTRY_CODE = 'country_code'; |
|
67 | - |
|
68 | - /** |
|
69 | - * The alternateName option name. |
|
70 | - * |
|
71 | - * @since 3.38.6 |
|
72 | - */ |
|
73 | - const ALTERNATE_NAME = 'wl-alternate-name'; |
|
74 | - |
|
75 | - /** |
|
76 | - * The publisher entity post ID option name. |
|
77 | - * |
|
78 | - * @since 3.9.0 |
|
79 | - */ |
|
80 | - const PUBLISHER_ID = 'publisher_id'; |
|
81 | - |
|
82 | - /** |
|
83 | - * The dataset URI option name |
|
84 | - * |
|
85 | - * @since 3.10.0 |
|
86 | - */ |
|
87 | - const DATASET_URI = 'redlink_dataset_uri'; |
|
88 | - |
|
89 | - /** |
|
90 | - * The link by default option name. |
|
91 | - * |
|
92 | - * @since 3.11.0 |
|
93 | - */ |
|
94 | - const LINK_BY_DEFAULT = 'link_by_default'; |
|
95 | - |
|
96 | - /** |
|
97 | - * The analytics enable option. |
|
98 | - * |
|
99 | - * @since 3.21.0 |
|
100 | - */ |
|
101 | - const ANALYTICS_ENABLE = 'analytics_enable'; |
|
102 | - |
|
103 | - /** |
|
104 | - * The analytics entity uri dimension option. |
|
105 | - * |
|
106 | - * @since 3.21.0 |
|
107 | - */ |
|
108 | - const ANALYTICS_ENTITY_URI_DIMENSION = 'analytics_entity_uri_dimension'; |
|
109 | - |
|
110 | - /** |
|
111 | - * The analytics entity type dimension option. |
|
112 | - * |
|
113 | - * @since 3.21.0 |
|
114 | - */ |
|
115 | - const ANALYTICS_ENTITY_TYPE_DIMENSION = 'analytics_entity_type_dimension'; |
|
116 | - |
|
117 | - /** |
|
118 | - * The user preferences about sharing data option. |
|
119 | - * |
|
120 | - * @since 3.19.0 |
|
121 | - */ |
|
122 | - const SEND_DIAGNOSTIC = 'send_diagnostic'; |
|
123 | - |
|
124 | - /** |
|
125 | - * The package type configuration key. |
|
126 | - * |
|
127 | - * @since 3.20.0 |
|
128 | - */ |
|
129 | - const PACKAGE_TYPE = 'package_type'; |
|
130 | - /** |
|
131 | - * The dataset ids connected to the current key |
|
132 | - * |
|
133 | - * @since 3.38.5 |
|
134 | - */ |
|
135 | - const NETWORK_DATASET_IDS = 'network_dataset_ids'; |
|
136 | - |
|
137 | - /** |
|
138 | - * The {@link Wordlift_Log_Service} instance. |
|
139 | - * |
|
140 | - * @since 3.16.0 |
|
141 | - * |
|
142 | - * @var \Wordlift_Log_Service $log The {@link Wordlift_Log_Service} instance. |
|
143 | - */ |
|
144 | - private $log; |
|
145 | - |
|
146 | - /** |
|
147 | - * Create a Wordlift_Configuration_Service's instance. |
|
148 | - * |
|
149 | - * @since 3.6.0 |
|
150 | - */ |
|
151 | - protected function __construct() { |
|
152 | - |
|
153 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
154 | - |
|
155 | - // Sync some configuration properties when key is validated. |
|
156 | - add_action( 'wl_key_validation_response', array( $this, 'sync' ) ); |
|
157 | - |
|
158 | - } |
|
159 | - |
|
160 | - /** |
|
161 | - * @param $response \Wordlift\Api\Response |
|
162 | - * |
|
163 | - * @return void |
|
164 | - */ |
|
165 | - public function sync( $response ) { |
|
166 | - if ( ! $response->is_success() ) { |
|
167 | - return; |
|
168 | - } |
|
169 | - $data = json_decode( $response->get_body(), true ); |
|
170 | - if ( ! is_array( $data ) || ! array_key_exists( 'networkDatasetId', $data ) ) { |
|
171 | - return; |
|
172 | - } |
|
173 | - $this->set_network_dataset_ids( $data['networkDatasetId'] ); |
|
174 | - } |
|
175 | - |
|
176 | - /** |
|
177 | - * The Wordlift_Configuration_Service's singleton instance. |
|
178 | - * |
|
179 | - * @since 3.6.0 |
|
180 | - * |
|
181 | - * @access private |
|
182 | - * @var \Wordlift_Configuration_Service $instance Wordlift_Configuration_Service's singleton instance. |
|
183 | - */ |
|
184 | - private static $instance = null; |
|
185 | - |
|
186 | - /** |
|
187 | - * Get the singleton instance. |
|
188 | - * |
|
189 | - * @return \Wordlift_Configuration_Service |
|
190 | - * @since 3.6.0 |
|
191 | - */ |
|
192 | - public static function get_instance() { |
|
193 | - |
|
194 | - if ( ! isset( self::$instance ) ) { |
|
195 | - self::$instance = new self(); |
|
196 | - } |
|
197 | - |
|
198 | - return self::$instance; |
|
199 | - } |
|
200 | - |
|
201 | - /** |
|
202 | - * Get a configuration given the option name and a key. The option value is |
|
203 | - * expected to be an array. |
|
204 | - * |
|
205 | - * @param string $option The option name. |
|
206 | - * @param string $key A key in the option value array. |
|
207 | - * @param string $default The default value in case the key is not found (by default an empty string). |
|
208 | - * |
|
209 | - * @return mixed The configuration value or the default value if not found. |
|
210 | - * @since 3.6.0 |
|
211 | - */ |
|
212 | - private function get( $option, $key, $default = '' ) { |
|
213 | - |
|
214 | - $options = get_option( $option, array() ); |
|
215 | - |
|
216 | - return isset( $options[ $key ] ) ? $options[ $key ] : $default; |
|
217 | - } |
|
218 | - |
|
219 | - /** |
|
220 | - * Set a configuration parameter. |
|
221 | - * |
|
222 | - * @param string $option Name of option to retrieve. Expected to not be SQL-escaped. |
|
223 | - * @param string $key The value key. |
|
224 | - * @param mixed $value The value. |
|
225 | - * |
|
226 | - * @since 3.9.0 |
|
227 | - */ |
|
228 | - private function set( $option, $key, $value ) { |
|
229 | - |
|
230 | - $values = get_option( $option ); |
|
231 | - $values = isset( $values ) ? $values : array(); |
|
232 | - $values[ $key ] = $value; |
|
233 | - update_option( $option, $values ); |
|
234 | - |
|
235 | - } |
|
236 | - |
|
237 | - /** |
|
238 | - * Get the entity base path, by default 'entity'. |
|
239 | - * |
|
240 | - * @return string The entity base path. |
|
241 | - * @since 3.6.0 |
|
242 | - */ |
|
243 | - public function get_entity_base_path() { |
|
244 | - |
|
245 | - return $this->get( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, 'entity' ); |
|
246 | - } |
|
247 | - |
|
248 | - /** |
|
249 | - * Get the entity base path. |
|
250 | - * |
|
251 | - * @param string $value The entity base path. |
|
252 | - * |
|
253 | - * @since 3.9.0 |
|
254 | - */ |
|
255 | - public function set_entity_base_path( $value ) { |
|
256 | - |
|
257 | - $this->set( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, $value ); |
|
258 | - |
|
259 | - } |
|
260 | - |
|
261 | - /** |
|
262 | - * Whether the installation skip wizard should be skipped. |
|
263 | - * |
|
264 | - * @return bool True if it should be skipped otherwise false. |
|
265 | - * @since 3.9.0 |
|
266 | - */ |
|
267 | - public function is_skip_wizard() { |
|
268 | - |
|
269 | - return $this->get( 'wl_general_settings', self::SKIP_WIZARD, false ); |
|
270 | - } |
|
271 | - |
|
272 | - /** |
|
273 | - * Set the skip wizard parameter. |
|
274 | - * |
|
275 | - * @param bool $value True to skip the wizard. We expect a boolean value. |
|
276 | - * |
|
277 | - * @since 3.9.0 |
|
278 | - */ |
|
279 | - public function set_skip_wizard( $value ) { |
|
280 | - |
|
281 | - $this->set( 'wl_general_settings', self::SKIP_WIZARD, true === $value ); |
|
282 | - |
|
283 | - } |
|
284 | - |
|
285 | - /** |
|
286 | - * Get WordLift's key. |
|
287 | - * |
|
288 | - * @return string WordLift's key or an empty string if not set. |
|
289 | - * @since 3.9.0 |
|
290 | - */ |
|
291 | - public function get_key() { |
|
292 | - |
|
293 | - return $this->get( 'wl_general_settings', self::KEY, '' ); |
|
294 | - } |
|
295 | - |
|
296 | - /** |
|
297 | - * Set WordLift's key. |
|
298 | - * |
|
299 | - * @param string $value WordLift's key. |
|
300 | - * |
|
301 | - * @since 3.9.0 |
|
302 | - */ |
|
303 | - public function set_key( $value ) { |
|
304 | - |
|
305 | - $this->set( 'wl_general_settings', self::KEY, $value ); |
|
306 | - } |
|
307 | - |
|
308 | - /** |
|
309 | - * Get WordLift's configured language, by default 'en'. |
|
310 | - * |
|
311 | - * Note that WordLift's language is used when writing strings to the Linked Data dataset, not for the analysis. |
|
312 | - * |
|
313 | - * @return string WordLift's configured language code ('en' by default). |
|
314 | - * @since 3.9.0 |
|
315 | - */ |
|
316 | - public function get_language_code() { |
|
317 | - |
|
318 | - $language = get_locale(); |
|
319 | - if ( ! $language ) { |
|
320 | - return 'en'; |
|
321 | - } |
|
322 | - |
|
323 | - return substr( $language, 0, 2 ); |
|
324 | - } |
|
325 | - |
|
326 | - /** |
|
327 | - * @param string $value WordLift's language code. |
|
328 | - * |
|
329 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1466 |
|
330 | - * |
|
331 | - * Set WordLift's language code, used when storing strings to the Linked Data dataset. |
|
332 | - * |
|
333 | - * @deprecated As of 3.32.7 this below method has no effect on setting the language, we use the |
|
334 | - * language code form WordPress directly. |
|
335 | - * |
|
336 | - * @since 3.9.0 |
|
337 | - */ |
|
338 | - public function set_language_code( $value ) { |
|
339 | - |
|
340 | - $this->set( 'wl_general_settings', self::LANGUAGE, $value ); |
|
341 | - |
|
342 | - } |
|
343 | - |
|
344 | - /** |
|
345 | - * Set the user preferences about sharing diagnostic with us. |
|
346 | - * |
|
347 | - * @param string $value The user preferences(yes/no). |
|
348 | - * |
|
349 | - * @since 3.19.0 |
|
350 | - */ |
|
351 | - public function set_diagnostic_preferences( $value ) { |
|
352 | - |
|
353 | - $this->set( 'wl_general_settings', self::SEND_DIAGNOSTIC, $value ); |
|
354 | - |
|
355 | - } |
|
356 | - |
|
357 | - /** |
|
358 | - * Get the user preferences about sharing diagnostic. |
|
359 | - * |
|
360 | - * @since 3.19.0 |
|
361 | - */ |
|
362 | - public function get_diagnostic_preferences() { |
|
363 | - |
|
364 | - return $this->get( 'wl_general_settings', self::SEND_DIAGNOSTIC, 'no' ); |
|
365 | - } |
|
366 | - |
|
367 | - /** |
|
368 | - * Get WordLift's configured country code, by default 'us'. |
|
369 | - * |
|
370 | - * @return string WordLift's configured country code ('us' by default). |
|
371 | - * @since 3.18.0 |
|
372 | - */ |
|
373 | - public function get_country_code() { |
|
374 | - |
|
375 | - return $this->get( 'wl_general_settings', self::COUNTRY_CODE, 'us' ); |
|
376 | - } |
|
377 | - |
|
378 | - /** |
|
379 | - * Set WordLift's country code. |
|
380 | - * |
|
381 | - * @param string $value WordLift's country code. |
|
382 | - * |
|
383 | - * @since 3.18.0 |
|
384 | - */ |
|
385 | - public function set_country_code( $value ) { |
|
386 | - |
|
387 | - $this->set( 'wl_general_settings', self::COUNTRY_CODE, $value ); |
|
388 | - |
|
389 | - } |
|
390 | - |
|
391 | - /** |
|
392 | - * Get the alternateName. |
|
393 | - * |
|
394 | - * Website markup alternateName |
|
395 | - * |
|
396 | - * @return string|NULL alternateName or NULL if not set. |
|
397 | - * @since 3.38.6 |
|
398 | - */ |
|
399 | - public function get_alternate_name() { |
|
400 | - return $this->get( 'wl_general_settings', self::ALTERNATE_NAME ); |
|
401 | - } |
|
402 | - |
|
403 | - /** |
|
404 | - * Set the alternateName. |
|
405 | - * |
|
406 | - * @param int $value The alternateName value. |
|
407 | - * |
|
408 | - * @since 3.38.6 |
|
409 | - */ |
|
410 | - public function set_alternate_name( $value ) { |
|
411 | - |
|
412 | - $this->set( 'wl_general_settings', self::ALTERNATE_NAME, wp_strip_all_tags( $value ) ); |
|
413 | - |
|
414 | - } |
|
415 | - |
|
416 | - /** |
|
417 | - * Get the publisher entity post id. |
|
418 | - * |
|
419 | - * The publisher entity post id points to an entity post which contains the data for the publisher used in schema.org |
|
420 | - * Article markup. |
|
421 | - * |
|
422 | - * @return int|NULL The publisher entity post id or NULL if not set. |
|
423 | - * @since 3.9.0 |
|
424 | - */ |
|
425 | - public function get_publisher_id() { |
|
426 | - |
|
427 | - return $this->get( 'wl_general_settings', self::PUBLISHER_ID, null ); |
|
428 | - } |
|
429 | - |
|
430 | - /** |
|
431 | - * Set the publisher entity post id. |
|
432 | - * |
|
433 | - * @param int $value The publisher entity post id. |
|
434 | - * |
|
435 | - * @since 3.9.0 |
|
436 | - */ |
|
437 | - public function set_publisher_id( $value ) { |
|
438 | - |
|
439 | - $this->set( 'wl_general_settings', self::PUBLISHER_ID, $value ); |
|
440 | - |
|
441 | - } |
|
442 | - |
|
443 | - /** |
|
444 | - * Get the dataset URI. |
|
445 | - * |
|
446 | - * @return string The dataset URI or an empty string if not set. |
|
447 | - * @since 3.10.0 |
|
448 | - * @since 3.27.7 Always return null if `wl_features__enable__dataset` is disabled. |
|
449 | - */ |
|
450 | - public function get_dataset_uri() { |
|
451 | - |
|
452 | - if ( apply_filters( 'wl_feature__enable__dataset', true ) ) { |
|
453 | - return $this->get( 'wl_advanced_settings', self::DATASET_URI, null ); |
|
454 | - } else { |
|
455 | - return null; |
|
456 | - } |
|
457 | - } |
|
458 | - |
|
459 | - /** |
|
460 | - * Set the dataset URI. |
|
461 | - * |
|
462 | - * @param string $value The dataset URI. |
|
463 | - * |
|
464 | - * @since 3.10.0 |
|
465 | - */ |
|
466 | - public function set_dataset_uri( $value ) { |
|
467 | - |
|
468 | - $this->set( 'wl_advanced_settings', self::DATASET_URI, $value ); |
|
469 | - } |
|
470 | - |
|
471 | - /** |
|
472 | - * Get the package type. |
|
473 | - * |
|
474 | - * @return string The package type or an empty string if not set. |
|
475 | - * @since 3.20.0 |
|
476 | - */ |
|
477 | - public function get_package_type() { |
|
478 | - |
|
479 | - return $this->get( 'wl_advanced_settings', self::PACKAGE_TYPE, null ); |
|
480 | - } |
|
481 | - |
|
482 | - /** |
|
483 | - * Set the package type. |
|
484 | - * |
|
485 | - * @param string $value The package type. |
|
486 | - * |
|
487 | - * @since 3.20.0 |
|
488 | - */ |
|
489 | - public function set_package_type( $value ) { |
|
490 | - $this->set( 'wl_advanced_settings', self::PACKAGE_TYPE, $value ); |
|
491 | - } |
|
492 | - |
|
493 | - /** |
|
494 | - * Intercept the change of the WordLift key in order to set the dataset URI. |
|
495 | - * |
|
496 | - * @since 3.20.0 as of #761, we save settings every time a key is set, not only when the key changes, so to |
|
497 | - * store the configuration parameters such as country or language. |
|
498 | - * @since 3.11.0 |
|
499 | - * |
|
500 | - * @see https://github.com/insideout10/wordlift-plugin/issues/761 |
|
501 | - * |
|
502 | - * @param array $old_value The old settings. |
|
503 | - * @param array $new_value The new settings. |
|
504 | - */ |
|
505 | - public function update_key( $old_value, $new_value ) { |
|
506 | - |
|
507 | - // Check the old key value and the new one. We're going to ask for the dataset URI only if the key has changed. |
|
508 | - // $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
509 | - $new_key = isset( $new_value['key'] ) ? $new_value['key'] : ''; |
|
510 | - |
|
511 | - // If the key hasn't changed, don't do anything. |
|
512 | - // WARN The 'update_option' hook is fired only if the new and old value are not equal. |
|
513 | - // if ( $old_key === $new_key ) { |
|
514 | - // return; |
|
515 | - // } |
|
516 | - |
|
517 | - // If the key is empty, empty the dataset URI. |
|
518 | - if ( '' === $new_key ) { |
|
519 | - $this->set_dataset_uri( '' ); |
|
520 | - } |
|
521 | - |
|
522 | - // make the request to the remote server. |
|
523 | - $this->get_remote_dataset_uri( $new_key ); |
|
524 | - |
|
525 | - do_action( 'wl_key_updated' ); |
|
526 | - |
|
527 | - } |
|
528 | - |
|
529 | - /** |
|
530 | - * Handle retrieving the dataset uri from the remote server. |
|
531 | - * |
|
532 | - * If a valid dataset uri is returned it is stored in the appropriate option, |
|
533 | - * otherwise the option is set to empty string. |
|
534 | - * |
|
535 | - * @param string $key The key to be used. |
|
536 | - * |
|
537 | - * @since 3.12.0 |
|
538 | - * |
|
539 | - * @since 3.17.0 send the site URL and get the dataset URI. |
|
540 | - */ |
|
541 | - public function get_remote_dataset_uri( $key ) { |
|
542 | - |
|
543 | - $this->log->trace( 'Getting the remote dataset URI and package type...' ); |
|
544 | - |
|
545 | - if ( empty( $key ) ) { |
|
546 | - $this->log->warn( 'Key set to empty value.' ); |
|
547 | - |
|
548 | - $this->set_dataset_uri( '' ); |
|
549 | - $this->set_package_type( null ); |
|
550 | - |
|
551 | - return; |
|
552 | - } |
|
553 | - |
|
554 | - /** |
|
555 | - * Allow 3rd parties to change the site_url. |
|
556 | - * |
|
557 | - * @param string $site_url The site url. |
|
558 | - * |
|
559 | - * @see https://github.com/insideout10/wordlift-plugin/issues/850 |
|
560 | - * |
|
561 | - * @since 3.20.0 |
|
562 | - */ |
|
563 | - $home_url = get_option( 'home' ); |
|
564 | - $site_url = apply_filters( 'wl_production_site_url', untrailingslashit( $home_url ) ); |
|
565 | - |
|
566 | - // Build the URL. |
|
567 | - $url = '/accounts' |
|
568 | - . '?key=' . rawurlencode( $key ) |
|
569 | - . '&url=' . rawurlencode( $site_url ) |
|
570 | - . '&country=' . $this->get_country_code() |
|
571 | - . '&language=' . $this->get_language_code(); |
|
572 | - |
|
573 | - $api_service = Default_Api_Service::get_instance(); |
|
574 | - /** |
|
575 | - * @since 3.27.7.1 |
|
576 | - * The Key should be passed to headers, otherwise api would return null. |
|
577 | - */ |
|
578 | - $headers = array( |
|
579 | - 'Authorization' => "Key $key", |
|
580 | - ); |
|
581 | - $response = $api_service->request( 'PUT', $url, $headers )->get_response(); |
|
582 | - |
|
583 | - // The response is an error. |
|
584 | - if ( is_wp_error( $response ) ) { |
|
585 | - $this->log->error( 'An error occurred setting the dataset URI: ' . $response->get_error_message() ); |
|
586 | - |
|
587 | - $this->set_dataset_uri( '' ); |
|
588 | - $this->set_package_type( null ); |
|
589 | - |
|
590 | - return; |
|
591 | - } |
|
592 | - |
|
593 | - // The response is not OK. |
|
594 | - if ( ! is_array( $response ) || 200 !== (int) $response['response']['code'] ) { |
|
595 | - $base_url = $api_service->get_base_url(); |
|
596 | - |
|
597 | - if ( ! is_array( $response ) ) { |
|
598 | - // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export |
|
599 | - $this->log->error( "Unexpected response when opening URL $base_url$url: " . var_export( $response, true ) ); |
|
600 | - } else { |
|
601 | - // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export |
|
602 | - $this->log->error( "Unexpected status code when opening URL $base_url$url: " . $response['response']['code'] . "\n" . var_export( $response, true ) ); |
|
603 | - } |
|
604 | - |
|
605 | - $this->set_dataset_uri( '' ); |
|
606 | - $this->set_package_type( null ); |
|
607 | - |
|
608 | - return; |
|
609 | - } |
|
610 | - |
|
611 | - /* |
|
26 | + /** |
|
27 | + * The entity base path option name. |
|
28 | + * |
|
29 | + * @since 3.6.0 |
|
30 | + */ |
|
31 | + const ENTITY_BASE_PATH_KEY = 'wl_entity_base_path'; |
|
32 | + |
|
33 | + /** |
|
34 | + * The skip wizard (admin installation wizard) option name. |
|
35 | + * |
|
36 | + * @since 3.9.0 |
|
37 | + */ |
|
38 | + const SKIP_WIZARD = 'wl_skip_wizard'; |
|
39 | + |
|
40 | + /** |
|
41 | + * The skip installation notice. |
|
42 | + * |
|
43 | + * @since 3.40.3 |
|
44 | + */ |
|
45 | + const SKIP_INSTALLATION_NOTICE = 'wl_skip_installation_notice'; |
|
46 | + |
|
47 | + /** |
|
48 | + * WordLift's key option name. |
|
49 | + * |
|
50 | + * @since 3.9.0 |
|
51 | + */ |
|
52 | + const KEY = 'key'; |
|
53 | + |
|
54 | + /** |
|
55 | + * WordLift's configured language option name. |
|
56 | + * |
|
57 | + * @since 3.9.0 |
|
58 | + */ |
|
59 | + const LANGUAGE = 'site_language'; |
|
60 | + |
|
61 | + /** |
|
62 | + * WordLift's configured country code. |
|
63 | + * |
|
64 | + * @since 3.18.0 |
|
65 | + */ |
|
66 | + const COUNTRY_CODE = 'country_code'; |
|
67 | + |
|
68 | + /** |
|
69 | + * The alternateName option name. |
|
70 | + * |
|
71 | + * @since 3.38.6 |
|
72 | + */ |
|
73 | + const ALTERNATE_NAME = 'wl-alternate-name'; |
|
74 | + |
|
75 | + /** |
|
76 | + * The publisher entity post ID option name. |
|
77 | + * |
|
78 | + * @since 3.9.0 |
|
79 | + */ |
|
80 | + const PUBLISHER_ID = 'publisher_id'; |
|
81 | + |
|
82 | + /** |
|
83 | + * The dataset URI option name |
|
84 | + * |
|
85 | + * @since 3.10.0 |
|
86 | + */ |
|
87 | + const DATASET_URI = 'redlink_dataset_uri'; |
|
88 | + |
|
89 | + /** |
|
90 | + * The link by default option name. |
|
91 | + * |
|
92 | + * @since 3.11.0 |
|
93 | + */ |
|
94 | + const LINK_BY_DEFAULT = 'link_by_default'; |
|
95 | + |
|
96 | + /** |
|
97 | + * The analytics enable option. |
|
98 | + * |
|
99 | + * @since 3.21.0 |
|
100 | + */ |
|
101 | + const ANALYTICS_ENABLE = 'analytics_enable'; |
|
102 | + |
|
103 | + /** |
|
104 | + * The analytics entity uri dimension option. |
|
105 | + * |
|
106 | + * @since 3.21.0 |
|
107 | + */ |
|
108 | + const ANALYTICS_ENTITY_URI_DIMENSION = 'analytics_entity_uri_dimension'; |
|
109 | + |
|
110 | + /** |
|
111 | + * The analytics entity type dimension option. |
|
112 | + * |
|
113 | + * @since 3.21.0 |
|
114 | + */ |
|
115 | + const ANALYTICS_ENTITY_TYPE_DIMENSION = 'analytics_entity_type_dimension'; |
|
116 | + |
|
117 | + /** |
|
118 | + * The user preferences about sharing data option. |
|
119 | + * |
|
120 | + * @since 3.19.0 |
|
121 | + */ |
|
122 | + const SEND_DIAGNOSTIC = 'send_diagnostic'; |
|
123 | + |
|
124 | + /** |
|
125 | + * The package type configuration key. |
|
126 | + * |
|
127 | + * @since 3.20.0 |
|
128 | + */ |
|
129 | + const PACKAGE_TYPE = 'package_type'; |
|
130 | + /** |
|
131 | + * The dataset ids connected to the current key |
|
132 | + * |
|
133 | + * @since 3.38.5 |
|
134 | + */ |
|
135 | + const NETWORK_DATASET_IDS = 'network_dataset_ids'; |
|
136 | + |
|
137 | + /** |
|
138 | + * The {@link Wordlift_Log_Service} instance. |
|
139 | + * |
|
140 | + * @since 3.16.0 |
|
141 | + * |
|
142 | + * @var \Wordlift_Log_Service $log The {@link Wordlift_Log_Service} instance. |
|
143 | + */ |
|
144 | + private $log; |
|
145 | + |
|
146 | + /** |
|
147 | + * Create a Wordlift_Configuration_Service's instance. |
|
148 | + * |
|
149 | + * @since 3.6.0 |
|
150 | + */ |
|
151 | + protected function __construct() { |
|
152 | + |
|
153 | + $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
154 | + |
|
155 | + // Sync some configuration properties when key is validated. |
|
156 | + add_action( 'wl_key_validation_response', array( $this, 'sync' ) ); |
|
157 | + |
|
158 | + } |
|
159 | + |
|
160 | + /** |
|
161 | + * @param $response \Wordlift\Api\Response |
|
162 | + * |
|
163 | + * @return void |
|
164 | + */ |
|
165 | + public function sync( $response ) { |
|
166 | + if ( ! $response->is_success() ) { |
|
167 | + return; |
|
168 | + } |
|
169 | + $data = json_decode( $response->get_body(), true ); |
|
170 | + if ( ! is_array( $data ) || ! array_key_exists( 'networkDatasetId', $data ) ) { |
|
171 | + return; |
|
172 | + } |
|
173 | + $this->set_network_dataset_ids( $data['networkDatasetId'] ); |
|
174 | + } |
|
175 | + |
|
176 | + /** |
|
177 | + * The Wordlift_Configuration_Service's singleton instance. |
|
178 | + * |
|
179 | + * @since 3.6.0 |
|
180 | + * |
|
181 | + * @access private |
|
182 | + * @var \Wordlift_Configuration_Service $instance Wordlift_Configuration_Service's singleton instance. |
|
183 | + */ |
|
184 | + private static $instance = null; |
|
185 | + |
|
186 | + /** |
|
187 | + * Get the singleton instance. |
|
188 | + * |
|
189 | + * @return \Wordlift_Configuration_Service |
|
190 | + * @since 3.6.0 |
|
191 | + */ |
|
192 | + public static function get_instance() { |
|
193 | + |
|
194 | + if ( ! isset( self::$instance ) ) { |
|
195 | + self::$instance = new self(); |
|
196 | + } |
|
197 | + |
|
198 | + return self::$instance; |
|
199 | + } |
|
200 | + |
|
201 | + /** |
|
202 | + * Get a configuration given the option name and a key. The option value is |
|
203 | + * expected to be an array. |
|
204 | + * |
|
205 | + * @param string $option The option name. |
|
206 | + * @param string $key A key in the option value array. |
|
207 | + * @param string $default The default value in case the key is not found (by default an empty string). |
|
208 | + * |
|
209 | + * @return mixed The configuration value or the default value if not found. |
|
210 | + * @since 3.6.0 |
|
211 | + */ |
|
212 | + private function get( $option, $key, $default = '' ) { |
|
213 | + |
|
214 | + $options = get_option( $option, array() ); |
|
215 | + |
|
216 | + return isset( $options[ $key ] ) ? $options[ $key ] : $default; |
|
217 | + } |
|
218 | + |
|
219 | + /** |
|
220 | + * Set a configuration parameter. |
|
221 | + * |
|
222 | + * @param string $option Name of option to retrieve. Expected to not be SQL-escaped. |
|
223 | + * @param string $key The value key. |
|
224 | + * @param mixed $value The value. |
|
225 | + * |
|
226 | + * @since 3.9.0 |
|
227 | + */ |
|
228 | + private function set( $option, $key, $value ) { |
|
229 | + |
|
230 | + $values = get_option( $option ); |
|
231 | + $values = isset( $values ) ? $values : array(); |
|
232 | + $values[ $key ] = $value; |
|
233 | + update_option( $option, $values ); |
|
234 | + |
|
235 | + } |
|
236 | + |
|
237 | + /** |
|
238 | + * Get the entity base path, by default 'entity'. |
|
239 | + * |
|
240 | + * @return string The entity base path. |
|
241 | + * @since 3.6.0 |
|
242 | + */ |
|
243 | + public function get_entity_base_path() { |
|
244 | + |
|
245 | + return $this->get( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, 'entity' ); |
|
246 | + } |
|
247 | + |
|
248 | + /** |
|
249 | + * Get the entity base path. |
|
250 | + * |
|
251 | + * @param string $value The entity base path. |
|
252 | + * |
|
253 | + * @since 3.9.0 |
|
254 | + */ |
|
255 | + public function set_entity_base_path( $value ) { |
|
256 | + |
|
257 | + $this->set( 'wl_general_settings', self::ENTITY_BASE_PATH_KEY, $value ); |
|
258 | + |
|
259 | + } |
|
260 | + |
|
261 | + /** |
|
262 | + * Whether the installation skip wizard should be skipped. |
|
263 | + * |
|
264 | + * @return bool True if it should be skipped otherwise false. |
|
265 | + * @since 3.9.0 |
|
266 | + */ |
|
267 | + public function is_skip_wizard() { |
|
268 | + |
|
269 | + return $this->get( 'wl_general_settings', self::SKIP_WIZARD, false ); |
|
270 | + } |
|
271 | + |
|
272 | + /** |
|
273 | + * Set the skip wizard parameter. |
|
274 | + * |
|
275 | + * @param bool $value True to skip the wizard. We expect a boolean value. |
|
276 | + * |
|
277 | + * @since 3.9.0 |
|
278 | + */ |
|
279 | + public function set_skip_wizard( $value ) { |
|
280 | + |
|
281 | + $this->set( 'wl_general_settings', self::SKIP_WIZARD, true === $value ); |
|
282 | + |
|
283 | + } |
|
284 | + |
|
285 | + /** |
|
286 | + * Get WordLift's key. |
|
287 | + * |
|
288 | + * @return string WordLift's key or an empty string if not set. |
|
289 | + * @since 3.9.0 |
|
290 | + */ |
|
291 | + public function get_key() { |
|
292 | + |
|
293 | + return $this->get( 'wl_general_settings', self::KEY, '' ); |
|
294 | + } |
|
295 | + |
|
296 | + /** |
|
297 | + * Set WordLift's key. |
|
298 | + * |
|
299 | + * @param string $value WordLift's key. |
|
300 | + * |
|
301 | + * @since 3.9.0 |
|
302 | + */ |
|
303 | + public function set_key( $value ) { |
|
304 | + |
|
305 | + $this->set( 'wl_general_settings', self::KEY, $value ); |
|
306 | + } |
|
307 | + |
|
308 | + /** |
|
309 | + * Get WordLift's configured language, by default 'en'. |
|
310 | + * |
|
311 | + * Note that WordLift's language is used when writing strings to the Linked Data dataset, not for the analysis. |
|
312 | + * |
|
313 | + * @return string WordLift's configured language code ('en' by default). |
|
314 | + * @since 3.9.0 |
|
315 | + */ |
|
316 | + public function get_language_code() { |
|
317 | + |
|
318 | + $language = get_locale(); |
|
319 | + if ( ! $language ) { |
|
320 | + return 'en'; |
|
321 | + } |
|
322 | + |
|
323 | + return substr( $language, 0, 2 ); |
|
324 | + } |
|
325 | + |
|
326 | + /** |
|
327 | + * @param string $value WordLift's language code. |
|
328 | + * |
|
329 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1466 |
|
330 | + * |
|
331 | + * Set WordLift's language code, used when storing strings to the Linked Data dataset. |
|
332 | + * |
|
333 | + * @deprecated As of 3.32.7 this below method has no effect on setting the language, we use the |
|
334 | + * language code form WordPress directly. |
|
335 | + * |
|
336 | + * @since 3.9.0 |
|
337 | + */ |
|
338 | + public function set_language_code( $value ) { |
|
339 | + |
|
340 | + $this->set( 'wl_general_settings', self::LANGUAGE, $value ); |
|
341 | + |
|
342 | + } |
|
343 | + |
|
344 | + /** |
|
345 | + * Set the user preferences about sharing diagnostic with us. |
|
346 | + * |
|
347 | + * @param string $value The user preferences(yes/no). |
|
348 | + * |
|
349 | + * @since 3.19.0 |
|
350 | + */ |
|
351 | + public function set_diagnostic_preferences( $value ) { |
|
352 | + |
|
353 | + $this->set( 'wl_general_settings', self::SEND_DIAGNOSTIC, $value ); |
|
354 | + |
|
355 | + } |
|
356 | + |
|
357 | + /** |
|
358 | + * Get the user preferences about sharing diagnostic. |
|
359 | + * |
|
360 | + * @since 3.19.0 |
|
361 | + */ |
|
362 | + public function get_diagnostic_preferences() { |
|
363 | + |
|
364 | + return $this->get( 'wl_general_settings', self::SEND_DIAGNOSTIC, 'no' ); |
|
365 | + } |
|
366 | + |
|
367 | + /** |
|
368 | + * Get WordLift's configured country code, by default 'us'. |
|
369 | + * |
|
370 | + * @return string WordLift's configured country code ('us' by default). |
|
371 | + * @since 3.18.0 |
|
372 | + */ |
|
373 | + public function get_country_code() { |
|
374 | + |
|
375 | + return $this->get( 'wl_general_settings', self::COUNTRY_CODE, 'us' ); |
|
376 | + } |
|
377 | + |
|
378 | + /** |
|
379 | + * Set WordLift's country code. |
|
380 | + * |
|
381 | + * @param string $value WordLift's country code. |
|
382 | + * |
|
383 | + * @since 3.18.0 |
|
384 | + */ |
|
385 | + public function set_country_code( $value ) { |
|
386 | + |
|
387 | + $this->set( 'wl_general_settings', self::COUNTRY_CODE, $value ); |
|
388 | + |
|
389 | + } |
|
390 | + |
|
391 | + /** |
|
392 | + * Get the alternateName. |
|
393 | + * |
|
394 | + * Website markup alternateName |
|
395 | + * |
|
396 | + * @return string|NULL alternateName or NULL if not set. |
|
397 | + * @since 3.38.6 |
|
398 | + */ |
|
399 | + public function get_alternate_name() { |
|
400 | + return $this->get( 'wl_general_settings', self::ALTERNATE_NAME ); |
|
401 | + } |
|
402 | + |
|
403 | + /** |
|
404 | + * Set the alternateName. |
|
405 | + * |
|
406 | + * @param int $value The alternateName value. |
|
407 | + * |
|
408 | + * @since 3.38.6 |
|
409 | + */ |
|
410 | + public function set_alternate_name( $value ) { |
|
411 | + |
|
412 | + $this->set( 'wl_general_settings', self::ALTERNATE_NAME, wp_strip_all_tags( $value ) ); |
|
413 | + |
|
414 | + } |
|
415 | + |
|
416 | + /** |
|
417 | + * Get the publisher entity post id. |
|
418 | + * |
|
419 | + * The publisher entity post id points to an entity post which contains the data for the publisher used in schema.org |
|
420 | + * Article markup. |
|
421 | + * |
|
422 | + * @return int|NULL The publisher entity post id or NULL if not set. |
|
423 | + * @since 3.9.0 |
|
424 | + */ |
|
425 | + public function get_publisher_id() { |
|
426 | + |
|
427 | + return $this->get( 'wl_general_settings', self::PUBLISHER_ID, null ); |
|
428 | + } |
|
429 | + |
|
430 | + /** |
|
431 | + * Set the publisher entity post id. |
|
432 | + * |
|
433 | + * @param int $value The publisher entity post id. |
|
434 | + * |
|
435 | + * @since 3.9.0 |
|
436 | + */ |
|
437 | + public function set_publisher_id( $value ) { |
|
438 | + |
|
439 | + $this->set( 'wl_general_settings', self::PUBLISHER_ID, $value ); |
|
440 | + |
|
441 | + } |
|
442 | + |
|
443 | + /** |
|
444 | + * Get the dataset URI. |
|
445 | + * |
|
446 | + * @return string The dataset URI or an empty string if not set. |
|
447 | + * @since 3.10.0 |
|
448 | + * @since 3.27.7 Always return null if `wl_features__enable__dataset` is disabled. |
|
449 | + */ |
|
450 | + public function get_dataset_uri() { |
|
451 | + |
|
452 | + if ( apply_filters( 'wl_feature__enable__dataset', true ) ) { |
|
453 | + return $this->get( 'wl_advanced_settings', self::DATASET_URI, null ); |
|
454 | + } else { |
|
455 | + return null; |
|
456 | + } |
|
457 | + } |
|
458 | + |
|
459 | + /** |
|
460 | + * Set the dataset URI. |
|
461 | + * |
|
462 | + * @param string $value The dataset URI. |
|
463 | + * |
|
464 | + * @since 3.10.0 |
|
465 | + */ |
|
466 | + public function set_dataset_uri( $value ) { |
|
467 | + |
|
468 | + $this->set( 'wl_advanced_settings', self::DATASET_URI, $value ); |
|
469 | + } |
|
470 | + |
|
471 | + /** |
|
472 | + * Get the package type. |
|
473 | + * |
|
474 | + * @return string The package type or an empty string if not set. |
|
475 | + * @since 3.20.0 |
|
476 | + */ |
|
477 | + public function get_package_type() { |
|
478 | + |
|
479 | + return $this->get( 'wl_advanced_settings', self::PACKAGE_TYPE, null ); |
|
480 | + } |
|
481 | + |
|
482 | + /** |
|
483 | + * Set the package type. |
|
484 | + * |
|
485 | + * @param string $value The package type. |
|
486 | + * |
|
487 | + * @since 3.20.0 |
|
488 | + */ |
|
489 | + public function set_package_type( $value ) { |
|
490 | + $this->set( 'wl_advanced_settings', self::PACKAGE_TYPE, $value ); |
|
491 | + } |
|
492 | + |
|
493 | + /** |
|
494 | + * Intercept the change of the WordLift key in order to set the dataset URI. |
|
495 | + * |
|
496 | + * @since 3.20.0 as of #761, we save settings every time a key is set, not only when the key changes, so to |
|
497 | + * store the configuration parameters such as country or language. |
|
498 | + * @since 3.11.0 |
|
499 | + * |
|
500 | + * @see https://github.com/insideout10/wordlift-plugin/issues/761 |
|
501 | + * |
|
502 | + * @param array $old_value The old settings. |
|
503 | + * @param array $new_value The new settings. |
|
504 | + */ |
|
505 | + public function update_key( $old_value, $new_value ) { |
|
506 | + |
|
507 | + // Check the old key value and the new one. We're going to ask for the dataset URI only if the key has changed. |
|
508 | + // $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
509 | + $new_key = isset( $new_value['key'] ) ? $new_value['key'] : ''; |
|
510 | + |
|
511 | + // If the key hasn't changed, don't do anything. |
|
512 | + // WARN The 'update_option' hook is fired only if the new and old value are not equal. |
|
513 | + // if ( $old_key === $new_key ) { |
|
514 | + // return; |
|
515 | + // } |
|
516 | + |
|
517 | + // If the key is empty, empty the dataset URI. |
|
518 | + if ( '' === $new_key ) { |
|
519 | + $this->set_dataset_uri( '' ); |
|
520 | + } |
|
521 | + |
|
522 | + // make the request to the remote server. |
|
523 | + $this->get_remote_dataset_uri( $new_key ); |
|
524 | + |
|
525 | + do_action( 'wl_key_updated' ); |
|
526 | + |
|
527 | + } |
|
528 | + |
|
529 | + /** |
|
530 | + * Handle retrieving the dataset uri from the remote server. |
|
531 | + * |
|
532 | + * If a valid dataset uri is returned it is stored in the appropriate option, |
|
533 | + * otherwise the option is set to empty string. |
|
534 | + * |
|
535 | + * @param string $key The key to be used. |
|
536 | + * |
|
537 | + * @since 3.12.0 |
|
538 | + * |
|
539 | + * @since 3.17.0 send the site URL and get the dataset URI. |
|
540 | + */ |
|
541 | + public function get_remote_dataset_uri( $key ) { |
|
542 | + |
|
543 | + $this->log->trace( 'Getting the remote dataset URI and package type...' ); |
|
544 | + |
|
545 | + if ( empty( $key ) ) { |
|
546 | + $this->log->warn( 'Key set to empty value.' ); |
|
547 | + |
|
548 | + $this->set_dataset_uri( '' ); |
|
549 | + $this->set_package_type( null ); |
|
550 | + |
|
551 | + return; |
|
552 | + } |
|
553 | + |
|
554 | + /** |
|
555 | + * Allow 3rd parties to change the site_url. |
|
556 | + * |
|
557 | + * @param string $site_url The site url. |
|
558 | + * |
|
559 | + * @see https://github.com/insideout10/wordlift-plugin/issues/850 |
|
560 | + * |
|
561 | + * @since 3.20.0 |
|
562 | + */ |
|
563 | + $home_url = get_option( 'home' ); |
|
564 | + $site_url = apply_filters( 'wl_production_site_url', untrailingslashit( $home_url ) ); |
|
565 | + |
|
566 | + // Build the URL. |
|
567 | + $url = '/accounts' |
|
568 | + . '?key=' . rawurlencode( $key ) |
|
569 | + . '&url=' . rawurlencode( $site_url ) |
|
570 | + . '&country=' . $this->get_country_code() |
|
571 | + . '&language=' . $this->get_language_code(); |
|
572 | + |
|
573 | + $api_service = Default_Api_Service::get_instance(); |
|
574 | + /** |
|
575 | + * @since 3.27.7.1 |
|
576 | + * The Key should be passed to headers, otherwise api would return null. |
|
577 | + */ |
|
578 | + $headers = array( |
|
579 | + 'Authorization' => "Key $key", |
|
580 | + ); |
|
581 | + $response = $api_service->request( 'PUT', $url, $headers )->get_response(); |
|
582 | + |
|
583 | + // The response is an error. |
|
584 | + if ( is_wp_error( $response ) ) { |
|
585 | + $this->log->error( 'An error occurred setting the dataset URI: ' . $response->get_error_message() ); |
|
586 | + |
|
587 | + $this->set_dataset_uri( '' ); |
|
588 | + $this->set_package_type( null ); |
|
589 | + |
|
590 | + return; |
|
591 | + } |
|
592 | + |
|
593 | + // The response is not OK. |
|
594 | + if ( ! is_array( $response ) || 200 !== (int) $response['response']['code'] ) { |
|
595 | + $base_url = $api_service->get_base_url(); |
|
596 | + |
|
597 | + if ( ! is_array( $response ) ) { |
|
598 | + // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export |
|
599 | + $this->log->error( "Unexpected response when opening URL $base_url$url: " . var_export( $response, true ) ); |
|
600 | + } else { |
|
601 | + // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export |
|
602 | + $this->log->error( "Unexpected status code when opening URL $base_url$url: " . $response['response']['code'] . "\n" . var_export( $response, true ) ); |
|
603 | + } |
|
604 | + |
|
605 | + $this->set_dataset_uri( '' ); |
|
606 | + $this->set_package_type( null ); |
|
607 | + |
|
608 | + return; |
|
609 | + } |
|
610 | + |
|
611 | + /* |
|
612 | 612 | * We also store the package type. |
613 | 613 | * |
614 | 614 | * @since 3.20.0 |
615 | 615 | */ |
616 | - $json = json_decode( $response['body'] ); |
|
617 | - /** |
|
618 | - * @since 3.27.7 |
|
619 | - * Remove the trailing slash returned from the new platform api. |
|
620 | - */ |
|
621 | - // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
622 | - $dataset_uri = untrailingslashit( $json->datasetURI ); |
|
623 | - // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
624 | - $package_type = isset( $json->packageType ) ? $json->packageType : null; |
|
625 | - |
|
626 | - $this->log->info( "Updating [ dataset uri :: $dataset_uri ][ package type :: $package_type ]..." ); |
|
627 | - |
|
628 | - $this->set_dataset_uri( $dataset_uri ); |
|
629 | - $this->set_package_type( $package_type ); |
|
630 | - } |
|
631 | - |
|
632 | - /** |
|
633 | - * Handle the edge case where a user submits the same key again |
|
634 | - * when he does not have the dataset uri to regain it. |
|
635 | - * |
|
636 | - * This can not be handled in the normal option update hook because |
|
637 | - * it is not being triggered when the save value equals to the one already |
|
638 | - * in the DB. |
|
639 | - * |
|
640 | - * @param mixed $value The new, unserialized option value. |
|
641 | - * @param mixed $old_value The old option value. |
|
642 | - * |
|
643 | - * @return mixed The same value in the $value parameter |
|
644 | - * @since 3.12.0 |
|
645 | - */ |
|
646 | - public function maybe_update_dataset_uri( $value, $old_value ) { |
|
647 | - |
|
648 | - // Check the old key value and the new one. Here we're only handling the |
|
649 | - // case where the key hasn't changed and the dataset URI isn't set. The |
|
650 | - // other case, i.e. a new key is inserted, is handled at `update_key`. |
|
651 | - $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
652 | - $new_key = isset( $value['key'] ) ? $value['key'] : ''; |
|
653 | - |
|
654 | - $dataset_uri = $this->get_dataset_uri(); |
|
655 | - |
|
656 | - if ( ! empty( $new_key ) && $new_key === $old_key && empty( $dataset_uri ) ) { |
|
657 | - |
|
658 | - // make the request to the remote server to try to get the dataset uri. |
|
659 | - $this->get_remote_dataset_uri( $new_key ); |
|
660 | - } |
|
661 | - |
|
662 | - return $value; |
|
663 | - } |
|
664 | - |
|
665 | - /** |
|
666 | - * Get the API URI to retrieve the dataset URI using the WordLift Key. |
|
667 | - * |
|
668 | - * @param string $key The WordLift key to use. |
|
669 | - * |
|
670 | - * @return string The API URI. |
|
671 | - * @since 3.11.0 |
|
672 | - */ |
|
673 | - public function get_accounts_by_key_dataset_uri( $key ) { |
|
674 | - |
|
675 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "accounts/key=$key/dataset_uri"; |
|
676 | - } |
|
677 | - |
|
678 | - /** |
|
679 | - * Get the `accounts` end point. |
|
680 | - * |
|
681 | - * @return string The `accounts` end point. |
|
682 | - * @since 3.16.0 |
|
683 | - */ |
|
684 | - public function get_accounts() { |
|
685 | - |
|
686 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'accounts'; |
|
687 | - } |
|
688 | - |
|
689 | - /** |
|
690 | - * Get the `link by default` option. |
|
691 | - * |
|
692 | - * @return bool True if entities must be linked by default otherwise false. |
|
693 | - * @since 3.13.0 |
|
694 | - */ |
|
695 | - public function is_link_by_default() { |
|
696 | - |
|
697 | - return 'yes' === $this->get( 'wl_general_settings', self::LINK_BY_DEFAULT, 'yes' ); |
|
698 | - } |
|
699 | - |
|
700 | - /** |
|
701 | - * Set the `link by default` option. |
|
702 | - * |
|
703 | - * @param bool $value True to enabling linking by default, otherwise false. |
|
704 | - * |
|
705 | - * @since 3.13.0 |
|
706 | - */ |
|
707 | - public function set_link_by_default( $value ) { |
|
708 | - |
|
709 | - $this->set( 'wl_general_settings', self::LINK_BY_DEFAULT, true === $value ? 'yes' : 'no' ); |
|
710 | - } |
|
711 | - |
|
712 | - /** |
|
713 | - * Get the 'analytics-enable' option. |
|
714 | - * |
|
715 | - * @return string 'no' or 'yes' representing bool. |
|
716 | - * @since 3.21.0 |
|
717 | - */ |
|
718 | - public function is_analytics_enable() { |
|
719 | - return 'yes' === $this->get( 'wl_analytics_settings', self::ANALYTICS_ENABLE, 'no' ); |
|
720 | - } |
|
721 | - |
|
722 | - /** |
|
723 | - * Set the `analytics-enable` option. |
|
724 | - * |
|
725 | - * @param bool $value True to enabling analytics, otherwise false. |
|
726 | - * |
|
727 | - * @since 3.21.0 |
|
728 | - */ |
|
729 | - public function set_is_analytics_enable( $value ) { |
|
730 | - |
|
731 | - $this->set( 'wl_general_settings', self::ANALYTICS_ENABLE, true === $value ? 'yes' : 'no' ); |
|
732 | - } |
|
733 | - |
|
734 | - /** |
|
735 | - * Get the 'analytics-entity-uri-dimention' option. |
|
736 | - * |
|
737 | - * @return int |
|
738 | - * @since 3.21.0 |
|
739 | - */ |
|
740 | - public function get_analytics_entity_uri_dimension() { |
|
741 | - return (int) $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_URI_DIMENSION, 1 ); |
|
742 | - } |
|
743 | - |
|
744 | - /** |
|
745 | - * Get the 'analytics-entity-type-dimension' option. |
|
746 | - * |
|
747 | - * @return int |
|
748 | - * @since 3.21.0 |
|
749 | - */ |
|
750 | - public function get_analytics_entity_type_dimension() { |
|
751 | - return $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_TYPE_DIMENSION, 2 ); |
|
752 | - } |
|
753 | - |
|
754 | - /** |
|
755 | - * Get the URL to perform autocomplete request. |
|
756 | - * |
|
757 | - * @return string The URL to call to perform the autocomplete request. |
|
758 | - * @since 3.15.0 |
|
759 | - */ |
|
760 | - public function get_autocomplete_url() { |
|
761 | - |
|
762 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'autocomplete'; |
|
763 | - |
|
764 | - } |
|
765 | - |
|
766 | - /** |
|
767 | - * Get the URL to perform feedback deactivation request. |
|
768 | - * |
|
769 | - * @return string The URL to call to perform the feedback deactivation request. |
|
770 | - * @since 3.19.0 |
|
771 | - */ |
|
772 | - public function get_deactivation_feedback_url() { |
|
773 | - |
|
774 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'feedbacks'; |
|
775 | - |
|
776 | - } |
|
777 | - |
|
778 | - /** |
|
779 | - * Get the base API URL. |
|
780 | - * |
|
781 | - * @return string The base API URL. |
|
782 | - * @since 3.20.0 |
|
783 | - */ |
|
784 | - public function get_api_url() { |
|
785 | - |
|
786 | - return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE; |
|
787 | - } |
|
788 | - |
|
789 | - public function get_network_dataset_ids() { |
|
790 | - return $this->get( 'wl_advanced_settings', self::NETWORK_DATASET_IDS, array() ); |
|
791 | - } |
|
792 | - |
|
793 | - public function set_network_dataset_ids( $network_dataset_ids ) { |
|
794 | - $this->set( 'wl_advanced_settings', self::NETWORK_DATASET_IDS, $network_dataset_ids ); |
|
795 | - } |
|
796 | - |
|
797 | - public function get_skip_installation_notice() { |
|
798 | - |
|
799 | - return $this->get( 'wl_general_settings', self::SKIP_INSTALLATION_NOTICE, false ); |
|
800 | - } |
|
801 | - |
|
802 | - public function set_skip_installation_notice( $value ) { |
|
803 | - |
|
804 | - $this->set( 'wl_general_settings', self::SKIP_INSTALLATION_NOTICE, $value ); |
|
805 | - |
|
806 | - } |
|
616 | + $json = json_decode( $response['body'] ); |
|
617 | + /** |
|
618 | + * @since 3.27.7 |
|
619 | + * Remove the trailing slash returned from the new platform api. |
|
620 | + */ |
|
621 | + // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
622 | + $dataset_uri = untrailingslashit( $json->datasetURI ); |
|
623 | + // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
624 | + $package_type = isset( $json->packageType ) ? $json->packageType : null; |
|
625 | + |
|
626 | + $this->log->info( "Updating [ dataset uri :: $dataset_uri ][ package type :: $package_type ]..." ); |
|
627 | + |
|
628 | + $this->set_dataset_uri( $dataset_uri ); |
|
629 | + $this->set_package_type( $package_type ); |
|
630 | + } |
|
631 | + |
|
632 | + /** |
|
633 | + * Handle the edge case where a user submits the same key again |
|
634 | + * when he does not have the dataset uri to regain it. |
|
635 | + * |
|
636 | + * This can not be handled in the normal option update hook because |
|
637 | + * it is not being triggered when the save value equals to the one already |
|
638 | + * in the DB. |
|
639 | + * |
|
640 | + * @param mixed $value The new, unserialized option value. |
|
641 | + * @param mixed $old_value The old option value. |
|
642 | + * |
|
643 | + * @return mixed The same value in the $value parameter |
|
644 | + * @since 3.12.0 |
|
645 | + */ |
|
646 | + public function maybe_update_dataset_uri( $value, $old_value ) { |
|
647 | + |
|
648 | + // Check the old key value and the new one. Here we're only handling the |
|
649 | + // case where the key hasn't changed and the dataset URI isn't set. The |
|
650 | + // other case, i.e. a new key is inserted, is handled at `update_key`. |
|
651 | + $old_key = isset( $old_value['key'] ) ? $old_value['key'] : ''; |
|
652 | + $new_key = isset( $value['key'] ) ? $value['key'] : ''; |
|
653 | + |
|
654 | + $dataset_uri = $this->get_dataset_uri(); |
|
655 | + |
|
656 | + if ( ! empty( $new_key ) && $new_key === $old_key && empty( $dataset_uri ) ) { |
|
657 | + |
|
658 | + // make the request to the remote server to try to get the dataset uri. |
|
659 | + $this->get_remote_dataset_uri( $new_key ); |
|
660 | + } |
|
661 | + |
|
662 | + return $value; |
|
663 | + } |
|
664 | + |
|
665 | + /** |
|
666 | + * Get the API URI to retrieve the dataset URI using the WordLift Key. |
|
667 | + * |
|
668 | + * @param string $key The WordLift key to use. |
|
669 | + * |
|
670 | + * @return string The API URI. |
|
671 | + * @since 3.11.0 |
|
672 | + */ |
|
673 | + public function get_accounts_by_key_dataset_uri( $key ) { |
|
674 | + |
|
675 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . "accounts/key=$key/dataset_uri"; |
|
676 | + } |
|
677 | + |
|
678 | + /** |
|
679 | + * Get the `accounts` end point. |
|
680 | + * |
|
681 | + * @return string The `accounts` end point. |
|
682 | + * @since 3.16.0 |
|
683 | + */ |
|
684 | + public function get_accounts() { |
|
685 | + |
|
686 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'accounts'; |
|
687 | + } |
|
688 | + |
|
689 | + /** |
|
690 | + * Get the `link by default` option. |
|
691 | + * |
|
692 | + * @return bool True if entities must be linked by default otherwise false. |
|
693 | + * @since 3.13.0 |
|
694 | + */ |
|
695 | + public function is_link_by_default() { |
|
696 | + |
|
697 | + return 'yes' === $this->get( 'wl_general_settings', self::LINK_BY_DEFAULT, 'yes' ); |
|
698 | + } |
|
699 | + |
|
700 | + /** |
|
701 | + * Set the `link by default` option. |
|
702 | + * |
|
703 | + * @param bool $value True to enabling linking by default, otherwise false. |
|
704 | + * |
|
705 | + * @since 3.13.0 |
|
706 | + */ |
|
707 | + public function set_link_by_default( $value ) { |
|
708 | + |
|
709 | + $this->set( 'wl_general_settings', self::LINK_BY_DEFAULT, true === $value ? 'yes' : 'no' ); |
|
710 | + } |
|
711 | + |
|
712 | + /** |
|
713 | + * Get the 'analytics-enable' option. |
|
714 | + * |
|
715 | + * @return string 'no' or 'yes' representing bool. |
|
716 | + * @since 3.21.0 |
|
717 | + */ |
|
718 | + public function is_analytics_enable() { |
|
719 | + return 'yes' === $this->get( 'wl_analytics_settings', self::ANALYTICS_ENABLE, 'no' ); |
|
720 | + } |
|
721 | + |
|
722 | + /** |
|
723 | + * Set the `analytics-enable` option. |
|
724 | + * |
|
725 | + * @param bool $value True to enabling analytics, otherwise false. |
|
726 | + * |
|
727 | + * @since 3.21.0 |
|
728 | + */ |
|
729 | + public function set_is_analytics_enable( $value ) { |
|
730 | + |
|
731 | + $this->set( 'wl_general_settings', self::ANALYTICS_ENABLE, true === $value ? 'yes' : 'no' ); |
|
732 | + } |
|
733 | + |
|
734 | + /** |
|
735 | + * Get the 'analytics-entity-uri-dimention' option. |
|
736 | + * |
|
737 | + * @return int |
|
738 | + * @since 3.21.0 |
|
739 | + */ |
|
740 | + public function get_analytics_entity_uri_dimension() { |
|
741 | + return (int) $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_URI_DIMENSION, 1 ); |
|
742 | + } |
|
743 | + |
|
744 | + /** |
|
745 | + * Get the 'analytics-entity-type-dimension' option. |
|
746 | + * |
|
747 | + * @return int |
|
748 | + * @since 3.21.0 |
|
749 | + */ |
|
750 | + public function get_analytics_entity_type_dimension() { |
|
751 | + return $this->get( 'wl_analytics_settings', self::ANALYTICS_ENTITY_TYPE_DIMENSION, 2 ); |
|
752 | + } |
|
753 | + |
|
754 | + /** |
|
755 | + * Get the URL to perform autocomplete request. |
|
756 | + * |
|
757 | + * @return string The URL to call to perform the autocomplete request. |
|
758 | + * @since 3.15.0 |
|
759 | + */ |
|
760 | + public function get_autocomplete_url() { |
|
761 | + |
|
762 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'autocomplete'; |
|
763 | + |
|
764 | + } |
|
765 | + |
|
766 | + /** |
|
767 | + * Get the URL to perform feedback deactivation request. |
|
768 | + * |
|
769 | + * @return string The URL to call to perform the feedback deactivation request. |
|
770 | + * @since 3.19.0 |
|
771 | + */ |
|
772 | + public function get_deactivation_feedback_url() { |
|
773 | + |
|
774 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE . 'feedbacks'; |
|
775 | + |
|
776 | + } |
|
777 | + |
|
778 | + /** |
|
779 | + * Get the base API URL. |
|
780 | + * |
|
781 | + * @return string The base API URL. |
|
782 | + * @since 3.20.0 |
|
783 | + */ |
|
784 | + public function get_api_url() { |
|
785 | + |
|
786 | + return WL_CONFIG_WORDLIFT_API_URL_DEFAULT_VALUE; |
|
787 | + } |
|
788 | + |
|
789 | + public function get_network_dataset_ids() { |
|
790 | + return $this->get( 'wl_advanced_settings', self::NETWORK_DATASET_IDS, array() ); |
|
791 | + } |
|
792 | + |
|
793 | + public function set_network_dataset_ids( $network_dataset_ids ) { |
|
794 | + $this->set( 'wl_advanced_settings', self::NETWORK_DATASET_IDS, $network_dataset_ids ); |
|
795 | + } |
|
796 | + |
|
797 | + public function get_skip_installation_notice() { |
|
798 | + |
|
799 | + return $this->get( 'wl_general_settings', self::SKIP_INSTALLATION_NOTICE, false ); |
|
800 | + } |
|
801 | + |
|
802 | + public function set_skip_installation_notice( $value ) { |
|
803 | + |
|
804 | + $this->set( 'wl_general_settings', self::SKIP_INSTALLATION_NOTICE, $value ); |
|
805 | + |
|
806 | + } |
|
807 | 807 | |
808 | 808 | } |
@@ -84,1836 +84,1836 @@ |
||
84 | 84 | */ |
85 | 85 | class Wordlift { |
86 | 86 | |
87 | - /** |
|
88 | - * The loader that's responsible for maintaining and registering all hooks that power |
|
89 | - * the plugin. |
|
90 | - * |
|
91 | - * @since 1.0.0 |
|
92 | - * @access protected |
|
93 | - * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
94 | - */ |
|
95 | - protected $loader; |
|
96 | - |
|
97 | - /** |
|
98 | - * The unique identifier of this plugin. |
|
99 | - * |
|
100 | - * @since 1.0.0 |
|
101 | - * @access protected |
|
102 | - * @var string $plugin_name The string used to uniquely identify this plugin. |
|
103 | - */ |
|
104 | - protected $plugin_name; |
|
105 | - |
|
106 | - /** |
|
107 | - * The current version of the plugin. |
|
108 | - * |
|
109 | - * @since 1.0.0 |
|
110 | - * @access protected |
|
111 | - * @var string $version The current version of the plugin. |
|
112 | - */ |
|
113 | - protected $version; |
|
114 | - |
|
115 | - /** |
|
116 | - * The {@link Wordlift_Tinymce_Adapter} instance. |
|
117 | - * |
|
118 | - * @since 3.12.0 |
|
119 | - * @access protected |
|
120 | - * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
121 | - */ |
|
122 | - protected $tinymce_adapter; |
|
123 | - |
|
124 | - /** |
|
125 | - * The Schema service. |
|
126 | - * |
|
127 | - * @since 3.3.0 |
|
128 | - * @access protected |
|
129 | - * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
130 | - */ |
|
131 | - protected $schema_service; |
|
132 | - |
|
133 | - /** |
|
134 | - * The Topic Taxonomy service. |
|
135 | - * |
|
136 | - * @since 3.5.0 |
|
137 | - * @access private |
|
138 | - * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
139 | - */ |
|
140 | - private $topic_taxonomy_service; |
|
141 | - |
|
142 | - /** |
|
143 | - * The Entity Types Taxonomy service. |
|
144 | - * |
|
145 | - * @since 3.18.0 |
|
146 | - * @access private |
|
147 | - * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
148 | - */ |
|
149 | - private $entity_types_taxonomy_service; |
|
150 | - |
|
151 | - /** |
|
152 | - * The User service. |
|
153 | - * |
|
154 | - * @since 3.1.7 |
|
155 | - * @access protected |
|
156 | - * @var \Wordlift_User_Service $user_service The User service. |
|
157 | - */ |
|
158 | - protected $user_service; |
|
159 | - |
|
160 | - /** |
|
161 | - * The Timeline service. |
|
162 | - * |
|
163 | - * @since 3.1.0 |
|
164 | - * @access private |
|
165 | - * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
166 | - */ |
|
167 | - private $timeline_service; |
|
168 | - |
|
169 | - /** |
|
170 | - * The Redirect service. |
|
171 | - * |
|
172 | - * @since 3.2.0 |
|
173 | - * @access private |
|
174 | - * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
175 | - */ |
|
176 | - private $redirect_service; |
|
177 | - |
|
178 | - /** |
|
179 | - * The Notice service. |
|
180 | - * |
|
181 | - * @since 3.3.0 |
|
182 | - * @access private |
|
183 | - * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
184 | - */ |
|
185 | - private $notice_service; |
|
186 | - |
|
187 | - /** |
|
188 | - * The Entity list customization. |
|
189 | - * |
|
190 | - * @since 3.3.0 |
|
191 | - * @access protected |
|
192 | - * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
193 | - */ |
|
194 | - protected $entity_list_service; |
|
195 | - |
|
196 | - /** |
|
197 | - * The Entity Types Taxonomy Walker. |
|
198 | - * |
|
199 | - * @since 3.1.0 |
|
200 | - * @access private |
|
201 | - * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
202 | - */ |
|
203 | - private $entity_types_taxonomy_walker; |
|
204 | - |
|
205 | - /** |
|
206 | - * The ShareThis service. |
|
207 | - * |
|
208 | - * @since 3.2.0 |
|
209 | - * @access private |
|
210 | - * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
211 | - */ |
|
212 | - private $sharethis_service; |
|
213 | - |
|
214 | - /** |
|
215 | - * The PrimaShop adapter. |
|
216 | - * |
|
217 | - * @since 3.2.3 |
|
218 | - * @access private |
|
219 | - * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
220 | - */ |
|
221 | - private $primashop_adapter; |
|
222 | - |
|
223 | - /** |
|
224 | - * The entity type service. |
|
225 | - * |
|
226 | - * @since 3.6.0 |
|
227 | - * @access private |
|
228 | - * @var \Wordlift_Entity_Post_Type_Service |
|
229 | - */ |
|
230 | - private $entity_post_type_service; |
|
231 | - |
|
232 | - /** |
|
233 | - * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
234 | - * |
|
235 | - * @since 3.6.0 |
|
236 | - * @access private |
|
237 | - * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
238 | - */ |
|
239 | - private $entity_link_service; |
|
240 | - |
|
241 | - /** |
|
242 | - * A {@link Wordlift_Jsonld_Service} instance. |
|
243 | - * |
|
244 | - * @since 3.7.0 |
|
245 | - * @access protected |
|
246 | - * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
247 | - */ |
|
248 | - protected $jsonld_service; |
|
249 | - |
|
250 | - /** |
|
251 | - * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
252 | - * |
|
253 | - * @since 3.14.0 |
|
254 | - * @access protected |
|
255 | - * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
256 | - */ |
|
257 | - protected $jsonld_website_converter; |
|
258 | - |
|
259 | - /** |
|
260 | - * A {@link Wordlift_Property_Factory} instance. |
|
261 | - * |
|
262 | - * @since 3.7.0 |
|
263 | - * @access private |
|
264 | - * @var \Wordlift_Property_Factory $property_factory |
|
265 | - */ |
|
266 | - private $property_factory; |
|
267 | - |
|
268 | - /** |
|
269 | - * The 'Download Your Data' page. |
|
270 | - * |
|
271 | - * @since 3.6.0 |
|
272 | - * @access private |
|
273 | - * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
274 | - */ |
|
275 | - private $download_your_data_page; |
|
276 | - |
|
277 | - /** |
|
278 | - * The 'WordLift Settings' page. |
|
279 | - * |
|
280 | - * @since 3.11.0 |
|
281 | - * @access protected |
|
282 | - * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
283 | - */ |
|
284 | - protected $settings_page; |
|
285 | - |
|
286 | - /** |
|
287 | - * The install wizard page. |
|
288 | - * |
|
289 | - * @since 3.9.0 |
|
290 | - * @access private |
|
291 | - * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
292 | - */ |
|
293 | - public $admin_setup; |
|
294 | - |
|
295 | - /** |
|
296 | - * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
297 | - * linking of entities to their pages. |
|
298 | - * |
|
299 | - * @since 3.8.0 |
|
300 | - * @access private |
|
301 | - * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
302 | - */ |
|
303 | - private $content_filter_service; |
|
304 | - |
|
305 | - /** |
|
306 | - * The Faq Content filter service |
|
307 | - * |
|
308 | - * @since 3.26.0 |
|
309 | - * @access private |
|
310 | - * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
311 | - */ |
|
312 | - private $faq_content_filter_service; |
|
313 | - |
|
314 | - /** |
|
315 | - * A {@link Wordlift_Key_Validation_Service} instance. |
|
316 | - * |
|
317 | - * @since 3.9.0 |
|
318 | - * @access private |
|
319 | - * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
320 | - */ |
|
321 | - private $key_validation_service; |
|
322 | - |
|
323 | - /** |
|
324 | - * A {@link Wordlift_Rating_Service} instance. |
|
325 | - * |
|
326 | - * @since 3.10.0 |
|
327 | - * @access private |
|
328 | - * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
329 | - */ |
|
330 | - private $rating_service; |
|
331 | - |
|
332 | - /** |
|
333 | - * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
334 | - * |
|
335 | - * @since 3.10.0 |
|
336 | - * @access protected |
|
337 | - * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
338 | - */ |
|
339 | - protected $post_to_jsonld_converter; |
|
340 | - |
|
341 | - /** |
|
342 | - * A {@link Wordlift_Install_Service} instance. |
|
343 | - * |
|
344 | - * @since 3.18.0 |
|
345 | - * @access protected |
|
346 | - * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
347 | - */ |
|
348 | - protected $install_service; |
|
349 | - |
|
350 | - /** |
|
351 | - * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
352 | - * |
|
353 | - * @since 3.10.0 |
|
354 | - * @access protected |
|
355 | - * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
356 | - */ |
|
357 | - protected $entity_post_to_jsonld_converter; |
|
358 | - |
|
359 | - /** |
|
360 | - * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
361 | - * |
|
362 | - * @since 3.10.0 |
|
363 | - * @access protected |
|
364 | - * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
365 | - */ |
|
366 | - protected $postid_to_jsonld_converter; |
|
367 | - |
|
368 | - /** |
|
369 | - * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
370 | - * |
|
371 | - * @since 3.11.0 |
|
372 | - * @access protected |
|
373 | - * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
374 | - */ |
|
375 | - protected $category_taxonomy_service; |
|
376 | - |
|
377 | - /** |
|
378 | - * The {@link Wordlift_Entity_Page_Service} instance. |
|
379 | - * |
|
380 | - * @since 3.11.0 |
|
381 | - * @access protected |
|
382 | - * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
383 | - */ |
|
384 | - protected $entity_page_service; |
|
385 | - |
|
386 | - /** |
|
387 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
388 | - * |
|
389 | - * @since 3.11.0 |
|
390 | - * @access protected |
|
391 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
392 | - */ |
|
393 | - protected $settings_page_action_link; |
|
394 | - |
|
395 | - /** |
|
396 | - * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
397 | - * |
|
398 | - * @since 3.11.0 |
|
399 | - * @access protected |
|
400 | - * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
401 | - */ |
|
402 | - protected $analytics_settings_page_action_link; |
|
403 | - |
|
404 | - /** |
|
405 | - * The {@link Wordlift_Analytics_Connect} class. |
|
406 | - * |
|
407 | - * @since 3.11.0 |
|
408 | - * @access protected |
|
409 | - * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
410 | - */ |
|
411 | - protected $analytics_connect; |
|
412 | - |
|
413 | - /** |
|
414 | - * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
415 | - * |
|
416 | - * @since 3.11.0 |
|
417 | - * @access protected |
|
418 | - * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
419 | - */ |
|
420 | - protected $publisher_ajax_adapter; |
|
421 | - |
|
422 | - /** |
|
423 | - * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
424 | - * |
|
425 | - * @since 3.11.0 |
|
426 | - * @access protected |
|
427 | - * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
428 | - */ |
|
429 | - protected $input_element; |
|
430 | - |
|
431 | - /** |
|
432 | - * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
433 | - * |
|
434 | - * @since 3.13.0 |
|
435 | - * @access protected |
|
436 | - * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
437 | - */ |
|
438 | - protected $radio_input_element; |
|
439 | - |
|
440 | - /** |
|
441 | - * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
442 | - * |
|
443 | - * @since 3.11.0 |
|
444 | - * @access protected |
|
445 | - * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
446 | - */ |
|
447 | - protected $language_select_element; |
|
448 | - |
|
449 | - /** |
|
450 | - * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
451 | - * |
|
452 | - * @since 3.18.0 |
|
453 | - * @access protected |
|
454 | - * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
455 | - */ |
|
456 | - protected $country_select_element; |
|
457 | - |
|
458 | - /** |
|
459 | - * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
460 | - * |
|
461 | - * @since 3.11.0 |
|
462 | - * @access protected |
|
463 | - * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
464 | - */ |
|
465 | - protected $publisher_element; |
|
466 | - |
|
467 | - /** |
|
468 | - * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
469 | - * |
|
470 | - * @since 3.11.0 |
|
471 | - * @access protected |
|
472 | - * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
473 | - */ |
|
474 | - protected $select2_element; |
|
475 | - |
|
476 | - /** |
|
477 | - * The controller for the entity type list admin page |
|
478 | - * |
|
479 | - * @since 3.11.0 |
|
480 | - * @access private |
|
481 | - * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
482 | - */ |
|
483 | - private $entity_type_admin_page; |
|
484 | - |
|
485 | - /** |
|
486 | - * The controller for the entity type settings admin page |
|
487 | - * |
|
488 | - * @since 3.11.0 |
|
489 | - * @access private |
|
490 | - * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
491 | - */ |
|
492 | - private $entity_type_settings_admin_page; |
|
493 | - |
|
494 | - /** |
|
495 | - * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
496 | - * |
|
497 | - * @since 3.11.0 |
|
498 | - * @access protected |
|
499 | - * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
500 | - */ |
|
501 | - protected $related_entities_cloud_widget; |
|
502 | - |
|
503 | - /** |
|
504 | - * The {@link Wordlift_Admin_Author_Element} instance. |
|
505 | - * |
|
506 | - * @since 3.14.0 |
|
507 | - * @access protected |
|
508 | - * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
509 | - */ |
|
510 | - protected $author_element; |
|
511 | - |
|
512 | - /** |
|
513 | - * The {@link Wordlift_Sample_Data_Service} instance. |
|
514 | - * |
|
515 | - * @since 3.12.0 |
|
516 | - * @access protected |
|
517 | - * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
518 | - */ |
|
519 | - protected $sample_data_service; |
|
520 | - |
|
521 | - /** |
|
522 | - * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
523 | - * |
|
524 | - * @since 3.12.0 |
|
525 | - * @access protected |
|
526 | - * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
527 | - */ |
|
528 | - protected $sample_data_ajax_adapter; |
|
529 | - |
|
530 | - /** |
|
531 | - * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
532 | - * |
|
533 | - * @since 3.16.0 |
|
534 | - * @access protected |
|
535 | - * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
536 | - */ |
|
537 | - protected $google_analytics_export_service; |
|
538 | - |
|
539 | - /** |
|
540 | - * {@link Wordlift}'s singleton instance. |
|
541 | - * |
|
542 | - * @since 3.15.0 |
|
543 | - * @access protected |
|
544 | - * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
545 | - */ |
|
546 | - protected $entity_type_adapter; |
|
547 | - |
|
548 | - /** |
|
549 | - * The {@link Wordlift_Storage_Factory} instance. |
|
550 | - * |
|
551 | - * @since 3.15.0 |
|
552 | - * @access protected |
|
553 | - * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
554 | - */ |
|
555 | - protected $storage_factory; |
|
556 | - |
|
557 | - /** |
|
558 | - * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
559 | - * |
|
560 | - * @since 3.15.0 |
|
561 | - * @access private |
|
562 | - * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
563 | - */ |
|
564 | - private $autocomplete_adapter; |
|
565 | - |
|
566 | - /** |
|
567 | - * The {@link Wordlift_Cached_Post_Converter} instance. |
|
568 | - * |
|
569 | - * @since 3.16.0 |
|
570 | - * @access protected |
|
571 | - * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
572 | - */ |
|
573 | - protected $cached_postid_to_jsonld_converter; |
|
574 | - |
|
575 | - /** |
|
576 | - * The {@link Wordlift_Entity_Uri_Service} instance. |
|
577 | - * |
|
578 | - * @since 3.16.3 |
|
579 | - * @access protected |
|
580 | - * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
581 | - */ |
|
582 | - protected $entity_uri_service; |
|
583 | - |
|
584 | - /** |
|
585 | - * The {@link Wordlift_Publisher_Service} instance. |
|
586 | - * |
|
587 | - * @since 3.19.0 |
|
588 | - * @access protected |
|
589 | - * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
590 | - */ |
|
591 | - protected $publisher_service; |
|
592 | - |
|
593 | - /** |
|
594 | - * The {@link Wordlift_Context_Cards_Service} instance. |
|
595 | - * |
|
596 | - * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
597 | - */ |
|
598 | - protected $context_cards_service; |
|
599 | - |
|
600 | - /** |
|
601 | - * {@link Wordlift}'s singleton instance. |
|
602 | - * |
|
603 | - * @since 3.11.2 |
|
604 | - * @access private |
|
605 | - * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
606 | - */ |
|
607 | - private static $instance; |
|
608 | - |
|
609 | - /** |
|
610 | - * A singleton instance of features registry. |
|
611 | - * |
|
612 | - * @since 3.30.0 |
|
613 | - * @var Features_Registry |
|
614 | - */ |
|
615 | - private $features_registry; |
|
616 | - |
|
617 | - private $analytics_settings_page; |
|
618 | - |
|
619 | - private $webhook_loader; |
|
620 | - |
|
621 | - /** |
|
622 | - * Define the core functionality of the plugin. |
|
623 | - * |
|
624 | - * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
625 | - * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
626 | - * the public-facing side of the site. |
|
627 | - * |
|
628 | - * @since 1.0.0 |
|
629 | - */ |
|
630 | - public function __construct() { |
|
631 | - |
|
632 | - self::$instance = $this; |
|
633 | - |
|
634 | - $this->plugin_name = 'wordlift'; |
|
635 | - $this->version = WORDLIFT_VERSION; |
|
636 | - $this->load_dependencies(); |
|
637 | - $this->set_locale(); |
|
638 | - |
|
639 | - $that = $this; |
|
640 | - add_action( |
|
641 | - 'plugins_loaded', |
|
642 | - function () use ( $that ) { |
|
643 | - $that->define_admin_hooks( $that ); |
|
644 | - $that->define_public_hooks( $that ); |
|
645 | - }, |
|
646 | - 4 |
|
647 | - ); |
|
648 | - |
|
649 | - // If we're in `WP_CLI` load the related files. |
|
650 | - if ( class_exists( 'WP_CLI' ) ) { |
|
651 | - $this->load_cli_dependencies(); |
|
652 | - } |
|
653 | - |
|
654 | - } |
|
655 | - |
|
656 | - /** |
|
657 | - * Get the singleton instance. |
|
658 | - * |
|
659 | - * @return Wordlift The {@link Wordlift} singleton instance. |
|
660 | - * @since 3.11.2 |
|
661 | - */ |
|
662 | - public static function get_instance() { |
|
663 | - |
|
664 | - return self::$instance; |
|
665 | - } |
|
666 | - |
|
667 | - /** |
|
668 | - * Load the required dependencies for this plugin. |
|
669 | - * |
|
670 | - * Include the following files that make up the plugin: |
|
671 | - * |
|
672 | - * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
673 | - * - Wordlift_i18n. Defines internationalization functionality. |
|
674 | - * - Wordlift_Admin. Defines all hooks for the admin area. |
|
675 | - * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
676 | - * |
|
677 | - * Create an instance of the loader which will be used to register the hooks |
|
678 | - * with WordPress. |
|
679 | - * |
|
680 | - * @throws Exception when an error occurs. |
|
681 | - * @since 1.0.0 |
|
682 | - * @access private |
|
683 | - */ |
|
684 | - private function load_dependencies() { |
|
685 | - |
|
686 | - /** |
|
687 | - * The class responsible for orchestrating the actions and filters of the |
|
688 | - * core plugin. |
|
689 | - */ |
|
690 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-loader.php'; |
|
691 | - |
|
692 | - // The class responsible for plugin uninstall. |
|
693 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
694 | - |
|
695 | - /** |
|
696 | - * The class responsible for defining internationalization functionality |
|
697 | - * of the plugin. |
|
698 | - */ |
|
699 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-i18n.php'; |
|
700 | - |
|
701 | - /** |
|
702 | - * WordLift's supported languages. |
|
703 | - */ |
|
704 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-languages.php'; |
|
705 | - |
|
706 | - /** |
|
707 | - * WordLift's supported countries. |
|
708 | - */ |
|
709 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-countries.php'; |
|
710 | - |
|
711 | - /** |
|
712 | - * Provide support functions to sanitize data. |
|
713 | - */ |
|
714 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sanitizer.php'; |
|
715 | - |
|
716 | - /** Services. */ |
|
717 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-log-service.php'; |
|
718 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-http-api.php'; |
|
719 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-redirect-service.php'; |
|
720 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-configuration-service.php'; |
|
721 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
722 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-service.php'; |
|
723 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-link-service.php'; |
|
724 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-relation-service.php'; |
|
725 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-image-service.php'; |
|
726 | - |
|
727 | - /** |
|
728 | - * The Schema service. |
|
729 | - */ |
|
730 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-schema-service.php'; |
|
731 | - |
|
732 | - /** |
|
733 | - * The schema:url property service. |
|
734 | - */ |
|
735 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-property-service.php'; |
|
736 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
737 | - |
|
738 | - /** |
|
739 | - * The UI service. |
|
740 | - */ |
|
741 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-ui-service.php'; |
|
742 | - |
|
743 | - /** |
|
744 | - * The Entity Types Taxonomy service. |
|
745 | - */ |
|
746 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
747 | - |
|
748 | - /** |
|
749 | - * The Entity service. |
|
750 | - */ |
|
751 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
752 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-service.php'; |
|
753 | - |
|
754 | - // Add the entity rating service. |
|
755 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-rating-service.php'; |
|
756 | - |
|
757 | - /** |
|
758 | - * The User service. |
|
759 | - */ |
|
760 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-user-service.php'; |
|
761 | - |
|
762 | - /** |
|
763 | - * The Timeline service. |
|
764 | - */ |
|
765 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-timeline-service.php'; |
|
766 | - |
|
767 | - /** |
|
768 | - * The Topic Taxonomy service. |
|
769 | - */ |
|
770 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
771 | - |
|
772 | - /** |
|
773 | - * The WordLift URI service. |
|
774 | - */ |
|
775 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-uri-service.php'; |
|
776 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-property-factory.php'; |
|
777 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sample-data-service.php'; |
|
778 | - |
|
779 | - require_once plugin_dir_path( __DIR__ ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
780 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-attachment-service.php'; |
|
781 | - |
|
782 | - /** |
|
783 | - * Load the converters. |
|
784 | - */ |
|
785 | - require_once plugin_dir_path( __DIR__ ) . 'includes/intf-wordlift-post-converter.php'; |
|
786 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
787 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
788 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
789 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
790 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-website-jsonld-converter.php'; |
|
791 | - |
|
792 | - /** |
|
793 | - * Load cache-related files. |
|
794 | - */ |
|
795 | - require_once plugin_dir_path( __DIR__ ) . 'includes/cache/require.php'; |
|
796 | - |
|
797 | - /** |
|
798 | - * Load the content filter. |
|
799 | - */ |
|
800 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-content-filter-service.php'; |
|
801 | - |
|
802 | - /* |
|
87 | + /** |
|
88 | + * The loader that's responsible for maintaining and registering all hooks that power |
|
89 | + * the plugin. |
|
90 | + * |
|
91 | + * @since 1.0.0 |
|
92 | + * @access protected |
|
93 | + * @var Wordlift_Loader $loader Maintains and registers all hooks for the plugin. |
|
94 | + */ |
|
95 | + protected $loader; |
|
96 | + |
|
97 | + /** |
|
98 | + * The unique identifier of this plugin. |
|
99 | + * |
|
100 | + * @since 1.0.0 |
|
101 | + * @access protected |
|
102 | + * @var string $plugin_name The string used to uniquely identify this plugin. |
|
103 | + */ |
|
104 | + protected $plugin_name; |
|
105 | + |
|
106 | + /** |
|
107 | + * The current version of the plugin. |
|
108 | + * |
|
109 | + * @since 1.0.0 |
|
110 | + * @access protected |
|
111 | + * @var string $version The current version of the plugin. |
|
112 | + */ |
|
113 | + protected $version; |
|
114 | + |
|
115 | + /** |
|
116 | + * The {@link Wordlift_Tinymce_Adapter} instance. |
|
117 | + * |
|
118 | + * @since 3.12.0 |
|
119 | + * @access protected |
|
120 | + * @var \Wordlift_Tinymce_Adapter $tinymce_adapter The {@link Wordlift_Tinymce_Adapter} instance. |
|
121 | + */ |
|
122 | + protected $tinymce_adapter; |
|
123 | + |
|
124 | + /** |
|
125 | + * The Schema service. |
|
126 | + * |
|
127 | + * @since 3.3.0 |
|
128 | + * @access protected |
|
129 | + * @var \Wordlift_Schema_Service $schema_service The Schema service. |
|
130 | + */ |
|
131 | + protected $schema_service; |
|
132 | + |
|
133 | + /** |
|
134 | + * The Topic Taxonomy service. |
|
135 | + * |
|
136 | + * @since 3.5.0 |
|
137 | + * @access private |
|
138 | + * @var \Wordlift_Topic_Taxonomy_Service The Topic Taxonomy service. |
|
139 | + */ |
|
140 | + private $topic_taxonomy_service; |
|
141 | + |
|
142 | + /** |
|
143 | + * The Entity Types Taxonomy service. |
|
144 | + * |
|
145 | + * @since 3.18.0 |
|
146 | + * @access private |
|
147 | + * @var \Wordlift_Entity_Type_Taxonomy_Service The Entity Types Taxonomy service. |
|
148 | + */ |
|
149 | + private $entity_types_taxonomy_service; |
|
150 | + |
|
151 | + /** |
|
152 | + * The User service. |
|
153 | + * |
|
154 | + * @since 3.1.7 |
|
155 | + * @access protected |
|
156 | + * @var \Wordlift_User_Service $user_service The User service. |
|
157 | + */ |
|
158 | + protected $user_service; |
|
159 | + |
|
160 | + /** |
|
161 | + * The Timeline service. |
|
162 | + * |
|
163 | + * @since 3.1.0 |
|
164 | + * @access private |
|
165 | + * @var \Wordlift_Timeline_Service $timeline_service The Timeline service. |
|
166 | + */ |
|
167 | + private $timeline_service; |
|
168 | + |
|
169 | + /** |
|
170 | + * The Redirect service. |
|
171 | + * |
|
172 | + * @since 3.2.0 |
|
173 | + * @access private |
|
174 | + * @var \Wordlift_Redirect_Service $redirect_service The Redirect service. |
|
175 | + */ |
|
176 | + private $redirect_service; |
|
177 | + |
|
178 | + /** |
|
179 | + * The Notice service. |
|
180 | + * |
|
181 | + * @since 3.3.0 |
|
182 | + * @access private |
|
183 | + * @var \Wordlift_Notice_Service $notice_service The Notice service. |
|
184 | + */ |
|
185 | + private $notice_service; |
|
186 | + |
|
187 | + /** |
|
188 | + * The Entity list customization. |
|
189 | + * |
|
190 | + * @since 3.3.0 |
|
191 | + * @access protected |
|
192 | + * @var \Wordlift_Entity_List_Service $entity_list_service The Entity list service. |
|
193 | + */ |
|
194 | + protected $entity_list_service; |
|
195 | + |
|
196 | + /** |
|
197 | + * The Entity Types Taxonomy Walker. |
|
198 | + * |
|
199 | + * @since 3.1.0 |
|
200 | + * @access private |
|
201 | + * @var \Wordlift_Entity_Types_Taxonomy_Walker $entity_types_taxonomy_walker The Entity Types Taxonomy Walker |
|
202 | + */ |
|
203 | + private $entity_types_taxonomy_walker; |
|
204 | + |
|
205 | + /** |
|
206 | + * The ShareThis service. |
|
207 | + * |
|
208 | + * @since 3.2.0 |
|
209 | + * @access private |
|
210 | + * @var \Wordlift_ShareThis_Service $sharethis_service The ShareThis service. |
|
211 | + */ |
|
212 | + private $sharethis_service; |
|
213 | + |
|
214 | + /** |
|
215 | + * The PrimaShop adapter. |
|
216 | + * |
|
217 | + * @since 3.2.3 |
|
218 | + * @access private |
|
219 | + * @var \Wordlift_PrimaShop_Adapter $primashop_adapter The PrimaShop adapter. |
|
220 | + */ |
|
221 | + private $primashop_adapter; |
|
222 | + |
|
223 | + /** |
|
224 | + * The entity type service. |
|
225 | + * |
|
226 | + * @since 3.6.0 |
|
227 | + * @access private |
|
228 | + * @var \Wordlift_Entity_Post_Type_Service |
|
229 | + */ |
|
230 | + private $entity_post_type_service; |
|
231 | + |
|
232 | + /** |
|
233 | + * The entity link service used to mangle links to entities with a custom slug or even w/o a slug. |
|
234 | + * |
|
235 | + * @since 3.6.0 |
|
236 | + * @access private |
|
237 | + * @var \Wordlift_Entity_Link_Service $entity_link_service The {@link Wordlift_Entity_Link_Service} instance. |
|
238 | + */ |
|
239 | + private $entity_link_service; |
|
240 | + |
|
241 | + /** |
|
242 | + * A {@link Wordlift_Jsonld_Service} instance. |
|
243 | + * |
|
244 | + * @since 3.7.0 |
|
245 | + * @access protected |
|
246 | + * @var \Wordlift_Jsonld_Service $jsonld_service A {@link Wordlift_Jsonld_Service} instance. |
|
247 | + */ |
|
248 | + protected $jsonld_service; |
|
249 | + |
|
250 | + /** |
|
251 | + * A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
252 | + * |
|
253 | + * @since 3.14.0 |
|
254 | + * @access protected |
|
255 | + * @var \Wordlift_Website_Jsonld_Converter $jsonld_website_converter A {@link Wordlift_Website_Jsonld_Converter} instance. |
|
256 | + */ |
|
257 | + protected $jsonld_website_converter; |
|
258 | + |
|
259 | + /** |
|
260 | + * A {@link Wordlift_Property_Factory} instance. |
|
261 | + * |
|
262 | + * @since 3.7.0 |
|
263 | + * @access private |
|
264 | + * @var \Wordlift_Property_Factory $property_factory |
|
265 | + */ |
|
266 | + private $property_factory; |
|
267 | + |
|
268 | + /** |
|
269 | + * The 'Download Your Data' page. |
|
270 | + * |
|
271 | + * @since 3.6.0 |
|
272 | + * @access private |
|
273 | + * @var \Wordlift_Admin_Download_Your_Data_Page $download_your_data_page The 'Download Your Data' page. |
|
274 | + */ |
|
275 | + private $download_your_data_page; |
|
276 | + |
|
277 | + /** |
|
278 | + * The 'WordLift Settings' page. |
|
279 | + * |
|
280 | + * @since 3.11.0 |
|
281 | + * @access protected |
|
282 | + * @var \Wordlift_Admin_Settings_Page $settings_page The 'WordLift Settings' page. |
|
283 | + */ |
|
284 | + protected $settings_page; |
|
285 | + |
|
286 | + /** |
|
287 | + * The install wizard page. |
|
288 | + * |
|
289 | + * @since 3.9.0 |
|
290 | + * @access private |
|
291 | + * @var \Wordlift_Admin_Setup $admin_setup The Install wizard. |
|
292 | + */ |
|
293 | + public $admin_setup; |
|
294 | + |
|
295 | + /** |
|
296 | + * The Content Filter Service hooks up to the 'the_content' filter and provides |
|
297 | + * linking of entities to their pages. |
|
298 | + * |
|
299 | + * @since 3.8.0 |
|
300 | + * @access private |
|
301 | + * @var \Wordlift_Content_Filter_Service $content_filter_service A {@link Wordlift_Content_Filter_Service} instance. |
|
302 | + */ |
|
303 | + private $content_filter_service; |
|
304 | + |
|
305 | + /** |
|
306 | + * The Faq Content filter service |
|
307 | + * |
|
308 | + * @since 3.26.0 |
|
309 | + * @access private |
|
310 | + * @var Faq_Content_Filter $faq_content_filter_service A {@link Faq_Content_Filter} instance. |
|
311 | + */ |
|
312 | + private $faq_content_filter_service; |
|
313 | + |
|
314 | + /** |
|
315 | + * A {@link Wordlift_Key_Validation_Service} instance. |
|
316 | + * |
|
317 | + * @since 3.9.0 |
|
318 | + * @access private |
|
319 | + * @var Wordlift_Key_Validation_Service $key_validation_service A {@link Wordlift_Key_Validation_Service} instance. |
|
320 | + */ |
|
321 | + private $key_validation_service; |
|
322 | + |
|
323 | + /** |
|
324 | + * A {@link Wordlift_Rating_Service} instance. |
|
325 | + * |
|
326 | + * @since 3.10.0 |
|
327 | + * @access private |
|
328 | + * @var \Wordlift_Rating_Service $rating_service A {@link Wordlift_Rating_Service} instance. |
|
329 | + */ |
|
330 | + private $rating_service; |
|
331 | + |
|
332 | + /** |
|
333 | + * A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
334 | + * |
|
335 | + * @since 3.10.0 |
|
336 | + * @access protected |
|
337 | + * @var \Wordlift_Post_To_Jsonld_Converter $post_to_jsonld_converter A {@link Wordlift_Post_To_Jsonld_Converter} instance. |
|
338 | + */ |
|
339 | + protected $post_to_jsonld_converter; |
|
340 | + |
|
341 | + /** |
|
342 | + * A {@link Wordlift_Install_Service} instance. |
|
343 | + * |
|
344 | + * @since 3.18.0 |
|
345 | + * @access protected |
|
346 | + * @var \Wordlift_Install_Service $install_service A {@link Wordlift_Install_Service} instance. |
|
347 | + */ |
|
348 | + protected $install_service; |
|
349 | + |
|
350 | + /** |
|
351 | + * A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
352 | + * |
|
353 | + * @since 3.10.0 |
|
354 | + * @access protected |
|
355 | + * @var \Wordlift_Entity_Post_To_Jsonld_Converter $entity_post_to_jsonld_converter A {@link Wordlift_Entity_Post_To_Jsonld_Converter} instance. |
|
356 | + */ |
|
357 | + protected $entity_post_to_jsonld_converter; |
|
358 | + |
|
359 | + /** |
|
360 | + * A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
361 | + * |
|
362 | + * @since 3.10.0 |
|
363 | + * @access protected |
|
364 | + * @var \Wordlift_Postid_To_Jsonld_Converter $postid_to_jsonld_converter A {@link Wordlift_Postid_To_Jsonld_Converter} instance. |
|
365 | + */ |
|
366 | + protected $postid_to_jsonld_converter; |
|
367 | + |
|
368 | + /** |
|
369 | + * The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
370 | + * |
|
371 | + * @since 3.11.0 |
|
372 | + * @access protected |
|
373 | + * @var \Wordlift_Category_Taxonomy_Service $category_taxonomy_service The {@link Wordlift_Category_Taxonomy_Service} instance. |
|
374 | + */ |
|
375 | + protected $category_taxonomy_service; |
|
376 | + |
|
377 | + /** |
|
378 | + * The {@link Wordlift_Entity_Page_Service} instance. |
|
379 | + * |
|
380 | + * @since 3.11.0 |
|
381 | + * @access protected |
|
382 | + * @var \Wordlift_Entity_Page_Service $entity_page_service The {@link Wordlift_Entity_Page_Service} instance. |
|
383 | + */ |
|
384 | + protected $entity_page_service; |
|
385 | + |
|
386 | + /** |
|
387 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
388 | + * |
|
389 | + * @since 3.11.0 |
|
390 | + * @access protected |
|
391 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
392 | + */ |
|
393 | + protected $settings_page_action_link; |
|
394 | + |
|
395 | + /** |
|
396 | + * The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
397 | + * |
|
398 | + * @since 3.11.0 |
|
399 | + * @access protected |
|
400 | + * @var \Wordlift_Admin_Settings_Page_Action_Link $settings_page_action_link The {@link Wordlift_Admin_Settings_Page_Action_Link} class. |
|
401 | + */ |
|
402 | + protected $analytics_settings_page_action_link; |
|
403 | + |
|
404 | + /** |
|
405 | + * The {@link Wordlift_Analytics_Connect} class. |
|
406 | + * |
|
407 | + * @since 3.11.0 |
|
408 | + * @access protected |
|
409 | + * @var \Wordlift_Analytics_Connect $analytics_connect The {@link Wordlift_Analytics_Connect} class. |
|
410 | + */ |
|
411 | + protected $analytics_connect; |
|
412 | + |
|
413 | + /** |
|
414 | + * The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
415 | + * |
|
416 | + * @since 3.11.0 |
|
417 | + * @access protected |
|
418 | + * @var \Wordlift_Publisher_Ajax_Adapter $publisher_ajax_adapter The {@link Wordlift_Publisher_Ajax_Adapter} instance. |
|
419 | + */ |
|
420 | + protected $publisher_ajax_adapter; |
|
421 | + |
|
422 | + /** |
|
423 | + * The {@link Wordlift_Admin_Input_Element} element renderer. |
|
424 | + * |
|
425 | + * @since 3.11.0 |
|
426 | + * @access protected |
|
427 | + * @var \Wordlift_Admin_Input_Element $input_element The {@link Wordlift_Admin_Input_Element} element renderer. |
|
428 | + */ |
|
429 | + protected $input_element; |
|
430 | + |
|
431 | + /** |
|
432 | + * The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
433 | + * |
|
434 | + * @since 3.13.0 |
|
435 | + * @access protected |
|
436 | + * @var \Wordlift_Admin_Radio_Input_Element $radio_input_element The {@link Wordlift_Admin_Radio_Input_Element} element renderer. |
|
437 | + */ |
|
438 | + protected $radio_input_element; |
|
439 | + |
|
440 | + /** |
|
441 | + * The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
442 | + * |
|
443 | + * @since 3.11.0 |
|
444 | + * @access protected |
|
445 | + * @var \Wordlift_Admin_Language_Select_Element $language_select_element The {@link Wordlift_Admin_Language_Select_Element} element renderer. |
|
446 | + */ |
|
447 | + protected $language_select_element; |
|
448 | + |
|
449 | + /** |
|
450 | + * The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
451 | + * |
|
452 | + * @since 3.18.0 |
|
453 | + * @access protected |
|
454 | + * @var \Wordlift_Admin_Country_Select_Element $country_select_element The {@link Wordlift_Admin_Country_Select_Element} element renderer. |
|
455 | + */ |
|
456 | + protected $country_select_element; |
|
457 | + |
|
458 | + /** |
|
459 | + * The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
460 | + * |
|
461 | + * @since 3.11.0 |
|
462 | + * @access protected |
|
463 | + * @var \Wordlift_Admin_Publisher_Element $publisher_element The {@link Wordlift_Admin_Publisher_Element} element renderer. |
|
464 | + */ |
|
465 | + protected $publisher_element; |
|
466 | + |
|
467 | + /** |
|
468 | + * The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
469 | + * |
|
470 | + * @since 3.11.0 |
|
471 | + * @access protected |
|
472 | + * @var \Wordlift_Admin_Select2_Element $select2_element The {@link Wordlift_Admin_Select2_Element} element renderer. |
|
473 | + */ |
|
474 | + protected $select2_element; |
|
475 | + |
|
476 | + /** |
|
477 | + * The controller for the entity type list admin page |
|
478 | + * |
|
479 | + * @since 3.11.0 |
|
480 | + * @access private |
|
481 | + * @var \Wordlift_Admin_Entity_Taxonomy_List_Page $entity_type_admin_page The {@link Wordlift_Admin_Entity_Taxonomy_List_Page} class. |
|
482 | + */ |
|
483 | + private $entity_type_admin_page; |
|
484 | + |
|
485 | + /** |
|
486 | + * The controller for the entity type settings admin page |
|
487 | + * |
|
488 | + * @since 3.11.0 |
|
489 | + * @access private |
|
490 | + * @var \Wordlift_Admin_Entity_Type_Settings $entity_type_settings_admin_page The {@link Wordlift_Admin_Entity_Type_Settings} class. |
|
491 | + */ |
|
492 | + private $entity_type_settings_admin_page; |
|
493 | + |
|
494 | + /** |
|
495 | + * The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
496 | + * |
|
497 | + * @since 3.11.0 |
|
498 | + * @access protected |
|
499 | + * @var \Wordlift_Related_Entities_Cloud_Widget $related_entities_cloud_widget The {@link Wordlift_Related_Entities_Cloud_Widget} instance. |
|
500 | + */ |
|
501 | + protected $related_entities_cloud_widget; |
|
502 | + |
|
503 | + /** |
|
504 | + * The {@link Wordlift_Admin_Author_Element} instance. |
|
505 | + * |
|
506 | + * @since 3.14.0 |
|
507 | + * @access protected |
|
508 | + * @var \Wordlift_Admin_Author_Element $author_element The {@link Wordlift_Admin_Author_Element} instance. |
|
509 | + */ |
|
510 | + protected $author_element; |
|
511 | + |
|
512 | + /** |
|
513 | + * The {@link Wordlift_Sample_Data_Service} instance. |
|
514 | + * |
|
515 | + * @since 3.12.0 |
|
516 | + * @access protected |
|
517 | + * @var \Wordlift_Sample_Data_Service $sample_data_service The {@link Wordlift_Sample_Data_Service} instance. |
|
518 | + */ |
|
519 | + protected $sample_data_service; |
|
520 | + |
|
521 | + /** |
|
522 | + * The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
523 | + * |
|
524 | + * @since 3.12.0 |
|
525 | + * @access protected |
|
526 | + * @var \Wordlift_Sample_Data_Ajax_Adapter $sample_data_ajax_adapter The {@link Wordlift_Sample_Data_Ajax_Adapter} instance. |
|
527 | + */ |
|
528 | + protected $sample_data_ajax_adapter; |
|
529 | + |
|
530 | + /** |
|
531 | + * The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
532 | + * |
|
533 | + * @since 3.16.0 |
|
534 | + * @access protected |
|
535 | + * @var \Wordlift_Google_Analytics_Export_Service $google_analytics_export_service The {@link Wordlift_Google_Analytics_Export_Service} instance. |
|
536 | + */ |
|
537 | + protected $google_analytics_export_service; |
|
538 | + |
|
539 | + /** |
|
540 | + * {@link Wordlift}'s singleton instance. |
|
541 | + * |
|
542 | + * @since 3.15.0 |
|
543 | + * @access protected |
|
544 | + * @var \Wordlift_Entity_Type_Adapter $entity_type_adapter The {@link Wordlift_Entity_Type_Adapter} instance. |
|
545 | + */ |
|
546 | + protected $entity_type_adapter; |
|
547 | + |
|
548 | + /** |
|
549 | + * The {@link Wordlift_Storage_Factory} instance. |
|
550 | + * |
|
551 | + * @since 3.15.0 |
|
552 | + * @access protected |
|
553 | + * @var \Wordlift_Storage_Factory $storage_factory The {@link Wordlift_Storage_Factory} instance. |
|
554 | + */ |
|
555 | + protected $storage_factory; |
|
556 | + |
|
557 | + /** |
|
558 | + * The {@link Wordlift_Autocomplete_Adapter} instance. |
|
559 | + * |
|
560 | + * @since 3.15.0 |
|
561 | + * @access private |
|
562 | + * @var \Wordlift_Autocomplete_Adapter $autocomplete_adapter The {@link Wordlift_Autocomplete_Adapter} instance. |
|
563 | + */ |
|
564 | + private $autocomplete_adapter; |
|
565 | + |
|
566 | + /** |
|
567 | + * The {@link Wordlift_Cached_Post_Converter} instance. |
|
568 | + * |
|
569 | + * @since 3.16.0 |
|
570 | + * @access protected |
|
571 | + * @var \Wordlift_Cached_Post_Converter $cached_postid_to_jsonld_converter The {@link Wordlift_Cached_Post_Converter} instance. |
|
572 | + */ |
|
573 | + protected $cached_postid_to_jsonld_converter; |
|
574 | + |
|
575 | + /** |
|
576 | + * The {@link Wordlift_Entity_Uri_Service} instance. |
|
577 | + * |
|
578 | + * @since 3.16.3 |
|
579 | + * @access protected |
|
580 | + * @var \Wordlift_Entity_Uri_Service $entity_uri_service The {@link Wordlift_Entity_Uri_Service} instance. |
|
581 | + */ |
|
582 | + protected $entity_uri_service; |
|
583 | + |
|
584 | + /** |
|
585 | + * The {@link Wordlift_Publisher_Service} instance. |
|
586 | + * |
|
587 | + * @since 3.19.0 |
|
588 | + * @access protected |
|
589 | + * @var \Wordlift_Publisher_Service $publisher_service The {@link Wordlift_Publisher_Service} instance. |
|
590 | + */ |
|
591 | + protected $publisher_service; |
|
592 | + |
|
593 | + /** |
|
594 | + * The {@link Wordlift_Context_Cards_Service} instance. |
|
595 | + * |
|
596 | + * @var \Wordlift_Context_Cards_Service The {@link Wordlift_Context_Cards_Service} instance. |
|
597 | + */ |
|
598 | + protected $context_cards_service; |
|
599 | + |
|
600 | + /** |
|
601 | + * {@link Wordlift}'s singleton instance. |
|
602 | + * |
|
603 | + * @since 3.11.2 |
|
604 | + * @access private |
|
605 | + * @var Wordlift $instance {@link Wordlift}'s singleton instance. |
|
606 | + */ |
|
607 | + private static $instance; |
|
608 | + |
|
609 | + /** |
|
610 | + * A singleton instance of features registry. |
|
611 | + * |
|
612 | + * @since 3.30.0 |
|
613 | + * @var Features_Registry |
|
614 | + */ |
|
615 | + private $features_registry; |
|
616 | + |
|
617 | + private $analytics_settings_page; |
|
618 | + |
|
619 | + private $webhook_loader; |
|
620 | + |
|
621 | + /** |
|
622 | + * Define the core functionality of the plugin. |
|
623 | + * |
|
624 | + * Set the plugin name and the plugin version that can be used throughout the plugin. |
|
625 | + * Load the dependencies, define the locale, and set the hooks for the admin area and |
|
626 | + * the public-facing side of the site. |
|
627 | + * |
|
628 | + * @since 1.0.0 |
|
629 | + */ |
|
630 | + public function __construct() { |
|
631 | + |
|
632 | + self::$instance = $this; |
|
633 | + |
|
634 | + $this->plugin_name = 'wordlift'; |
|
635 | + $this->version = WORDLIFT_VERSION; |
|
636 | + $this->load_dependencies(); |
|
637 | + $this->set_locale(); |
|
638 | + |
|
639 | + $that = $this; |
|
640 | + add_action( |
|
641 | + 'plugins_loaded', |
|
642 | + function () use ( $that ) { |
|
643 | + $that->define_admin_hooks( $that ); |
|
644 | + $that->define_public_hooks( $that ); |
|
645 | + }, |
|
646 | + 4 |
|
647 | + ); |
|
648 | + |
|
649 | + // If we're in `WP_CLI` load the related files. |
|
650 | + if ( class_exists( 'WP_CLI' ) ) { |
|
651 | + $this->load_cli_dependencies(); |
|
652 | + } |
|
653 | + |
|
654 | + } |
|
655 | + |
|
656 | + /** |
|
657 | + * Get the singleton instance. |
|
658 | + * |
|
659 | + * @return Wordlift The {@link Wordlift} singleton instance. |
|
660 | + * @since 3.11.2 |
|
661 | + */ |
|
662 | + public static function get_instance() { |
|
663 | + |
|
664 | + return self::$instance; |
|
665 | + } |
|
666 | + |
|
667 | + /** |
|
668 | + * Load the required dependencies for this plugin. |
|
669 | + * |
|
670 | + * Include the following files that make up the plugin: |
|
671 | + * |
|
672 | + * - Wordlift_Loader. Orchestrates the hooks of the plugin. |
|
673 | + * - Wordlift_i18n. Defines internationalization functionality. |
|
674 | + * - Wordlift_Admin. Defines all hooks for the admin area. |
|
675 | + * - Wordlift_Public. Defines all hooks for the public side of the site. |
|
676 | + * |
|
677 | + * Create an instance of the loader which will be used to register the hooks |
|
678 | + * with WordPress. |
|
679 | + * |
|
680 | + * @throws Exception when an error occurs. |
|
681 | + * @since 1.0.0 |
|
682 | + * @access private |
|
683 | + */ |
|
684 | + private function load_dependencies() { |
|
685 | + |
|
686 | + /** |
|
687 | + * The class responsible for orchestrating the actions and filters of the |
|
688 | + * core plugin. |
|
689 | + */ |
|
690 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-loader.php'; |
|
691 | + |
|
692 | + // The class responsible for plugin uninstall. |
|
693 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-deactivator-feedback.php'; |
|
694 | + |
|
695 | + /** |
|
696 | + * The class responsible for defining internationalization functionality |
|
697 | + * of the plugin. |
|
698 | + */ |
|
699 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-i18n.php'; |
|
700 | + |
|
701 | + /** |
|
702 | + * WordLift's supported languages. |
|
703 | + */ |
|
704 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-languages.php'; |
|
705 | + |
|
706 | + /** |
|
707 | + * WordLift's supported countries. |
|
708 | + */ |
|
709 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-countries.php'; |
|
710 | + |
|
711 | + /** |
|
712 | + * Provide support functions to sanitize data. |
|
713 | + */ |
|
714 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sanitizer.php'; |
|
715 | + |
|
716 | + /** Services. */ |
|
717 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-log-service.php'; |
|
718 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-http-api.php'; |
|
719 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-redirect-service.php'; |
|
720 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-configuration-service.php'; |
|
721 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-post-type-service.php'; |
|
722 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-service.php'; |
|
723 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-link-service.php'; |
|
724 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-relation-service.php'; |
|
725 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-image-service.php'; |
|
726 | + |
|
727 | + /** |
|
728 | + * The Schema service. |
|
729 | + */ |
|
730 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-schema-service.php'; |
|
731 | + |
|
732 | + /** |
|
733 | + * The schema:url property service. |
|
734 | + */ |
|
735 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-property-service.php'; |
|
736 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-schema-url-property-service.php'; |
|
737 | + |
|
738 | + /** |
|
739 | + * The UI service. |
|
740 | + */ |
|
741 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-ui-service.php'; |
|
742 | + |
|
743 | + /** |
|
744 | + * The Entity Types Taxonomy service. |
|
745 | + */ |
|
746 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-taxonomy-service.php'; |
|
747 | + |
|
748 | + /** |
|
749 | + * The Entity service. |
|
750 | + */ |
|
751 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-uri-service.php'; |
|
752 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-service.php'; |
|
753 | + |
|
754 | + // Add the entity rating service. |
|
755 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-rating-service.php'; |
|
756 | + |
|
757 | + /** |
|
758 | + * The User service. |
|
759 | + */ |
|
760 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-user-service.php'; |
|
761 | + |
|
762 | + /** |
|
763 | + * The Timeline service. |
|
764 | + */ |
|
765 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-timeline-service.php'; |
|
766 | + |
|
767 | + /** |
|
768 | + * The Topic Taxonomy service. |
|
769 | + */ |
|
770 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-topic-taxonomy-service.php'; |
|
771 | + |
|
772 | + /** |
|
773 | + * The WordLift URI service. |
|
774 | + */ |
|
775 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-uri-service.php'; |
|
776 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-property-factory.php'; |
|
777 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sample-data-service.php'; |
|
778 | + |
|
779 | + require_once plugin_dir_path( __DIR__ ) . 'includes/properties/class-wordlift-property-getter-factory.php'; |
|
780 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-attachment-service.php'; |
|
781 | + |
|
782 | + /** |
|
783 | + * Load the converters. |
|
784 | + */ |
|
785 | + require_once plugin_dir_path( __DIR__ ) . 'includes/intf-wordlift-post-converter.php'; |
|
786 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-abstract-post-to-jsonld-converter.php'; |
|
787 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-postid-to-jsonld-converter.php'; |
|
788 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-post-to-jsonld-converter.php'; |
|
789 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-to-jsonld-converter.php'; |
|
790 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-website-jsonld-converter.php'; |
|
791 | + |
|
792 | + /** |
|
793 | + * Load cache-related files. |
|
794 | + */ |
|
795 | + require_once plugin_dir_path( __DIR__ ) . 'includes/cache/require.php'; |
|
796 | + |
|
797 | + /** |
|
798 | + * Load the content filter. |
|
799 | + */ |
|
800 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-content-filter-service.php'; |
|
801 | + |
|
802 | + /* |
|
803 | 803 | * Load the excerpt helper. |
804 | 804 | */ |
805 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
806 | - |
|
807 | - /** |
|
808 | - * Load the JSON-LD service to publish entities using JSON-LD.s |
|
809 | - * |
|
810 | - * @since 3.8.0 |
|
811 | - */ |
|
812 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-jsonld-service.php'; |
|
813 | - |
|
814 | - // The Publisher Service and the AJAX adapter. |
|
815 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-publisher-service.php'; |
|
816 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
817 | - |
|
818 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-adapter.php'; |
|
819 | - |
|
820 | - /** |
|
821 | - * Load the WordLift key validation service. |
|
822 | - */ |
|
823 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-key-validation-service.php'; |
|
824 | - |
|
825 | - // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
826 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
827 | - |
|
828 | - // Load the `Wordlift_Entity_Page_Service` class definition. |
|
829 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-page-service.php'; |
|
830 | - |
|
831 | - /** Linked Data. */ |
|
832 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
833 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
834 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
835 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
836 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
837 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
838 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
839 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
840 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
841 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
842 | - require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
843 | - |
|
844 | - /** Services. */ |
|
845 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
846 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-api-service.php'; |
|
847 | - |
|
848 | - /** Adapters. */ |
|
849 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
850 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
851 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
852 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
853 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
854 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-nitropack-adapter.php'; |
|
855 | - |
|
856 | - /** Autocomplete. */ |
|
857 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
858 | - |
|
859 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-remote-image-service.php'; |
|
860 | - |
|
861 | - /** Analytics */ |
|
862 | - require_once plugin_dir_path( __DIR__ ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
863 | - |
|
864 | - /** |
|
865 | - * The class responsible for defining all actions that occur in the admin area. |
|
866 | - */ |
|
867 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin.php'; |
|
868 | - |
|
869 | - /** |
|
870 | - * The class to customize the entity list admin page. |
|
871 | - */ |
|
872 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-list-service.php'; |
|
873 | - |
|
874 | - /** |
|
875 | - * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
876 | - */ |
|
877 | - global $wp_version; |
|
878 | - if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
879 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
880 | - } else { |
|
881 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
882 | - } |
|
883 | - |
|
884 | - /** |
|
885 | - * The Notice service. |
|
886 | - */ |
|
887 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-notice-service.php'; |
|
888 | - |
|
889 | - /** |
|
890 | - * The PrimaShop adapter. |
|
891 | - */ |
|
892 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
893 | - |
|
894 | - /** |
|
895 | - * The WordLift Dashboard service. |
|
896 | - */ |
|
897 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-dashboard-service.php'; |
|
898 | - |
|
899 | - /** |
|
900 | - * The admin 'Install wizard' page. |
|
901 | - */ |
|
902 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-setup.php'; |
|
903 | - |
|
904 | - /** |
|
905 | - * The WordLift entity type list admin page controller. |
|
906 | - */ |
|
907 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
908 | - |
|
909 | - /** |
|
910 | - * The WordLift entity type settings admin page controller. |
|
911 | - */ |
|
912 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-entity-type-settings.php'; |
|
913 | - |
|
914 | - /** |
|
915 | - * The admin 'Download Your Data' page. |
|
916 | - */ |
|
917 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-download-your-data-page.php'; |
|
918 | - |
|
919 | - /** |
|
920 | - * The admin 'WordLift Settings' page. |
|
921 | - */ |
|
922 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
923 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
924 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-radio-input-element.php'; |
|
925 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
926 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
927 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
928 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
929 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
930 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
931 | - require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
932 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-page.php'; |
|
933 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
934 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
935 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
936 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
937 | - |
|
938 | - /** Admin Pages */ |
|
939 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
940 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
941 | - |
|
942 | - /** |
|
943 | - * The class responsible for defining all actions that occur in the public-facing |
|
944 | - * side of the site. |
|
945 | - */ |
|
946 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-public.php'; |
|
947 | - |
|
948 | - /** |
|
949 | - * The shortcode abstract class. |
|
950 | - */ |
|
951 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-shortcode.php'; |
|
952 | - |
|
953 | - /** |
|
954 | - * The Timeline shortcode. |
|
955 | - */ |
|
956 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
957 | - |
|
958 | - /** |
|
959 | - * The Navigator shortcode. |
|
960 | - */ |
|
961 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
962 | - |
|
963 | - /** |
|
964 | - * The Products Navigator shortcode. |
|
965 | - */ |
|
966 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
967 | - |
|
968 | - /** |
|
969 | - * The chord shortcode. |
|
970 | - */ |
|
971 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-chord-shortcode.php'; |
|
972 | - |
|
973 | - /** |
|
974 | - * The geomap shortcode. |
|
975 | - */ |
|
976 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
977 | - |
|
978 | - /** |
|
979 | - * The entity cloud shortcode. |
|
980 | - */ |
|
981 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
982 | - |
|
983 | - /** |
|
984 | - * The entity glossary shortcode. |
|
985 | - */ |
|
986 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-alphabet-service.php'; |
|
987 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
988 | - |
|
989 | - /** |
|
990 | - * Faceted Search shortcode. |
|
991 | - */ |
|
992 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
993 | - |
|
994 | - /** |
|
995 | - * The ShareThis service. |
|
996 | - */ |
|
997 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-sharethis-service.php'; |
|
998 | - |
|
999 | - /** |
|
1000 | - * The SEO service. |
|
1001 | - */ |
|
1002 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-seo-service.php'; |
|
1003 | - |
|
1004 | - /** |
|
1005 | - * The AMP service. |
|
1006 | - */ |
|
1007 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-amp-service.php'; |
|
1008 | - |
|
1009 | - /** Widgets */ |
|
1010 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-widget.php'; |
|
1011 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
1012 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-context-cards-service.php'; |
|
1013 | - |
|
1014 | - /* |
|
805 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-excerpt-helper.php'; |
|
806 | + |
|
807 | + /** |
|
808 | + * Load the JSON-LD service to publish entities using JSON-LD.s |
|
809 | + * |
|
810 | + * @since 3.8.0 |
|
811 | + */ |
|
812 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-jsonld-service.php'; |
|
813 | + |
|
814 | + // The Publisher Service and the AJAX adapter. |
|
815 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-publisher-service.php'; |
|
816 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-publisher-ajax-adapter.php'; |
|
817 | + |
|
818 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-post-adapter.php'; |
|
819 | + |
|
820 | + /** |
|
821 | + * Load the WordLift key validation service. |
|
822 | + */ |
|
823 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-key-validation-service.php'; |
|
824 | + |
|
825 | + // Load the `Wordlift_Category_Taxonomy_Service` class definition. |
|
826 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-category-taxonomy-service.php'; |
|
827 | + |
|
828 | + // Load the `Wordlift_Entity_Page_Service` class definition. |
|
829 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-page-service.php'; |
|
830 | + |
|
831 | + /** Linked Data. */ |
|
832 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-storage.php'; |
|
833 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-meta-storage.php'; |
|
834 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-property-storage.php'; |
|
835 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-taxonomy-storage.php'; |
|
836 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-schema-class-storage.php'; |
|
837 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-author-storage.php'; |
|
838 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-meta-uri-storage.php'; |
|
839 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-image-storage.php'; |
|
840 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-post-related-storage.php'; |
|
841 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-url-property-storage.php'; |
|
842 | + require_once plugin_dir_path( __DIR__ ) . 'includes/linked-data/storage/class-wordlift-storage-factory.php'; |
|
843 | + |
|
844 | + /** Services. */ |
|
845 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-google-analytics-export-service.php'; |
|
846 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-api-service.php'; |
|
847 | + |
|
848 | + /** Adapters. */ |
|
849 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-tinymce-adapter.php'; |
|
850 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-newrelic-adapter.php'; |
|
851 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-sample-data-ajax-adapter.php'; |
|
852 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-entity-type-adapter.php'; |
|
853 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-wprocket-adapter.php'; |
|
854 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-nitropack-adapter.php'; |
|
855 | + |
|
856 | + /** Autocomplete. */ |
|
857 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-autocomplete-adapter.php'; |
|
858 | + |
|
859 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-remote-image-service.php'; |
|
860 | + |
|
861 | + /** Analytics */ |
|
862 | + require_once plugin_dir_path( __DIR__ ) . 'includes/analytics/class-wordlift-analytics-connect.php'; |
|
863 | + |
|
864 | + /** |
|
865 | + * The class responsible for defining all actions that occur in the admin area. |
|
866 | + */ |
|
867 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin.php'; |
|
868 | + |
|
869 | + /** |
|
870 | + * The class to customize the entity list admin page. |
|
871 | + */ |
|
872 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-list-service.php'; |
|
873 | + |
|
874 | + /** |
|
875 | + * The Entity Types Taxonomy Walker (transforms checkboxes into radios). |
|
876 | + */ |
|
877 | + global $wp_version; |
|
878 | + if ( version_compare( $wp_version, '5.3', '<' ) ) { |
|
879 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-types-taxonomy-walker.php'; |
|
880 | + } else { |
|
881 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-types-taxonomy-walker-5-3.php'; |
|
882 | + } |
|
883 | + |
|
884 | + /** |
|
885 | + * The Notice service. |
|
886 | + */ |
|
887 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-notice-service.php'; |
|
888 | + |
|
889 | + /** |
|
890 | + * The PrimaShop adapter. |
|
891 | + */ |
|
892 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-primashop-adapter.php'; |
|
893 | + |
|
894 | + /** |
|
895 | + * The WordLift Dashboard service. |
|
896 | + */ |
|
897 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-dashboard-service.php'; |
|
898 | + |
|
899 | + /** |
|
900 | + * The admin 'Install wizard' page. |
|
901 | + */ |
|
902 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-setup.php'; |
|
903 | + |
|
904 | + /** |
|
905 | + * The WordLift entity type list admin page controller. |
|
906 | + */ |
|
907 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-entity-taxonomy-list-page.php'; |
|
908 | + |
|
909 | + /** |
|
910 | + * The WordLift entity type settings admin page controller. |
|
911 | + */ |
|
912 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-entity-type-settings.php'; |
|
913 | + |
|
914 | + /** |
|
915 | + * The admin 'Download Your Data' page. |
|
916 | + */ |
|
917 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-download-your-data-page.php'; |
|
918 | + |
|
919 | + /** |
|
920 | + * The admin 'WordLift Settings' page. |
|
921 | + */ |
|
922 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/intf-wordlift-admin-element.php'; |
|
923 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-input-element.php'; |
|
924 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-radio-input-element.php'; |
|
925 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-select-element.php'; |
|
926 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-select2-element.php'; |
|
927 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-language-select-element.php'; |
|
928 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-country-select-element.php'; |
|
929 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-tabs-element.php'; |
|
930 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-author-element.php'; |
|
931 | + require_once plugin_dir_path( __DIR__ ) . 'admin/elements/class-wordlift-admin-publisher-element.php'; |
|
932 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-page.php'; |
|
933 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-page.php'; |
|
934 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-analytics-page.php'; |
|
935 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-page-action-link.php'; |
|
936 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-settings-analytics-page-action-link.php'; |
|
937 | + |
|
938 | + /** Admin Pages */ |
|
939 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-user-profile-page.php'; |
|
940 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-entity-type-admin-service.php'; |
|
941 | + |
|
942 | + /** |
|
943 | + * The class responsible for defining all actions that occur in the public-facing |
|
944 | + * side of the site. |
|
945 | + */ |
|
946 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-public.php'; |
|
947 | + |
|
948 | + /** |
|
949 | + * The shortcode abstract class. |
|
950 | + */ |
|
951 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-shortcode.php'; |
|
952 | + |
|
953 | + /** |
|
954 | + * The Timeline shortcode. |
|
955 | + */ |
|
956 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-timeline-shortcode.php'; |
|
957 | + |
|
958 | + /** |
|
959 | + * The Navigator shortcode. |
|
960 | + */ |
|
961 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-navigator-shortcode.php'; |
|
962 | + |
|
963 | + /** |
|
964 | + * The Products Navigator shortcode. |
|
965 | + */ |
|
966 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-products-navigator-shortcode.php'; |
|
967 | + |
|
968 | + /** |
|
969 | + * The chord shortcode. |
|
970 | + */ |
|
971 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-chord-shortcode.php'; |
|
972 | + |
|
973 | + /** |
|
974 | + * The geomap shortcode. |
|
975 | + */ |
|
976 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-geomap-shortcode.php'; |
|
977 | + |
|
978 | + /** |
|
979 | + * The entity cloud shortcode. |
|
980 | + */ |
|
981 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-related-entities-cloud-shortcode.php'; |
|
982 | + |
|
983 | + /** |
|
984 | + * The entity glossary shortcode. |
|
985 | + */ |
|
986 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-alphabet-service.php'; |
|
987 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-vocabulary-shortcode.php'; |
|
988 | + |
|
989 | + /** |
|
990 | + * Faceted Search shortcode. |
|
991 | + */ |
|
992 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-faceted-search-shortcode.php'; |
|
993 | + |
|
994 | + /** |
|
995 | + * The ShareThis service. |
|
996 | + */ |
|
997 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-sharethis-service.php'; |
|
998 | + |
|
999 | + /** |
|
1000 | + * The SEO service. |
|
1001 | + */ |
|
1002 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-seo-service.php'; |
|
1003 | + |
|
1004 | + /** |
|
1005 | + * The AMP service. |
|
1006 | + */ |
|
1007 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-amp-service.php'; |
|
1008 | + |
|
1009 | + /** Widgets */ |
|
1010 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-widget.php'; |
|
1011 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-related-entities-cloud-widget.php'; |
|
1012 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-context-cards-service.php'; |
|
1013 | + |
|
1014 | + /* |
|
1015 | 1015 | * Batch Operations. They're similar to Batch Actions but do not require working on post types. |
1016 | 1016 | * |
1017 | 1017 | * Eventually Batch Actions will become Batch Operations. |
1018 | 1018 | * |
1019 | 1019 | * @since 3.20.0 |
1020 | 1020 | */ |
1021 | - require_once plugin_dir_path( __DIR__ ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
1022 | - require_once plugin_dir_path( __DIR__ ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
1021 | + require_once plugin_dir_path( __DIR__ ) . 'includes/batch/intf-wordlift-batch-operation.php'; |
|
1022 | + require_once plugin_dir_path( __DIR__ ) . 'includes/batch/class-wordlift-batch-operation-ajax-adapter.php'; |
|
1023 | 1023 | |
1024 | - /* |
|
1024 | + /* |
|
1025 | 1025 | * Schema.org Services. |
1026 | 1026 | * |
1027 | 1027 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
1028 | 1028 | */ |
1029 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1030 | - if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
1031 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
1032 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
1033 | - require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
1034 | - new Wordlift_Schemaorg_Sync_Service(); |
|
1035 | - $schemaorg_property_service = Wordlift_Schemaorg_Property_Service::get_instance(); |
|
1036 | - new Wordlift_Schemaorg_Class_Service(); |
|
1037 | - } else { |
|
1038 | - $schemaorg_property_service = null; |
|
1039 | - } |
|
1040 | - |
|
1041 | - $this->loader = new Wordlift_Loader(); |
|
1042 | - /** |
|
1043 | - * @since 3.30.0 |
|
1044 | - */ |
|
1045 | - $this->features_registry = Features_Registry::get_instance(); |
|
1046 | - |
|
1047 | - // Instantiate a global logger. |
|
1048 | - global $wl_logger; |
|
1049 | - $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
1050 | - |
|
1051 | - // Load the `wl-api` end-point. |
|
1052 | - new Wordlift_Http_Api(); |
|
1053 | - |
|
1054 | - // Load the Install Service. |
|
1055 | - require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-service.php'; |
|
1056 | - $this->install_service = new Wordlift_Install_Service(); |
|
1057 | - $this->notice_service = new Wordlift_Notice_Service(); |
|
1058 | - $this->user_service = Wordlift_User_Service::get_instance(); |
|
1059 | - // create an instance of the entity type list admin page controller. |
|
1060 | - $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
1061 | - $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
1062 | - $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
1063 | - // Create an entity type service instance. It'll be later bound to the init action. |
|
1064 | - $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( |
|
1065 | - Wordlift_Entity_Service::TYPE_NAME, |
|
1066 | - Wordlift_Configuration_Service::get_instance()->get_entity_base_path() |
|
1067 | - ); |
|
1068 | - /* WordPress Admin. */ |
|
1069 | - $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page(); |
|
1070 | - // create an instance of the entity type setting admin page controller. |
|
1071 | - $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
1072 | - |
|
1073 | - $that = $this; |
|
1074 | - add_action( |
|
1075 | - 'plugins_loaded', |
|
1076 | - // phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable |
|
1077 | - function () use ( &$that, $schemaorg_property_service ) { |
|
1078 | - |
|
1079 | - /** Services. */ |
|
1080 | - // Create the configuration service. |
|
1081 | - new Wordlift_Api_Service(); |
|
1082 | - |
|
1083 | - // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
1084 | - $that->entity_link_service = new Wordlift_Entity_Link_Service( $that->entity_post_type_service, Wordlift_Configuration_Service::get_instance()->get_entity_base_path() ); |
|
1085 | - |
|
1086 | - $schema_url_property_service = new Wordlift_Schema_Url_Property_Service(); |
|
1087 | - |
|
1088 | - $that->entity_uri_service = Wordlift_Entity_Uri_Service::get_instance(); |
|
1089 | - |
|
1090 | - // Create a new instance of the Redirect service. |
|
1091 | - $that->redirect_service = new Wordlift_Redirect_Service( $that->entity_uri_service ); |
|
1092 | - |
|
1093 | - // Create a new instance of the Timeline service and Timeline shortcode. |
|
1094 | - $that->timeline_service = new Wordlift_Timeline_Service(); |
|
1095 | - |
|
1096 | - $that->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
1097 | - |
|
1098 | - // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
1099 | - $that->sharethis_service = new Wordlift_ShareThis_Service(); |
|
1100 | - |
|
1101 | - // Create an instance of the PrimaShop adapter. |
|
1102 | - $that->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
1103 | - |
|
1104 | - $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
1105 | - |
|
1106 | - // Create the entity rating service. |
|
1107 | - $that->rating_service = Wordlift_Rating_Service::get_instance(); |
|
1108 | - |
|
1109 | - // Create entity list customization (wp-admin/edit.php). |
|
1110 | - $that->entity_list_service = new Wordlift_Entity_List_Service( $that->rating_service ); |
|
1111 | - |
|
1112 | - // Create an instance of the Publisher Service and the AJAX Adapter. |
|
1113 | - $that->publisher_service = Wordlift_Publisher_Service::get_instance(); |
|
1114 | - $that->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
1115 | - $that->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
1116 | - |
|
1117 | - $attachment_service = Wordlift_Attachment_Service::get_instance(); |
|
1118 | - |
|
1119 | - // Instantiate the JSON-LD service. |
|
1120 | - $property_getter = Wordlift_Property_Getter_Factory::create(); |
|
1121 | - $that->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
1122 | - $that->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $that->post_to_jsonld_converter ); |
|
1123 | - $that->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $that->entity_post_to_jsonld_converter, $that->post_to_jsonld_converter ); |
|
1124 | - $that->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
1125 | - |
|
1126 | - $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
1127 | - $that->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $that->postid_to_jsonld_converter, $jsonld_cache ); |
|
1128 | - /* |
|
1029 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1030 | + if ( apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) ) { |
|
1031 | + require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-sync-service.php'; |
|
1032 | + require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-property-service.php'; |
|
1033 | + require_once plugin_dir_path( __DIR__ ) . 'includes/schemaorg/class-wordlift-schemaorg-class-service.php'; |
|
1034 | + new Wordlift_Schemaorg_Sync_Service(); |
|
1035 | + $schemaorg_property_service = Wordlift_Schemaorg_Property_Service::get_instance(); |
|
1036 | + new Wordlift_Schemaorg_Class_Service(); |
|
1037 | + } else { |
|
1038 | + $schemaorg_property_service = null; |
|
1039 | + } |
|
1040 | + |
|
1041 | + $this->loader = new Wordlift_Loader(); |
|
1042 | + /** |
|
1043 | + * @since 3.30.0 |
|
1044 | + */ |
|
1045 | + $this->features_registry = Features_Registry::get_instance(); |
|
1046 | + |
|
1047 | + // Instantiate a global logger. |
|
1048 | + global $wl_logger; |
|
1049 | + $wl_logger = Wordlift_Log_Service::get_logger( 'WordLift' ); |
|
1050 | + |
|
1051 | + // Load the `wl-api` end-point. |
|
1052 | + new Wordlift_Http_Api(); |
|
1053 | + |
|
1054 | + // Load the Install Service. |
|
1055 | + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-service.php'; |
|
1056 | + $this->install_service = new Wordlift_Install_Service(); |
|
1057 | + $this->notice_service = new Wordlift_Notice_Service(); |
|
1058 | + $this->user_service = Wordlift_User_Service::get_instance(); |
|
1059 | + // create an instance of the entity type list admin page controller. |
|
1060 | + $this->entity_type_admin_page = new Wordlift_Admin_Entity_Taxonomy_List_Page(); |
|
1061 | + $this->topic_taxonomy_service = new Wordlift_Topic_Taxonomy_Service(); |
|
1062 | + $this->entity_types_taxonomy_service = new Wordlift_Entity_Type_Taxonomy_Service(); |
|
1063 | + // Create an entity type service instance. It'll be later bound to the init action. |
|
1064 | + $this->entity_post_type_service = new Wordlift_Entity_Post_Type_Service( |
|
1065 | + Wordlift_Entity_Service::TYPE_NAME, |
|
1066 | + Wordlift_Configuration_Service::get_instance()->get_entity_base_path() |
|
1067 | + ); |
|
1068 | + /* WordPress Admin. */ |
|
1069 | + $this->download_your_data_page = new Wordlift_Admin_Download_Your_Data_Page(); |
|
1070 | + // create an instance of the entity type setting admin page controller. |
|
1071 | + $this->entity_type_settings_admin_page = new Wordlift_Admin_Entity_Type_Settings(); |
|
1072 | + |
|
1073 | + $that = $this; |
|
1074 | + add_action( |
|
1075 | + 'plugins_loaded', |
|
1076 | + // phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable |
|
1077 | + function () use ( &$that, $schemaorg_property_service ) { |
|
1078 | + |
|
1079 | + /** Services. */ |
|
1080 | + // Create the configuration service. |
|
1081 | + new Wordlift_Api_Service(); |
|
1082 | + |
|
1083 | + // Create an entity link service instance. It'll be later bound to the post_type_link and pre_get_posts actions. |
|
1084 | + $that->entity_link_service = new Wordlift_Entity_Link_Service( $that->entity_post_type_service, Wordlift_Configuration_Service::get_instance()->get_entity_base_path() ); |
|
1085 | + |
|
1086 | + $schema_url_property_service = new Wordlift_Schema_Url_Property_Service(); |
|
1087 | + |
|
1088 | + $that->entity_uri_service = Wordlift_Entity_Uri_Service::get_instance(); |
|
1089 | + |
|
1090 | + // Create a new instance of the Redirect service. |
|
1091 | + $that->redirect_service = new Wordlift_Redirect_Service( $that->entity_uri_service ); |
|
1092 | + |
|
1093 | + // Create a new instance of the Timeline service and Timeline shortcode. |
|
1094 | + $that->timeline_service = new Wordlift_Timeline_Service(); |
|
1095 | + |
|
1096 | + $that->entity_types_taxonomy_walker = new Wordlift_Entity_Types_Taxonomy_Walker(); |
|
1097 | + |
|
1098 | + // Create an instance of the ShareThis service, later we hook it to the_content and the_excerpt filters. |
|
1099 | + $that->sharethis_service = new Wordlift_ShareThis_Service(); |
|
1100 | + |
|
1101 | + // Create an instance of the PrimaShop adapter. |
|
1102 | + $that->primashop_adapter = new Wordlift_PrimaShop_Adapter(); |
|
1103 | + |
|
1104 | + $uri_service = new Wordlift_Uri_Service( $GLOBALS['wpdb'] ); |
|
1105 | + |
|
1106 | + // Create the entity rating service. |
|
1107 | + $that->rating_service = Wordlift_Rating_Service::get_instance(); |
|
1108 | + |
|
1109 | + // Create entity list customization (wp-admin/edit.php). |
|
1110 | + $that->entity_list_service = new Wordlift_Entity_List_Service( $that->rating_service ); |
|
1111 | + |
|
1112 | + // Create an instance of the Publisher Service and the AJAX Adapter. |
|
1113 | + $that->publisher_service = Wordlift_Publisher_Service::get_instance(); |
|
1114 | + $that->property_factory = new Wordlift_Property_Factory( $schema_url_property_service ); |
|
1115 | + $that->property_factory->register( Wordlift_Schema_Url_Property_Service::META_KEY, $schema_url_property_service ); |
|
1116 | + |
|
1117 | + $attachment_service = Wordlift_Attachment_Service::get_instance(); |
|
1118 | + |
|
1119 | + // Instantiate the JSON-LD service. |
|
1120 | + $property_getter = Wordlift_Property_Getter_Factory::create(); |
|
1121 | + $that->post_to_jsonld_converter = new Wordlift_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
1122 | + $that->entity_post_to_jsonld_converter = new Wordlift_Entity_Post_To_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service, $property_getter, $schemaorg_property_service, $that->post_to_jsonld_converter ); |
|
1123 | + $that->postid_to_jsonld_converter = new Wordlift_Postid_To_Jsonld_Converter( $that->entity_post_to_jsonld_converter, $that->post_to_jsonld_converter ); |
|
1124 | + $that->jsonld_website_converter = new Wordlift_Website_Jsonld_Converter( Wordlift_Entity_Type_Service::get_instance(), $that->user_service, $attachment_service ); |
|
1125 | + |
|
1126 | + $jsonld_cache = new Ttl_Cache( 'jsonld', 86400 ); |
|
1127 | + $that->cached_postid_to_jsonld_converter = new Wordlift_Cached_Post_Converter( $that->postid_to_jsonld_converter, $jsonld_cache ); |
|
1128 | + /* |
|
1129 | 1129 | * Load the `Wordlift_Term_JsonLd_Adapter`. |
1130 | 1130 | * |
1131 | 1131 | * @see https://github.com/insideout10/wordlift-plugin/issues/892 |
1132 | 1132 | * |
1133 | 1133 | * @since 3.20.0 |
1134 | 1134 | */ |
1135 | - require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
1136 | - |
|
1137 | - $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $that->entity_uri_service, $that->cached_postid_to_jsonld_converter ); |
|
1138 | - $that->jsonld_service = new Wordlift_Jsonld_Service( Wordlift_Entity_Service::get_instance(), $that->cached_postid_to_jsonld_converter, $that->jsonld_website_converter, $term_jsonld_adapter ); |
|
1139 | - |
|
1140 | - $jsonld_service = new Jsonld_Service( |
|
1141 | - $that->jsonld_service, |
|
1142 | - $term_jsonld_adapter, |
|
1143 | - new Jsonld_User_Service( $that->user_service ) |
|
1144 | - ); |
|
1145 | - new Jsonld_Endpoint( $jsonld_service, $that->entity_uri_service ); |
|
1146 | - |
|
1147 | - // Prints the JSON-LD in the head. |
|
1148 | - new Jsonld_Adapter( $that->jsonld_service ); |
|
1149 | - |
|
1150 | - new Jsonld_By_Id_Endpoint( $that->jsonld_service, $that->entity_uri_service ); |
|
1151 | - |
|
1152 | - /** |
|
1153 | - * @since 3.37.1 |
|
1154 | - * Add mentions property to the entity. |
|
1155 | - */ |
|
1156 | - new Mentions(); |
|
1157 | - |
|
1158 | - $that->key_validation_service = new Wordlift_Key_Validation_Service(); |
|
1159 | - |
|
1160 | - $that->content_filter_service = Wordlift_Content_Filter_Service::get_instance(); |
|
1161 | - // Creating Faq Content filter service. |
|
1162 | - $that->faq_content_filter_service = new Faq_Content_Filter(); |
|
1163 | - $that->sample_data_service = Wordlift_Sample_Data_Service::get_instance(); |
|
1164 | - $that->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $that->sample_data_service ); |
|
1165 | - |
|
1166 | - $that->loader->add_action( 'enqueue_block_editor_assets', $that, 'add_wl_enabled_blocks' ); |
|
1167 | - $that->loader->add_action( 'admin_enqueue_scripts', $that, 'add_wl_enabled_blocks' ); |
|
1168 | - |
|
1169 | - /** |
|
1170 | - * Filter: wl_feature__enable__blocks. |
|
1171 | - * |
|
1172 | - * @param bool whether the blocks needed to be registered, defaults to true. |
|
1173 | - * |
|
1174 | - * @return bool |
|
1175 | - * @since 3.27.6 |
|
1176 | - */ |
|
1177 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
1178 | - // Initialize the short-codes. |
|
1179 | - new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
1180 | - new Wordlift_Chord_Shortcode(); |
|
1181 | - new Wordlift_Geomap_Shortcode(); |
|
1182 | - new Wordlift_Timeline_Shortcode(); |
|
1183 | - new Wordlift_Related_Entities_Cloud_Shortcode( Wordlift_Relation_Service::get_instance(), Wordlift_Entity_Service::get_instance() ); |
|
1184 | - new Wordlift_Vocabulary_Shortcode(); |
|
1185 | - new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
1186 | - } |
|
1187 | - |
|
1188 | - new Wordlift_Products_Navigator_Shortcode(); |
|
1189 | - |
|
1190 | - // Initialize the Context Cards Service |
|
1191 | - $that->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
1192 | - |
|
1193 | - // Initialize the SEO service. |
|
1194 | - new Wordlift_Seo_Service(); |
|
1195 | - |
|
1196 | - // Initialize the AMP service. |
|
1197 | - new Wordlift_AMP_Service( $that->jsonld_service ); |
|
1198 | - |
|
1199 | - /** Services. */ |
|
1200 | - $that->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
1201 | - new Wordlift_Image_Service(); |
|
1202 | - |
|
1203 | - /** Adapters. */ |
|
1204 | - $that->entity_type_adapter = new Wordlift_Entity_Type_Adapter( Wordlift_Entity_Type_Service::get_instance() ); |
|
1205 | - $that->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $that->publisher_service ); |
|
1206 | - $that->tinymce_adapter = new Wordlift_Tinymce_Adapter( $that ); |
|
1207 | - |
|
1208 | - /* |
|
1135 | + require_once plugin_dir_path( __DIR__ ) . 'public/class-wordlift-term-jsonld-adapter.php'; |
|
1136 | + |
|
1137 | + $term_jsonld_adapter = new Wordlift_Term_JsonLd_Adapter( $that->entity_uri_service, $that->cached_postid_to_jsonld_converter ); |
|
1138 | + $that->jsonld_service = new Wordlift_Jsonld_Service( Wordlift_Entity_Service::get_instance(), $that->cached_postid_to_jsonld_converter, $that->jsonld_website_converter, $term_jsonld_adapter ); |
|
1139 | + |
|
1140 | + $jsonld_service = new Jsonld_Service( |
|
1141 | + $that->jsonld_service, |
|
1142 | + $term_jsonld_adapter, |
|
1143 | + new Jsonld_User_Service( $that->user_service ) |
|
1144 | + ); |
|
1145 | + new Jsonld_Endpoint( $jsonld_service, $that->entity_uri_service ); |
|
1146 | + |
|
1147 | + // Prints the JSON-LD in the head. |
|
1148 | + new Jsonld_Adapter( $that->jsonld_service ); |
|
1149 | + |
|
1150 | + new Jsonld_By_Id_Endpoint( $that->jsonld_service, $that->entity_uri_service ); |
|
1151 | + |
|
1152 | + /** |
|
1153 | + * @since 3.37.1 |
|
1154 | + * Add mentions property to the entity. |
|
1155 | + */ |
|
1156 | + new Mentions(); |
|
1157 | + |
|
1158 | + $that->key_validation_service = new Wordlift_Key_Validation_Service(); |
|
1159 | + |
|
1160 | + $that->content_filter_service = Wordlift_Content_Filter_Service::get_instance(); |
|
1161 | + // Creating Faq Content filter service. |
|
1162 | + $that->faq_content_filter_service = new Faq_Content_Filter(); |
|
1163 | + $that->sample_data_service = Wordlift_Sample_Data_Service::get_instance(); |
|
1164 | + $that->sample_data_ajax_adapter = new Wordlift_Sample_Data_Ajax_Adapter( $that->sample_data_service ); |
|
1165 | + |
|
1166 | + $that->loader->add_action( 'enqueue_block_editor_assets', $that, 'add_wl_enabled_blocks' ); |
|
1167 | + $that->loader->add_action( 'admin_enqueue_scripts', $that, 'add_wl_enabled_blocks' ); |
|
1168 | + |
|
1169 | + /** |
|
1170 | + * Filter: wl_feature__enable__blocks. |
|
1171 | + * |
|
1172 | + * @param bool whether the blocks needed to be registered, defaults to true. |
|
1173 | + * |
|
1174 | + * @return bool |
|
1175 | + * @since 3.27.6 |
|
1176 | + */ |
|
1177 | + if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
1178 | + // Initialize the short-codes. |
|
1179 | + new Async_Template_Decorator( new Wordlift_Navigator_Shortcode() ); |
|
1180 | + new Wordlift_Chord_Shortcode(); |
|
1181 | + new Wordlift_Geomap_Shortcode(); |
|
1182 | + new Wordlift_Timeline_Shortcode(); |
|
1183 | + new Wordlift_Related_Entities_Cloud_Shortcode( Wordlift_Relation_Service::get_instance(), Wordlift_Entity_Service::get_instance() ); |
|
1184 | + new Wordlift_Vocabulary_Shortcode(); |
|
1185 | + new Async_Template_Decorator( new Wordlift_Faceted_Search_Shortcode() ); |
|
1186 | + } |
|
1187 | + |
|
1188 | + new Wordlift_Products_Navigator_Shortcode(); |
|
1189 | + |
|
1190 | + // Initialize the Context Cards Service |
|
1191 | + $that->context_cards_service = new Wordlift_Context_Cards_Service(); |
|
1192 | + |
|
1193 | + // Initialize the SEO service. |
|
1194 | + new Wordlift_Seo_Service(); |
|
1195 | + |
|
1196 | + // Initialize the AMP service. |
|
1197 | + new Wordlift_AMP_Service( $that->jsonld_service ); |
|
1198 | + |
|
1199 | + /** Services. */ |
|
1200 | + $that->google_analytics_export_service = new Wordlift_Google_Analytics_Export_Service(); |
|
1201 | + new Wordlift_Image_Service(); |
|
1202 | + |
|
1203 | + /** Adapters. */ |
|
1204 | + $that->entity_type_adapter = new Wordlift_Entity_Type_Adapter( Wordlift_Entity_Type_Service::get_instance() ); |
|
1205 | + $that->publisher_ajax_adapter = new Wordlift_Publisher_Ajax_Adapter( $that->publisher_service ); |
|
1206 | + $that->tinymce_adapter = new Wordlift_Tinymce_Adapter( $that ); |
|
1207 | + |
|
1208 | + /* |
|
1209 | 1209 | * Exclude our public js from WP-Rocket. |
1210 | 1210 | * |
1211 | 1211 | * @since 3.19.4 |
1212 | 1212 | * |
1213 | 1213 | * @see https://github.com/insideout10/wordlift-plugin/issues/842. |
1214 | 1214 | */ |
1215 | - new Wordlift_WpRocket_Adapter(); |
|
1215 | + new Wordlift_WpRocket_Adapter(); |
|
1216 | 1216 | |
1217 | - // Add support for NitroPack compatibility. |
|
1218 | - $nitropack_adapter = new Wordlift_NitroPack_Adapter(); |
|
1219 | - $nitropack_adapter->register_hooks(); |
|
1217 | + // Add support for NitroPack compatibility. |
|
1218 | + $nitropack_adapter = new Wordlift_NitroPack_Adapter(); |
|
1219 | + $nitropack_adapter->register_hooks(); |
|
1220 | 1220 | |
1221 | - /** WordPress Admin UI. */ |
|
1221 | + /** WordPress Admin UI. */ |
|
1222 | 1222 | |
1223 | - // UI elements. |
|
1224 | - $that->input_element = new Wordlift_Admin_Input_Element(); |
|
1225 | - $that->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
1226 | - $that->select2_element = new Wordlift_Admin_Select2_Element(); |
|
1227 | - $that->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
1228 | - $that->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
1229 | - $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
1230 | - $that->publisher_element = new Wordlift_Admin_Publisher_Element( $that->publisher_service, $tabs_element, $that->select2_element ); |
|
1231 | - $that->author_element = new Wordlift_Admin_Author_Element( $that->publisher_service, $that->select2_element ); |
|
1223 | + // UI elements. |
|
1224 | + $that->input_element = new Wordlift_Admin_Input_Element(); |
|
1225 | + $that->radio_input_element = new Wordlift_Admin_Radio_Input_Element(); |
|
1226 | + $that->select2_element = new Wordlift_Admin_Select2_Element(); |
|
1227 | + $that->language_select_element = new Wordlift_Admin_Language_Select_Element(); |
|
1228 | + $that->country_select_element = new Wordlift_Admin_Country_Select_Element(); |
|
1229 | + $tabs_element = new Wordlift_Admin_Tabs_Element(); |
|
1230 | + $that->publisher_element = new Wordlift_Admin_Publisher_Element( $that->publisher_service, $tabs_element, $that->select2_element ); |
|
1231 | + $that->author_element = new Wordlift_Admin_Author_Element( $that->publisher_service, $that->select2_element ); |
|
1232 | 1232 | |
1233 | - $that->settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
|
1234 | - $that->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $that->settings_page ); |
|
1233 | + $that->settings_page = Wordlift_Admin_Settings_Page::get_instance(); |
|
1234 | + $that->settings_page_action_link = new Wordlift_Admin_Settings_Page_Action_Link( $that->settings_page ); |
|
1235 | 1235 | |
1236 | - $that->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $that->input_element, $that->radio_input_element ); |
|
1237 | - $that->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $that->analytics_settings_page ); |
|
1238 | - $that->analytics_connect = new Wordlift_Analytics_Connect(); |
|
1236 | + $that->analytics_settings_page = new Wordlift_Admin_Settings_Analytics_Page( $that->input_element, $that->radio_input_element ); |
|
1237 | + $that->analytics_settings_page_action_link = new Wordlift_Admin_Settings_Analytics_Page_Action_Link( $that->analytics_settings_page ); |
|
1238 | + $that->analytics_connect = new Wordlift_Analytics_Connect(); |
|
1239 | 1239 | |
1240 | - // Pages. |
|
1241 | - /* |
|
1240 | + // Pages. |
|
1241 | + /* |
|
1242 | 1242 | * Call the `wl_can_see_classification_box` filter to determine whether we can display the classification box. |
1243 | 1243 | * |
1244 | 1244 | * @since 3.20.3 |
1245 | 1245 | * |
1246 | 1246 | * @see https://github.com/insideout10/wordlift-plugin/issues/914 |
1247 | 1247 | */ |
1248 | - if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
1249 | - require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
1250 | - new Wordlift_Admin_Post_Edit_Page( $that ); |
|
1251 | - } |
|
1252 | - new Wordlift_Entity_Type_Admin_Service(); |
|
1248 | + if ( apply_filters( 'wl_can_see_classification_box', true ) ) { |
|
1249 | + require_once plugin_dir_path( __DIR__ ) . 'admin/class-wordlift-admin-post-edit-page.php'; |
|
1250 | + new Wordlift_Admin_Post_Edit_Page( $that ); |
|
1251 | + } |
|
1252 | + new Wordlift_Entity_Type_Admin_Service(); |
|
1253 | 1253 | |
1254 | - /** Widgets */ |
|
1255 | - $that->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
1254 | + /** Widgets */ |
|
1255 | + $that->related_entities_cloud_widget = new Wordlift_Related_Entities_Cloud_Widget(); |
|
1256 | 1256 | |
1257 | - // Create an instance of the install wizard. |
|
1258 | - $that->admin_setup = new Wordlift_Admin_Setup( $that->key_validation_service, Wordlift_Entity_Service::get_instance(), $that->language_select_element, $that->country_select_element ); |
|
1257 | + // Create an instance of the install wizard. |
|
1258 | + $that->admin_setup = new Wordlift_Admin_Setup( $that->key_validation_service, Wordlift_Entity_Service::get_instance(), $that->language_select_element, $that->country_select_element ); |
|
1259 | 1259 | |
1260 | - $that->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $that->entity_post_type_service ); |
|
1260 | + $that->category_taxonomy_service = new Wordlift_Category_Taxonomy_Service( $that->entity_post_type_service ); |
|
1261 | 1261 | |
1262 | - // User Profile. |
|
1263 | - new Wordlift_Admin_User_Profile_Page( $that->author_element, $that->user_service ); |
|
1262 | + // User Profile. |
|
1263 | + new Wordlift_Admin_User_Profile_Page( $that->author_element, $that->user_service ); |
|
1264 | 1264 | |
1265 | - $that->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
1265 | + $that->entity_page_service = new Wordlift_Entity_Page_Service(); |
|
1266 | 1266 | |
1267 | - // Load the debug service if WP is in debug mode. |
|
1268 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
1269 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-debug-service.php'; |
|
1270 | - new Wordlift_Debug_Service( Wordlift_Entity_Service::get_instance(), $uri_service ); |
|
1271 | - } |
|
1267 | + // Load the debug service if WP is in debug mode. |
|
1268 | + if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
1269 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-debug-service.php'; |
|
1270 | + new Wordlift_Debug_Service( Wordlift_Entity_Service::get_instance(), $uri_service ); |
|
1271 | + } |
|
1272 | 1272 | |
1273 | - // Remote Image Service. |
|
1274 | - new Wordlift_Remote_Image_Service(); |
|
1273 | + // Remote Image Service. |
|
1274 | + new Wordlift_Remote_Image_Service(); |
|
1275 | 1275 | |
1276 | - /* |
|
1276 | + /* |
|
1277 | 1277 | * Provides mappings between post types and entity types. |
1278 | 1278 | * |
1279 | 1279 | * @since 3.20.0 |
1280 | 1280 | * |
1281 | 1281 | * @see https://github.com/insideout10/wordlift-plugin/issues/852. |
1282 | 1282 | */ |
1283 | - require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-batch-action.php'; |
|
1284 | - require_once plugin_dir_path( __DIR__ ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
1285 | - require_once plugin_dir_path( __DIR__ ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
1283 | + require_once plugin_dir_path( __DIR__ ) . 'includes/class-wordlift-batch-action.php'; |
|
1284 | + require_once plugin_dir_path( __DIR__ ) . 'includes/mapping/class-wordlift-mapping-service.php'; |
|
1285 | + require_once plugin_dir_path( __DIR__ ) . 'includes/mapping/class-wordlift-mapping-ajax-adapter.php'; |
|
1286 | 1286 | |
1287 | - // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
1288 | - new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
1287 | + // Create an instance of the Mapping Service and assign it to the Ajax Adapter. |
|
1288 | + new Wordlift_Mapping_Ajax_Adapter( new Wordlift_Mapping_Service( Wordlift_Entity_Type_Service::get_instance() ) ); |
|
1289 | 1289 | |
1290 | - /* |
|
1290 | + /* |
|
1291 | 1291 | * Load the Mappings JSON-LD post processing. |
1292 | 1292 | * |
1293 | 1293 | * @since 3.25.0 |
1294 | 1294 | */ |
1295 | 1295 | |
1296 | - $mappings_dbo = new Mappings_DBO(); |
|
1297 | - $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
1298 | - new Post_Type_Rule_Validator(); |
|
1299 | - // Taxonomy term rule validator for validating rules for term pages. |
|
1300 | - new Taxonomy_Term_Rule_Validator(); |
|
1301 | - new Post_Taxonomy_Term_Rule_Validator(); |
|
1302 | - $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
1303 | - $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
1304 | - $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
1305 | - |
|
1306 | - new Url_To_Entity_Transform_Function( $that->entity_uri_service ); |
|
1307 | - new Taxonomy_To_Terms_Transform_Function(); |
|
1308 | - new Post_Id_To_Entity_Transform_Function(); |
|
1309 | - $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
1310 | - |
|
1311 | - /** |
|
1312 | - * @since 3.27.1 |
|
1313 | - * Intiailize the acf group data formatter. |
|
1314 | - */ |
|
1315 | - new Acf_Group_Formatter(); |
|
1316 | - new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
1317 | - |
|
1318 | - /** |
|
1319 | - * @since 3.26.0 |
|
1320 | - * Initialize the Faq JSON LD converter here - disabled. |
|
1321 | - */ |
|
1322 | - // new Faq_To_Jsonld_Converter(); |
|
1323 | - /* |
|
1296 | + $mappings_dbo = new Mappings_DBO(); |
|
1297 | + $default_rule_validator = new Taxonomy_Rule_Validator(); |
|
1298 | + new Post_Type_Rule_Validator(); |
|
1299 | + // Taxonomy term rule validator for validating rules for term pages. |
|
1300 | + new Taxonomy_Term_Rule_Validator(); |
|
1301 | + new Post_Taxonomy_Term_Rule_Validator(); |
|
1302 | + $rule_validators_registry = new Rule_Validators_Registry( $default_rule_validator ); |
|
1303 | + $rule_groups_validator = new Rule_Groups_Validator( $rule_validators_registry ); |
|
1304 | + $mappings_validator = new Mappings_Validator( $mappings_dbo, $rule_groups_validator ); |
|
1305 | + |
|
1306 | + new Url_To_Entity_Transform_Function( $that->entity_uri_service ); |
|
1307 | + new Taxonomy_To_Terms_Transform_Function(); |
|
1308 | + new Post_Id_To_Entity_Transform_Function(); |
|
1309 | + $mappings_transform_functions_registry = new Mappings_Transform_Functions_Registry(); |
|
1310 | + |
|
1311 | + /** |
|
1312 | + * @since 3.27.1 |
|
1313 | + * Intiailize the acf group data formatter. |
|
1314 | + */ |
|
1315 | + new Acf_Group_Formatter(); |
|
1316 | + new Jsonld_Converter( $mappings_validator, $mappings_transform_functions_registry ); |
|
1317 | + |
|
1318 | + /** |
|
1319 | + * @since 3.26.0 |
|
1320 | + * Initialize the Faq JSON LD converter here - disabled. |
|
1321 | + */ |
|
1322 | + // new Faq_To_Jsonld_Converter(); |
|
1323 | + /* |
|
1324 | 1324 | * Use the Templates Ajax Endpoint to load HTML templates for the legacy Angular app via admin-ajax.php |
1325 | 1325 | * end-point. |
1326 | 1326 | * |
1327 | 1327 | * @see https://github.com/insideout10/wordlift-plugin/issues/834 |
1328 | 1328 | * @since 3.24.4 |
1329 | 1329 | */ |
1330 | - new Templates_Ajax_Endpoint(); |
|
1331 | - // Call this static method to register FAQ routes to rest api - disabled |
|
1332 | - // Faq_Rest_Controller::register_routes(); |
|
1333 | - |
|
1334 | - $that->storage_factory = new Wordlift_Storage_Factory( Wordlift_Entity_Service::get_instance(), $that->user_service, $property_getter ); |
|
1335 | - |
|
1336 | - /** WL Autocomplete. */ |
|
1337 | - $autocomplete_service = new All_Autocomplete_Service( |
|
1338 | - array( |
|
1339 | - new Local_Autocomplete_Service(), |
|
1340 | - new Linked_Data_Autocomplete_Service( Entity_Helper::get_instance(), $that->entity_uri_service, Wordlift_Entity_Service::get_instance() ), |
|
1341 | - ) |
|
1342 | - ); |
|
1343 | - $that->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
1344 | - |
|
1345 | - /** |
|
1346 | - * @since 3.27.2 |
|
1347 | - * Integrate the recipe maker jsonld & set recipe |
|
1348 | - * as default entity type to the wprm_recipe CPT. |
|
1349 | - */ |
|
1350 | - new Recipe_Maker_Post_Type_Hook(); |
|
1351 | - $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
1352 | - new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
1353 | - new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
1354 | - new Recipe_Maker_Jsonld_Swap( $recipe_maker_validation_service, $that->jsonld_service ); |
|
1355 | - new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
1356 | - |
|
1357 | - /** |
|
1358 | - * Avada Builder compatibility. |
|
1359 | - * |
|
1360 | - * @since 3.40.0 |
|
1361 | - */ |
|
1362 | - new Avada_Builder_Support(); |
|
1363 | - |
|
1364 | - new Duplicate_Markup_Remover(); |
|
1365 | - |
|
1366 | - /** |
|
1367 | - * @since 3.27.8 |
|
1368 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
|
1369 | - */ |
|
1370 | - new Key_Validation_Notice( $that->key_validation_service, Wordlift_Configuration_Service::get_instance() ); |
|
1371 | - |
|
1372 | - /** |
|
1373 | - * @since 3.28.0 |
|
1374 | - * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen |
|
1375 | - */ |
|
1376 | - new Entity_No_Index_Flag(); |
|
1377 | - |
|
1378 | - /** |
|
1379 | - * @since 3.29.0 |
|
1380 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1304 |
|
1381 | - */ |
|
1382 | - new Entity_Rest_Service( Wordlift_Entity_Type_Service::get_instance() ); |
|
1383 | - |
|
1384 | - /** |
|
1385 | - * Expand author in to references. |
|
1386 | - * |
|
1387 | - * @since 3.30.0 |
|
1388 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1318 |
|
1389 | - */ |
|
1390 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1391 | - if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) { |
|
1392 | - new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter ); |
|
1393 | - } |
|
1394 | - |
|
1395 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1396 | - if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) { |
|
1397 | - $vocabulary_loader = new Vocabulary_Loader(); |
|
1398 | - $vocabulary_loader->init_vocabulary(); |
|
1399 | - } |
|
1400 | - |
|
1401 | - /** |
|
1402 | - * Added for feature request 1496 (Webhooks) |
|
1403 | - */ |
|
1404 | - if ( apply_filters( 'wl_feature__enable__webhooks', false ) ) { |
|
1405 | - $that->webhook_loader = new Webhooks_Loader(); |
|
1406 | - $that->webhook_loader->init(); |
|
1407 | - } |
|
1408 | - |
|
1409 | - /** |
|
1410 | - * @since 3.30.0 |
|
1411 | - * Add a checkbox to user option screen for wordlift admin. |
|
1412 | - */ |
|
1413 | - $wordlift_admin_checkbox = new Admin_User_Option(); |
|
1414 | - $wordlift_admin_checkbox->connect_hook(); |
|
1415 | - |
|
1416 | - /** |
|
1417 | - * @since 3.31.0 |
|
1418 | - * Init loader class for videoobject. |
|
1419 | - */ |
|
1420 | - $videoobject_loader = new Loader(); |
|
1421 | - $videoobject_loader->init_feature(); |
|
1422 | - |
|
1423 | - /** |
|
1424 | - * @since 3.35.0 |
|
1425 | - */ |
|
1426 | - $google_addon_integration_loader = new \Wordlift\Google_Addon_Integration\Loader(); |
|
1427 | - $google_addon_integration_loader->init_feature(); |
|
1428 | - |
|
1429 | - /** |
|
1430 | - * @since 3.31.5 |
|
1431 | - * Create configuration endpoint for webapp to configure. |
|
1432 | - */ |
|
1433 | - new Config( $that->admin_setup, $that->key_validation_service ); |
|
1434 | - /** |
|
1435 | - * @since 3.31.7 |
|
1436 | - * Remove duplicate videoobject. |
|
1437 | - */ |
|
1438 | - new Videoobject_Duplicate_Remover(); |
|
1439 | - $synonym_loader = new \Wordlift\Synonym\Loader(); |
|
1440 | - $synonym_loader->init_feature(); |
|
1441 | - /** |
|
1442 | - * @since 3.32.0 |
|
1443 | - * Create loader for vocabulary terms. |
|
1444 | - */ |
|
1445 | - $vocabulary_terms_loader = new Vocabulary_Terms_Loader( Wordlift_Entity_Type_Service::get_instance(), $property_getter ); |
|
1446 | - $vocabulary_terms_loader->init_feature(); |
|
1447 | - |
|
1448 | - new Entity_Type_Change_Handler( |
|
1449 | - Wordlift_Entity_Service::get_instance(), |
|
1450 | - Wordlift_Entity_Type_Service::get_instance() |
|
1451 | - ); |
|
1452 | - |
|
1453 | - }, |
|
1454 | - 3 |
|
1455 | - ); |
|
1456 | - |
|
1457 | - new Entity_Type_Setter(); |
|
1458 | - $no_editor_analysis_loader = new \Wordlift\No_Editor_Analysis\Loader(); |
|
1459 | - $no_editor_analysis_loader->init_feature(); |
|
1460 | - } |
|
1461 | - |
|
1462 | - /** |
|
1463 | - * Define the locale for this plugin for internationalization. |
|
1464 | - * |
|
1465 | - * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
1466 | - * with WordPress. |
|
1467 | - * |
|
1468 | - * @since 1.0.0 |
|
1469 | - * @access private |
|
1470 | - */ |
|
1471 | - private function set_locale() { |
|
1472 | - |
|
1473 | - $plugin_i18n = new Wordlift_I18n(); |
|
1474 | - $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
1475 | - |
|
1476 | - $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
1477 | - |
|
1478 | - } |
|
1479 | - |
|
1480 | - /** |
|
1481 | - * Register all of the hooks related to the admin area functionality |
|
1482 | - * of the plugin. |
|
1483 | - * |
|
1484 | - * @since 1.0.0 |
|
1485 | - * @access private |
|
1486 | - */ |
|
1487 | - private function define_admin_hooks( $that ) { |
|
1488 | - $plugin_admin = new Wordlift_Admin( |
|
1489 | - $that->get_plugin_name(), |
|
1490 | - $that->get_version(), |
|
1491 | - $that->notice_service, |
|
1492 | - $that->user_service |
|
1493 | - ); |
|
1494 | - |
|
1495 | - $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
1496 | - $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
1497 | - |
|
1498 | - // Hook the `admin_init` function to the Admin Setup. |
|
1499 | - Assertions::is_set( $that->admin_setup, '`admin_setup` must be set' ); |
|
1500 | - $that->loader->add_action( 'admin_init', $that->admin_setup, 'admin_init' ); |
|
1501 | - |
|
1502 | - // Hook the admin_init to the settings page. |
|
1503 | - Assertions::is_set( $that->settings_page, '`setting_page` must be set' ); |
|
1504 | - $that->loader->add_action( 'admin_init', $that->settings_page, 'admin_init' ); |
|
1505 | - |
|
1506 | - // Hook the admin_init to the analytics settings page. |
|
1507 | - Assertions::is_set( $that->analytics_settings_page, '`analytics_setting_page` must be set' ); |
|
1508 | - $that->loader->add_action( 'admin_init', $that->analytics_settings_page, 'admin_init' ); |
|
1509 | - |
|
1510 | - // Hook the init action to taxonomy services. |
|
1511 | - $that->loader->add_action( 'init', $that->topic_taxonomy_service, 'init', 0 ); |
|
1512 | - $that->loader->add_action( 'init', $that->entity_types_taxonomy_service, 'init', 0 ); |
|
1513 | - |
|
1514 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
1515 | - $that->loader->add_action( 'wp_ajax_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
1516 | - |
|
1517 | - // Register custom allowed redirect hosts. |
|
1518 | - $that->loader->add_filter( 'allowed_redirect_hosts', $that->redirect_service, 'allowed_redirect_hosts' ); |
|
1519 | - // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
1520 | - $that->loader->add_action( 'wp_ajax_wordlift_redirect', $that->redirect_service, 'ajax_redirect' ); |
|
1521 | - |
|
1522 | - // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
1523 | - // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
1524 | - $that->loader->add_action( 'save_post', Wordlift_Entity_Service::get_instance(), 'save_post', 9, 2 ); |
|
1525 | - $that->loader->add_action( 'save_post', $that->rating_service, 'set_rating_for', 20, 1 ); |
|
1526 | - |
|
1527 | - $that->loader->add_action( 'edit_form_before_permalink', Wordlift_Entity_Service::get_instance(), 'edit_form_before_permalink', 10, 1 ); |
|
1528 | - $that->loader->add_action( 'in_admin_header', $that->rating_service, 'in_admin_header' ); |
|
1529 | - |
|
1530 | - // Entity listing customization (wp-admin/edit.php) |
|
1531 | - // Add custom columns. |
|
1532 | - $that->loader->add_filter( 'manage_entity_posts_columns', $that->entity_list_service, 'register_custom_columns' ); |
|
1533 | - // no explicit entity as it prevents handling of other post types. |
|
1534 | - $that->loader->add_filter( 'manage_posts_custom_column', $that->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
1535 | - // Add 4W selection. |
|
1536 | - $that->loader->add_action( 'restrict_manage_posts', $that->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
1537 | - $that->loader->add_filter( 'posts_clauses', $that->entity_list_service, 'posts_clauses_classification_scope' ); |
|
1538 | - $that->loader->add_action( 'pre_get_posts', $that->entity_list_service, 'pre_get_posts' ); |
|
1539 | - $that->loader->add_action( 'load-edit.php', $that->entity_list_service, 'load_edit' ); |
|
1540 | - |
|
1541 | - /* |
|
1330 | + new Templates_Ajax_Endpoint(); |
|
1331 | + // Call this static method to register FAQ routes to rest api - disabled |
|
1332 | + // Faq_Rest_Controller::register_routes(); |
|
1333 | + |
|
1334 | + $that->storage_factory = new Wordlift_Storage_Factory( Wordlift_Entity_Service::get_instance(), $that->user_service, $property_getter ); |
|
1335 | + |
|
1336 | + /** WL Autocomplete. */ |
|
1337 | + $autocomplete_service = new All_Autocomplete_Service( |
|
1338 | + array( |
|
1339 | + new Local_Autocomplete_Service(), |
|
1340 | + new Linked_Data_Autocomplete_Service( Entity_Helper::get_instance(), $that->entity_uri_service, Wordlift_Entity_Service::get_instance() ), |
|
1341 | + ) |
|
1342 | + ); |
|
1343 | + $that->autocomplete_adapter = new Wordlift_Autocomplete_Adapter( $autocomplete_service ); |
|
1344 | + |
|
1345 | + /** |
|
1346 | + * @since 3.27.2 |
|
1347 | + * Integrate the recipe maker jsonld & set recipe |
|
1348 | + * as default entity type to the wprm_recipe CPT. |
|
1349 | + */ |
|
1350 | + new Recipe_Maker_Post_Type_Hook(); |
|
1351 | + $recipe_maker_validation_service = new Recipe_Maker_Validation_Service(); |
|
1352 | + new Recipe_Maker_Jsonld_Hook( $attachment_service, $recipe_maker_validation_service ); |
|
1353 | + new Recipe_Maker_After_Get_Jsonld_Hook( $recipe_maker_validation_service ); |
|
1354 | + new Recipe_Maker_Jsonld_Swap( $recipe_maker_validation_service, $that->jsonld_service ); |
|
1355 | + new Recipe_Maker_Warning( $recipe_maker_validation_service ); |
|
1356 | + |
|
1357 | + /** |
|
1358 | + * Avada Builder compatibility. |
|
1359 | + * |
|
1360 | + * @since 3.40.0 |
|
1361 | + */ |
|
1362 | + new Avada_Builder_Support(); |
|
1363 | + |
|
1364 | + new Duplicate_Markup_Remover(); |
|
1365 | + |
|
1366 | + /** |
|
1367 | + * @since 3.27.8 |
|
1368 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1248 |
|
1369 | + */ |
|
1370 | + new Key_Validation_Notice( $that->key_validation_service, Wordlift_Configuration_Service::get_instance() ); |
|
1371 | + |
|
1372 | + /** |
|
1373 | + * @since 3.28.0 |
|
1374 | + * @see https://github.com/insideout10/wordlift-plugin/issues?q=assignee%3Anaveen17797+is%3Aopen |
|
1375 | + */ |
|
1376 | + new Entity_No_Index_Flag(); |
|
1377 | + |
|
1378 | + /** |
|
1379 | + * @since 3.29.0 |
|
1380 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1304 |
|
1381 | + */ |
|
1382 | + new Entity_Rest_Service( Wordlift_Entity_Type_Service::get_instance() ); |
|
1383 | + |
|
1384 | + /** |
|
1385 | + * Expand author in to references. |
|
1386 | + * |
|
1387 | + * @since 3.30.0 |
|
1388 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1318 |
|
1389 | + */ |
|
1390 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1391 | + if ( apply_filters( 'wl_feature__enable__article-wrapper', false ) ) { |
|
1392 | + new Jsonld_Article_Wrapper( Wordlift_Post_To_Jsonld_Converter::get_instance(), $that->cached_postid_to_jsonld_converter ); |
|
1393 | + } |
|
1394 | + |
|
1395 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1396 | + if ( apply_filters( 'wl_feature__enable__match-terms', false ) ) { |
|
1397 | + $vocabulary_loader = new Vocabulary_Loader(); |
|
1398 | + $vocabulary_loader->init_vocabulary(); |
|
1399 | + } |
|
1400 | + |
|
1401 | + /** |
|
1402 | + * Added for feature request 1496 (Webhooks) |
|
1403 | + */ |
|
1404 | + if ( apply_filters( 'wl_feature__enable__webhooks', false ) ) { |
|
1405 | + $that->webhook_loader = new Webhooks_Loader(); |
|
1406 | + $that->webhook_loader->init(); |
|
1407 | + } |
|
1408 | + |
|
1409 | + /** |
|
1410 | + * @since 3.30.0 |
|
1411 | + * Add a checkbox to user option screen for wordlift admin. |
|
1412 | + */ |
|
1413 | + $wordlift_admin_checkbox = new Admin_User_Option(); |
|
1414 | + $wordlift_admin_checkbox->connect_hook(); |
|
1415 | + |
|
1416 | + /** |
|
1417 | + * @since 3.31.0 |
|
1418 | + * Init loader class for videoobject. |
|
1419 | + */ |
|
1420 | + $videoobject_loader = new Loader(); |
|
1421 | + $videoobject_loader->init_feature(); |
|
1422 | + |
|
1423 | + /** |
|
1424 | + * @since 3.35.0 |
|
1425 | + */ |
|
1426 | + $google_addon_integration_loader = new \Wordlift\Google_Addon_Integration\Loader(); |
|
1427 | + $google_addon_integration_loader->init_feature(); |
|
1428 | + |
|
1429 | + /** |
|
1430 | + * @since 3.31.5 |
|
1431 | + * Create configuration endpoint for webapp to configure. |
|
1432 | + */ |
|
1433 | + new Config( $that->admin_setup, $that->key_validation_service ); |
|
1434 | + /** |
|
1435 | + * @since 3.31.7 |
|
1436 | + * Remove duplicate videoobject. |
|
1437 | + */ |
|
1438 | + new Videoobject_Duplicate_Remover(); |
|
1439 | + $synonym_loader = new \Wordlift\Synonym\Loader(); |
|
1440 | + $synonym_loader->init_feature(); |
|
1441 | + /** |
|
1442 | + * @since 3.32.0 |
|
1443 | + * Create loader for vocabulary terms. |
|
1444 | + */ |
|
1445 | + $vocabulary_terms_loader = new Vocabulary_Terms_Loader( Wordlift_Entity_Type_Service::get_instance(), $property_getter ); |
|
1446 | + $vocabulary_terms_loader->init_feature(); |
|
1447 | + |
|
1448 | + new Entity_Type_Change_Handler( |
|
1449 | + Wordlift_Entity_Service::get_instance(), |
|
1450 | + Wordlift_Entity_Type_Service::get_instance() |
|
1451 | + ); |
|
1452 | + |
|
1453 | + }, |
|
1454 | + 3 |
|
1455 | + ); |
|
1456 | + |
|
1457 | + new Entity_Type_Setter(); |
|
1458 | + $no_editor_analysis_loader = new \Wordlift\No_Editor_Analysis\Loader(); |
|
1459 | + $no_editor_analysis_loader->init_feature(); |
|
1460 | + } |
|
1461 | + |
|
1462 | + /** |
|
1463 | + * Define the locale for this plugin for internationalization. |
|
1464 | + * |
|
1465 | + * Uses the Wordlift_i18n class in order to set the domain and to register the hook |
|
1466 | + * with WordPress. |
|
1467 | + * |
|
1468 | + * @since 1.0.0 |
|
1469 | + * @access private |
|
1470 | + */ |
|
1471 | + private function set_locale() { |
|
1472 | + |
|
1473 | + $plugin_i18n = new Wordlift_I18n(); |
|
1474 | + $plugin_i18n->set_domain( $this->get_plugin_name() ); |
|
1475 | + |
|
1476 | + $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' ); |
|
1477 | + |
|
1478 | + } |
|
1479 | + |
|
1480 | + /** |
|
1481 | + * Register all of the hooks related to the admin area functionality |
|
1482 | + * of the plugin. |
|
1483 | + * |
|
1484 | + * @since 1.0.0 |
|
1485 | + * @access private |
|
1486 | + */ |
|
1487 | + private function define_admin_hooks( $that ) { |
|
1488 | + $plugin_admin = new Wordlift_Admin( |
|
1489 | + $that->get_plugin_name(), |
|
1490 | + $that->get_version(), |
|
1491 | + $that->notice_service, |
|
1492 | + $that->user_service |
|
1493 | + ); |
|
1494 | + |
|
1495 | + $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); |
|
1496 | + $that->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts', 11 ); |
|
1497 | + |
|
1498 | + // Hook the `admin_init` function to the Admin Setup. |
|
1499 | + Assertions::is_set( $that->admin_setup, '`admin_setup` must be set' ); |
|
1500 | + $that->loader->add_action( 'admin_init', $that->admin_setup, 'admin_init' ); |
|
1501 | + |
|
1502 | + // Hook the admin_init to the settings page. |
|
1503 | + Assertions::is_set( $that->settings_page, '`setting_page` must be set' ); |
|
1504 | + $that->loader->add_action( 'admin_init', $that->settings_page, 'admin_init' ); |
|
1505 | + |
|
1506 | + // Hook the admin_init to the analytics settings page. |
|
1507 | + Assertions::is_set( $that->analytics_settings_page, '`analytics_setting_page` must be set' ); |
|
1508 | + $that->loader->add_action( 'admin_init', $that->analytics_settings_page, 'admin_init' ); |
|
1509 | + |
|
1510 | + // Hook the init action to taxonomy services. |
|
1511 | + $that->loader->add_action( 'init', $that->topic_taxonomy_service, 'init', 0 ); |
|
1512 | + $that->loader->add_action( 'init', $that->entity_types_taxonomy_service, 'init', 0 ); |
|
1513 | + |
|
1514 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
1515 | + $that->loader->add_action( 'wp_ajax_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
1516 | + |
|
1517 | + // Register custom allowed redirect hosts. |
|
1518 | + $that->loader->add_filter( 'allowed_redirect_hosts', $that->redirect_service, 'allowed_redirect_hosts' ); |
|
1519 | + // Hook the AJAX wordlift_redirect action to the Redirect service. |
|
1520 | + $that->loader->add_action( 'wp_ajax_wordlift_redirect', $that->redirect_service, 'ajax_redirect' ); |
|
1521 | + |
|
1522 | + // Hook save_post to the entity service to update custom fields (such as alternate labels). |
|
1523 | + // We have a priority of 9 because we want to be executed before data is sent to Redlink. |
|
1524 | + $that->loader->add_action( 'save_post', Wordlift_Entity_Service::get_instance(), 'save_post', 9, 2 ); |
|
1525 | + $that->loader->add_action( 'save_post', $that->rating_service, 'set_rating_for', 20, 1 ); |
|
1526 | + |
|
1527 | + $that->loader->add_action( 'edit_form_before_permalink', Wordlift_Entity_Service::get_instance(), 'edit_form_before_permalink', 10, 1 ); |
|
1528 | + $that->loader->add_action( 'in_admin_header', $that->rating_service, 'in_admin_header' ); |
|
1529 | + |
|
1530 | + // Entity listing customization (wp-admin/edit.php) |
|
1531 | + // Add custom columns. |
|
1532 | + $that->loader->add_filter( 'manage_entity_posts_columns', $that->entity_list_service, 'register_custom_columns' ); |
|
1533 | + // no explicit entity as it prevents handling of other post types. |
|
1534 | + $that->loader->add_filter( 'manage_posts_custom_column', $that->entity_list_service, 'render_custom_columns', 10, 2 ); |
|
1535 | + // Add 4W selection. |
|
1536 | + $that->loader->add_action( 'restrict_manage_posts', $that->entity_list_service, 'restrict_manage_posts_classification_scope' ); |
|
1537 | + $that->loader->add_filter( 'posts_clauses', $that->entity_list_service, 'posts_clauses_classification_scope' ); |
|
1538 | + $that->loader->add_action( 'pre_get_posts', $that->entity_list_service, 'pre_get_posts' ); |
|
1539 | + $that->loader->add_action( 'load-edit.php', $that->entity_list_service, 'load_edit' ); |
|
1540 | + |
|
1541 | + /* |
|
1542 | 1542 | * If `All Entity Types` is disable, use the radio button Walker. |
1543 | 1543 | * |
1544 | 1544 | * @see https://github.com/insideout10/wordlift-plugin/issues/835 |
1545 | 1545 | */ |
1546 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1547 | - if ( ! apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) |
|
1548 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1549 | - && ! apply_filters( 'wl_feature__enable__entity-types-professional', false ) |
|
1550 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1551 | - && ! apply_filters( 'wl_feature__enable__entity-types-business', false ) |
|
1552 | - ) { |
|
1553 | - $that->loader->add_filter( 'wp_terms_checklist_args', $that->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
1554 | - } |
|
1555 | - |
|
1556 | - // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
1557 | - // entities. |
|
1558 | - $that->loader->add_filter( 'prima_metabox_entity_header_args', $that->primashop_adapter, 'prima_metabox_entity_header_args', 10 ); |
|
1559 | - |
|
1560 | - /** |
|
1561 | - * Filter: wl_feature__enable__settings-download. |
|
1562 | - * |
|
1563 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
1564 | - * |
|
1565 | - * @return bool |
|
1566 | - * @since 3.27.6 |
|
1567 | - */ |
|
1568 | - $that->features_registry->register_feature_from_slug( |
|
1569 | - 'settings-download', |
|
1570 | - true, |
|
1571 | - array( |
|
1572 | - $that, |
|
1573 | - 'register_screens', |
|
1574 | - ) |
|
1575 | - ); |
|
1576 | - |
|
1577 | - // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
1578 | - $that->loader->add_action( 'wp_ajax_wl_download_your_data', $that->download_your_data_page, 'download_your_data', 10 ); |
|
1579 | - |
|
1580 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
1581 | - $that->loader->add_action( 'wp_ajax_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1582 | - $that->loader->add_action( 'admin_post_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1583 | - $that->loader->add_action( 'admin_post_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1584 | - |
|
1585 | - // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
1586 | - $that->loader->add_action( 'wp_ajax_wl_validate_key', $that->key_validation_service, 'validate_key' ); |
|
1587 | - |
|
1588 | - // Hook the AJAX wl_update_country_options action to the countries. |
|
1589 | - $that->loader->add_action( 'wp_ajax_wl_update_country_options', $that->country_select_element, 'get_options_html' ); |
|
1590 | - |
|
1591 | - $that->loader->add_filter( 'admin_post_thumbnail_html', $that->publisher_service, 'add_featured_image_instruction' ); |
|
1592 | - |
|
1593 | - // Hook the menu creation on the general wordlift menu creation. |
|
1594 | - /** |
|
1595 | - * Filter: wl_feature__enable__screens. |
|
1596 | - * |
|
1597 | - * @param bool whether the screens needed to be registered, defaults to true. |
|
1598 | - * |
|
1599 | - * @return bool |
|
1600 | - * @since 3.27.6 |
|
1601 | - * |
|
1602 | - * Since 3.30.0 this feature is registered using registry. |
|
1603 | - */ |
|
1604 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1605 | - if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) { |
|
1606 | - add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 ); |
|
1607 | - } |
|
1608 | - |
|
1609 | - // Hook key update. |
|
1610 | - $that->loader->add_action( 'pre_update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'maybe_update_dataset_uri', 10, 2 ); |
|
1611 | - $that->loader->add_action( 'update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'update_key', 10, 2 ); |
|
1612 | - |
|
1613 | - // Add additional action links to the WordLift plugin in the plugins page. |
|
1614 | - $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->settings_page_action_link, 'action_links', 10, 1 ); |
|
1615 | - |
|
1616 | - /* |
|
1546 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1547 | + if ( ! apply_filters( 'wl_feature__enable__all-entity-types', WL_ALL_ENTITY_TYPES ) |
|
1548 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1549 | + && ! apply_filters( 'wl_feature__enable__entity-types-professional', false ) |
|
1550 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1551 | + && ! apply_filters( 'wl_feature__enable__entity-types-business', false ) |
|
1552 | + ) { |
|
1553 | + $that->loader->add_filter( 'wp_terms_checklist_args', $that->entity_types_taxonomy_walker, 'terms_checklist_args' ); |
|
1554 | + } |
|
1555 | + |
|
1556 | + // Hook the PrimaShop adapter to <em>prima_metabox_entity_header_args</em> in order to add header support for |
|
1557 | + // entities. |
|
1558 | + $that->loader->add_filter( 'prima_metabox_entity_header_args', $that->primashop_adapter, 'prima_metabox_entity_header_args', 10 ); |
|
1559 | + |
|
1560 | + /** |
|
1561 | + * Filter: wl_feature__enable__settings-download. |
|
1562 | + * |
|
1563 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
1564 | + * |
|
1565 | + * @return bool |
|
1566 | + * @since 3.27.6 |
|
1567 | + */ |
|
1568 | + $that->features_registry->register_feature_from_slug( |
|
1569 | + 'settings-download', |
|
1570 | + true, |
|
1571 | + array( |
|
1572 | + $that, |
|
1573 | + 'register_screens', |
|
1574 | + ) |
|
1575 | + ); |
|
1576 | + |
|
1577 | + // Hook the admin-ajax.php?action=wl_download_your_data&out=xyz links. |
|
1578 | + $that->loader->add_action( 'wp_ajax_wl_download_your_data', $that->download_your_data_page, 'download_your_data', 10 ); |
|
1579 | + |
|
1580 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
1581 | + $that->loader->add_action( 'wp_ajax_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1582 | + $that->loader->add_action( 'admin_post_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1583 | + $that->loader->add_action( 'admin_post_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1584 | + |
|
1585 | + // Hook the AJAX wl_validate_key action to the Key Validation service. |
|
1586 | + $that->loader->add_action( 'wp_ajax_wl_validate_key', $that->key_validation_service, 'validate_key' ); |
|
1587 | + |
|
1588 | + // Hook the AJAX wl_update_country_options action to the countries. |
|
1589 | + $that->loader->add_action( 'wp_ajax_wl_update_country_options', $that->country_select_element, 'get_options_html' ); |
|
1590 | + |
|
1591 | + $that->loader->add_filter( 'admin_post_thumbnail_html', $that->publisher_service, 'add_featured_image_instruction' ); |
|
1592 | + |
|
1593 | + // Hook the menu creation on the general wordlift menu creation. |
|
1594 | + /** |
|
1595 | + * Filter: wl_feature__enable__screens. |
|
1596 | + * |
|
1597 | + * @param bool whether the screens needed to be registered, defaults to true. |
|
1598 | + * |
|
1599 | + * @return bool |
|
1600 | + * @since 3.27.6 |
|
1601 | + * |
|
1602 | + * Since 3.30.0 this feature is registered using registry. |
|
1603 | + */ |
|
1604 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1605 | + if ( apply_filters( 'wl_feature__enable__settings-screen', true ) || Admin_User_Option::is_wordlift_admin() ) { |
|
1606 | + add_action( 'wl_admin_menu', array( $that->settings_page, 'admin_menu' ), 10, 2 ); |
|
1607 | + } |
|
1608 | + |
|
1609 | + // Hook key update. |
|
1610 | + $that->loader->add_action( 'pre_update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'maybe_update_dataset_uri', 10, 2 ); |
|
1611 | + $that->loader->add_action( 'update_option_wl_general_settings', Wordlift_Configuration_Service::get_instance(), 'update_key', 10, 2 ); |
|
1612 | + |
|
1613 | + // Add additional action links to the WordLift plugin in the plugins page. |
|
1614 | + $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->settings_page_action_link, 'action_links', 10, 1 ); |
|
1615 | + |
|
1616 | + /* |
|
1617 | 1617 | * Remove the Analytics Settings link from the plugin page. |
1618 | 1618 | * |
1619 | 1619 | * @see https://github.com/insideout10/wordlift-plugin/issues/932 |
1620 | 1620 | * @since 3.21.1 |
1621 | 1621 | */ |
1622 | - // $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
1623 | - |
|
1624 | - // Hook the AJAX `wl_publisher` action name. |
|
1625 | - $that->loader->add_action( 'wp_ajax_wl_publisher', $that->publisher_ajax_adapter, 'publisher' ); |
|
1626 | - |
|
1627 | - // Hook row actions for the entity type list admin. |
|
1628 | - $that->loader->add_filter( 'wl_entity_type_row_actions', $that->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
1629 | - |
|
1630 | - /** Ajax actions. */ |
|
1631 | - $that->loader->add_action( 'wp_ajax_wl_google_analytics_export', $that->google_analytics_export_service, 'export' ); |
|
1632 | - |
|
1633 | - // Hook capabilities manipulation to allow access to entity type admin |
|
1634 | - // page on WordPress versions before 4.7. |
|
1635 | - global $wp_version; |
|
1636 | - if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
1637 | - $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 2 ); |
|
1638 | - } |
|
1639 | - |
|
1640 | - /** Adapters. */ |
|
1641 | - $that->loader->add_filter( 'mce_external_plugins', $that->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
1642 | - /** |
|
1643 | - * Disabling Faq temporarily. |
|
1644 | - * Load the tinymce editor button on the tool bar. |
|
1645 | - * |
|
1646 | - * @since 3.26.0 |
|
1647 | - */ |
|
1648 | - // $that->loader->add_filter( 'tiny_mce_before_init', $that->faq_tinymce_adapter, 'register_custom_tags' ); |
|
1649 | - // $that->loader->add_filter( 'mce_buttons', $that->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
1650 | - // $that->loader->add_filter( 'mce_external_plugins', $that->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
1651 | - |
|
1652 | - $that->loader->add_action( 'wp_ajax_wl_sample_data_create', $that->sample_data_ajax_adapter, 'create' ); |
|
1653 | - $that->loader->add_action( 'wp_ajax_wl_sample_data_delete', $that->sample_data_ajax_adapter, 'delete' ); |
|
1654 | - |
|
1655 | - /** |
|
1656 | - * @since 3.26.0 |
|
1657 | - */ |
|
1658 | - $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
1659 | - $that->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
1660 | - // Adding Rest route for the post excerpt |
|
1661 | - Post_Excerpt_Rest_Controller::register_routes(); |
|
1662 | - |
|
1663 | - // Handle the autocomplete request. |
|
1664 | - add_action( |
|
1665 | - 'wp_ajax_wl_autocomplete', |
|
1666 | - array( |
|
1667 | - $that->autocomplete_adapter, |
|
1668 | - 'wl_autocomplete', |
|
1669 | - ) |
|
1670 | - ); |
|
1671 | - add_action( |
|
1672 | - 'wp_ajax_nopriv_wl_autocomplete', |
|
1673 | - array( |
|
1674 | - $that->autocomplete_adapter, |
|
1675 | - 'wl_autocomplete', |
|
1676 | - ) |
|
1677 | - ); |
|
1678 | - |
|
1679 | - // Hooks to restrict multisite super admin from manipulating entity types. |
|
1680 | - if ( is_multisite() ) { |
|
1681 | - $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'restrict_super_admin', 10, 2 ); |
|
1682 | - } |
|
1683 | - |
|
1684 | - $deactivator_feedback = new Wordlift_Deactivator_Feedback(); |
|
1685 | - |
|
1686 | - add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
1687 | - add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
1688 | - add_action( |
|
1689 | - 'wp_ajax_wl_deactivation_feedback', |
|
1690 | - array( |
|
1691 | - $deactivator_feedback, |
|
1692 | - 'wl_deactivation_feedback', |
|
1693 | - ) |
|
1694 | - ); |
|
1695 | - |
|
1696 | - /** |
|
1697 | - * Always allow the `wordlift/classification` block. |
|
1698 | - * |
|
1699 | - * @since 3.23.0 |
|
1700 | - */ |
|
1701 | - add_filter( |
|
1702 | - 'allowed_block_types', |
|
1703 | - function ( $value ) { |
|
1704 | - |
|
1705 | - if ( true === $value ) { |
|
1706 | - return $value; |
|
1707 | - } |
|
1708 | - |
|
1709 | - return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
1710 | - }, |
|
1711 | - PHP_INT_MAX |
|
1712 | - ); |
|
1713 | - |
|
1714 | - /** |
|
1715 | - * @since 3.27.7 |
|
1716 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
1717 | - */ |
|
1718 | - new Top_Entities(); |
|
1719 | - |
|
1720 | - add_action( |
|
1721 | - 'admin_notices', |
|
1722 | - function () { |
|
1723 | - if ( apply_filters( 'wl_feature__enable__notices', true ) ) { |
|
1724 | - /** |
|
1725 | - * Fired when the notice feature is enabled. |
|
1726 | - * |
|
1727 | - * @since 3.40.4 |
|
1728 | - */ |
|
1729 | - do_action( 'wordlift_admin_notices' ); |
|
1730 | - } |
|
1731 | - } |
|
1732 | - ); |
|
1733 | - |
|
1734 | - add_action( |
|
1735 | - 'admin_init', |
|
1736 | - function () { |
|
1737 | - // Only show the notice when the key is set or skipped. |
|
1738 | - if ( \Wordlift_Configuration_Service::get_instance()->get_key() && ! \Wordlift_Configuration_Service::get_instance()->get_skip_installation_notice() ) { |
|
1739 | - $installation_complete_notice = new Installation_Complete_Notice(); |
|
1740 | - $installation_complete_notice->init(); |
|
1741 | - } |
|
1742 | - } |
|
1743 | - ); |
|
1744 | - |
|
1745 | - } |
|
1746 | - |
|
1747 | - /** |
|
1748 | - * Register all of the hooks related to the public-facing functionality |
|
1749 | - * of the plugin. |
|
1750 | - * |
|
1751 | - * @since 1.0.0 |
|
1752 | - * @access private |
|
1753 | - */ |
|
1754 | - private function define_public_hooks( $that ) { |
|
1755 | - |
|
1756 | - $plugin_public = new Wordlift_Public( $that->get_plugin_name(), $that->get_version() ); |
|
1757 | - |
|
1758 | - // Register the entity post type. |
|
1759 | - $that->loader->add_action( 'init', $that->entity_post_type_service, 'register' ); |
|
1760 | - |
|
1761 | - // Bind the link generation and handling hooks to the entity link service. |
|
1762 | - $that->loader->add_filter( 'post_type_link', $that->entity_link_service, 'post_type_link', 10, 2 ); |
|
1763 | - $that->loader->add_action( 'pre_get_posts', $that->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
1764 | - |
|
1765 | - $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
1766 | - $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
1767 | - $that->loader->add_action( 'wp_enqueue_scripts', $that->context_cards_service, 'enqueue_scripts' ); |
|
1768 | - |
|
1769 | - // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
1770 | - $that->loader->add_filter( 'the_content', $that->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
1771 | - // Hook the content filter service to add entity links. |
|
1772 | - if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
1773 | - // We run before other filters. |
|
1774 | - $that->loader->add_filter( 'the_content', $that->content_filter_service, 'the_content', 9 ); |
|
1775 | - } |
|
1776 | - |
|
1777 | - // Hook the AJAX wl_timeline action to the Timeline service. |
|
1778 | - $that->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
1779 | - |
|
1780 | - // Hook the ShareThis service. |
|
1781 | - $that->loader->add_filter( 'the_content', $that->sharethis_service, 'the_content', 99 ); |
|
1782 | - $that->loader->add_filter( 'the_excerpt', $that->sharethis_service, 'the_excerpt', 99 ); |
|
1783 | - |
|
1784 | - // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
1785 | - $that->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1786 | - |
|
1787 | - // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
1788 | - // in order to tweak WP's `WP_Query` to include entities in queries related |
|
1789 | - // to categories. |
|
1790 | - $that->loader->add_action( 'pre_get_posts', $that->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
1791 | - |
|
1792 | - /* |
|
1622 | + // $that->loader->add_filter( 'plugin_action_links_wordlift/wordlift.php', $that->analytics_settings_page_action_link, 'action_links', 10, 1 ); |
|
1623 | + |
|
1624 | + // Hook the AJAX `wl_publisher` action name. |
|
1625 | + $that->loader->add_action( 'wp_ajax_wl_publisher', $that->publisher_ajax_adapter, 'publisher' ); |
|
1626 | + |
|
1627 | + // Hook row actions for the entity type list admin. |
|
1628 | + $that->loader->add_filter( 'wl_entity_type_row_actions', $that->entity_type_admin_page, 'wl_entity_type_row_actions', 10, 2 ); |
|
1629 | + |
|
1630 | + /** Ajax actions. */ |
|
1631 | + $that->loader->add_action( 'wp_ajax_wl_google_analytics_export', $that->google_analytics_export_service, 'export' ); |
|
1632 | + |
|
1633 | + // Hook capabilities manipulation to allow access to entity type admin |
|
1634 | + // page on WordPress versions before 4.7. |
|
1635 | + global $wp_version; |
|
1636 | + if ( version_compare( $wp_version, '4.7', '<' ) ) { |
|
1637 | + $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'enable_admin_access_pre_47', 10, 2 ); |
|
1638 | + } |
|
1639 | + |
|
1640 | + /** Adapters. */ |
|
1641 | + $that->loader->add_filter( 'mce_external_plugins', $that->tinymce_adapter, 'mce_external_plugins', 10, 1 ); |
|
1642 | + /** |
|
1643 | + * Disabling Faq temporarily. |
|
1644 | + * Load the tinymce editor button on the tool bar. |
|
1645 | + * |
|
1646 | + * @since 3.26.0 |
|
1647 | + */ |
|
1648 | + // $that->loader->add_filter( 'tiny_mce_before_init', $that->faq_tinymce_adapter, 'register_custom_tags' ); |
|
1649 | + // $that->loader->add_filter( 'mce_buttons', $that->faq_tinymce_adapter, 'register_faq_toolbar_button', 10, 1 ); |
|
1650 | + // $that->loader->add_filter( 'mce_external_plugins', $that->faq_tinymce_adapter, 'register_faq_tinymce_plugin', 10, 1 ); |
|
1651 | + |
|
1652 | + $that->loader->add_action( 'wp_ajax_wl_sample_data_create', $that->sample_data_ajax_adapter, 'create' ); |
|
1653 | + $that->loader->add_action( 'wp_ajax_wl_sample_data_delete', $that->sample_data_ajax_adapter, 'delete' ); |
|
1654 | + |
|
1655 | + /** |
|
1656 | + * @since 3.26.0 |
|
1657 | + */ |
|
1658 | + $excerpt_adapter = new Post_Excerpt_Meta_Box_Adapter(); |
|
1659 | + $that->loader->add_action( 'do_meta_boxes', $excerpt_adapter, 'replace_post_excerpt_meta_box' ); |
|
1660 | + // Adding Rest route for the post excerpt |
|
1661 | + Post_Excerpt_Rest_Controller::register_routes(); |
|
1662 | + |
|
1663 | + // Handle the autocomplete request. |
|
1664 | + add_action( |
|
1665 | + 'wp_ajax_wl_autocomplete', |
|
1666 | + array( |
|
1667 | + $that->autocomplete_adapter, |
|
1668 | + 'wl_autocomplete', |
|
1669 | + ) |
|
1670 | + ); |
|
1671 | + add_action( |
|
1672 | + 'wp_ajax_nopriv_wl_autocomplete', |
|
1673 | + array( |
|
1674 | + $that->autocomplete_adapter, |
|
1675 | + 'wl_autocomplete', |
|
1676 | + ) |
|
1677 | + ); |
|
1678 | + |
|
1679 | + // Hooks to restrict multisite super admin from manipulating entity types. |
|
1680 | + if ( is_multisite() ) { |
|
1681 | + $that->loader->add_filter( 'map_meta_cap', $that->entity_type_admin_page, 'restrict_super_admin', 10, 2 ); |
|
1682 | + } |
|
1683 | + |
|
1684 | + $deactivator_feedback = new Wordlift_Deactivator_Feedback(); |
|
1685 | + |
|
1686 | + add_action( 'admin_footer', array( $deactivator_feedback, 'render_feedback_popup' ) ); |
|
1687 | + add_action( 'admin_enqueue_scripts', array( $deactivator_feedback, 'enqueue_popup_scripts' ) ); |
|
1688 | + add_action( |
|
1689 | + 'wp_ajax_wl_deactivation_feedback', |
|
1690 | + array( |
|
1691 | + $deactivator_feedback, |
|
1692 | + 'wl_deactivation_feedback', |
|
1693 | + ) |
|
1694 | + ); |
|
1695 | + |
|
1696 | + /** |
|
1697 | + * Always allow the `wordlift/classification` block. |
|
1698 | + * |
|
1699 | + * @since 3.23.0 |
|
1700 | + */ |
|
1701 | + add_filter( |
|
1702 | + 'allowed_block_types', |
|
1703 | + function ( $value ) { |
|
1704 | + |
|
1705 | + if ( true === $value ) { |
|
1706 | + return $value; |
|
1707 | + } |
|
1708 | + |
|
1709 | + return array_merge( (array) $value, array( 'wordlift/classification' ) ); |
|
1710 | + }, |
|
1711 | + PHP_INT_MAX |
|
1712 | + ); |
|
1713 | + |
|
1714 | + /** |
|
1715 | + * @since 3.27.7 |
|
1716 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
1717 | + */ |
|
1718 | + new Top_Entities(); |
|
1719 | + |
|
1720 | + add_action( |
|
1721 | + 'admin_notices', |
|
1722 | + function () { |
|
1723 | + if ( apply_filters( 'wl_feature__enable__notices', true ) ) { |
|
1724 | + /** |
|
1725 | + * Fired when the notice feature is enabled. |
|
1726 | + * |
|
1727 | + * @since 3.40.4 |
|
1728 | + */ |
|
1729 | + do_action( 'wordlift_admin_notices' ); |
|
1730 | + } |
|
1731 | + } |
|
1732 | + ); |
|
1733 | + |
|
1734 | + add_action( |
|
1735 | + 'admin_init', |
|
1736 | + function () { |
|
1737 | + // Only show the notice when the key is set or skipped. |
|
1738 | + if ( \Wordlift_Configuration_Service::get_instance()->get_key() && ! \Wordlift_Configuration_Service::get_instance()->get_skip_installation_notice() ) { |
|
1739 | + $installation_complete_notice = new Installation_Complete_Notice(); |
|
1740 | + $installation_complete_notice->init(); |
|
1741 | + } |
|
1742 | + } |
|
1743 | + ); |
|
1744 | + |
|
1745 | + } |
|
1746 | + |
|
1747 | + /** |
|
1748 | + * Register all of the hooks related to the public-facing functionality |
|
1749 | + * of the plugin. |
|
1750 | + * |
|
1751 | + * @since 1.0.0 |
|
1752 | + * @access private |
|
1753 | + */ |
|
1754 | + private function define_public_hooks( $that ) { |
|
1755 | + |
|
1756 | + $plugin_public = new Wordlift_Public( $that->get_plugin_name(), $that->get_version() ); |
|
1757 | + |
|
1758 | + // Register the entity post type. |
|
1759 | + $that->loader->add_action( 'init', $that->entity_post_type_service, 'register' ); |
|
1760 | + |
|
1761 | + // Bind the link generation and handling hooks to the entity link service. |
|
1762 | + $that->loader->add_filter( 'post_type_link', $that->entity_link_service, 'post_type_link', 10, 2 ); |
|
1763 | + $that->loader->add_action( 'pre_get_posts', $that->entity_link_service, 'pre_get_posts', PHP_INT_MAX, 1 ); |
|
1764 | + |
|
1765 | + $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); |
|
1766 | + $that->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); |
|
1767 | + $that->loader->add_action( 'wp_enqueue_scripts', $that->context_cards_service, 'enqueue_scripts' ); |
|
1768 | + |
|
1769 | + // Registering Faq_Content_Filter service used for removing faq question and answer tags from the html. |
|
1770 | + $that->loader->add_filter( 'the_content', $that->faq_content_filter_service, 'remove_all_faq_question_and_answer_tags' ); |
|
1771 | + // Hook the content filter service to add entity links. |
|
1772 | + if ( ! defined( 'WL_DISABLE_CONTENT_FILTER' ) || ! WL_DISABLE_CONTENT_FILTER ) { |
|
1773 | + // We run before other filters. |
|
1774 | + $that->loader->add_filter( 'the_content', $that->content_filter_service, 'the_content', 9 ); |
|
1775 | + } |
|
1776 | + |
|
1777 | + // Hook the AJAX wl_timeline action to the Timeline service. |
|
1778 | + $that->loader->add_action( 'wp_ajax_nopriv_wl_timeline', $that->timeline_service, 'ajax_timeline' ); |
|
1779 | + |
|
1780 | + // Hook the ShareThis service. |
|
1781 | + $that->loader->add_filter( 'the_content', $that->sharethis_service, 'the_content', 99 ); |
|
1782 | + $that->loader->add_filter( 'the_excerpt', $that->sharethis_service, 'the_excerpt', 99 ); |
|
1783 | + |
|
1784 | + // Hook the AJAX wl_jsonld action to the JSON-LD service. |
|
1785 | + $that->loader->add_action( 'wp_ajax_nopriv_wl_jsonld', $that->jsonld_service, 'get' ); |
|
1786 | + |
|
1787 | + // Hook the `pre_get_posts` action to the `Wordlift_Category_Taxonomy_Service` |
|
1788 | + // in order to tweak WP's `WP_Query` to include entities in queries related |
|
1789 | + // to categories. |
|
1790 | + $that->loader->add_action( 'pre_get_posts', $that->category_taxonomy_service, 'pre_get_posts', 10, 1 ); |
|
1791 | + |
|
1792 | + /* |
|
1793 | 1793 | * Hook the `pre_get_posts` action to the `Wordlift_Entity_Page_Service` |
1794 | 1794 | * in order to tweak WP's `WP_Query` to show event related entities in reverse |
1795 | 1795 | * order of start time. |
1796 | 1796 | */ |
1797 | - $that->loader->add_action( 'pre_get_posts', $that->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
1798 | - |
|
1799 | - // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
1800 | - $that->loader->add_action( 'save_post', $that->entity_type_adapter, 'save_post', 9, 2 ); |
|
1801 | - |
|
1802 | - // Analytics Script Frontend. |
|
1803 | - if ( apply_filters( 'wl_feature__enable__analytics', true ) && Wordlift_Configuration_Service::get_instance()->is_analytics_enable() ) { |
|
1804 | - $that->loader->add_action( 'wp_enqueue_scripts', $that->analytics_connect, 'enqueue_scripts', 10 ); |
|
1805 | - } |
|
1806 | - |
|
1807 | - } |
|
1808 | - |
|
1809 | - /** |
|
1810 | - * Run the loader to execute all of the hooks with WordPress. |
|
1811 | - * |
|
1812 | - * @since 1.0.0 |
|
1813 | - */ |
|
1814 | - public function run() { |
|
1815 | - $this->loader->run(); |
|
1816 | - } |
|
1817 | - |
|
1818 | - /** |
|
1819 | - * The name of the plugin used to uniquely identify it within the context of |
|
1820 | - * WordPress and to define internationalization functionality. |
|
1821 | - * |
|
1822 | - * @return string The name of the plugin. |
|
1823 | - * @since 1.0.0 |
|
1824 | - */ |
|
1825 | - public function get_plugin_name() { |
|
1826 | - return $this->plugin_name; |
|
1827 | - } |
|
1828 | - |
|
1829 | - /** |
|
1830 | - * The reference to the class that orchestrates the hooks with the plugin. |
|
1831 | - * |
|
1832 | - * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
1833 | - * @since 1.0.0 |
|
1834 | - */ |
|
1835 | - public function get_loader() { |
|
1836 | - return $this->loader; |
|
1837 | - } |
|
1838 | - |
|
1839 | - /** |
|
1840 | - * Retrieve the version number of the plugin. |
|
1841 | - * |
|
1842 | - * @return string The version number of the plugin. |
|
1843 | - * @since 1.0.0 |
|
1844 | - */ |
|
1845 | - public function get_version() { |
|
1846 | - return $this->version; |
|
1847 | - } |
|
1848 | - |
|
1849 | - /** |
|
1850 | - * Load dependencies for WP-CLI. |
|
1851 | - * |
|
1852 | - * @throws Exception when an error occurs. |
|
1853 | - * @since 3.18.0 |
|
1854 | - */ |
|
1855 | - private function load_cli_dependencies() { |
|
1856 | - |
|
1857 | - } |
|
1858 | - |
|
1859 | - public function add_wl_enabled_blocks() { |
|
1860 | - /** |
|
1861 | - * Filter: wl_feature__enable__blocks. |
|
1862 | - * |
|
1863 | - * @param bool whether the blocks needed to be registered, defaults to true. |
|
1864 | - * |
|
1865 | - * @return bool |
|
1866 | - * @since 3.27.6 |
|
1867 | - */ |
|
1868 | - // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NotInFooter,WordPress.WP.EnqueuedResourceParameters.MissingVersion |
|
1869 | - wp_register_script( 'wl_enabled_blocks', false ); |
|
1870 | - |
|
1871 | - $enabled_blocks = array(); |
|
1872 | - |
|
1873 | - /** |
|
1874 | - * Filter name: wl_feature__enable__product-navigator |
|
1875 | - * |
|
1876 | - * @since 3.32.3 |
|
1877 | - */ |
|
1878 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1879 | - if ( apply_filters( 'wl_feature__enable__product-navigator', true ) ) { |
|
1880 | - $enabled_blocks[] = 'wordlift/products-navigator'; |
|
1881 | - } |
|
1882 | - |
|
1883 | - if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
1884 | - // To intimate JS |
|
1885 | - $enabled_blocks = array_merge( |
|
1886 | - $enabled_blocks, |
|
1887 | - array( |
|
1888 | - 'wordlift/navigator', |
|
1889 | - 'wordlift/chord', |
|
1890 | - 'wordlift/geomap', |
|
1891 | - 'wordlift/timeline', |
|
1892 | - 'wordlift/cloud', |
|
1893 | - 'wordlift/vocabulary', |
|
1894 | - 'wordlift/faceted-search', |
|
1895 | - ) |
|
1896 | - ); |
|
1897 | - } |
|
1898 | - |
|
1899 | - wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
1900 | - wp_enqueue_script( 'wl_enabled_blocks' ); |
|
1901 | - } |
|
1902 | - |
|
1903 | - /** |
|
1904 | - * Register screens based on the filter. |
|
1905 | - */ |
|
1906 | - public function register_screens() { |
|
1907 | - // Hook the menu to the Download Your Data page. |
|
1908 | - // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1909 | - if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) { |
|
1910 | - Assertions::is_set( $this->download_your_data_page, "`download_your_data_page` can't be null" ); |
|
1911 | - add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 ); |
|
1912 | - } |
|
1913 | - |
|
1914 | - Assertions::is_set( $this->entity_type_settings_admin_page, "`entity_type_settings_admin_page` can't be null" ); |
|
1915 | - add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 ); |
|
1916 | - |
|
1917 | - } |
|
1797 | + $that->loader->add_action( 'pre_get_posts', $that->entity_page_service, 'pre_get_posts', 10, 1 ); |
|
1798 | + |
|
1799 | + // This hook have to run before the rating service, as otherwise the post might not be a proper entity when rating is done. |
|
1800 | + $that->loader->add_action( 'save_post', $that->entity_type_adapter, 'save_post', 9, 2 ); |
|
1801 | + |
|
1802 | + // Analytics Script Frontend. |
|
1803 | + if ( apply_filters( 'wl_feature__enable__analytics', true ) && Wordlift_Configuration_Service::get_instance()->is_analytics_enable() ) { |
|
1804 | + $that->loader->add_action( 'wp_enqueue_scripts', $that->analytics_connect, 'enqueue_scripts', 10 ); |
|
1805 | + } |
|
1806 | + |
|
1807 | + } |
|
1808 | + |
|
1809 | + /** |
|
1810 | + * Run the loader to execute all of the hooks with WordPress. |
|
1811 | + * |
|
1812 | + * @since 1.0.0 |
|
1813 | + */ |
|
1814 | + public function run() { |
|
1815 | + $this->loader->run(); |
|
1816 | + } |
|
1817 | + |
|
1818 | + /** |
|
1819 | + * The name of the plugin used to uniquely identify it within the context of |
|
1820 | + * WordPress and to define internationalization functionality. |
|
1821 | + * |
|
1822 | + * @return string The name of the plugin. |
|
1823 | + * @since 1.0.0 |
|
1824 | + */ |
|
1825 | + public function get_plugin_name() { |
|
1826 | + return $this->plugin_name; |
|
1827 | + } |
|
1828 | + |
|
1829 | + /** |
|
1830 | + * The reference to the class that orchestrates the hooks with the plugin. |
|
1831 | + * |
|
1832 | + * @return Wordlift_Loader Orchestrates the hooks of the plugin. |
|
1833 | + * @since 1.0.0 |
|
1834 | + */ |
|
1835 | + public function get_loader() { |
|
1836 | + return $this->loader; |
|
1837 | + } |
|
1838 | + |
|
1839 | + /** |
|
1840 | + * Retrieve the version number of the plugin. |
|
1841 | + * |
|
1842 | + * @return string The version number of the plugin. |
|
1843 | + * @since 1.0.0 |
|
1844 | + */ |
|
1845 | + public function get_version() { |
|
1846 | + return $this->version; |
|
1847 | + } |
|
1848 | + |
|
1849 | + /** |
|
1850 | + * Load dependencies for WP-CLI. |
|
1851 | + * |
|
1852 | + * @throws Exception when an error occurs. |
|
1853 | + * @since 3.18.0 |
|
1854 | + */ |
|
1855 | + private function load_cli_dependencies() { |
|
1856 | + |
|
1857 | + } |
|
1858 | + |
|
1859 | + public function add_wl_enabled_blocks() { |
|
1860 | + /** |
|
1861 | + * Filter: wl_feature__enable__blocks. |
|
1862 | + * |
|
1863 | + * @param bool whether the blocks needed to be registered, defaults to true. |
|
1864 | + * |
|
1865 | + * @return bool |
|
1866 | + * @since 3.27.6 |
|
1867 | + */ |
|
1868 | + // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NotInFooter,WordPress.WP.EnqueuedResourceParameters.MissingVersion |
|
1869 | + wp_register_script( 'wl_enabled_blocks', false ); |
|
1870 | + |
|
1871 | + $enabled_blocks = array(); |
|
1872 | + |
|
1873 | + /** |
|
1874 | + * Filter name: wl_feature__enable__product-navigator |
|
1875 | + * |
|
1876 | + * @since 3.32.3 |
|
1877 | + */ |
|
1878 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1879 | + if ( apply_filters( 'wl_feature__enable__product-navigator', true ) ) { |
|
1880 | + $enabled_blocks[] = 'wordlift/products-navigator'; |
|
1881 | + } |
|
1882 | + |
|
1883 | + if ( apply_filters( 'wl_feature__enable__blocks', true ) ) { |
|
1884 | + // To intimate JS |
|
1885 | + $enabled_blocks = array_merge( |
|
1886 | + $enabled_blocks, |
|
1887 | + array( |
|
1888 | + 'wordlift/navigator', |
|
1889 | + 'wordlift/chord', |
|
1890 | + 'wordlift/geomap', |
|
1891 | + 'wordlift/timeline', |
|
1892 | + 'wordlift/cloud', |
|
1893 | + 'wordlift/vocabulary', |
|
1894 | + 'wordlift/faceted-search', |
|
1895 | + ) |
|
1896 | + ); |
|
1897 | + } |
|
1898 | + |
|
1899 | + wp_localize_script( 'wl_enabled_blocks', 'wlEnabledBlocks', $enabled_blocks ); |
|
1900 | + wp_enqueue_script( 'wl_enabled_blocks' ); |
|
1901 | + } |
|
1902 | + |
|
1903 | + /** |
|
1904 | + * Register screens based on the filter. |
|
1905 | + */ |
|
1906 | + public function register_screens() { |
|
1907 | + // Hook the menu to the Download Your Data page. |
|
1908 | + // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
1909 | + if ( apply_filters( 'wl_feature__enable__settings-download', true ) ) { |
|
1910 | + Assertions::is_set( $this->download_your_data_page, "`download_your_data_page` can't be null" ); |
|
1911 | + add_action( 'admin_menu', array( $this->download_your_data_page, 'admin_menu' ), 100, 0 ); |
|
1912 | + } |
|
1913 | + |
|
1914 | + Assertions::is_set( $this->entity_type_settings_admin_page, "`entity_type_settings_admin_page` can't be null" ); |
|
1915 | + add_action( 'admin_menu', array( $this->entity_type_settings_admin_page, 'admin_menu' ), 100, 0 ); |
|
1916 | + |
|
1917 | + } |
|
1918 | 1918 | |
1919 | 1919 | } |
@@ -4,17 +4,17 @@ discard block |
||
4 | 4 | |
5 | 5 | class Installation_Complete_Notice { |
6 | 6 | |
7 | - public function init() { |
|
7 | + public function init() { |
|
8 | 8 | |
9 | - $this->handle_notice_close(); |
|
9 | + $this->handle_notice_close(); |
|
10 | 10 | |
11 | - add_action( |
|
12 | - 'wordlift_admin_notices', |
|
13 | - function () { |
|
14 | - if ( \Wordlift_Configuration_Service::get_instance()->get_skip_installation_notice() ) { |
|
15 | - return; |
|
16 | - } |
|
17 | - ?> |
|
11 | + add_action( |
|
12 | + 'wordlift_admin_notices', |
|
13 | + function () { |
|
14 | + if ( \Wordlift_Configuration_Service::get_instance()->get_skip_installation_notice() ) { |
|
15 | + return; |
|
16 | + } |
|
17 | + ?> |
|
18 | 18 | <div class="updated"> |
19 | 19 | <H3><?php echo esc_html( get_plugin_data( WORDLIFT_PLUGIN_FILE )['Name'] ); ?> <?php esc_html_e( 'has been successfully installed on your site!', 'wordlift' ); ?></H3> |
20 | 20 | <p><?php esc_html_e( 'we\'re now automatically enriching the structured data on your posts to create the best representation of your content that search engines will understand. Time to look forward to an increase in organic traffic!', 'wordlift' ); ?></p> |
@@ -27,23 +27,23 @@ discard block |
||
27 | 27 | </p> |
28 | 28 | </div> |
29 | 29 | <?php |
30 | - } |
|
31 | - ); |
|
30 | + } |
|
31 | + ); |
|
32 | 32 | |
33 | - } |
|
33 | + } |
|
34 | 34 | |
35 | - public function handle_notice_close() { |
|
36 | - if ( ! isset( $_GET['wl_hide_installation_notice'] ) || ! isset( $_GET['_wl_hide_installation_notice_nonce'] ) ) { |
|
37 | - return; |
|
38 | - } |
|
35 | + public function handle_notice_close() { |
|
36 | + if ( ! isset( $_GET['wl_hide_installation_notice'] ) || ! isset( $_GET['_wl_hide_installation_notice_nonce'] ) ) { |
|
37 | + return; |
|
38 | + } |
|
39 | 39 | |
40 | - if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wl_hide_installation_notice_nonce'] ) ), 'wordlift_hide_installation_notice_nonce' ) |
|
41 | - || ! current_user_can( 'manage_options' ) ) { |
|
42 | - wp_die( esc_html__( 'Action failed.', 'wordlift' ) ); |
|
43 | - } |
|
40 | + if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wl_hide_installation_notice_nonce'] ) ), 'wordlift_hide_installation_notice_nonce' ) |
|
41 | + || ! current_user_can( 'manage_options' ) ) { |
|
42 | + wp_die( esc_html__( 'Action failed.', 'wordlift' ) ); |
|
43 | + } |
|
44 | 44 | |
45 | - \Wordlift_Configuration_Service::get_instance()->set_skip_installation_notice( true ); |
|
45 | + \Wordlift_Configuration_Service::get_instance()->set_skip_installation_notice( true ); |
|
46 | 46 | |
47 | - } |
|
47 | + } |
|
48 | 48 | |
49 | 49 | } |
@@ -6,60 +6,60 @@ |
||
6 | 6 | use Wordlift\Modules\Include_Exclude_Push_Config\Include_Exclude_API; |
7 | 7 | |
8 | 8 | if ( ! defined( 'ABSPATH' ) ) { |
9 | - exit; |
|
9 | + exit; |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | // Bail out if the feature isn't enabled. |
13 | 13 | if ( ! apply_filters( 'wl_feature__enable__include-exclude', false ) ) { // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
14 | - return; |
|
14 | + return; |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | // Autoloader for dependencies. |
18 | 18 | if ( file_exists( __DIR__ . '/third-party/vendor/scoper-autoload.php' ) ) { |
19 | - require __DIR__ . '/third-party/vendor/scoper-autoload.php'; |
|
19 | + require __DIR__ . '/third-party/vendor/scoper-autoload.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | // Autoloader for plugin itself. |
23 | 23 | if ( file_exists( __DIR__ . '/includes/vendor/autoload.php' ) ) { |
24 | - require __DIR__ . '/includes/vendor/autoload.php'; |
|
24 | + require __DIR__ . '/includes/vendor/autoload.php'; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | function __wl_include_exclude_push_config() { |
28 | - // Get the configuration. |
|
29 | - $config = get_option( 'wl_exclude_include_urls_settings', array() ); |
|
28 | + // Get the configuration. |
|
29 | + $config = get_option( 'wl_exclude_include_urls_settings', array() ); |
|
30 | 30 | |
31 | - // Set the default data. |
|
32 | - if ( ! is_array( $config ) || empty( $config ) || ! isset( $config['include_exclude'] ) || ! isset( $config['urls'] ) ) { |
|
33 | - $config = get_option( |
|
34 | - 'wl_exclude_include_urls_settings', |
|
35 | - array( |
|
36 | - 'include_exclude' => 'exclude', |
|
37 | - 'urls' => '', |
|
38 | - ) |
|
39 | - ); |
|
40 | - } |
|
31 | + // Set the default data. |
|
32 | + if ( ! is_array( $config ) || empty( $config ) || ! isset( $config['include_exclude'] ) || ! isset( $config['urls'] ) ) { |
|
33 | + $config = get_option( |
|
34 | + 'wl_exclude_include_urls_settings', |
|
35 | + array( |
|
36 | + 'include_exclude' => 'exclude', |
|
37 | + 'urls' => '', |
|
38 | + ) |
|
39 | + ); |
|
40 | + } |
|
41 | 41 | |
42 | - // Map the configuration to the payload. |
|
43 | - $payload = array_map( |
|
44 | - function ( $item ) use ( $config ) { |
|
45 | - return array( |
|
46 | - 'url' => |
|
47 | - ( 1 === preg_match( '@^https?://.*$@', $item ) ? $item : get_home_url( null, $item ) ), |
|
48 | - 'flag' => strtoupper( $config['include_exclude'] ), |
|
49 | - ); |
|
50 | - }, |
|
51 | - array_filter( preg_split( '/[\r\n]+/', $config['urls'] ) ) |
|
52 | - ); |
|
42 | + // Map the configuration to the payload. |
|
43 | + $payload = array_map( |
|
44 | + function ( $item ) use ( $config ) { |
|
45 | + return array( |
|
46 | + 'url' => |
|
47 | + ( 1 === preg_match( '@^https?://.*$@', $item ) ? $item : get_home_url( null, $item ) ), |
|
48 | + 'flag' => strtoupper( $config['include_exclude'] ), |
|
49 | + ); |
|
50 | + }, |
|
51 | + array_filter( preg_split( '/[\r\n]+/', $config['urls'] ) ) |
|
52 | + ); |
|
53 | 53 | |
54 | - // Load the service. |
|
55 | - $container_builder = new ContainerBuilder(); |
|
56 | - $loader = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) ); |
|
57 | - $loader->load( 'services.yml' ); |
|
58 | - $container_builder->compile(); |
|
54 | + // Load the service. |
|
55 | + $container_builder = new ContainerBuilder(); |
|
56 | + $loader = new YamlFileLoader( $container_builder, new FileLocator( __DIR__ ) ); |
|
57 | + $loader->load( 'services.yml' ); |
|
58 | + $container_builder->compile(); |
|
59 | 59 | |
60 | - /** @var Include_Exclude_API $api */ |
|
61 | - $api = $container_builder->get( 'Wordlift\Modules\Include_Exclude_Push_Config\Include_Exclude_API' ); |
|
62 | - $api->update( $payload ); |
|
60 | + /** @var Include_Exclude_API $api */ |
|
61 | + $api = $container_builder->get( 'Wordlift\Modules\Include_Exclude_Push_Config\Include_Exclude_API' ); |
|
62 | + $api->update( $payload ); |
|
63 | 63 | |
64 | 64 | } |
65 | 65 |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | |
34 | 34 | // If this file is called directly, abort. |
35 | 35 | if ( ! defined( 'WPINC' ) ) { |
36 | - die; |
|
36 | + die; |
|
37 | 37 | } |
38 | 38 | define( |
39 | - 'WORDLIFT_PLUGIN_FILE', |
|
40 | - __FILE__ |
|
39 | + 'WORDLIFT_PLUGIN_FILE', |
|
40 | + __FILE__ |
|
41 | 41 | ); |
42 | 42 | define( 'WORDLIFT_VERSION', '3.40.3' ); |
43 | 43 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @since 3.33.6 |
51 | 51 | */ |
52 | 52 | if ( ! apply_filters( 'wl_is_enabled', true ) ) { |
53 | - return; |
|
53 | + return; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php'; |
@@ -79,33 +79,33 @@ discard block |
||
79 | 79 | */ |
80 | 80 | function activate_wordlift() { |
81 | 81 | |
82 | - $log = Wordlift_Log_Service::get_logger( 'activate_wordlift' ); |
|
82 | + $log = Wordlift_Log_Service::get_logger( 'activate_wordlift' ); |
|
83 | 83 | |
84 | - $log->info( 'Activating WordLift...' ); |
|
84 | + $log->info( 'Activating WordLift...' ); |
|
85 | 85 | |
86 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php'; |
|
87 | - Wordlift_Activator::activate(); |
|
86 | + require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-activator.php'; |
|
87 | + Wordlift_Activator::activate(); |
|
88 | 88 | |
89 | - /** |
|
90 | - * Tell the {@link Wordlift_Http_Api} class that we're activating, to let it run activation tasks. |
|
91 | - * |
|
92 | - * @see https://github.com/insideout10/wordlift-plugin/issues/820 related issue. |
|
93 | - * @since 3.19.2 |
|
94 | - */ |
|
95 | - Wordlift_Http_Api::activate(); |
|
96 | - |
|
97 | - // Ensure the post type is registered before flushing the rewrite rules. |
|
98 | - Wordlift_Entity_Post_Type_Service::get_instance()->register(); |
|
99 | - flush_rewrite_rules(); |
|
100 | - /** |
|
101 | - * @since 3.27.7 |
|
102 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
103 | - */ |
|
104 | - Top_Entities::activate(); |
|
89 | + /** |
|
90 | + * Tell the {@link Wordlift_Http_Api} class that we're activating, to let it run activation tasks. |
|
91 | + * |
|
92 | + * @see https://github.com/insideout10/wordlift-plugin/issues/820 related issue. |
|
93 | + * @since 3.19.2 |
|
94 | + */ |
|
95 | + Wordlift_Http_Api::activate(); |
|
96 | + |
|
97 | + // Ensure the post type is registered before flushing the rewrite rules. |
|
98 | + Wordlift_Entity_Post_Type_Service::get_instance()->register(); |
|
99 | + flush_rewrite_rules(); |
|
100 | + /** |
|
101 | + * @since 3.27.7 |
|
102 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
103 | + */ |
|
104 | + Top_Entities::activate(); |
|
105 | 105 | |
106 | - if ( ! wp_next_scheduled( 'wl_daily_cron' ) ) { |
|
107 | - wp_schedule_event( time(), 'daily', 'wl_daily_cron' ); |
|
108 | - } |
|
106 | + if ( ! wp_next_scheduled( 'wl_daily_cron' ) ) { |
|
107 | + wp_schedule_event( time(), 'daily', 'wl_daily_cron' ); |
|
108 | + } |
|
109 | 109 | |
110 | 110 | } |
111 | 111 | |
@@ -115,23 +115,23 @@ discard block |
||
115 | 115 | */ |
116 | 116 | function deactivate_wordlift() { |
117 | 117 | |
118 | - require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php'; |
|
119 | - Wordlift_Deactivator::deactivate(); |
|
120 | - Wordlift_Http_Api::deactivate(); |
|
121 | - Ttl_Cache_Cleaner::deactivate(); |
|
122 | - /** |
|
123 | - * @since 3.27.7 |
|
124 | - * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
125 | - */ |
|
126 | - Top_Entities::deactivate(); |
|
127 | - /** |
|
128 | - * @since 3.27.8 |
|
129 | - * Remove notification flag on deactivation. |
|
130 | - */ |
|
131 | - Key_Validation_Notice::remove_notification_flag(); |
|
132 | - flush_rewrite_rules(); |
|
133 | - |
|
134 | - wp_clear_scheduled_hook( 'wl_daily_cron' ); |
|
118 | + require_once plugin_dir_path( __FILE__ ) . 'includes/class-wordlift-deactivator.php'; |
|
119 | + Wordlift_Deactivator::deactivate(); |
|
120 | + Wordlift_Http_Api::deactivate(); |
|
121 | + Ttl_Cache_Cleaner::deactivate(); |
|
122 | + /** |
|
123 | + * @since 3.27.7 |
|
124 | + * @see https://github.com/insideout10/wordlift-plugin/issues/1214 |
|
125 | + */ |
|
126 | + Top_Entities::deactivate(); |
|
127 | + /** |
|
128 | + * @since 3.27.8 |
|
129 | + * Remove notification flag on deactivation. |
|
130 | + */ |
|
131 | + Key_Validation_Notice::remove_notification_flag(); |
|
132 | + flush_rewrite_rules(); |
|
133 | + |
|
134 | + wp_clear_scheduled_hook( 'wl_daily_cron' ); |
|
135 | 135 | |
136 | 136 | } |
137 | 137 | |
@@ -154,84 +154,84 @@ discard block |
||
154 | 154 | * @since 1.0.0 |
155 | 155 | */ |
156 | 156 | function run_wordlift() { |
157 | - /** |
|
158 | - * Filter: wl_feature__enable__widgets. |
|
159 | - * |
|
160 | - * @param bool whether the widgets needed to be registered, defaults to true. |
|
161 | - * |
|
162 | - * @return bool |
|
163 | - * @since 3.27.6 |
|
164 | - */ |
|
165 | - if ( apply_filters( 'wl_feature__enable__widgets', true ) ) { |
|
166 | - add_action( 'widgets_init', 'wl_register_chord_widget' ); |
|
167 | - add_action( 'widgets_init', 'wl_register_geo_widget' ); |
|
168 | - add_action( 'widgets_init', 'wl_register_timeline_widget' ); |
|
169 | - } |
|
170 | - add_filter( 'widget_text', 'do_shortcode' ); |
|
171 | - |
|
172 | - /** |
|
173 | - * Filter: wl_feature__enable__analysis |
|
174 | - * |
|
175 | - * @param bool Whether to send api request to analysis or not |
|
176 | - * |
|
177 | - * @return bool |
|
178 | - * @since 3.27.6 |
|
179 | - */ |
|
180 | - if ( apply_filters( 'wl_feature__enable__analysis', true ) ) { |
|
181 | - add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_action' ); |
|
182 | - } else { |
|
183 | - add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action' ); |
|
184 | - } |
|
185 | - |
|
186 | - $plugin = new Wordlift(); |
|
187 | - $plugin->run(); |
|
188 | - |
|
189 | - // Initialize the TTL Cache Cleaner. |
|
190 | - new Ttl_Cache_Cleaner(); |
|
191 | - |
|
192 | - // Load the new Post Adapter. |
|
193 | - new Post_Adapter(); |
|
194 | - |
|
195 | - // Load the API Data Hooks. |
|
196 | - new Api_Data_Hooks(); |
|
197 | - |
|
198 | - add_action( |
|
199 | - 'plugins_loaded', |
|
200 | - function () { |
|
201 | - // All features from registry should be initialized here. |
|
202 | - $features_registry = Features_Registry::get_instance(); |
|
203 | - $features_registry->initialize_all_features(); |
|
204 | - }, |
|
205 | - 5 |
|
206 | - ); |
|
207 | - |
|
208 | - add_action( |
|
209 | - 'plugins_loaded', |
|
210 | - // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
211 | - function () use ( $plugin ) { |
|
212 | - |
|
213 | - new Wordlift_Products_Navigator_Shortcode_REST(); |
|
214 | - |
|
215 | - // Register the Dataset module, requires `$api_service`. |
|
216 | - require_once plugin_dir_path( __FILE__ ) . 'wordlift/dataset/index.php'; |
|
217 | - require_once plugin_dir_path( __FILE__ ) . 'wordlift/shipping-data/index.php'; |
|
218 | - |
|
219 | - /* |
|
157 | + /** |
|
158 | + * Filter: wl_feature__enable__widgets. |
|
159 | + * |
|
160 | + * @param bool whether the widgets needed to be registered, defaults to true. |
|
161 | + * |
|
162 | + * @return bool |
|
163 | + * @since 3.27.6 |
|
164 | + */ |
|
165 | + if ( apply_filters( 'wl_feature__enable__widgets', true ) ) { |
|
166 | + add_action( 'widgets_init', 'wl_register_chord_widget' ); |
|
167 | + add_action( 'widgets_init', 'wl_register_geo_widget' ); |
|
168 | + add_action( 'widgets_init', 'wl_register_timeline_widget' ); |
|
169 | + } |
|
170 | + add_filter( 'widget_text', 'do_shortcode' ); |
|
171 | + |
|
172 | + /** |
|
173 | + * Filter: wl_feature__enable__analysis |
|
174 | + * |
|
175 | + * @param bool Whether to send api request to analysis or not |
|
176 | + * |
|
177 | + * @return bool |
|
178 | + * @since 3.27.6 |
|
179 | + */ |
|
180 | + if ( apply_filters( 'wl_feature__enable__analysis', true ) ) { |
|
181 | + add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_action' ); |
|
182 | + } else { |
|
183 | + add_action( 'wp_ajax_wl_analyze', 'wl_ajax_analyze_disabled_action' ); |
|
184 | + } |
|
185 | + |
|
186 | + $plugin = new Wordlift(); |
|
187 | + $plugin->run(); |
|
188 | + |
|
189 | + // Initialize the TTL Cache Cleaner. |
|
190 | + new Ttl_Cache_Cleaner(); |
|
191 | + |
|
192 | + // Load the new Post Adapter. |
|
193 | + new Post_Adapter(); |
|
194 | + |
|
195 | + // Load the API Data Hooks. |
|
196 | + new Api_Data_Hooks(); |
|
197 | + |
|
198 | + add_action( |
|
199 | + 'plugins_loaded', |
|
200 | + function () { |
|
201 | + // All features from registry should be initialized here. |
|
202 | + $features_registry = Features_Registry::get_instance(); |
|
203 | + $features_registry->initialize_all_features(); |
|
204 | + }, |
|
205 | + 5 |
|
206 | + ); |
|
207 | + |
|
208 | + add_action( |
|
209 | + 'plugins_loaded', |
|
210 | + // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
|
211 | + function () use ( $plugin ) { |
|
212 | + |
|
213 | + new Wordlift_Products_Navigator_Shortcode_REST(); |
|
214 | + |
|
215 | + // Register the Dataset module, requires `$api_service`. |
|
216 | + require_once plugin_dir_path( __FILE__ ) . 'wordlift/dataset/index.php'; |
|
217 | + require_once plugin_dir_path( __FILE__ ) . 'wordlift/shipping-data/index.php'; |
|
218 | + |
|
219 | + /* |
|
220 | 220 | * Require the Entity annotation cleanup module. |
221 | 221 | * |
222 | 222 | * @since 3.34.6 |
223 | 223 | */ |
224 | - require_once plugin_dir_path( __FILE__ ) . 'wordlift/cleanup/index.php'; |
|
224 | + require_once plugin_dir_path( __FILE__ ) . 'wordlift/cleanup/index.php'; |
|
225 | 225 | |
226 | - /* |
|
226 | + /* |
|
227 | 227 | * Import LOD entities. |
228 | 228 | * |
229 | 229 | * @since 3.35.0 |
230 | 230 | */ |
231 | - require_once plugin_dir_path( __FILE__ ) . 'wordlift/lod-import/index.php'; |
|
231 | + require_once plugin_dir_path( __FILE__ ) . 'wordlift/lod-import/index.php'; |
|
232 | 232 | |
233 | - } |
|
234 | - ); |
|
233 | + } |
|
234 | + ); |
|
235 | 235 | |
236 | 236 | } |
237 | 237 | |
@@ -245,45 +245,45 @@ discard block |
||
245 | 245 | */ |
246 | 246 | function wordlift_plugin_autoload_register() { |
247 | 247 | |
248 | - spl_autoload_register( |
|
249 | - function ( $class_name ) { |
|
248 | + spl_autoload_register( |
|
249 | + function ( $class_name ) { |
|
250 | 250 | |
251 | - // Bail out if these are not our classes. |
|
252 | - if ( 0 !== strpos( $class_name, 'Wordlift\\' ) ) { |
|
253 | - return false; |
|
254 | - } |
|
251 | + // Bail out if these are not our classes. |
|
252 | + if ( 0 !== strpos( $class_name, 'Wordlift\\' ) ) { |
|
253 | + return false; |
|
254 | + } |
|
255 | 255 | |
256 | - $class_name_lc = strtolower( str_replace( '_', '-', $class_name ) ); |
|
256 | + $class_name_lc = strtolower( str_replace( '_', '-', $class_name ) ); |
|
257 | 257 | |
258 | - preg_match( '|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches ); |
|
258 | + preg_match( '|^(?:(.*)\\\\)?(.+?)$|', $class_name_lc, $matches ); |
|
259 | 259 | |
260 | - $path = str_replace( '\\', DIRECTORY_SEPARATOR, $matches[1] ); |
|
261 | - $file = 'class-' . $matches[2] . '.php'; |
|
260 | + $path = str_replace( '\\', DIRECTORY_SEPARATOR, $matches[1] ); |
|
261 | + $file = 'class-' . $matches[2] . '.php'; |
|
262 | 262 | |
263 | - $full_path = plugin_dir_path( __FILE__ ) . $path . DIRECTORY_SEPARATOR . $file; |
|
263 | + $full_path = plugin_dir_path( __FILE__ ) . $path . DIRECTORY_SEPARATOR . $file; |
|
264 | 264 | |
265 | - if ( ! file_exists( $full_path ) ) { |
|
266 | - return false; |
|
267 | - } |
|
265 | + if ( ! file_exists( $full_path ) ) { |
|
266 | + return false; |
|
267 | + } |
|
268 | 268 | |
269 | - require_once $full_path; |
|
269 | + require_once $full_path; |
|
270 | 270 | |
271 | - return true; |
|
272 | - } |
|
273 | - ); |
|
271 | + return true; |
|
272 | + } |
|
273 | + ); |
|
274 | 274 | |
275 | 275 | } |
276 | 276 | |
277 | 277 | function wl_block_categories( $categories ) { |
278 | - return array_merge( |
|
279 | - $categories, |
|
280 | - array( |
|
281 | - array( |
|
282 | - 'slug' => 'wordlift', |
|
283 | - 'title' => __( 'WordLift', 'wordlift' ), |
|
284 | - ), |
|
285 | - ) |
|
286 | - ); |
|
278 | + return array_merge( |
|
279 | + $categories, |
|
280 | + array( |
|
281 | + array( |
|
282 | + 'slug' => 'wordlift', |
|
283 | + 'title' => __( 'WordLift', 'wordlift' ), |
|
284 | + ), |
|
285 | + ) |
|
286 | + ); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | /** |
@@ -291,19 +291,19 @@ discard block |
||
291 | 291 | * this has to be removed when removing the legacy fields from the ui. |
292 | 292 | */ |
293 | 293 | function wl_enqueue_leaflet( $in_footer = false ) { |
294 | - // Leaflet. |
|
295 | - wp_enqueue_style( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.css', array(), '1.6.0' ); |
|
296 | - wp_enqueue_script( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.js', array(), '1.6.0', $in_footer ); |
|
294 | + // Leaflet. |
|
295 | + wp_enqueue_style( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.css', array(), '1.6.0' ); |
|
296 | + wp_enqueue_script( 'wl-leaflet', plugin_dir_url( __FILE__ ) . 'js/leaflet/leaflet.js', array(), '1.6.0', $in_footer ); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | add_filter( 'block_categories', 'wl_block_categories', 10 ); |
300 | 300 | |
301 | 301 | // Temporary fix for a typo in WooCommerce Extension. |
302 | 302 | add_filter( |
303 | - 'wl_feature__enable__dataset', |
|
304 | - function ( $value ) { |
|
305 | - return apply_filters( 'wl_features__enable__dataset', $value ); |
|
306 | - } |
|
303 | + 'wl_feature__enable__dataset', |
|
304 | + function ( $value ) { |
|
305 | + return apply_filters( 'wl_features__enable__dataset', $value ); |
|
306 | + } |
|
307 | 307 | ); |
308 | 308 | |
309 | 309 | require_once __DIR__ . '/modules/food-kg/load.php'; |
@@ -312,26 +312,26 @@ discard block |
||
312 | 312 | require_once __DIR__ . '/modules/include-exclude-push-config/load.php'; |
313 | 313 | |
314 | 314 | add_action( |
315 | - 'update_plugins_adthrive.wordlift.io', |
|
316 | - function ( $update, $plugin_data, $plugin_file ) { |
|
317 | - // Bail out if it's not our plugin. |
|
318 | - $update_uri = $plugin_data['UpdateURI']; |
|
319 | - if ( 'wordlift/wordlift.php' !== $plugin_file || ! isset( $update_uri ) ) { |
|
320 | - return $update; |
|
321 | - } |
|
322 | - |
|
323 | - $response = wp_remote_get( "$update_uri?nocache=" . time() ); |
|
324 | - |
|
325 | - if ( is_wp_error( $response ) ) { |
|
326 | - return $update; |
|
327 | - } |
|
328 | - |
|
329 | - try { |
|
330 | - return json_decode( wp_remote_retrieve_body( $response ) ); |
|
331 | - } catch ( Exception $e ) { |
|
332 | - return $update; |
|
333 | - } |
|
334 | - }, |
|
335 | - 10, |
|
336 | - 3 |
|
315 | + 'update_plugins_adthrive.wordlift.io', |
|
316 | + function ( $update, $plugin_data, $plugin_file ) { |
|
317 | + // Bail out if it's not our plugin. |
|
318 | + $update_uri = $plugin_data['UpdateURI']; |
|
319 | + if ( 'wordlift/wordlift.php' !== $plugin_file || ! isset( $update_uri ) ) { |
|
320 | + return $update; |
|
321 | + } |
|
322 | + |
|
323 | + $response = wp_remote_get( "$update_uri?nocache=" . time() ); |
|
324 | + |
|
325 | + if ( is_wp_error( $response ) ) { |
|
326 | + return $update; |
|
327 | + } |
|
328 | + |
|
329 | + try { |
|
330 | + return json_decode( wp_remote_retrieve_body( $response ) ); |
|
331 | + } catch ( Exception $e ) { |
|
332 | + return $update; |
|
333 | + } |
|
334 | + }, |
|
335 | + 10, |
|
336 | + 3 |
|
337 | 337 | ); |