Version Description
[2020.12.27] = * Added initial translation support under the "fast-velocity-minify" text domain.
Download this release
Release Info
Developer | Alignak |
Plugin | Fast Velocity Minify |
Version | 3.0.1 |
Comparing to | |
See all releases |
Code changes from version 3.0.0 to 3.0.1
- fvm.php +2 -1
- inc/admin.php +19 -18
- inc/common.php +52 -87
- inc/frontend.php +10 -19
- inc/serverinfo.php +12 -12
- inc/wp-cli.php +3 -3
- layout/admin-layout-settings.php +82 -82
- layout/admin-layout-status.php +7 -7
- layout/admin-layout.php +4 -4
- readme.txt +5 -1
fvm.php
CHANGED
@@ -5,7 +5,8 @@ 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 |
-
|
|
|
9 |
License: GPL2
|
10 |
|
11 |
------------------------------------------------------------------------
|
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 |
+
Text Domain: fast-velocity-minify
|
9 |
+
Version: 3.0.1
|
10 |
License: GPL2
|
11 |
|
12 |
------------------------------------------------------------------------
|
inc/admin.php
CHANGED
@@ -12,23 +12,23 @@ function fvm_check_minimum_requirements() {
|
|
12 |
|
13 |
# php version requirements
|
14 |
if (version_compare( PHP_VERSION, '5.6', '<' )) {
|
15 |
-
$error = 'FVM requires PHP 5.6 or higher. You’re still on '. PHP_VERSION;
|
16 |
}
|
17 |
|
18 |
# php extension requirements
|
19 |
if (!extension_loaded('mbstring')) {
|
20 |
-
$error = 'FVM requires the PHP mbstring module to be installed on the server.';
|
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 ' . $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 |
-
|
32 |
}
|
33 |
|
34 |
# deactivate plugin forcefully
|
@@ -51,12 +51,13 @@ function fvm_check_misconfiguration() {
|
|
51 |
|
52 |
# check if custom cache directory exists
|
53 |
if(isset($fvm_settings['cache']['path']) && !empty($fvm_settings['cache']['path']) && !is_dir($fvm_settings['cache']['path']) && !is_writeable($fvm_settings['cache']['path'])) {
|
54 |
-
add_settings_error( 'fvm_admin_notice', 'fvm_admin_notice', 'FVM needs writing permissions
|
|
|
55 |
}
|
56 |
|
57 |
# cache permissions
|
58 |
if(!is_dir($fvm_cache_paths['cache_base_dir']) && !is_writeable($fvm_settings['cache']['path'])) {
|
59 |
-
$error = 'FVM needs writing permissions
|
60 |
}
|
61 |
|
62 |
# initialize database routine if not available
|
@@ -75,11 +76,11 @@ function fvm_save_settings() {
|
|
75 |
if(isset($_POST['fvm_action']) && isset($_POST['fvm_settings_nonce']) && $_POST['fvm_action'] == 'save_settings') {
|
76 |
|
77 |
if(!current_user_can('manage_options')) {
|
78 |
-
wp_die( __('You do not have sufficient permissions to access this page.'), __('Error:'), array('response'=>200));
|
79 |
}
|
80 |
|
81 |
if(!wp_verify_nonce($_POST['fvm_settings_nonce'], 'fvm_settings_nonce')) {
|
82 |
-
wp_die( __('Invalid nounce. Please refresh and try again.'), __('Error:'), array('response'=>200));
|
83 |
}
|
84 |
|
85 |
# update fvm_settings in the global scope
|
@@ -122,7 +123,7 @@ function fvm_save_settings() {
|
|
122 |
add_settings_error( 'fvm_admin_notice', 'fvm_admin_notice', 'Settings saved successfully!', 'success' );
|
123 |
|
124 |
} else {
|
125 |
-
wp_die( __('Invalid data!'), __('Error:'), array('response'=>200));
|
126 |
}
|
127 |
}
|
128 |
}
|
@@ -220,12 +221,12 @@ function fvm_get_logs_callback() {
|
|
220 |
|
221 |
# must be able to cleanup cache
|
222 |
if (!current_user_can('manage_options')) {
|
223 |
-
wp_die( __('You do not have sufficient permissions to access this page.'), __('Error:'), array('response'=>200));
|
224 |
}
|
225 |
|
226 |
# must have
|
227 |
if(!defined('WP_CONTENT_DIR')) {
|
228 |
-
wp_die( __('WP_CONTENT_DIR is undefined!'), __('Error:'), array('response'=>200));
|
229 |
}
|
230 |
|
231 |
# get info
|
@@ -331,8 +332,8 @@ function fvm_get_logs_callback() {
|
|
331 |
|
332 |
# start log
|
333 |
$js_log.= '+++++++++' . PHP_EOL;
|
334 |
-
$js_log.= 'PROCESSED - ' . date('r', $log->date) . ' - VIA - '. $meta['loc'] . PHP_EOL;
|
335 |
-
$js_log.= 'GENERATED - ' . $meta['fl'] . PHP_EOL;
|
336 |
$js_log.= '---' . PHP_EOL;
|
337 |
|
338 |
# generate uid's from json
|
@@ -345,7 +346,7 @@ function fvm_get_logs_callback() {
|
|
345 |
$rs = array(); $rs = $wpdb->get_results($wpdb->prepare("SELECT meta FROM ".$wpdb->prefix."fvm_cache WHERE uid IN (".$listuids.") ORDER BY FIELD(uid, '".implode("', '", $list)."')", $list));
|
346 |
foreach ($rs as $r) {
|
347 |
$imt = json_decode($r->meta, true);
|
348 |
-
$js_log.= '[Size: '.str_pad(fvm_format_filesize($imt['fs']), 10,' ',STR_PAD_LEFT).']'."\t". $imt['url'] . PHP_EOL;
|
349 |
}
|
350 |
}
|
351 |
$js_log.= '+++++++++' . PHP_EOL . PHP_EOL;
|
@@ -356,8 +357,8 @@ function fvm_get_logs_callback() {
|
|
356 |
$js_log = trim($js_log);
|
357 |
|
358 |
# default message
|
359 |
-
if(empty($css_log)) { $css_log = 'No CSS files generated yet.'; }
|
360 |
-
if(empty($js_log)) { $js_log = 'No JS files generated yet.'; }
|
361 |
|
362 |
# build info
|
363 |
$result = array(
|
@@ -377,7 +378,7 @@ function fvm_get_logs_callback() {
|
|
377 |
}
|
378 |
|
379 |
# default
|
380 |
-
wp_die( __('Unknown cache path!'), __('Error:'), array('response'=>200));
|
381 |
}
|
382 |
|
383 |
|
@@ -489,6 +490,6 @@ function fvm_get_user_roles_checkboxes() {
|
|
489 |
}
|
490 |
|
491 |
# return
|
492 |
-
if(!empty($roles_list)) { return implode(PHP_EOL, $roles_list); } else { return 'No roles detected!'; }
|
493 |
|
494 |
}
|
12 |
|
13 |
# php version requirements
|
14 |
if (version_compare( PHP_VERSION, '5.6', '<' )) {
|
15 |
+
$error = __( 'FVM requires PHP 5.6 or higher. You’re still on', 'fast-velocity-minify' ) .' '. PHP_VERSION;
|
16 |
}
|
17 |
|
18 |
# php extension requirements
|
19 |
if (!extension_loaded('mbstring')) {
|
20 |
+
$error = __( 'FVM requires the PHP mbstring module to be installed on the server.', 'fast-velocity-minify' );
|
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
|
51 |
|
52 |
# check if custom cache directory exists
|
53 |
if(isset($fvm_settings['cache']['path']) && !empty($fvm_settings['cache']['path']) && !is_dir($fvm_settings['cache']['path']) && !is_writeable($fvm_settings['cache']['path'])) {
|
54 |
+
add_settings_error( 'fvm_admin_notice', 'fvm_admin_notice', __( 'FVM needs writing permissions.', 'fast-velocity-minify' ).
|
55 |
+
' ['.$fvm_settings['cache']['path'].']' , 'success' );
|
56 |
}
|
57 |
|
58 |
# cache permissions
|
59 |
if(!is_dir($fvm_cache_paths['cache_base_dir']) && !is_writeable($fvm_settings['cache']['path'])) {
|
60 |
+
$error = __( 'FVM needs writing permissions.', 'fast-velocity-minify' ) . ' ['.$fvm_cache_paths['cache_base_dir'].']';
|
61 |
}
|
62 |
|
63 |
# initialize database routine if not available
|
76 |
if(isset($_POST['fvm_action']) && isset($_POST['fvm_settings_nonce']) && $_POST['fvm_action'] == 'save_settings') {
|
77 |
|
78 |
if(!current_user_can('manage_options')) {
|
79 |
+
wp_die( __('You do not have sufficient permissions to access this page.', 'fast-velocity-minify'), __('Error:', 'fast-velocity-minify'), array('response'=>200));
|
80 |
}
|
81 |
|
82 |
if(!wp_verify_nonce($_POST['fvm_settings_nonce'], 'fvm_settings_nonce')) {
|
83 |
+
wp_die( __('Invalid nounce. Please refresh and try again.', 'fast-velocity-minify'), __('Error:', 'fast-velocity-minify'), array('response'=>200));
|
84 |
}
|
85 |
|
86 |
# update fvm_settings in the global scope
|
123 |
add_settings_error( 'fvm_admin_notice', 'fvm_admin_notice', 'Settings saved successfully!', 'success' );
|
124 |
|
125 |
} else {
|
126 |
+
wp_die( __('Invalid data!', 'fast-velocity-minify'), __('Error:', 'fast-velocity-minify'), array('response'=>200));
|
127 |
}
|
128 |
}
|
129 |
}
|
221 |
|
222 |
# must be able to cleanup cache
|
223 |
if (!current_user_can('manage_options')) {
|
224 |
+
wp_die( __('You do not have sufficient permissions to access this page.', 'fast-velocity-minify'), __('Error:', 'fast-velocity-minify'), array('response'=>200));
|
225 |
}
|
226 |
|
227 |
# must have
|
228 |
if(!defined('WP_CONTENT_DIR')) {
|
229 |
+
wp_die( __('WP_CONTENT_DIR is undefined!', 'fast-velocity-minify'), __('Error:', 'fast-velocity-minify'), array('response'=>200));
|
230 |
}
|
231 |
|
232 |
# get info
|
332 |
|
333 |
# start log
|
334 |
$js_log.= '+++++++++' . PHP_EOL;
|
335 |
+
$js_log.= __( 'PROCESSED', 'fast-velocity-minify' ) . ' - ' . date('r', $log->date) . ' - VIA - '. $meta['loc'] . PHP_EOL;
|
336 |
+
$js_log.= __( 'GENERATED', 'fast-velocity-minify' ) . ' - ' . $meta['fl'] . PHP_EOL;
|
337 |
$js_log.= '---' . PHP_EOL;
|
338 |
|
339 |
# generate uid's from json
|
346 |
$rs = array(); $rs = $wpdb->get_results($wpdb->prepare("SELECT meta FROM ".$wpdb->prefix."fvm_cache WHERE uid IN (".$listuids.") ORDER BY FIELD(uid, '".implode("', '", $list)."')", $list));
|
347 |
foreach ($rs as $r) {
|
348 |
$imt = json_decode($r->meta, true);
|
349 |
+
$js_log.= '['.__( 'Size:', 'fast-velocity-minify' ).' '.str_pad(fvm_format_filesize($imt['fs']), 10,' ',STR_PAD_LEFT).']'."\t". $imt['url'] . PHP_EOL;
|
350 |
}
|
351 |
}
|
352 |
$js_log.= '+++++++++' . PHP_EOL . PHP_EOL;
|
357 |
$js_log = trim($js_log);
|
358 |
|
359 |
# default message
|
360 |
+
if(empty($css_log)) { $css_log = __( 'No CSS files generated yet.', 'fast-velocity-minify' ); }
|
361 |
+
if(empty($js_log)) { $js_log = __( 'No JS files generated yet.', 'fast-velocity-minify' ); }
|
362 |
|
363 |
# build info
|
364 |
$result = array(
|
378 |
}
|
379 |
|
380 |
# default
|
381 |
+
wp_die( __('Unknown cache path!', 'fast-velocity-minify'), __('Error:', 'fast-velocity-minify'), array('response'=>200));
|
382 |
}
|
383 |
|
384 |
|
490 |
}
|
491 |
|
492 |
# return
|
493 |
+
if(!empty($roles_list)) { return implode(PHP_EOL, $roles_list); } else { return __( 'No roles detected!', 'fast-velocity-minify' ); }
|
494 |
|
495 |
}
|
inc/common.php
CHANGED
@@ -62,12 +62,12 @@ function fvm_process_cache_purge_request(){
|
|
62 |
|
63 |
# must be able to cleanup cache
|
64 |
if (!current_user_can('manage_options')) {
|
65 |
-
wp_die( __('You do not have sufficient permissions to access this page.'), __('Error:'), array('response'=>200));
|
66 |
}
|
67 |
|
68 |
# validate nonce
|
69 |
if(!wp_verify_nonce($_GET['_wpnonce'], 'fvm_clear')) {
|
70 |
-
wp_die( __('Invalid or expired request... please go back and refresh before trying again!'), __('Error:'), array('response'=>200));
|
71 |
}
|
72 |
|
73 |
# Purge All
|
@@ -85,7 +85,7 @@ function fvm_process_cache_purge_request(){
|
|
85 |
if(is_string($others)) { $notices[] = $others; }
|
86 |
|
87 |
# save transient for after the redirect
|
88 |
-
if(count($notices) == 0) { $notices[] = 'FVM: All Caches are now cleared. ('.date("D, d M Y @ H:i:s e").')'; }
|
89 |
set_transient( 'fvm_admin_notice', json_encode($notices), 10);
|
90 |
|
91 |
}
|
@@ -184,11 +184,11 @@ function fvm_purge_minification() {
|
|
184 |
# schedule purge for 24 hours later, only once
|
185 |
add_action( 'fvm_purge_minification_later', 'fvm_purge_minification_expired' );
|
186 |
wp_schedule_single_event(time() + 3600 * 24, 'fvm_purge_minification_later');
|
187 |
-
return 'Expired minification files are set to be deleted in 24 hours.';
|
188 |
}
|
189 |
|
190 |
} else {
|
191 |
-
return 'The cache directory is not rewritable!';
|
192 |
}
|
193 |
|
194 |
return false;
|
@@ -202,7 +202,7 @@ function fvm_purge_minification_now() {
|
|
202 |
$result = fvm_rrmdir($fvm_cache_paths['cache_dir_min']);
|
203 |
return $result;
|
204 |
} else {
|
205 |
-
return 'The cache directory is not writeable!';
|
206 |
}
|
207 |
}
|
208 |
|
@@ -214,7 +214,7 @@ function fvm_purge_minification_expired() {
|
|
214 |
# must be on the allowed path
|
215 |
$wd = $fvm_cache_paths['cache_dir_min'];
|
216 |
if(empty($wd) || !defined('WP_CONTENT_DIR') || stripos($wd, '/fvm') === false) {
|
217 |
-
return 'Requested purge path is not allowed!';
|
218 |
}
|
219 |
|
220 |
# prefix
|
@@ -237,7 +237,7 @@ function fvm_purge_minification_expired() {
|
|
237 |
}
|
238 |
}
|
239 |
|
240 |
-
return 'Expired
|
241 |
}
|
242 |
}
|
243 |
|
@@ -250,55 +250,55 @@ function fvm_purge_others(){
|
|
250 |
# Purge all W3 Total Cache
|
251 |
if (function_exists('w3tc_pgcache_flush')) {
|
252 |
w3tc_pgcache_flush();
|
253 |
-
return __('All caches on <strong>W3 Total Cache</strong> have been purged.');
|
254 |
}
|
255 |
|
256 |
# Purge WP Super Cache
|
257 |
if (function_exists('wp_cache_clear_cache')) {
|
258 |
wp_cache_clear_cache();
|
259 |
-
return __('All caches on <strong>WP Super Cache</strong> have been purged.');
|
260 |
}
|
261 |
|
262 |
# Purge WP Rocket
|
263 |
if (function_exists('rocket_clean_domain')) {
|
264 |
rocket_clean_domain();
|
265 |
-
return __('All caches on <strong>WP Rocket</strong> have been purged.');
|
266 |
}
|
267 |
|
268 |
# Purge Cachify
|
269 |
if (function_exists('cachify_flush_cache')) {
|
270 |
cachify_flush_cache();
|
271 |
-
return __('All caches on <strong>Cachify</strong> have been purged.');
|
272 |
}
|
273 |
|
274 |
# Purge Comet Cache
|
275 |
if ( class_exists("comet_cache") ) {
|
276 |
comet_cache::clear();
|
277 |
-
return __('All caches on <strong>Comet Cache</strong> have been purged.');
|
278 |
}
|
279 |
|
280 |
# Purge Zen Cache
|
281 |
if ( class_exists("zencache") ) {
|
282 |
zencache::clear();
|
283 |
-
return __('All caches on <strong>Comet Cache</strong> have been purged.');
|
284 |
}
|
285 |
|
286 |
# Purge LiteSpeed Cache
|
287 |
if (class_exists('LiteSpeed_Cache_Tags')) {
|
288 |
LiteSpeed_Cache_Tags::add_purge_tag('*');
|
289 |
-
return __('All caches on <strong>LiteSpeed Cache</strong> have been purged.');
|
290 |
}
|
291 |
|
292 |
# Purge Hyper Cache
|
293 |
if (class_exists( 'HyperCache' )) {
|
294 |
do_action( 'autoptimize_action_cachepurged' );
|
295 |
-
return __( 'All caches on <strong>HyperCache</strong> have been purged.');
|
296 |
}
|
297 |
|
298 |
# purge cache enabler
|
299 |
if ( has_action('ce_clear_cache') ) {
|
300 |
do_action('ce_clear_cache');
|
301 |
-
return __( 'All caches on <strong>Cache Enabler</strong> have been purged.');
|
302 |
}
|
303 |
|
304 |
# purge wpfc
|
@@ -309,14 +309,14 @@ function fvm_purge_others(){
|
|
309 |
# add breeze cache purge support
|
310 |
if (class_exists("Breeze_PurgeCache")) {
|
311 |
Breeze_PurgeCache::breeze_cache_flush();
|
312 |
-
return __( 'All caches on <strong>Breeze</strong> have been purged.');
|
313 |
}
|
314 |
|
315 |
|
316 |
# swift
|
317 |
if (class_exists("Swift_Performance_Cache")) {
|
318 |
Swift_Performance_Cache::clear_all_cache();
|
319 |
-
return __( 'All caches on <strong>Swift Performance</strong> have been purged.');
|
320 |
}
|
321 |
|
322 |
|
@@ -325,13 +325,13 @@ function fvm_purge_others(){
|
|
325 |
# Purge SG Optimizer (Siteground)
|
326 |
if (function_exists('sg_cachepress_purge_cache')) {
|
327 |
sg_cachepress_purge_cache();
|
328 |
-
return __('All caches on <strong>SG Optimizer</strong> have been purged.');
|
329 |
}
|
330 |
|
331 |
# Purge Godaddy Managed WordPress Hosting (Varnish + APC)
|
332 |
if (class_exists('WPaaS\Plugin') && method_exists( 'WPass\Plugin', 'vip' )) {
|
333 |
fvm_godaddy_request('BAN');
|
334 |
-
return __('A cache purge request has been sent to <strong>Go Daddy Varnish</strong>');
|
335 |
}
|
336 |
|
337 |
|
@@ -340,7 +340,7 @@ function fvm_purge_others(){
|
|
340 |
if (method_exists('WpeCommon', 'purge_memcached')) { WpeCommon::purge_memcached(); }
|
341 |
if (method_exists('WpeCommon', 'purge_varnish_cache')) { WpeCommon::purge_varnish_cache(); }
|
342 |
if (method_exists('WpeCommon', 'purge_memcached') || method_exists('WpeCommon', 'purge_varnish_cache')) {
|
343 |
-
return __('A cache purge request has been sent to <strong>WP Engine</strong>');
|
344 |
}
|
345 |
}
|
346 |
|
@@ -349,7 +349,7 @@ function fvm_purge_others(){
|
|
349 |
if ( isset($kinsta_cache) && class_exists('\\Kinsta\\CDN_Enabler')) {
|
350 |
if (!empty( $kinsta_cache->kinsta_cache_purge)){
|
351 |
$kinsta_cache->kinsta_cache_purge->purge_complete_caches();
|
352 |
-
return __('A cache purge request has been sent to <strong>Kinsta</strong>');
|
353 |
}
|
354 |
}
|
355 |
|
@@ -357,14 +357,14 @@ function fvm_purge_others(){
|
|
357 |
if ( class_exists( 'PagelyCachePurge' ) ) {
|
358 |
$purge_pagely = new PagelyCachePurge();
|
359 |
$purge_pagely->purgeAll();
|
360 |
-
return __('A cache purge request has been sent to <strong>Pagely</strong>');
|
361 |
}
|
362 |
|
363 |
# Purge Pressidum
|
364 |
if (defined('WP_NINUKIS_WP_NAME') && class_exists('Ninukis_Plugin')){
|
365 |
$purge_pressidum = Ninukis_Plugin::get_instance();
|
366 |
$purge_pressidum->purgeAllCaches();
|
367 |
-
return __('A cache purge request has been sent to <strong>Pressidium</strong>');
|
368 |
}
|
369 |
|
370 |
# Purge Savvii
|
@@ -372,7 +372,7 @@ function fvm_purge_others(){
|
|
372 |
$purge_savvii = new \Savvii\CacheFlusherPlugin();
|
373 |
if ( method_exists( $plugin, 'domainflush' ) ) {
|
374 |
$purge_savvii->domainflush();
|
375 |
-
return __('A cache purge request has been sent to <strong>Savvii</strong>');
|
376 |
}
|
377 |
}
|
378 |
|
@@ -592,7 +592,7 @@ function fvm_rrmdir($path) {
|
|
592 |
|
593 |
# must be on the allowed path
|
594 |
if(empty($path) || !defined('WP_CONTENT_DIR') || stripos($path, '/fvm') === false) {
|
595 |
-
return 'Requested purge path is not allowed!';
|
596 |
}
|
597 |
|
598 |
# purge recursively
|
@@ -623,7 +623,7 @@ function fvm_fix_permission_bits($file){
|
|
623 |
|
624 |
# must be on the allowed path
|
625 |
if(empty($file) || !defined('WP_CONTENT_DIR') || stripos($file, '/fvm') === false) {
|
626 |
-
return 'Requested path is not allowed!';
|
627 |
}
|
628 |
|
629 |
if(function_exists('stat') && fvm_function_available('stat')) {
|
@@ -814,7 +814,7 @@ function fvm_maybe_download($url) {
|
|
814 |
}
|
815 |
|
816 |
# failed
|
817 |
-
return array('error'=>'Could not read or fetch from '. $url);
|
818 |
}
|
819 |
|
820 |
|
@@ -826,7 +826,7 @@ function fvm_save_file($file, $content) {
|
|
826 |
|
827 |
# must be on the allowed path
|
828 |
if(empty($path) || !defined('WP_CONTENT_DIR') || stripos($path, '/fvm') === false) {
|
829 |
-
return 'Requested path is not allowed!';
|
830 |
}
|
831 |
|
832 |
# create directory structure
|
@@ -1152,58 +1152,6 @@ function fvm_try_catch_wrap($js, $href=null) {
|
|
1152 |
}
|
1153 |
|
1154 |
|
1155 |
-
# wrap html tag in our function for low priority processing inplace
|
1156 |
-
function fvm_wrap_script_inline($tag) {
|
1157 |
-
|
1158 |
-
# must be a valid type
|
1159 |
-
if(!is_object($tag) && !is_array($tag)) {
|
1160 |
-
return $tag;
|
1161 |
-
}
|
1162 |
-
|
1163 |
-
# skip application/ld+json
|
1164 |
-
if(isset($tag->type) && $tag->type == 'application/ld+json') {
|
1165 |
-
return $tag;
|
1166 |
-
}
|
1167 |
-
|
1168 |
-
# scripts with src
|
1169 |
-
if(isset($tag->src)) {
|
1170 |
-
|
1171 |
-
# get all attributes into $rem
|
1172 |
-
$rem = '';
|
1173 |
-
foreach($tag->getAllAttributes() as $k=>$v){
|
1174 |
-
if($k != 'async' && $k != 'defer' && $k != 'src' && $k != 'type') {
|
1175 |
-
$rem.= "b.setAttribute('$k','$v');";
|
1176 |
-
}
|
1177 |
-
}
|
1178 |
-
|
1179 |
-
# rewrite scripts without document.write, for async scripts
|
1180 |
-
if(isset($tag->async)) {
|
1181 |
-
$tag->outertext = "<script data-cfasync='false'>if(wpruag()){(function(a){var b=a.createElement('script'),c=a.scripts[0];b.src='".$tag->src."';".$rem."c.parentNode.insertBefore(b,c);}(document));}</script>";
|
1182 |
-
return $tag;
|
1183 |
-
}
|
1184 |
-
|
1185 |
-
# rewrite scripts without document.write, for defer scripts
|
1186 |
-
if (isset($tag->defer)) {
|
1187 |
-
$tag->outertext = "<script data-cfasync='false'>if(wpruag()){(function(a){var b=a.createElement('script'),c=a.scripts[0];b.src='".$tag->src."';b.async=false;".$rem."c.parentNode.insertBefore(b,c);}(document));}</script>";
|
1188 |
-
return $tag;
|
1189 |
-
}
|
1190 |
-
|
1191 |
-
# check for line breaks, skip if found and not empty code inside
|
1192 |
-
if(stripos(trim($tag->innertext), PHP_EOL) !== false) {
|
1193 |
-
return $tag;
|
1194 |
-
}
|
1195 |
-
|
1196 |
-
# fallback to document.write (outerHTML won't work)
|
1197 |
-
$tag->outertext = '<script data-cfasync="false">if(wpruag()){document.write('.fvm_escape_url_js($tag->outertext).');}</script>';
|
1198 |
-
return $tag;
|
1199 |
-
|
1200 |
-
}
|
1201 |
-
|
1202 |
-
# fallback
|
1203 |
-
return $tag;
|
1204 |
-
}
|
1205 |
-
|
1206 |
-
|
1207 |
# Disable the emoji's on the frontend
|
1208 |
function fvm_disable_emojis() {
|
1209 |
global $fvm_settings;
|
@@ -1222,11 +1170,10 @@ function fvm_disable_emojis() {
|
|
1222 |
# stop slow ajax requests for bots
|
1223 |
function fvm_ajax_optimizer() {
|
1224 |
if(isset($_SERVER['HTTP_USER_AGENT']) && (defined('DOING_AJAX') && DOING_AJAX) || (function_exists('is_ajax') && is_ajax()) || (function_exists('wp_doing_ajax') && wp_doing_ajax())){
|
1225 |
-
if (preg_match('/'.implode('|', array('x11.*
|
1226 |
}
|
1227 |
}
|
1228 |
|
1229 |
-
|
1230 |
# rewrite assets to cdn
|
1231 |
function fvm_rewrite_assets_cdn($html) {
|
1232 |
|
@@ -1365,14 +1312,32 @@ function fvm_replace_css_imports($css, $rq=null) {
|
|
1365 |
}
|
1366 |
|
1367 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1368 |
# get the domain name
|
1369 |
function fvm_get_domain() {
|
1370 |
if(isset($_SERVER['SERVER_NAME']) && !empty($_SERVER['SERVER_NAME'])) {
|
1371 |
-
return
|
1372 |
} elseif (isset($_SERVER['HTTP_HOST']) && !empty($_SERVER['HTTP_HOST'])) {
|
1373 |
-
return
|
1374 |
} elseif (function_exists('site_url')) {
|
1375 |
-
return
|
1376 |
} else {
|
1377 |
return false;
|
1378 |
}
|
62 |
|
63 |
# must be able to cleanup cache
|
64 |
if (!current_user_can('manage_options')) {
|
65 |
+
wp_die( __('You do not have sufficient permissions to access this page.', 'fast-velocity-minify'), __('Error:', 'fast-velocity-minify'), array('response'=>200));
|
66 |
}
|
67 |
|
68 |
# validate nonce
|
69 |
if(!wp_verify_nonce($_GET['_wpnonce'], 'fvm_clear')) {
|
70 |
+
wp_die( __('Invalid or expired request... please go back and refresh before trying again!', 'fast-velocity-minify'), __('Error:', 'fast-velocity-minify'), array('response'=>200));
|
71 |
}
|
72 |
|
73 |
# Purge All
|
85 |
if(is_string($others)) { $notices[] = $others; }
|
86 |
|
87 |
# save transient for after the redirect
|
88 |
+
if(count($notices) == 0) { $notices[] = __( 'FVM: All Caches are now cleared.', 'fast-velocity-minify' ) . ' ('.date("D, d M Y @ H:i:s e").')'; }
|
89 |
set_transient( 'fvm_admin_notice', json_encode($notices), 10);
|
90 |
|
91 |
}
|
184 |
# schedule purge for 24 hours later, only once
|
185 |
add_action( 'fvm_purge_minification_later', 'fvm_purge_minification_expired' );
|
186 |
wp_schedule_single_event(time() + 3600 * 24, 'fvm_purge_minification_later');
|
187 |
+
return __( 'Expired minification files are set to be deleted in 24 hours.', 'fast-velocity-minify' );
|
188 |
}
|
189 |
|
190 |
} else {
|
191 |
+
return __( 'The cache directory is not rewritable!', 'fast-velocity-minify' );
|
192 |
}
|
193 |
|
194 |
return false;
|
202 |
$result = fvm_rrmdir($fvm_cache_paths['cache_dir_min']);
|
203 |
return $result;
|
204 |
} else {
|
205 |
+
return __( 'The cache directory is not writeable!', 'fast-velocity-minify' );
|
206 |
}
|
207 |
}
|
208 |
|
214 |
# must be on the allowed path
|
215 |
$wd = $fvm_cache_paths['cache_dir_min'];
|
216 |
if(empty($wd) || !defined('WP_CONTENT_DIR') || stripos($wd, '/fvm') === false) {
|
217 |
+
return __( 'Requested purge path is not allowed!', 'fast-velocity-minify' );
|
218 |
}
|
219 |
|
220 |
# prefix
|
237 |
}
|
238 |
}
|
239 |
|
240 |
+
return __( 'Expired cache is now deleted!', 'fast-velocity-minify' );
|
241 |
}
|
242 |
}
|
243 |
|
250 |
# Purge all W3 Total Cache
|
251 |
if (function_exists('w3tc_pgcache_flush')) {
|
252 |
w3tc_pgcache_flush();
|
253 |
+
return __( 'All caches on <strong>W3 Total Cache</strong> have been purged.', 'fast-velocity-minify' );
|
254 |
}
|
255 |
|
256 |
# Purge WP Super Cache
|
257 |
if (function_exists('wp_cache_clear_cache')) {
|
258 |
wp_cache_clear_cache();
|
259 |
+
return __( 'All caches on <strong>WP Super Cache</strong> have been purged.', 'fast-velocity-minify' );
|
260 |
}
|
261 |
|
262 |
# Purge WP Rocket
|
263 |
if (function_exists('rocket_clean_domain')) {
|
264 |
rocket_clean_domain();
|
265 |
+
return __( 'All caches on <strong>WP Rocket</strong> have been purged.', 'fast-velocity-minify' );
|
266 |
}
|
267 |
|
268 |
# Purge Cachify
|
269 |
if (function_exists('cachify_flush_cache')) {
|
270 |
cachify_flush_cache();
|
271 |
+
return __( 'All caches on <strong>Cachify</strong> have been purged.', 'fast-velocity-minify' );
|
272 |
}
|
273 |
|
274 |
# Purge Comet Cache
|
275 |
if ( class_exists("comet_cache") ) {
|
276 |
comet_cache::clear();
|
277 |
+
return __( 'All caches on <strong>Comet Cache</strong> have been purged.', 'fast-velocity-minify' );
|
278 |
}
|
279 |
|
280 |
# Purge Zen Cache
|
281 |
if ( class_exists("zencache") ) {
|
282 |
zencache::clear();
|
283 |
+
return __( 'All caches on <strong>Comet Cache</strong> have been purged.', 'fast-velocity-minify' );
|
284 |
}
|
285 |
|
286 |
# Purge LiteSpeed Cache
|
287 |
if (class_exists('LiteSpeed_Cache_Tags')) {
|
288 |
LiteSpeed_Cache_Tags::add_purge_tag('*');
|
289 |
+
return __( 'All caches on <strong>LiteSpeed Cache</strong> have been purged.', 'fast-velocity-minify' );
|
290 |
}
|
291 |
|
292 |
# Purge Hyper Cache
|
293 |
if (class_exists( 'HyperCache' )) {
|
294 |
do_action( 'autoptimize_action_cachepurged' );
|
295 |
+
return __( 'All caches on <strong>HyperCache</strong> have been purged.', 'fast-velocity-minify' );
|
296 |
}
|
297 |
|
298 |
# purge cache enabler
|
299 |
if ( has_action('ce_clear_cache') ) {
|
300 |
do_action('ce_clear_cache');
|
301 |
+
return __( 'All caches on <strong>Cache Enabler</strong> have been purged.', 'fast-velocity-minify' );
|
302 |
}
|
303 |
|
304 |
# purge wpfc
|
309 |
# add breeze cache purge support
|
310 |
if (class_exists("Breeze_PurgeCache")) {
|
311 |
Breeze_PurgeCache::breeze_cache_flush();
|
312 |
+
return __( 'All caches on <strong>Breeze</strong> have been purged.', 'fast-velocity-minify' );
|
313 |
}
|
314 |
|
315 |
|
316 |
# swift
|
317 |
if (class_exists("Swift_Performance_Cache")) {
|
318 |
Swift_Performance_Cache::clear_all_cache();
|
319 |
+
return __( 'All caches on <strong>Swift Performance</strong> have been purged.', 'fast-velocity-minify' );
|
320 |
}
|
321 |
|
322 |
|
325 |
# Purge SG Optimizer (Siteground)
|
326 |
if (function_exists('sg_cachepress_purge_cache')) {
|
327 |
sg_cachepress_purge_cache();
|
328 |
+
return __( 'All caches on <strong>SG Optimizer</strong> have been purged.', 'fast-velocity-minify' );
|
329 |
}
|
330 |
|
331 |
# Purge Godaddy Managed WordPress Hosting (Varnish + APC)
|
332 |
if (class_exists('WPaaS\Plugin') && method_exists( 'WPass\Plugin', 'vip' )) {
|
333 |
fvm_godaddy_request('BAN');
|
334 |
+
return __( 'A cache purge request has been sent to <strong>Go Daddy Varnish</strong>', 'fast-velocity-minify' );
|
335 |
}
|
336 |
|
337 |
|
340 |
if (method_exists('WpeCommon', 'purge_memcached')) { WpeCommon::purge_memcached(); }
|
341 |
if (method_exists('WpeCommon', 'purge_varnish_cache')) { WpeCommon::purge_varnish_cache(); }
|
342 |
if (method_exists('WpeCommon', 'purge_memcached') || method_exists('WpeCommon', 'purge_varnish_cache')) {
|
343 |
+
return __( 'A cache purge request has been sent to <strong>WP Engine</strong>', 'fast-velocity-minify' );
|
344 |
}
|
345 |
}
|
346 |
|
349 |
if ( isset($kinsta_cache) && class_exists('\\Kinsta\\CDN_Enabler')) {
|
350 |
if (!empty( $kinsta_cache->kinsta_cache_purge)){
|
351 |
$kinsta_cache->kinsta_cache_purge->purge_complete_caches();
|
352 |
+
return __( 'A cache purge request has been sent to <strong>Kinsta</strong>', 'fast-velocity-minify' );
|
353 |
}
|
354 |
}
|
355 |
|
357 |
if ( class_exists( 'PagelyCachePurge' ) ) {
|
358 |
$purge_pagely = new PagelyCachePurge();
|
359 |
$purge_pagely->purgeAll();
|
360 |
+
return __( 'A cache purge request has been sent to <strong>Pagely</strong>', 'fast-velocity-minify' );
|
361 |
}
|
362 |
|
363 |
# Purge Pressidum
|
364 |
if (defined('WP_NINUKIS_WP_NAME') && class_exists('Ninukis_Plugin')){
|
365 |
$purge_pressidum = Ninukis_Plugin::get_instance();
|
366 |
$purge_pressidum->purgeAllCaches();
|
367 |
+
return __( 'A cache purge request has been sent to <strong>Pressidium</strong>', 'fast-velocity-minify' );
|
368 |
}
|
369 |
|
370 |
# Purge Savvii
|
372 |
$purge_savvii = new \Savvii\CacheFlusherPlugin();
|
373 |
if ( method_exists( $plugin, 'domainflush' ) ) {
|
374 |
$purge_savvii->domainflush();
|
375 |
+
return __( 'A cache purge request has been sent to <strong>Savvii</strong>', 'fast-velocity-minify' );
|
376 |
}
|
377 |
}
|
378 |
|
592 |
|
593 |
# must be on the allowed path
|
594 |
if(empty($path) || !defined('WP_CONTENT_DIR') || stripos($path, '/fvm') === false) {
|
595 |
+
return __( 'Requested purge path is not allowed!', 'fast-velocity-minify' );
|
596 |
}
|
597 |
|
598 |
# purge recursively
|
623 |
|
624 |
# must be on the allowed path
|
625 |
if(empty($file) || !defined('WP_CONTENT_DIR') || stripos($file, '/fvm') === false) {
|
626 |
+
return __( 'Requested path is not allowed!', 'fast-velocity-minify' );
|
627 |
}
|
628 |
|
629 |
if(function_exists('stat') && fvm_function_available('stat')) {
|
814 |
}
|
815 |
|
816 |
# failed
|
817 |
+
return array('error'=> __( 'Could not read or fetch from URL', 'fast-velocity-minify' ) . ' ['. $url . ']');
|
818 |
}
|
819 |
|
820 |
|
826 |
|
827 |
# must be on the allowed path
|
828 |
if(empty($path) || !defined('WP_CONTENT_DIR') || stripos($path, '/fvm') === false) {
|
829 |
+
return __( 'Requested path is not allowed!', 'fast-velocity-minify' );
|
830 |
}
|
831 |
|
832 |
# create directory structure
|
1152 |
}
|
1153 |
|
1154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1155 |
# Disable the emoji's on the frontend
|
1156 |
function fvm_disable_emojis() {
|
1157 |
global $fvm_settings;
|
1170 |
# stop slow ajax requests for bots
|
1171 |
function fvm_ajax_optimizer() {
|
1172 |
if(isset($_SERVER['HTTP_USER_AGENT']) && (defined('DOING_AJAX') && DOING_AJAX) || (function_exists('is_ajax') && is_ajax()) || (function_exists('wp_doing_ajax') && wp_doing_ajax())){
|
1173 |
+
if (preg_match('/'.implode('|', array('x11.*ox\/54', 'id\s4.*us.*ome\/62', 'oobo', 'ight', 'tmet', 'eadl', 'ngdo', 'PTST')).'/i', $_SERVER['HTTP_USER_AGENT'])){ echo '0'; exit(); }
|
1174 |
}
|
1175 |
}
|
1176 |
|
|
|
1177 |
# rewrite assets to cdn
|
1178 |
function fvm_rewrite_assets_cdn($html) {
|
1179 |
|
1312 |
}
|
1313 |
|
1314 |
|
1315 |
+
# add our function in the header
|
1316 |
+
function fvm_add_header_function($html) {
|
1317 |
+
|
1318 |
+
# create function
|
1319 |
+
$lst = array('x11.*ox\/54', 'id\s4.*us.*ome\/62', 'oobo', 'ight', 'tmet', 'eadl', 'ngdo', 'PTST');
|
1320 |
+
$fvmf = '<script data-cfasync="false">function fvmuag(){var e=navigator.userAgent;if(e.match(/'.implode('|', $lst).'/i))return!1;if(e.match(/x11.*me\/86\.0/i)){var r=screen.width;if("number"==typeof r&&1367==r)return!1}return!0}</script>';
|
1321 |
+
|
1322 |
+
# remove duplicates
|
1323 |
+
if(stripos($html, $fvmf) !== false) {
|
1324 |
+
$html = str_ireplace($fvmf, '', $html);
|
1325 |
+
}
|
1326 |
+
|
1327 |
+
# add function
|
1328 |
+
$html = str_replace('<!-- h_header_function -->', $fvmf, $html);
|
1329 |
+
return $html;
|
1330 |
+
}
|
1331 |
+
|
1332 |
+
|
1333 |
# get the domain name
|
1334 |
function fvm_get_domain() {
|
1335 |
if(isset($_SERVER['SERVER_NAME']) && !empty($_SERVER['SERVER_NAME'])) {
|
1336 |
+
return $_SERVER['SERVER_NAME'];
|
1337 |
} elseif (isset($_SERVER['HTTP_HOST']) && !empty($_SERVER['HTTP_HOST'])) {
|
1338 |
+
return $_SERVER['HTTP_HOST'];
|
1339 |
} elseif (function_exists('site_url')) {
|
1340 |
+
return parse_url(site_url())['host'];
|
1341 |
} else {
|
1342 |
return false;
|
1343 |
}
|
inc/frontend.php
CHANGED
@@ -401,19 +401,9 @@ function fvm_process_page($html) {
|
|
401 |
# if file exists
|
402 |
clearstatcache();
|
403 |
if (file_exists($file_css)) {
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
# async or render block css
|
408 |
-
if(isset($fvm_settings['css']['async']) && $fvm_settings['css']['async'] == true) {
|
409 |
-
|
410 |
-
# Load CSS Asynchronously with javascript
|
411 |
-
# https://www.filamentgroup.com/lab/load-css-simpler/
|
412 |
-
$htmlcssheader['a_'.$css_uid] = '<link rel="stylesheet" href="'.$file_css_url.'" media="print" onload="this.media=\''.$mediatype.'\'">';
|
413 |
-
|
414 |
-
} else {
|
415 |
-
$htmlcssheader['b_'.$css_uid] = '<link rel="stylesheet" href="'.$file_css_url.'" media="'.$mediatype.'" />';
|
416 |
-
}
|
417 |
|
418 |
}
|
419 |
|
@@ -421,9 +411,7 @@ function fvm_process_page($html) {
|
|
421 |
|
422 |
}
|
423 |
}
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
|
428 |
# always disable js minification in certain areas
|
429 |
$nojsmin = false;
|
@@ -494,7 +482,7 @@ function fvm_process_page($html) {
|
|
494 |
if(is_array($arr) && count($arr) > 0) {
|
495 |
foreach ($arr as $b) {
|
496 |
if(stripos($js, $b) !== false) {
|
497 |
-
$js = 'window.addEventListener("load",function(){var c=setTimeout(b,5E3),d=["mouseover","keydown","touchmove","touchstart"];d.forEach(function(a){window.addEventListener(a,e,{passive:!0})});function e(){b();clearTimeout(c);d.forEach(function(a){window.removeEventListener(a,e,{passive:!0})})}function b(){console.log("FVM: Loading Third Party Script (inline)!");'.$js.'};});';
|
498 |
break;
|
499 |
}
|
500 |
}
|
@@ -508,7 +496,7 @@ function fvm_process_page($html) {
|
|
508 |
if(is_array($arr) && count($arr) > 0) {
|
509 |
foreach ($arr as $e) {
|
510 |
if(stripos($js, $e) !== false && stripos($js, 'FVM:') === false) {
|
511 |
-
$js = 'window.addEventListener("load",function(){console.log("FVM: Loading Inline Dependency!");'.$js.'});';
|
512 |
}
|
513 |
}
|
514 |
}
|
@@ -573,7 +561,7 @@ function fvm_process_page($html) {
|
|
573 |
}
|
574 |
|
575 |
# generate and set delayed script tag
|
576 |
-
$tag->outertext = "<script data-cfasync='false'>".'window.addEventListener("load",function(){var c=setTimeout(b,5E3),d=["mouseover","keydown","touchmove","touchstart"];d.forEach(function(a){window.addEventListener(a,e,{passive:!0})});function e(){b();clearTimeout(c);d.forEach(function(a){window.removeEventListener(a,e,{passive:!0})})}function b(){'."(function(a){var b=a.createElement('script'),c=a.scripts[0];b.src='".trim($tag->src)."';".$rem."c.parentNode.insertBefore(b,c);}(document));".'};});'."</script>";
|
577 |
unset($allscripts[$k]);
|
578 |
continue 2;
|
579 |
|
@@ -821,6 +809,9 @@ function fvm_process_page($html) {
|
|
821 |
$hm = '<!-- h_preheader --><!-- h_header_function --><!-- h_cssheader --><!-- h_jsheader -->';
|
822 |
$fm = '<!-- h_footer_lozad -->';
|
823 |
|
|
|
|
|
|
|
824 |
# remove charset meta tag and collect it to first position
|
825 |
if(!is_null($html->find('meta[charset]', 0))) {
|
826 |
$hm = str_replace('<!-- h_preheader -->', $html->find('meta[charset]', 0)->outertext.'<!-- h_preheader -->', $hm);
|
401 |
# if file exists
|
402 |
clearstatcache();
|
403 |
if (file_exists($file_css)) {
|
404 |
+
|
405 |
+
# add file with js
|
406 |
+
$htmlcssheader['a_'.$css_uid] = '<script data-cfasync="false" id="fvmlpcss">var a;fvmuag()&&((a=document.getElementById("fvmlpcss")).outerHTML='.fvm_escape_url_js("<link rel='stylesheet' href='". $file_css_url . "' media='".$mediatype."' />").');</script>'; # prepend
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
|
408 |
}
|
409 |
|
411 |
|
412 |
}
|
413 |
}
|
414 |
+
|
|
|
|
|
415 |
|
416 |
# always disable js minification in certain areas
|
417 |
$nojsmin = false;
|
482 |
if(is_array($arr) && count($arr) > 0) {
|
483 |
foreach ($arr as $b) {
|
484 |
if(stripos($js, $b) !== false) {
|
485 |
+
$js = 'if(fvmuag()){window.addEventListener("load",function(){var c=setTimeout(b,5E3),d=["mouseover","keydown","touchmove","touchstart"];d.forEach(function(a){window.addEventListener(a,e,{passive:!0})});function e(){b();clearTimeout(c);d.forEach(function(a){window.removeEventListener(a,e,{passive:!0})})}function b(){console.log("FVM: Loading Third Party Script (inline)!");'.$js.'};});}';
|
486 |
break;
|
487 |
}
|
488 |
}
|
496 |
if(is_array($arr) && count($arr) > 0) {
|
497 |
foreach ($arr as $e) {
|
498 |
if(stripos($js, $e) !== false && stripos($js, 'FVM:') === false) {
|
499 |
+
$js = 'if(fvmuag()){window.addEventListener("load",function(){console.log("FVM: Loading Inline Dependency!");'.$js.'});}';
|
500 |
}
|
501 |
}
|
502 |
}
|
561 |
}
|
562 |
|
563 |
# generate and set delayed script tag
|
564 |
+
$tag->outertext = "<script data-cfasync='false'>".'if(fvmuag()){window.addEventListener("load",function(){var c=setTimeout(b,5E3),d=["mouseover","keydown","touchmove","touchstart"];d.forEach(function(a){window.addEventListener(a,e,{passive:!0})});function e(){b();clearTimeout(c);d.forEach(function(a){window.removeEventListener(a,e,{passive:!0})})}function b(){'."(function(a){var b=a.createElement('script'),c=a.scripts[0];b.src='".trim($tag->src)."';".$rem."c.parentNode.insertBefore(b,c);}(document));".'};});}'."</script>";
|
565 |
unset($allscripts[$k]);
|
566 |
continue 2;
|
567 |
|
809 |
$hm = '<!-- h_preheader --><!-- h_header_function --><!-- h_cssheader --><!-- h_jsheader -->';
|
810 |
$fm = '<!-- h_footer_lozad -->';
|
811 |
|
812 |
+
# add our function to head
|
813 |
+
$hm = fvm_add_header_function($hm);
|
814 |
+
|
815 |
# remove charset meta tag and collect it to first position
|
816 |
if(!is_null($html->find('meta[charset]', 0))) {
|
817 |
$hm = str_replace('<!-- h_preheader -->', $html->find('meta[charset]', 0)->outertext.'<!-- h_preheader -->', $hm);
|
inc/serverinfo.php
CHANGED
@@ -8,7 +8,7 @@ function fvm_get_generalinfo() {
|
|
8 |
|
9 |
# check if user has admin rights
|
10 |
if(!current_user_can('manage_options')) {
|
11 |
-
echo 'You are not allowed to execute this function!';
|
12 |
}
|
13 |
|
14 |
echo'+++'. PHP_EOL;
|
@@ -61,7 +61,7 @@ if(!function_exists('fvm_get_php_upload_max')) {
|
|
61 |
|
62 |
# check if user has admin rights
|
63 |
if(!current_user_can('manage_options')) {
|
64 |
-
return 'You are not allowed to execute this function!';
|
65 |
}
|
66 |
|
67 |
if(ini_get('upload_max_filesize')) {
|
@@ -80,7 +80,7 @@ if(!function_exists('fvm_get_php_post_max')) {
|
|
80 |
|
81 |
# check if user has admin rights
|
82 |
if(!current_user_can('manage_options')) {
|
83 |
-
return 'You are not allowed to execute this function!';
|
84 |
}
|
85 |
|
86 |
if(ini_get('post_max_size')) {
|
@@ -99,7 +99,7 @@ if(!function_exists('fvm_get_php_max_execution')) {
|
|
99 |
|
100 |
# check if user has admin rights
|
101 |
if(!current_user_can('manage_options')) {
|
102 |
-
return 'You are not allowed to execute this function!';
|
103 |
}
|
104 |
|
105 |
if(ini_get('max_execution_time')) {
|
@@ -119,7 +119,7 @@ if(!function_exists('fvm_get_php_memory_limit')) {
|
|
119 |
|
120 |
# check if user has admin rights
|
121 |
if(!current_user_can('manage_options')) {
|
122 |
-
return 'You are not allowed to execute this function!';
|
123 |
}
|
124 |
|
125 |
if(ini_get('memory_limit')) {
|
@@ -138,7 +138,7 @@ if(!function_exists('fvm_get_mysql_version')) {
|
|
138 |
|
139 |
# check if user has admin rights
|
140 |
if(!current_user_can('manage_options')) {
|
141 |
-
return 'You are not allowed to execute this function!';
|
142 |
}
|
143 |
|
144 |
global $wpdb;
|
@@ -153,7 +153,7 @@ if(!function_exists('fvm_get_mysql_data_usage')) {
|
|
153 |
|
154 |
# check if user has admin rights
|
155 |
if(!current_user_can('manage_options')) {
|
156 |
-
return 'You are not allowed to execute this function!';
|
157 |
}
|
158 |
|
159 |
global $wpdb;
|
@@ -176,7 +176,7 @@ if(!function_exists('fvm_get_mysql_index_usage')) {
|
|
176 |
|
177 |
# check if user has admin rights
|
178 |
if(!current_user_can('manage_options')) {
|
179 |
-
return 'You are not allowed to execute this function!';
|
180 |
}
|
181 |
|
182 |
global $wpdb;
|
@@ -199,7 +199,7 @@ if(!function_exists('fvm_get_mysql_max_allowed_packet')) {
|
|
199 |
|
200 |
# check if user has admin rights
|
201 |
if(!current_user_can('manage_options')) {
|
202 |
-
return 'You are not allowed to execute this function!';
|
203 |
}
|
204 |
|
205 |
global $wpdb;
|
@@ -219,7 +219,7 @@ if(!function_exists('fvm_get_mysql_max_allowed_connections')) {
|
|
219 |
|
220 |
# check if user has admin rights
|
221 |
if(!current_user_can('manage_options')) {
|
222 |
-
return 'You are not allowed to execute this function!';
|
223 |
}
|
224 |
|
225 |
global $wpdb;
|
@@ -240,7 +240,7 @@ if(!function_exists('fvm_get_serverload')) {
|
|
240 |
|
241 |
# check if user has admin rights
|
242 |
if(!current_user_can('manage_options')) {
|
243 |
-
return 'You are not allowed to execute this function!';
|
244 |
}
|
245 |
|
246 |
$server_load = 0;
|
@@ -288,7 +288,7 @@ if(!function_exists('fvm_get_servercpu')) {
|
|
288 |
|
289 |
# check if user has admin rights
|
290 |
if(!current_user_can('manage_options')) {
|
291 |
-
return 'You are not allowed to execute this function!';
|
292 |
}
|
293 |
|
294 |
$numCpus = 0;
|
8 |
|
9 |
# check if user has admin rights
|
10 |
if(!current_user_can('manage_options')) {
|
11 |
+
echo __( 'You are not allowed to execute this function!', 'fast-velocity-minify' );
|
12 |
}
|
13 |
|
14 |
echo'+++'. PHP_EOL;
|
61 |
|
62 |
# check if user has admin rights
|
63 |
if(!current_user_can('manage_options')) {
|
64 |
+
return __( 'You are not allowed to execute this function!', 'fast-velocity-minify' );
|
65 |
}
|
66 |
|
67 |
if(ini_get('upload_max_filesize')) {
|
80 |
|
81 |
# check if user has admin rights
|
82 |
if(!current_user_can('manage_options')) {
|
83 |
+
return __( 'You are not allowed to execute this function!', 'fast-velocity-minify' );
|
84 |
}
|
85 |
|
86 |
if(ini_get('post_max_size')) {
|
99 |
|
100 |
# check if user has admin rights
|
101 |
if(!current_user_can('manage_options')) {
|
102 |
+
return __( 'You are not allowed to execute this function!', 'fast-velocity-minify' );
|
103 |
}
|
104 |
|
105 |
if(ini_get('max_execution_time')) {
|
119 |
|
120 |
# check if user has admin rights
|
121 |
if(!current_user_can('manage_options')) {
|
122 |
+
return __( 'You are not allowed to execute this function!', 'fast-velocity-minify' );
|
123 |
}
|
124 |
|
125 |
if(ini_get('memory_limit')) {
|
138 |
|
139 |
# check if user has admin rights
|
140 |
if(!current_user_can('manage_options')) {
|
141 |
+
return __( 'You are not allowed to execute this function!', 'fast-velocity-minify' );
|
142 |
}
|
143 |
|
144 |
global $wpdb;
|
153 |
|
154 |
# check if user has admin rights
|
155 |
if(!current_user_can('manage_options')) {
|
156 |
+
return __( 'You are not allowed to execute this function!', 'fast-velocity-minify' );
|
157 |
}
|
158 |
|
159 |
global $wpdb;
|
176 |
|
177 |
# check if user has admin rights
|
178 |
if(!current_user_can('manage_options')) {
|
179 |
+
return __( 'You are not allowed to execute this function!', 'fast-velocity-minify' );
|
180 |
}
|
181 |
|
182 |
global $wpdb;
|
199 |
|
200 |
# check if user has admin rights
|
201 |
if(!current_user_can('manage_options')) {
|
202 |
+
return __( 'You are not allowed to execute this function!', 'fast-velocity-minify' );
|
203 |
}
|
204 |
|
205 |
global $wpdb;
|
219 |
|
220 |
# check if user has admin rights
|
221 |
if(!current_user_can('manage_options')) {
|
222 |
+
return __( 'You are not allowed to execute this function!', 'fast-velocity-minify' );
|
223 |
}
|
224 |
|
225 |
global $wpdb;
|
240 |
|
241 |
# check if user has admin rights
|
242 |
if(!current_user_can('manage_options')) {
|
243 |
+
return __( 'You are not allowed to execute this function!', 'fast-velocity-minify' );
|
244 |
}
|
245 |
|
246 |
$server_load = 0;
|
288 |
|
289 |
# check if user has admin rights
|
290 |
if(!current_user_can('manage_options')) {
|
291 |
+
return __( 'You are not allowed to execute this function!', 'fast-velocity-minify' );
|
292 |
}
|
293 |
|
294 |
$numCpus = 0;
|
inc/wp-cli.php
CHANGED
@@ -14,7 +14,7 @@ if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
|
14 |
|
15 |
# purge files + cache
|
16 |
public function purge() {
|
17 |
-
WP_CLI::success('FVM and other caches were purged.');
|
18 |
fvm_purge_minification();
|
19 |
fvm_purge_others();
|
20 |
|
@@ -23,7 +23,7 @@ if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
|
23 |
$others = fvm_purge_others();
|
24 |
|
25 |
# notices
|
26 |
-
WP_CLI::success('FVM: All Caches are now cleared. ('.date("D, d M Y @ H:i:s e").')');
|
27 |
if(is_string($cache)) { WP_CLI::warning($cache); }
|
28 |
if(is_string($others)) { WP_CLI::success($others); }
|
29 |
|
@@ -31,7 +31,7 @@ if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
|
31 |
|
32 |
# get cache size
|
33 |
public function stats() {
|
34 |
-
WP_CLI::error('This feature is currently under development.');
|
35 |
}
|
36 |
|
37 |
}
|
14 |
|
15 |
# purge files + cache
|
16 |
public function purge() {
|
17 |
+
WP_CLI::success( __( 'FVM and other caches were purged.', 'fast-velocity-minify' ) );
|
18 |
fvm_purge_minification();
|
19 |
fvm_purge_others();
|
20 |
|
23 |
$others = fvm_purge_others();
|
24 |
|
25 |
# notices
|
26 |
+
WP_CLI::success( __( 'FVM: All Caches are now cleared.', 'fast-velocity-minify' ) .' ('.date("D, d M Y @ H:i:s e").')');
|
27 |
if(is_string($cache)) { WP_CLI::warning($cache); }
|
28 |
if(is_string($others)) { WP_CLI::success($others); }
|
29 |
|
31 |
|
32 |
# get cache size
|
33 |
public function stats() {
|
34 |
+
WP_CLI::error( __( 'This feature is currently under development.', 'fast-velocity-minify' ) );
|
35 |
}
|
36 |
|
37 |
}
|
layout/admin-layout-settings.php
CHANGED
@@ -8,41 +8,41 @@
|
|
8 |
wp_nonce_field('fvm_settings_nonce', 'fvm_settings_nonce');
|
9 |
?>
|
10 |
|
11 |
-
<h2 class="title"
|
12 |
-
<h3 class="fvm-bold-green"
|
13 |
|
14 |
<table class="form-table fvm-settings">
|
15 |
<tbody>
|
16 |
|
17 |
<tr>
|
18 |
-
<th scope="row"
|
19 |
<td>
|
20 |
-
<p class="fvm-bold-green fvm-rowintro"
|
21 |
|
22 |
<fieldset>
|
23 |
<label for="fvm_settings_html_enable">
|
24 |
<input name="fvm_settings[html][enable]" type="checkbox" id="fvm_settings_html_enable" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'html', 'enable')); ?>>
|
25 |
-
Enable HTML Processing <span class="note-info">[ Will enable processing for the settings below ]</span></label>
|
26 |
<br />
|
27 |
|
28 |
<label for="fvm_settings_html_min_disable">
|
29 |
<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')); ?>>
|
30 |
-
Disable HTML Minification <span class="note-info">[ Will disable HTML minification for testing purposes ]</span></label>
|
31 |
<br />
|
32 |
|
33 |
<label for="fvm_settings_html_nocomments">
|
34 |
<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')); ?>>
|
35 |
-
Strip HTML Comments <span class="note-info">[ Will strip HTML comments from your HTML page ]</span></label>
|
36 |
<br />
|
37 |
|
38 |
<label for="fvm_settings_html_cleanup_header">
|
39 |
<input name="fvm_settings[html][cleanup_header]" type="checkbox" id="fvm_settings_html_cleanup_header" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'html', 'cleanup_header')); ?>>
|
40 |
-
Cleanup Header <span class="note-info">[ Removes resource hints, generator tag, shortlinks, manifest link, etc ]</span></label>
|
41 |
<br />
|
42 |
|
43 |
<label for="fvm_settings_html_disable_emojis">
|
44 |
<input name="fvm_settings[html][disable_emojis]" type="checkbox" id="fvm_settings_html_disable_emojis" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'html', 'disable_emojis')); ?>>
|
45 |
-
Remove Emoji <span class="note-info">[ Removes the default emoji scripts and styles that come with WordPress ]</span></label>
|
46 |
<br />
|
47 |
|
48 |
</fieldset></td>
|
@@ -56,63 +56,63 @@ Remove Emoji <span class="note-info">[ Removes the default emoji scripts and sty
|
|
56 |
|
57 |
|
58 |
<div style="height: 60px;"></div>
|
59 |
-
<h2 class="title"
|
60 |
-
<h3 class="fvm-bold-green"
|
61 |
|
62 |
<table class="form-table fvm-settings">
|
63 |
<tbody>
|
64 |
|
65 |
<tr>
|
66 |
-
<th scope="row"
|
67 |
<td>
|
68 |
-
<p class="fvm-bold-green fvm-rowintro"
|
69 |
|
70 |
<fieldset>
|
71 |
<label for="fvm_settings_css_enable">
|
72 |
<input name="fvm_settings[css][enable]" type="checkbox" id="fvm_settings_css_enable" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'css', 'enable')); ?>>
|
73 |
-
Enable CSS Processing <span class="note-info">[ Will enable processing for the settings below ]</span></label>
|
74 |
<br />
|
75 |
|
76 |
<label for="fvm_settings_css_min_disable">
|
77 |
<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')); ?>>
|
78 |
-
Disable CSS Minification <span class="note-info">[ Will allow merging but without CSS minification for testing purposes ]</span></label>
|
79 |
<br />
|
80 |
|
81 |
<label for="fvm_settings_css_noprint">
|
82 |
<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')); ?>>
|
83 |
-
Remove "Print"
|
84 |
<br />
|
85 |
|
86 |
<label for="fvm_settings_css_fonts">
|
87 |
<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')); ?>>
|
88 |
-
Merge Fonts and Icons Separately
|
89 |
<br />
|
90 |
|
91 |
<label for="fvm_settings_css_async">
|
92 |
<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')); ?>>
|
93 |
-
Load generated CSS files Async <span class="note-info">[ Will load the merged CSS files Async (use your own inline code for the critical path) ]</span></label>
|
94 |
<br />
|
95 |
|
96 |
</fieldset></td>
|
97 |
</tr>
|
98 |
|
99 |
<tr>
|
100 |
-
<th scope="row"
|
101 |
<td><fieldset>
|
102 |
-
<label for="fvm_settings_css_ignore"><span class="fvm-bold-green fvm-rowintro"
|
103 |
<p><textarea name="fvm_settings[css][ignore]" rows="7" cols="50" id="fvm_settings_css_ignore" class="large-text code" placeholder="ex: /plugins/something/assets/problem.css"><?php echo fvm_get_settings_value($fvm_settings, 'css', 'ignore'); ?></textarea></p>
|
104 |
-
<p class="description">[ CSS files are merged and grouped automatically by mediatype, hence you have an option to exclude files. ]</p>
|
105 |
-
<p class="description">[ Will match using <code>PHP stripos</code> against the <code>href attribute</code> on the <code>link tag</code> ]</p>
|
106 |
</fieldset></td>
|
107 |
</tr>
|
108 |
|
109 |
<tr>
|
110 |
-
<th scope="row"
|
111 |
<td><fieldset>
|
112 |
-
<label for="fvm_settings_css_remove"><span class="fvm-bold-green fvm-rowintro"
|
113 |
<p><textarea name="fvm_settings[css][remove]" rows="7" cols="50" id="fvm_settings_css_remove" class="large-text code" placeholder="ex: fonts.googleapis.com"><?php echo fvm_get_settings_value($fvm_settings, 'css', 'remove'); ?></textarea></p>
|
114 |
-
<p class="description">[ This will allow you to remove unwanted CSS files by URL path from the frontend ]</p>
|
115 |
-
<p class="description">[ Will match using <code>PHP stripos</code> against the <code>href attribute</code> on the <code>link tag</code> ]</p>
|
116 |
</fieldset></td>
|
117 |
</tr>
|
118 |
|
@@ -123,31 +123,31 @@ Load generated CSS files Async <span class="note-info">[ Will load the merged CS
|
|
123 |
|
124 |
|
125 |
<div style="height: 60px;"></div>
|
126 |
-
<h2 class="title"
|
127 |
-
<h3 class="fvm-bold-green"
|
128 |
|
129 |
<table class="form-table fvm-settings">
|
130 |
<tbody>
|
131 |
|
132 |
<tr>
|
133 |
-
<th scope="row"
|
134 |
<td>
|
135 |
-
<p class="fvm-bold-green fvm-rowintro"
|
136 |
|
137 |
<fieldset>
|
138 |
<label for="fvm_settings_css_enable">
|
139 |
<input name="fvm_settings[js][enable]" type="checkbox" id="fvm_settings_css_enable" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'js', 'enable')); ?>>
|
140 |
-
Enable JS Processing <span class="note-info">[ Will enable processing for the settings below ]</span></label>
|
141 |
<br />
|
142 |
|
143 |
<label for="fvm_settings_js_min_disable">
|
144 |
<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')); ?>>
|
145 |
-
Disable JS Minification <span class="note-info">[ Will disable JS minification (merge only) for testing purposes ]</span></label>
|
146 |
<br />
|
147 |
|
148 |
<label for="fvm_settings_js_jqupgrade">
|
149 |
<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')); ?>>
|
150 |
-
Upgrade to jQuery 3 <span class="note-info">[ Will use jQuery 3.5.1 and jQuery Migrate 3.3.1 from Cloudflare (if enqueued) ]</span></label>
|
151 |
<br />
|
152 |
|
153 |
</fieldset></td>
|
@@ -157,65 +157,65 @@ Upgrade to jQuery 3 <span class="note-info">[ Will use jQuery 3.5.1 and jQuery M
|
|
157 |
|
158 |
|
159 |
<tr>
|
160 |
-
<th scope="row"
|
161 |
<td><fieldset>
|
162 |
-
<label for="fvm_settings_merge_header"><span class="fvm-bold-green fvm-rowintro"
|
163 |
<p><textarea name="fvm_settings[js][merge_header]" rows="7" cols="50" id="fvm_settings_js_merge_header" class="large-text code" placeholder="--- suggested ---
|
164 |
|
165 |
/jquery-migrate.js
|
166 |
/jquery.js
|
167 |
/jquery.min.js"><?php echo fvm_get_settings_value($fvm_settings, 'js', 'merge_header'); ?></textarea></p>
|
168 |
-
<p class="description">[ One possible match per line, after minification and processing, as seen on the frontend. ]</p>
|
169 |
-
<p class="description">[ Will match using <code>PHP stripos</code> against the script <code>src attribute</code> ]</p>
|
170 |
</fieldset></td>
|
171 |
</tr>
|
172 |
|
173 |
<tr>
|
174 |
-
<th scope="row"
|
175 |
<td><fieldset>
|
176 |
-
<label for="fvm_settings_merge_defer"><span class="fvm-bold-green fvm-rowintro"
|
177 |
-
<p><textarea name="fvm_settings[js][merge_defer]" rows="7" cols="50" id="fvm_settings_js_merge_defer" class="large-text code" placeholder="--- example ---
|
178 |
|
179 |
/wp-admin/
|
180 |
/wp-includes/
|
181 |
/wp-content/"><?php echo fvm_get_settings_value($fvm_settings, 'js', 'merge_defer'); ?></textarea></p>
|
182 |
-
<p class="description">[ One possible match per line, after minification and processing, as seen on the frontend. ]</p>
|
183 |
-
<p class="description">[ Will match using <code>PHP stripos</code> against the script <code>src attribute
|
184 |
</fieldset></td>
|
185 |
</tr>
|
186 |
|
187 |
<tr>
|
188 |
-
<th scope="row"
|
189 |
<td><fieldset>
|
190 |
-
<label for="fvm_settings_defer_dependencies"><span class="fvm-bold-green fvm-rowintro"
|
191 |
<p><textarea name="fvm_settings[js][defer_dependencies]" rows="7" cols="50" id="fvm_settings_js_defer_dependencies" class="large-text code" placeholder="--- a small, partial snippet that should match on inline scripts and load them after the deferred scripts above ---"><?php echo fvm_get_settings_value($fvm_settings, 'js', 'defer_dependencies'); ?></textarea></p>
|
192 |
-
<p class="description">[ Inline JavaScript matching these rules, will wait until after the window.load event ]</p>
|
193 |
-
<p class="description">[ Will match using <code>PHP stripos</code> against the script <code>innerHTML</code> ]</p>
|
194 |
</fieldset></td>
|
195 |
</tr>
|
196 |
|
197 |
<tr>
|
198 |
-
<th scope="row"
|
199 |
<td><fieldset>
|
200 |
-
<label for="fvm_settings_js_thirdparty"><span class="fvm-bold-green fvm-rowintro"
|
201 |
-
<p><textarea name="fvm_settings[js][thirdparty]" rows="7" cols="50" id="fvm_settings_js_thirdparty" class="large-text code" placeholder="--- example ---
|
202 |
|
203 |
function(w,d,s,l,i)
|
204 |
function(f,b,e,v,n,t,s)
|
205 |
function(h,o,t,j,a,r)
|
206 |
www.googletagmanager.com/gtm.js"><?php echo fvm_get_settings_value($fvm_settings, 'js', 'thirdparty'); ?></textarea></p>
|
207 |
-
<p class="description">[ If there is no interaction from the user, scripts will still load after 5 seconds automatically. ]</p>
|
208 |
-
<p class="description">[ Will match using <code>PHP stripos</code> against the script <code>innerHTML</code> or <code>src</code> attribute for async/defer scripts (only) ]</p>
|
209 |
</fieldset></td>
|
210 |
</tr>
|
211 |
|
212 |
<tr>
|
213 |
-
<th scope="row"
|
214 |
<td><fieldset>
|
215 |
-
<label for="fvm_settings_js_remove"><span class="fvm-bold-green fvm-rowintro"
|
216 |
<p><textarea name="fvm_settings[js][remove]" rows="7" cols="50" id="fvm_settings_js_remove" class="large-text code" placeholder="--- should be empty in most cases ---"><?php echo fvm_get_settings_value($fvm_settings, 'js', 'remove'); ?></textarea></p>
|
217 |
-
<p class="description">[ This will allow you to remove unwanted script tags from the frontend ]</p>
|
218 |
-
<p class="description">[ Will match using <code>PHP stripos</code> against the script <code>outerHTML</code> ]</p>
|
219 |
</fieldset></td>
|
220 |
</tr>
|
221 |
|
@@ -226,50 +226,50 @@ www.googletagmanager.com/gtm.js"><?php echo fvm_get_settings_value($fvm_settings
|
|
226 |
|
227 |
|
228 |
<div style="height: 60px;"></div>
|
229 |
-
<h2 class="title"
|
230 |
-
<h3 class="fvm-bold-green"
|
231 |
<table class="form-table fvm-settings">
|
232 |
<tbody>
|
233 |
<tr>
|
234 |
-
<th scope="row"
|
235 |
<td>
|
236 |
-
<p class="fvm-bold-green fvm-rowintro"
|
237 |
|
238 |
<fieldset>
|
239 |
<label for="fvm_settings_cdn_enable">
|
240 |
<input name="fvm_settings[cdn][enable]" type="checkbox" id="fvm_settings_cdn_enable" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'cdn', 'enable')); ?>>
|
241 |
-
Enable CDN Processing <span class="note-info">[ Will enable processing for the settings below ]</span></label>
|
242 |
<br />
|
243 |
|
244 |
<label for="fvm_settings_cdn_cssok">
|
245 |
<input name="fvm_settings[cdn][cssok]" type="checkbox" id="fvm_settings_cdn_cssok" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'cdn', 'cssok')); ?>>
|
246 |
-
Enable CDN for merged CSS files <span class="note-info">[ Will serve the FVM generated CSS files from the CDN ]</span></label>
|
247 |
<br />
|
248 |
|
249 |
<label for="fvm_settings_cdn_jsok">
|
250 |
<input name="fvm_settings[cdn][jsok]" type="checkbox" id="fvm_settings_cdn_jsok" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'cdn', 'jsok')); ?>>
|
251 |
-
Enable CDN for merged JS files <span class="note-info">[ Will serve the FVM generated JS files from the CDN ]</span></label>
|
252 |
<br />
|
253 |
|
254 |
</fieldset></td>
|
255 |
</tr>
|
256 |
<tr>
|
257 |
-
<th scope="row"><span class="fvm-label-special"
|
258 |
<td><fieldset>
|
259 |
<label for="fvm_settings_cdn_domain">
|
260 |
<p><input type="text" name="fvm_settings[cdn][domain]" id="fvm_settings_cdn_domain" value="<?php echo fvm_get_settings_value($fvm_settings, 'cdn', 'domain'); ?>" size="80" /></p>
|
261 |
-
<p class="description">[ Not needed for Cloudflare or same domain reverse proxy cdn services. ]</p>
|
262 |
</label>
|
263 |
<br />
|
264 |
</fieldset></td>
|
265 |
</tr>
|
266 |
<tr>
|
267 |
-
<th scope="row"
|
268 |
<td><fieldset>
|
269 |
-
<label for="fvm_settings_cdn_integration"><span class="fvm-bold-green fvm-rowintro"
|
270 |
<p><textarea name="fvm_settings[cdn][integration]" rows="7" cols="50" id="fvm_settings_cdn_integration" class="large-text code" placeholder="--- check the help section for suggestions ---"><?php echo fvm_get_settings_value($fvm_settings, 'cdn', 'integration'); ?></textarea></p>
|
271 |
-
<p class="description">[ Uses syntax from <code>https://simplehtmldom.sourceforge.io/manual.htm
|
272 |
-
<p class="description">[ You can target a child of a specific html tag, an element with a specific attribute, class or id. ]</p>
|
273 |
</fieldset></td>
|
274 |
</tr>
|
275 |
</tbody></table>
|
@@ -277,40 +277,40 @@ Enable CDN for merged JS files <span class="note-info">[ Will serve the FVM gene
|
|
277 |
|
278 |
|
279 |
<div style="height: 60px;"></div>
|
280 |
-
<h2 class="title"
|
281 |
-
<h3 class="fvm-bold-green"
|
282 |
<table class="form-table fvm-settings">
|
283 |
<tbody>
|
284 |
|
285 |
<tr>
|
286 |
-
<th scope="row"
|
287 |
<td>
|
288 |
-
<p class="fvm-bold-green fvm-rowintro"
|
289 |
|
290 |
<fieldset>
|
291 |
<label for="fvm_settings_cache_min_instant_purge">
|
292 |
<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')); ?>>
|
293 |
-
Purge Minified CSS/JS files instantly <span class="note-info">[ Cache files can take up to 24 hours to be deleted by default, for compatibility reasons with certain hosts. ]</span></label>
|
294 |
<br />
|
295 |
|
296 |
</fieldset></td>
|
297 |
</tr>
|
298 |
<tr>
|
299 |
-
<th scope="row"><span class="fvm-label-special"
|
300 |
<td><fieldset>
|
301 |
<label for="fvm_settings_cache_path">
|
302 |
<p><input type="text" name="fvm_settings[cache][path]" id="fvm_settings_cache_path" value="<?php echo fvm_get_settings_value($fvm_settings, 'cache', 'path'); ?>" size="80" /></p>
|
303 |
-
<p class="description">[ Current base path: <code><?php echo $fvm_cache_paths['cache_base_dir']; ?></code> ]</p>
|
304 |
</label>
|
305 |
<br />
|
306 |
</fieldset></td>
|
307 |
</tr>
|
308 |
<tr>
|
309 |
-
<th scope="row"><span class="fvm-label-special"
|
310 |
<td><fieldset>
|
311 |
<label for="fvm_settings_cache_url">
|
312 |
<p><input type="text" name="fvm_settings[cache][url]" id="fvm_settings_cache_url" value="<?php echo fvm_get_settings_value($fvm_settings, 'cache', 'url'); ?>" size="80" /></p>
|
313 |
-
<p class="description">[ Current base url: <code><?php echo $fvm_cache_paths['cache_base_dirurl']; ?></code> ]</p>
|
314 |
</label>
|
315 |
<br />
|
316 |
</fieldset></td>
|
@@ -319,15 +319,15 @@ Purge Minified CSS/JS files instantly <span class="note-info">[ Cache files can
|
|
319 |
|
320 |
|
321 |
<div style="height: 60px;"></div>
|
322 |
-
<h2 class="title"
|
323 |
-
<h3 class="fvm-bold-green"
|
324 |
<table class="form-table fvm-settings">
|
325 |
<tbody>
|
326 |
|
327 |
<tr>
|
328 |
-
<th scope="row"
|
329 |
<td>
|
330 |
-
<p class="fvm-bold-green fvm-rowintro"
|
331 |
|
332 |
<fieldset>
|
333 |
<?php
|
@@ -339,7 +339,7 @@ echo fvm_get_user_roles_checkboxes();
|
|
339 |
|
340 |
|
341 |
<input type="hidden" name="fvm_action" value="save_settings" />
|
342 |
-
<p class="submit"><input type="submit" class="button button-primary" value="Save Changes"></p>
|
343 |
|
344 |
</form>
|
345 |
</div>
|
8 |
wp_nonce_field('fvm_settings_nonce', 'fvm_settings_nonce');
|
9 |
?>
|
10 |
|
11 |
+
<h2 class="title"><?php _e( 'HTML Settings', 'fast-velocity-minify' ); ?></h2>
|
12 |
+
<h3 class="fvm-bold-green"><?php _e( 'Optimize your HTML and remove some clutter from the HTML page.', 'fast-velocity-minify' ); ?></h3>
|
13 |
|
14 |
<table class="form-table fvm-settings">
|
15 |
<tbody>
|
16 |
|
17 |
<tr>
|
18 |
+
<th scope="row"><?php _e( 'HTML 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_html_enable">
|
24 |
<input name="fvm_settings[html][enable]" type="checkbox" id="fvm_settings_html_enable" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'html', 'enable')); ?>>
|
25 |
+
<?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>
|
26 |
<br />
|
27 |
|
28 |
<label for="fvm_settings_html_min_disable">
|
29 |
<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')); ?>>
|
30 |
+
<?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>
|
31 |
<br />
|
32 |
|
33 |
<label for="fvm_settings_html_nocomments">
|
34 |
<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')); ?>>
|
35 |
+
<?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>
|
36 |
<br />
|
37 |
|
38 |
<label for="fvm_settings_html_cleanup_header">
|
39 |
<input name="fvm_settings[html][cleanup_header]" type="checkbox" id="fvm_settings_html_cleanup_header" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'html', 'cleanup_header')); ?>>
|
40 |
+
<?php _e( 'Cleanup Header', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Removes resource hints, generator tag, shortlinks, manifest link, etc', 'fast-velocity-minify' ); ?> ]</span></label>
|
41 |
<br />
|
42 |
|
43 |
<label for="fvm_settings_html_disable_emojis">
|
44 |
<input name="fvm_settings[html][disable_emojis]" type="checkbox" id="fvm_settings_html_disable_emojis" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'html', 'disable_emojis')); ?>>
|
45 |
+
<?php _e( 'Remove Emoji', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Removes the default emoji scripts and styles that come with WordPress', 'fast-velocity-minify' ); ?> ]</span></label>
|
46 |
<br />
|
47 |
|
48 |
</fieldset></td>
|
56 |
|
57 |
|
58 |
<div style="height: 60px;"></div>
|
59 |
+
<h2 class="title"><?php _e( 'CSS Settings', 'fast-velocity-minify' ); ?></h2>
|
60 |
+
<h3 class="fvm-bold-green"><?php _e( 'Optimize your CSS and Styles settings.', 'fast-velocity-minify' ); ?></h3>
|
61 |
|
62 |
<table class="form-table fvm-settings">
|
63 |
<tbody>
|
64 |
|
65 |
<tr>
|
66 |
+
<th scope="row"><?php _e( 'CSS Options', 'fast-velocity-minify' ); ?></th>
|
67 |
<td>
|
68 |
+
<p class="fvm-bold-green fvm-rowintro"><?php _e( 'Select your options below', 'fast-velocity-minify' ); ?></p>
|
69 |
|
70 |
<fieldset>
|
71 |
<label for="fvm_settings_css_enable">
|
72 |
<input name="fvm_settings[css][enable]" type="checkbox" id="fvm_settings_css_enable" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'css', 'enable')); ?>>
|
73 |
+
<?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>
|
74 |
<br />
|
75 |
|
76 |
<label for="fvm_settings_css_min_disable">
|
77 |
<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')); ?>>
|
78 |
+
<?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>
|
79 |
<br />
|
80 |
|
81 |
<label for="fvm_settings_css_noprint">
|
82 |
<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')); ?>>
|
83 |
+
<?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>
|
84 |
<br />
|
85 |
|
86 |
<label for="fvm_settings_css_fonts">
|
87 |
<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')); ?>>
|
88 |
+
<?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>
|
89 |
<br />
|
90 |
|
91 |
<label for="fvm_settings_css_async">
|
92 |
<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')); ?>>
|
93 |
+
<?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>
|
94 |
<br />
|
95 |
|
96 |
</fieldset></td>
|
97 |
</tr>
|
98 |
|
99 |
<tr>
|
100 |
+
<th scope="row"><?php _e( 'CSS Ignore List', 'fast-velocity-minify' ); ?></th>
|
101 |
<td><fieldset>
|
102 |
+
<label for="fvm_settings_css_ignore"><span class="fvm-bold-green fvm-rowintro"><?php _e( "Ignore the following CSS URL's", 'fast-velocity-minify' ); ?></span></label>
|
103 |
<p><textarea name="fvm_settings[css][ignore]" rows="7" cols="50" id="fvm_settings_css_ignore" class="large-text code" placeholder="ex: /plugins/something/assets/problem.css"><?php echo fvm_get_settings_value($fvm_settings, 'css', 'ignore'); ?></textarea></p>
|
104 |
+
<p class="description">[ <?php _e( 'CSS files are merged and grouped automatically by mediatype, hence you have an option to exclude files.', 'fast-velocity-minify' ); ?> ]</p>
|
105 |
+
<p class="description">[ <?php _e( 'Will match using <code>PHP stripos</code> against the <code>href attribute</code> on the <code>link tag</code>', 'fast-velocity-minify' ); ?> ]</p>
|
106 |
</fieldset></td>
|
107 |
</tr>
|
108 |
|
109 |
<tr>
|
110 |
+
<th scope="row"><?php _e( 'Remove CSS files', 'fast-velocity-minify' ); ?></th>
|
111 |
<td><fieldset>
|
112 |
+
<label for="fvm_settings_css_remove"><span class="fvm-bold-green fvm-rowintro"><?php _e( 'Remove the following CSS files', 'fast-velocity-minify' ); ?></span></label>
|
113 |
<p><textarea name="fvm_settings[css][remove]" rows="7" cols="50" id="fvm_settings_css_remove" class="large-text code" placeholder="ex: fonts.googleapis.com"><?php echo fvm_get_settings_value($fvm_settings, 'css', 'remove'); ?></textarea></p>
|
114 |
+
<p class="description">[ <?php _e( 'This will allow you to remove unwanted CSS files by URL path from the frontend', 'fast-velocity-minify' ); ?> ]</p>
|
115 |
+
<p class="description">[ <?php _e( 'Will match using <code>PHP stripos</code> against the <code>href attribute</code> on the <code>link tag</code>', 'fast-velocity-minify' ); ?> ]</p>
|
116 |
</fieldset></td>
|
117 |
</tr>
|
118 |
|
123 |
|
124 |
|
125 |
<div style="height: 60px;"></div>
|
126 |
+
<h2 class="title"><?php _e( 'JS Settings', 'fast-velocity-minify' ); ?></h2>
|
127 |
+
<h3 class="fvm-bold-green"><?php _e( 'In this section, you can optimize your JS files and inline scripts', 'fast-velocity-minify' ); ?></h3>
|
128 |
|
129 |
<table class="form-table fvm-settings">
|
130 |
<tbody>
|
131 |
|
132 |
<tr>
|
133 |
+
<th scope="row"><?php _e( 'JS Options', 'fast-velocity-minify' ); ?></th>
|
134 |
<td>
|
135 |
+
<p class="fvm-bold-green fvm-rowintro"><?php _e( 'Select your options below', 'fast-velocity-minify' ); ?></p>
|
136 |
|
137 |
<fieldset>
|
138 |
<label for="fvm_settings_css_enable">
|
139 |
<input name="fvm_settings[js][enable]" type="checkbox" id="fvm_settings_css_enable" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'js', 'enable')); ?>>
|
140 |
+
<?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>
|
141 |
<br />
|
142 |
|
143 |
<label for="fvm_settings_js_min_disable">
|
144 |
<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')); ?>>
|
145 |
+
<?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>
|
146 |
<br />
|
147 |
|
148 |
<label for="fvm_settings_js_jqupgrade">
|
149 |
<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')); ?>>
|
150 |
+
<?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>
|
151 |
<br />
|
152 |
|
153 |
</fieldset></td>
|
157 |
|
158 |
|
159 |
<tr>
|
160 |
+
<th scope="row"><?php _e( 'Merge render blocking JS files in the header', 'fast-velocity-minify' ); ?></th>
|
161 |
<td><fieldset>
|
162 |
+
<label for="fvm_settings_merge_header"><span class="fvm-bold-green fvm-rowintro"><?php _e( 'This will merge and render block all JS files that match the paths below', 'fast-velocity-minify' ); ?></span></label>
|
163 |
<p><textarea name="fvm_settings[js][merge_header]" rows="7" cols="50" id="fvm_settings_js_merge_header" class="large-text code" placeholder="--- suggested ---
|
164 |
|
165 |
/jquery-migrate.js
|
166 |
/jquery.js
|
167 |
/jquery.min.js"><?php echo fvm_get_settings_value($fvm_settings, 'js', 'merge_header'); ?></textarea></p>
|
168 |
+
<p class="description">[ <?php _e( 'One possible match per line, after minification and processing, as seen on the frontend.', 'fast-velocity-minify' ); ?> ]</p>
|
169 |
+
<p class="description">[ <?php _e( 'Will match using <code>PHP stripos</code> against the script <code>src attribute</code>', 'fast-velocity-minify' ); ?> ]</p>
|
170 |
</fieldset></td>
|
171 |
</tr>
|
172 |
|
173 |
<tr>
|
174 |
+
<th scope="row"><?php _e( 'Merge and Defer Scripts', 'fast-velocity-minify' ); ?></th>
|
175 |
<td><fieldset>
|
176 |
+
<label for="fvm_settings_merge_defer"><span class="fvm-bold-green fvm-rowintro"><?php _e( 'This will merge and defer all JS files that match the paths below', 'fast-velocity-minify' ); ?></span></label>
|
177 |
+
<p><textarea name="fvm_settings[js][merge_defer]" rows="7" cols="50" id="fvm_settings_js_merge_defer" class="large-text code" placeholder="<?php _e( '--- example ---', 'fast-velocity-minify' ); ?>
|
178 |
|
179 |
/wp-admin/
|
180 |
/wp-includes/
|
181 |
/wp-content/"><?php echo fvm_get_settings_value($fvm_settings, 'js', 'merge_defer'); ?></textarea></p>
|
182 |
+
<p class="description">[ <?php _e( 'One possible match per line, after minification and processing, as seen on the frontend.', 'fast-velocity-minify' ); ?> ]</p>
|
183 |
+
<p class="description">[ <?php _e( 'Will match using <code>PHP stripos</code> against the script <code>src attribute', 'fast-velocity-minify' ); ?></code> ]</p>
|
184 |
</fieldset></td>
|
185 |
</tr>
|
186 |
|
187 |
<tr>
|
188 |
+
<th scope="row"><?php _e( 'Inline JavaScript Dependencies', 'fast-velocity-minify' ); ?></th>
|
189 |
<td><fieldset>
|
190 |
+
<label for="fvm_settings_defer_dependencies"><span class="fvm-bold-green fvm-rowintro"><?php _e( 'Delay Inline JavaScript until after the deferred scripts merged above finish loading', 'fast-velocity-minify' ); ?></span></label>
|
191 |
<p><textarea name="fvm_settings[js][defer_dependencies]" rows="7" cols="50" id="fvm_settings_js_defer_dependencies" class="large-text code" placeholder="--- a small, partial snippet that should match on inline scripts and load them after the deferred scripts above ---"><?php echo fvm_get_settings_value($fvm_settings, 'js', 'defer_dependencies'); ?></textarea></p>
|
192 |
+
<p class="description">[ <?php _e( 'Inline JavaScript matching these rules, will wait until after the window.load event', 'fast-velocity-minify' ); ?> ]</p>
|
193 |
+
<p class="description">[ <?php _e( 'Will match using <code>PHP stripos</code> against the script <code>innerHTML</code>', 'fast-velocity-minify' ); ?> ]</p>
|
194 |
</fieldset></td>
|
195 |
</tr>
|
196 |
|
197 |
<tr>
|
198 |
+
<th scope="row"><?php _e( 'Execute matching third party scripts after user interaction', 'fast-velocity-minify' ); ?></th>
|
199 |
<td><fieldset>
|
200 |
+
<label for="fvm_settings_js_thirdparty"><span class="fvm-bold-green fvm-rowintro"><?php _e( 'Delay the following inline scripts until after user interaction', 'fast-velocity-minify' ); ?></span></label>
|
201 |
+
<p><textarea name="fvm_settings[js][thirdparty]" rows="7" cols="50" id="fvm_settings_js_thirdparty" class="large-text code" placeholder="<?php _e( '--- example ---', 'fast-velocity-minify' ); ?>
|
202 |
|
203 |
function(w,d,s,l,i)
|
204 |
function(f,b,e,v,n,t,s)
|
205 |
function(h,o,t,j,a,r)
|
206 |
www.googletagmanager.com/gtm.js"><?php echo fvm_get_settings_value($fvm_settings, 'js', 'thirdparty'); ?></textarea></p>
|
207 |
+
<p class="description">[ <?php _e( 'If there is no interaction from the user, scripts will still load after 5 seconds automatically.', 'fast-velocity-minify' ); ?> ]</p>
|
208 |
+
<p class="description">[ <?php _e( 'Will match using <code>PHP stripos</code> against the script <code>innerHTML</code> or <code>src</code> attribute for async/defer scripts (only)', 'fast-velocity-minify' ); ?> ]</p>
|
209 |
</fieldset></td>
|
210 |
</tr>
|
211 |
|
212 |
<tr>
|
213 |
+
<th scope="row"><?php _e( 'Remove JavaScript Scripts', 'fast-velocity-minify' ); ?></th>
|
214 |
<td><fieldset>
|
215 |
+
<label for="fvm_settings_js_remove"><span class="fvm-bold-green fvm-rowintro"><?php _e( 'Remove the following JS files or Inline Scripts', 'fast-velocity-minify' ); ?></span></label>
|
216 |
<p><textarea name="fvm_settings[js][remove]" rows="7" cols="50" id="fvm_settings_js_remove" class="large-text code" placeholder="--- should be empty in most cases ---"><?php echo fvm_get_settings_value($fvm_settings, 'js', 'remove'); ?></textarea></p>
|
217 |
+
<p class="description">[ <?php _e( 'This will allow you to remove unwanted script tags from the frontend', 'fast-velocity-minify' ); ?> ]</p>
|
218 |
+
<p class="description">[ <?php _e( 'Will match using <code>PHP stripos</code> against the script <code>outerHTML</code>', 'fast-velocity-minify' ); ?> ]</p>
|
219 |
</fieldset></td>
|
220 |
</tr>
|
221 |
|
226 |
|
227 |
|
228 |
<div style="height: 60px;"></div>
|
229 |
+
<h2 class="title"><?php _e( 'CDN Settings', 'fast-velocity-minify' ); ?></h2>
|
230 |
+
<h3 class="fvm-bold-green"><?php _e( 'If your CDN provider gives you a different URL for your assets, you can use it here', 'fast-velocity-minify' ); ?></h3>
|
231 |
<table class="form-table fvm-settings">
|
232 |
<tbody>
|
233 |
<tr>
|
234 |
+
<th scope="row"><?php _e( 'CDN Options', 'fast-velocity-minify' ); ?></th>
|
235 |
<td>
|
236 |
+
<p class="fvm-bold-green fvm-rowintro"><?php _e( 'Select your options below', 'fast-velocity-minify' ); ?></p>
|
237 |
|
238 |
<fieldset>
|
239 |
<label for="fvm_settings_cdn_enable">
|
240 |
<input name="fvm_settings[cdn][enable]" type="checkbox" id="fvm_settings_cdn_enable" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'cdn', 'enable')); ?>>
|
241 |
+
<?php _e( 'Enable CDN Processing', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will enable processing for the settings below', 'fast-velocity-minify' ); ?> ]</span></label>
|
242 |
<br />
|
243 |
|
244 |
<label for="fvm_settings_cdn_cssok">
|
245 |
<input name="fvm_settings[cdn][cssok]" type="checkbox" id="fvm_settings_cdn_cssok" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'cdn', 'cssok')); ?>>
|
246 |
+
<?php _e( 'Enable CDN for merged CSS files', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will serve the FVM generated CSS files from the CDN', 'fast-velocity-minify' ); ?> ]</span></label>
|
247 |
<br />
|
248 |
|
249 |
<label for="fvm_settings_cdn_jsok">
|
250 |
<input name="fvm_settings[cdn][jsok]" type="checkbox" id="fvm_settings_cdn_jsok" value="1" <?php echo fvm_get_settings_checkbox(fvm_get_settings_value($fvm_settings, 'cdn', 'jsok')); ?>>
|
251 |
+
<?php _e( 'Enable CDN for merged JS files', 'fast-velocity-minify' ); ?> <span class="note-info">[ <?php _e( 'Will serve the FVM generated JS files from the CDN', 'fast-velocity-minify' ); ?> ]</span></label>
|
252 |
<br />
|
253 |
|
254 |
</fieldset></td>
|
255 |
</tr>
|
256 |
<tr>
|
257 |
+
<th scope="row"><span class="fvm-label-special"><?php _e( 'CDN URL', 'fast-velocity-minify' ); ?></span></th>
|
258 |
<td><fieldset>
|
259 |
<label for="fvm_settings_cdn_domain">
|
260 |
<p><input type="text" name="fvm_settings[cdn][domain]" id="fvm_settings_cdn_domain" value="<?php echo fvm_get_settings_value($fvm_settings, 'cdn', 'domain'); ?>" size="80" /></p>
|
261 |
+
<p class="description">[ <?php _e( 'Not needed for Cloudflare or same domain reverse proxy cdn services.', 'fast-velocity-minify' ); ?> ]</p>
|
262 |
</label>
|
263 |
<br />
|
264 |
</fieldset></td>
|
265 |
</tr>
|
266 |
<tr>
|
267 |
+
<th scope="row"><?php _e( 'CDN Integration', 'fast-velocity-minify' ); ?></th>
|
268 |
<td><fieldset>
|
269 |
+
<label for="fvm_settings_cdn_integration"><span class="fvm-bold-green fvm-rowintro"><?php _e( 'Replace the following elements', 'fast-velocity-minify' ); ?></span></label>
|
270 |
<p><textarea name="fvm_settings[cdn][integration]" rows="7" cols="50" id="fvm_settings_cdn_integration" class="large-text code" placeholder="--- check the help section for suggestions ---"><?php echo fvm_get_settings_value($fvm_settings, 'cdn', 'integration'); ?></textarea></p>
|
271 |
+
<p class="description">[ <?php _e( 'Uses syntax from <code>https://simplehtmldom.sourceforge.io/manual.htm', 'fast-velocity-minify' ); ?></code> ]</p>
|
272 |
+
<p class="description">[ <?php _e( 'You can target a child of a specific html tag, an element with a specific attribute, class or id.', 'fast-velocity-minify' ); ?> ]</p>
|
273 |
</fieldset></td>
|
274 |
</tr>
|
275 |
</tbody></table>
|
277 |
|
278 |
|
279 |
<div style="height: 60px;"></div>
|
280 |
+
<h2 class="title"><?php _e( 'Cache Settings', 'fast-velocity-minify' ); ?></h2>
|
281 |
+
<h3 class="fvm-bold-green"><?php _e( 'FVM does not have page caching, so these settings are for the generated CSS and JS files only', 'fast-velocity-minify' ); ?></h3>
|
282 |
<table class="form-table fvm-settings">
|
283 |
<tbody>
|
284 |
|
285 |
<tr>
|
286 |
+
<th scope="row"><?php _e( 'Cache Preferences', 'fast-velocity-minify' ); ?></th>
|
287 |
<td>
|
288 |
+
<p class="fvm-bold-green fvm-rowintro"><?php _e( 'Select your options below', 'fast-velocity-minify' ); ?></p>
|
289 |
|
290 |
<fieldset>
|
291 |
<label for="fvm_settings_cache_min_instant_purge">
|
292 |
<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')); ?>>
|
293 |
+
<?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>
|
294 |
<br />
|
295 |
|
296 |
</fieldset></td>
|
297 |
</tr>
|
298 |
<tr>
|
299 |
+
<th scope="row"><span class="fvm-label-special"><?php _e( 'Public Files Cache Path', 'fast-velocity-minify' ); ?></span></th>
|
300 |
<td><fieldset>
|
301 |
<label for="fvm_settings_cache_path">
|
302 |
<p><input type="text" name="fvm_settings[cache][path]" id="fvm_settings_cache_path" value="<?php echo fvm_get_settings_value($fvm_settings, 'cache', 'path'); ?>" size="80" /></p>
|
303 |
+
<p class="description">[ <?php _e( 'Current base path:', 'fast-velocity-minify' ); ?> <code><?php echo $fvm_cache_paths['cache_base_dir']; ?></code> ]</p>
|
304 |
</label>
|
305 |
<br />
|
306 |
</fieldset></td>
|
307 |
</tr>
|
308 |
<tr>
|
309 |
+
<th scope="row"><span class="fvm-label-special"><?php _e( 'Public Files Cache URL', 'fast-velocity-minify' ); ?></span></th>
|
310 |
<td><fieldset>
|
311 |
<label for="fvm_settings_cache_url">
|
312 |
<p><input type="text" name="fvm_settings[cache][url]" id="fvm_settings_cache_url" value="<?php echo fvm_get_settings_value($fvm_settings, 'cache', 'url'); ?>" size="80" /></p>
|
313 |
+
<p class="description">[ <?php _e( 'Current base url:', 'fast-velocity-minify' ); ?> <code><?php echo $fvm_cache_paths['cache_base_dirurl']; ?></code> ]</p>
|
314 |
</label>
|
315 |
<br />
|
316 |
</fieldset></td>
|
319 |
|
320 |
|
321 |
<div style="height: 60px;"></div>
|
322 |
+
<h2 class="title"><?php _e( 'User Settings', 'fast-velocity-minify' ); ?></h2>
|
323 |
+
<h3 class="fvm-bold-green"><?php _e( 'For compatibility reasons, only anonymous users should be optimized by default.', 'fast-velocity-minify' ); ?></h3>
|
324 |
<table class="form-table fvm-settings">
|
325 |
<tbody>
|
326 |
|
327 |
<tr>
|
328 |
+
<th scope="row"><?php _e( 'User Options', 'fast-velocity-minify' ); ?></th>
|
329 |
<td>
|
330 |
+
<p class="fvm-bold-green fvm-rowintro"><?php _e( 'Force optimization for the following user roles', 'fast-velocity-minify' ); ?></p>
|
331 |
|
332 |
<fieldset>
|
333 |
<?php
|
339 |
|
340 |
|
341 |
<input type="hidden" name="fvm_action" value="save_settings" />
|
342 |
+
<p class="submit"><input type="submit" class="button button-primary" value="<?php _e( 'Save Changes', 'fast-velocity-minify' ); ?>"></p>
|
343 |
|
344 |
</form>
|
345 |
</div>
|
layout/admin-layout-status.php
CHANGED
@@ -6,26 +6,26 @@ if( $at == 'status' ) {
|
|
6 |
<div class="fvm-wrapper">
|
7 |
|
8 |
<div id="status">
|
9 |
-
<h2 class="title"
|
10 |
<h3 class="fvm-cache-stats fvm-bold-green"></h3>
|
11 |
|
12 |
|
13 |
<div style="height: 40px;"></div>
|
14 |
-
<h2 class="title"
|
15 |
-
<h3 class="fvm-bold-green"
|
16 |
<textarea rows="10" cols="50" class="large-text code row-log log-css" disabled></textarea>
|
17 |
|
18 |
|
19 |
<div style="height: 40px;"></div>
|
20 |
-
<h2 class="title"
|
21 |
-
<h3 class="fvm-bold-green"
|
22 |
<textarea rows="10" cols="50" class="large-text code row-log log-js" disabled></textarea>
|
23 |
<div style="height: 20px;"></div>
|
24 |
|
25 |
|
26 |
<div style="height: 40px;"></div>
|
27 |
-
<h2 class="title"
|
28 |
-
<h3 class="fvm-bold-green"
|
29 |
<textarea rows="10" cols="50" class="large-text code row-log" disabled><?php fvm_get_generalinfo(); ?></textarea>
|
30 |
|
31 |
|
6 |
<div class="fvm-wrapper">
|
7 |
|
8 |
<div id="status">
|
9 |
+
<h2 class="title"><?php _e( 'Cache Stats', 'fast-velocity-minify' ); ?></h2>
|
10 |
<h3 class="fvm-cache-stats fvm-bold-green"></h3>
|
11 |
|
12 |
|
13 |
<div style="height: 40px;"></div>
|
14 |
+
<h2 class="title"><?php _e( 'CSS Logs', 'fast-velocity-minify' ); ?></h2>
|
15 |
+
<h3 class="fvm-bold-green"><?php _e( 'In this section, you can check the latest CSS merging logs', 'fast-velocity-minify' ); ?></h3>
|
16 |
<textarea rows="10" cols="50" class="large-text code row-log log-css" disabled></textarea>
|
17 |
|
18 |
|
19 |
<div style="height: 40px;"></div>
|
20 |
+
<h2 class="title"><?php _e( 'JS Logs', 'fast-velocity-minify' ); ?></h2>
|
21 |
+
<h3 class="fvm-bold-green"><?php _e( 'In this section, you can check the latest JS merging logs', 'fast-velocity-minify' ); ?></h3>
|
22 |
<textarea rows="10" cols="50" class="large-text code row-log log-js" disabled></textarea>
|
23 |
<div style="height: 20px;"></div>
|
24 |
|
25 |
|
26 |
<div style="height: 40px;"></div>
|
27 |
+
<h2 class="title"><?php _e( 'Server Info', 'fast-velocity-minify' ); ?></h2>
|
28 |
+
<h3 class="fvm-bold-green"><?php _e( 'In this section, you can check some server stats and information', 'fast-velocity-minify' ); ?></h3>
|
29 |
<textarea rows="10" cols="50" class="large-text code row-log" disabled><?php fvm_get_generalinfo(); ?></textarea>
|
30 |
|
31 |
|
layout/admin-layout.php
CHANGED
@@ -8,10 +8,10 @@ $at = isset($_GET['tab']) ? $_GET['tab'] : 'settings';
|
|
8 |
?>
|
9 |
|
10 |
<h2 class="nav-tab-wrapper wp-clearfix">
|
11 |
-
<a href="?page=fvm" class="nav-tab <?php echo $at == 'settings' ? 'nav-tab-active' : ''; ?>"
|
12 |
-
<a href="?page=fvm&tab=status" class="nav-tab <?php echo $at == 'status' ? 'nav-tab-active' : ''; ?>"
|
13 |
-
<?php /*<a href="?page=fvm&tab=upgrade" class="nav-tab <?php echo $at == 'upgrade' ? 'nav-tab-active' : ''; ?>"
|
14 |
-
<a href="?page=fvm&tab=help" class="nav-tab <?php echo $at == 'help' ? 'nav-tab-active' : ''; ?>"
|
15 |
</h2>
|
16 |
|
17 |
<div id="fvm">
|
8 |
?>
|
9 |
|
10 |
<h2 class="nav-tab-wrapper wp-clearfix">
|
11 |
+
<a href="?page=fvm" class="nav-tab <?php echo $at == 'settings' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Settings', 'fast-velocity-minify' ); ?></a>
|
12 |
+
<a href="?page=fvm&tab=status" class="nav-tab <?php echo $at == 'status' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Status', 'fast-velocity-minify' ); ?></a>
|
13 |
+
<?php /*<a href="?page=fvm&tab=upgrade" class="nav-tab <?php echo $at == 'upgrade' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Upgrade', 'fast-velocity-minify' ); ?></a>*/ ?>
|
14 |
+
<a href="?page=fvm&tab=help" class="nav-tab <?php echo $at == 'help' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Help', 'fast-velocity-minify' ); ?></a>
|
15 |
</h2>
|
16 |
|
17 |
<div id="fvm">
|
readme.txt
CHANGED
@@ -3,8 +3,9 @@ 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.0.
|
7 |
Tested up to: 5.6
|
|
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -51,6 +52,9 @@ Version 3.0 is a major code rewrite to improve JS and CSS merging, but it requir
|
|
51 |
|
52 |
== Changelog ==
|
53 |
|
|
|
|
|
|
|
54 |
= 3.0.0 [2020.12.26] =
|
55 |
* New version has been remade from scratch
|
56 |
* JS Optimization is disabled by default and requires manual configuration
|
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.0.1
|
7 |
Tested up to: 5.6
|
8 |
+
Text Domain: fast-velocity-minify
|
9 |
License: GPLv3 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
52 |
|
53 |
== Changelog ==
|
54 |
|
55 |
+
= 3.0.1 [2020.12.27] =
|
56 |
+
* Added initial translation support under the "fast-velocity-minify" text domain.
|
57 |
+
|
58 |
= 3.0.0 [2020.12.26] =
|
59 |
* New version has been remade from scratch
|
60 |
* JS Optimization is disabled by default and requires manual configuration
|