Fast Velocity Minify - Version 2.5.6

Version Description

This is expected to be the last update on the 2.x branch, before the 3.0 major release

Download this release

Release Info

Developer Alignak
Plugin Icon 128x128 Fast Velocity Minify
Version 2.5.6
Comparing to
See all releases

Code changes from version 2.5.5 to 2.5.6

Files changed (4) hide show
  1. fvm.php +18 -13
  2. inc/functions-upgrade.php +14 -0
  3. inc/functions.php +2 -2
  4. readme.txt +15 -2
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.5.5
9
  License: GPL2
10
 
11
  ------------------------------------------------------------------------
@@ -1056,7 +1056,7 @@ Enable FVM JS files Preload<span class="note-info">[ Automatically create http h
1056
 
1057
  <div style="height: 20px;"></div>
1058
  <h2 class="title">Async CSS</h2>
1059
- <p class="fvm-bold-green">If you have multiple css files per media type, they may load out of order and break your design.<br />These options won't work, if you select "Disable CSS Processing" on the settings page.</p>
1060
 
1061
  <table class="form-table fvm-settings">
1062
  <tbody>
@@ -1065,7 +1065,7 @@ Enable FVM JS files Preload<span class="note-info">[ Automatically create http h
1065
  <td><fieldset>
1066
  <label for="fastvelocity_min_loadcss">
1067
  <input name="fastvelocity_min_loadcss" type="checkbox" id="fastvelocity_min_loadcss" value="1" <?php echo checked(1 == get_option('fastvelocity_min_loadcss'), true, false); ?>>
1068
- Async CSS with LoadCSS<span class="note-info">[ Only works if "Inline all header / footer CSS files" is disabled ]</span></label>
1069
 
1070
  <br />
1071
  <label for="fastvelocity_min_fvm_removecss">
@@ -1584,8 +1584,9 @@ if (stripos($src, '?ver') !== false) {
1584
  $src = $srcf;
1585
  }
1586
 
1587
- # fix page editors
1588
- if($fvm_fix_editor == true && is_user_logged_in()) { return $tag; }
 
1589
 
1590
  # return if defer option is not selected
1591
  if ($defer_for_pagespeed != true && $enable_defer_js != true) { return $tag; }
@@ -1627,7 +1628,7 @@ if (stripos($tag, 'defer') === false && stripos($tag, 'async') === false) {
1627
 
1628
  # Exclude JS files in the "ignore list" from PSI
1629
  if($defer_for_pagespeed_optimize != false) {
1630
- if((count($ignore) > 0 && fastvelocity_min_in_arrayi($src, $nignore)) || (count($blacklist) > 0 && fastvelocity_min_in_arrayi($src, $blacklist)) || (count($ignorelist) > 0 && fastvelocity_min_in_arrayi($src, $ignorelist))) {
1631
  return $jsdeferhidepsi;
1632
  }
1633
  }
@@ -1641,7 +1642,7 @@ if (stripos($tag, 'defer') === false && stripos($tag, 'async') === false) {
1641
  if($enable_defer_js == true) {
1642
 
1643
  # consider "Skip deferring the ignore list"
1644
- if($skip_defer_lists != false && ((count($nignore) > 0 && fastvelocity_min_in_arrayi($src, $nignore)) || (count($blacklist) > 0 && fastvelocity_min_in_arrayi($src, $blacklist)) || (count($ignorelist) > 0 && fastvelocity_min_in_arrayi($src, $ignorelist)))) {
1645
  return $tag;
1646
  } else {
1647
  return $jsdefer;
@@ -1673,7 +1674,7 @@ function fastvelocity_min_merge_css($html, $handle, $href, $media){
1673
  if($fvm_debug == true) { echo "<!-- FVM DEBUG: Merging CSS processing start $handle / $href -->" . PHP_EOL; }
1674
 
1675
  # prevent optimization for these locations
1676
- if (is_admin() || is_preview() || is_customize_preview() || ($fvm_fix_editor == true && is_user_logged_in())) {
1677
  return $html;
1678
  }
1679
 
@@ -1703,9 +1704,11 @@ function fastvelocity_min_merge_css($html, $handle, $href, $media){
1703
  return false;
1704
  }
1705
 
 
 
 
1706
  # return if in any ignore or black list
1707
- $nignore = array(); if(is_array($ignore)) { foreach ($ignore as $i) { if($i != '/fvm/cache/') { $nignore[] = $i; } } }
1708
- if (count($nignore) > 0 && fastvelocity_min_in_arrayi($href, $nignore) || count($blacklist) > 0 && fastvelocity_min_in_arrayi($href, $blacklist) || count($ignorelist) > 0 && fastvelocity_min_in_arrayi($href, $ignorelist)) {
1709
  return $html;
1710
  }
1711
 
@@ -2169,7 +2172,7 @@ function fastvelocity_optimizecss($html, $handle, $href, $media){
2169
  if($fvm_debug == true) { echo "<!-- FVM DEBUG: Inline CSS processing start $handle / $href -->" . PHP_EOL; }
2170
 
2171
  # prevent optimization for these locations
2172
- if (is_admin() || is_preview() || is_customize_preview() || ($fvm_fix_editor == true && is_user_logged_in())) {
2173
  return $html;
2174
  }
2175
 
@@ -2204,9 +2207,11 @@ function fastvelocity_optimizecss($html, $handle, $href, $media){
2204
  return false;
2205
  }
2206
 
 
 
 
2207
  # return if in any ignore or black list
2208
- $nignore = array(); if(is_array($ignore)) { foreach ($ignore as $i) { if($i != '/fvm/cache/') { $nignore[] = $i; } } }
2209
- if (count($nignore) > 0 && fastvelocity_min_in_arrayi($href, $nignore) || count($blacklist) > 0 && fastvelocity_min_in_arrayi($href, $blacklist) || count($ignorelist) > 0 && fastvelocity_min_in_arrayi($href, $ignorelist)) {
2210
  return $html;
2211
  }
2212
 
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.5.6
9
  License: GPL2
10
 
11
  ------------------------------------------------------------------------
1056
 
1057
  <div style="height: 20px;"></div>
1058
  <h2 class="title">Async CSS</h2>
1059
+ <p class="fvm-bold-green">If you have multiple css files per media type, they may load out of order and break your design.<br />These options won't work, if you select "Disable CSS Processing" on the settings page. </p>
1060
 
1061
  <table class="form-table fvm-settings">
1062
  <tbody>
1065
  <td><fieldset>
1066
  <label for="fastvelocity_min_loadcss">
1067
  <input name="fastvelocity_min_loadcss" type="checkbox" id="fastvelocity_min_loadcss" value="1" <?php echo checked(1 == get_option('fastvelocity_min_loadcss'), true, false); ?>>
1068
+ Async CSS with LoadCSS <span class="note-info">[ Note that inline CSS won't work if this is active ]</span></label>
1069
 
1070
  <br />
1071
  <label for="fastvelocity_min_fvm_removecss">
1584
  $src = $srcf;
1585
  }
1586
 
1587
+
1588
+ # fix page editors, admin, amp, etc
1589
+ if (is_admin() || is_preview() || is_customize_preview() || ($fvm_fix_editor == true && is_user_logged_in()) || (function_exists( 'is_amp_endpoint' ) && is_amp_endpoint())) { return $tag; }
1590
 
1591
  # return if defer option is not selected
1592
  if ($defer_for_pagespeed != true && $enable_defer_js != true) { return $tag; }
1628
 
1629
  # Exclude JS files in the "ignore list" from PSI
1630
  if($defer_for_pagespeed_optimize != false) {
1631
+ if((count($ignore) > 0 && fastvelocity_min_in_arrayi($src, $ignore)) || (count($blacklist) > 0 && fastvelocity_min_in_arrayi($src, $blacklist)) || (count($ignorelist) > 0 && fastvelocity_min_in_arrayi($src, $ignorelist))) {
1632
  return $jsdeferhidepsi;
1633
  }
1634
  }
1642
  if($enable_defer_js == true) {
1643
 
1644
  # consider "Skip deferring the ignore list"
1645
+ if($skip_defer_lists != false && ((count($ignore) > 0 && fastvelocity_min_in_arrayi($src, $ignore)) || (count($blacklist) > 0 && fastvelocity_min_in_arrayi($src, $blacklist)) || (count($ignorelist) > 0 && fastvelocity_min_in_arrayi($src, $ignorelist)))) {
1646
  return $tag;
1647
  } else {
1648
  return $jsdefer;
1674
  if($fvm_debug == true) { echo "<!-- FVM DEBUG: Merging CSS processing start $handle / $href -->" . PHP_EOL; }
1675
 
1676
  # prevent optimization for these locations
1677
+ if (is_admin() || is_preview() || is_customize_preview() || ($fvm_fix_editor == true && is_user_logged_in()) || (function_exists( 'is_amp_endpoint' ) && is_amp_endpoint())) {
1678
  return $html;
1679
  }
1680
 
1704
  return false;
1705
  }
1706
 
1707
+ # remove FVM from the ignore list
1708
+ array_filter($ignore, function ($var) { return (stripos($var, '/fvm/') === false); });
1709
+
1710
  # return if in any ignore or black list
1711
+ if (count($ignore) > 0 && fastvelocity_min_in_arrayi($href, $ignore) || count($blacklist) > 0 && fastvelocity_min_in_arrayi($href, $blacklist) || count($ignorelist) > 0 && fastvelocity_min_in_arrayi($href, $ignorelist)) {
 
1712
  return $html;
1713
  }
1714
 
2172
  if($fvm_debug == true) { echo "<!-- FVM DEBUG: Inline CSS processing start $handle / $href -->" . PHP_EOL; }
2173
 
2174
  # prevent optimization for these locations
2175
+ if (is_admin() || is_preview() || is_customize_preview() || ($fvm_fix_editor == true && is_user_logged_in()) || (function_exists( 'is_amp_endpoint' ) && is_amp_endpoint())) {
2176
  return $html;
2177
  }
2178
 
2207
  return false;
2208
  }
2209
 
2210
+ # remove FVM from the ignore list
2211
+ array_filter($ignore, function ($var) { return (stripos($var, '/fvm/') === false); });
2212
+
2213
  # return if in any ignore or black list
2214
+ if (count($ignore) > 0 && fastvelocity_min_in_arrayi($href, $ignore) || count($blacklist) > 0 && fastvelocity_min_in_arrayi($href, $blacklist) || count($ignorelist) > 0 && fastvelocity_min_in_arrayi($href, $ignorelist)) {
 
2215
  return $html;
2216
  }
2217
 
inc/functions-upgrade.php CHANGED
@@ -46,3 +46,17 @@ function fastvelocity_version_check() {
46
 
47
  }
48
  add_action( 'plugins_loaded', 'fastvelocity_version_check' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  }
48
  add_action( 'plugins_loaded', 'fastvelocity_version_check' );
49
+
50
+
51
+ # upgrade notifications
52
+ function fastvelocity_plugin_update_message($currentPluginMetadata, $newPluginMetadata) {
53
+ if (isset($newPluginMetadata->upgrade_notice) && strlen(trim($newPluginMetadata->upgrade_notice)) > 0){
54
+ echo '<span style="display:block; background: #F7FCFE; padding: 14px 0 6px 0; margin: 10px -12px -12px -16px;">';
55
+ echo '<span class="notice notice-info" style="display:block; padding: 10px; margin: 0;">';
56
+ echo '<span class="dashicons dashicons-megaphone" style="margin-left: 2px; margin-right: 6px;"></span>';
57
+ echo strip_tags($newPluginMetadata->upgrade_notice);
58
+ echo '</span>';
59
+ echo '</span>';
60
+ }
61
+ }
62
+ add_action( 'in_plugin_update_message-fast-velocity-minify/fvm.php', 'fastvelocity_plugin_update_message', 10, 2 );
inc/functions.php CHANGED
@@ -298,7 +298,7 @@ function fastvelocity_min_in_arrayi($hurl, $ignore){
298
  }
299
 
300
 
301
- # better compatibility urls + fix bootstrap 4 svg images https://www.w3.org/TR/SVG/intro.html#NamespaceAndDTDIdentifiers
302
  function fvm_compat_urls($code) {
303
  $default_protocol = get_option('fastvelocity_min_default_protocol', 'dynamic');
304
  if($default_protocol == 'dynamic' || empty($default_protocol)) {
@@ -307,7 +307,7 @@ function fvm_compat_urls($code) {
307
  $default_protocol = $default_protocol.'://';
308
  }
309
  $code = str_ireplace(array('http://', 'https://'), $default_protocol, $code);
310
- $code = str_ireplace($default_protocol.'www.w3.org/2000/svg', 'http://www.w3.org/2000/svg', $code);
311
  return $code;
312
  }
313
 
298
  }
299
 
300
 
301
+ # better compatibility urls + fix w3.org NamespaceAndDTDIdentifiers
302
  function fvm_compat_urls($code) {
303
  $default_protocol = get_option('fastvelocity_min_default_protocol', 'dynamic');
304
  if($default_protocol == 'dynamic' || empty($default_protocol)) {
307
  $default_protocol = $default_protocol.'://';
308
  }
309
  $code = str_ireplace(array('http://', 'https://'), $default_protocol, $code);
310
+ $code = str_ireplace($default_protocol.'www.w3.org', 'http://www.w3.org', $code);
311
  return $code;
312
  }
313
 
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: Alignak
3
  Tags: PHP Minify, Lighthouse, GTmetrix, Pingdom, Pagespeed, CSS Merging, JS Merging, CSS Minification, JS Minification, Speed Optimization, HTML Minification, Performance, Optimization, Speed, Fast
4
  Requires at least: 4.5
5
- Stable tag: 2.5.5
6
  Tested up to: 5.0.3
7
  License: GPLv3 or later
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -198,12 +198,25 @@ Alternatively, you can reach me via info (at) fastvelocity.com for security or o
198
  If you would like to donate any amount to the plugin author (thank you in advance), you can do it via PayPal at https://goo.gl/vpLrSV
199
 
200
 
 
 
 
 
 
 
 
 
201
 
202
  == Changelog ==
203
 
 
 
 
 
 
204
  = 2.5.5 [2019.01.12] =
205
  * fixed the dynamic urls being forced as http://
206
- * fixed the inlined styles being stripped when the inline All CSS option is enabled
207
  * added option to disable merging of inlined css code (for when you have dynamic inline css code)
208
  * other minor bug fixes
209
 
2
  Contributors: Alignak
3
  Tags: PHP Minify, Lighthouse, GTmetrix, Pingdom, Pagespeed, CSS Merging, JS Merging, CSS Minification, JS Minification, Speed Optimization, HTML Minification, Performance, Optimization, Speed, Fast
4
  Requires at least: 4.5
5
+ Stable tag: 2.5.6
6
  Tested up to: 5.0.3
7
  License: GPLv3 or later
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
198
  If you would like to donate any amount to the plugin author (thank you in advance), you can do it via PayPal at https://goo.gl/vpLrSV
199
 
200
 
201
+ == Upgrade Notice ==
202
+
203
+ = 2.5.6 =
204
+ This is expected to be the last update on the 2.x branch, before the 3.0 major release
205
+
206
+ = 3.0 =
207
+ Please backup your site before updating. Version 3.0 will have a major code rewrite to improve JS and CSS merging.
208
+
209
 
210
  == Changelog ==
211
 
212
+ = 2.5.6 [2019.01.18] =
213
+ * fixed some php notices
214
+ * disabled FVM on amp pages
215
+ * expected to be the last update on the 2.x branch, before 3.0 major release
216
+
217
  = 2.5.5 [2019.01.12] =
218
  * fixed the dynamic urls being forced as http://
219
+ * fixed the inlined styles being stripped when the inline all CSS option is enabled
220
  * added option to disable merging of inlined css code (for when you have dynamic inline css code)
221
  * other minor bug fixes
222