Asset CleanUp: Page Speed Booster - Version 1.2.9.8

Version Description

  • 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
Download this release

Release Info

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

Code changes from version 1.2.9.7 to 1.2.9.8

classes/Main.php CHANGED
@@ -1,8 +1,6 @@
1
  <?php
2
  namespace WpAssetCleanUp;
3
 
4
- use FakerPress\Module\Meta;
5
-
6
  /**
7
  * Class Main
8
  * @package WpAssetCleanUp
1
  <?php
2
  namespace WpAssetCleanUp;
3
 
 
 
4
  /**
5
  * Class Main
6
  * @package WpAssetCleanUp
classes/MetaBoxes.php CHANGED
@@ -100,10 +100,9 @@ class MetaBoxes
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
  *
@@ -118,7 +117,8 @@ class MetaBoxes
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();
100
  {
101
  $data = array('page_options' => self::getPageOptions());
102
 
103
+ Main::instance()->parseTemplate('meta-box-side-page-options', $data, true);
104
  }
105
 
 
106
  /**
107
  * @param int $postId
108
  *
117
 
118
  if ($postId > 1) {
119
  $metaPageOptionsJson = get_post_meta($postId, '_'.WPACU_PLUGIN_ID.'_page_options', true);
120
+
121
+ return @json_decode( $metaPageOptionsJson, ARRAY_A );
122
  }
123
 
124
  return array();
classes/OptimiseAssets/CombineCommon.php CHANGED
@@ -195,10 +195,11 @@ class CombineCommon
195
  {
196
  // Only clean request URIs allowed
197
  if (strpos($_SERVER['REQUEST_URI'], '?') !== false) {
198
- return array();
 
 
199
  }
200
 
201
- $requestUri = $_SERVER['REQUEST_URI'];
202
  $requestUriPart = $requestUri;
203
 
204
  if ($requestUri === '/') {
@@ -258,10 +259,11 @@ class CombineCommon
258
  {
259
  // Only clean request URIs allowed
260
  if (strpos($_SERVER['REQUEST_URI'], '?') !== false) {
261
- return;
 
 
262
  }
263
 
264
- $requestUri = $_SERVER['REQUEST_URI'];
265
  $requestUriPart = $requestUri;
266
 
267
  if ($requestUri === '/') {
@@ -298,10 +300,11 @@ class CombineCommon
298
  {
299
  // Only clean request URIs allowed
300
  if (strpos($_SERVER['REQUEST_URI'], '?') !== false) {
301
- return;
 
 
302
  }
303
 
304
- $requestUri = $_SERVER['REQUEST_URI'];
305
  $requestUriPart = $requestUri;
306
 
307
  if ($requestUri === '/') {
195
  {
196
  // Only clean request URIs allowed
197
  if (strpos($_SERVER['REQUEST_URI'], '?') !== false) {
198
+ list($requestUri) = explode('?', $_SERVER['REQUEST_URI']);
199
+ } else {
200
+ $requestUri = $_SERVER['REQUEST_URI'];
201
  }
202
 
 
203
  $requestUriPart = $requestUri;
204
 
205
  if ($requestUri === '/') {
259
  {
260
  // Only clean request URIs allowed
261
  if (strpos($_SERVER['REQUEST_URI'], '?') !== false) {
262
+ list($requestUri) = explode('?', $_SERVER['REQUEST_URI']);
263
+ } else {
264
+ $requestUri = $_SERVER['REQUEST_URI'];
265
  }
266
 
 
267
  $requestUriPart = $requestUri;
268
 
269
  if ($requestUri === '/') {
300
  {
301
  // Only clean request URIs allowed
302
  if (strpos($_SERVER['REQUEST_URI'], '?') !== false) {
303
+ list($requestUri) = explode('?', $_SERVER['REQUEST_URI']);
304
+ } else {
305
+ $requestUri = $_SERVER['REQUEST_URI'];
306
  }
307
 
 
308
  $requestUriPart = $requestUri;
309
 
310
  if ($requestUri === '/') {
classes/OptimiseAssets/CombineCss.php CHANGED
@@ -363,7 +363,12 @@ HTML;
363
 
364
  // Only clean request URIs allowed
365
  if (strpos($_SERVER['REQUEST_URI'], '?') !== false) {
366
- return false;
 
 
 
 
 
367
  }
368
 
369
  if (! CombineCommon::doCombineIsRegularPage()) {
363
 
364
  // Only clean request URIs allowed
365
  if (strpos($_SERVER['REQUEST_URI'], '?') !== false) {
366
+ // Exceptions
367
+ $isPreview = (isset($_GET['preview_id'], $_GET['preview_nonce'], $_GET['preview']) || isset($_GET['preview']));
368
+
369
+ if (! $isPreview) {
370
+ return false;
371
+ }
372
  }
373
 
374
  if (! CombineCommon::doCombineIsRegularPage()) {
classes/Update.php CHANGED
@@ -192,9 +192,9 @@ HTML;
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;
@@ -417,6 +417,12 @@ HTML;
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)) {
192
  */
193
  public function savePost($postId, $post = array())
194
  {
195
+ if (empty($post) || $post === '') {
196
+ global $post;
197
+ }
198
 
199
  if (! isset($post->ID) || ! isset($post->post_type)) {
200
  return;
417
  ? $_POST[WPACU_PLUGIN_ID.'_page_options']
418
  : array();
419
 
420
+ // In order for the "Apply the selected options" to work
421
+ // At least one of the checkboxes above have to be enabled
422
+ if (isset($pageOptions['apply_options_for']) && $pageOptions['apply_options_for'] && count($pageOptions) === 1) {
423
+ $pageOptions = array();
424
+ }
425
+
426
  // No page options? Delete any entry from the database to free up space
427
  // instead of updating it as an empty entry
428
  if (empty($pageOptions)) {
readme.txt CHANGED
@@ -4,15 +4,16 @@ 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.7
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl.html
10
 
11
  Make your website load FASTER by preventing specific scripts (.JS) & styles (.CSS) from loading on pages/posts and home page. Works best in addition to a cache plugin!
12
 
13
  == Description ==
14
- * Make your web pages load FASTER with **Asset CleanUp: Page Speed Booster**
15
- * Faster page load = Happier Visitors = More Conversions = More Revenue
 
16
 
17
  There are often times when you are using a theme and a number of plugins which are enabled and run on the same page. However, you don't need to use all of them and to improve the speed of your website and make the HTML source code cleaner (convenient for debugging purposes), it's better to prevent those styles and scripts from loading.
18
 
@@ -131,6 +132,9 @@ 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.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
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
 
11
  Make your website load FASTER by preventing specific scripts (.JS) & styles (.CSS) from loading on pages/posts and home page. Works best in addition to a cache plugin!
12
 
13
  == Description ==
14
+ Don't just minify & combine CSS/JavaScript files: **strip the "fat" and get a faster page load** :)
15
+
16
+ Faster page load = Happier Visitors = More Conversions = More Revenue
17
 
18
  There are often times when you are using a theme and a number of plugins which are enabled and run on the same page. However, you don't need to use all of them and to improve the speed of your website and make the HTML source code cleaner (convenient for debugging purposes), it's better to prevent those styles and scripts from loading.
19
 
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
+
138
  = 1.2.9.7 =
139
  * Bug Fix: Prevent fatal error from showing in PHP 5.4 when the plugin was updated
140
  * Re-organised the plugin's links within the Dashboard to make it easier to navigate through
templates/{meta-box-page-options.php → meta-box-side-page-options.php} RENAMED
@@ -10,7 +10,8 @@ if (! isset($data)) {
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
@@ -26,12 +27,19 @@ if (! isset($data)) {
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>
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
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>
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.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')) {
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')) {