PluginProbe
Translate and Go multilingual – Automatic AI translation – wpLingua / 2.12.1
Translate and Go multilingual – Automatic AI translation – wpLingua v2.12.1
2.16.7 2.16.6 2.16.5 2.16.4 2.16.3 2.16.2 2.16.1 2.16.0 2.15.2 2.15.1 2.15.0 2.14.3 2.14.2 2.14.1 2.14.0 2.13.1 2.13.0 2.12.3 2.12.2 2.12.1 trunk 1.0.3 1.0.4 1.0.5 1.1.0 All 112 releases
wplingua / data / json.php

json.php in Translate and Go multilingual – Automatic AI translation – wpLingua 2.12.1, at data/json.php

847 lines 23.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // If this file is called directly, abort.
4 if ( ! defined( 'WPINC' ) ) {
5 die;
6 }
7
8
9 /**
10 * Retrieves an array of function calls that contain translatable JSON.
11 *
12 * This whitelist is used to identify JavaScript function calls where the
13 * JSON argument should be parsed and translated (e.g., jQuery datepicker).
14 *
15 * @return array Array of function names with dot notation.
16 */
17 function wplng_data_json_in_js_functions() {
18 return apply_filters(
19 'wplng_json_in_js_functions',
20 array(
21 'jQuery.datepicker.setDefaults',
22 '$.datepicker.setDefaults',
23 )
24 );
25 }
26
27
28 /**
29 * Retrieves an array of exclusion rules for JSON elements.
30 *
31 * Each rule is a callback function that determines whether a JSON element
32 * should be excluded based on its value and its parent elements.
33 *
34 * @return array Array of callback functions defining exclusion rules.
35 */
36 function wplng_data_json_rules_exclusion() {
37
38 $logical_rules = array();
39
40 // ------------------------------------------------------------------------
41 // Plugin: wpLingua (Ajax edit modal)
42 // ------------------------------------------------------------------------
43
44 $logical_rules[] = function ( $element, $parents ) {
45 return in_array(
46 $parents,
47 array(
48 array( 'data', 'wplng_edit_html' ),
49 array( 'wplngI18nTranslation' ),
50 array( 'wplngI18nSlug' ),
51 array( 'wplngI18nGutenberg' ),
52 )
53 );
54 };
55
56 // ------------------------------------------------------------------------
57 // Plugin: Google Site Kit
58 // ------------------------------------------------------------------------
59
60 $logical_rules[] = function ( $element, $parents ) {
61 return in_array(
62 $parents,
63 array(
64 array( '_googlesitekitBaseData' ),
65 )
66 );
67 };
68
69 // ------------------------------------------------------------------------
70 // Plugin: WooCommerce
71 // ------------------------------------------------------------------------
72
73 $logical_rules[] = function ( $element, $parents ) {
74 return in_array(
75 $parents,
76 array(
77 array( 'encoded_as_url', 'wcSettings', 'wcBlocksConfig', 'pluginUrl' ),
78 array( 'encoded_as_url', 'wcSettings', 'wcBlocksConfig', 'restApiRoutes' ),
79 array( 'encoded_as_url', 'wcSettings', 'wcBlocksConfig', 'defaultAvatar' ),
80 )
81 );
82 };
83
84 $logical_rules[] = function ( $element, $parents ) {
85 return (
86 isset( $parents[0] )
87 && $parents[0] === 'wc_order_attribution'
88 );
89 };
90
91 return apply_filters(
92 'wplng_json_rules_exclusion',
93 $logical_rules
94 );
95 }
96
97
98 /**
99 * Retrieves an array of inclusion rules for JSON elements.
100 *
101 * Each rule is a callback function that determines whether a JSON element
102 * should be included for translation based on its value and its parent elements.
103 *
104 * @return array Array of callback functions defining inclusion rules.
105 */
106 function wplng_data_json_rules_inclusion() {
107
108 $logical_rules = array();
109
110 // ------------------------------------------------------------------------
111 // Global methods
112 // ------------------------------------------------------------------------
113
114 /**
115 * Some case tagged as label
116 */
117
118 $logical_rules[] = function ( $element, $parents ) {
119 return (
120 ! empty( $parents[ count( $parents ) - 1 ] )
121 && $parents[ count( $parents ) - 1 ] === 'label'
122 );
123 };
124
125 $logical_rules[] = function ( $element, $parents ) {
126 return in_array(
127 $parents,
128 array(
129 array( 'i18n', 'loading' ),
130 array( 'i18n', 'loaded' ),
131 )
132 );
133 };
134
135 /**
136 * i18n scripts
137 */
138
139 $logical_rules[] = function ( $element, $parents ) {
140 return (
141 isset(
142 $parents[0],
143 $parents[1],
144 $parents[2],
145 $parents[3],
146 $parents[4],
147 $parents[5]
148 )
149 && $parents[0] === 'i18n_script'
150 && is_string( $parents[1] )
151 && $parents[2] === 'locale_data'
152 && $parents[3] === 'messages'
153 && is_string( $parents[4] )
154 && is_int( $parents[5] )
155 );
156 };
157
158 // ------------------------------------------------------------------------
159 // schema-graph
160 // ------------------------------------------------------------------------
161
162 /**
163 * Schema-graph: Caption, name, description, etc
164 */
165
166 $logical_rules[] = function ( $element, $parents ) {
167 return (
168 ! empty( $parents[0] )
169 && $parents[0] === '@graph'
170 && count( $parents ) > 2
171 && (
172 (
173 $parents[ count( $parents ) - 2 ] === 'author'
174 && $parents[ count( $parents ) - 1 ] === 'headline'
175 )
176 || (
177 $parents[ count( $parents ) - 2 ] === 'articleSection'
178 && is_int( $parents[ count( $parents ) - 1 ] )
179 )
180 || $parents[ count( $parents ) - 1 ] === 'caption'
181 || $parents[ count( $parents ) - 1 ] === 'name'
182 || $parents[ count( $parents ) - 1 ] === 'alternateName'
183 || $parents[ count( $parents ) - 1 ] === 'description'
184 )
185 );
186 };
187
188 /**
189 * Schema-graph: BreadcrumbList
190 */
191
192 $logical_rules[] = function ( $element, $parents ) {
193 return (
194 isset( $parents[0], $parents[2], $parents[3] )
195 && $parents[0] === 'itemListElement'
196 && $parents[2] === 'item'
197 && $parents[3] === 'name'
198 );
199 };
200
201 // ------------------------------------------------------------------------
202 // Plugin: Elementor
203 // ------------------------------------------------------------------------
204
205 /**
206 * Plugin: Elementor - elementorFrontendConfig
207 */
208
209 $logical_rules[] = function ( $element, $parents ) {
210 return (
211 count( $parents ) === 3
212 && isset( $parents[0], $parents[1] )
213 && $parents[0] === 'elementorFrontendConfig'
214 && $parents[1] === 'i18n'
215 );
216 };
217
218 // ------------------------------------------------------------------------
219 // Plugin: Elementor Essential Addons
220 // ------------------------------------------------------------------------
221
222 /**
223 * Plugin: Elementor - Event Calendar
224 */
225
226 $logical_rules[] = function ( $element, $parents ) {
227 return in_array(
228 $parents,
229 array(
230 array( 'data-translate', 'today' ),
231 array( 'data-translate', 'tomorrow' ),
232 )
233 );
234 };
235
236 $logical_rules[] = function ( $element, $parents ) {
237 return (
238 isset( $parents[0], $parents[1], $parents[2] )
239 && $parents[0] === 'data-events'
240 && is_int( $parents[1] )
241 && (
242 $parents[2] === 'title'
243 || $parents[2] === 'description'
244 )
245 );
246 };
247
248 $logical_rules[] = function ( $element, $parents ) {
249 return (
250 isset( $parents[0], $parents[1] )
251 && $parents[0] === 'jQuery.datepicker.setDefaults'
252 && $parents[1] !== 'dateFormat'
253 );
254 };
255
256 // ------------------------------------------------------------------------
257 // Plugin: WooCommerce
258 // ------------------------------------------------------------------------
259
260 $logical_rules[] = function ( $element, $parents ) {
261 return (
262 isset( $parents[0] )
263 && (
264 $parents[0] === 'wc_add_to_cart_params'
265 || $parents[0] === 'wc_country_select_params'
266 || $parents[0] === 'wc_address_i18n_params'
267 || $parents[0] === 'woocommerce_params'
268 || $parents[0] === 'wc_single_product_params'
269 )
270 && count( $parents ) >= 2
271 && wplng_str_starts_with( $parents[ array_key_last( $parents ) ], 'i18n_' )
272 );
273 };
274
275 $logical_rules[] = function ( $element, $parents ) {
276 return in_array(
277 $parents,
278 array(
279 array( 'config', 'woocommerce', 'messages', 'addedToCartText' ),
280
281 // JSON in attribute data-"wp-context"
282 array( 'data-wp-context', 'addToCartText' ),
283 array( 'data-wp-context', 'ariaLabel' ),
284 array( 'data-wp-context', 'ariaLabelPrevious' ),
285 array( 'data-wp-context', 'ariaLabelNext' ),
286 array( 'data-wp-context', 'addToCartText' ),
287 array( 'data-wp-context', 'inTheCartText' ),
288 array( 'data-wp-context', 'inTheCartText' ),
289
290 // Address placeholder
291 array( 'wc_address_i18n_params', 'locale', 'default', 'address_1', 'placeholder' ),
292 array( 'wc_address_i18n_params', 'locale', 'default', 'address_2', 'placeholder' ),
293
294 // JSON encoded as URL
295 array( 'encoded_as_url', 'wcSettings', 'wcBlocksConfig', 'wordCountType' ),
296 array( 'encoded_as_url', 'wcSettings', 'siteTitle' ),
297
298 array( 'config', 'woocommerce/mini-cart-title-items-counter-block', 'itemsInCartTextTemplate' ),
299 array( 'config', 'woocommerce/mini-cart-products-table-block', 'reduceQuantityLabel' ),
300 array( 'config', 'woocommerce/mini-cart-products-table-block', 'increaseQuantityLabel' ),
301 array( 'config', 'woocommerce/mini-cart-products-table-block', 'quantityDescriptionLabel' ),
302 array( 'config', 'woocommerce/mini-cart-products-table-block', 'removeFromCartLabel' ),
303 array( 'config', 'woocommerce/mini-cart-products-table-block', 'lowInStockLabel' ),
304 array( 'config', 'woocommerce/mini-cart', 'buttonAriaLabelTemplate' ),
305 array( 'state', 'woocommerce/mini-cart-title-items-counter-block', 'itemsInCartText' ),
306 )
307 );
308 };
309
310 /**
311 * Plugin: WooCommerce - Product rating
312 */
313
314 $logical_rules[] = function ( $element, $parents ) {
315 return (
316 isset( $parents[0], $parents[1], $parents[2] )
317 && $parents[0] === 'wc_single_product_params'
318 && $parents[1] === 'i18n_rating_options'
319 && is_int( $parents[2] )
320 );
321 };
322
323 /**
324 * Plugin: WooCommerce - Order Statuses
325 */
326
327 $logical_rules[] = function ( $element, $parents ) {
328 return (
329 isset(
330 $parents[0],
331 $parents[1],
332 $parents[2],
333 $parents[3]
334 )
335 && $parents[0] === 'encoded_as_url'
336 && $parents[1] === 'wcSettings'
337 && $parents[2] === 'orderStatuses'
338 && is_string( $parents[3] )
339 );
340 };
341
342 /**
343 * Plugin: WooCommerce - Item name
344 */
345
346 $logical_rules[] = function ( $element, $parents ) {
347 return (
348 count( $parents ) >= 3
349 && isset(
350 $parents[ count( $parents ) - 3 ],
351 $parents[ count( $parents ) - 2 ],
352 $parents[ count( $parents ) - 1 ],
353 )
354 && $parents[ count( $parents ) - 3 ] === 'items'
355 && is_int( $parents[ count( $parents ) - 2 ] )
356 && $parents[ count( $parents ) - 1 ] === 'name'
357 );
358 };
359
360 /**
361 * Plugin: WooCommerce - Item image name
362 */
363
364 $logical_rules[] = function ( $element, $parents ) {
365 return (
366 count( $parents ) >= 5
367 && isset(
368 $parents[ count( $parents ) - 5 ],
369 $parents[ count( $parents ) - 4 ],
370 $parents[ count( $parents ) - 3 ],
371 $parents[ count( $parents ) - 2 ],
372 $parents[ count( $parents ) - 1 ],
373 )
374 && $parents[ count( $parents ) - 5 ] === 'items'
375 && is_int( $parents[ count( $parents ) - 4 ] )
376 && $parents[ count( $parents ) - 3 ] === 'images'
377 && is_int( $parents[ count( $parents ) - 2 ] )
378 && (
379 $parents[ count( $parents ) - 1 ] === 'name'
380 || $parents[ count( $parents ) - 1 ] === 'alt'
381 )
382 );
383 };
384
385 /**
386 * Plugin: WooCommerce - Form fields
387 */
388
389 $logical_rules[] = function ( $element, $parents ) {
390 return (
391 isset(
392 $parents[0],
393 $parents[1],
394 $parents[2],
395 $parents[3],
396 $parents[4],
397 )
398 && $parents[0] === 'encoded_as_url'
399 && $parents[1] === 'wcSettings'
400 && $parents[2] === 'defaultFields'
401 && is_string( $parents[3] )
402 && (
403 $parents[4] === 'label'
404 || $parents[4] === 'optionalLabel'
405 )
406 );
407 };
408
409 /**
410 * Plugin: WooCommerce - Store pages title
411 */
412
413 $logical_rules[] = function ( $element, $parents ) {
414 return (
415 isset(
416 $parents[0],
417 $parents[1],
418 $parents[2],
419 $parents[3],
420 $parents[4],
421 )
422 && $parents[0] === 'encoded_as_url'
423 && $parents[1] === 'wcSettings'
424 && $parents[2] === 'storePages'
425 && is_string( $parents[3] )
426 && $parents[4] === 'title'
427 );
428 };
429
430 /**
431 * Plugin: WooCommerce - Country select
432 */
433
434 $logical_rules[] = function ( $element, $parents ) {
435 return (
436 isset(
437 $parents[0],
438 $parents[1],
439 $parents[2],
440 $parents[3],
441 )
442 && $parents[0] === 'wc_country_select_params'
443 && $parents[1] === 'countries'
444 && count( $parents ) === 4
445 );
446 };
447
448 /**
449 * Plugin: WooCommerce - Country name
450 */
451
452 $logical_rules[] = function ( $element, $parents ) {
453 return (
454 isset(
455 $parents[0],
456 $parents[1],
457 $parents[2],
458 $parents[3],
459 )
460 && $parents[0] === 'encoded_as_url'
461 && $parents[1] === 'wcSettings'
462 && $parents[2] === 'countries'
463 && is_string( $parents[2] )
464 );
465 };
466
467 /**
468 * Plugin: WooCommerce - Countries label
469 */
470
471 $logical_rules[] = function ( $element, $parents ) {
472 return (
473 isset(
474 $parents[0],
475 $parents[1],
476 $parents[2],
477 $parents[3],
478 $parents[4],
479 $parents[5],
480 )
481 && $parents[0] === 'encoded_as_url'
482 && $parents[1] === 'wcSettings'
483 && $parents[2] === 'countryData'
484 && is_string( $parents[3] )
485 && $parents[4] === 'states'
486 );
487 };
488
489 // ------------------------------------------------------------------------
490 // Plugin: Plugin: woocommerce-paypal-payments
491 // ------------------------------------------------------------------------
492
493 $logical_rules[] = function ( $element, $parents ) {
494 return in_array(
495 $parents,
496 array(
497 array( 'PayPalCommerceGateway', 'hosted_fields', 'labels', 'fields_empty' ),
498 array( 'PayPalCommerceGateway', 'hosted_fields', 'labels', 'fields_not_valid' ),
499 array( 'PayPalCommerceGateway', 'hosted_fields', 'labels', 'card_not_supported' ),
500 array( 'PayPalCommerceGateway', 'hosted_fields', 'labels', 'cardholder_name_required' ),
501 array( 'PayPalCommerceGateway', 'labels', 'error', 'generic' ),
502 array( 'PayPalCommerceGateway', 'labels', 'error', 'required', 'generic' ),
503 array( 'PayPalCommerceGateway', 'labels', 'error', 'required', 'field' ),
504 array( 'PayPalCommerceGateway', 'labels', 'error', 'required', 'elements', 'terms' ),
505 array( 'PayPalCommerceGateway', 'labels', 'billing_field' ),
506 array( 'PayPalCommerceGateway', 'labels', 'shipping_field' ),
507 array( 'PayPalCommerceGateway', 'labels', 'shipping_field' ),
508 )
509 );
510 };
511
512 // ------------------------------------------------------------------------
513 // Plugin: NM Gift Registry and Wishlist Lite (nm-wishlist)
514 // ------------------------------------------------------------------------
515
516 $logical_rules[] = function ( $element, $parents ) {
517 return in_array(
518 $parents,
519 array(
520 array( 'nm_wishlist_vars', 'wlButtonTitleAdd' ),
521 array( 'nm_wishlist_vars', 'wlButtonTitleRemove' ),
522 array( 'nm_wishlist_vars', 'wlButtonTitleRemove' ),
523 )
524 );
525 };
526
527 // ------------------------------------------------------------------------
528 // Plugin: Contact Form 7
529 // ------------------------------------------------------------------------
530
531 $logical_rules[] = function ( $element, $parents ) {
532 return (
533 isset( $parents[0] )
534 && (
535 $parents[0] === 'message'
536 || (
537 isset( $parents[1] )
538 && isset( $parents[2] )
539 && $parents[0] === 'rules'
540 && is_int( $parents[1] )
541 && $parents[2] === 'error'
542 )
543 || (
544 isset( $parents[1] )
545 && isset( $parents[2] )
546 && $parents[0] === 'invalid_fields'
547 && is_int( $parents[1] )
548 && $parents[2] === 'message'
549 )
550 )
551 );
552 };
553
554 // ------------------------------------------------------------------------
555 // Plugin: YITH
556 // ------------------------------------------------------------------------
557
558 $logical_rules[] = function ( $element, $parents ) {
559 return in_array(
560 $parents,
561 array(
562 array( 'yith_wcwl_l10n', 'labels', 'cookie_disabled' ),
563 )
564 );
565 };
566
567 // ------------------------------------------------------------------------
568 // Plugin: WF Cookie Consent
569 // ------------------------------------------------------------------------
570
571 $logical_rules[] = function ( $element, $parents ) {
572 return in_array(
573 $parents,
574 array(
575 array( 'wfCookieConsentSettings', 'wf_cookietext' ),
576 array( 'wfCookieConsentSettings', 'wf_dismisstext' ),
577 array( 'wfCookieConsentSettings', 'wf_linktext' ),
578 )
579 );
580 };
581
582 // ------------------------------------------------------------------------
583 // Plugin: complianz
584 // ------------------------------------------------------------------------
585
586 $logical_rules[] = function ( $element, $parents ) {
587 return in_array(
588 $parents,
589 array(
590 array( 'complianz', 'categories', 'statistics' ),
591 array( 'complianz', 'categories', 'marketing' ),
592 array( 'complianz', 'placeholdertext' ),
593 array( 'complianz', 'page_links', 'eu', 'privacy-statement', 'title' ),
594 array( 'complianz', 'page_links', 'eu', 'cookie-statement', 'title' ),
595 array( 'complianz', 'aria_label' ),
596 )
597 );
598 };
599
600 // ------------------------------------------------------------------------
601 // Plugin: ultimate-post-kit
602 // ------------------------------------------------------------------------
603
604 $logical_rules[] = function ( $element, $parents ) {
605 return in_array(
606 $parents,
607 array(
608 array( 'UltimatePostKitConfig', 'mailchimp', 'subscribing' ),
609 )
610 );
611 };
612
613 // ------------------------------------------------------------------------
614 // Plugin: royal-elementor-addons
615 // ------------------------------------------------------------------------
616
617 $logical_rules[] = function ( $element, $parents ) {
618 return in_array(
619 $parents,
620 array(
621 array( 'WprConfig', 'addedToCartText' ),
622 array( 'WprConfig', 'viewCart' ),
623 array( 'WprConfig', 'chooseQuantityText' ),
624 array( 'WprConfig', 'input_empty' ),
625 array( 'WprConfig', 'select_empty' ),
626 array( 'WprConfig', 'file_empty' ),
627 array( 'WprConfig', 'recaptcha_error' ),
628 )
629 );
630 };
631
632 // ------------------------------------------------------------------------
633 // Plugin: WP Grid Builder
634 // ------------------------------------------------------------------------
635
636 $logical_rules[] = function ( $element, $parents ) {
637 return in_array(
638 $parents,
639 array(
640 array( 'wpgb_settings', 'resultMsg', 'plural' ),
641 array( 'wpgb_settings', 'resultMsg', 'singular' ),
642 array( 'wpgb_settings', 'resultMsg', 'none' ),
643
644 array( 'wpgb_settings', 'lightbox', 'errorMsg' ),
645 array( 'wpgb_settings', 'lightbox', 'prevLabel' ),
646 array( 'wpgb_settings', 'lightbox', 'nextLabel' ),
647 array( 'wpgb_settings', 'lightbox', 'closeLabel' ),
648
649 array( 'wpgb_settings', 'combobox', 'search' ),
650 array( 'wpgb_settings', 'combobox', 'loading' ),
651 array( 'wpgb_settings', 'combobox', 'cleared' ),
652 array( 'wpgb_settings', 'combobox', 'expanded' ),
653 array( 'wpgb_settings', 'combobox', 'noResults' ),
654 array( 'wpgb_settings', 'combobox', 'collapsed' ),
655 array( 'wpgb_settings', 'combobox', 'toggleLabel' ),
656 array( 'wpgb_settings', 'combobox', 'clearLabel' ),
657 array( 'wpgb_settings', 'combobox', 'selected' ),
658 array( 'wpgb_settings', 'combobox', 'deselected' ),
659
660 array( 'wpgb_settings', 'autocomplete', 'open' ),
661 array( 'wpgb_settings', 'autocomplete', 'input' ),
662 array( 'wpgb_settings', 'autocomplete', 'clear' ),
663 array( 'wpgb_settings', 'autocomplete', 'noResults' ),
664 array( 'wpgb_settings', 'autocomplete', 'loading' ),
665 array( 'wpgb_settings', 'autocomplete', 'clearLabel' ),
666 array( 'wpgb_settings', 'autocomplete', 'select' ),
667
668 array( 'wpgb_settings', 'range', 'minLabel' ),
669 array( 'wpgb_settings', 'range', 'maxLabel' ),
670 )
671 );
672 };
673
674 // ------------------------------------------------------------------------
675 // Plugin: WP Amelia
676 // ------------------------------------------------------------------------
677
678 $logical_rules[] = function ( $element, $parents ) {
679 return (
680 // -> wpAmeliaSettings
681 isset( $parents[0] )
682 && $parents[0] === 'wpAmeliaSettings'
683 && (
684 // -> appointments
685 (
686 isset( $parents[1] )
687 && $parents[1] === 'appointments'
688 )
689 // -> roles -> providerBadges -> badges -> content
690 || (
691 isset( $parents[1] )
692 && isset( $parents[2] )
693 && isset( $parents[3] )
694 && isset( $parents[4] )
695 && isset( $parents[5] )
696 && $parents[1] === 'roles'
697 && $parents[2] === 'providerBadges'
698 && $parents[3] === 'badges'
699 && is_int( $parents[4] )
700 && $parents[5] === 'content'
701 )
702 // -> customizedData -> sbsNew -> ... -> ... -> ... -> name
703 || (
704 isset( $parents[1] )
705 && isset( $parents[2] )
706 && isset( $parents[3] )
707 && isset( $parents[4] )
708 && isset( $parents[5] )
709 && isset( $parents[6] )
710 && $parents[1] === 'customizedData'
711 && $parents[2] === 'sbsNew'
712 && $parents[6] === 'name'
713 )
714 )
715 );
716 };
717
718 $logical_rules[] = function ( $element, $parents ) {
719 return (
720 // wpAmeliaLabels -> welcome_back
721 isset( $parents[0] )
722 && $parents[0] === 'wpAmeliaLabels'
723 && isset( $parents[1] )
724 && is_string( $parents[1] )
725 );
726 };
727
728 // ------------------------------------------------------------------------
729 // Theme: Divi
730 // ------------------------------------------------------------------------
731
732 $logical_rules[] = function ( $element, $parents ) {
733 return in_array(
734 $parents,
735 array(
736 array( 'DIVI', 'item_count' ),
737 array( 'DIVI', 'items_count' ),
738
739 array( 'et_pb_custom', 'subscription_failed' ),
740 array( 'et_pb_custom', 'fill_message' ),
741 array( 'et_pb_custom', 'contact_error_message' ),
742 array( 'et_pb_custom', 'invalid' ),
743 array( 'et_pb_custom', 'captcha' ),
744 array( 'et_pb_custom', 'prev' ),
745 array( 'et_pb_custom', 'previous' ),
746 array( 'et_pb_custom', 'next' ),
747 array( 'et_pb_custom', 'wrong_captcha' ),
748 array( 'et_pb_custom', 'wrong_checkbox' ),
749
750 array( 'data-et-multi-view', 'schema', 'content', 'desktop' ),
751 array( 'data-et-multi-view', 'schema', 'content', 'tablet' ),
752 array( 'data-et-multi-view', 'schema', 'content', 'phone' ),
753 )
754 );
755 };
756
757 // ------------------------------------------------------------------------
758 // Theme: My listing
759 // ------------------------------------------------------------------------
760
761 /**
762 * Theme: My listing - JSON in HTML
763 */
764
765 $logical_rules[] = function ( $element, $parents ) {
766 return (
767 isset( $parents[0], $parents[1], $parents[2] )
768 && wplng_str_starts_with( $parents[0], 'CASE' )
769 && $parents[1] === 'l10n'
770 && (
771 $parents[2] === 'selectOption'
772 || $parents[2] === 'errorLoading'
773 || $parents[2] === 'removeAllItems'
774 || $parents[2] === 'loadingMore'
775 || $parents[2] === 'noResults'
776 || $parents[2] === 'searching'
777 || $parents[2] === 'irreversible_action'
778 || $parents[2] === 'delete_listing_confirm'
779 || $parents[2] === 'copied_to_clipboard'
780 || $parents[2] === 'nearby_listings_location_required'
781 || $parents[2] === 'nearby_listings_retrieving_location'
782 || $parents[2] === 'nearby_listings_searching'
783 || $parents[2] === 'geolocation_failed'
784 || $parents[2] === 'something_went_wrong'
785 || $parents[2] === 'all_in_category'
786 || $parents[2] === 'invalid_file_type'
787 || $parents[2] === 'file_limit_exceeded'
788 || $parents[2] === 'file_size_limit'
789 || (
790 $parents[2] === 'datepicker'
791 && isset( $parents[3] )
792 && (
793 $parents[3] === 'applyLabel'
794 || $parents[3] === 'cancelLabel'
795 || $parents[3] === 'customRangeLabel'
796 || $parents[3] === 'daysOfWeek'
797 || $parents[3] === 'monthNames'
798 )
799 )
800 )
801 );
802 };
803
804 /**
805 * Theme: My listing - JSON in AJAX
806 */
807
808 $logical_rules[] = function ( $element, $parents ) {
809 return (
810 isset( $parents[0], $parents[1], $parents[12] )
811 && $parents[0] === 'children'
812 && wplng_str_starts_with( $parents[1], 'term_' )
813 && (
814 $parents[2] === 'name'
815 || $parents[2] === 'description'
816 )
817 );
818 };
819
820 // ------------------------------------------------------------------------
821 // Theme: Breaks
822 // ------------------------------------------------------------------------
823
824 $logical_rules[] = function ( $element, $parents ) {
825 return in_array(
826 $parents,
827 array(
828 array( 'data', 'message' ),
829 )
830 );
831 };
832
833 $logical_rules[] = function ( $element, $parents ) {
834 return (
835 isset( $parents[0], $parents[1], $parents[2] )
836 && $parents[0] === 'data'
837 && $parents[1] === 'message'
838 && is_int( $parents[2] )
839 );
840 };
841
842 return apply_filters(
843 'wplng_json_rules_inclusion',
844 $logical_rules
845 );
846 }
847