activate.php
6 months ago
admin.php
4 months ago
cache-plugin-filters.php
2 months ago
demo-widgets.php
7 months ago
elementor-widgets.php
1 month ago
feature-request.php
7 months ago
get-more-customers-box.php
7 months ago
rate-us-feedback-box.php
7 months ago
schema.php
9 months ago
shortcode-paste-box.php
7 months ago
step-list.php
7 months ago
troubleshooting.php
7 months ago
uninstall.php
6 months ago
update.php
6 months ago
cache-plugin-filters.php
115 lines
| 1 | <?php |
| 2 | defined('ABSPATH') or die('No script kiddies please!'); |
| 3 | if (!function_exists('trustindex_exclude_js')) { |
| 4 | function trustindex_exclude_js($list) { |
| 5 | $list []= 'trustindex.io'; |
| 6 | $list []= 'https://cdn.trustindex.io/'; |
| 7 | $list []= 'https://cdn.trustindex.io/loader.js'; |
| 8 | $list []= 'https://cdn.trustindex.io/loader-cert.js'; |
| 9 | $list []= 'https://cdn.trustindex.io/loader-feed.js'; |
| 10 | return $list; |
| 11 | } |
| 12 | } |
| 13 | add_filter('rocket_minify_excluded_external_js', 'trustindex_exclude_js'); |
| 14 | add_filter('rocket_exclude_js', 'trustindex_exclude_js'); |
| 15 | add_filter('rocket_delay_js_exclusions', 'trustindex_exclude_js'); |
| 16 | add_filter('litespeed_optimize_js_excludes', 'trustindex_exclude_js'); |
| 17 | add_filter('sgo_javascript_combine_excluded_external_paths', 'trustindex_exclude_js'); |
| 18 | add_filter('sgo_css_combine_exclude', function($list) { |
| 19 | foreach (array ( |
| 20 | 0 => 'facebook', |
| 21 | 1 => 'google', |
| 22 | 2 => 'tripadvisor', |
| 23 | 3 => 'yelp', |
| 24 | 4 => 'booking', |
| 25 | 5 => 'amazon', |
| 26 | 6 => 'arukereso', |
| 27 | 7 => 'airbnb', |
| 28 | 8 => 'hotels', |
| 29 | 9 => 'opentable', |
| 30 | 10 => 'foursquare', |
| 31 | 11 => 'capterra', |
| 32 | 12 => 'szallashu', |
| 33 | 13 => 'thumbtack', |
| 34 | 14 => 'expedia', |
| 35 | 15 => 'zillow', |
| 36 | 16 => 'wordpressPlugin', |
| 37 | 17 => 'aliexpress', |
| 38 | 18 => 'alibaba', |
| 39 | 19 => 'sourceForge', |
| 40 | 20 => 'ebay', |
| 41 | ) as $platform) { |
| 42 | $list []= 'ti-widget-css-'. $platform; |
| 43 | } |
| 44 | foreach (array ( |
| 45 | 0 => 'facebook', |
| 46 | 1 => 'google', |
| 47 | 2 => 'instagram', |
| 48 | 3 => 'pinterest', |
| 49 | 4 => 'tiktok', |
| 50 | 5 => 'twitter', |
| 51 | 6 => 'vimeo', |
| 52 | 7 => 'youtube', |
| 53 | ) as $platform) { |
| 54 | $list []= 'trustindex-feed-widget-css-'. $platform; |
| 55 | } |
| 56 | return $list; |
| 57 | }); |
| 58 | add_filter('rocket_rucss_safelist', function($list) { |
| 59 | $list []= 'trustindex-(.*).css'; |
| 60 | $list []= '.ti-widget'; |
| 61 | return $list; |
| 62 | }); |
| 63 | add_filter('script_loader_tag', function($tag) { |
| 64 | if (strpos($tag, 'trustindex') !== false && strpos($tag, '/loader') !== false) { |
| 65 | $tag = preg_replace('/ (crossorigin|integrity|consent-required|consent-by|consent-id)=[\'"][^\'"]+[\'"]/m', '', $tag); |
| 66 | $tag = str_replace([ |
| 67 | 'consent-original-src-_', |
| 68 | 'consent-original-type-_', |
| 69 | 'type="application/consent"', |
| 70 | ], [ |
| 71 | 'src', |
| 72 | 'type', |
| 73 | '', |
| 74 | ], $tag); |
| 75 | } |
| 76 | return $tag; |
| 77 | }, 9999999); |
| 78 | add_filter('style_loader_tag', function($tag) { |
| 79 | if (strpos($tag, 'trustindex') !== false && (strpos($tag, '/assets/widget-presetted-css/') !== false || strpos($tag, '/ti-preview-box.css') !== false)) { |
| 80 | $tag = preg_replace('/ (crossorigin|integrity|consent-required|consent-by|consent-id)=[\'"][^\'"]+[\'"]/m', '', $tag); |
| 81 | $tag = str_replace([ |
| 82 | 'consent-original-src-_', |
| 83 | 'consent-original-type-_', |
| 84 | 'type="application/consent"', |
| 85 | ], [ |
| 86 | 'src', |
| 87 | 'type', |
| 88 | '', |
| 89 | ], $tag); |
| 90 | } |
| 91 | return $tag; |
| 92 | }, 9999999); |
| 93 | $localizationFiles = get_option('litespeed.conf.optm-localize_domains'); |
| 94 | $isJson = false; |
| 95 | if (is_string($localizationFiles)) { |
| 96 | $localizationFiles = json_decode($localizationFiles, true); |
| 97 | $isJson = true; |
| 98 | } |
| 99 | if ($localizationFiles && is_array($localizationFiles)) { |
| 100 | $isUpdated = false; |
| 101 | foreach ($localizationFiles as $i => $url) { |
| 102 | if (strpos($url, '#') !== 0 && strpos($url, '.trustindex.') !== false) { |
| 103 | $localizationFiles[$i] = '# '.$url; |
| 104 | $isUpdated = true; |
| 105 | } |
| 106 | } |
| 107 | if ($isUpdated) { |
| 108 | if ($isJson) { |
| 109 | $localizationFiles = json_encode($localizationFiles); |
| 110 | } |
| 111 | update_option('litespeed.conf.optm-localize_domains', $localizationFiles, true); |
| 112 | } |
| 113 | } |
| 114 | ?> |
| 115 |