Version Description
[2020.02.18] = * changed cache file names hash to longer names to avoid colisions on elementor plugin
Download this release
Release Info
Developer | Alignak |
Plugin | Fast Velocity Minify |
Version | 2.7.9 |
Comparing to | |
See all releases |
Code changes from version 2.7.8 to 2.7.9
- fvm.php +27 -27
- inc/functions.php +3 -3
- readme.txt +4 -1
fvm.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://fastvelocity.com
|
|
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 |
Author: Raul Peixoto
|
7 |
Author URI: http://fastvelocity.com
|
8 |
-
Version: 2.7.
|
9 |
License: GPL2
|
10 |
|
11 |
------------------------------------------------------------------------
|
@@ -329,7 +329,7 @@ function fastvelocity_min_files_callback() {
|
|
329 |
if ($ext == 'css' && file_exists($mincss)) { $filename = basename($mincss); }
|
330 |
if ($ext == 'js' && file_exists($minjs)) { $filename = basename($minjs); }
|
331 |
$fsize = fastvelocity_format_filesize(filesize($file));
|
332 |
-
$uid = hash('
|
333 |
array_push($return[$ext], array('uid'=>$uid, 'filename' => $filename, 'log' => $log, 'fsize' => $fsize));
|
334 |
}
|
335 |
}
|
@@ -1299,7 +1299,7 @@ for($i=0,$l=count($header);$i<$l;$i++) {
|
|
1299 |
|
1300 |
# static cache file info + done
|
1301 |
$done = array_merge($done, $header[$i]['handles']);
|
1302 |
-
$hash = 'header-'.hash('
|
1303 |
|
1304 |
# create cache files and urls
|
1305 |
$file = $cachedir.fastvelocity_get_os_slash().$hash.'.min.js';
|
@@ -1329,7 +1329,7 @@ for($i=0,$l=count($header);$i<$l;$i++) {
|
|
1329 |
$printurl = str_ireplace(array(site_url(), home_url(), 'http:', 'https:'), '', $hurl);
|
1330 |
|
1331 |
# download, minify, cache
|
1332 |
-
$tkey = 'js-'.hash('
|
1333 |
$json = false; $json = fvm_get_transient($tkey);
|
1334 |
if ( $json === false) {
|
1335 |
$json = fvm_download_and_minify($hurl, null, $disable_js_minification, 'js', $handle);
|
@@ -1500,7 +1500,7 @@ for($i=0,$l=count($footer);$i<$l;$i++) {
|
|
1500 |
|
1501 |
# static cache file info + done
|
1502 |
$done = array_merge($done, $footer[$i]['handles']);
|
1503 |
-
$hash = 'footer-'.hash('
|
1504 |
|
1505 |
# create cache files and urls
|
1506 |
$file = $cachedir.fastvelocity_get_os_slash().$hash.'.min.js';
|
@@ -1531,7 +1531,7 @@ for($i=0,$l=count($footer);$i<$l;$i++) {
|
|
1531 |
|
1532 |
|
1533 |
# download, minify, cache
|
1534 |
-
$tkey = 'js-'.hash('
|
1535 |
$json = false; $json = fvm_get_transient($tkey);
|
1536 |
if ( $json === false) {
|
1537 |
$json = fvm_download_and_minify($hurl, null, $disable_js_minification, 'js', $handle);
|
@@ -1778,13 +1778,13 @@ foreach( $styles->to_do as $handle):
|
|
1778 |
|
1779 |
# mark duplicates as done and remove from the queue
|
1780 |
if(!empty($hurl)) {
|
1781 |
-
$key = hash('
|
1782 |
if (isset($uniq[$key])) { $done = array_merge($done, array($handle)); continue; } else { $uniq[$key] = $handle; }
|
1783 |
}
|
1784 |
|
1785 |
# Exclude specific CSS files from PSI?
|
1786 |
if($fvm_min_excludecsslist != false && is_array($fvm_min_excludecsslist) && fastvelocity_min_in_arrayi($hurl, $fvm_min_excludecsslist)) {
|
1787 |
-
$cssguid = 'fvm'.hash('
|
1788 |
echo '<script type="text/javascript">if(fvmuag()){';
|
1789 |
echo 'var '.$cssguid.'=document.createElement("link");'.$cssguid.'.rel="stylesheet",'.$cssguid.'.type="text/css",'.$cssguid.'.media="async",'.$cssguid.'.href="'.$hurl.'",'.$cssguid.'.onload=function(){'.$cssguid.'.media="'.$mediatype.'"},document.getElementsByTagName("head")[0].appendChild('.$cssguid.');';
|
1790 |
echo '}</script>';
|
@@ -1801,7 +1801,7 @@ foreach( $styles->to_do as $handle):
|
|
1801 |
|
1802 |
# font awesome processing, async and exclude from PSI
|
1803 |
if($fvm_fawesome_method == 3 && stripos($hurl, 'font-awesome') !== false) {
|
1804 |
-
$cssguid = 'fvm'.hash('
|
1805 |
echo '<script type="text/javascript">if(fvmuag()){';
|
1806 |
echo 'var '.$cssguid.'=document.createElement("link");'.$cssguid.'.rel="stylesheet",'.$cssguid.'.type="text/css",'.$cssguid.'.media="async",'.$cssguid.'.href="'.$hurl.'",'.$cssguid.'.onload=function(){'.$cssguid.'.media="'.$mediatype.'"},document.getElementsByTagName("head")[0].appendChild('.$cssguid.');';
|
1807 |
echo '}</script>';
|
@@ -1849,7 +1849,7 @@ if(!$skip_google_fonts && count($google_fonts) > 0 || ($force_inline_googlefonts
|
|
1849 |
if($css_hide_googlefonts == true) {
|
1850 |
|
1851 |
# make a stylesheet, hide from PSI
|
1852 |
-
$cssguid = 'fvm'.hash('
|
1853 |
echo '<script type="text/javascript">if(fvmuag()){';
|
1854 |
echo 'var '.$cssguid.'=document.createElement("link");'.$cssguid.'.rel="stylesheet",'.$cssguid.'.type="text/css",'.$cssguid.'.media="async",'.$cssguid.'.href="'.$gfurl.'",'.$cssguid.'.onload=function(){'.$cssguid.'.media="all"},document.getElementsByTagName("head")[0].appendChild('.$cssguid.');';
|
1855 |
echo '}</script>';
|
@@ -1864,7 +1864,7 @@ if(!$skip_google_fonts && count($google_fonts) > 0 || ($force_inline_googlefonts
|
|
1864 |
} elseif($force_inline_googlefonts == true) {
|
1865 |
|
1866 |
# download, minify, cache
|
1867 |
-
$tkey = 'css-'.hash('
|
1868 |
$json = false; $json = fvm_get_transient($tkey);
|
1869 |
if ( $json === false) {
|
1870 |
$json = fvm_download_and_minify($gfurl, null, $disable_css_minification, 'css', null);
|
@@ -1987,7 +1987,7 @@ for($i=0,$l=count($header);$i<$l;$i++) {
|
|
1987 |
|
1988 |
# static cache file info + done
|
1989 |
$done = array_merge($done, $header[$i]['handles']);
|
1990 |
-
$hash = 'header-'.hash('
|
1991 |
|
1992 |
# create cache files and urls
|
1993 |
$file = $cachedir.fastvelocity_get_os_slash().$hash.'.min.css';
|
@@ -2017,7 +2017,7 @@ for($i=0,$l=count($header);$i<$l;$i++) {
|
|
2017 |
$printurl = str_ireplace(array(site_url(), home_url(), 'http:', 'https:'), '', $hurl);
|
2018 |
|
2019 |
# download, minify, cache
|
2020 |
-
$tkey = 'css-'.hash('
|
2021 |
$json = false; $json = fvm_get_transient($tkey);
|
2022 |
if ( $json === false) {
|
2023 |
$json = fvm_download_and_minify($hurl, null, $disable_css_minification, 'css', $handle);
|
@@ -2196,7 +2196,7 @@ if(!$skip_google_fonts && count($google_fonts) > 0 || ($force_inline_googlefonts
|
|
2196 |
if($css_hide_googlefonts == true) {
|
2197 |
|
2198 |
# make a stylesheet, hide from PSI
|
2199 |
-
$cssguid = 'fvm'.hash('
|
2200 |
echo '<script type="text/javascript">if(fvmuag()){';
|
2201 |
echo 'var '.$cssguid.'=document.createElement("link");'.$cssguid.'.rel="stylesheet",'.$cssguid.'.type="text/css",'.$cssguid.'.media="async",'.$cssguid.'.href="'.$gfurl.'",'.$cssguid.'.onload=function(){'.$cssguid.'.media="all"},document.getElementsByTagName("head")[0].appendChild('.$cssguid.');';
|
2202 |
echo '}</script>';
|
@@ -2211,7 +2211,7 @@ if(!$skip_google_fonts && count($google_fonts) > 0 || ($force_inline_googlefonts
|
|
2211 |
} elseif($force_inline_googlefonts == true) {
|
2212 |
|
2213 |
# download, minify, cache
|
2214 |
-
$tkey = 'css-'.hash('
|
2215 |
$json = false; $json = fvm_get_transient($tkey);
|
2216 |
if ( $json === false) {
|
2217 |
$json = fvm_download_and_minify($gfurl, null, $disable_css_minification, 'css', null);
|
@@ -2276,7 +2276,7 @@ foreach( $styles->to_do as $handle ) :
|
|
2276 |
|
2277 |
# mark duplicates as done and remove from the queue
|
2278 |
if(!empty($hurl)) {
|
2279 |
-
$key = hash('
|
2280 |
if (isset($uniq[$key])) { $done = array_merge($done, array($handle)); continue; } else { $uniq[$key] = $handle; }
|
2281 |
}
|
2282 |
|
@@ -2287,7 +2287,7 @@ foreach( $styles->to_do as $handle ) :
|
|
2287 |
|
2288 |
# Exclude specific CSS files from PSI?
|
2289 |
if($fvm_min_excludecsslist != false && is_array($fvm_min_excludecsslist) && fastvelocity_min_in_arrayi($hurl, $fvm_min_excludecsslist)) {
|
2290 |
-
$cssguid = 'fvm'.hash('
|
2291 |
echo '<script type="text/javascript">if(fvmuag()){';
|
2292 |
echo 'var '.$cssguid.'=document.createElement("link");'.$cssguid.'.rel="stylesheet",'.$cssguid.'.type="text/css",'.$cssguid.'.media="async",'.$cssguid.'.href="'.$hurl.'",'.$cssguid.'.onload=function(){'.$cssguid.'.media="'.$mediatype.'"},document.getElementsByTagName("head")[0].appendChild('.$cssguid.');';
|
2293 |
echo '}</script>';
|
@@ -2304,7 +2304,7 @@ foreach( $styles->to_do as $handle ) :
|
|
2304 |
|
2305 |
# font awesome processing, async and exclude from PSI
|
2306 |
if($fvm_fawesome_method == 3 && stripos($hurl, 'font-awesome') !== false) {
|
2307 |
-
$cssguid = 'fvm'.hash('
|
2308 |
echo '<script type="text/javascript">if(fvmuag()){';
|
2309 |
echo 'var '.$cssguid.'=document.createElement("link");'.$cssguid.'.rel="stylesheet",'.$cssguid.'.type="text/css",'.$cssguid.'.media="async",'.$cssguid.'.href="'.$hurl.'",'.$cssguid.'.onload=function(){'.$cssguid.'.media="'.$mediatype.'"},document.getElementsByTagName("head")[0].appendChild('.$cssguid.');';
|
2310 |
echo '}</script>';
|
@@ -2377,7 +2377,7 @@ for($i=0,$l=count($footer);$i<$l;$i++) {
|
|
2377 |
|
2378 |
# static cache file info + done
|
2379 |
$done = array_merge($done, $footer[$i]['handles']);
|
2380 |
-
$hash = 'footer-'.hash('
|
2381 |
|
2382 |
# create cache files and urls
|
2383 |
$file = $cachedir.fastvelocity_get_os_slash().$hash.'.min.css';
|
@@ -2407,7 +2407,7 @@ for($i=0,$l=count($footer);$i<$l;$i++) {
|
|
2407 |
$printurl = str_ireplace(array(site_url(), home_url(), 'http:', 'https:'), '', $hurl);
|
2408 |
|
2409 |
# download, minify, cache
|
2410 |
-
$tkey = 'css-'.hash('
|
2411 |
$json = false; $json = fvm_get_transient($tkey);
|
2412 |
if ( $json === false) {
|
2413 |
$json = fvm_download_and_minify($hurl, null, $disable_css_minification, 'css', $handle);
|
@@ -2643,7 +2643,7 @@ function fastvelocity_optimizecss($html, $handle, $href, $media){
|
|
2643 |
|
2644 |
# Exclude specific CSS files from PSI?
|
2645 |
if($fvm_min_excludecsslist != false && is_array($fvm_min_excludecsslist) && fastvelocity_min_in_arrayi($href, $fvm_min_excludecsslist)) {
|
2646 |
-
$cssguid = 'fvm'.hash('
|
2647 |
echo '<script type="text/javascript">if(fvmuag()){';
|
2648 |
echo 'var '.$cssguid.'=document.createElement("link");'.$cssguid.'.rel="stylesheet",'.$cssguid.'.type="text/css",'.$cssguid.'.media="async",'.$cssguid.'.href="'.$href.'",'.$cssguid.'.onload=function(){'.$cssguid.'.media="'.$media.'"},document.getElementsByTagName("head")[0].appendChild('.$cssguid.');';
|
2649 |
echo '}</script>';
|
@@ -2668,7 +2668,7 @@ function fastvelocity_optimizecss($html, $handle, $href, $media){
|
|
2668 |
|
2669 |
# hide google fonts from PSI
|
2670 |
if($css_hide_googlefonts == true) {
|
2671 |
-
$cssguid = 'fvm'.hash('
|
2672 |
echo '<script type="text/javascript">if(fvmuag()){';
|
2673 |
echo 'var '.$cssguid.'=document.createElement("link");'.$cssguid.'.rel="stylesheet",'.$cssguid.'.type="text/css",'.$cssguid.'.media="async",'.$cssguid.'.href="'.$href.'",'.$cssguid.'.onload=function(){'.$cssguid.'.media="all"},document.getElementsByTagName("head")[0].appendChild('.$cssguid.');';
|
2674 |
echo '}</script>';
|
@@ -2694,7 +2694,7 @@ function fastvelocity_optimizecss($html, $handle, $href, $media){
|
|
2694 |
|
2695 |
# font awesome processing, async and exclude from PSI
|
2696 |
if($fvm_fawesome_method == 3 && stripos($href, 'font-awesome') !== false) {
|
2697 |
-
$cssguid = 'fvm'.hash('
|
2698 |
echo '<script type="text/javascript">if(fvmuag()){';
|
2699 |
echo 'var '.$cssguid.'=document.createElement("link");'.$cssguid.'.rel="stylesheet",'.$cssguid.'.type="text/css",'.$cssguid.'.media="async",'.$cssguid.'.href="'.$href.'",'.$cssguid.'.onload=function(){'.$cssguid.'.media="'.$media.'"},document.getElementsByTagName("head")[0].appendChild('.$cssguid.');';
|
2700 |
echo '}</script>';
|
@@ -2705,7 +2705,7 @@ function fastvelocity_optimizecss($html, $handle, $href, $media){
|
|
2705 |
if($fvm_fawesome_method == 1 && stripos($href, 'font-awesome') !== false) {
|
2706 |
|
2707 |
# download, minify, cache
|
2708 |
-
$tkey = 'css-'.hash('
|
2709 |
$json = false; $json = fvm_get_transient($tkey);
|
2710 |
if ( $json === false) {
|
2711 |
$json = fvm_download_and_minify($href, null, $disable_css_minification, 'css', $handle);
|
@@ -2734,7 +2734,7 @@ function fastvelocity_optimizecss($html, $handle, $href, $media){
|
|
2734 |
if(stripos($href, 'fonts.googleapis.com') !== false && $force_inline_googlefonts != false && $css_hide_googlefonts != true && $min_async_googlefonts != true) {
|
2735 |
|
2736 |
# download, minify, cache
|
2737 |
-
$tkey = 'css-'.hash('
|
2738 |
$json = false; $json = fvm_get_transient($tkey);
|
2739 |
if ( $json === false) {
|
2740 |
$json = fvm_download_and_minify($href, null, $disable_css_minification, 'css', $handle);
|
@@ -2772,7 +2772,7 @@ function fastvelocity_optimizecss($html, $handle, $href, $media){
|
|
2772 |
}
|
2773 |
|
2774 |
# download, minify, cache
|
2775 |
-
$tkey = 'css-'.hash('
|
2776 |
$json = false; $json = fvm_get_transient($tkey);
|
2777 |
if ( $json === false) {
|
2778 |
$json = fvm_download_and_minify($href, null, $disable_css_minification, 'css', $handle);
|
@@ -2849,7 +2849,7 @@ function fastvelocity_add_google_fonts_merged() {
|
|
2849 |
if($css_hide_googlefonts == true) {
|
2850 |
|
2851 |
# make a stylesheet, hide from PSI
|
2852 |
-
$cssguid = 'fvm'.hash('
|
2853 |
echo '<script type="text/javascript">if(fvmuag()){';
|
2854 |
echo 'var '.$cssguid.'=document.createElement("link");'.$cssguid.'.rel="stylesheet",'.$cssguid.'.type="text/css",'.$cssguid.'.media="async",'.$cssguid.'.href="'.$gfurl.'",'.$cssguid.'.onload=function(){'.$cssguid.'.media="all"},document.getElementsByTagName("head")[0].appendChild('.$cssguid.');';
|
2855 |
echo '}</script>';
|
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 |
Author: Raul Peixoto
|
7 |
Author URI: http://fastvelocity.com
|
8 |
+
Version: 2.7.9
|
9 |
License: GPL2
|
10 |
|
11 |
------------------------------------------------------------------------
|
329 |
if ($ext == 'css' && file_exists($mincss)) { $filename = basename($mincss); }
|
330 |
if ($ext == 'js' && file_exists($minjs)) { $filename = basename($minjs); }
|
331 |
$fsize = fastvelocity_format_filesize(filesize($file));
|
332 |
+
$uid = hash('sha1', $filename);
|
333 |
array_push($return[$ext], array('uid'=>$uid, 'filename' => $filename, 'log' => $log, 'fsize' => $fsize));
|
334 |
}
|
335 |
}
|
1299 |
|
1300 |
# static cache file info + done
|
1301 |
$done = array_merge($done, $header[$i]['handles']);
|
1302 |
+
$hash = 'header-'.hash('sha1',implode('',$header[$i]['handles']));
|
1303 |
|
1304 |
# create cache files and urls
|
1305 |
$file = $cachedir.fastvelocity_get_os_slash().$hash.'.min.js';
|
1329 |
$printurl = str_ireplace(array(site_url(), home_url(), 'http:', 'https:'), '', $hurl);
|
1330 |
|
1331 |
# download, minify, cache
|
1332 |
+
$tkey = 'js-'.hash('sha1', $handle.$hurl).'.js';
|
1333 |
$json = false; $json = fvm_get_transient($tkey);
|
1334 |
if ( $json === false) {
|
1335 |
$json = fvm_download_and_minify($hurl, null, $disable_js_minification, 'js', $handle);
|
1500 |
|
1501 |
# static cache file info + done
|
1502 |
$done = array_merge($done, $footer[$i]['handles']);
|
1503 |
+
$hash = 'footer-'.hash('sha1',implode('',$footer[$i]['handles']));
|
1504 |
|
1505 |
# create cache files and urls
|
1506 |
$file = $cachedir.fastvelocity_get_os_slash().$hash.'.min.js';
|
1531 |
|
1532 |
|
1533 |
# download, minify, cache
|
1534 |
+
$tkey = 'js-'.hash('sha1', $handle.$hurl).'.js';
|
1535 |
$json = false; $json = fvm_get_transient($tkey);
|
1536 |
if ( $json === false) {
|
1537 |
$json = fvm_download_and_minify($hurl, null, $disable_js_minification, 'js', $handle);
|
1778 |
|
1779 |
# mark duplicates as done and remove from the queue
|
1780 |
if(!empty($hurl)) {
|
1781 |
+
$key = hash('sha1', $hurl);
|
1782 |
if (isset($uniq[$key])) { $done = array_merge($done, array($handle)); continue; } else { $uniq[$key] = $handle; }
|
1783 |
}
|
1784 |
|
1785 |
# Exclude specific CSS files from PSI?
|
1786 |
if($fvm_min_excludecsslist != false && is_array($fvm_min_excludecsslist) && fastvelocity_min_in_arrayi($hurl, $fvm_min_excludecsslist)) {
|
1787 |
+
$cssguid = 'fvm'.hash('sha1', $hurl);
|
1788 |
echo '<script type="text/javascript">if(fvmuag()){';
|
1789 |
echo 'var '.$cssguid.'=document.createElement("link");'.$cssguid.'.rel="stylesheet",'.$cssguid.'.type="text/css",'.$cssguid.'.media="async",'.$cssguid.'.href="'.$hurl.'",'.$cssguid.'.onload=function(){'.$cssguid.'.media="'.$mediatype.'"},document.getElementsByTagName("head")[0].appendChild('.$cssguid.');';
|
1790 |
echo '}</script>';
|
1801 |
|
1802 |
# font awesome processing, async and exclude from PSI
|
1803 |
if($fvm_fawesome_method == 3 && stripos($hurl, 'font-awesome') !== false) {
|
1804 |
+
$cssguid = 'fvm'.hash('sha1', $hurl);
|
1805 |
echo '<script type="text/javascript">if(fvmuag()){';
|
1806 |
echo 'var '.$cssguid.'=document.createElement("link");'.$cssguid.'.rel="stylesheet",'.$cssguid.'.type="text/css",'.$cssguid.'.media="async",'.$cssguid.'.href="'.$hurl.'",'.$cssguid.'.onload=function(){'.$cssguid.'.media="'.$mediatype.'"},document.getElementsByTagName("head")[0].appendChild('.$cssguid.');';
|
1807 |
echo '}</script>';
|
1849 |
if($css_hide_googlefonts == true) {
|
1850 |
|
1851 |
# make a stylesheet, hide from PSI
|
1852 |
+
$cssguid = 'fvm'.hash('sha1', $gfurl);
|
1853 |
echo '<script type="text/javascript">if(fvmuag()){';
|
1854 |
echo 'var '.$cssguid.'=document.createElement("link");'.$cssguid.'.rel="stylesheet",'.$cssguid.'.type="text/css",'.$cssguid.'.media="async",'.$cssguid.'.href="'.$gfurl.'",'.$cssguid.'.onload=function(){'.$cssguid.'.media="all"},document.getElementsByTagName("head")[0].appendChild('.$cssguid.');';
|
1855 |
echo '}</script>';
|
1864 |
} elseif($force_inline_googlefonts == true) {
|
1865 |
|
1866 |
# download, minify, cache
|
1867 |
+
$tkey = 'css-'.hash('sha1', $gfurl).'.css';
|
1868 |
$json = false; $json = fvm_get_transient($tkey);
|
1869 |
if ( $json === false) {
|
1870 |
$json = fvm_download_and_minify($gfurl, null, $disable_css_minification, 'css', null);
|
1987 |
|
1988 |
# static cache file info + done
|
1989 |
$done = array_merge($done, $header[$i]['handles']);
|
1990 |
+
$hash = 'header-'.hash('sha1',implode('',$header[$i]['handles']).$inline_css_hash);
|
1991 |
|
1992 |
# create cache files and urls
|
1993 |
$file = $cachedir.fastvelocity_get_os_slash().$hash.'.min.css';
|
2017 |
$printurl = str_ireplace(array(site_url(), home_url(), 'http:', 'https:'), '', $hurl);
|
2018 |
|
2019 |
# download, minify, cache
|
2020 |
+
$tkey = 'css-'.hash('sha1', $handle.$hurl).'.css';
|
2021 |
$json = false; $json = fvm_get_transient($tkey);
|
2022 |
if ( $json === false) {
|
2023 |
$json = fvm_download_and_minify($hurl, null, $disable_css_minification, 'css', $handle);
|
2196 |
if($css_hide_googlefonts == true) {
|
2197 |
|
2198 |
# make a stylesheet, hide from PSI
|
2199 |
+
$cssguid = 'fvm'.hash('sha1', $gfurl);
|
2200 |
echo '<script type="text/javascript">if(fvmuag()){';
|
2201 |
echo 'var '.$cssguid.'=document.createElement("link");'.$cssguid.'.rel="stylesheet",'.$cssguid.'.type="text/css",'.$cssguid.'.media="async",'.$cssguid.'.href="'.$gfurl.'",'.$cssguid.'.onload=function(){'.$cssguid.'.media="all"},document.getElementsByTagName("head")[0].appendChild('.$cssguid.');';
|
2202 |
echo '}</script>';
|
2211 |
} elseif($force_inline_googlefonts == true) {
|
2212 |
|
2213 |
# download, minify, cache
|
2214 |
+
$tkey = 'css-'.hash('sha1', $gfurl).'.css';
|
2215 |
$json = false; $json = fvm_get_transient($tkey);
|
2216 |
if ( $json === false) {
|
2217 |
$json = fvm_download_and_minify($gfurl, null, $disable_css_minification, 'css', null);
|
2276 |
|
2277 |
# mark duplicates as done and remove from the queue
|
2278 |
if(!empty($hurl)) {
|
2279 |
+
$key = hash('sha1', $hurl);
|
2280 |
if (isset($uniq[$key])) { $done = array_merge($done, array($handle)); continue; } else { $uniq[$key] = $handle; }
|
2281 |
}
|
2282 |
|
2287 |
|
2288 |
# Exclude specific CSS files from PSI?
|
2289 |
if($fvm_min_excludecsslist != false && is_array($fvm_min_excludecsslist) && fastvelocity_min_in_arrayi($hurl, $fvm_min_excludecsslist)) {
|
2290 |
+
$cssguid = 'fvm'.hash('sha1', $hurl);
|
2291 |
echo '<script type="text/javascript">if(fvmuag()){';
|
2292 |
echo 'var '.$cssguid.'=document.createElement("link");'.$cssguid.'.rel="stylesheet",'.$cssguid.'.type="text/css",'.$cssguid.'.media="async",'.$cssguid.'.href="'.$hurl.'",'.$cssguid.'.onload=function(){'.$cssguid.'.media="'.$mediatype.'"},document.getElementsByTagName("head")[0].appendChild('.$cssguid.');';
|
2293 |
echo '}</script>';
|
2304 |
|
2305 |
# font awesome processing, async and exclude from PSI
|
2306 |
if($fvm_fawesome_method == 3 && stripos($hurl, 'font-awesome') !== false) {
|
2307 |
+
$cssguid = 'fvm'.hash('sha1', $hurl);
|
2308 |
echo '<script type="text/javascript">if(fvmuag()){';
|
2309 |
echo 'var '.$cssguid.'=document.createElement("link");'.$cssguid.'.rel="stylesheet",'.$cssguid.'.type="text/css",'.$cssguid.'.media="async",'.$cssguid.'.href="'.$hurl.'",'.$cssguid.'.onload=function(){'.$cssguid.'.media="'.$mediatype.'"},document.getElementsByTagName("head")[0].appendChild('.$cssguid.');';
|
2310 |
echo '}</script>';
|
2377 |
|
2378 |
# static cache file info + done
|
2379 |
$done = array_merge($done, $footer[$i]['handles']);
|
2380 |
+
$hash = 'footer-'.hash('sha1',implode('',$footer[$i]['handles']).$inline_css_hash);
|
2381 |
|
2382 |
# create cache files and urls
|
2383 |
$file = $cachedir.fastvelocity_get_os_slash().$hash.'.min.css';
|
2407 |
$printurl = str_ireplace(array(site_url(), home_url(), 'http:', 'https:'), '', $hurl);
|
2408 |
|
2409 |
# download, minify, cache
|
2410 |
+
$tkey = 'css-'.hash('sha1', $handle.$hurl).'.css';
|
2411 |
$json = false; $json = fvm_get_transient($tkey);
|
2412 |
if ( $json === false) {
|
2413 |
$json = fvm_download_and_minify($hurl, null, $disable_css_minification, 'css', $handle);
|
2643 |
|
2644 |
# Exclude specific CSS files from PSI?
|
2645 |
if($fvm_min_excludecsslist != false && is_array($fvm_min_excludecsslist) && fastvelocity_min_in_arrayi($href, $fvm_min_excludecsslist)) {
|
2646 |
+
$cssguid = 'fvm'.hash('sha1', $href);
|
2647 |
echo '<script type="text/javascript">if(fvmuag()){';
|
2648 |
echo 'var '.$cssguid.'=document.createElement("link");'.$cssguid.'.rel="stylesheet",'.$cssguid.'.type="text/css",'.$cssguid.'.media="async",'.$cssguid.'.href="'.$href.'",'.$cssguid.'.onload=function(){'.$cssguid.'.media="'.$media.'"},document.getElementsByTagName("head")[0].appendChild('.$cssguid.');';
|
2649 |
echo '}</script>';
|
2668 |
|
2669 |
# hide google fonts from PSI
|
2670 |
if($css_hide_googlefonts == true) {
|
2671 |
+
$cssguid = 'fvm'.hash('sha1', $href);
|
2672 |
echo '<script type="text/javascript">if(fvmuag()){';
|
2673 |
echo 'var '.$cssguid.'=document.createElement("link");'.$cssguid.'.rel="stylesheet",'.$cssguid.'.type="text/css",'.$cssguid.'.media="async",'.$cssguid.'.href="'.$href.'",'.$cssguid.'.onload=function(){'.$cssguid.'.media="all"},document.getElementsByTagName("head")[0].appendChild('.$cssguid.');';
|
2674 |
echo '}</script>';
|
2694 |
|
2695 |
# font awesome processing, async and exclude from PSI
|
2696 |
if($fvm_fawesome_method == 3 && stripos($href, 'font-awesome') !== false) {
|
2697 |
+
$cssguid = 'fvm'.hash('sha1', $href);
|
2698 |
echo '<script type="text/javascript">if(fvmuag()){';
|
2699 |
echo 'var '.$cssguid.'=document.createElement("link");'.$cssguid.'.rel="stylesheet",'.$cssguid.'.type="text/css",'.$cssguid.'.media="async",'.$cssguid.'.href="'.$href.'",'.$cssguid.'.onload=function(){'.$cssguid.'.media="'.$media.'"},document.getElementsByTagName("head")[0].appendChild('.$cssguid.');';
|
2700 |
echo '}</script>';
|
2705 |
if($fvm_fawesome_method == 1 && stripos($href, 'font-awesome') !== false) {
|
2706 |
|
2707 |
# download, minify, cache
|
2708 |
+
$tkey = 'css-'.hash('sha1', $handle.$href).'.css';
|
2709 |
$json = false; $json = fvm_get_transient($tkey);
|
2710 |
if ( $json === false) {
|
2711 |
$json = fvm_download_and_minify($href, null, $disable_css_minification, 'css', $handle);
|
2734 |
if(stripos($href, 'fonts.googleapis.com') !== false && $force_inline_googlefonts != false && $css_hide_googlefonts != true && $min_async_googlefonts != true) {
|
2735 |
|
2736 |
# download, minify, cache
|
2737 |
+
$tkey = 'css-'.hash('sha1', $handle.$href).'.css';
|
2738 |
$json = false; $json = fvm_get_transient($tkey);
|
2739 |
if ( $json === false) {
|
2740 |
$json = fvm_download_and_minify($href, null, $disable_css_minification, 'css', $handle);
|
2772 |
}
|
2773 |
|
2774 |
# download, minify, cache
|
2775 |
+
$tkey = 'css-'.hash('sha1', $handle.$href).'.css';
|
2776 |
$json = false; $json = fvm_get_transient($tkey);
|
2777 |
if ( $json === false) {
|
2778 |
$json = fvm_download_and_minify($href, null, $disable_css_minification, 'css', $handle);
|
2849 |
if($css_hide_googlefonts == true) {
|
2850 |
|
2851 |
# make a stylesheet, hide from PSI
|
2852 |
+
$cssguid = 'fvm'.hash('sha1', $gfurl);
|
2853 |
echo '<script type="text/javascript">if(fvmuag()){';
|
2854 |
echo 'var '.$cssguid.'=document.createElement("link");'.$cssguid.'.rel="stylesheet",'.$cssguid.'.type="text/css",'.$cssguid.'.media="async",'.$cssguid.'.href="'.$gfurl.'",'.$cssguid.'.onload=function(){'.$cssguid.'.media="all"},document.getElementsByTagName("head")[0].appendChild('.$cssguid.');';
|
2855 |
echo '}</script>';
|
inc/functions.php
CHANGED
@@ -758,7 +758,7 @@ function fvm_safename($str, $noname=NULL) {
|
|
758 |
}
|
759 |
|
760 |
# fallback
|
761 |
-
return 'noname-'.hash('
|
762 |
}
|
763 |
|
764 |
|
@@ -872,8 +872,8 @@ if(is_array($ignore)) {
|
|
872 |
|
873 |
# make sure it's unique and not empty
|
874 |
$uniq = array();
|
875 |
-
foreach ($ignore as $i) { $k = hash('
|
876 |
-
foreach ($exc as $e) { $k = hash('
|
877 |
|
878 |
# merge and return
|
879 |
return $uniq;
|
758 |
}
|
759 |
|
760 |
# fallback
|
761 |
+
return 'noname-'.hash('sha1', $str);
|
762 |
}
|
763 |
|
764 |
|
872 |
|
873 |
# make sure it's unique and not empty
|
874 |
$uniq = array();
|
875 |
+
foreach ($ignore as $i) { $k = hash('sha1', $i); if(!empty($i)) { $uniq[$k] = $i; } }
|
876 |
+
foreach ($exc as $e) { $k = hash('sha1', $e); if(!empty($e)) { $uniq[$k] = $e; } }
|
877 |
|
878 |
# merge and return
|
879 |
return $uniq;
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: Alignak
|
|
3 |
Tags: PHP Minify, Lighthouse, GTmetrix, Pingdom, Pagespeed, CSS Merging, JS Merging, CSS Minification, JS Minification, Speed Optimization, HTML Minification, Performance, Optimization, FVM
|
4 |
Requires at least: 4.7
|
5 |
Requires PHP: 5.6
|
6 |
-
Stable tag: 2.7.
|
7 |
Tested up to: 5.3
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -198,6 +198,9 @@ Please backup your site before updating. Version 3.0 will have a major code rewr
|
|
198 |
|
199 |
== Changelog ==
|
200 |
|
|
|
|
|
|
|
201 |
= 2.7.8 [2020.02.06] =
|
202 |
* updated PHP Minify with full support for PHP 7.4
|
203 |
* added try, catch wrappers for merged javacript files with console log errors (instead of letting the browser stop execution on error)
|
3 |
Tags: PHP Minify, Lighthouse, GTmetrix, Pingdom, Pagespeed, CSS Merging, JS Merging, CSS Minification, JS Minification, Speed Optimization, HTML Minification, Performance, Optimization, FVM
|
4 |
Requires at least: 4.7
|
5 |
Requires PHP: 5.6
|
6 |
+
Stable tag: 2.7.9
|
7 |
Tested up to: 5.3
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
198 |
|
199 |
== Changelog ==
|
200 |
|
201 |
+
= 2.7.9 [2020.02.18] =
|
202 |
+
* changed cache file names hash to longer names to avoid colisions on elementor plugin
|
203 |
+
|
204 |
= 2.7.8 [2020.02.06] =
|
205 |
* updated PHP Minify with full support for PHP 7.4
|
206 |
* added try, catch wrappers for merged javacript files with console log errors (instead of letting the browser stop execution on error)
|