Asset CleanUp: Page Speed Booster - Version 1.2.9.7

Version Description

  • Bug Fix: Prevent fatal error from showing in PHP 5.4 when the plugin was updated
  • Re-organised the plugin's links within the Dashboard to make it easier to navigate through
  • "Combine CSS files into one" feature update - CSS files having media="print" or media="only screen and (max-width: 768px)" (and so on) are not combined
  • "Combine JS files into fewer ones" feature update - jQuery and jQuery Migrate are combined as a single group (not together with any other files); if only jQuery is loaded (without jQuery Migrate), it will not be added to any group and load independently
Download this release

Release Info

Developer gabelivan
Plugin Icon 128x128 Asset CleanUp: Page Speed Booster
Version 1.2.9.7
Comparing to
See all releases

Code changes from version 1.2.9.6 to 1.2.9.7

classes/Main.php CHANGED
@@ -1,6 +1,8 @@
1
<?php
2
namespace WpAssetCleanUp;
3
4
/**
5
* Class Main
6
* @package WpAssetCleanUp
@@ -236,16 +238,23 @@ class Main
236
add_action('wp_footer', array($this, 'printScriptsStyles'), PHP_INT_MAX);
237
}
238
239
- // Do not load the meta box nor do any AJAX calls
240
- // if the asset management is not enabled for the Dashboard
241
- if ( $this->settings['dashboard_show'] == 1 && is_admin() ) {
242
- // Send an AJAX request to get the list of loaded scripts and styles and print it nicely
243
- add_action(
244
- 'wp_ajax_' . WPACU_PLUGIN_ID . '_get_loaded_assets',
245
- array( $this, 'ajaxGetJsonListCallback' )
246
- );
247
248
- add_action( 'add_meta_boxes', array( $this, 'addMetaBox' ) );
249
}
250
251
if ($this->settings['disable_emojis'] == 1) {
@@ -266,6 +275,8 @@ class Main
266
267
// it will update $this->isUpdateable;
268
$this->getCurrentPostId();
269
}
270
271
/**
@@ -302,57 +313,6 @@ class Main
302
}
303
}
304
305
- /**
306
- * @param $postType
307
- */
308
- public function addMetaBox($postType)
309
- {
310
- $obj = get_post_type_object($postType);
311
-
312
- if (isset($obj->public) && $obj->public > 0) {
313
- add_meta_box(
314
- WPACU_PLUGIN_ID . '_asset_list',
315
- __('Asset CleanUp', WPACU_PLUGIN_TEXT_DOMAIN),
316
- array($this, 'renderMetaBoxContent'),
317
- $postType,
318
- 'advanced',
319
- 'high'
320
- );
321
- }
322
- }
323
-
324
- /**
325
- * This is triggered only in the Edit Mode Dashboard View
326
- */
327
- public function renderMetaBoxContent()
328
- {
329
- global $post;
330
-
331
- if ($post->ID === null) {
332
- return;
333
- }
334
-
335
- $postId = $post->ID;
336
-
337
- $getAssets = true;
338
-
339
- if (get_post_status($postId) !== 'publish') {
340
- $getAssets = false;
341
- }
342
-
343
- if ($getAssets) {
344
- // Add an nonce field so we can check for it later.
345
- wp_nonce_field( WPACU_PLUGIN_ID . '_meta_box', WPACU_PLUGIN_ID . '_nonce');
346
- }
347
-
348
- $data = array();
349
-
350
- $data['get_assets'] = $getAssets;
351
- $data['fetch_url'] = Misc::getPageUrl($postId);
352
-
353
- $this->parseTemplate('meta-box', $data, true);
354
- }
355
-
356
/**
357
* See if there is any list with scripts to be removed in JSON format
358
* Only the handles (the ID of the scripts) are saved
@@ -498,7 +458,8 @@ class Main
498
if (! empty($globalUnload['styles']) && $nonAssetConfigPage) {
499
$list = $globalUnload['styles'];
500
} else { // [/wpacu_lite]
501
- // Post, Page, Front-page and more (if the Premium Extension is activated)
502
$toRemove = $this->getAssetsUnloaded();
503
504
$jsonList = @json_decode($toRemove);
@@ -1622,6 +1583,14 @@ class Main
1622
return true; // visitors (non-logged in) will view the pages with all the assets loaded
1623
}
1624
1625
return false;
1626
}
1627
1
<?php
2
namespace WpAssetCleanUp;
3
4
+ use FakerPress\Module\Meta;
5
+
6
/**
7
* Class Main
8
* @package WpAssetCleanUp
238
add_action('wp_footer', array($this, 'printScriptsStyles'), PHP_INT_MAX);
239
}
240
241
+ $metaboxes = new MetaBoxes;
242
+
243
+ if ( is_admin() ) {
244
+ // Do not load the meta box nor do any AJAX calls
245
+ // if the asset management is not enabled for the Dashboard
246
+ if ($this->settings['dashboard_show'] == 1) {
247
+ // Send an AJAX request to get the list of loaded scripts and styles and print it nicely
248
+ add_action(
249
+ 'wp_ajax_' . WPACU_PLUGIN_ID . '_get_loaded_assets',
250
+ array( $this, 'ajaxGetJsonListCallback' )
251
+ );
252
253
+ $metaboxes->initManagerMetaBox();
254
+ }
255
+
256
+ // Side Meta Box: Asset CleanUp Options
257
+ $metaboxes->initCustomOptionsMetaBox();
258
}
259
260
if ($this->settings['disable_emojis'] == 1) {
275
276
// it will update $this->isUpdateable;
277
$this->getCurrentPostId();
278
+
279
+ define('WPACU_CURRENT_PAGE_ID', $this->getCurrentPostId());
280
}
281
282
/**
313
}
314
}
315
316
/**
317
* See if there is any list with scripts to be removed in JSON format
318
* Only the handles (the ID of the scripts) are saved
458
if (! empty($globalUnload['styles']) && $nonAssetConfigPage) {
459
$list = $globalUnload['styles'];
460
} else { // [/wpacu_lite]
461
+ // Post, Page, Front-page
462
+ // and more (if the Premium Extension is activated)
463
$toRemove = $this->getAssetsUnloaded();
464
465
$jsonList = @json_decode($toRemove);
1583
return true; // visitors (non-logged in) will view the pages with all the assets loaded
1584
}
1585
1586
+ if (defined('WPACU_CURRENT_PAGE_ID') && WPACU_CURRENT_PAGE_ID > 0) {
1587
+ $pageOptions = MetaBoxes::getPageOptions(WPACU_CURRENT_PAGE_ID);
1588
+
1589
+ if (isset($pageOptions['no_assets_settings']) && $pageOptions['no_assets_settings']) {
1590
+ return true;
1591
+ }
1592
+ }
1593
+
1594
return false;
1595
}
1596
classes/MetaBoxes.php ADDED
@@ -0,0 +1,126 @@
1
+ <?php
2
+ namespace WpAssetCleanUp;
3
+
4
+ /**
5
+ * Class MetaBoxes
6
+ * @package WpAssetCleanUp
7
+ */
8
+ class MetaBoxes
9
+ {
10
+ /**
11
+ *
12
+ */
13
+ public function initManagerMetaBox()
14
+ {
15
+ add_action( 'add_meta_boxes', array( $this, 'addAssetManagerMetaBox' ) );
16
+ }
17
+
18
+ /**
19
+ *
20
+ */
21
+ public function initCustomOptionsMetaBox()
22
+ {
23
+ add_action( 'add_meta_boxes', array( $this, 'addPageOptionsMetaBox' ) );
24
+ }
25
+
26
+ /**
27
+ * @param $postType
28
+ */
29
+ public function addAssetManagerMetaBox($postType)
30
+ {
31
+ $obj = get_post_type_object($postType);
32
+
33
+ if (isset($obj->public) && $obj->public > 0) {
34
+ add_meta_box(
35
+ WPACU_PLUGIN_ID . '_asset_list',
36
+ __('Asset CleanUp: CSS &amp; JavaScript Manager', WPACU_PLUGIN_TEXT_DOMAIN),
37
+ array($this, 'renderAssetManagerMetaBoxContent'),
38
+ $postType,
39
+ 'advanced',
40
+ 'high'
41
+ );
42
+ }
43
+ }
44
+
45
+ /**
46
+ * This is triggered only in the Edit Mode Dashboard View
47
+ */
48
+ public function renderAssetManagerMetaBoxContent()
49
+ {
50
+ global $post;
51
+
52
+ if ($post->ID === null) {
53
+ return;
54
+ }
55
+
56
+ $postId = $post->ID;
57
+
58
+ $getAssets = true;
59
+
60
+ if (get_post_status($postId) !== 'publish') {
61
+ $getAssets = false;
62
+ }
63
+
64
+ if ($getAssets) {
65
+ // Add an nonce field so we can check for it later.
66
+ wp_nonce_field( WPACU_PLUGIN_ID . '_meta_box', WPACU_PLUGIN_ID . '_nonce');
67
+ }
68
+
69
+ $data = array();
70
+
71
+ $data['get_assets'] = $getAssets;
72
+ $data['fetch_url'] = Misc::getPageUrl($postId);
73
+
74
+ Main::instance()->parseTemplate('meta-box', $data, true);
75
+ }
76
+
77
+ /**
78
+ * @param $postType
79
+ */
80
+ public function addPageOptionsMetaBox($postType)
81
+ {
82
+ $obj = get_post_type_object($postType);
83
+
84
+ if (isset($obj->public) && $obj->public > 0) {
85
+ add_meta_box(
86
+ WPACU_PLUGIN_ID . '_page_options',
87
+ __('Asset CleanUp Options', WPACU_PLUGIN_TEXT_DOMAIN),
88
+ array($this, 'renderPageOptionsMetaBoxContent'),
89
+ $postType,
90
+ 'side',
91
+ 'high'
92
+ );
93
+ }
94
+ }
95
+
96
+ /**
97
+ *
98
+ */
99
+ public function renderPageOptionsMetaBoxContent()
100
+ {
101
+ $data = array('page_options' => self::getPageOptions());
102
+
103
+ Main::instance()->parseTemplate('meta-box-page-options', $data, true);
104
+ }
105
+
106
+
107
+ /**
108
+ * @param int $postId
109
+ *
110
+ * @return array|mixed|object
111
+ */
112
+ public static function getPageOptions($postId = 0)
113
+ {
114
+ if ($postId < 1) {
115
+ global $post;
116
+ $postId = (int)$post->ID;
117
+ }
118
+
119
+ if ($postId > 1) {
120
+ $metaPageOptionsJson = get_post_meta($postId, '_'.WPACU_PLUGIN_ID.'_page_options', true);
121
+ return @json_decode($metaPageOptionsJson, ARRAY_A);
122
+ }
123
+
124
+ return array();
125
+ }
126
+ }
classes/OptimiseAssets/CombineCss.php CHANGED
@@ -3,6 +3,7 @@ namespace WpAssetCleanUp\OptimiseAssets;
3
4
use WpAssetCleanUp\Main;
5
use WpAssetCleanUp\Menu;
6
7
/**
8
* Class CombineCss
@@ -25,6 +26,9 @@ class CombineCss
25
*/
26
public $jsonStorageFile = 'css-combined{maybe-extra-info}.json';
27
28
public function init()
29
{
30
add_action('wp_loaded', function() {
@@ -33,6 +37,13 @@ class CombineCss
33
}
34
35
ob_start(function ($htmlSource) {
36
$useDom = function_exists('libxml_use_internal_errors') && function_exists('libxml_clear_errors') && class_exists('DOMDocument');
37
38
if (! $useDom) {
@@ -52,6 +63,7 @@ class CombineCss
52
53
// $uriToFinalCssFile will always be relative ONLY within WP_CONTENT_DIR . self::$relPathCssCacheDir
54
// which is usually "wp-content/cache/asset-cleanup/css/"
55
if (! empty($localFinalCssFileData) && isset($localFinalCssFileData['local_final_css_file']) && file_exists($localFinalCssFileData['local_final_css_file'])) {
56
/*
57
* URIs to the LINK tags are already cached; No need to parse the DOM
@@ -73,16 +85,20 @@ class CombineCss
73
$documentHead = $document->getElementsByTagName('head')->item(0);
74
libxml_use_internal_errors( true );
75
76
- $combinedUriPaths = $hrefUriPreloads = $localAssetsPaths = $linkHrefs = array();
77
78
foreach ($documentHead->getElementsByTagName('link') as $tagObject) {
79
if (! $tagObject->hasAttributes()) {
80
continue;
81
}
82
83
- $getHref = $checkCssPreload = $href = false;
84
85
foreach ($tagObject->attributes as $attrObj) {
86
// Only rel="stylesheet" (with no rel="preload" associated with it) gets prepared for combining as links with rel="preload" (if any) are never combined into a standard render-blocking CSS file
87
// rel="preload" is there for a reason to make sure the CSS code is made available earlier prior to the one from rel="stylesheet" which is render-blocking
88
if ($attrObj->nodeName === 'rel' && $attrObj->nodeValue === 'stylesheet') {
@@ -96,40 +112,54 @@ class CombineCss
96
97
$localAssetPath = CombineCommon::getLocalAssetPath($href, 'css');
98
99
if ($localAssetPath) {
100
$combinedUriPaths[] = CombineCommon::getHrefRelPath($href);
101
$localAssetsPaths[$href] = $localAssetPath;
102
$linkHrefs[] = $href;
103
}
104
}
105
106
- // Check if there is any rel="preload" connected to the rel="stylesheet"
107
- // and make sure the file is not added to the final CSS combined file
108
- if ($attrObj->nodeName === 'rel' && $attrObj->nodeValue === 'preload') {
109
- $checkCssPreload = true;
110
- }
111
112
- if ($checkCssPreload && $attrObj->nodeName === 'href') {
113
- $hrefUriPreloads[] = CombineCommon::getHrefRelPath($attrObj->nodeValue);
114
- }
115
}
116
}
117
118
- // Any rel="preload" found? Remove the stylesheet from the combination
119
- if (! empty($hrefUriPreloads)) {
120
- foreach ($hrefUriPreloads as $hrefUriPreload) {
121
- if (in_array($hrefUriPreload, $combinedUriPaths)) {
122
- $linkHrefUriKey = array_search($hrefUriPreload, $combinedUriPaths);
123
unset($combinedUriPaths[$linkHrefUriKey]);
124
125
foreach (array_keys($localAssetsPaths) as $localAssetPathKey) {
126
- if (substr($localAssetPathKey, -strlen($hrefUriPreload)) === $hrefUriPreload) {
127
unset($localAssetsPaths[$localAssetPathKey]);
128
}
129
}
130
131
foreach ($linkHrefs as $linkHrefKey => $linkHref) {
132
- if (substr($linkHref, -strlen($hrefUriPreload)) === $hrefUriPreload) {
133
unset($linkHrefs[$linkHrefKey]);
134
}
135
}
@@ -174,7 +204,6 @@ HTML;
174
175
$htmlSource = preg_replace('#<head>#si', '<head>'."\n" . $finalCssTag . "\n", $htmlSource, 1);
176
177
- $htmlSourceBeforeLinkTagLoopReplacement = $htmlSource;
178
$htmlSource = CombineCommon::stripJustCombinedFileTags($linkHrefs, $htmlSource, 'css'); // Strip the combined files to avoid duplicate code
179
180
// There should be at least two replacements made
3
4
use WpAssetCleanUp\Main;
5
use WpAssetCleanUp\Menu;
6
+ use WpAssetCleanUp\MetaBoxes;
7
8
/**
9
* Class CombineCss
26
*/
27
public $jsonStorageFile = 'css-combined{maybe-extra-info}.json';
28
29
+ /**
30
+ *
31
+ */
32
public function init()
33
{
34
add_action('wp_loaded', function() {
37
}
38
39
ob_start(function ($htmlSource) {
40
+ // If "Do not combine CSS on this page" is checked in "Asset CleanUp Options" side meta box
41
+ $pageOptions = MetaBoxes::getPageOptions(WPACU_CURRENT_PAGE_ID);
42
+
43
+ if (isset($pageOptions['no_css_optimize']) && $pageOptions['no_css_optimize']) {
44
+ return $htmlSource;
45
+ }
46
+
47
$useDom = function_exists('libxml_use_internal_errors') && function_exists('libxml_clear_errors') && class_exists('DOMDocument');
48
49
if (! $useDom) {
63
64
// $uriToFinalCssFile will always be relative ONLY within WP_CONTENT_DIR . self::$relPathCssCacheDir
65
// which is usually "wp-content/cache/asset-cleanup/css/"
66
+
67
if (! empty($localFinalCssFileData) && isset($localFinalCssFileData['local_final_css_file']) && file_exists($localFinalCssFileData['local_final_css_file'])) {
68
/*
69
* URIs to the LINK tags are already cached; No need to parse the DOM
85
$documentHead = $document->getElementsByTagName('head')->item(0);
86
libxml_use_internal_errors( true );
87
88
+ $combinedUriPaths = $hrefUriNotCombinableList = $localAssetsPaths = $linkHrefs = array();
89
90
foreach ($documentHead->getElementsByTagName('link') as $tagObject) {
91
if (! $tagObject->hasAttributes()) {
92
continue;
93
}
94
95
+ $getHref = $href = false;
96
+
97
+ $linkAttributes = array();
98
99
foreach ($tagObject->attributes as $attrObj) {
100
+ $linkAttributes[$attrObj->nodeName] = $attrObj->nodeValue;
101
+
102
// Only rel="stylesheet" (with no rel="preload" associated with it) gets prepared for combining as links with rel="preload" (if any) are never combined into a standard render-blocking CSS file
103
// rel="preload" is there for a reason to make sure the CSS code is made available earlier prior to the one from rel="stylesheet" which is render-blocking
104
if ($attrObj->nodeName === 'rel' && $attrObj->nodeValue === 'stylesheet') {
112
113
$localAssetPath = CombineCommon::getLocalAssetPath($href, 'css');
114
115
+ // It will skip external stylesheets (from a different domain)
116
if ($localAssetPath) {
117
$combinedUriPaths[] = CombineCommon::getHrefRelPath($href);
118
$localAssetsPaths[$href] = $localAssetPath;
119
$linkHrefs[] = $href;
120
}
121
}
122
+ }
123
124
+ if (! $getHref) {
125
+ continue;
126
+ }
127
128
+ $cssNotCombinable = false;
129
+
130
+ // 1) Check if there is any rel="preload" connected to the rel="stylesheet"
131
+ // making sure the file is not added to the final CSS combined file
132
+
133
+ // 2) Only combine media "all", "screen" and the ones with no media
134
+ // Do not combine media='only screen and (max-width: 768px)' etc.
135
+ if (isset($linkAttributes['rel']) && $linkAttributes['rel'] === 'preload') {
136
+ $cssNotCombinable = true;
137
+ }
138
+
139
+ if (array_key_exists('media', $linkAttributes) && ! in_array($linkAttributes['media'], array('all', 'screen'))) {
140
+ $cssNotCombinable = true;
141
+ }
142
+
143
+ if ($cssNotCombinable) {
144
+ $hrefUriNotCombinableList[] = CombineCommon::getHrefRelPath( $href );
145
}
146
}
147
148
+ // Any rel="preload" or media="print" found? Remove the stylesheet from the combination
149
+ if (! empty($hrefUriNotCombinableList)) {
150
+ foreach ($hrefUriNotCombinableList as $hrefUriNotCombinable) {
151
+ if (in_array($hrefUriNotCombinable, $combinedUriPaths)) {
152
+ $linkHrefUriKey = array_search($hrefUriNotCombinable, $combinedUriPaths);
153
unset($combinedUriPaths[$linkHrefUriKey]);
154
155
foreach (array_keys($localAssetsPaths) as $localAssetPathKey) {
156
+ if (substr($localAssetPathKey, -strlen($hrefUriNotCombinable)) === $hrefUriNotCombinable) {
157
unset($localAssetsPaths[$localAssetPathKey]);
158
}
159
}
160
161
foreach ($linkHrefs as $linkHrefKey => $linkHref) {
162
+ if (substr($linkHref, -strlen($hrefUriNotCombinable)) === $hrefUriNotCombinable) {
163
unset($linkHrefs[$linkHrefKey]);
164
}
165
}
204
205
$htmlSource = preg_replace('#<head>#si', '<head>'."\n" . $finalCssTag . "\n", $htmlSource, 1);
206
207
$htmlSource = CombineCommon::stripJustCombinedFileTags($linkHrefs, $htmlSource, 'css'); // Strip the combined files to avoid duplicate code
208
209
// There should be at least two replacements made
classes/Update.php CHANGED
@@ -192,20 +192,23 @@ HTML;
192
*/
193
public function savePost($postId, $post = array())
194
{
195
// This is triggered only if the "Asset CleanUp" meta box was loaded with the list of assets
196
// Otherwise, $_POST[WPACU_PLUGIN_ID] will be taken as empty which might be not if there are values in the database
197
if (! (isset($_POST['wpacu_unload_assets_area_loaded']) && $_POST['wpacu_unload_assets_area_loaded'])) {
198
return;
199
}
200
201
- if (empty($post)) {
202
- global $post;
203
- }
204
-
205
- if (! isset($post->ID) || ! isset($post->post_type)) {
206
- return;
207
- }
208
-
209
// Has to be a public post type
210
$obj = get_post_type_object($post->post_type);
211
@@ -405,6 +408,29 @@ HTML;
405
}
406
}
407
408
/**
409
* Triggers either "saveToEverywhereUnloads" or "removeEverywhereUnloads" methods
410
*/
192
*/
193
public function savePost($postId, $post = array())
194
{
195
+ if (empty($post)) {
196
+ global $post;
197
+ }
198
+
199
+ if (! isset($post->ID) || ! isset($post->post_type)) {
200
+ return;
201
+ }
202
+
203
+ // Any page options set? From the Side Meta Box "Asset CleanUp Options"
204
+ $this->updatePageOptions($post->ID);
205
+
206
// This is triggered only if the "Asset CleanUp" meta box was loaded with the list of assets
207
// Otherwise, $_POST[WPACU_PLUGIN_ID] will be taken as empty which might be not if there are values in the database
208
if (! (isset($_POST['wpacu_unload_assets_area_loaded']) && $_POST['wpacu_unload_assets_area_loaded'])) {
209
return;
210
}
211
212
// Has to be a public post type
213
$obj = get_post_type_object($post->post_type);
214
408
}
409
}
410
411
+ /*
412
+ * This method should ONLY be triggered when the "Asset CleanUp Options" area is visible
413
+ */
414
+ public function updatePageOptions($postId)
415
+ {
416
+ $pageOptions = array_key_exists(WPACU_PLUGIN_ID.'_page_options', $_POST)
417
+ ? $_POST[WPACU_PLUGIN_ID.'_page_options']
418
+ : array();
419
+
420
+ // No page options? Delete any entry from the database to free up space
421
+ // instead of updating it as an empty entry
422
+ if (empty($pageOptions)) {
423
+ delete_post_meta($postId, '_' . WPACU_PLUGIN_ID . '_page_options');
424
+ return;
425
+ }
426
+
427
+ $pageOptionsJson = json_encode($pageOptions);
428
+
429
+ if (! add_post_meta($postId, '_' . WPACU_PLUGIN_ID . '_page_options', $pageOptionsJson, true)) {
430
+ update_post_meta($postId, '_' . WPACU_PLUGIN_ID . '_page_options', $pageOptionsJson);
431
+ }
432
+ }
433
+
434
/**
435
* Triggers either "saveToEverywhereUnloads" or "removeEverywhereUnloads" methods
436
*/
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: pagespeed, page speed, dequeue, performance, gtmetrix
4
Donate link: https://gabelivan.com/items/wp-asset-cleanup-pro/?utm_source=wp_org_lite&utm_medium=donate
5
Requires at least: 4.4
6
Tested up to: 5.0.3
7
- Stable tag: 1.2.9.6
8
License: GPLv3
9
License URI: http://www.gnu.org/licenses/gpl.html
10
@@ -131,6 +131,12 @@ With the recently released "Test Mode" feature, you can safely unload assets on
131
4. Scripts (.JS) are selected for site-wide unload
132
133
== Changelog ==
134
= 1.2.9.6 =
135
* Bug Fix: After post/page update, a fatal error was showing on calling a method that doesn't exist
136
4
Donate link: https://gabelivan.com/items/wp-asset-cleanup-pro/?utm_source=wp_org_lite&utm_medium=donate
5
Requires at least: 4.4
6
Tested up to: 5.0.3
7
+ Stable tag: 1.2.9.7
8
License: GPLv3
9
License URI: http://www.gnu.org/licenses/gpl.html
10
131
4. Scripts (.JS) are selected for site-wide unload
132
133
== Changelog ==
134
+ = 1.2.9.7 =
135
+ * Bug Fix: Prevent fatal error from showing in PHP 5.4 when the plugin was updated
136
+ * Re-organised the plugin's links within the Dashboard to make it easier to navigate through
137
+ * "Combine CSS files into one" feature update - CSS files having media="print" or media="only screen and (max-width: 768px)" (and so on) are not combined
138
+ * "Combine JS files into fewer ones" feature update - jQuery and jQuery Migrate are combined as a single group (not together with any other files); if only jQuery is loaded (without jQuery Migrate), it will not be added to any group and load independently
139
+
140
= 1.2.9.6 =
141
* Bug Fix: After post/page update, a fatal error was showing on calling a method that doesn't exist
142
templates/admin-page-settings-plugin.php CHANGED
@@ -239,7 +239,7 @@ do_action('wpacu_admin_notices');
239
240
<div id="wpacu-setting-test-mode" class="wpacu-settings-tab-content">
241
<h2><?php _e('Test Mode', WPACU_PLUGIN_TEXT_DOMAIN); ?></h2>
242
- <p>Have your visitors load without any Asset CleanUp settings while you're going through the plugin setup and unloading the useless CSS &amp; JavaScript!</p>
243
<table class="wpacu-form-table">
244
<tr valign="top">
245
<th scope="row" class="setting_title">
@@ -294,13 +294,13 @@ do_action('wpacu_admin_notices');
294
</tr>
295
<tr valign="top">
296
<th scope="row" class="setting_title">
297
- <label>Combine loaded JS (JavaScript) into less files?</label>
298
<p class="wpacu_subtitle"><small><em>Helps reducing the number of HTTP Requests even further</em></small></p>
299
</th>
300
<td>
301
<?php echo $availableForPro; ?> <small>* if /wp-content/cache/ directory is not writable for some reason, this feature will not work; requires the DOMDocument XML DOM Parser to be enabled in PHP (which it is by default) for maximum performance</small>
302
&nbsp;
303
- <p>This scans the remaining JavaScript files (left after cleaning up the unnecessary ones) from the <code>&lt;head&gt;</code> and <code>&lt;body&gt;</code> and combines them into less files. The combination is made in such a way that it will not interefere with any inline JavaScript code associated with any of the files. To be 100% sure everything works fine after activation, consider using "Yes, for logged-in administrators" so only you can see the updated page. If all looks good, you can later switch it to "Yes (for everyone)".</p>
304
<p style="margin-bottom: -7px;">For maximum performance and making sure that no functionality is broken the following JavaScript files:</p>
305
<ul style="list-style: disc; margin-left: 25px; margin-bottom: 0;">
306
<li>Any script tag having "defer" or "async" attributes</li>
239
240
<div id="wpacu-setting-test-mode" class="wpacu-settings-tab-content">
241
<h2><?php _e('Test Mode', WPACU_PLUGIN_TEXT_DOMAIN); ?></h2>
242
+ <p>Have your visitors load the website without any Asset CleanUp settings while you're going through the plugin setup and unloading the useless CSS &amp; JavaScript!</p>
243
<table class="wpacu-form-table">
244
<tr valign="top">
245
<th scope="row" class="setting_title">
294
</tr>
295
<tr valign="top">
296
<th scope="row" class="setting_title">
297
+ <label>Combine loaded JS (JavaScript) into fewer files?</label>
298
<p class="wpacu_subtitle"><small><em>Helps reducing the number of HTTP Requests even further</em></small></p>
299
</th>
300
<td>
301
<?php echo $availableForPro; ?> <small>* if /wp-content/cache/ directory is not writable for some reason, this feature will not work; requires the DOMDocument XML DOM Parser to be enabled in PHP (which it is by default) for maximum performance</small>
302
&nbsp;
303
+ <p>This scans the remaining JavaScript files (left after cleaning up the unnecessary ones) from the <code>&lt;head&gt;</code> and <code>&lt;body&gt;</code> and combines them into fewer files. The combination is made in such a way that it will not interefere with any inline JavaScript code associated with any of the files. To be 100% sure everything works fine after activation, consider using "Yes, for logged-in administrators" so only you can see the updated page. If all looks good, you can later switch it to "Yes (for everyone)".</p>
304
<p style="margin-bottom: -7px;">For maximum performance and making sure that no functionality is broken the following JavaScript files:</p>
305
<ul style="list-style: disc; margin-left: 25px; margin-bottom: 0;">
306
<li>Any script tag having "defer" or "async" attributes</li>
templates/meta-box-page-options.php ADDED
@@ -0,0 +1,37 @@
1
+ <?php
2
+ /*
3
+ * No direct access to this file
4
+ */
5
+ if (! isset($data)) {
6
+ exit;
7
+ }
8
+ ?>
9
+ <div id="wpacu_meta_box_page_options_content">
10
+ <ul>
11
+ <li>
12
+ <label for="wpacu_page_options_no_css_optimize">
13
+ <input type="checkbox" <?php if (isset($data['page_options']['no_css_optimize']) && $data['page_options']['no_css_optimize']) { echo 'checked="checked"'; } ?>
14
+ id="wpacu_page_options_no_css_optimize"
15
+ name="<?php echo WPACU_PLUGIN_ID; ?>_page_options[no_css_optimize]"
16
+ value="1" />Do not combine CSS on this page
17
+ </label>
18
+ </li>
19
+ <li>
20
+ <label for="wpacu_page_options_no_js_optimize" style="color: rgba(51,51,51,.4);">
21
+ <input disabled="disabled"
22
+ type="checkbox"
23
+ id="wpacu_page_options_no_js_optimize"
24
+ name="<?php echo WPACU_PLUGIN_ID; ?>_page_options[no_js_optimize]"
25
+ value="1" />Do not combine JavaScript on this page (Available in Pro version)
26
+ </label>
27
+ </li>
28
+ <li>
29
+ <label for="wpacu_page_options_no_css_js_file_settings">
30
+ <input type="checkbox" <?php if (isset($data['page_options']['no_assets_settings']) && $data['page_options']['no_assets_settings']) { echo 'checked="checked"'; } ?>
31
+ id="wpacu_page_options_no_css_js_file_settings"
32
+ name="<?php echo WPACU_PLUGIN_ID; ?>_page_options[no_assets_settings]"
33
+ value="1" />Do not apply any CSS &amp; JavaScript settings (including async, defer, load &amp; unload rules) on this page
34
+ </label>
35
+ </li>
36
+ </ul>
37
+ </div>
wpacu.php CHANGED
@@ -2,13 +2,13 @@
2
/*
3
* Plugin Name: Asset CleanUp: Page Speed Booster
4
* Plugin URI: https://wordpress.org/plugins/wp-asset-clean-up/
5
- * Version: 1.2.9.6
6
* Description: Prevent Chosen Scripts & Styles from loading in Posts/Pages to reduce HTTP Requests and have the website load faster
7
* Author: Gabriel Livan
8
* Author URI: http://gabelivan.com/
9
*/
10
11
- define('WPACU_PLUGIN_VERSION', '1.2.9.6');
12
13
// Exit if accessed directly
14
if (! defined('ABSPATH')) {
2
/*
3
* Plugin Name: Asset CleanUp: Page Speed Booster
4
* Plugin URI: https://wordpress.org/plugins/wp-asset-clean-up/
5
+ * Version: 1.2.9.7
6
* Description: Prevent Chosen Scripts & Styles from loading in Posts/Pages to reduce HTTP Requests and have the website load faster
7
* Author: Gabriel Livan
8
* Author URI: http://gabelivan.com/
9
*/
10
11
+ define('WPACU_PLUGIN_VERSION', '1.2.9.7');
12
13
// Exit if accessed directly
14
if (! defined('ABSPATH')) {