| @@ -1,132 +1,151 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -// If this file is called directly, abort. | |
| 4 | -if ( ! defined( 'WPINC' ) ) { | |
| 5 | - die; | |
| 6 | -} | |
| 7 | - | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * Get selectors of excluded elements | |
| 11 | - * | |
| 12 | - * @return array | |
| 13 | - */ | |
| 14 | -function wplng_data_excluded_selector_default() { | |
| 15 | - return array( | |
| 16 | - // Default nodes | |
| 17 | - 'style', | |
| 18 | - 'svg', | |
| 19 | - 'canvas', | |
| 20 | - 'address', | |
| 21 | - 'iframe', | |
| 22 | - 'code', | |
| 23 | - 'xml', | |
| 24 | - | |
| 25 | - // Link tag | |
| 26 | - 'link[rel="EditURI"]', | |
| 27 | - 'link[title="oEmbed (JSON)"]', | |
| 28 | - 'link[title="oEmbed (XML)"]', | |
| 29 | - 'link[title="JSON"]', | |
| 30 | - 'link[type="application/rss+xml"]', | |
| 31 | - | |
| 32 | - // Default class | |
| 33 | - '.no-translate', | |
| 34 | - '.notranslate', | |
| 35 | - | |
| 36 | - // wpLingua | |
| 37 | - '#wplingua-load-in-progress-data', | |
| 38 | - | |
| 39 | - // Wordpress | |
| 40 | - '#wpadminbar', | |
| 41 | - '.wp-embed-share-input', | |
| 42 | - '[aria-label="HTML"]', | |
| 43 | - '#media-views-js-extra', | |
| 44 | - '#wp-api-request-js-extra', | |
| 45 | - 'body#error-page', | |
| 46 | - '.wp-die-message', | |
| 47 | - | |
| 48 | - // wpLingua | |
| 49 | - 'link[hreflang]', | |
| 50 | - '.wplng-switcher', | |
| 51 | - '.wplingua-menu', | |
| 52 | - '#wplng-modal-edit-container', | |
| 53 | - | |
| 54 | - // Comment | |
| 55 | - '.comment-content', | |
| 56 | - '.comment-author', | |
| 57 | - '.comment_postinfo .fn', | |
| 58 | - | |
| 59 | - // Author name | |
| 60 | - '.author.vcard', | |
| 61 | - '.entry-author .fn', | |
| 62 | - | |
| 63 | - // Plugin: Query Monitor | |
| 64 | - '#query-monitor', | |
| 65 | - '#query-monitor-main', | |
| 66 | - | |
| 67 | - // Plugin: SecuPress | |
| 68 | - '#secupress-donttranslate', | |
| 69 | - | |
| 70 | - // Plugin: Debug Bar | |
| 71 | - '#querylist', | |
| 72 | - | |
| 73 | - // Plugin: Google Site Kit | |
| 74 | - '#googlesitekit-base-data-js-extra', | |
| 75 | - | |
| 76 | - // Plugin: Smash Balloon - Social photo feed | |
| 77 | - '#sb_instagram', | |
| 78 | - | |
| 79 | - // Plugin: Complianz GDPR | |
| 80 | - '.cookies-per-purpose .name', | |
| 81 | - | |
| 82 | - // Plugin: SEOPress | |
| 83 | - '#seopress-metabox-js-extra', | |
| 84 | - | |
| 85 | - // Plugin: WooCommerce | |
| 86 | - '.woocommerce-Price-amount', | |
| 87 | - | |
| 88 | - // Plugin: events-calendar-pro | |
| 89 | - '.tribe-event-date-start', | |
| 90 | - ); | |
| 91 | -} | |
| 92 | - | |
| 93 | - | |
| 94 | -/** | |
| 95 | - * Get selectors of excluded elements in visual editor | |
| 96 | - * | |
| 97 | - * @return array | |
| 98 | - */ | |
| 99 | -function wplng_data_excluded_editor_link() { | |
| 100 | - return apply_filters( | |
| 101 | - 'wplng_excluded_editor_link', | |
| 102 | - array( | |
| 103 | - 'textarea', | |
| 104 | - 'pre', | |
| 105 | - 'option', | |
| 106 | - ) | |
| 107 | - ); | |
| 108 | -} | |
| 109 | - | |
| 110 | - | |
| 111 | -/** | |
| 112 | - * Get selectors of excluded nodes text | |
| 113 | - * Exclude the node content, not the attributes (title, href, ...) | |
| 114 | - * | |
| 115 | - * @return array | |
| 116 | - */ | |
| 117 | -function wplng_data_excluded_node_text() { | |
| 118 | - return apply_filters( | |
| 119 | - 'wplng_excluded_node_text', | |
| 120 | - array( | |
| 121 | - 'style', | |
| 122 | - 'svg', | |
| 123 | - 'canvas', | |
| 124 | - 'link', | |
| 125 | - 'script', | |
| 126 | - 'code', | |
| 127 | - | |
| 128 | - // Plugin: Contact Form 7 | |
| 129 | - '.wpcf7-textarea', | |
| 130 | - ) | |
| 131 | - ); | |
| 132 | -} | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +// If this file is called directly, abort. | |
| 4 | +if ( ! defined( 'WPINC' ) ) { | |
| 5 | + die; | |
| 6 | +} | |
| 7 | + | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * Get selectors of excluded elements | |
| 11 | + * | |
| 12 | + * @return array | |
| 13 | + */ | |
| 14 | +function wplng_data_excluded_selector_default() { | |
| 15 | + return array( | |
| 16 | + // Default nodes | |
| 17 | + 'style', | |
| 18 | + 'svg', | |
| 19 | + 'canvas', | |
| 20 | + 'address', | |
| 21 | + 'iframe', | |
| 22 | + 'code', | |
| 23 | + 'xml', | |
| 24 | + | |
| 25 | + // Link tag | |
| 26 | + 'link[rel="EditURI"]', | |
| 27 | + 'link[title="oEmbed (JSON)"]', | |
| 28 | + 'link[title="oEmbed (XML)"]', | |
| 29 | + 'link[title="JSON"]', | |
| 30 | + 'link[type="application/rss+xml"]', | |
| 31 | + | |
| 32 | + // Default class | |
| 33 | + '.no-translate', | |
| 34 | + '.notranslate', | |
| 35 | + | |
| 36 | + // wpLingua | |
| 37 | + '#wplingua-load-in-progress-data', | |
| 38 | + | |
| 39 | + // Wordpress | |
| 40 | + '#wpadminbar', | |
| 41 | + '.wp-embed-share-input', | |
| 42 | + '[aria-label="HTML"]', | |
| 43 | + '#media-views-js-extra', | |
| 44 | + '#wp-api-request-js-extra', | |
| 45 | + 'body#error-page', | |
| 46 | + '.wp-die-message', | |
| 47 | + | |
| 48 | + // wpLingua | |
| 49 | + 'link[hreflang]', | |
| 50 | + '.wplng-switcher', | |
| 51 | + '.wplingua-menu', | |
| 52 | + '#wplng-modal-edit-container', | |
| 53 | + | |
| 54 | + // Comment | |
| 55 | + '.comment-content', | |
| 56 | + '.comment-author', | |
| 57 | + '.comment_postinfo .fn', | |
| 58 | + | |
| 59 | + // Author name | |
| 60 | + '.author.vcard', | |
| 61 | + '.entry-author .fn', | |
| 62 | + | |
| 63 | + // Plugin: Query Monitor | |
| 64 | + '#query-monitor', | |
| 65 | + '#query-monitor-main', | |
| 66 | + | |
| 67 | + // Plugin: SecuPress | |
| 68 | + '#secupress-donttranslate', | |
| 69 | + | |
| 70 | + // Plugin: Debug Bar | |
| 71 | + '#querylist', | |
| 72 | + | |
| 73 | + // Plugin: Google Site Kit | |
| 74 | + '#googlesitekit-base-data-js-extra', | |
| 75 | + | |
| 76 | + // Plugin: Smash Balloon - Social photo feed | |
| 77 | + '#sb_instagram', | |
| 78 | + | |
| 79 | + // Plugin: Complianz GDPR | |
| 80 | + '.cookies-per-purpose .name', | |
| 81 | + | |
| 82 | + // Plugin: SEOPress | |
| 83 | + '#seopress-metabox-js-extra', | |
| 84 | + | |
| 85 | + // Plugin: WooCommerce | |
| 86 | + '.woocommerce-Price-amount', | |
| 87 | + | |
| 88 | + // Plugin: events-calendar-pro | |
| 89 | + '.tribe-event-date-start', | |
| 90 | + | |
| 91 | + // Plugin: top-10 | |
| 92 | + '.tptn_counter', | |
| 93 | + ); | |
| 94 | +} | |
| 95 | + | |
| 96 | + | |
| 97 | +/** | |
| 98 | + * Get selectors of excluded elements in visual editor | |
| 99 | + * | |
| 100 | + * @return array | |
| 101 | + */ | |
| 102 | +function wplng_data_excluded_editor_link() { | |
| 103 | + global $wplng_data_excluded_editor_link; | |
| 104 | + | |
| 105 | + if ( null !== $wplng_data_excluded_editor_link ) { | |
| 106 | + return $wplng_data_excluded_editor_link; | |
| 107 | + } | |
| 108 | + | |
| 109 | + $wplng_data_excluded_editor_link = apply_filters( | |
| 110 | + 'wplng_excluded_editor_link', | |
| 111 | + array( | |
| 112 | + 'textarea', | |
| 113 | + 'pre', | |
| 114 | + 'option', | |
| 115 | + ) | |
| 116 | + ); | |
| 117 | + | |
| 118 | + return $wplng_data_excluded_editor_link; | |
| 119 | +} | |
| 120 | + | |
| 121 | + | |
| 122 | +/** | |
| 123 | + * Get selectors of excluded nodes text | |
| 124 | + * Exclude the node content, not the attributes (title, href, ...) | |
| 125 | + * | |
| 126 | + * @return array | |
| 127 | + */ | |
| 128 | +function wplng_data_excluded_node_text() { | |
| 129 | + global $wplng_data_excluded_node_text; | |
| 130 | + | |
| 131 | + if ( null !== $wplng_data_excluded_node_text ) { | |
| 132 | + return $wplng_data_excluded_node_text; | |
| 133 | + } | |
| 134 | + | |
| 135 | + $wplng_data_excluded_node_text = apply_filters( | |
| 136 | + 'wplng_excluded_node_text', | |
| 137 | + array( | |
| 138 | + 'style', | |
| 139 | + 'svg', | |
| 140 | + 'canvas', | |
| 141 | + 'link', | |
| 142 | + 'script', | |
| 143 | + 'code', | |
| 144 | + | |
| 145 | + // Plugin: Contact Form 7 | |
| 146 | + '.wpcf7-textarea', | |
| 147 | + ) | |
| 148 | + ); | |
| 149 | + | |
| 150 | + return $wplng_data_excluded_node_text; | |
| 151 | +} | |