Fast Velocity Minify - Version 3.1.6

Version Description

[2021.04.25] = * fixed a notice on wp-admin * better http2 support

Download this release

Release Info

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

Code changes from version 3.1.5 to 3.1.6

Files changed (5) hide show
  1. fvm.php +1 -1
  2. inc/admin.php +18 -7
  3. inc/common.php +10 -0
  4. inc/frontend.php +1 -1
  5. readme.txt +5 -1
fvm.php CHANGED
@@ -6,7 +6,7 @@ Description: Improve your speed score on GTmetrix, Pingdom Tools and Google Page
6
  Author: Raul Peixoto
7
  Author URI: http://fastvelocity.com
8
  Text Domain: fast-velocity-minify
9
- Version: 3.1.5
10
  License: GPL2
11
 
12
  ------------------------------------------------------------------------
6
  Author: Raul Peixoto
7
  Author URI: http://fastvelocity.com
8
  Text Domain: fast-velocity-minify
9
+ Version: 3.1.6
10
  License: GPL2
11
 
12
  ------------------------------------------------------------------------
inc/admin.php CHANGED
@@ -21,16 +21,27 @@ function fvm_check_minimum_requirements() {
21
  }
22
 
23
  # wp version requirements
24
- if ( version_compare( $GLOBALS['wp_version'], '4.5', '<' ) ) {
25
- $error = __( 'FVM requires WP 4.5 or higher. You’re still on', 'fast-velocity-minify' ) .' '. $GLOBALS['wp_version'];
26
  }
27
 
28
- # cache permissions
29
- global $fvm_cache_paths;
30
- if(is_dir($fvm_cache_paths['cache_base_dir']) && !is_writable($fvm_cache_paths['cache_base_dir'])) {
31
- $error = __( 'FVM needs writing permissions.', 'fast-velocity-minify' ). ' ['.$fvm_cache_paths['cache_base_dir'].']';
 
 
 
 
 
 
 
 
 
 
32
  }
33
 
 
34
  # deactivate plugin forcefully
35
  global $fvm_var_basename;
36
  if ((is_plugin_active($fvm_var_basename) && !empty($error)) || !empty($error)) {
@@ -237,7 +248,7 @@ function fvm_add_settings_admin() {
237
  }
238
 
239
  # include admin html template
240
- global $fvm_cache_paths, $fvm_settings, $fvm_var_dir_path;
241
 
242
  # admin html templates
243
  include($fvm_var_dir_path . 'layout' . DIRECTORY_SEPARATOR . 'admin-layout.php');
21
  }
22
 
23
  # wp version requirements
24
+ if ( version_compare( $GLOBALS['wp_version'], '4.9', '<' ) ) {
25
+ $error = __( 'FVM requires WP 4.9 or higher. You’re still on', 'fast-velocity-minify' ) .' '. $GLOBALS['wp_version'];
26
  }
27
 
28
+ # set cache on the uploads directory
29
+ $upload_dir = wp_upload_dir();
30
+ if(isset($upload_dir['basedir']) && isset($upload_dir['baseurl']) && !empty($upload_dir['basedir'])) {
31
+
32
+ # define and create directory
33
+ $cache_dir = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'fvm-cache'. DIRECTORY_SEPARATOR . 'min';
34
+ $cache_dir_url = $upload_dir['baseurl'] . '/fvm-cache/min';
35
+ if(!is_dir($cache_dir) && function_exists('wp_mkdir_p')) { wp_mkdir_p($cache_dir); }
36
+
37
+ # check
38
+ if(is_dir($cache_dir) && !is_writable($cache_dir)) {
39
+ $error = __( 'FVM needs writing permissions on ', 'fast-velocity-minify' ). ' ['.$cache_dir.']';
40
+ }
41
+
42
  }
43
 
44
+
45
  # deactivate plugin forcefully
46
  global $fvm_var_basename;
47
  if ((is_plugin_active($fvm_var_basename) && !empty($error)) || !empty($error)) {
248
  }
249
 
250
  # include admin html template
251
+ global $fvm_settings, $fvm_var_dir_path;
252
 
253
  # admin html templates
254
  include($fvm_var_dir_path . 'layout' . DIRECTORY_SEPARATOR . 'admin-layout.php');
inc/common.php CHANGED
@@ -1986,6 +1986,16 @@ function fvm_get_scheme() {
1986
  return 'http';
1987
  }
1988
 
 
 
 
 
 
 
 
 
 
 
1989
  # get the domain name
1990
  function fvm_get_domain() {
1991
  if (function_exists('site_url')) {
1986
  return 'http';
1987
  }
1988
 
1989
+ # detect http2
1990
+ function fvm_has_http2() {
1991
+ if(isset($_SERVER['SERVER_PROTOCOL'])) {
1992
+ if($_SERVER['SERVER_PROTOCOL'] == 'HTTP/2.0') { return true; }
1993
+ }
1994
+ return false;
1995
+ }
1996
+
1997
+
1998
+
1999
  # get the domain name
2000
  function fvm_get_domain() {
2001
  if (function_exists('site_url')) {
inc/frontend.php CHANGED
@@ -940,7 +940,7 @@ function fvm_process_page($html) {
940
 
941
  # add preload http header
942
  if(count($pre_http) > 0) {
943
- if(!headers_sent()) {
944
  header("Link: " . implode(', ', $pre_http));
945
  }
946
  }
940
 
941
  # add preload http header
942
  if(count($pre_http) > 0) {
943
+ if(!headers_sent() && fvm_get_scheme() && fvm_has_http2()) {
944
  header("Link: " . implode(', ', $pre_http));
945
  }
946
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Alignak
3
  Tags: PHP Minify, Lighthouse, GTmetrix, Pingdom, Pagespeed, Merging, Minification, Optimization, Speed, Performance, FVM
4
  Requires at least: 4.9
5
  Requires PHP: 5.6
6
- Stable tag: 3.1.5
7
  Tested up to: 5.7.1
8
  Text Domain: fast-velocity-minify
9
  License: GPLv3 or later
@@ -55,6 +55,10 @@ Version 3.0 is a major code rewrite to improve JS and CSS merging, but it requir
55
 
56
  == Changelog ==
57
 
 
 
 
 
58
  = 3.1.5 [2021.04.24] =
59
  * added support for WP Cloudflare Super Page Cache plugin
60
  * fixed support for LiteSpeed Cache purging
3
  Tags: PHP Minify, Lighthouse, GTmetrix, Pingdom, Pagespeed, Merging, Minification, Optimization, Speed, Performance, FVM
4
  Requires at least: 4.9
5
  Requires PHP: 5.6
6
+ Stable tag: 3.1.6
7
  Tested up to: 5.7.1
8
  Text Domain: fast-velocity-minify
9
  License: GPLv3 or later
55
 
56
  == Changelog ==
57
 
58
+ = 3.1.6 [2021.04.25] =
59
+ * fixed a notice on wp-admin
60
+ * better http2 support
61
+
62
  = 3.1.5 [2021.04.24] =
63
  * added support for WP Cloudflare Super Page Cache plugin
64
  * fixed support for LiteSpeed Cache purging