PluginProbe
Translate and Go multilingual – Automatic AI translation – wpLingua / 2.10.0
Translate and Go multilingual – Automatic AI translation – wpLingua v2.10.0
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.10.0, at data/json.php

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