PluginProbe
Translate and Go multilingual – Automatic AI translation – wpLingua / 2.11.2
Translate and Go multilingual – Automatic AI translation – wpLingua v2.11.2
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 1.1.1 All 111 releases
wplingua / data / json.php

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

824 lines 23.3 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', 'aria_label' ),
595 )
596 );
597 };
598
599 // ------------------------------------------------------------------------
600 // Plugin: ultimate-post-kit
601 // ------------------------------------------------------------------------
602
603 $logical_rules[] = function ( $element, $parents ) {
604 return in_array(
605 $parents,
606 array(
607 array( 'UltimatePostKitConfig', 'mailchimp', 'subscribing' ),
608 )
609 );
610 };
611
612 // ------------------------------------------------------------------------
613 // Plugin: royal-elementor-addons
614 // ------------------------------------------------------------------------
615
616 $logical_rules[] = function ( $element, $parents ) {
617 return in_array(
618 $parents,
619 array(
620 array( 'WprConfig', 'addedToCartText' ),
621 array( 'WprConfig', 'viewCart' ),
622 array( 'WprConfig', 'chooseQuantityText' ),
623 array( 'WprConfig', 'input_empty' ),
624 array( 'WprConfig', 'select_empty' ),
625 array( 'WprConfig', 'file_empty' ),
626 array( 'WprConfig', 'recaptcha_error' ),
627 )
628 );
629 };
630
631 // ------------------------------------------------------------------------
632 // Plugin: WP Grid Builder
633 // ------------------------------------------------------------------------
634
635 $logical_rules[] = function ( $element, $parents ) {
636 return in_array(
637 $parents,
638 array(
639 array( 'wpgb_settings', 'resultMsg', 'plural' ),
640 array( 'wpgb_settings', 'resultMsg', 'singular' ),
641 array( 'wpgb_settings', 'resultMsg', 'none' ),
642
643 array( 'wpgb_settings', 'lightbox', 'errorMsg' ),
644 array( 'wpgb_settings', 'lightbox', 'prevLabel' ),
645 array( 'wpgb_settings', 'lightbox', 'nextLabel' ),
646 array( 'wpgb_settings', 'lightbox', 'closeLabel' ),
647
648 array( 'wpgb_settings', 'combobox', 'search' ),
649 array( 'wpgb_settings', 'combobox', 'loading' ),
650 array( 'wpgb_settings', 'combobox', 'cleared' ),
651 array( 'wpgb_settings', 'combobox', 'expanded' ),
652 array( 'wpgb_settings', 'combobox', 'noResults' ),
653 array( 'wpgb_settings', 'combobox', 'collapsed' ),
654 array( 'wpgb_settings', 'combobox', 'toggleLabel' ),
655 array( 'wpgb_settings', 'combobox', 'clearLabel' ),
656 array( 'wpgb_settings', 'combobox', 'selected' ),
657 array( 'wpgb_settings', 'combobox', 'deselected' ),
658
659 array( 'wpgb_settings', 'autocomplete', 'open' ),
660 array( 'wpgb_settings', 'autocomplete', 'input' ),
661 array( 'wpgb_settings', 'autocomplete', 'clear' ),
662 array( 'wpgb_settings', 'autocomplete', 'noResults' ),
663 array( 'wpgb_settings', 'autocomplete', 'loading' ),
664 array( 'wpgb_settings', 'autocomplete', 'clearLabel' ),
665 array( 'wpgb_settings', 'autocomplete', 'select' ),
666
667 array( 'wpgb_settings', 'range', 'minLabel' ),
668 array( 'wpgb_settings', 'range', 'maxLabel' ),
669 )
670 );
671 };
672
673 // ------------------------------------------------------------------------
674 // Plugin: WP Amelia
675 // ------------------------------------------------------------------------
676
677 $logical_rules[] = function ( $element, $parents ) {
678 return (
679 // -> wpAmeliaSettings
680 isset( $parents[0] )
681 && $parents[0] === 'wpAmeliaSettings'
682 && (
683 // -> appointments
684 (
685 isset( $parents[1] )
686 && $parents[1] === 'appointments'
687 )
688 // -> roles -> providerBadges -> badges -> content
689 || (
690 isset( $parents[1] )
691 && isset( $parents[2] )
692 && isset( $parents[3] )
693 && isset( $parents[4] )
694 && isset( $parents[5] )
695 && $parents[1] === 'roles'
696 && $parents[2] === 'providerBadges'
697 && $parents[3] === 'badges'
698 && is_int( $parents[4] )
699 && $parents[5] === 'content'
700 )
701 // -> customizedData -> sbsNew -> ... -> ... -> ... -> name
702 || (
703 isset( $parents[1] )
704 && isset( $parents[2] )
705 && isset( $parents[3] )
706 && isset( $parents[4] )
707 && isset( $parents[5] )
708 && isset( $parents[6] )
709 && $parents[1] === 'customizedData'
710 && $parents[2] === 'sbsNew'
711 && $parents[6] === 'name'
712 )
713 )
714 );
715 };
716
717 $logical_rules[] = function ( $element, $parents ) {
718 return (
719 // wpAmeliaLabels -> welcome_back
720 isset( $parents[0] )
721 && $parents[0] === 'wpAmeliaLabels'
722 && isset( $parents[1] )
723 && is_string( $parents[1] )
724 );
725 };
726
727 // ------------------------------------------------------------------------
728 // Theme: Divi
729 // ------------------------------------------------------------------------
730
731 $logical_rules[] = function ( $element, $parents ) {
732 return in_array(
733 $parents,
734 array(
735 array( 'DIVI', 'item_count' ),
736 array( 'DIVI', 'items_count' ),
737
738 array( 'et_pb_custom', 'subscription_failed' ),
739 array( 'et_pb_custom', 'fill_message' ),
740 array( 'et_pb_custom', 'contact_error_message' ),
741 array( 'et_pb_custom', 'invalid' ),
742 array( 'et_pb_custom', 'captcha' ),
743 array( 'et_pb_custom', 'prev' ),
744 array( 'et_pb_custom', 'previous' ),
745 array( 'et_pb_custom', 'next' ),
746 array( 'et_pb_custom', 'wrong_captcha' ),
747 array( 'et_pb_custom', 'wrong_checkbox' ),
748
749 array( 'data-et-multi-view', 'schema', 'content', 'desktop' ),
750 array( 'data-et-multi-view', 'schema', 'content', 'tablet' ),
751 array( 'data-et-multi-view', 'schema', 'content', 'phone' ),
752 )
753 );
754 };
755
756 // ------------------------------------------------------------------------
757 // Theme: My listing
758 // ------------------------------------------------------------------------
759
760 /**
761 * Theme: My listing - JSON in HTML
762 */
763
764 $logical_rules[] = function ( $element, $parents ) {
765 return (
766 isset( $parents[0], $parents[1], $parents[2] )
767 && wplng_str_starts_with( $parents[0], 'CASE' )
768 && $parents[1] === 'l10n'
769 && (
770 $parents[2] === 'selectOption'
771 || $parents[2] === 'errorLoading'
772 || $parents[2] === 'removeAllItems'
773 || $parents[2] === 'loadingMore'
774 || $parents[2] === 'noResults'
775 || $parents[2] === 'searching'
776 || $parents[2] === 'irreversible_action'
777 || $parents[2] === 'delete_listing_confirm'
778 || $parents[2] === 'copied_to_clipboard'
779 || $parents[2] === 'nearby_listings_location_required'
780 || $parents[2] === 'nearby_listings_retrieving_location'
781 || $parents[2] === 'nearby_listings_searching'
782 || $parents[2] === 'geolocation_failed'
783 || $parents[2] === 'something_went_wrong'
784 || $parents[2] === 'all_in_category'
785 || $parents[2] === 'invalid_file_type'
786 || $parents[2] === 'file_limit_exceeded'
787 || $parents[2] === 'file_size_limit'
788 || (
789 $parents[2] === 'datepicker'
790 && isset( $parents[3] )
791 && (
792 $parents[3] === 'applyLabel'
793 || $parents[3] === 'cancelLabel'
794 || $parents[3] === 'customRangeLabel'
795 || $parents[3] === 'daysOfWeek'
796 || $parents[3] === 'monthNames'
797 )
798 )
799 )
800 );
801 };
802
803 /**
804 * Theme: My listing - JSON in AJAX
805 */
806
807 $logical_rules[] = function ( $element, $parents ) {
808 return (
809 isset( $parents[0], $parents[1], $parents[12] )
810 && $parents[0] === 'children'
811 && wplng_str_starts_with( $parents[1], 'term_' )
812 && (
813 $parents[2] === 'name'
814 || $parents[2] === 'description'
815 )
816 );
817 };
818
819 return apply_filters(
820 'wplng_json_rules_inclusion',
821 $logical_rules
822 );
823 }
824