Version Description
[2019.07.27] = * fixed an AMP validation javascript error
Download this release
Release Info
Developer | Alignak |
Plugin | Fast Velocity Minify |
Version | 2.7.1 |
Comparing to | |
See all releases |
Code changes from version 2.7.0 to 2.7.1
- fvm.php +13 -8
- inc/functions.php +48 -1
- 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 |
------------------------------------------------------------------------
|
@@ -166,7 +166,9 @@ $fvmualist = array('x11.*fox\/54', 'oid\s4.*xus.*ome\/62', 'oobot', 'ighth', 'tm
|
|
166 |
add_action('wp_head','fastvelocity_add_fvmuag', -PHP_INT_MAX);
|
167 |
function fastvelocity_add_fvmuag() {
|
168 |
global $fvmualist;
|
169 |
-
|
|
|
|
|
170 |
}
|
171 |
|
172 |
# generate fvmuag js function
|
@@ -251,6 +253,11 @@ if(is_admin()) {
|
|
251 |
# remove query from static assets and process defering (if enabled)
|
252 |
add_filter('style_loader_src', 'fastvelocity_remove_cssjs_ver', 10, 2);
|
253 |
add_filter('script_loader_tag', 'fastvelocity_min_defer_js', 10, 3);
|
|
|
|
|
|
|
|
|
|
|
254 |
|
255 |
}
|
256 |
}
|
@@ -259,7 +266,7 @@ if(is_admin()) {
|
|
259 |
# exclude processing for editors and administrators (fix editors)
|
260 |
add_action( 'plugins_loaded', 'fastvelocity_fix_editor' );
|
261 |
function fastvelocity_fix_editor() {
|
262 |
-
global $fvm_fix_editor
|
263 |
if($fvm_fix_editor == true && is_user_logged_in()) {
|
264 |
remove_action('wp_print_scripts', 'fastvelocity_min_merge_header_scripts', PHP_INT_MAX );
|
265 |
remove_action('wp_print_footer_scripts', 'fastvelocity_min_merge_footer_scripts', 9.999999 );
|
@@ -268,6 +275,7 @@ global $fvm_fix_editor, $disable_js_merge, $disable_css_merge, $skip_emoji_remov
|
|
268 |
remove_action('wp_print_styles', 'fastvelocity_add_google_fonts_merged', PHP_INT_MAX);
|
269 |
remove_action('wp_print_footer_scripts', 'fastvelocity_add_google_fonts_merged', PHP_INT_MAX );
|
270 |
remove_action('init', 'fastvelocity_min_disable_wp_emojicons');
|
|
|
271 |
remove_action('template_redirect', 'fastvelocity_min_html_compression_start', PHP_INT_MAX);
|
272 |
remove_filter('style_loader_src', 'fastvelocity_remove_cssjs_ver', 10, 2);
|
273 |
remove_filter('script_loader_tag', 'fastvelocity_min_defer_js', 10, 3);
|
@@ -1624,7 +1632,7 @@ if (stripos($src, '?ver') !== false) {
|
|
1624 |
|
1625 |
|
1626 |
# fix page editors, admin, amp, etc
|
1627 |
-
if
|
1628 |
|
1629 |
# return if defer option is not selected
|
1630 |
if ($defer_for_pagespeed != true && $enable_defer_js != true) { return $tag; }
|
@@ -2543,7 +2551,6 @@ function fvm_add_criticial_path() {
|
|
2543 |
###########################################
|
2544 |
# add preconnect and preload headers
|
2545 |
###########################################
|
2546 |
-
add_action( 'send_headers', 'fvm_extra_preload_headers' );
|
2547 |
function fvm_extra_preload_headers() {
|
2548 |
|
2549 |
# fetch headers
|
@@ -2596,7 +2603,7 @@ function fastvelocity_optimizecss($html, $handle, $href, $media){
|
|
2596 |
if($fvm_debug == true) { echo "<!-- FVM DEBUG: Inline CSS processing start $handle / $href -->" . PHP_EOL; }
|
2597 |
|
2598 |
# prevent optimization for these locations
|
2599 |
-
if
|
2600 |
return $html;
|
2601 |
}
|
2602 |
|
@@ -2856,7 +2863,6 @@ function fastvelocity_add_google_fonts_merged() {
|
|
2856 |
|
2857 |
|
2858 |
# collect all fvm JS files and save them to an headers file
|
2859 |
-
add_filter('script_loader_tag', 'fastvelocity_collect_js_preload_headers', PHP_INT_MAX, 3 );
|
2860 |
function fastvelocity_collect_js_preload_headers($html, $handle, $src){
|
2861 |
global $cachedirurl, $collect_preload_js, $fvm_enabled_css_preload, $fvm_enabled_js_preload;
|
2862 |
|
@@ -2873,7 +2879,6 @@ function fastvelocity_collect_js_preload_headers($html, $handle, $src){
|
|
2873 |
}
|
2874 |
|
2875 |
# generate preload headers file
|
2876 |
-
add_action('wp_footer', 'fastvelocity_generate_preload_headers', PHP_INT_MAX);
|
2877 |
function fastvelocity_generate_preload_headers(){
|
2878 |
global $cachedirurl, $collect_preload_css, $collect_preload_js, $fvm_enabled_css_preload, $fvm_enabled_js_preload;
|
2879 |
|
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.1
|
9 |
License: GPL2
|
10 |
|
11 |
------------------------------------------------------------------------
|
166 |
add_action('wp_head','fastvelocity_add_fvmuag', -PHP_INT_MAX);
|
167 |
function fastvelocity_add_fvmuag() {
|
168 |
global $fvmualist;
|
169 |
+
if(!fastvelocity_exclude_contents() || fastvelocity_load_fvuag()) {
|
170 |
+
echo '<script>'.fastvelocity_get_fvmuag($fvmualist).'</script>';
|
171 |
+
}
|
172 |
}
|
173 |
|
174 |
# generate fvmuag js function
|
253 |
# remove query from static assets and process defering (if enabled)
|
254 |
add_filter('style_loader_src', 'fastvelocity_remove_cssjs_ver', 10, 2);
|
255 |
add_filter('script_loader_tag', 'fastvelocity_min_defer_js', 10, 3);
|
256 |
+
|
257 |
+
# headers
|
258 |
+
add_action( 'send_headers', 'fvm_extra_preload_headers' );
|
259 |
+
add_action( 'wp_footer', 'fastvelocity_generate_preload_headers', PHP_INT_MAX);
|
260 |
+
add_filter( 'script_loader_tag', 'fastvelocity_collect_js_preload_headers', PHP_INT_MAX, 3 );
|
261 |
|
262 |
}
|
263 |
}
|
266 |
# exclude processing for editors and administrators (fix editors)
|
267 |
add_action( 'plugins_loaded', 'fastvelocity_fix_editor' );
|
268 |
function fastvelocity_fix_editor() {
|
269 |
+
global $fvm_fix_editor;
|
270 |
if($fvm_fix_editor == true && is_user_logged_in()) {
|
271 |
remove_action('wp_print_scripts', 'fastvelocity_min_merge_header_scripts', PHP_INT_MAX );
|
272 |
remove_action('wp_print_footer_scripts', 'fastvelocity_min_merge_footer_scripts', 9.999999 );
|
275 |
remove_action('wp_print_styles', 'fastvelocity_add_google_fonts_merged', PHP_INT_MAX);
|
276 |
remove_action('wp_print_footer_scripts', 'fastvelocity_add_google_fonts_merged', PHP_INT_MAX );
|
277 |
remove_action('init', 'fastvelocity_min_disable_wp_emojicons');
|
278 |
+
remove_filter( 'tiny_mce_plugins', 'fastvelocity_disable_emojis_tinymce' );
|
279 |
remove_action('template_redirect', 'fastvelocity_min_html_compression_start', PHP_INT_MAX);
|
280 |
remove_filter('style_loader_src', 'fastvelocity_remove_cssjs_ver', 10, 2);
|
281 |
remove_filter('script_loader_tag', 'fastvelocity_min_defer_js', 10, 3);
|
1632 |
|
1633 |
|
1634 |
# fix page editors, admin, amp, etc
|
1635 |
+
if(fastvelocity_exclude_contents()) { return $tag; }
|
1636 |
|
1637 |
# return if defer option is not selected
|
1638 |
if ($defer_for_pagespeed != true && $enable_defer_js != true) { return $tag; }
|
2551 |
###########################################
|
2552 |
# add preconnect and preload headers
|
2553 |
###########################################
|
|
|
2554 |
function fvm_extra_preload_headers() {
|
2555 |
|
2556 |
# fetch headers
|
2603 |
if($fvm_debug == true) { echo "<!-- FVM DEBUG: Inline CSS processing start $handle / $href -->" . PHP_EOL; }
|
2604 |
|
2605 |
# prevent optimization for these locations
|
2606 |
+
if(fastvelocity_exclude_contents()) {
|
2607 |
return $html;
|
2608 |
}
|
2609 |
|
2863 |
|
2864 |
|
2865 |
# collect all fvm JS files and save them to an headers file
|
|
|
2866 |
function fastvelocity_collect_js_preload_headers($html, $handle, $src){
|
2867 |
global $cachedirurl, $collect_preload_js, $fvm_enabled_css_preload, $fvm_enabled_js_preload;
|
2868 |
|
2879 |
}
|
2880 |
|
2881 |
# generate preload headers file
|
|
|
2882 |
function fastvelocity_generate_preload_headers(){
|
2883 |
global $cachedirurl, $collect_preload_css, $collect_preload_js, $fvm_enabled_css_preload, $fvm_enabled_js_preload;
|
2884 |
|
inc/functions.php
CHANGED
@@ -784,11 +784,57 @@ return str_ireplace(array('\\\\\"', '\\\\"', '\\\"', '\\"'), '\"', json_encode($
|
|
784 |
|
785 |
|
786 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
787 |
# exclude processing from some pages / posts / contents
|
788 |
function fastvelocity_exclude_contents() {
|
789 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
790 |
# exclude processing here
|
791 |
-
if (is_admin() || (defined('DOING_AJAX') && DOING_AJAX) || (function_exists('wp_doing_ajax') && wp_doing_ajax()) || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || (defined('WP_BLOG_ADMIN') && WP_BLOG_ADMIN) || (defined('WP_NETWORK_ADMIN') && WP_NETWORK_ADMIN) || (defined('WP_INSTALLING') && WP_INSTALLING) || (defined('WP_IMPORTING') && WP_IMPORTING) || (defined('WP_REPAIRING') && WP_REPAIRING) || (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST) || (defined('SHORTINIT') && SHORTINIT) || (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST') ||
|
792 |
(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') || (isset($_SERVER['REQUEST_URI']) && (substr($_SERVER['REQUEST_URI'], -4) == '.txt' || substr($_SERVER['REQUEST_URI'], -4) == '.xml'))) {
|
793 |
return true;
|
794 |
}
|
@@ -823,6 +869,7 @@ function fastvelocity_exclude_contents() {
|
|
823 |
return false;
|
824 |
}
|
825 |
|
|
|
826 |
# Know files that should always be ignored
|
827 |
function fastvelocity_default_ignore($ignore) {
|
828 |
if(is_array($ignore)) {
|
784 |
|
785 |
|
786 |
|
787 |
+
# always load the fvmua javascript code
|
788 |
+
function fastvelocity_load_fvuag() {
|
789 |
+
|
790 |
+
# for compatibility, let's always skip the checkout page
|
791 |
+
if(function_exists('is_checkout') && is_checkout() === true || is_preview() || is_customize_preview()) {
|
792 |
+
return true;
|
793 |
+
}
|
794 |
+
|
795 |
+
# customizer preview, visual composer
|
796 |
+
$arr = array('customize_theme', 'preview_id', 'preview');
|
797 |
+
foreach ($arr as $a) { if(isset($_GET[$a])) { return true; } }
|
798 |
+
|
799 |
+
# Thrive plugins and other post_types
|
800 |
+
$arr = array('tve_form_type', 'tve_lead_shortcode', 'tqb_splash');
|
801 |
+
foreach ($arr as $a) { if(isset($_GET['post_type']) && $_GET['post_type'] == $a) { return true; } }
|
802 |
+
|
803 |
+
# elementor
|
804 |
+
if(isset($_GET['elementor-preview'])) { return true; }
|
805 |
+
if(is_array($_GET)) {
|
806 |
+
foreach ($_GET as $k=>$v) {
|
807 |
+
if(is_string($v) && is_string($k)) {
|
808 |
+
if(stripos($k, 'elementor') !== false || stripos($v, 'elementor') !== false) {
|
809 |
+
return true;
|
810 |
+
}
|
811 |
+
}
|
812 |
+
}
|
813 |
+
}
|
814 |
+
|
815 |
+
# do not load
|
816 |
+
return false;
|
817 |
+
}
|
818 |
+
|
819 |
+
|
820 |
# exclude processing from some pages / posts / contents
|
821 |
function fastvelocity_exclude_contents() {
|
822 |
|
823 |
+
# prevent execution for specific urls
|
824 |
+
if(isset($_SERVER['REQUEST_URI']) && !empty($_SERVER['REQUEST_URI'])) {
|
825 |
+
$disable_on_url = array_filter(array_map('trim', explode(PHP_EOL, get_option('fastvelocity_disable_on_url', ''))));
|
826 |
+
foreach ($disable_on_url as $url) {
|
827 |
+
if($url == parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)) { return true; }
|
828 |
+
}
|
829 |
+
}
|
830 |
+
|
831 |
+
# for compatibility, let's always skip the checkout page
|
832 |
+
if(function_exists('is_checkout') && is_checkout() === true) {
|
833 |
+
return true;
|
834 |
+
}
|
835 |
+
|
836 |
# exclude processing here
|
837 |
+
if (is_feed() || is_admin() || is_preview() || is_customize_preview() || (defined('DOING_AJAX') && DOING_AJAX) || (function_exists('wp_doing_ajax') && wp_doing_ajax()) || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || (defined('WP_BLOG_ADMIN') && WP_BLOG_ADMIN) || (defined('WP_NETWORK_ADMIN') && WP_NETWORK_ADMIN) || (defined('WP_INSTALLING') && WP_INSTALLING) || (defined('WP_IMPORTING') && WP_IMPORTING) || (defined('WP_REPAIRING') && WP_REPAIRING) || (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST) || (defined('SHORTINIT') && SHORTINIT) || (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'POST') || (function_exists( 'is_amp_endpoint' ) && is_amp_endpoint()) ||
|
838 |
(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') || (isset($_SERVER['REQUEST_URI']) && (substr($_SERVER['REQUEST_URI'], -4) == '.txt' || substr($_SERVER['REQUEST_URI'], -4) == '.xml'))) {
|
839 |
return true;
|
840 |
}
|
869 |
return false;
|
870 |
}
|
871 |
|
872 |
+
|
873 |
# Know files that should always be ignored
|
874 |
function fastvelocity_default_ignore($ignore) {
|
875 |
if(is_array($ignore)) {
|
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, Speed, Fast
|
4 |
Requires at least: 4.5
|
5 |
Requires PHP: 5.5
|
6 |
-
Stable tag: 2.7.
|
7 |
Tested up to: 5.2.2
|
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.0 [2019.07.23] =
|
202 |
* some score fixes when deferring to pagespeed is enabled
|
203 |
|
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 |
Requires PHP: 5.5
|
6 |
+
Stable tag: 2.7.1
|
7 |
Tested up to: 5.2.2
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
198 |
|
199 |
== Changelog ==
|
200 |
|
201 |
+
= 2.7.1 [2019.07.27] =
|
202 |
+
* fixed an AMP validation javascript error
|
203 |
+
|
204 |
= 2.7.0 [2019.07.23] =
|
205 |
* some score fixes when deferring to pagespeed is enabled
|
206 |
|