Asset CleanUp: Page Speed Booster - Version 1.2.9.9

Version Description

  • Bug Fix: Side "Asset CleanUp: Options" meta box was not showing in the edit page/post within the Dashboard view
Download this release

Release Info

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

Code changes from version 1.2.9.8 to 1.2.9.9

classes/AdminBar.php CHANGED
@@ -51,11 +51,11 @@ class AdminBar
51
'href' => admin_url( 'admin.php?page=' . WPACU_PLUGIN_ID . '_settings')
52
));
53
54
- if (Main::instance()->settings['combine_loaded_css']) {
55
$wp_admin_bar->add_menu( array(
56
'parent' => 'assetcleanup-parent',
57
- 'id' => 'assetcleanup-clear-combined-files-cache',
58
- 'title' => 'Clear Combined Files Cache',
59
'href' => wp_nonce_url( admin_url( 'admin-post.php?action=assetcleanup_clear_assets_cache' . $goBackToCurrentUrl ),
60
'assetcleanup_clear_assets_cache' )
61
) );
51
'href' => admin_url( 'admin.php?page=' . WPACU_PLUGIN_ID . '_settings')
52
));
53
54
+ if (Main::instance()->settings['combine_loaded_css'] || Main::instance()->settings['minify_loaded_css']) {
55
$wp_admin_bar->add_menu( array(
56
'parent' => 'assetcleanup-parent',
57
+ 'id' => 'assetcleanup-clear-css-js-files-cache',
58
+ 'title' => 'Clear CSS/JS Files Cache',
59
'href' => wp_nonce_url( admin_url( 'admin-post.php?action=assetcleanup_clear_assets_cache' . $goBackToCurrentUrl ),
60
'assetcleanup_clear_assets_cache' )
61
) );
classes/Main.php CHANGED
@@ -530,7 +530,8 @@ class Main
530
if (isset($this->wpAllStyles['queue']) && ! empty($this->wpAllStyles['queue'])) {
531
$this->wpAllStyles['queue'] = array_unique( $this->wpAllStyles['queue'] );
532
}
533
- }
534
535
// e.g. for test mode or AJAX calls (where all assets have to load)
536
if ($this->preventUnloadAssets() === true) {
@@ -993,7 +994,7 @@ class Main
993
);
994
995
if (! file_exists($templateFile)) {
996
- wp_die('Template '.$name.' not found.');
997
}
998
999
ob_start();
530
if (isset($this->wpAllStyles['queue']) && ! empty($this->wpAllStyles['queue'])) {
531
$this->wpAllStyles['queue'] = array_unique( $this->wpAllStyles['queue'] );
532
}
533
+
534
+ }
535
536
// e.g. for test mode or AJAX calls (where all assets have to load)
537
if ($this->preventUnloadAssets() === true) {
994
);
995
996
if (! file_exists($templateFile)) {
997
+ return 'Template '.$name.' not found.';
998
}
999
1000
ob_start();
classes/MetaBoxes.php CHANGED
@@ -84,7 +84,7 @@ class MetaBoxes
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',
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',
classes/Misc.php CHANGED
@@ -431,7 +431,7 @@ class Misc
431
return false;
432
}
433
434
- set_transient('wpacu_active_plugins_icons', json_encode($activePluginsIcons), 86400 * 7); // expires in 7 days
435
436
return $activePluginsIcons;
437
}
431
return false;
432
}
433
434
+ set_transient('wpacu_active_plugins_icons', json_encode($activePluginsIcons), 1209600); // in seconds
435
436
return $activePluginsIcons;
437
}
classes/OptimiseAssets/{CombineCommon.php → OptimizeCommon.php} RENAMED
@@ -2,12 +2,13 @@
2
namespace WpAssetCleanUp\OptimiseAssets;
3
4
use WpAssetCleanUp\Misc;
5
6
/**
7
- * Class CombineCommon
8
* @package WpAssetCleanUp
9
*/
10
- class CombineCommon
11
{
12
/**
13
* @var string
@@ -15,7 +16,7 @@ class CombineCommon
15
public static $relPathPluginCacheDir = '/cache/asset-cleanup/';
16
17
/**
18
- * CombineCommon constructor.
19
*/
20
public function __construct()
21
{
@@ -169,7 +170,11 @@ class CombineCommon
169
public static function getHrefRelPath($href)
170
{
171
$parseUrl = parse_url($href);
172
- $hrefHost = $parseUrl['host'];
173
174
// Sometimes host is different on Staging websites such as the ones from Siteground
175
// e.g. staging1.domain.com and domain.com
@@ -215,7 +220,7 @@ class CombineCommon
215
$assetsFile = $dirToFilename . self::filterStorageFileName($jsonStorageFile);
216
217
if ($assetType === 'css') {
218
- $cachedAssetsFileExpiresIn = CombineCss::$cachedCssAssetsFileExpiresIn;
219
}
220
else {
221
return array();
@@ -230,7 +235,7 @@ class CombineCommon
230
$optionValue = @file_get_contents($assetsFile);
231
232
if ($optionValue) {
233
- $optionValueArray = json_decode($optionValue, ARRAY_A);
234
235
$uriToFinalCssFile = $optionValueArray['uri_to_final_css_file'];
236
$linkHrefs = $optionValueArray['link_hrefs'];
@@ -336,6 +341,10 @@ class CombineCommon
336
return;
337
}
338
339
$fileExtToRemove = array('.json');
340
341
// Also delete .css
@@ -366,6 +375,12 @@ class CombineCommon
366
@rmdir($storageEmptyDir);
367
}
368
369
if ( $redirectAfter && wp_get_referer() ) {
370
wp_safe_redirect( wp_get_referer() );
371
}
2
namespace WpAssetCleanUp\OptimiseAssets;
3
4
use WpAssetCleanUp\Misc;
5
+ use WpAssetCleanUp\Tools;
6
7
/**
8
+ * Class OptimizeCommon
9
* @package WpAssetCleanUp
10
*/
11
+ class OptimizeCommon
12
{
13
/**
14
* @var string
16
public static $relPathPluginCacheDir = '/cache/asset-cleanup/';
17
18
/**
19
+ * OptimizeCommon constructor.
20
*/
21
public function __construct()
22
{
170
public static function getHrefRelPath($href)
171
{
172
$parseUrl = parse_url($href);
173
+ $hrefHost = isset($parseUrl['host']) ? $parseUrl['host'] : false;
174
+
175
+ if (! $hrefHost) {
176
+ return $href;
177
+ }
178
179
// Sometimes host is different on Staging websites such as the ones from Siteground
180
// e.g. staging1.domain.com and domain.com
220
$assetsFile = $dirToFilename . self::filterStorageFileName($jsonStorageFile);
221
222
if ($assetType === 'css') {
223
+ $cachedAssetsFileExpiresIn = OptimizeCss::$cachedCssAssetsFileExpiresIn;
224
}
225
else {
226
return array();
235
$optionValue = @file_get_contents($assetsFile);
236
237
if ($optionValue) {
238
+ $optionValueArray = json_decode($optionValue, ARRAY_A);
239
240
$uriToFinalCssFile = $optionValueArray['uri_to_final_css_file'];
241
$linkHrefs = $optionValueArray['link_hrefs'];
341
return;
342
}
343
344
+ /*
345
+ * STEP 1: Clear all .json, .css and .js files that are related to "Combine CSS/JS files" feature
346
+ */
347
+
348
$fileExtToRemove = array('.json');
349
350
// Also delete .css
375
@rmdir($storageEmptyDir);
376
}
377
378
+ /*
379
+ * STEP 2: Remove all transients related to the Minify CSS/JS files feature
380
+ */
381
+ $toolsClass = new Tools();
382
+ $toolsClass->clearAllCacheTransients();
383
+
384
if ( $redirectAfter && wp_get_referer() ) {
385
wp_safe_redirect( wp_get_referer() );
386
}
classes/OptimiseAssets/{CombineCss.php → OptimizeCss.php} RENAMED
@@ -6,10 +6,10 @@ use WpAssetCleanUp\Menu;
6
use WpAssetCleanUp\MetaBoxes;
7
8
/**
9
- * Class CombineCss
10
* @package WpAssetCleanUp
11
*/
12
- class CombineCss
13
{
14
/**
15
* @var string
@@ -19,7 +19,7 @@ class CombineCss
19
/**
20
* @var float|int
21
*/
22
- public static $cachedCssAssetsFileExpiresIn = 60 * 60 * 12; // 8 hours in seconds
23
24
/**
25
* @var string
@@ -32,11 +32,16 @@ class CombineCss
32
public function init()
33
{
34
add_action('wp_loaded', function() {
35
- if (! $this->doCssCombine()) {
36
- return;
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
@@ -59,7 +64,7 @@ class CombineCss
59
60
// Speed up processing by getting the already existing final CSS file URI
61
// This will avoid parsing the HTML DOM and determine the combined URI paths for all the CSS files
62
- $localFinalCssFileData = CombineCommon::getAssetCachedData($this->jsonStorageFile, self::$relPathCssCacheDir, 'css');
63
64
// $uriToFinalCssFile will always be relative ONLY within WP_CONTENT_DIR . self::$relPathCssCacheDir
65
// which is usually "wp-content/cache/asset-cleanup/css/"
@@ -76,7 +81,7 @@ class CombineCss
76
* NO CACHING TRANSIENT; Parse the DOM
77
*/
78
// Nothing in the database records or the retrieved cached file does not exist?
79
- CombineCommon::clearAssetCachedData($this->jsonStorageFile, self::$relPathCssCacheDir);
80
81
// Fetch the DOM, and then set a new transient
82
$document = new \DOMDocument();
@@ -110,11 +115,11 @@ class CombineCss
110
//$htmlSource .= $attrObj->nodeValue."\n";
111
$href = (string)$attrObj->nodeValue;
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
}
@@ -141,7 +146,7 @@ class CombineCss
141
}
142
143
if ($cssNotCombinable) {
144
- $hrefUriNotCombinableList[] = CombineCommon::getHrefRelPath( $href );
145
}
146
}
147
@@ -182,7 +187,7 @@ class CombineCss
182
183
if (file_exists($localFinalCssFile)) {
184
$cachedFileExists = true;
185
- CombineCommon::setAssetCachedData(
186
$this->jsonStorageFile,
187
self::$relPathCssCacheDir,
188
array('uri_to_final_css_file' => $uriToFinalCssFile, 'link_hrefs' => $linkHrefs)
@@ -204,7 +209,7 @@ HTML;
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
210
if ($htmlSource === 'do_not_combine') {
@@ -371,7 +376,7 @@ HTML;
371
}
372
}
373
374
- if (! CombineCommon::doCombineIsRegularPage()) {
375
return false;
376
}
377
6
use WpAssetCleanUp\MetaBoxes;
7
8
/**
9
+ * Class OptimizeCss
10
* @package WpAssetCleanUp
11
*/
12
+ class OptimizeCss
13
{
14
/**
15
* @var string
19
/**
20
* @var float|int
21
*/
22
+ public static $cachedCssAssetsFileExpiresIn = 28800; // 8 hours in seconds (60 * 60 * 8)
23
24
/**
25
* @var string
32
public function init()
33
{
34
add_action('wp_loaded', function() {
35
ob_start(function ($htmlSource) {
36
+ // Do not do any optimization if "Test Mode" is Enabled
37
+ if (Main::instance()->settings['test_mode'] && ! Menu::userCanManageAssets()) {
38
+ return $htmlSource;
39
+ }
40
+
41
+ if (! $this->doCssCombine()) {
42
+ return $htmlSource;
43
+ }
44
+
45
// If "Do not combine CSS on this page" is checked in "Asset CleanUp Options" side meta box
46
$pageOptions = MetaBoxes::getPageOptions(WPACU_CURRENT_PAGE_ID);
47
64
65
// Speed up processing by getting the already existing final CSS file URI
66
// This will avoid parsing the HTML DOM and determine the combined URI paths for all the CSS files
67
+ $localFinalCssFileData = OptimizeCommon::getAssetCachedData($this->jsonStorageFile, self::$relPathCssCacheDir, 'css');
68
69
// $uriToFinalCssFile will always be relative ONLY within WP_CONTENT_DIR . self::$relPathCssCacheDir
70
// which is usually "wp-content/cache/asset-cleanup/css/"
81
* NO CACHING TRANSIENT; Parse the DOM
82
*/
83
// Nothing in the database records or the retrieved cached file does not exist?
84
+ OptimizeCommon::clearAssetCachedData($this->jsonStorageFile, self::$relPathCssCacheDir);
85
86
// Fetch the DOM, and then set a new transient
87
$document = new \DOMDocument();
115
//$htmlSource .= $attrObj->nodeValue."\n";
116
$href = (string)$attrObj->nodeValue;
117
118
+ $localAssetPath = OptimizeCommon::getLocalAssetPath($href, 'css');
119
120
// It will skip external stylesheets (from a different domain)
121
if ($localAssetPath) {
122
+ $combinedUriPaths[] = OptimizeCommon::getHrefRelPath($href);
123
$localAssetsPaths[$href] = $localAssetPath;
124
$linkHrefs[] = $href;
125
}
146
}
147
148
if ($cssNotCombinable) {
149
+ $hrefUriNotCombinableList[] = OptimizeCommon::getHrefRelPath( $href );
150
}
151
}
152
187
188
if (file_exists($localFinalCssFile)) {
189
$cachedFileExists = true;
190
+ OptimizeCommon::setAssetCachedData(
191
$this->jsonStorageFile,
192
self::$relPathCssCacheDir,
193
array('uri_to_final_css_file' => $uriToFinalCssFile, 'link_hrefs' => $linkHrefs)
209
210
$htmlSource = preg_replace('#<head>#si', '<head>'."\n" . $finalCssTag . "\n", $htmlSource, 1);
211
212
+ $htmlSource = OptimizeCommon::stripJustCombinedFileTags($linkHrefs, $htmlSource, 'css'); // Strip the combined files to avoid duplicate code
213
214
// There should be at least two replacements made
215
if ($htmlSource === 'do_not_combine') {
376
}
377
}
378
379
+ if (! OptimizeCommon::doCombineIsRegularPage()) {
380
return false;
381
}
382
classes/Plugin.php CHANGED
@@ -75,7 +75,7 @@ class Plugin
75
*/
76
public static function createCacheFoldersFiles()
77
{
78
- $cacheCssDir = WP_CONTENT_DIR . OptimiseAssets\CombineCss::$relPathCssCacheDir;
79
80
$emptyPhpFileContents = <<<TEXT
81
<?php
@@ -102,11 +102,20 @@ HTACCESS;
102
@mkdir( $cacheCssDir . 'logged-in', 0755 );
103
}
104
105
if (! is_file($cacheCssDir . 'logged-in/index.php')) {
106
// /wp-content/cache/asset-cleanup/cache/css/logged-in/index.html
107
@file_put_contents( $cacheCssDir . 'logged-in/index.php', $emptyPhpFileContents );
108
}
109
110
$htAccessFilePath = dirname($cacheCssDir) . '/.htaccess';
111
112
if (! is_file($htAccessFilePath)) {
75
*/
76
public static function createCacheFoldersFiles()
77
{
78
+ $cacheCssDir = WP_CONTENT_DIR . OptimiseAssets\OptimizeCss::$relPathCssCacheDir;
79
80
$emptyPhpFileContents = <<<TEXT
81
<?php
102
@mkdir( $cacheCssDir . 'logged-in', 0755 );
103
}
104
105
+ if (! is_dir($cacheCssDir . 'min')) {
106
+ @mkdir( $cacheCssDir . 'min', 0755 );
107
+ }
108
+
109
if (! is_file($cacheCssDir . 'logged-in/index.php')) {
110
// /wp-content/cache/asset-cleanup/cache/css/logged-in/index.html
111
@file_put_contents( $cacheCssDir . 'logged-in/index.php', $emptyPhpFileContents );
112
}
113
114
+ if (! is_file($cacheCssDir . 'min/index.php')) {
115
+ // /wp-content/cache/asset-cleanup/cache/css/min/index.html
116
+ @file_put_contents( $cacheCssDir . 'min/index.php', $emptyPhpFileContents );
117
+ }
118
+
119
$htAccessFilePath = dirname($cacheCssDir) . '/.htaccess';
120
121
if (! is_file($htAccessFilePath)) {
classes/Settings.php CHANGED
@@ -1,7 +1,7 @@
1
<?php
2
namespace WpAssetCleanUp;
3
4
- use WpAssetCleanUp\OptimiseAssets\CombineCommon;
5
6
/**
7
* Class Settings
@@ -30,6 +30,9 @@ class Settings
30
// Combine loaded CSS (remaining ones after unloading the useless ones) into one file
31
'combine_loaded_css',
32
33
'disable_emojis',
34
35
// Stored in 'wpassetcleanup_global_unload' option
@@ -229,7 +232,7 @@ class Settings
229
*/
230
public function update($settings)
231
{
232
- CombineCommon::clearAllCache();
233
234
$wpacuUpdate = new Update;
235
@@ -293,14 +296,4 @@ class Settings
293
update_option(WPACU_PLUGIN_ID . '_settings', json_encode($settings), 'no');
294
$this->status['updated'] = true;
295
}
296
-
297
- /**
298
- *
299
- */
300
- public static function clearAllCache()
301
- {
302
- // Clear "Combined CSS/JS Loaded Files" Cache
303
- CombineCommon::clearAllCache();
304
-
305
- }
306
}
1
<?php
2
namespace WpAssetCleanUp;
3
4
+ use WpAssetCleanUp\OptimiseAssets\OptimizeCommon;
5
6
/**
7
* Class Settings
30
// Combine loaded CSS (remaining ones after unloading the useless ones) into one file
31
'combine_loaded_css',
32
33
+ // Minify each loaded CSS (remaining ones after unloading the useless ones)
34
+ 'minify_loaded_css',
35
+
36
'disable_emojis',
37
38
// Stored in 'wpassetcleanup_global_unload' option
232
*/
233
public function update($settings)
234
{
235
+ OptimizeCommon::clearAllCache();
236
237
$wpacuUpdate = new Update;
238
296
update_option(WPACU_PLUGIN_ID . '_settings', json_encode($settings), 'no');
297
$this->status['updated'] = true;
298
}
299
}
classes/Tools.php CHANGED
@@ -318,23 +318,7 @@ SQL;
318
}
319
320
// Remove Asset CleanUp's cache transients
321
- $transientLikes = array(
322
- '_transient_timeout_wpacu_',
323
- '_transient_wpacu_',
324
- );
325
-
326
- $transientLikesSql = '';
327
-
328
- foreach ($transientLikes as $transientLike) {
329
- $transientLikesSql .= " option_name LIKE '%".$transientLike."%' OR ";
330
- }
331
-
332
- $transientLikesSql = rtrim($transientLikesSql, ' OR ');
333
-
334
- $sqlQuery = <<<SQL
335
- DELETE FROM `{$wpdb->prefix}options` WHERE {$transientLikesSql}
336
- SQL;
337
- $wpdb->query($sqlQuery);
338
339
// Refers to the plugins' icons shown when viewing assets list by location is enabled
340
delete_transient('wpacu_active_plugins_icons');
@@ -358,6 +342,37 @@ SQL;
358
add_action('wpacu_admin_notices', array($this, 'resetDone'));
359
}
360
361
/**
362
*
363
*/
318
}
319
320
// Remove Asset CleanUp's cache transients
321
+ $this->clearAllCacheTransients();
322
323
// Refers to the plugins' icons shown when viewing assets list by location is enabled
324
delete_transient('wpacu_active_plugins_icons');
342
add_action('wpacu_admin_notices', array($this, 'resetDone'));
343
}
344
345
+ /**
346
+ * Remove Asset CleanUp's Cache Transients
347
+ */
348
+ public function clearAllCacheTransients()
349
+ {
350
+ global $wpdb;
351
+
352
+ $transientLikes = array(
353
+ // CSS
354
+ '_transient_timeout_wpacu_css_',
355
+ '_transient_wpacu_css_',
356
+
357
+ // JS
358
+ '_transient_timeout_wpacu_js_',
359
+ '_transient_wpacu_js_',
360
+ );
361
+
362
+ $transientLikesSql = '';
363
+
364
+ foreach ($transientLikes as $transientLike) {
365
+ $transientLikesSql .= " option_name LIKE '%".$transientLike."%' OR ";
366
+ }
367
+
368
+ $transientLikesSql = rtrim($transientLikesSql, ' OR ');
369
+
370
+ $sqlQuery = <<<SQL
371
+ DELETE FROM `{$wpdb->prefix}options` WHERE {$transientLikesSql}
372
+ SQL;
373
+ $wpdb->query($sqlQuery);
374
+ }
375
+
376
/**
377
*
378
*/
classes/Update.php CHANGED
@@ -1,6 +1,8 @@
1
<?php
2
namespace WpAssetCleanUp;
3
4
/**
5
* Class Update
6
* @package WpAssetCleanUp
@@ -259,7 +261,7 @@ HTML;
259
$this->removeBulkUnloads();
260
261
// Clear all cache
262
- Settings::clearAllCache();
263
}
264
265
/**
@@ -294,7 +296,7 @@ HTML;
294
$this->frontEndUpdateFor['homepage'] = true;
295
296
// Clear all cache
297
- Settings::clearAllCache();
298
}
299
300
/**
1
<?php
2
namespace WpAssetCleanUp;
3
4
+ use WpAssetCleanUp\OptimiseAssets\OptimizeCommon;
5
+
6
/**
7
* Class Update
8
* @package WpAssetCleanUp
261
$this->removeBulkUnloads();
262
263
// Clear all cache
264
+ OptimizeCommon::clearAllCache();
265
}
266
267
/**
296
$this->frontEndUpdateFor['homepage'] = true;
297
298
// Clear all cache
299
+ OptimizeCommon::clearAllCache();
300
}
301
302
/**
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.8
8
License: GPLv3
9
License URI: http://www.gnu.org/licenses/gpl.html
10
@@ -132,6 +132,9 @@ With the recently released "Test Mode" feature, you can safely unload assets on
132
4. Scripts (.JS) are selected for site-wide unload
133
134
== Changelog ==
135
= 1.2.9.8 =
136
* New Feature: "Asset CleanUp: Options" side meta box showing options to disable plugin functionality for posts, pages and custom post types; Ideal to use with the "Preview" feature if you wish to see how a page loads/looks before publishing any changes
137
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.9
8
License: GPLv3
9
License URI: http://www.gnu.org/licenses/gpl.html
10
132
4. Scripts (.JS) are selected for site-wide unload
133
134
== Changelog ==
135
+ = 1.2.9.9 =
136
+ * Bug Fix: Side "Asset CleanUp: Options" meta box was not showing in the edit page/post within the Dashboard view
137
+
138
= 1.2.9.8 =
139
* New Feature: "Asset CleanUp: Options" side meta box showing options to disable plugin functionality for posts, pages and custom post types; Ideal to use with the "Preview" feature if you wish to see how a page loads/looks before publishing any changes
140
templates/admin-page-settings-plugin.php CHANGED
@@ -23,6 +23,7 @@ do_action('wpacu_admin_notices');
23
<div class="wpacu-settings-tab">
24
<a href="#wpacu-setting-plugin-usage-settings" class="wpacu-settings-tab-link active" onclick="wpacuTabOpenSettingsArea(event, 'wpacu-setting-plugin-usage-settings');"><?php _e('General &amp; Files Management', WPACU_PLUGIN_TEXT_DOMAIN); ?></a>
25
<a href="#wpacu-setting-test-mode" class="wpacu-settings-tab-link" onclick="wpacuTabOpenSettingsArea(event, 'wpacu-setting-test-mode');"><?php _e('Test Mode', WPACU_PLUGIN_TEXT_DOMAIN); ?></a>
26
<a href="#wpacu-setting-combine-loaded-files" class="wpacu-settings-tab-link" onclick="wpacuTabOpenSettingsArea(event, 'wpacu-setting-combine-loaded-files');"><?php _e('Combine CSS &amp; JS Files', WPACU_PLUGIN_TEXT_DOMAIN); ?></a>
27
<a href="#wpacu-setting-common-files-unload" class="wpacu-settings-tab-link" onclick="wpacuTabOpenSettingsArea(event, 'wpacu-setting-common-files-unload');"><?php _e('Common Elements Unload', WPACU_PLUGIN_TEXT_DOMAIN); ?></a>
28
<a href="#wpacu-setting-head-cleanup" class="wpacu-settings-tab-link" onclick="wpacuTabOpenSettingsArea(event, 'wpacu-setting-head-cleanup');"><?php _e('&lthead&gt; CleanUp', WPACU_PLUGIN_TEXT_DOMAIN); ?></a>
@@ -263,8 +264,10 @@ do_action('wpacu_admin_notices');
263
</table>
264
</div>
265
266
<div id="wpacu-setting-combine-loaded-files" class="wpacu-settings-tab-content">
267
- <h2><?php _e('Combine loaded CSS &amp; JavaScript files into fewer files', WPACU_PLUGIN_TEXT_DOMAIN); ?></h2>
268
<p><?php echo $settingsWithLock; ?></p>
269
<table class="wpacu-form-table">
270
<tr valign="top">
23
<div class="wpacu-settings-tab">
24
<a href="#wpacu-setting-plugin-usage-settings" class="wpacu-settings-tab-link active" onclick="wpacuTabOpenSettingsArea(event, 'wpacu-setting-plugin-usage-settings');"><?php _e('General &amp; Files Management', WPACU_PLUGIN_TEXT_DOMAIN); ?></a>
25
<a href="#wpacu-setting-test-mode" class="wpacu-settings-tab-link" onclick="wpacuTabOpenSettingsArea(event, 'wpacu-setting-test-mode');"><?php _e('Test Mode', WPACU_PLUGIN_TEXT_DOMAIN); ?></a>
26
+ <!-- -->
27
<a href="#wpacu-setting-combine-loaded-files" class="wpacu-settings-tab-link" onclick="wpacuTabOpenSettingsArea(event, 'wpacu-setting-combine-loaded-files');"><?php _e('Combine CSS &amp; JS Files', WPACU_PLUGIN_TEXT_DOMAIN); ?></a>
28
<a href="#wpacu-setting-common-files-unload" class="wpacu-settings-tab-link" onclick="wpacuTabOpenSettingsArea(event, 'wpacu-setting-common-files-unload');"><?php _e('Common Elements Unload', WPACU_PLUGIN_TEXT_DOMAIN); ?></a>
29
<a href="#wpacu-setting-head-cleanup" class="wpacu-settings-tab-link" onclick="wpacuTabOpenSettingsArea(event, 'wpacu-setting-head-cleanup');"><?php _e('&lthead&gt; CleanUp', WPACU_PLUGIN_TEXT_DOMAIN); ?></a>
264
</table>
265
</div>
266
267
+ <!-- -->
268
+
269
<div id="wpacu-setting-combine-loaded-files" class="wpacu-settings-tab-content">
270
+ <h2><?php _e('Combine loaded CSS &amp; JavaScript files into fewer files to reduce HTTP Requests', WPACU_PLUGIN_TEXT_DOMAIN); ?></h2>
271
<p><?php echo $settingsWithLock; ?></p>
272
<table class="wpacu-form-table">
273
<tr valign="top">
templates/meta-box-side-page-options.php CHANGED
@@ -5,41 +5,52 @@
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"
14
<?php if (isset($data['page_options']['no_css_optimize']) && $data['page_options']['no_css_optimize']) { echo 'checked="checked"'; } ?>
15
id="wpacu_page_options_no_css_optimize"
16
name="<?php echo WPACU_PLUGIN_ID; ?>_page_options[no_css_optimize]"
17
- value="1" />Do not combine CSS on this page
18
</label>
19
</li>
20
<li>
21
<label for="wpacu_page_options_no_js_optimize" style="color: rgba(51,51,51,.4);">
22
<input disabled="disabled"
23
type="checkbox"
24
id="wpacu_page_options_no_js_optimize"
25
name="<?php echo WPACU_PLUGIN_ID; ?>_page_options[no_js_optimize]"
26
- value="1" />Do not combine JavaScript on this page (Available in Pro version)
27
- </label>
28
</li>
29
<li>
30
<label for="wpacu_page_options_no_assets_settings">
31
<input type="checkbox"
32
<?php if (isset($data['page_options']['no_assets_settings']) && $data['page_options']['no_assets_settings']) { echo 'checked="checked"'; } ?>
33
id="wpacu_page_options_no_assets_settings"
34
name="<?php echo WPACU_PLUGIN_ID; ?>_page_options[no_assets_settings]"
35
- value="1" />Do not apply any CSS &amp; JavaScript settings (including async, defer, load &amp; unload rules) on this page
36
</label>
37
</li>
38
</ul>
39
<!--
40
-->
41
<hr/>
42
- <p style="margin-top: 10px;"><strong><span style="color: #82878c;" class="dashicons dashicons-lightbulb"></span></strong> Use the "Preview" button if you wish to see how the options above, as well as the load/unload rules will apply before updating anything. It works like the "Test Mode" feature for this page only.</p>
43
<!--
44
-->
45
</div>
5
if (! isset($data)) {
6
exit;
7
}
8
+
9
+ $availableForPro = '<a style="color: rgba(51,51,51,.4);" href="'.WPACU_PLUGIN_GO_PRO_URL.'?utm_source=edit_page_side_meta_box" class="go-pro-link-no-style"><span class="wpacu-tooltip" style="width: auto; margin-left: -32px;">Upgrade</span> <img style="opacity: 0.4;" width="20" height="20" src="'.WPACU_PLUGIN_URL.'/assets/icons/icon-lock.svg" valign="top" alt="" /></a>';
10
?>
11
<div id="wpacu_meta_box_page_options_content">
12
<ul>
13
+ <!--
14
+ -->
15
+
16
<li>
17
<label for="wpacu_page_options_no_css_optimize">
18
<input type="checkbox"
19
<?php if (isset($data['page_options']['no_css_optimize']) && $data['page_options']['no_css_optimize']) { echo 'checked="checked"'; } ?>
20
id="wpacu_page_options_no_css_optimize"
21
name="<?php echo WPACU_PLUGIN_ID; ?>_page_options[no_css_optimize]"
22
+ value="1" />Do not combine CSS files on this page
23
</label>
24
</li>
25
+
26
+ <!--
27
+ -->
28
+
29
<li>
30
<label for="wpacu_page_options_no_js_optimize" style="color: rgba(51,51,51,.4);">
31
<input disabled="disabled"
32
type="checkbox"
33
id="wpacu_page_options_no_js_optimize"
34
name="<?php echo WPACU_PLUGIN_ID; ?>_page_options[no_js_optimize]"
35
+ value="1" />Do not combine JS files on this page (Pro version) <?php echo $availableForPro; ?></label>
36
</li>
37
+
38
<li>
39
<label for="wpacu_page_options_no_assets_settings">
40
<input type="checkbox"
41
<?php if (isset($data['page_options']['no_assets_settings']) && $data['page_options']['no_assets_settings']) { echo 'checked="checked"'; } ?>
42
id="wpacu_page_options_no_assets_settings"
43
name="<?php echo WPACU_PLUGIN_ID; ?>_page_options[no_assets_settings]"
44
+ value="1" />Do not apply any CSS &amp; JS settings (including async, defer, load &amp; unload rules) on this page
45
</label>
46
</li>
47
</ul>
48
<!--
49
-->
50
<hr/>
51
+ <p style="margin-top: 10px;">
52
+ <strong><span style="color: #82878c;" class="dashicons dashicons-lightbulb"></span></strong> Use the "Preview" button if you wish to see how the options above, as well as the load/unload rules will apply before updating anything. It works like the "Test Mode" feature for this page only.
53
+ </p>
54
<!--
55
-->
56
</div>
wpacu-load.php CHANGED
@@ -56,11 +56,11 @@ new \WpAssetCleanUp\AdminBar();
56
* Trigger the CSS & JS combination only in the front-end view in certain conditions (not within the Dashboard)
57
*/
58
// Common functions for both CSS & JS combinations
59
- new \WpAssetCleanUp\OptimiseAssets\CombineCommon();
60
61
- // Combine CSS Files Setup
62
- $wpacuCombineCss = new \WpAssetCleanUp\OptimiseAssets\CombineCss();
63
- $wpacuCombineCss->init();
64
65
if (is_admin()) {
66
new \WpAssetCleanUp\Plugin;
56
* Trigger the CSS & JS combination only in the front-end view in certain conditions (not within the Dashboard)
57
*/
58
// Common functions for both CSS & JS combinations
59
+ new \WpAssetCleanUp\OptimiseAssets\OptimizeCommon();
60
61
+ // Combine/Minify CSS Files Setup
62
+ $wpacuOptimizeCss = new \WpAssetCleanUp\OptimiseAssets\OptimizeCss();
63
+ $wpacuOptimizeCss->init();
64
65
if (is_admin()) {
66
new \WpAssetCleanUp\Plugin;
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.8
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.8');
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.9
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.9');
12
13
// Exit if accessed directly
14
if (! defined('ABSPATH')) {