Changeset 3372990
- Timestamp:
- 10/05/2025 02:01:30 AM (6 months ago)
- Location:
- fast-velocity-minify/trunk
- Files:
-
- 3 edited
-
fvm.php (modified) (1 diff)
-
inc/common.php (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fast-velocity-minify/trunk/fvm.php
r3241155 r3372990 4 4 * Plugin URI: https://www.upwork.com/fl/raulpeixoto 5 5 * Description: Improve your speed score on GTmetrix, Pingdom Tools and Google PageSpeed Insights by merging and minifying CSS and JavaScript files into groups, compressing HTML and other speed optimizations. 6 * Version: 3. 4.36 * Version: 3.5.0 7 7 * Author: Raul Peixoto 8 8 * Author URI: https://www.upwork.com/fl/raulpeixoto -
fast-velocity-minify/trunk/inc/common.php
r3241155 r3372990 355 355 } 356 356 357 # Purge CLP Varnish Cache (cloudpanel.io) 358 if ( class_exists('ClpVarnishCacheManager') ) { 359 try { 360 $clp_varnish = new ClpVarnishCacheManager(); 361 if ( method_exists($clp_varnish, 'is_enabled') && $clp_varnish->is_enabled() ) { 362 if ( method_exists($clp_varnish, 'purge_host') ) { 363 $host = parse_url( home_url(), PHP_URL_HOST ); 364 if ( !empty($host) ) { 365 $clp_varnish->purge_host( $host ); 366 return __( 'All caches on <strong>CLP Varnish Cache</strong> have been purged.', 'fast-velocity-minify' ); 367 } 368 } 369 } 370 } catch (\Exception $e) { 371 return __( 'CLP Varnish Cache purge failed: ' . $e->getMessage(), 'fast-velocity-minify' ); 372 } 373 } 374 357 375 # bigscoots.com 358 376 if(has_action('bs_cache_purge_cache')) { … … 543 561 544 562 # php 545 if(!file_exists($file) || (file_exists($file) && filemtime($file) < $tvers)) { file_put_contents($file, $code); } 563 if(!file_exists($file) || (file_exists($file) && filemtime($file) < $tvers)) { 564 # add @charset "UTF-8"; for CSS files only 565 if ($type == 'css' && !empty($code)) { 566 $code = '@charset "UTF-8";' . PHP_EOL . $code; 567 } 568 file_put_contents($file, $code); 569 } 546 570 if(file_exists($file)) { return $public; } 547 571 … … 993 1017 994 1018 # get minification settings for files 1019 $enable_css_minification = false; 995 1020 if(isset($fvm_settings['css']['css_enable_min_files'])) { 996 1021 $enable_css_minification = $fvm_settings['css']['css_enable_min_files']; … … 1703 1728 # ensure that string is utf8 1704 1729 function fvm_ensure_utf8($str) { 1730 1731 # remove UTF-8 BOM if present 1732 $bom = pack('H*','EFBBBF'); 1733 if (strpos($str, $bom) === 0) { 1734 $str = substr($str, 3); 1735 } 1736 1737 # FIRST: check if it's already valid UTF-8 - if yes, return unchanged 1738 # This prevents double-encoding issues with files that contain valid UTF-8 characters 1739 # (e.g., icon fonts with literal Unicode characters in private use areas) 1740 if (mb_check_encoding($str, 'UTF-8')) { 1741 return $str; // already valid UTF-8, no conversion needed 1742 } 1743 1744 # NOT valid UTF-8, so try to detect the actual encoding and convert 1705 1745 $encodings = [ "UTF-32", "UTF-32BE", "UTF-32LE", "UTF-16", "UTF-16BE", "UTF-16LE", "UTF-8", "ASCII", "EUC-JP", "SJIS", "eucJP-win", "SJIS-win", "JIS", "ISO-2022-JP", "Windows-1252", "ISO-8859-1", "ISO-8859-2", "ISO-8859-3", "ISO-8859-4", "ISO-8859-5", "ISO-8859-6", "ISO-8859-7", "ISO-8859-8", "ISO-8859-9", "ISO-8859-10", "ISO-8859-13", "ISO-8859-14", "ISO-8859-15", "EUC-CN", "CP936", "EUC-TW", "BIG-5", "EUC-KR", "UHC", "ISO-2022-KR", "Windows-1251", "KOI8-R" ]; 1706 1746 $enc = mb_detect_encoding($str, $encodings, true); 1707 if ($enc === false){ 1708 return mb_convert_encoding($str, "UTF-8", "UTF-8"); // could not detect encoding, so try as utf-8 1747 1748 if ($enc === false) { 1749 # Could not detect - try assuming Windows-1252 (common for mis-encoded files) 1750 $converted = @mb_convert_encoding($str, "UTF-8", "Windows-1252"); 1751 if ($converted !== false && mb_check_encoding($converted, 'UTF-8')) { 1752 return $converted; 1753 } 1754 # Last resort: force UTF-8 interpretation 1755 return mb_convert_encoding($str, "UTF-8", "UTF-8"); 1709 1756 } else if ($enc !== "UTF-8") { 1710 1757 return mb_convert_encoding($str, "UTF-8", $enc); // converted to utf8 1711 } else { 1712 return $str; // already utf8 1713 } 1714 1715 # fail 1716 return false; 1758 } 1759 1760 # fallback 1761 return $str; 1717 1762 } 1718 1763 -
fast-velocity-minify/trunk/readme.txt
r3241155 r3372990 4 4 Requires at least: 5.6 5 5 Requires PHP: 7.2 6 Stable tag: 3. 4.37 Tested up to: 6. 7.36 Stable tag: 3.5.0 7 Tested up to: 6.8.3 8 8 Text Domain: fast-velocity-minify 9 9 License: GPLv3 or later … … 49 49 50 50 == Changelog == 51 52 = 3.5.0 [2025.10.05] = 53 * Fixed UTF-8 encoding issues with CSS minification that caused icon fonts to display incorrectly 54 * Added @charset "UTF-8" declaration to all minified CSS files for proper encoding 55 * Fixed undefined variable warnings for $enable_css_minification 56 * Improved encoding detection to prevent double-encoding of valid UTF-8 content 57 * Enhanced compatibility with icon fonts using literal Unicode characters 58 * Added support for CLP Varnish Cache (cloudpanel.io) integration for automatic cache purging 51 59 52 60 = 3.4.3 [2025.02.15] =
Note: See TracChangeset
for help on using the changeset viewer.