| @@ -14,9 +14,15 @@ | ||
| 14 | 14 | * |
| 15 | 15 | * @return array Array of function names with dot notation. |
| 16 | 16 | */ |
| 17 | 17 | function wplng_data_json_in_js_functions() { |
| 18 | - return apply_filters( | |
| 18 | + global $wplng_data_json_in_js_functions; | |
| 19 | + | |
| 20 | + if ( null !== $wplng_data_json_in_js_functions ) { | |
| 21 | + return $wplng_data_json_in_js_functions; | |
| 22 | + } | |
| 23 | + | |
| 24 | + $wplng_data_json_in_js_functions = apply_filters( | |
| 19 | 25 | 'wplng_json_in_js_functions', |
| 20 | 26 | array( |
| 21 | 27 | 'jQuery.datepicker.setDefaults', |
| 22 | 28 | '$.datepicker.setDefaults', |
| @@ -21,8 +27,10 @@ | ||
| 21 | 27 | 'jQuery.datepicker.setDefaults', |
| 22 | 28 | '$.datepicker.setDefaults', |
| 23 | 29 | ) |
| 24 | 30 | ); |
| 31 | + | |
| 32 | + return $wplng_data_json_in_js_functions; | |
| 25 | 33 | } |
| 26 | 34 | |
| 27 | 35 | |
| 28 | 36 | /** |
| @@ -33,9 +41,14 @@ | ||
| 33 | 41 | * |
| 34 | 42 | * @return array Array of callback functions defining exclusion rules. |
| 35 | 43 | */ |
| 36 | 44 | function wplng_data_json_rules_exclusion() { |
| 45 | + global $wplng_data_json_rules_exclusion; | |
| 37 | 46 | |
| 47 | + if ( null !== $wplng_data_json_rules_exclusion ) { | |
| 48 | + return $wplng_data_json_rules_exclusion; | |
| 49 | + } | |
| 50 | + | |
| 38 | 51 | $logical_rules = array(); |
| 39 | 52 | |
| 40 | 53 | // ------------------------------------------------------------------------ |
| 41 | 54 | // Plugin: wpLingua (Ajax edit modal) |
| @@ -87,12 +100,14 @@ | ||
| 87 | 100 | && $parents[0] === 'wc_order_attribution' |
| 88 | 101 | ); |
| 89 | 102 | }; |
| 90 | 103 | |
| 91 | - return apply_filters( | |
| 104 | + $wplng_data_json_rules_exclusion = apply_filters( | |
| 92 | 105 | 'wplng_json_rules_exclusion', |
| 93 | 106 | $logical_rules |
| 94 | 107 | ); |
| 108 | + | |
| 109 | + return $wplng_data_json_rules_exclusion; | |
| 95 | 110 | } |
| 96 | 111 | |
| 97 | 112 | |
| 98 | 113 | /** |
| @@ -103,9 +118,14 @@ | ||
| 103 | 118 | * |
| 104 | 119 | * @return array Array of callback functions defining inclusion rules. |
| 105 | 120 | */ |
| 106 | 121 | function wplng_data_json_rules_inclusion() { |
| 122 | + global $wplng_data_json_rules_inclusion; | |
| 107 | 123 | |
| 124 | + if ( null !== $wplng_data_json_rules_inclusion ) { | |
| 125 | + return $wplng_data_json_rules_inclusion; | |
| 126 | + } | |
| 127 | + | |
| 108 | 128 | $logical_rules = array(); |
| 109 | 129 | |
| 110 | 130 | // ------------------------------------------------------------------------ |
| 111 | 131 | // Global methods |
| @@ -725,8 +745,60 @@ | ||
| 725 | 745 | ); |
| 726 | 746 | }; |
| 727 | 747 | |
| 728 | 748 | // ------------------------------------------------------------------------ |
| 749 | + // Plugin: advanced-post-block | |
| 750 | + // ------------------------------------------------------------------------ | |
| 751 | + | |
| 752 | + $logical_rules[] = function ( $element, $parents ) { | |
| 753 | + return ( | |
| 754 | + isset( $parents[0], $parents[1], $parents[2], $parents[3], $parents[4] ) | |
| 755 | + && $parents[0] === 'data' | |
| 756 | + && $parents[1] === 'posts' | |
| 757 | + && is_int($parents[2]) | |
| 758 | + && $parents[3] === 'thumbnail' | |
| 759 | + && $parents[4] === 'alt' | |
| 760 | + ); | |
| 761 | + }; | |
| 762 | + | |
| 763 | + $logical_rules[] = function ( $element, $parents ) { | |
| 764 | + return ( | |
| 765 | + isset( $parents[0], $parents[1], $parents[2], $parents[3] ) | |
| 766 | + && $parents[0] === 'data' | |
| 767 | + && $parents[1] === 'posts' | |
| 768 | + && is_int($parents[2]) | |
| 769 | + && ( | |
| 770 | + $parents[3] === 'title' | |
| 771 | + || $parents[3] === 'date' | |
| 772 | + || $parents[3] === 'excerpt' | |
| 773 | + ) | |
| 774 | + ); | |
| 775 | + }; | |
| 776 | + | |
| 777 | + $logical_rules[] = function ( $element, $parents ) { | |
| 778 | + return in_array( | |
| 779 | + $parents, | |
| 780 | + array( | |
| 781 | + array( 'data-attributes', 'readMoreLabel' ), | |
| 782 | + ) | |
| 783 | + ); | |
| 784 | + }; | |
| 785 | + | |
| 786 | + // ------------------------------------------------------------------------ | |
| 787 | + // Theme: GeneratePress | |
| 788 | + // ------------------------------------------------------------------------ | |
| 789 | + | |
| 790 | + $logical_rules[] = function ( $element, $parents ) { | |
| 791 | + return in_array( | |
| 792 | + $parents, | |
| 793 | + array( | |
| 794 | + array( 'generatepressMenu', 'openSubMenuLabel' ), | |
| 795 | + array( 'generatepressMenu', 'closeSubMenuLabel' ), | |
| 796 | + ) | |
| 797 | + ); | |
| 798 | + }; | |
| 799 | + | |
| 800 | + // ------------------------------------------------------------------------ | |
| 729 | 801 | // Theme: Divi |
| 730 | 802 | // ------------------------------------------------------------------------ |
| 731 | 803 | |
| 732 | 804 | $logical_rules[] = function ( $element, $parents ) { |
| @@ -817,9 +889,9 @@ | ||
| 817 | 889 | ); |
| 818 | 890 | }; |
| 819 | 891 | |
| 820 | 892 | // ------------------------------------------------------------------------ |
| 821 | - // Theme: Breaks | |
| 893 | + // Theme: Briks | |
| 822 | 894 | // ------------------------------------------------------------------------ |
| 823 | 895 | |
| 824 | 896 | $logical_rules[] = function ( $element, $parents ) { |
| 825 | 897 | return in_array( |
| @@ -838,9 +910,19 @@ | ||
| 838 | 910 | && is_int( $parents[2] ) |
| 839 | 911 | ); |
| 840 | 912 | }; |
| 841 | 913 | |
| 842 | - return apply_filters( | |
| 914 | + $logical_rules[] = function ( $element, $parents ) { | |
| 915 | + return ( | |
| 916 | + isset( $parents[0], $parents[1], $parents[2] ) | |
| 917 | + && $parents[0] === 'bricksData' | |
| 918 | + && $parents[1] === 'i18n' | |
| 919 | + ); | |
| 920 | + }; | |
| 921 | + | |
| 922 | + $wplng_data_json_rules_inclusion = apply_filters( | |
| 843 | 923 | 'wplng_json_rules_inclusion', |
| 844 | 924 | $logical_rules |
| 845 | 925 | ); |
| 926 | + | |
| 927 | + return $wplng_data_json_rules_inclusion; | |
| 846 | 928 | } |