Fast Velocity Minify - Version 3.1.1

Version Description

[2021.01.09] = * Added option to disable preload header * Added support for the preload header importance attribute * Better default settings for new installs * Other bug fixes related to UTF-8 decoding and merging

Download this release

Release Info

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

Code changes from version 3.1.0 to 3.1.1

Files changed (6) hide show
  1. fvm.php +1 -1
  2. inc/common.php +29 -6
  3. inc/frontend.php +85 -15
  4. inc/updates.php +21 -36
  5. layout/admin-layout-settings.php +71 -27
  6. readme.txt +8 -2
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.0
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.1
10
  License: GPL2
11
 
12
  ------------------------------------------------------------------------
inc/common.php CHANGED
@@ -846,6 +846,8 @@ function fvm_maybe_download($url) {
846
  $content = wp_remote_retrieve_body($response);
847
  if(strlen($content) > 1) {
848
  return array('content'=>$content, 'src'=>'Web');
 
 
849
  }
850
  }
851
 
@@ -1113,13 +1115,31 @@ function fvm_remove_utf8_bom($text) {
1113
  return $text;
1114
  }
1115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1116
 
1117
  # validate and minify css
1118
  function fvm_maybe_minify_css_file($css, $url, $min) {
1119
 
 
 
 
1120
  # return early if empty
1121
- if(empty($css) || $css == false) { return $css; }
1122
-
1123
  # process css only if it's not php or html
1124
  if(fvm_not_php_html($css)) {
1125
 
@@ -1204,21 +1224,24 @@ function fvm_maybe_minify_css_file($css, $url, $min) {
1204
  # validate and minify js
1205
  function fvm_maybe_minify_js($js, $url, $enable_js_minification) {
1206
 
 
 
 
1207
  # return early if empty
1208
- if(empty($js) || $js == false) { return $js; }
1209
 
1210
  # process js only if it's not php or html
1211
  if(fvm_not_php_html($js)) {
1212
 
1213
  # globals
1214
  global $fvm_settings;
1215
-
1216
  # filtering
1217
  $js = fvm_remove_utf8_bom($js);
1218
-
1219
  # remove sourceMappingURL
1220
  $js = preg_replace('/(\/\/\s*[#]\s*sourceMappingURL\s*[=]\s*)([a-zA-Z0-9-_\.\/]+)(\.map)/ui', '', $js);
1221
-
1222
  # minify?
1223
  if($enable_js_minification == true) {
1224
 
846
  $content = wp_remote_retrieve_body($response);
847
  if(strlen($content) > 1) {
848
  return array('content'=>$content, 'src'=>'Web');
849
+ } else {
850
+ return array('error'=> __( 'Empty content!', 'fast-velocity-minify' ) . ' ['. $url . ']');
851
  }
852
  }
853
 
1115
  return $text;
1116
  }
1117
 
1118
+ # ensure that string is utf8
1119
+ function fvm_ensure_utf8($str) {
1120
+ $enc = mb_detect_encoding($str, mb_list_encodings(), true);
1121
+ if ($enc === false){
1122
+ return false; // could not detect encoding
1123
+ } else if ($enc !== "UTF-8") {
1124
+ return mb_convert_encoding($str, "UTF-8", $enc); // converted to utf8
1125
+ } else {
1126
+ return $str; // already utf8
1127
+ }
1128
+
1129
+ # fail
1130
+ return false;
1131
+ }
1132
+
1133
 
1134
  # validate and minify css
1135
  function fvm_maybe_minify_css_file($css, $url, $min) {
1136
 
1137
+ # ensure it's utf8
1138
+ $css = fvm_ensure_utf8($css);
1139
+
1140
  # return early if empty
1141
+ if(empty($css) || $css == false) { return false; }
1142
+
1143
  # process css only if it's not php or html
1144
  if(fvm_not_php_html($css)) {
1145
 
1224
  # validate and minify js
1225
  function fvm_maybe_minify_js($js, $url, $enable_js_minification) {
1226
 
1227
+ # ensure it's utf8
1228
+ $js = fvm_ensure_utf8($js);
1229
+
1230
  # return early if empty
1231
+ if(empty($js) || $js == false) { return false; }
1232
 
1233
  # process js only if it's not php or html
1234
  if(fvm_not_php_html($js)) {
1235
 
1236
  # globals
1237
  global $fvm_settings;
1238
+
1239
  # filtering
1240
  $js = fvm_remove_utf8_bom($js);
1241
+
1242
  # remove sourceMappingURL
1243
  $js = preg_replace('/(\/\/\s*[#]\s*sourceMappingURL\s*[=]\s*)([a-zA-Z0-9-_\.\/]+)(\.map)/ui', '', $js);
1244
+
1245
  # minify?
1246
  if($enable_js_minification == true) {
1247
 
inc/frontend.php CHANGED
@@ -56,7 +56,6 @@ function fvm_process_page($html) {
56
  # defaults
57
  $tvers = get_option('fvm_last_cache_update', '0');
58
  $now = time();
59
- $htmlpreloader = array();
60
  $htmlcssheader = array();
61
  $lp_css_last_ff_inline = '';
62
 
@@ -72,6 +71,27 @@ function fvm_process_page($html) {
72
  }
73
 
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  # process css, if not disabled
76
  if(isset($fvm_settings['css']['enable']) && $fvm_settings['css']['enable'] == true) {
77
 
@@ -195,7 +215,7 @@ function fvm_process_page($html) {
195
  $css = apply_filters( 'fvm_after_download_and_minify_code', $css, 'css');
196
 
197
  # quick integrity check
198
- if(!empty($css) && $css != false) {
199
 
200
  # trim code
201
  $css = trim($css);
@@ -231,6 +251,14 @@ function fvm_process_page($html) {
231
  continue;
232
  }
233
 
 
 
 
 
 
 
 
 
234
  }
235
 
236
  }
@@ -375,7 +403,9 @@ function fvm_process_page($html) {
375
  if (file_exists($file_css)) {
376
 
377
  # preload and save for html implementation (with priority order prefix)
378
- $htmlpreloader['b_'.$css_uid] = '<link rel="preload" href="'.$file_css_url.'" as="style" media="'.$mediatype.'" />';
 
 
379
 
380
  # async or render block css
381
  if(isset($fvm_settings['css']['async']) && $fvm_settings['css']['async'] == true) {
@@ -458,7 +488,7 @@ function fvm_process_page($html) {
458
  foreach($html->find('script') as $element) {
459
  $allscripts[] = $element;
460
  }
461
-
462
  # process all scripts
463
  if (is_array($allscripts) && count($allscripts) > 0) {
464
  foreach($allscripts as $k=>$tag) {
@@ -633,7 +663,7 @@ function fvm_process_page($html) {
633
  $js = fvm_maybe_minify_js($js, $href, $enable_js_minification);
634
 
635
  # quick integrity check
636
- if(!empty($js) && $js != false) {
637
 
638
  # try catch
639
  $js = fvm_try_catch_wrap($js, $href);
@@ -665,6 +695,14 @@ function fvm_process_page($html) {
665
  unset($allscripts[$k]);
666
  continue 2;
667
 
 
 
 
 
 
 
 
 
668
  }
669
 
670
  }
@@ -679,7 +717,7 @@ function fvm_process_page($html) {
679
  if(is_array($arr) && count($arr) > 0) {
680
  foreach ($arr as $e) {
681
  if(stripos($href, $e) !== false) {
682
-
683
  # download, minify, cache
684
  $tkey = hash('sha1', $href);
685
  $js = fvm_get_transient($tkey);
@@ -697,9 +735,9 @@ function fvm_process_page($html) {
697
 
698
  # minify, save and wrap
699
  $js = fvm_maybe_minify_js($js, $href, $enable_js_minification);
700
-
701
  # quick integrity check
702
- if(!empty($js) && $js != false) {
703
 
704
  # try catch
705
  $js = fvm_try_catch_wrap($js, $href);
@@ -778,7 +816,11 @@ function fvm_process_page($html) {
778
  }
779
 
780
  # preload and save for html implementation (with priority order prefix)
781
- $htmlpreloader['c_'.$fheader_url] = '<link rel="preload" href="'.$fheader_url.'" as="script" />';
 
 
 
 
782
  $htmljscodeheader['c_'.$js_header_uid] = '<script data-cfasync="false" src="'.$fheader_url.'"></script>';
783
 
784
  }
@@ -817,7 +859,11 @@ function fvm_process_page($html) {
817
  }
818
 
819
  # preload and save for html implementation (with priority order prefix)
820
- $htmlpreloader['d_'.$ffooter_url] = '<link rel="preload" href="'.$ffooter_url.'" as="script" />';
 
 
 
 
821
  $htmljscodedefer['d_'.$js_ffooter_uid] = '<script data-cfasync="false" defer src="'.$ffooter_url.'"></script>';
822
 
823
  }
@@ -863,11 +909,35 @@ function fvm_process_page($html) {
863
  foreach($html->find('meta[charset]') as $element) { $element->outertext = ''; }
864
  }
865
 
866
- # add preload headers
867
- if(isset($htmlpreloader)) {
868
- if(is_array($htmlpreloader)) {
869
- ksort($htmlpreloader); # priority
870
- $hm = str_replace('<!-- h_preheader -->', implode(PHP_EOL, $htmlpreloader).'<!-- h_preheader -->', $hm);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
871
  }
872
  }
873
 
56
  # defaults
57
  $tvers = get_option('fvm_last_cache_update', '0');
58
  $now = time();
 
59
  $htmlcssheader = array();
60
  $lp_css_last_ff_inline = '';
61
 
71
  }
72
 
73
 
74
+ # collect all link preload headers
75
+ $allpreloads = array();
76
+ foreach($html->find('link[rel=preload]') as $element) {
77
+
78
+ # normal importance by default
79
+ $importance = 'normal';
80
+ if(isset($tag->importance)) {
81
+ $importance = $tag->importance;
82
+ }
83
+
84
+ # highest to high (but earlier in page)
85
+ if(isset($tag->importance) && $tag->importance == 'highest') {
86
+ $tag->importance = 'high';
87
+ }
88
+
89
+ # collect, group by importance and remove
90
+ $allpreloads[$importance][] = $element->outertext;
91
+ $tag->outertext = '';
92
+ }
93
+
94
+
95
  # process css, if not disabled
96
  if(isset($fvm_settings['css']['enable']) && $fvm_settings['css']['enable'] == true) {
97
 
215
  $css = apply_filters( 'fvm_after_download_and_minify_code', $css, 'css');
216
 
217
  # quick integrity check
218
+ if(!empty($css) && $css !== false) {
219
 
220
  # trim code
221
  $css = trim($css);
251
  continue;
252
  }
253
 
254
+ } else {
255
+
256
+ # there is an error, so leave them alone
257
+ $err = ''; if(isset($ddl['error'])) { $err = '<!-- '.$ddl['error'].' -->'; }
258
+ $tag->outertext = PHP_EOL . $tag->outertext.$err . PHP_EOL;
259
+ unset($allcss[$k]);
260
+ continue;
261
+
262
  }
263
 
264
  }
403
  if (file_exists($file_css)) {
404
 
405
  # preload and save for html implementation (with priority order prefix)
406
+ if((!isset($fvm_settings['css']['nopreload']) || (isset($fvm_settings['css']['nopreload']) && $fvm_settings['css']['nopreload'] != true)) && (!isset($fvm_settings['css']['inline-all']) || (isset($fvm_settings['css']['inline-all']) && $fvm_settings['css']['inline-all'] != true))) {
407
+ $allpreloads['high'][] = '<link rel="preload" href="'.$file_css_url.'" as="style" media="'.$mediatype.'" importance="high" />';
408
+ }
409
 
410
  # async or render block css
411
  if(isset($fvm_settings['css']['async']) && $fvm_settings['css']['async'] == true) {
488
  foreach($html->find('script') as $element) {
489
  $allscripts[] = $element;
490
  }
491
+
492
  # process all scripts
493
  if (is_array($allscripts) && count($allscripts) > 0) {
494
  foreach($allscripts as $k=>$tag) {
663
  $js = fvm_maybe_minify_js($js, $href, $enable_js_minification);
664
 
665
  # quick integrity check
666
+ if(!empty($js) && $js !== false) {
667
 
668
  # try catch
669
  $js = fvm_try_catch_wrap($js, $href);
695
  unset($allscripts[$k]);
696
  continue 2;
697
 
698
+ } else {
699
+
700
+ # there is an error, so leave them alone
701
+ $err = ''; if(isset($ddl['error'])) { $err = '<!-- '.$ddl['error'].' -->'; }
702
+ $tag->outertext = PHP_EOL . $tag->outertext.$err . PHP_EOL;
703
+ unset($allscripts[$k]);
704
+ continue 2;
705
+
706
  }
707
 
708
  }
717
  if(is_array($arr) && count($arr) > 0) {
718
  foreach ($arr as $e) {
719
  if(stripos($href, $e) !== false) {
720
+
721
  # download, minify, cache
722
  $tkey = hash('sha1', $href);
723
  $js = fvm_get_transient($tkey);
735
 
736
  # minify, save and wrap
737
  $js = fvm_maybe_minify_js($js, $href, $enable_js_minification);
738
+
739
  # quick integrity check
740
+ if(!empty($js) && $js !== false) {
741
 
742
  # try catch
743
  $js = fvm_try_catch_wrap($js, $href);
816
  }
817
 
818
  # preload and save for html implementation (with priority order prefix)
819
+ if(!isset($fvm_settings['js']['nopreload']) || (isset($fvm_settings['js']['nopreload']) && $fvm_settings['js']['nopreload'] != true)) {
820
+ $allpreloads['high'][] = '<link rel="preload" href="'.$fheader_url.'" as="script" importance="high" />';
821
+ }
822
+
823
+ # header
824
  $htmljscodeheader['c_'.$js_header_uid] = '<script data-cfasync="false" src="'.$fheader_url.'"></script>';
825
 
826
  }
859
  }
860
 
861
  # preload and save for html implementation (with priority order prefix)
862
+ if(!isset($fvm_settings['js']['nopreload']) || (isset($fvm_settings['js']['nopreload']) && $fvm_settings['js']['nopreload'] != true)) {
863
+ $allpreloads['low'][] = '<link rel="preload" href="'.$ffooter_url.'" as="script" importance="low" />';
864
+ }
865
+
866
+ # header
867
  $htmljscodedefer['d_'.$js_ffooter_uid] = '<script data-cfasync="false" defer src="'.$ffooter_url.'"></script>';
868
 
869
  }
909
  foreach($html->find('meta[charset]') as $element) { $element->outertext = ''; }
910
  }
911
 
912
+ # preload headers, by importance
913
+ if(is_array($allpreloads)) {
914
+
915
+ # start
916
+ $preload = '';
917
+
918
+ # highest priority (rewritten as high, but earlier)
919
+ if(isset($allpreloads['highest'])) {
920
+ $preload.= implode(PHP_EOL, $allpreloads['highest']);
921
+ }
922
+
923
+ # high priority
924
+ if(isset($allpreloads['high'])) {
925
+ $preload.= implode(PHP_EOL, $allpreloads['high']);
926
+ }
927
+
928
+ # auto priority
929
+ if(isset($allpreloads['auto'])) {
930
+ $preload.= implode(PHP_EOL, $allpreloads['auto']);
931
+ }
932
+
933
+ # low priority
934
+ if(isset($allpreloads['low'])) {
935
+ $preload.= implode(PHP_EOL, $allpreloads['low']);
936
+ }
937
+
938
+ # add preload
939
+ if(!empty($preload)) {
940
+ $hm = str_replace('<!-- h_preheader -->', $preload.'<!-- h_preheader -->', $hm);
941
  }
942
  }
943
 
inc/updates.php CHANGED
@@ -58,11 +58,13 @@ function fvm_get_updated_field_routines($fvm_settings) {
58
 
59
 
60
  # cdn url
61
- if (get_option("fastvelocity_min_fvm_cdn_url") !== false && !isset($fvm_settings['cdn']['domain'])) {
62
- $fvm_settings['cdn']['enable'] = 1;
63
- $fvm_settings['cdn']['cssok'] = 1;
64
- $fvm_settings['cdn']['jsok'] = 1;
65
- $fvm_settings['cdn']['domain'] = get_option("fastvelocity_min_fvm_cdn_url");
 
 
66
  }
67
 
68
  # force https
@@ -98,41 +100,24 @@ function fvm_get_updated_field_routines($fvm_settings) {
98
 
99
  }
100
 
101
- # add recommended default scripts, if legacy mode is enabled
102
- if (!isset($fvm_settings['js']['merge_defer']) || isset($fvm_settings['js']['merge_defer']) && empty($fvm_settings['js']['merge_defer'])) {
103
- $arr = array('/ajax.aspnetcdn.com/ajax/', '/ajax.googleapis.com/ajax/libs/', '/cdnjs.cloudflare.com/ajax/libs/', '/stackpath.bootstrapcdn.com/bootstrap/', '/wp-admin/', '/wp-content/', '/wp-includes/');
104
- $fvm_settings['js']['merge_defer'] = implode(PHP_EOL, fvm_array_order($arr));
105
- }
106
-
107
-
108
- # js ignore list
109
- if (get_option("fastvelocity_min_ignorelist") !== false || get_option("fastvelocity_min_blacklist") !== false || get_option("fastvelocity_min_ignore") !== false && !isset($fvm_settings['js']['ignore']) && !isset($fvm_settings['css']['ignore'])) {
110
 
111
- # default
112
- $arr1 = array();
113
- $arr2 = array();
114
- $arr3 = array();
115
- $arr4 = array();
116
- $arr5 = array();
117
- $arr6 = array();
118
- $arr7 = array();
119
- $arr8 = array();
120
 
121
- # legacy, merge
122
- $arr1 = fvm_array_order(fvm_string_toarray(get_option("fastvelocity_min_ignore")));
123
- $arr2 = fvm_array_order(fvm_string_toarray(get_option("fastvelocity_min_ignorelist")));
124
- $arr3 = fvm_array_order(fvm_string_toarray(get_option("fastvelocity_min_blacklist")));
125
- $arr4 = array_merge($arr1, $arr2);
126
- $arr5 = array_merge($arr4, $arr3);
127
- $arr6 = fvm_array_order($arr5);
128
 
129
- # css / js list
130
- foreach($arr1 as $c) { if(substr($c, -3) != '.js') { $arr7[] = trim($c); } }
131
- foreach($arr6 as $c) { if(substr($c, -4) != '.css') { $arr8[] = trim($c); } }
132
 
133
- # save settings for css and js
134
- $fvm_settings['css']['ignore'] = implode(PHP_EOL, $arr7);
135
- $fvm_settings['js']['ignore'] = implode(PHP_EOL, $arr8);
136
 
137
  }
138
 
58
 
59
 
60
  # cdn url
61
+ if (get_option("fastvelocity_min_fvm_cdn_url") !== false) {
62
+ if (!isset($fvm_settings['cdn']['domain']) || (isset($fvm_settings['cdn']['domain']) && empty($fvm_settings['cdn']['domain']))) {
63
+ $fvm_settings['cdn']['enable'] = 1;
64
+ $fvm_settings['cdn']['cssok'] = 1;
65
+ $fvm_settings['cdn']['jsok'] = 1;
66
+ $fvm_settings['cdn']['domain'] = get_option("fastvelocity_min_fvm_cdn_url");
67
+ }
68
  }
69
 
70
  # force https
100
 
101
  }
102
 
103
+ # new users, add recommended default scripts settings
104
+ if ( (!isset($fvm_settings['js']['merge_header']) || isset($fvm_settings['js']['merge_header']) && empty($fvm_settings['js']['merge_header'])) && (!isset($fvm_settings['js']['merge_defer']) || (isset($fvm_settings['js']['merge_defer']) && empty($fvm_settings['js']['merge_defer']))) ) {
 
 
 
 
 
 
 
105
 
106
+ # header
107
+ $arr = array('/jquery-migrate-', '/jquery-migrate.js', '/jquery-migrate.min.js', '/jquery.js', '/jquery.min.js');
108
+ $fvm_settings['js']['merge_header'] = implode(PHP_EOL, fvm_array_order($arr));
 
 
 
 
 
 
109
 
110
+ # defer
111
+ $arr = array('/ajax.aspnetcdn.com/ajax/', '/ajax.googleapis.com/ajax/libs/', '/cdnjs.cloudflare.com/ajax/libs/', '/stackpath.bootstrapcdn.com/bootstrap/', '/wp-admin/', '/wp-content/', '/wp-includes/');
112
+ $fvm_settings['js']['merge_defer'] = implode(PHP_EOL, fvm_array_order($arr));
 
 
 
 
113
 
114
+ # js footer dependencies
115
+ $arr = array('wp.i18n');
116
+ $fvm_settings['js']['defer_dependencies'] = implode(PHP_EOL, fvm_array_order($arr));
117
 
118
+ # recommended delayed scripts
119
+ $arr = array('function(f,b,e,v,n,t,s)', 'function(w,d,s,l,i)', 'function(h,o,t,j,a,r)', 'connect.facebook.net', 'www.googletagmanager.com', 'gtag(', 'fbq(', 'assets.pinterest.com/js/pinit_main.js', 'pintrk(');
120
+ $fvm_settings['js']['thirdparty'] = implode(PHP_EOL, fvm_array_order($arr));
121
 
122
  }
123
 
layout/admin-layout-settings.php CHANGED
@@ -17,13 +17,9 @@
17
  <tr>
18
  <th scope="row"><?php _e( 'Global Options', 'fast-velocity-minify' ); ?></th>
19
  <td>
20
- <p class="fvm-bold-green fvm-rowintro"><?php _e( 'Select your options below', 'fast-velocity-minify' ); ?></p>
21
 
22
  <fieldset>
23
- <label for="fvm_settings_cache_min_instant_purge">
24
- <input name="fvm_settings[cache][min_instant_purge]" type="checkbox" id="fvm_settings_cache_min_instant_purge" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'cache', 'min_instant_purge')); ?>>
25
- <?php _e( 'Purge Minified CSS/JS files instantly', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Cache files can take up to 24 hours to be deleted by default, for compatibility reasons with certain hosts.', 'fast-velocity-minify' ); ?> ]</span></label>
26
- <br />
27
 
28
  <label for="fvm_settings_global_preserve_settings">
29
  <input name="fvm_settings[global][preserve_settings]" type="checkbox" id="fvm_settings_global_preserve_settings" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'global', 'preserve_settings')); ?>>
@@ -38,6 +34,20 @@
38
  </fieldset></td>
39
  </tr>
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  </tbody>
42
  </table>
43
 
@@ -51,7 +61,7 @@
51
  <tr>
52
  <th scope="row"><?php _e( 'HTML Options', 'fast-velocity-minify' ); ?></th>
53
  <td>
54
- <p class="fvm-bold-green fvm-rowintro"><?php _e( 'Select your options below', 'fast-velocity-minify' ); ?></p>
55
 
56
  <fieldset>
57
  <label for="fvm_settings_html_enable">
@@ -59,11 +69,6 @@
59
  <?php _e( 'Enable HTML Processing', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will enable processing for the settings below', 'fast-velocity-minify' ); ?> ]</span></label>
60
  <br />
61
 
62
- <label for="fvm_settings_html_min_disable">
63
- <input name="fvm_settings[html][min_disable]" type="checkbox" id="fvm_settings_html_min_disable" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'html', 'min_disable')); ?>>
64
- <?php _e( 'Disable HTML Minification', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will disable HTML minification for testing purposes', 'fast-velocity-minify' ); ?> ]</span></label>
65
- <br />
66
-
67
  <label for="fvm_settings_html_nocomments">
68
  <input name="fvm_settings[html][nocomments]" type="checkbox" id="fvm_settings_html_nocomments" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'html', 'nocomments')); ?>>
69
  <?php _e( 'Strip HTML Comments', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will strip HTML comments from your HTML page', 'fast-velocity-minify' ); ?> ]</span></label>
@@ -82,12 +87,22 @@
82
  </fieldset></td>
83
  </tr>
84
 
85
- </tbody>
86
- </table>
87
-
 
88
 
 
 
 
 
 
89
 
 
 
90
 
 
 
91
 
92
  <div style="height: 60px;"></div>
93
  <h2 class="title"><?php _e( 'CSS Settings', 'fast-velocity-minify' ); ?></h2>
@@ -99,7 +114,7 @@
99
  <tr>
100
  <th scope="row"><?php _e( 'CSS Options', 'fast-velocity-minify' ); ?></th>
101
  <td>
102
- <p class="fvm-bold-green fvm-rowintro"><?php _e( 'Select your options below', 'fast-velocity-minify' ); ?></p>
103
 
104
  <fieldset>
105
  <label for="fvm_settings_css_enable">
@@ -107,29 +122,44 @@
107
  <?php _e( 'Enable CSS Processing', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will enable processing for the settings below', 'fast-velocity-minify' ); ?> ]</span></label>
108
  <br />
109
 
110
- <label for="fvm_settings_css_min_disable">
111
- <input name="fvm_settings[css][min_disable]" type="checkbox" id="fvm_settings_css_min_disable" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'css', 'min_disable')); ?>>
112
- <?php _e( 'Disable CSS Minification', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will allow merging but without CSS minification for testing purposes', 'fast-velocity-minify' ); ?> ]</span></label>
 
 
 
 
 
113
  <br />
114
 
 
 
 
 
 
 
 
 
 
 
115
  <label for="fvm_settings_css_inline-all">
116
  <input name="fvm_settings[css][inline-all]" type="checkbox" id="fvm_settings_css_inline-all" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'css', 'inline-all')); ?>>
117
  <?php _e( 'Disable Merging and Inline all CSS', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'It will inline all CSS files, instead of merging CSS into an external file (not recommended)', 'fast-velocity-minify' ); ?> ]</span></label>
118
  <br />
119
 
120
- <label for="fvm_settings_css_noprint">
121
- <input name="fvm_settings[css][noprint]" type="checkbox" id="fvm_settings_css_noprint" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'css', 'noprint')); ?>>
122
- <?php _e( 'Remove "Print" CSS files', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will remove CSS files of mediatype "print" from the frontend', 'fast-velocity-minify' ); ?> ]</span></label>
123
  <br />
124
 
125
- <label for="fvm_settings_css_fonts">
126
- <input name="fvm_settings[css][fonts]" type="checkbox" id="fvm_settings_css_fonts" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'css', 'fonts')); ?>>
127
- <?php _e( 'Merge Fonts and Icons separately', 'fast-velocity-minify' ); ?><span class="note-info">[ <?php _e( 'Will merge fonts and icons into a separate CSS file', 'fast-velocity-minify' ); ?> ]</span></label>
128
  <br />
129
 
130
  <label for="fvm_settings_css_async">
131
  <input name="fvm_settings[css][async]" type="checkbox" id="fvm_settings_css_async" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'css', 'async')); ?>>
132
- <?php _e( 'Load generated CSS files Async', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will load the merged CSS files Async (use your own inline code for the critical path)', 'fast-velocity-minify' ); ?> ]</span></label>
133
  <br />
134
 
135
  </fieldset></td>
@@ -171,7 +201,7 @@
171
  <tr>
172
  <th scope="row"><?php _e( 'JS Options', 'fast-velocity-minify' ); ?></th>
173
  <td>
174
- <p class="fvm-bold-green fvm-rowintro"><?php _e( 'Select your options below', 'fast-velocity-minify' ); ?></p>
175
 
176
  <fieldset>
177
  <label for="fvm_settings_js_enable">
@@ -179,11 +209,25 @@
179
  <?php _e( 'Enable JS Processing', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will enable processing for the settings below', 'fast-velocity-minify' ); ?> ]</span></label>
180
  <br />
181
 
 
 
 
 
 
 
 
 
 
182
  <label for="fvm_settings_js_min_disable">
183
  <input name="fvm_settings[js][min_disable]" type="checkbox" id="fvm_settings_js_min_disable" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'js', 'min_disable')); ?>>
184
  <?php _e( 'Disable JS Minification', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will disable JS minification (merge only) for testing purposes', 'fast-velocity-minify' ); ?> ]</span></label>
185
  <br />
186
 
 
 
 
 
 
187
  <label for="fvm_settings_js_jqupgrade">
188
  <input name="fvm_settings[js][jqupgrade]" type="checkbox" id="fvm_settings_js_jqupgrade" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'js', 'jqupgrade')); ?>>
189
  <?php _e( 'Upgrade to jQuery 3', 'fast-velocity-minify' ); ?> <span class="note-info">[<?php _e( 'Will use jQuery 3.5.1 and jQuery Migrate 3.3.1 from Cloudflare (if enqueued)', 'fast-velocity-minify' ); ?> ]</span></label>
@@ -197,7 +241,7 @@
197
  <th scope="row"><?php _e( 'Ignore Script Files', 'fast-velocity-minify' ); ?></th>
198
  <td><fieldset>
199
  <label for="fvm_settings_js_ignore"><span class="fvm-bold-green fvm-rowintro"><?php _e( 'Will prevent merging and minification for these files, regardless of any other broader rules in this page.', 'fast-velocity-minify' ); ?></span></label>
200
- <p><textarea name="fvm_settings[js][ignore]" rows="7" cols="50" id="fvm_settings_js_ignore" class="large-text code" placeholder="<?php _e( '--- a small snippet that should match an inline script and make it wait for the deferred scripts above ---', 'fast-velocity-minify' ); ?>"><?php echo fvm_get_settings_value($fvm_settings, 'js', 'ignore'); ?></textarea></p>
201
  <p class="description">[ <?php _e( 'Will match using <code>PHP stripos</code> against the script <code>src</code> attribute', 'fast-velocity-minify' ); ?> ]</p>
202
  <p class="description">[ <?php _e( 'It is highly recommended to try to leave this empty and later be more specific on what to merge', 'fast-velocity-minify' ); ?> ]</p>
203
  </fieldset></td>
17
  <tr>
18
  <th scope="row"><?php _e( 'Global Options', 'fast-velocity-minify' ); ?></th>
19
  <td>
20
+ <p class="fvm-bold-green fvm-rowintro"><?php _e( 'Recommended Settings', 'fast-velocity-minify' ); ?></p>
21
 
22
  <fieldset>
 
 
 
 
23
 
24
  <label for="fvm_settings_global_preserve_settings">
25
  <input name="fvm_settings[global][preserve_settings]" type="checkbox" id="fvm_settings_global_preserve_settings" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'global', 'preserve_settings')); ?>>
34
  </fieldset></td>
35
  </tr>
36
 
37
+ <tr>
38
+ <th scope="row"><?php _e( 'Advanced Global Options', 'fast-velocity-minify' ); ?></th>
39
+ <td>
40
+ <p class="fvm-bold-green fvm-rowintro"><?php _e( 'Handle with Care', 'fast-velocity-minify' ); ?></p>
41
+
42
+ <fieldset>
43
+ <label for="fvm_settings_cache_min_instant_purge">
44
+ <input name="fvm_settings[cache][min_instant_purge]" type="checkbox" id="fvm_settings_cache_min_instant_purge" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'cache', 'min_instant_purge')); ?>>
45
+ <?php _e( 'Purge Minified CSS/JS files instantly', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Cache files can take up to 24 hours to be deleted by default, for compatibility reasons with certain hosts.', 'fast-velocity-minify' ); ?> ]</span></label>
46
+ <br />
47
+
48
+ </fieldset></td>
49
+ </tr>
50
+
51
  </tbody>
52
  </table>
53
 
61
  <tr>
62
  <th scope="row"><?php _e( 'HTML Options', 'fast-velocity-minify' ); ?></th>
63
  <td>
64
+ <p class="fvm-bold-green fvm-rowintro"><?php _e( 'Recommended Settings', 'fast-velocity-minify' ); ?></p>
65
 
66
  <fieldset>
67
  <label for="fvm_settings_html_enable">
69
  <?php _e( 'Enable HTML Processing', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will enable processing for the settings below', 'fast-velocity-minify' ); ?> ]</span></label>
70
  <br />
71
 
 
 
 
 
 
72
  <label for="fvm_settings_html_nocomments">
73
  <input name="fvm_settings[html][nocomments]" type="checkbox" id="fvm_settings_html_nocomments" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'html', 'nocomments')); ?>>
74
  <?php _e( 'Strip HTML Comments', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will strip HTML comments from your HTML page', 'fast-velocity-minify' ); ?> ]</span></label>
87
  </fieldset></td>
88
  </tr>
89
 
90
+ <tr>
91
+ <th scope="row"><?php _e( 'Advanced HTML Options', 'fast-velocity-minify' ); ?></th>
92
+ <td>
93
+ <p class="fvm-bold-green fvm-rowintro"><?php _e( 'Handle with Care', 'fast-velocity-minify' ); ?></p>
94
 
95
+ <fieldset>
96
+ <label for="fvm_settings_html_min_disable">
97
+ <input name="fvm_settings[html][min_disable]" type="checkbox" id="fvm_settings_html_min_disable" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'html', 'min_disable')); ?>>
98
+ <?php _e( 'Disable HTML Minification', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will disable HTML minification for testing purposes', 'fast-velocity-minify' ); ?> ]</span></label>
99
+ <br />
100
 
101
+ </fieldset></td>
102
+ </tr>
103
 
104
+ </tbody>
105
+ </table>
106
 
107
  <div style="height: 60px;"></div>
108
  <h2 class="title"><?php _e( 'CSS Settings', 'fast-velocity-minify' ); ?></h2>
114
  <tr>
115
  <th scope="row"><?php _e( 'CSS Options', 'fast-velocity-minify' ); ?></th>
116
  <td>
117
+ <p class="fvm-bold-green fvm-rowintro"><?php _e( 'Recommended Settings', 'fast-velocity-minify' ); ?></p>
118
 
119
  <fieldset>
120
  <label for="fvm_settings_css_enable">
122
  <?php _e( 'Enable CSS Processing', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will enable processing for the settings below', 'fast-velocity-minify' ); ?> ]</span></label>
123
  <br />
124
 
125
+ <label for="fvm_settings_css_fonts">
126
+ <input name="fvm_settings[css][fonts]" type="checkbox" id="fvm_settings_css_fonts" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'css', 'fonts')); ?>>
127
+ <?php _e( 'Merge Fonts and Icons separately', 'fast-velocity-minify' ); ?><span class="note-info">[ <?php _e( 'Will merge fonts and icons into a separate CSS file', 'fast-velocity-minify' ); ?> ]</span></label>
128
+ <br />
129
+
130
+ <label for="fvm_settings_css_noprint">
131
+ <input name="fvm_settings[css][noprint]" type="checkbox" id="fvm_settings_css_noprint" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'css', 'noprint')); ?>>
132
+ <?php _e( 'Remove "Print" CSS files', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will remove CSS files of mediatype "print" from the frontend', 'fast-velocity-minify' ); ?> ]</span></label>
133
  <br />
134
 
135
+ </fieldset></td>
136
+ </tr>
137
+
138
+ <tr>
139
+ <th scope="row"><?php _e( 'Advanced CSS Options', 'fast-velocity-minify' ); ?></th>
140
+ <td>
141
+ <p class="fvm-bold-green fvm-rowintro"><?php _e( 'Handle with Care', 'fast-velocity-minify' ); ?></p>
142
+
143
+ <fieldset>
144
+
145
  <label for="fvm_settings_css_inline-all">
146
  <input name="fvm_settings[css][inline-all]" type="checkbox" id="fvm_settings_css_inline-all" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'css', 'inline-all')); ?>>
147
  <?php _e( 'Disable Merging and Inline all CSS', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'It will inline all CSS files, instead of merging CSS into an external file (not recommended)', 'fast-velocity-minify' ); ?> ]</span></label>
148
  <br />
149
 
150
+ <label for="fvm_settings_css_min_disable">
151
+ <input name="fvm_settings[css][min_disable]" type="checkbox" id="fvm_settings_css_min_disable" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'css', 'min_disable')); ?>>
152
+ <?php _e( 'Disable CSS Minification', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will allow merging but without CSS minification for testing purposes', 'fast-velocity-minify' ); ?> ]</span></label>
153
  <br />
154
 
155
+ <label for="fvm_settings_css_inline-all">
156
+ <input name="fvm_settings[css][nopreload]" type="checkbox" id="fvm_settings_css_nopreload" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'css', 'nopreload')); ?>>
157
+ <?php _e( 'Disable CSS link preload', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will remove the CSS link preload from the header (not recommended)', 'fast-velocity-minify' ); ?> ]</span></label>
158
  <br />
159
 
160
  <label for="fvm_settings_css_async">
161
  <input name="fvm_settings[css][async]" type="checkbox" id="fvm_settings_css_async" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'css', 'async')); ?>>
162
+ <?php _e( 'Load generated CSS files Async', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Use your own critical path code like <code>&lt;style id=&quot;critical-path&quot;&gt; your code &lt;/style&gt;</code>', 'fast-velocity-minify' ); ?> ]</span></label>
163
  <br />
164
 
165
  </fieldset></td>
201
  <tr>
202
  <th scope="row"><?php _e( 'JS Options', 'fast-velocity-minify' ); ?></th>
203
  <td>
204
+ <p class="fvm-bold-green fvm-rowintro"><?php _e( 'Recommended Settings', 'fast-velocity-minify' ); ?></p>
205
 
206
  <fieldset>
207
  <label for="fvm_settings_js_enable">
209
  <?php _e( 'Enable JS Processing', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will enable processing for the settings below', 'fast-velocity-minify' ); ?> ]</span></label>
210
  <br />
211
 
212
+ </fieldset></td>
213
+ </tr>
214
+
215
+ <tr>
216
+ <th scope="row"><?php _e( 'Advanced JS Options', 'fast-velocity-minify' ); ?></th>
217
+ <td>
218
+ <p class="fvm-bold-green fvm-rowintro"><?php _e( 'Handle with Care', 'fast-velocity-minify' ); ?></p>
219
+
220
+ <fieldset>
221
  <label for="fvm_settings_js_min_disable">
222
  <input name="fvm_settings[js][min_disable]" type="checkbox" id="fvm_settings_js_min_disable" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'js', 'min_disable')); ?>>
223
  <?php _e( 'Disable JS Minification', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will disable JS minification (merge only) for testing purposes', 'fast-velocity-minify' ); ?> ]</span></label>
224
  <br />
225
 
226
+ <label for="fvm_settings_js_inline-all">
227
+ <input name="fvm_settings[js][nopreload]" type="checkbox" id="fvm_settings_js_nopreload" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'js', 'nopreload')); ?>>
228
+ <?php _e( 'Disable JS link preload', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will remove the JS link preload from the header (not recommended)', 'fast-velocity-minify' ); ?> ]</span></label>
229
+ <br />
230
+
231
  <label for="fvm_settings_js_jqupgrade">
232
  <input name="fvm_settings[js][jqupgrade]" type="checkbox" id="fvm_settings_js_jqupgrade" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'js', 'jqupgrade')); ?>>
233
  <?php _e( 'Upgrade to jQuery 3', 'fast-velocity-minify' ); ?> <span class="note-info">[<?php _e( 'Will use jQuery 3.5.1 and jQuery Migrate 3.3.1 from Cloudflare (if enqueued)', 'fast-velocity-minify' ); ?> ]</span></label>
241
  <th scope="row"><?php _e( 'Ignore Script Files', 'fast-velocity-minify' ); ?></th>
242
  <td><fieldset>
243
  <label for="fvm_settings_js_ignore"><span class="fvm-bold-green fvm-rowintro"><?php _e( 'Will prevent merging and minification for these files, regardless of any other broader rules in this page.', 'fast-velocity-minify' ); ?></span></label>
244
+ <p><textarea name="fvm_settings[js][ignore]" rows="7" cols="50" id="fvm_settings_js_ignore" class="large-text code" placeholder="<?php _e( '--- ex: /plugins/something/assets/problem.js ---', 'fast-velocity-minify' ); ?>"><?php echo fvm_get_settings_value($fvm_settings, 'js', 'ignore'); ?></textarea></p>
245
  <p class="description">[ <?php _e( 'Will match using <code>PHP stripos</code> against the script <code>src</code> attribute', 'fast-velocity-minify' ); ?> ]</p>
246
  <p class="description">[ <?php _e( 'It is highly recommended to try to leave this empty and later be more specific on what to merge', 'fast-velocity-minify' ); ?> ]</p>
247
  </fieldset></td>
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.7
5
  Requires PHP: 5.6
6
- Stable tag: 3.1.0
7
  Tested up to: 5.6
8
  Text Domain: fast-velocity-minify
9
  License: GPLv3 or later
@@ -55,9 +55,15 @@ Version 3.0 is a major code rewrite to improve JS and CSS merging, but it requir
55
 
56
  == Changelog ==
57
 
 
 
 
 
 
 
58
  = 3.1.0 [2021.01.06] =
59
  * Added support for WP AMP by custom4web
60
- * Fix for code and pre tags being minified
61
  * Better HTML document detection for minification
62
 
63
  = 3.0.9 [2021.01.04] =
3
  Tags: PHP Minify, Lighthouse, GTmetrix, Pingdom, Pagespeed, Merging, Minification, Optimization, Speed, Performance, FVM
4
  Requires at least: 4.7
5
  Requires PHP: 5.6
6
+ Stable tag: 3.1.1
7
  Tested up to: 5.6
8
  Text Domain: fast-velocity-minify
9
  License: GPLv3 or later
55
 
56
  == Changelog ==
57
 
58
+ = 3.1.1 [2021.01.09] =
59
+ * Added option to disable preload header
60
+ * Added support for the preload header importance attribute
61
+ * Better default settings for new installs
62
+ * Other bug fixes related to UTF-8 decoding and merging
63
+
64
  = 3.1.0 [2021.01.06] =
65
  * Added support for WP AMP by custom4web
66
+ * Fix for <code> and <pre> tags being minified
67
  * Better HTML document detection for minification
68
 
69
  = 3.0.9 [2021.01.04] =