Asset CleanUp: Page Speed Booster - Version 1.2.6.8

Version Description

  • Important: If you use the premium extension, please upgrade to 1.0.3
  • Removed "WP" from the plugin's title
  • Prevent the LITE plugin from loading if the PRO version is enabled as loading both plugins is not relevant anymore
  • Avoided loading Asset CleanUp Lite's own CSS and JS within the Dashboard view as they are irrelevant since the're only loaded for the admins that manage the plugin
Download this release

Release Info

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

Code changes from version 1.2.6.7 to 1.2.6.8

assets/script.js CHANGED
@@ -149,6 +149,15 @@ jQuery(document).ready(function($) {
149
  $('#wpacu_post_type_form').submit();
150
  });
151
 
 
 
 
 
 
 
 
 
 
152
  // Items are marked for removal from the unload list
153
  // from either "Everywhere" or "Post Type"
154
  $('.wpacu_remove_rule').click(function() {
149
  $('#wpacu_post_type_form').submit();
150
  });
151
 
152
+ // Manage in Dashboard Clicked
153
+ $('#wpacu_dashboard').click(function() {
154
+ if ($(this).prop('checked')) {
155
+ $('#wpacu-settings-assets-retrieval-mode').fadeIn();
156
+ } else {
157
+ $('#wpacu-settings-assets-retrieval-mode').fadeOut();
158
+ }
159
+ });
160
+
161
  // Items are marked for removal from the unload list
162
  // from either "Everywhere" or "Post Type"
163
  $('.wpacu_remove_rule').click(function() {
assets/script.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(a){var b={load:function(){var b,c=".icheckbox_square-red";a(c).iCheck({checkboxClass:"icheckbox_square-red"}),a(c).on("ifChecked",function(b){a(b.target).closest("tr").addClass("wpacu_not_load")}),a(c).on("ifUnchecked",function(b){a(b.target).closest("tr").removeClass("wpacu_not_load")}),a(".wpacu_global_unload").click(function(){b=a(this).attr("data-handle"),a(this).prop("checked")?a(this).parent("label").addClass("wpacu_global_checked"):a(this).parent("label").removeClass("wpacu_global_checked")}),a(".wpacu_keep_bulk_rule").click(function(){a(this).prop("checked")&&a(this).parents("li").next().removeClass("remove_rule")}),a(".wpacu_remove_bulk_rule").click(function(){a(this).prop("checked")&&a(this).parents("li").addClass("remove_rule")}),a(".wpacu_bulk_unload").click(function(){a(this).prop("checked")?a(this).parent("label").addClass("wpacu_bulk_unload_active"):a(this).parent("label").removeClass("wpacu_bulk_unload_active")}),a(".wpacu_load_it_option").click(function(){var b=a(this).attr("data-handle");if(a(this).prop("checked")){a(this).parent("label").addClass("wpacu_global_unload_exception");var c="";a(this).hasClass("wpacu_style")?c="style":a(this).hasClass("wpacu_script")&&(c="script"),a("#"+c+"_"+b).iCheck("uncheck")}else a(this).parent("label").removeClass("wpacu_global_unload_exception")})}};if(a("#wpacu_post_type_select").change(function(){a("#wpacu_post_type_form").submit()}),a(".wpacu_remove_rule").click(function(){var b=a(this).parents(".wpacu_global_rule_row");a(this).prop("checked")?b.addClass("selected"):b.removeClass("selected")}),a("#wpacu_wrap_assets").length>0&&b.load(),"undefined"==typeof wpacu_object||a("#wpacu_meta_box_content").length<1)return!1;var c={};"direct"===wpacu_object.dom_get_type?(c[wpacu_object.plugin_name+"_load"]=1,a.ajax({method:"GET",url:wpacu_object.page_url,data:c,cache:!1}).done(function(c){var d=c.substring(c.lastIndexOf(wpacu_object.start_del)+wpacu_object.start_del.length,c.lastIndexOf(wpacu_object.end_del)),e={action:wpacu_object.plugin_name+"_get_loaded_assets",wpacu_list:d,post_id:wpacu_object.post_id,page_url:wpacu_object.page_url,tag_id:wpacu_object.tag_id};if("btoa"in window)try{c=c.replace(/[\u0250-\ue007]/g,""),c=c.replace(/[^\x00-\x7F]/g,""),e.contents=window.btoa(c)}catch(a){e.contents=""}a.post(wpacu_object.ajax_url,e,function(c){return!!c&&(a("#wpacu_meta_box_content").html(c),a("#wpacu_home_page_form").length>0&&a("#submit").show(),void b.load())})})):"wp_remote_post"===wpacu_object.dom_get_type&&(c={action:wpacu_object.plugin_name+"_get_loaded_assets",post_id:wpacu_object.post_id,page_url:wpacu_object.page_url,tag_id:wpacu_object.tag_id},a.post(wpacu_object.ajax_url,c,function(c){return!!c&&(a("#wpacu_meta_box_content").html(c),a("#wpacu_home_page_form").length>0&&a("#submit").show(),void b.load())}))});
1
+ jQuery(document).ready(function(a){var b={load:function(){var b,c=".icheckbox_square-red";a(c).iCheck({checkboxClass:"icheckbox_square-red"}),a(c).on("ifChecked",function(b){a(b.target).closest("tr").addClass("wpacu_not_load")}),a(c).on("ifUnchecked",function(b){a(b.target).closest("tr").removeClass("wpacu_not_load")}),a(".wpacu_global_unload").click(function(){b=a(this).attr("data-handle"),a(this).prop("checked")?a(this).parent("label").addClass("wpacu_global_checked"):a(this).parent("label").removeClass("wpacu_global_checked")}),a(".wpacu_keep_bulk_rule").click(function(){a(this).prop("checked")&&a(this).parents("li").next().removeClass("remove_rule")}),a(".wpacu_remove_bulk_rule").click(function(){a(this).prop("checked")&&a(this).parents("li").addClass("remove_rule")}),a(".wpacu_bulk_unload").click(function(){a(this).prop("checked")?a(this).parent("label").addClass("wpacu_bulk_unload_active"):a(this).parent("label").removeClass("wpacu_bulk_unload_active")}),a(".wpacu_load_it_option").click(function(){var b=a(this).attr("data-handle");if(a(this).prop("checked")){a(this).parent("label").addClass("wpacu_global_unload_exception");var c="";a(this).hasClass("wpacu_style")?c="style":a(this).hasClass("wpacu_script")&&(c="script"),a("#"+c+"_"+b).iCheck("uncheck")}else a(this).parent("label").removeClass("wpacu_global_unload_exception")})}};if(a("#wpacu_post_type_select").change(function(){a("#wpacu_post_type_form").submit()}),a("#wpacu_dashboard").click(function(){a(this).prop("checked")?a("#wpacu-settings-assets-retrieval-mode").fadeIn():a("#wpacu-settings-assets-retrieval-mode").fadeOut()}),a(".wpacu_remove_rule").click(function(){var b=a(this).parents(".wpacu_global_rule_row");a(this).prop("checked")?b.addClass("selected"):b.removeClass("selected")}),a("#wpacu_wrap_assets").length>0&&b.load(),"undefined"==typeof wpacu_object||a("#wpacu_meta_box_content").length<1)return!1;var c={};"direct"===wpacu_object.dom_get_type?(c[wpacu_object.plugin_name+"_load"]=1,a.ajax({method:"GET",url:wpacu_object.page_url,data:c,cache:!1}).done(function(c){var d=c.substring(c.lastIndexOf(wpacu_object.start_del)+wpacu_object.start_del.length,c.lastIndexOf(wpacu_object.end_del)),e={action:wpacu_object.plugin_name+"_get_loaded_assets",wpacu_list:d,post_id:wpacu_object.post_id,page_url:wpacu_object.page_url,tag_id:wpacu_object.tag_id};if("btoa"in window)try{c=c.replace(/[\u0250-\ue007]/g,""),c=c.replace(/[^\x00-\x7F]/g,""),e.contents=window.btoa(c)}catch(a){e.contents=""}a.post(wpacu_object.ajax_url,e,function(c){return!!c&&(a("#wpacu_meta_box_content").html(c),a("#wpacu_home_page_form").length>0&&a("#submit").show(),void b.load())})})):"wp_remote_post"===wpacu_object.dom_get_type&&(c={action:wpacu_object.plugin_name+"_get_loaded_assets",post_id:wpacu_object.post_id,page_url:wpacu_object.page_url,tag_id:wpacu_object.tag_id},a.post(wpacu_object.ajax_url,c,function(c){return!!c&&(a("#wpacu_meta_box_content").html(c),a("#wpacu_home_page_form").length>0&&a("#submit").show(),void b.load())}))});
classes/Main.php CHANGED
@@ -267,7 +267,7 @@ class Main
267
  if (isset($obj->public) && $obj->public > 0) {
268
  add_meta_box(
269
  WPACU_PLUGIN_NAME.'_asset_list',
270
- __('WP Asset CleanUp', WPACU_PLUGIN_NAME),
271
  array($this, 'renderMetaBoxContent'),
272
  $postType,
273
  'advanced',
@@ -546,10 +546,12 @@ class Main
546
  WPACU_PLUGIN_NAME . '_front_page_load_exceptions'
547
  );
548
  } elseif (Main::wpacuProEnabled() && $type == 'for_pro') {
549
- if (class_exists('\\WpAssetCleanUpPro\\Exceptions')) {
550
- $ExceptionsPro = new \WpAssetCleanUpPro\Exceptions();
 
551
  $exceptionsListJson = $ExceptionsPro->getLoadExceptions();
552
  }
 
553
  }
554
 
555
  if ($exceptionsListJson) {
@@ -708,7 +710,9 @@ class Main
708
  }
709
  }
710
 
 
711
  $currentUnloadedAll = apply_filters('wpacu_pro_filter_all_bulk_unloads', $currentUnloadedAll);
 
712
 
713
  /*
714
  * Style List
@@ -727,7 +731,7 @@ class Main
727
  }
728
 
729
  foreach ($wp_styles->done as $handle) {
730
- if ($isFrontEndView && in_array($handle, $skipStyles)) {
731
  continue;
732
  }
733
 
@@ -745,7 +749,7 @@ class Main
745
  // Append unloaded ones (if any)
746
  if (! empty($currentUnloadedAll['styles']) && !empty($stylesBeforeUnload)) {
747
  foreach ($currentUnloadedAll['styles'] as $sbuHandle) {
748
- if (!in_array($sbuHandle, $wp_styles->done)) {
749
  // Could be an old style that is not loaded anymore
750
  // We have to check that
751
  if (! isset($stylesBeforeUnload['registered'][$sbuHandle])) {
@@ -776,7 +780,7 @@ class Main
776
  );
777
 
778
  foreach ($wp_scripts->done as $handle) {
779
- if ($isFrontEndView && in_array($handle, $skipScripts)) {
780
  continue;
781
  }
782
 
@@ -794,7 +798,7 @@ class Main
794
  // Append unloaded ones (if any)
795
  if (! empty($currentUnloadedAll['scripts']) && !empty($scriptsBeforeUnload)) {
796
  foreach ($currentUnloadedAll['scripts'] as $sbuHandle) {
797
- if (!in_array($sbuHandle, $wp_scripts->done)) {
798
  // Could be an old script that is not loaded anymore
799
  // We have to check that
800
  if (! isset($scriptsBeforeUnload['registered'][$sbuHandle])) {
@@ -842,8 +846,10 @@ class Main
842
  } elseif ($this->getCurrentPostId() > 0) {
843
  $type = 'post';
844
  } else {
 
845
  // $this->getCurrentPostId() would be 0
846
  $type = 'for_pro';
 
847
  }
848
 
849
  $data['load_exceptions'] = $this->getLoadExceptions($type, $this->getCurrentPostId());
@@ -874,9 +880,11 @@ class Main
874
  $data = $this->setPageTemplate($data);
875
  }
876
 
 
877
  // If the premium extension is enabled, it will also pull the other bulk unloads
878
  // such as 'taxonomy', 'author' etc.
879
  $data = apply_filters('wpacu_pro_get_bulk_unloads', $data);
 
880
 
881
  $data['total_styles'] = (! empty($data['all']['styles'])) ? count($data['all']['styles']) : false;
882
  $data['total_scripts'] = (! empty($data['all']['scripts'])) ? count($data['all']['scripts']) : false;
@@ -1003,9 +1011,10 @@ class Main
1003
  }
1004
  }
1005
 
1006
- // If the premium extension is enabled, it will also pull the other bulk unloads
1007
- // such as 'taxonomy', 'author' etc.
1008
  $data = apply_filters('wpacu_pro_get_bulk_unloads', $data);
 
1009
 
1010
  // For debug purposes
1011
  //unset($data['contents']); echo '<pre>'; print_r($data); exit;
@@ -1014,7 +1023,9 @@ class Main
1014
  if ($postId > 0) {
1015
  $type = 'post';
1016
  } elseif (isset($_POST['tag_id']) && $_POST['tag_id']) {
 
1017
  $type = 'for_pro';
 
1018
  } elseif($postId == 0) {
1019
  $type = 'front_page';
1020
  }
@@ -1187,9 +1198,11 @@ class Main
1187
  $this->assetsRemoved = get_post_meta($postId, '_' . WPACU_PLUGIN_NAME . '_no_load', true);
1188
  }
1189
 
 
1190
  // Premium Extension: Filter assets for pages such as category, tag, author, dates etc.
1191
  // Retrieves "per page" list of unloaded CSS and JavaScript
1192
  $this->assetsRemoved = apply_filters('wpacu_pro_get_assets_unloaded', $this->assetsRemoved);
 
1193
 
1194
  @json_decode($this->assetsRemoved);
1195
 
@@ -1264,8 +1277,8 @@ class Main
1264
  // Undetectable? The page is not a singular one nor the home page
1265
  // It's likely an archive, category page (WooCommerce), 404 page etc.
1266
  if (! $this->currentPostId && ! Misc::isHomePage()) {
1267
- // Check if "WP Asset CleanUp Pro" is enabled
1268
- // Archives, tags, categories (taxonomy) pages are available in the premium extension: WP Asset CleanUp Pro
1269
  if ($this->wpacuProEnabled()) {
1270
  // Could be archive of: Category, Tag, Author, Date, Custom Post Type or Custom Taxonomy based pages.
1271
  // Or: Search, 404 page etc.
@@ -1400,6 +1413,8 @@ class Main
1400
  */
1401
  public function wpacuProEnabled()
1402
  {
 
1403
  return (defined('WPACU_PRO_PLUGIN_FILE'));
 
1404
  }
1405
  }
267
  if (isset($obj->public) && $obj->public > 0) {
268
  add_meta_box(
269
  WPACU_PLUGIN_NAME.'_asset_list',
270
+ __('Asset CleanUp Lite', WPACU_PLUGIN_NAME),
271
  array($this, 'renderMetaBoxContent'),
272
  $postType,
273
  'advanced',
546
  WPACU_PLUGIN_NAME . '_front_page_load_exceptions'
547
  );
548
  } elseif (Main::wpacuProEnabled() && $type == 'for_pro') {
549
+ // [@pro]
550
+ if (class_exists( '\\WpAssetCleanUpPro\\LoadExceptions' )) {
551
+ $ExceptionsPro = new \WpAssetCleanUpPro\LoadExceptions();
552
  $exceptionsListJson = $ExceptionsPro->getLoadExceptions();
553
  }
554
+ // [/@pro]
555
  }
556
 
557
  if ($exceptionsListJson) {
710
  }
711
  }
712
 
713
+ // [@pro]
714
  $currentUnloadedAll = apply_filters('wpacu_pro_filter_all_bulk_unloads', $currentUnloadedAll);
715
+ // [/@pro]
716
 
717
  /*
718
  * Style List
731
  }
732
 
733
  foreach ($wp_styles->done as $handle) {
734
+ if (in_array($handle, $skipStyles)) {
735
  continue;
736
  }
737
 
749
  // Append unloaded ones (if any)
750
  if (! empty($currentUnloadedAll['styles']) && !empty($stylesBeforeUnload)) {
751
  foreach ($currentUnloadedAll['styles'] as $sbuHandle) {
752
+ if (! in_array($sbuHandle, $wp_styles->done)) {
753
  // Could be an old style that is not loaded anymore
754
  // We have to check that
755
  if (! isset($stylesBeforeUnload['registered'][$sbuHandle])) {
780
  );
781
 
782
  foreach ($wp_scripts->done as $handle) {
783
+ if (in_array($handle, $skipScripts)) {
784
  continue;
785
  }
786
 
798
  // Append unloaded ones (if any)
799
  if (! empty($currentUnloadedAll['scripts']) && !empty($scriptsBeforeUnload)) {
800
  foreach ($currentUnloadedAll['scripts'] as $sbuHandle) {
801
+ if (! in_array($sbuHandle, $wp_scripts->done)) {
802
  // Could be an old script that is not loaded anymore
803
  // We have to check that
804
  if (! isset($scriptsBeforeUnload['registered'][$sbuHandle])) {
846
  } elseif ($this->getCurrentPostId() > 0) {
847
  $type = 'post';
848
  } else {
849
+ // [@pro]
850
  // $this->getCurrentPostId() would be 0
851
  $type = 'for_pro';
852
+ // [/@pro]
853
  }
854
 
855
  $data['load_exceptions'] = $this->getLoadExceptions($type, $this->getCurrentPostId());
880
  $data = $this->setPageTemplate($data);
881
  }
882
 
883
+ // [@pro]
884
  // If the premium extension is enabled, it will also pull the other bulk unloads
885
  // such as 'taxonomy', 'author' etc.
886
  $data = apply_filters('wpacu_pro_get_bulk_unloads', $data);
887
+ // [/@pro]
888
 
889
  $data['total_styles'] = (! empty($data['all']['styles'])) ? count($data['all']['styles']) : false;
890
  $data['total_scripts'] = (! empty($data['all']['scripts'])) ? count($data['all']['scripts']) : false;
1011
  }
1012
  }
1013
 
1014
+ // [@pro]
1015
+ // If the pro version is used, it will also pull the other bulk unloads such as 'taxonomy', 'author' etc.
1016
  $data = apply_filters('wpacu_pro_get_bulk_unloads', $data);
1017
+ // [/@pro]
1018
 
1019
  // For debug purposes
1020
  //unset($data['contents']); echo '<pre>'; print_r($data); exit;
1023
  if ($postId > 0) {
1024
  $type = 'post';
1025
  } elseif (isset($_POST['tag_id']) && $_POST['tag_id']) {
1026
+ // [@pro]
1027
  $type = 'for_pro';
1028
+ // [/@pro]
1029
  } elseif($postId == 0) {
1030
  $type = 'front_page';
1031
  }
1198
  $this->assetsRemoved = get_post_meta($postId, '_' . WPACU_PLUGIN_NAME . '_no_load', true);
1199
  }
1200
 
1201
+ // [@pro]
1202
  // Premium Extension: Filter assets for pages such as category, tag, author, dates etc.
1203
  // Retrieves "per page" list of unloaded CSS and JavaScript
1204
  $this->assetsRemoved = apply_filters('wpacu_pro_get_assets_unloaded', $this->assetsRemoved);
1205
+ // [/@pro]
1206
 
1207
  @json_decode($this->assetsRemoved);
1208
 
1277
  // Undetectable? The page is not a singular one nor the home page
1278
  // It's likely an archive, category page (WooCommerce), 404 page etc.
1279
  if (! $this->currentPostId && ! Misc::isHomePage()) {
1280
+ // Check if "Asset CleanUp Pro" is enabled
1281
+ // Archives, tags, categories (taxonomy) pages are available in the premium extension: Asset CleanUp Pro
1282
  if ($this->wpacuProEnabled()) {
1283
  // Could be archive of: Category, Tag, Author, Date, Custom Post Type or Custom Taxonomy based pages.
1284
  // Or: Search, 404 page etc.
1413
  */
1414
  public function wpacuProEnabled()
1415
  {
1416
+ // [@pro]
1417
  return (defined('WPACU_PRO_PLUGIN_FILE'));
1418
+ // [/@pro]
1419
  }
1420
  }
classes/Menu.php CHANGED
@@ -25,6 +25,11 @@ class Menu
25
  self::$slug = WPACU_PLUGIN_NAME . '_settings';
26
 
27
  add_action('admin_menu', array($this, 'activeMenu'));
 
 
 
 
 
28
  }
29
 
30
  /**
@@ -37,8 +42,8 @@ class Menu
37
  }
38
 
39
  add_menu_page(
40
- __('WP Asset CleanUp', WPACU_PLUGIN_NAME),
41
- __('WP Asset Clean Up', WPACU_PLUGIN_NAME),
42
  self::$capability,
43
  self::$slug,
44
  array(new Settings, 'settingsPage'),
@@ -73,6 +78,16 @@ class Menu
73
  array(new GetHelp, 'page')
74
  );
75
 
 
 
 
 
 
 
 
 
 
 
76
  // Rename first item from the menu which has the same title as the menu page
77
  $GLOBALS['submenu'][self::$slug][0][0] = esc_attr__('Settings', WPACU_PLUGIN_NAME);
78
  }
25
  self::$slug = WPACU_PLUGIN_NAME . '_settings';
26
 
27
  add_action('admin_menu', array($this, 'activeMenu'));
28
+
29
+ if (isset($_GET['page']) && $_GET['page'] === 'wpassetcleanup_go_pro') {
30
+ header('Location: '.WPACU_PLUGIN_GO_PRO_LINK);
31
+ exit();
32
+ }
33
  }
34
 
35
  /**
42
  }
43
 
44
  add_menu_page(
45
+ __('Asset CleanUp Lite', WPACU_PLUGIN_NAME),
46
+ __('Asset CleanUp Lite', WPACU_PLUGIN_NAME),
47
  self::$capability,
48
  self::$slug,
49
  array(new Settings, 'settingsPage'),
78
  array(new GetHelp, 'page')
79
  );
80
 
81
+ // Upgrade to "Go Pro" | Redirects to sale page
82
+ add_submenu_page(
83
+ self::$slug,
84
+ __('Go Pro', WPACU_PLUGIN_NAME),
85
+ __('Go Pro <span style="font-size: 16px;" class="dashicons dashicons-star-empty"></span>', WPACU_PLUGIN_NAME),
86
+ self::$capability,
87
+ WPACU_PLUGIN_NAME.'_go_pro',
88
+ function() {}
89
+ );
90
+
91
  // Rename first item from the menu which has the same title as the menu page
92
  $GLOBALS['submenu'][self::$slug][0][0] = esc_attr__('Settings', WPACU_PLUGIN_NAME);
93
  }
classes/Plugin.php CHANGED
@@ -13,8 +13,10 @@ class Plugin
13
  {
14
  register_activation_hook(WPACU_PLUGIN_FILE, array($this, 'whenActivated'));
15
 
 
16
  // Admin footer text: Ask the user to review the plugin
17
  add_filter('admin_footer_text', array($this, 'adminFooter'), 1, 1);
 
18
 
19
  // Show "Settings" and "Go Pro" as plugin action links
20
  add_filter('plugin_action_links_'.WPACU_PLUGIN_BASE, array($this, 'actionLinks'));
@@ -45,16 +47,19 @@ class Plugin
45
  {
46
  $links['settings'] = '<a href="admin.php?page='.WPACU_PLUGIN_NAME.'_settings">Settings</a>';
47
 
 
48
  $allPlugins = get_plugins();
49
 
50
- // If premium extension is not installed (active or not), show the "Go Pro" link
51
- if (! array_key_exists('wp-asset-clean-up-pro/wpacu-pro.php', $allPlugins)) {
52
- $links['go_pro'] = '<a target="_blank" style="font-weight: bold; color: #46b450;" href="https://www.gabelivan.com/items/wp-asset-cleanup-pro/">Go Pro</a>';
53
  }
 
54
 
55
  return $links;
56
  }
57
 
 
58
  /**
59
  * @param $text
60
  *
@@ -64,9 +69,10 @@ class Plugin
64
  {
65
  if (isset($_GET['page']) && strpos($_GET['page'], WPACU_PLUGIN_NAME) !== false) {
66
  $reviewUrl = 'https://wordpress.org/support/plugin/wp-asset-clean-up/reviews/?filter=5#new-post';
67
- $text = 'Thank you for using my plugin <span class="dashicons dashicons-smiley"></span> &nbsp;&nbsp; If you like it, please <a target="_blank" href="'.$reviewUrl.'"><strong>rate</strong> WP Asset CleanUp</a> <a target="_blank" href="'.$reviewUrl.'"><span class="dashicons dashicons-wpacu dashicons-star-filled"></span><span class="dashicons dashicons-wpacu dashicons-star-filled"></span><span class="dashicons dashicons-wpacu dashicons-star-filled"></span><span class="dashicons dashicons-wpacu dashicons-star-filled"></span><span class="dashicons dashicons-wpacu dashicons-star-filled"></span></a> on WordPress.org to help me spread the word to the community.';
68
  }
69
 
70
  return $text;
71
  }
 
72
  }
13
  {
14
  register_activation_hook(WPACU_PLUGIN_FILE, array($this, 'whenActivated'));
15
 
16
+ // [wpacu_lite]
17
  // Admin footer text: Ask the user to review the plugin
18
  add_filter('admin_footer_text', array($this, 'adminFooter'), 1, 1);
19
+ // [/wpacu_lite]
20
 
21
  // Show "Settings" and "Go Pro" as plugin action links
22
  add_filter('plugin_action_links_'.WPACU_PLUGIN_BASE, array($this, 'actionLinks'));
47
  {
48
  $links['settings'] = '<a href="admin.php?page='.WPACU_PLUGIN_NAME.'_settings">Settings</a>';
49
 
50
+ // [wpacu_lite]
51
  $allPlugins = get_plugins();
52
 
53
+ // If the pro version is not installed (active or not), show the upgrade link
54
+ if (! array_key_exists('wp-asset-clean-up-pro/wpacu.php', $allPlugins)) {
55
+ $links['go_pro'] = '<a target="_blank" style="font-weight: bold;" href="https://www.gabelivan.com/items/wp-asset-cleanup-pro/">Go Pro For More Benefits</a>';
56
  }
57
+ // [/wpacu_lite]
58
 
59
  return $links;
60
  }
61
 
62
+ // [wpacu_lite]
63
  /**
64
  * @param $text
65
  *
69
  {
70
  if (isset($_GET['page']) && strpos($_GET['page'], WPACU_PLUGIN_NAME) !== false) {
71
  $reviewUrl = 'https://wordpress.org/support/plugin/wp-asset-clean-up/reviews/?filter=5#new-post';
72
+ $text = 'Thank you for using my plugin <span class="dashicons dashicons-smiley"></span> &nbsp;&nbsp; If you like it, please <a target="_blank" href="'.$reviewUrl.'"><strong>rate</strong> Asset CleanUp Lite</a> <a target="_blank" href="'.$reviewUrl.'"><span class="dashicons dashicons-wpacu dashicons-star-filled"></span><span class="dashicons dashicons-wpacu dashicons-star-filled"></span><span class="dashicons dashicons-wpacu dashicons-star-filled"></span><span class="dashicons dashicons-wpacu dashicons-star-filled"></span><span class="dashicons dashicons-wpacu dashicons-star-filled"></span></a> on WordPress.org to help me spread the word to the community.';
73
  }
74
 
75
  return $text;
76
  }
77
+ // [/wpacu_lite]
78
  }
classes/Update.php CHANGED
@@ -96,8 +96,10 @@ class Update
96
  return;
97
  }
98
 
 
99
  // Form Submitted from a page such as taxonomy (e.g. 'category'), author page, 404 page, search page etc.
100
  do_action('wpacu_pro_frontend_update');
 
101
  }
102
 
103
  /**
@@ -127,7 +129,7 @@ class Update
127
  */
128
  public function savePost($postId, $post = array())
129
  {
130
- // This is triggered only if the "WP Asset CleanUp" meta box was loaded with the list of assets
131
  // Otherwise, $_POST[WPACU_PLUGIN_NAME] will be taken as empty which might be not if there are values in the database
132
  if (! (isset($_POST['wpacu_unload_assets_area_loaded']) && $_POST['wpacu_unload_assets_area_loaded'])) {
133
  return;
@@ -243,8 +245,10 @@ class Update
243
  } elseif ($type == 'front_page') {
244
  delete_option(WPACU_PLUGIN_NAME . '_front_page_load_exceptions');
245
  } elseif ($type == 'for_pro') {
 
246
  // Premium Extensions: Clear existing list for pages like: taxonomy, 404, search, date etc.
247
  do_action( 'wpacu_pro_clear_load_exceptions' );
 
248
  }
249
 
250
  if (! $isPostOptionStyles && ! $isPostOptionScripts) {
@@ -308,8 +312,10 @@ class Update
308
  } elseif ($type == 'front_page') {
309
  update_option(WPACU_PLUGIN_NAME . '_front_page_load_exceptions', $jsonLoadExceptions);
310
  } elseif ($type == 'for_pro') {
 
311
  // Premium Extensions: Update any load extensions for pages like: taxonomy, 404, search, date etc.
312
  do_action( 'wpacu_pro_update_load_exceptions', $jsonLoadExceptions );
 
313
  }
314
  }
315
  }
96
  return;
97
  }
98
 
99
+ // [@pro]
100
  // Form Submitted from a page such as taxonomy (e.g. 'category'), author page, 404 page, search page etc.
101
  do_action('wpacu_pro_frontend_update');
102
+ // [/@pro]
103
  }
104
 
105
  /**
129
  */
130
  public function savePost($postId, $post = array())
131
  {
132
+ // This is triggered only if the "Asset CleanUp Lite" meta box was loaded with the list of assets
133
  // Otherwise, $_POST[WPACU_PLUGIN_NAME] will be taken as empty which might be not if there are values in the database
134
  if (! (isset($_POST['wpacu_unload_assets_area_loaded']) && $_POST['wpacu_unload_assets_area_loaded'])) {
135
  return;
245
  } elseif ($type == 'front_page') {
246
  delete_option(WPACU_PLUGIN_NAME . '_front_page_load_exceptions');
247
  } elseif ($type == 'for_pro') {
248
+ // [@pro]
249
  // Premium Extensions: Clear existing list for pages like: taxonomy, 404, search, date etc.
250
  do_action( 'wpacu_pro_clear_load_exceptions' );
251
+ // [/@pro]
252
  }
253
 
254
  if (! $isPostOptionStyles && ! $isPostOptionScripts) {
312
  } elseif ($type == 'front_page') {
313
  update_option(WPACU_PLUGIN_NAME . '_front_page_load_exceptions', $jsonLoadExceptions);
314
  } elseif ($type == 'for_pro') {
315
+ // [@pro]
316
  // Premium Extensions: Update any load extensions for pages like: taxonomy, 404, search, date etc.
317
  do_action( 'wpacu_pro_update_load_exceptions', $jsonLoadExceptions );
318
+ // [/@pro]
319
  }
320
  }
321
  }
readme.txt CHANGED
@@ -1,24 +1,24 @@
1
- === WP Asset CleanUp Lite (Page Speed Optimizer) ===
2
  Contributors: gabelivan
3
  Tags: speed, pagespeed, dequeue style, dequeue script, unload style, unload script, disable emojis
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7GJZCW6RD8ECS
5
  Requires at least: 4.0
6
  Tested up to: 4.9.8
7
- Stable tag: 1.2.6.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 "WP Asset CleanUp (Page Speed Optimizer)"
15
  * Faster page load = Happier Visitors = More Conversions
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
 
19
  For instance, you might use a plugin that generates contact forms and it loads its assets (.CSS and .JS files) in every page of your website instead of doing it only in the /contact page (if that's the only place where you need it).
20
 
21
- WP Asset CleanUp scans your page and detects all the assets that are loaded. All you have to do when editing a page/post is just to select the ones you DO NOT wish to load.
22
 
23
  = This plugin's benefits include =
24
  * Decreases number of HTTP requests loaded (important for faster load)
@@ -38,8 +38,8 @@ NOTE: People that have tested the plugin are so far happy with it and I want to
38
  == Installation ==
39
  1. Upload the "wp-asset-clean-up" folder in your plugins folder
40
  2. Activate the plugin (if server's PHP version is below 5.3, it will show you an error and activation will not be made)
41
- 3. Edit any page / post/ custom post and you will see a meta box called "WP Asset CleanUp" which will load the list of all the loaded .css and .js files
42
- 4. To unload the assets for the "Home Page", go to "WP Asset CleanUp" menu on the left panel of the Dashboard
43
 
44
  == Frequently Asked Questions ==
45
  = What PHP version is required for this plugin to work? =
@@ -48,13 +48,13 @@ NOTE: People that have tested the plugin are so far happy with it and I want to
48
 
49
  = Is this plugin a caching one?
50
 
51
- No, WP Asset CleanUp does not do any caching. It just unloads .css and .js when needed. This combined with an existing caching plugin will make your website pages load faster and get a better score in speed checking tools such as GTMetrix.
52
 
53
  = Has this plugin been tested with other caching / speed booster plugins?
54
 
55
  Yes, this plugin was tested with W3 Total Cache, WP Rocket and Autoptimize and should work with any caching plugin as any page should be cached only after the page (HTML Source) was rendered and all the enqueueing / dequeueing was already completed (from either the plugins or the theme).
56
 
57
- = I've noticed scripts and styles that are loaded on the page, but they do not show in the "WP Asset CleanUp" list when editing the page or no assets are showing at all. Why is that? =
58
 
59
  There are a few known reasons why you might see different or no assets loading for management:
60
 
@@ -62,7 +62,7 @@ There are a few known reasons why you might see different or no assets loading f
62
 
63
  - You're using a cache plugin that is caching pages even when you're logged in which is something I don't recommend as you might have conflicts with other plugins as well (e.g. in W3 Total Cache, you can enable/disable this) or that plugin is caching pages even when a POST request is made to them (which is not a good practice as there are many situations in which a page should not be cached). That could happen if you're using "WP Remote POST" method (from version 1.2.4.4) of retrieving the assets in the Dashboard.
64
 
65
- - You might have other functions or plugins (e.g. Plugin Organizer) that are loading prior to WP Asset CleanUp. Note that Plugin Organizer has a file that is in “mu-plugins” which will load prior to any plugin you have in “plugins”, thus, if you have disabled specific plugins through “Plugin Organizer” in some pages, their assets will obviously not show in the assets list as they are not loaded at all in the first place.
66
 
67
  If none of these apply to you and you just don't see assets that should definitely show there, please open a support ticket.
68
 
@@ -84,9 +84,9 @@ The plugin makes AJAX calls to retrieve the data from the front-end page with 10
84
 
85
  - There could be a conflict between plugins or your theme and something is interfering with the script that is retrieving the assets
86
 
87
- - You are loading the WordPress Dashboard through HTTPS, but you are forcing the front-end to load via HTTP. Although WP Asset CleanUp auto-corrects the retrieval URL (e.g. if you're logged in the Dashboard securely via HTTPS, it will attempt to fetch the assets through HTTPS too), there could be cases where another plugin or .htaccess forces a HTTP connection only for the public view. Due to Same Origin Policy (read more here: https://developer.mozilla.org/En/Same_origin_policy_for_JavaScript), you can't make plain HTTP AJAX calls from HTTPS connections. If that's the case, try to enable "WP Remote POST" as a retrieval method in the plugin's settings if you want to manage the assets in the Dashboard.
88
 
89
- In this case, it's advisable to enable "Manage in the Front-end?" in "Settings" of "WP Asset CleanUp", thus making the list to show at the bottom of the posts, pages and front-page only for the logged in users with admin privileges.
90
 
91
  Although I've written the code to ensure maximum compatibility, there are factors which are not up to the quality of the plugin that could interfere with it.
92
  In case the assets are not loading for you, please write me on the forum and I will be happy to assist you!
@@ -97,11 +97,20 @@ If that's the case, then it's advisable to consult with a developer (ideally the
97
 
98
  == Screenshots ==
99
  1. When editing a post/page (custom post type as well) a meta box will load with the asset list
100
- 2. Styles (.CSS) loaded for the home page when accessing the "WP Asset CleanUp" Dashboard's menu
101
- 3. Scripts (.JS) loaded for the home page having an alert message when accessing the "WP Asset CleanUp" Dashboard's menu
102
  4. Scripts (.JS) are selected for site-wide unload
103
 
104
  == Changelog ==
 
 
 
 
 
 
 
 
 
105
  = 1.2.6.7 =
106
  * Bug Fix: "Unload on All Pages of [post type here] post type" was not showing within the Dashboard view
107
 
1
+ === Asset CleanUp Lite: Page Speed Optimizer ===
2
  Contributors: gabelivan
3
  Tags: speed, pagespeed, dequeue style, dequeue script, unload style, unload script, disable emojis
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7GJZCW6RD8ECS
5
  Requires at least: 4.0
6
  Tested up to: 4.9.8
7
+ Stable tag: 1.2.6.9
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 Lite: Page Speed Optimizer"
15
  * Faster page load = Happier Visitors = More Conversions
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
 
19
  For instance, you might use a plugin that generates contact forms and it loads its assets (.CSS and .JS files) in every page of your website instead of doing it only in the /contact page (if that's the only place where you need it).
20
 
21
+ "Asset CleanUp Lite" scans your page and detects all the assets that are loaded. All you have to do when editing a page/post is just to select the ones you DO NOT wish to load.
22
 
23
  = This plugin's benefits include =
24
  * Decreases number of HTTP requests loaded (important for faster load)
38
  == Installation ==
39
  1. Upload the "wp-asset-clean-up" folder in your plugins folder
40
  2. Activate the plugin (if server's PHP version is below 5.3, it will show you an error and activation will not be made)
41
+ 3. Edit any page / post/ custom post and you will see a meta box called "Asset CleanUp Lite" which will load the list of all the loaded .css and .js files
42
+ 4. To unload the assets for the "Home Page", go to "Asset CleanUp Lite" menu on the left panel of the Dashboard
43
 
44
  == Frequently Asked Questions ==
45
  = What PHP version is required for this plugin to work? =
48
 
49
  = Is this plugin a caching one?
50
 
51
+ No, Asset CleanUp does not do any caching. It just unloads .css and .js when needed. This combined with an existing caching plugin will make your website pages load faster and get a better score in speed checking tools such as GTMetrix.
52
 
53
  = Has this plugin been tested with other caching / speed booster plugins?
54
 
55
  Yes, this plugin was tested with W3 Total Cache, WP Rocket and Autoptimize and should work with any caching plugin as any page should be cached only after the page (HTML Source) was rendered and all the enqueueing / dequeueing was already completed (from either the plugins or the theme).
56
 
57
+ = I've noticed scripts and styles that are loaded on the page, but they do not show in the "Asset CleanUp" list when editing the page or no assets are showing at all. Why is that? =
58
 
59
  There are a few known reasons why you might see different or no assets loading for management:
60
 
62
 
63
  - You're using a cache plugin that is caching pages even when you're logged in which is something I don't recommend as you might have conflicts with other plugins as well (e.g. in W3 Total Cache, you can enable/disable this) or that plugin is caching pages even when a POST request is made to them (which is not a good practice as there are many situations in which a page should not be cached). That could happen if you're using "WP Remote POST" method (from version 1.2.4.4) of retrieving the assets in the Dashboard.
64
 
65
+ - You might have other functions or plugins (e.g. Plugin Organizer) that are loading prior to Asset CleanUp. Note that Plugin Organizer has a file that is in “mu-plugins” which will load prior to any plugin you have in “plugins”, thus, if you have disabled specific plugins through “Plugin Organizer” in some pages, their assets will obviously not show in the assets list as they are not loaded at all in the first place.
66
 
67
  If none of these apply to you and you just don't see assets that should definitely show there, please open a support ticket.
68
 
84
 
85
  - There could be a conflict between plugins or your theme and something is interfering with the script that is retrieving the assets
86
 
87
+ - You are loading the WordPress Dashboard through HTTPS, but you are forcing the front-end to load via HTTP. Although Asset CleanUp auto-corrects the retrieval URL (e.g. if you're logged in the Dashboard securely via HTTPS, it will attempt to fetch the assets through HTTPS too), there could be cases where another plugin or .htaccess forces a HTTP connection only for the public view. Due to Same Origin Policy (read more here: https://developer.mozilla.org/En/Same_origin_policy_for_JavaScript), you can't make plain HTTP AJAX calls from HTTPS connections. If that's the case, try to enable "WP Remote POST" as a retrieval method in the plugin's settings if you want to manage the assets in the Dashboard.
88
 
89
+ In this case, it's advisable to enable "Manage in the Front-end?" in "Settings" of "Asset CleanUp", thus making the list to show at the bottom of the posts, pages and front-page only for the logged in users with admin privileges.
90
 
91
  Although I've written the code to ensure maximum compatibility, there are factors which are not up to the quality of the plugin that could interfere with it.
92
  In case the assets are not loading for you, please write me on the forum and I will be happy to assist you!
97
 
98
  == Screenshots ==
99
  1. When editing a post/page (custom post type as well) a meta box will load with the asset list
100
+ 2. Styles (.CSS) loaded for the home page when accessing the "Asset CleanUp" Dashboard's menu
101
+ 3. Scripts (.JS) loaded for the home page having an alert message when accessing the "Asset CleanUp Lite" Dashboard's menu
102
  4. Scripts (.JS) are selected for site-wide unload
103
 
104
  == Changelog ==
105
+ = 1.2.6.9 =
106
+ * Made sure that default.php (new file) is not missing within /templates/meta-box-loaded-assets/ directory
107
+
108
+ = 1.2.6.8 =
109
+ * Important: If you use the premium extension, please upgrade to 1.0.3
110
+ * Removed "WP" from the plugin's title
111
+ * Prevent the LITE plugin from loading if the PRO version is enabled as loading both plugins is not relevant anymore
112
+ * Avoided loading Asset CleanUp Lite's own CSS and JS within the Dashboard view as they are irrelevant since the're only loaded for the admins that manage the plugin
113
+
114
  = 1.2.6.7 =
115
  * Bug Fix: "Unload on All Pages of [post type here] post type" was not showing within the Dashboard view
116
 
templates/get-help.php CHANGED
@@ -7,10 +7,10 @@ if (! isset($data)) {
7
  }
8
  ?>
9
  <div class="wrap wpacu-get-help-wrap">
10
- <h1><?php echo apply_filters('wpacu_plugin_page_title', 'WP Asset CleanUp Lite'); ?></h1>
11
  <h2><?php _e('In case you are stuck and need assistance, I can help you!', WPACU_PLUGIN_NAME); ?></h2>
12
 
13
- <p>If you believe the plugin has a bug (e.g. you're getting JavaScript or PHP errors generated by WP Asset CleanUp or the selected scripts are not unloading etc.) that needs to be fixed, then <a href="https://wordpress.org/support/plugin/wp-asset-clean-up">please report it by opening a support ticket</a>. Note that the support forum is only for reporting bugs and it's not for custom work request.</p>
14
 
15
  <p>In case you need professional help in one of the following scenarios and you don't have a developer available to provide what you need, then me or any of my colleagues from <a href="https://app.codeable.io/tasks/new?ref=d3TOr">Codeable</a>, would be able to assist you:</p>
16
 
7
  }
8
  ?>
9
  <div class="wrap wpacu-get-help-wrap">
10
+ <h1><?php echo apply_filters('wpacu_plugin_page_title', 'Asset CleanUp Lite'); ?></h1>
11
  <h2><?php _e('In case you are stuck and need assistance, I can help you!', WPACU_PLUGIN_NAME); ?></h2>
12
 
13
+ <p>If you believe the plugin has a bug (e.g. you're getting JavaScript or PHP errors generated by Asset CleanUp or the selected scripts are not unloading etc.) that needs to be fixed, then <a href="https://wordpress.org/support/plugin/wp-asset-clean-up">please report it by opening a support ticket</a>. Note that the support forum is only for reporting bugs and it's not for custom work request.</p>
14
 
15
  <p>In case you need professional help in one of the following scenarios and you don't have a developer available to provide what you need, then me or any of my colleagues from <a href="https://app.codeable.io/tasks/new?ref=d3TOr">Codeable</a>, would be able to assist you:</p>
16
 
templates/meta-box-loaded-assets/default.php ADDED
@@ -0,0 +1,538 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if (! isset($data)) {
3
+ exit;
4
+ }
5
+
6
+ /*
7
+ * --------------------
8
+ * [START] STYLES LIST
9
+ * --------------------
10
+ */
11
+ ?>
12
+ <h3><span style="font-size: 120%; line-height: 130%;" class="dashicons dashicons-admin-appearance"></span> &nbsp; <?php _e('Styles (.css files)', WPACU_PLUGIN_NAME); ?></h3>
13
+
14
+ <?php
15
+ if ($data['total_styles']) {
16
+ ?>
17
+ <h4>&#10141; Total enqueued stylesheets: <strong><?php echo $data['total_styles']; ?></strong></h4>
18
+ <?php
19
+ }
20
+ ?>
21
+
22
+ <?php
23
+ if (! empty($data['all']['styles'])) {
24
+ ?>
25
+ <p><?php echo sprintf(__('The following styles are loading on this page. Please select the ones that are %sNOT NEEDED%s. If you are not sure which ones to unload, it is better to leave them enabled (unchecked) and consult with a developer about unloading the assets.', WPACU_PLUGIN_NAME), '<span style="color: #CC0000;"><strong>', '</strong></span>'); ?></p>
26
+ <p><?php echo __('"Load in on this page (make exception)" will take effect when a bulk unload rule is used. Otherwise, the asset will load anyway unless you select it for unload.', WPACU_PLUGIN_NAME); ?></p>
27
+ <?php
28
+ if ($data['core_styles_loaded']) {
29
+ ?>
30
+ <div class="wpacu_note wpacu_warning"><em><?php
31
+ echo sprintf(
32
+ __('Assets that are marked with %s are part of WordPress core files. Be careful if you decide to unload them!', WPACU_PLUGIN_NAME),
33
+ '<span class="dashicons dashicons-warning"></span>'
34
+ );
35
+ ?>
36
+ </em></div><br />
37
+ <?php
38
+ }
39
+ ?>
40
+ <table class="wp-asset-clean-up wp-list-table widefat wpacu_widefat fixed striped wpacu_striped">
41
+ <tbody>
42
+ <?php
43
+ foreach ($data['all']['styles'] as $obj) {
44
+ $active = (isset($data['current']['styles']) && in_array($obj->handle, $data['current']['styles']));
45
+
46
+ $class = ($active) ? 'wpacu_not_load' : '';
47
+ $checked = ($active) ? 'checked="checked"' : '';
48
+
49
+ /*
50
+ * $isGlobalRule is only used to apply a red background in the style's area to point out that the style is unloaded
51
+ * is set to `true` if either the asset is unloaded everywhere or it's unloaded on a group of pages (such as all pages belonging to 'page' post type)
52
+ */
53
+ $globalUnloaded = $bulkTypeUnloaded = $isPostTypeUnloaded = $isLoadException = $isGlobalRule = false;
54
+
55
+ // Mark it as unloaded - Everywhere
56
+ if (in_array($obj->handle, $data['global_unload']['styles'])) {
57
+ $globalUnloaded = $isGlobalRule = true;
58
+ }
59
+
60
+ // Mark it as unloaded - for the Current Post Type
61
+ if ($data['bulk_unloaded_type'] && in_array($obj->handle, $data['bulk_unloaded'][$data['bulk_unloaded_type']]['styles'])) {
62
+ $bulkTypeUnloaded = $isGlobalRule = true;
63
+
64
+ if ($data['bulk_unloaded_type'] === 'post_type') {
65
+ $isPostTypeUnloaded = true;
66
+ }
67
+ }
68
+
69
+ if ($isGlobalRule) {
70
+ if (in_array($obj->handle, $data['load_exceptions']['styles'])) {
71
+ $isLoadException = true;
72
+ } else {
73
+ $class .= ' wpacu_not_load';
74
+ }
75
+ }
76
+
77
+ $class .= ' style_'.$obj->handle;
78
+ ?>
79
+ <tr class="wpacu_asset_row <?php echo $class; ?>">
80
+ <td valign="top" style="width: 100%;">
81
+ <p style="margin-top: 0;">
82
+ <label for="style_<?php echo $obj->handle; ?>"><?php _e('Handle:', WPACU_PLUGIN_NAME); ?> <strong><span style="color: green;"><?php echo $obj->handle; ?></span></strong></label>
83
+ <?php
84
+ if (isset($obj->wp) && $obj->wp) {
85
+ ?>
86
+ <span class="dashicons dashicons-warning"></span>
87
+ <?php
88
+ }
89
+ ?>
90
+ </p>
91
+
92
+ <div>
93
+ <ul class="wpacu_asset_options">
94
+ <li>
95
+ <label><input id="style_<?php echo $obj->handle; ?>" <?php if ($globalUnloaded) { echo 'disabled="disabled"'; } echo $checked; ?> name="<?php echo WPACU_PLUGIN_NAME; ?>[styles][]" class="icheckbox_square-red" type="checkbox" value="<?php echo $obj->handle; ?>" /> &nbsp;Unload on this page</label>
96
+ </li>
97
+ </div>
98
+
99
+ <div style="padding: 5px 10px; margin: 15px 0; background: white; border: 1px solid #eee; border-radius: 5px;">
100
+ <?php
101
+ // Unloaded Everywhere
102
+ if ($globalUnloaded) {
103
+ ?>
104
+ <p><strong style="color: #d54e21;">This stylesheet file is unloaded everywhere</strong></p>
105
+ <div class="clear"></div>
106
+ <?php
107
+ }
108
+ ?>
109
+
110
+ <ul class="wpacu_asset_options">
111
+ <?php
112
+ // [START] UNLOAD EVERYWHERE
113
+ if ($globalUnloaded) {
114
+ ?>
115
+ <li>
116
+ <label><input data-handle="<?php echo $obj->handle; ?>"
117
+ class="wpacu_global_option wpacu_style"
118
+ type="radio"
119
+ name="wpacu_options_styles[<?php echo $obj->handle; ?>]"
120
+ checked="checked"
121
+ value="default" />
122
+ Keep the unload global rule</label>
123
+ </li>
124
+
125
+ <li>
126
+ <label><input data-handle="<?php echo $obj->handle; ?>"
127
+ class="wpacu_global_option wpacu_style"
128
+ type="radio"
129
+ name="wpacu_options_styles[<?php echo $obj->handle; ?>]"
130
+ value="remove" />
131
+ Remove global unload rule</label>
132
+ </li>
133
+ <?php
134
+ } else {
135
+ ?>
136
+ <li>
137
+ <label><input data-handle="<?php echo $obj->handle; ?>"
138
+ class="wpacu_global_unload wpacu_global_style"
139
+ id="wpacu_global_unload_style_<?php echo $obj->handle; ?>" type="checkbox"
140
+ name="wpacu_global_unload_styles[]" value="<?php echo $obj->handle; ?>"/>
141
+ Unload Everywhere</label>
142
+ </li>
143
+ <?php
144
+ }
145
+ // [END] UNLOAD EVERYWHERE
146
+ ?>
147
+ </ul>
148
+ </div>
149
+
150
+ <?php if ($data['bulk_unloaded_type'] === 'post_type') { ?>
151
+ <div style="padding: 5px 10px; margin: 15px 0; background: white; border: 1px solid #eee; border-radius: 5px;">
152
+ <?php } ?>
153
+
154
+ <?php
155
+ // Unloaded On All Pages Belonging to the page's Post Type
156
+ if ($isPostTypeUnloaded) {
157
+ ?>
158
+ <p><strong style="color: #d54e21;">This stylesheet file is unloaded on all <u><?php echo $data['post_type']; ?></u> post types.</strong></p>
159
+ <div class="clear"></div>
160
+ <?php
161
+ }
162
+ ?>
163
+
164
+ <?php
165
+ if ($data['bulk_unloaded_type'] === 'post_type') {
166
+ ?>
167
+ <ul class="wpacu_asset_options">
168
+ <?php
169
+ // [START] ALL PAGES HAVING THE SAME POST TYPE
170
+ if ($isPostTypeUnloaded) {
171
+ ?>
172
+ <li>
173
+ <label><input data-handle="<?php echo $obj->handle; ?>"
174
+ class="wpacu_bulk_option wpacu_style wpacu_keep_bulk_rule"
175
+ type="radio"
176
+ name="wpacu_options_post_type_styles[<?php echo $obj->handle; ?>]"
177
+ checked="checked"
178
+ value="default"/>
179
+ Keep rule</label>
180
+ </li>
181
+
182
+ <li>
183
+ <label><input data-handle="<?php echo $obj->handle; ?>"
184
+ class="wpacu_bulk_option wpacu_style wpacu_remove_bulk_rule"
185
+ type="radio"
186
+ name="wpacu_options_post_type_styles[<?php echo $obj->handle; ?>]"
187
+ value="remove"/>
188
+ Remove rule</label>
189
+ </li>
190
+ <?php
191
+ } else {
192
+ ?>
193
+ <li>
194
+ <label><input data-handle="<?php echo $obj->handle; ?>"
195
+ class="wpacu_bulk_unload wpacu_post_type_unload wpacu_post_type_style"
196
+ id="wpacu_bulk_unload_post_type_style_<?php echo $obj->handle; ?>"
197
+ type="checkbox"
198
+ name="wpacu_bulk_unload_styles[post_type][<?php echo $data['post_type']; ?>][]"
199
+ value="<?php echo $obj->handle; ?>"/>
200
+ Unload on All Pages of <strong><?php echo $data['post_type']; ?></strong> post type</label>
201
+ </li>
202
+ <?php
203
+ }
204
+ ?>
205
+ </ul>
206
+ <?php
207
+ }
208
+ // [END] ALL PAGES HAVING THE SAME POST TYPE
209
+ ?>
210
+
211
+ <?php if ($data['bulk_unloaded_type'] === 'post_type') { ?>
212
+ </div>
213
+ <?php } ?>
214
+
215
+ <?php
216
+ // [@pro]
217
+ do_action('wpacu_pro_bulk_unload_output', $data, $obj, 'css');
218
+ // [/@pro]
219
+ ?>
220
+
221
+ <ul class="wpacu_asset_options">
222
+ <li id="wpacu_load_it_option_style_<?php echo $obj->handle; ?>">
223
+ <label><input data-handle="<?php echo $obj->handle; ?>"
224
+ id="wpacu_style_load_it_<?php echo $obj->handle; ?>"
225
+ class="wpacu_load_it_option wpacu_style wpacu_load_exception"
226
+ type="checkbox"
227
+ <?php if ($isLoadException) { ?> checked="checked" <?php } ?>
228
+ name="wpacu_styles_load_it[]"
229
+ value="<?php echo $obj->handle; ?>"/>
230
+ Load it on this page (make exception<?php if (! $isGlobalRule) { echo ' * works only IF any of rules above is selected'; } ?>)</label>
231
+ </li>
232
+ </ul>
233
+ <?php
234
+ if (isset($obj->src) && $obj->src != '') {
235
+ ?>
236
+ <p><?php _e('Source:', WPACU_PLUGIN_NAME); ?> <a target="_blank" href="<?php echo $obj->srcHref; ?>"><?php echo $obj->src; ?></a></p>
237
+ <?php }
238
+
239
+ if (! empty($obj->deps)) {
240
+ ?>
241
+ <p><?php echo __('Depends on:', WPACU_PLUGIN_NAME) . ' ' . implode(', ', $obj->deps); ?></p>
242
+ <?php
243
+ }
244
+
245
+ if ($obj->ver) {
246
+ ?>
247
+ <p><?php _e('Version:', WPACU_PLUGIN_NAME); ?> <?php echo $obj->ver; ?></p>
248
+ <?php
249
+ }
250
+
251
+ if (isset($obj->extra->data) && ! empty($obj->extra->data)) { ?>
252
+ <p><?php _e('Inline:', WPACU_PLUGIN_NAME); ?> <em><?php echo $obj->extra->data; ?></em></p>
253
+ <?php } ?>
254
+ </td>
255
+ </tr>
256
+ <?php
257
+ }
258
+ ?>
259
+ </tbody>
260
+ </table>
261
+ <?php
262
+ } else {
263
+ echo __('It looks like there are no public .css files loaded or the ones visible do not follow <a href="https://codex.wordpress.org/Function_Reference/wp_enqueue_style">the WordPress way of enqueuing styles</a>.', WPACU_PLUGIN_NAME);
264
+ }
265
+ /* -------------------
266
+ * [END] STYLES LIST
267
+ * -------------------
268
+ */
269
+
270
+ /*
271
+ * ---------------------
272
+ * [START] SCRIPTS LIST
273
+ * ---------------------
274
+ */
275
+ ?>
276
+ <h3><span style="font-size: 120%; line-height: 130%;" class="dashicons dashicons-media-code"></span> &nbsp; <?php _e('Scripts (.js files)', WPACU_PLUGIN_NAME); ?></h3>
277
+
278
+ <?php
279
+ if ($data['total_scripts']) {
280
+ ?>
281
+ <h4>&#10141; Total enqueued JavaScript files: <strong><?php echo $data['total_scripts']; ?></strong></h4>
282
+ <?php
283
+ }
284
+ ?>
285
+
286
+ <?php
287
+ if (! empty($data['all']['scripts'])) {
288
+ ?>
289
+ <p><?php echo sprintf(__('The following scripts are loading on this page. Please select the ones that are %sNOT NEEDED%s. If you are not sure which ones to unload, it is better to leave them enabled and consult with a developer about unloading the assets.', WPACU_PLUGIN_NAME), '<span style="color: #CC0000;"><strong>', '</strong></span>'); ?></p>
290
+ <p><?php echo __('"Load in on this page (make exception)" will take effect when a bulk unload rule is used. Otherwise, the asset will load anyway unless you select it for unload.', WPACU_PLUGIN_NAME); ?></p>
291
+ <?php
292
+ if ($data['core_scripts_loaded']) {
293
+ ?>
294
+ <div class="wpacu_note wpacu_warning"><em><?php
295
+ echo sprintf(
296
+ __('Assets that are marked with %s are part of WordPress core files. Be careful if you decide to unload them!', WPACU_PLUGIN_NAME),
297
+ '<span class="dashicons dashicons-warning"></span>'
298
+ );
299
+ ?>
300
+ </em></div><br />
301
+ <?php
302
+ }
303
+ ?>
304
+
305
+ <table class="wp-list-table widefat wpacu_widefat fixed striped wpacu_striped">
306
+ <tbody>
307
+ <?php
308
+ foreach ($data['all']['scripts'] as $obj) {
309
+ $active = (isset($data['current']['scripts']) && in_array($obj->handle, $data['current']['scripts']));
310
+
311
+ $class = ($active) ? 'wpacu_not_load' : '';
312
+ $checked = ($active) ? 'checked="checked"' : '';
313
+
314
+ /*
315
+ * $isGlobalRule is only used to apply a red background in the script's area to point out that the script is unloaded
316
+ */
317
+ $globalUnloaded = $bulkTypeUnloaded = $isPostTypeUnloaded = $isLoadException = $isGlobalRule = false;
318
+
319
+ // Mark it as unloaded - Everywhere
320
+ if (in_array($obj->handle, $data['global_unload']['scripts']) && !$class) {
321
+ $globalUnloaded = $isGlobalRule = true;
322
+ }
323
+
324
+ // Mark it as unloaded - for the Current Post Type
325
+ if ($data['bulk_unloaded_type'] && in_array($obj->handle, $data['bulk_unloaded'][$data['bulk_unloaded_type']]['scripts'])) {
326
+ $bulkTypeUnloaded = $isGlobalRule = true;
327
+
328
+ if ($data['bulk_unloaded_type'] === 'post_type') {
329
+ $isPostTypeUnloaded = true;
330
+ }
331
+ }
332
+
333
+ if ($isGlobalRule) {
334
+ if (in_array($obj->handle, $data['load_exceptions']['scripts'])) {
335
+ $isLoadException = true;
336
+ } else {
337
+ $class .= ' wpacu_not_load';
338
+ }
339
+ }
340
+
341
+ $class .= ' script_'.$obj->handle;
342
+ ?>
343
+ <tr class="wpacu_asset_row <?php echo $class; ?>">
344
+ <td valign="top" style="width: 100%;">
345
+ <p style="margin-top: 0;">
346
+ <label for="script_<?php echo $obj->handle; ?>"> <?php _e('Handle:', WPACU_PLUGIN_NAME); ?> <strong><span style="color: green;"><?php echo $obj->handle; ?></span></strong></label>
347
+ <?php
348
+ if (isset($obj->wp) && $obj->wp) {
349
+ ?>
350
+ <span class="dashicons dashicons-warning"></span>
351
+ <?php
352
+ }
353
+ ?>
354
+ </p>
355
+
356
+ <?php
357
+ // Unloaded Everywhere
358
+ if ($globalUnloaded) {
359
+ ?>
360
+ <p><strong style="color: #d54e21;">This JavaScript file is unloaded everywhere</strong></p>
361
+ <?php
362
+ }
363
+ ?>
364
+
365
+ <div style="padding: 5px 10px; margin: 15px 0; background: white; border: 1px solid #eee; border-radius: 5px;">
366
+ <ul class="wpacu_asset_options">
367
+ <li>
368
+ <label><input id="script_<?php echo $obj->handle; ?>" <?php if ($globalUnloaded) { echo 'disabled="disabled"'; } echo $checked; ?> name="<?php echo WPACU_PLUGIN_NAME; ?>[scripts][]" class="icheckbox_square-red" type="checkbox" value="<?php echo $obj->handle; ?>" /> &nbsp;Unload on this page</label>
369
+ </li>
370
+ </ul>
371
+ </div>
372
+
373
+ <div style="padding: 5px 10px; margin: 15px 0; background: white; border: 1px solid #eee; border-radius: 5px;">
374
+ <ul class="wpacu_asset_options">
375
+ <?php
376
+ // [START] UNLOAD EVERYWHERE
377
+ if ($globalUnloaded) {
378
+ ?>
379
+ <li>
380
+ <label><input data-handle="<?php echo $obj->handle; ?>"
381
+ class="wpacu_bulk_option wpacu_script"
382
+ type="radio"
383
+ name="wpacu_options_scripts[<?php echo $obj->handle; ?>]"
384
+ checked="checked"
385
+ value="default" />
386
+ Keep the unload global rule</label>
387
+ </li>
388
+
389
+ <li>
390
+ <label><input data-handle="<?php echo $obj->handle; ?>"
391
+ class="wpacu_bulk_option wpacu_script"
392
+ type="radio"
393
+ name="wpacu_options_scripts[<?php echo $obj->handle; ?>]"
394
+ value="remove" />
395
+ Remove global unload rule</label>
396
+ </li>
397
+ <?php
398
+ } else {
399
+ ?>
400
+ <li>
401
+ <label><input data-handle="<?php echo $obj->handle; ?>"
402
+ class="wpacu_global_unload wpacu_global_script"
403
+ id="wpacu_global_unload_script_<?php echo $obj->handle; ?>"
404
+ type="checkbox"
405
+ name="wpacu_global_unload_scripts[]"
406
+ value="<?php echo $obj->handle; ?>"/>
407
+ Unload Everywhere</label>
408
+ </li>
409
+ <?php
410
+ }
411
+ // [END] UNLOAD EVERYWHERE
412
+ ?>
413
+
414
+ </ul>
415
+ </div>
416
+
417
+ <?php if ($data['bulk_unloaded_type'] === 'post_type') { ?>
418
+ <div style="padding: 5px 10px; margin: 15px 0; background: white; border: 1px solid #eee; border-radius: 5px;">
419
+ <?php } ?>
420
+
421
+ <?php
422
+ // Unloaded On All Pages Belonging to the page's Post Type
423
+ if ($isPostTypeUnloaded) {
424
+ ?>
425
+ <p><strong style="color: #d54e21;">This JavaScript file is unloaded on all <u><?php echo $data['post_type']; ?></u> post types.</strong></p>
426
+ <div class="clear"></div>
427
+ <?php
428
+ }
429
+ ?>
430
+
431
+ <ul class="wpacu_asset_options">
432
+ <?php
433
+ if ($data['bulk_unloaded_type'] === 'post_type') {
434
+ // [START] ALL PAGES HAVING THE SAME POST TYPE
435
+ if ($isPostTypeUnloaded) {
436
+ ?>
437
+ <li>
438
+ <label><input data-handle="<?php echo $obj->handle; ?>"
439
+ class="wpacu_post_type_option wpacu_post_type_script wpacu_keep_bulk_rule"
440
+ type="radio"
441
+ name="wpacu_options_post_type_scripts[<?php echo $obj->handle; ?>]"
442
+ checked="checked"
443
+ value="default"/>
444
+ Keep rule</label>
445
+ </li>
446
+
447
+ <li>
448
+ <label><input data-handle="<?php echo $obj->handle; ?>"
449
+ class="wpacu_post_type_option wpacu_remove_bulk_rule wpacu_post_type_script"
450
+ type="radio"
451
+ name="wpacu_options_post_type_scripts[<?php echo $obj->handle; ?>]"
452
+ value="remove"/>
453
+ Remove rule</label>
454
+ </li>
455
+ <?php
456
+ } else {
457
+ ?>
458
+ <li>
459
+ <label><input data-handle="<?php echo $obj->handle; ?>"
460
+ class="wpacu_bulk_unload wpacu_post_type_unload wpacu_post_type_script"
461
+ id="wpacu_global_unload_post_type_script_<?php echo $obj->handle; ?>"
462
+ type="checkbox"
463
+ name="wpacu_bulk_unload_scripts[post_type][<?php echo $data['post_type']; ?>][]"
464
+ value="<?php echo $obj->handle; ?>"/>
465
+ Unload on All Pages of <strong><?php echo $data['post_type']; ?></strong> post type</label>
466
+ </li>
467
+ <?php
468
+ }
469
+ }
470
+ // [END] ALL PAGES HAVING THE SAME POST TYPE
471
+ ?>
472
+ </ul>
473
+ <?php if ($data['bulk_unloaded_type'] === 'post_type') { ?>
474
+ </div>
475
+ <?php }
476
+ // [@pro]
477
+ do_action('wpacu_pro_bulk_unload_output', $data, $obj, 'js');
478
+ // [/@pro]
479
+ ?>
480
+
481
+ <ul class="wpacu_asset_options">
482
+ <li id="wpacu_load_it_option_script_<?php echo $obj->handle; ?>">
483
+ <label><input data-handle="<?php echo $obj->handle; ?>"
484
+ id="wpacu_script_load_it_<?php echo $obj->handle; ?>"
485
+ class="wpacu_load_it_option wpacu_script wpacu_load_exception"
486
+ type="checkbox"
487
+ name="wpacu_scripts_load_it[]"
488
+ <?php if ($isLoadException) { ?> checked="checked" <?php } ?>
489
+ value="<?php echo $obj->handle; ?>" />
490
+ Load it on this page (make exception<?php if (! $isGlobalRule) { echo ' * works only IF any of rules above is selected'; } ?>)</label>
491
+ </li>
492
+ </ul>
493
+ <?php
494
+ if (isset($obj->src) && $obj->src != '') {
495
+ ?>
496
+ <p><?php _e('Source:', WPACU_PLUGIN_NAME); ?> <a target="_blank" href="<?php echo $obj->srcHref; ?>"><?php echo $obj->src; ?></a></p>
497
+ <?php } ?>
498
+
499
+ <?php
500
+ if (! empty($obj->deps)) {
501
+ ?>
502
+ <p><?php echo __('Depends on:', WPACU_PLUGIN_NAME) . ' ' . implode(', ', $obj->deps); ?></p>
503
+ <?php
504
+ }
505
+
506
+ if (isset($obj->ver) && $obj->ver != '') {
507
+ ?>
508
+ <p><?php _e('Version:', WPACU_PLUGIN_NAME); ?> <?php echo $obj->ver; ?></p>
509
+ <?php
510
+ }
511
+
512
+ if (isset($obj->extra->data) && ! empty($obj->extra->data)) { ?>
513
+ <p><?php _e('Inline:', WPACU_PLUGIN_NAME); ?> <em><?php echo strip_tags($obj->extra->data); ?></em></p>
514
+ <?php
515
+ }
516
+
517
+ if (isset($obj->position) && $obj->position != '') {
518
+ ?>
519
+ <p><?php _e('Position:', WPACU_PLUGIN_NAME); ?> <?php echo ($obj->position == 'head') ? 'HEAD' : 'BODY'; ?></p>
520
+ <?php
521
+ }
522
+ ?>
523
+ </td>
524
+ </tr>
525
+ <?php
526
+ }
527
+ ?>
528
+ </tbody>
529
+ </table>
530
+ <?php
531
+ } else {
532
+ echo __('It looks like there are no public .js files loaded or the ones visible do not follow <a href="https://codex.wordpress.org/Function_Reference/wp_enqueue_script">the WordPress way of enqueuing scripts</a>.', WPACU_PLUGIN_NAME);
533
+ }
534
+ /*
535
+ * -------------------
536
+ * [END] SCRIPTS LIST
537
+ * -------------------
538
+ */
templates/meta-box-loaded.php CHANGED
@@ -75,539 +75,7 @@ if (isset($data['page_template'])) {
75
  <?php
76
  }
77
 
78
- /*
79
- * --------------------
80
- * [START] STYLES LIST
81
- * --------------------
82
- */
83
- ?>
84
-
85
- <h3><span style="font-size: 120%; line-height: 130%;" class="dashicons dashicons-admin-appearance"></span> &nbsp; <?php _e('Styles (.css files)', WPACU_PLUGIN_NAME); ?></h3>
86
-
87
- <?php
88
- if ($data['total_styles']) {
89
- ?>
90
- <h4>&#10141; Total enqueued stylesheets: <strong><?php echo $data['total_styles']; ?></strong></h4>
91
- <?php
92
- }
93
- ?>
94
-
95
- <?php
96
- if (! empty($data['all']['styles'])) {
97
- ?>
98
- <p><?php echo sprintf(__('The following styles are loading on this page. Please select the ones that are %sNOT NEEDED%s. If you are not sure which ones to unload, it is better to leave them enabled (unchecked) and consult with a developer about unloading the assets.', WPACU_PLUGIN_NAME), '<span style="color: #CC0000;"><strong>', '</strong></span>'); ?></p>
99
- <p><?php echo __('"Load in on this page (make exception)" will take effect when a bulk unload rule is used. Otherwise, the asset will load anyway unless you select it for unload.', WPACU_PLUGIN_NAME); ?></p>
100
- <?php
101
- if ($data['core_styles_loaded']) {
102
- ?>
103
- <div class="wpacu_note wpacu_warning"><em><?php
104
- echo sprintf(
105
- __('Assets that are marked with %s are part of WordPress core files. Be careful if you decide to unload them!', WPACU_PLUGIN_NAME),
106
- '<span class="dashicons dashicons-warning"></span>'
107
- );
108
- ?>
109
- </em></div><br />
110
- <?php
111
- }
112
- ?>
113
-
114
- <table class="wp-asset-clean-up wp-list-table widefat wpacu_widefat fixed striped wpacu_striped">
115
- <tbody>
116
- <?php
117
- foreach ($data['all']['styles'] as $obj) {
118
- $active = (isset($data['current']['styles']) && in_array($obj->handle, $data['current']['styles']));
119
-
120
- $class = ($active) ? 'wpacu_not_load' : '';
121
- $checked = ($active) ? 'checked="checked"' : '';
122
-
123
- /*
124
- * $isGlobalRule is only used to apply a red background in the style's area to point out that the style is unloaded
125
- * is set to `true` if either the asset is unloaded everywhere or it's unloaded on a group of pages (such as all pages belonging to 'page' post type)
126
- */
127
- $globalUnloaded = $bulkTypeUnloaded = $isPostTypeUnloaded = $isLoadException = $isGlobalRule = false;
128
-
129
- // Mark it as unloaded - Everywhere
130
- if (in_array($obj->handle, $data['global_unload']['styles'])) {
131
- $globalUnloaded = $isGlobalRule = true;
132
- }
133
-
134
- // Mark it as unloaded - for the Current Post Type
135
- if ($data['bulk_unloaded_type'] && in_array($obj->handle, $data['bulk_unloaded'][$data['bulk_unloaded_type']]['styles'])) {
136
- $bulkTypeUnloaded = $isGlobalRule = true;
137
-
138
- if ($data['bulk_unloaded_type'] === 'post_type') {
139
- $isPostTypeUnloaded = true;
140
- }
141
- }
142
-
143
- if ($isGlobalRule) {
144
- if (in_array($obj->handle, $data['load_exceptions']['styles'])) {
145
- $isLoadException = true;
146
- } else {
147
- $class .= ' wpacu_not_load';
148
- }
149
- }
150
-
151
- $class .= ' style_'.$obj->handle;
152
- ?>
153
- <tr class="wpacu_asset_row <?php echo $class; ?>">
154
- <td valign="top" style="width: 100%;">
155
- <p style="margin-top: 0;">
156
- <label for="style_<?php echo $obj->handle; ?>"><?php _e('Handle:', WPACU_PLUGIN_NAME); ?> <strong><span style="color: green;"><?php echo $obj->handle; ?></span></strong></label>
157
- <?php
158
- if (isset($obj->wp) && $obj->wp) {
159
- ?>
160
- <span class="dashicons dashicons-warning"></span>
161
- <?php
162
- }
163
- ?>
164
- </p>
165
-
166
- <div>
167
- <ul class="wpacu_asset_options">
168
- <li>
169
- <label><input id="style_<?php echo $obj->handle; ?>" <?php if ($globalUnloaded) { echo 'disabled="disabled"'; } echo $checked; ?> name="<?php echo WPACU_PLUGIN_NAME; ?>[styles][]" class="icheckbox_square-red" type="checkbox" value="<?php echo $obj->handle; ?>" /> &nbsp;Unload on this page</label>
170
- </li>
171
- </div>
172
-
173
- <div style="padding: 5px 10px; margin: 15px 0; background: white; border: 1px solid #eee; border-radius: 5px;">
174
- <?php
175
- // Unloaded Everywhere
176
- if ($globalUnloaded) {
177
- ?>
178
- <p><strong style="color: #d54e21;">This stylesheet file is unloaded everywhere</strong></p>
179
- <div class="clear"></div>
180
- <?php
181
- }
182
- ?>
183
-
184
- <ul class="wpacu_asset_options">
185
- <?php
186
- // [START] UNLOAD EVERYWHERE
187
- if ($globalUnloaded) {
188
- ?>
189
- <li>
190
- <label><input data-handle="<?php echo $obj->handle; ?>"
191
- class="wpacu_global_option wpacu_style"
192
- type="radio"
193
- name="wpacu_options_styles[<?php echo $obj->handle; ?>]"
194
- checked="checked"
195
- value="default" />
196
- Keep the unload global rule</label>
197
- </li>
198
-
199
- <li>
200
- <label><input data-handle="<?php echo $obj->handle; ?>"
201
- class="wpacu_global_option wpacu_style"
202
- type="radio"
203
- name="wpacu_options_styles[<?php echo $obj->handle; ?>]"
204
- value="remove" />
205
- Remove global unload rule</label>
206
- </li>
207
- <?php
208
- } else {
209
- ?>
210
- <li>
211
- <label><input data-handle="<?php echo $obj->handle; ?>"
212
- class="wpacu_global_unload wpacu_global_style"
213
- id="wpacu_global_unload_style_<?php echo $obj->handle; ?>" type="checkbox"
214
- name="wpacu_global_unload_styles[]" value="<?php echo $obj->handle; ?>"/>
215
- Unload Everywhere</label>
216
- </li>
217
- <?php
218
- }
219
- // [END] UNLOAD EVERYWHERE
220
- ?>
221
- </ul>
222
- </div>
223
-
224
- <?php if ($data['bulk_unloaded_type'] === 'post_type') { ?>
225
- <div style="padding: 5px 10px; margin: 15px 0; background: white; border: 1px solid #eee; border-radius: 5px;">
226
- <?php } ?>
227
-
228
- <?php
229
- // Unloaded On All Pages Belonging to the page's Post Type
230
- if ($isPostTypeUnloaded) {
231
- ?>
232
- <p><strong style="color: #d54e21;">This stylesheet file is unloaded on all <u><?php echo $data['post_type']; ?></u> post types.</strong></p>
233
- <div class="clear"></div>
234
- <?php
235
- }
236
- ?>
237
-
238
- <?php
239
- if ($data['bulk_unloaded_type'] === 'post_type') {
240
- ?>
241
- <ul class="wpacu_asset_options">
242
- <?php
243
- // [START] ALL PAGES HAVING THE SAME POST TYPE
244
- if ($isPostTypeUnloaded) {
245
- ?>
246
- <li>
247
- <label><input data-handle="<?php echo $obj->handle; ?>"
248
- class="wpacu_bulk_option wpacu_style wpacu_keep_bulk_rule"
249
- type="radio"
250
- name="wpacu_options_post_type_styles[<?php echo $obj->handle; ?>]"
251
- checked="checked"
252
- value="default"/>
253
- Keep rule</label>
254
- </li>
255
-
256
- <li>
257
- <label><input data-handle="<?php echo $obj->handle; ?>"
258
- class="wpacu_bulk_option wpacu_style wpacu_remove_bulk_rule"
259
- type="radio"
260
- name="wpacu_options_post_type_styles[<?php echo $obj->handle; ?>]"
261
- value="remove"/>
262
- Remove rule</label>
263
- </li>
264
- <?php
265
- } else {
266
- ?>
267
- <li>
268
- <label><input data-handle="<?php echo $obj->handle; ?>"
269
- class="wpacu_bulk_unload wpacu_post_type_unload wpacu_post_type_style"
270
- id="wpacu_bulk_unload_post_type_style_<?php echo $obj->handle; ?>"
271
- type="checkbox"
272
- name="wpacu_bulk_unload_styles[post_type][<?php echo $data['post_type']; ?>][]"
273
- value="<?php echo $obj->handle; ?>"/>
274
- Unload on All Pages of <strong><?php echo $data['post_type']; ?></strong> post type</label>
275
- </li>
276
- <?php
277
- }
278
- ?>
279
- </ul>
280
- <?php
281
- }
282
- // [END] ALL PAGES HAVING THE SAME POST TYPE
283
- ?>
284
-
285
- <?php if ($data['bulk_unloaded_type'] === 'post_type') { ?>
286
- </div>
287
- <?php } ?>
288
-
289
- <?php
290
- do_action('wpacu_pro_bulk_unload_output', $data, $obj, 'css');
291
- ?>
292
-
293
- <ul class="wpacu_asset_options">
294
- <li id="wpacu_load_it_option_style_<?php echo $obj->handle; ?>">
295
- <label><input data-handle="<?php echo $obj->handle; ?>"
296
- id="wpacu_style_load_it_<?php echo $obj->handle; ?>"
297
- class="wpacu_load_it_option wpacu_style wpacu_load_exception"
298
- type="checkbox"
299
- <?php if ($isLoadException) { ?> checked="checked" <?php } ?>
300
- name="wpacu_styles_load_it[]"
301
- value="<?php echo $obj->handle; ?>"/>
302
- Load it on this page (make exception<?php if (! $isGlobalRule) { echo ' * works only IF any of rules above is selected'; } ?>)</label>
303
- </li>
304
- </ul>
305
- <?php
306
- if (isset($obj->src) && $obj->src != '') {
307
- ?>
308
- <p><?php _e('Source:', WPACU_PLUGIN_NAME); ?> <a target="_blank" href="<?php echo $obj->srcHref; ?>"><?php echo $obj->src; ?></a></p>
309
- <?php }
310
-
311
- if (! empty($obj->deps)) {
312
- ?>
313
- <p><?php echo __('Depends on:', WPACU_PLUGIN_NAME) . ' ' . implode(', ', $obj->deps); ?></p>
314
- <?php
315
- }
316
-
317
- if ($obj->ver) {
318
- ?>
319
- <p><?php _e('Version:', WPACU_PLUGIN_NAME); ?> <?php echo $obj->ver; ?></p>
320
- <?php
321
- }
322
-
323
- if (isset($obj->extra->data) && ! empty($obj->extra->data)) { ?>
324
- <p><?php _e('Inline:', WPACU_PLUGIN_NAME); ?> <em><?php echo $obj->extra->data; ?></em></p>
325
- <?php } ?>
326
- </td>
327
- </tr>
328
- <?php
329
- }
330
- ?>
331
- </tbody>
332
- </table>
333
- <?php
334
- } else {
335
- echo __('It looks like there are no public .css files loaded or the ones visible do not follow <a href="https://codex.wordpress.org/Function_Reference/wp_enqueue_style">the WordPress way of enqueuing styles</a>.', WPACU_PLUGIN_NAME);
336
- }
337
- /* -------------------
338
- * [END] STYLES LIST
339
- * -------------------
340
- */
341
-
342
- /*
343
- * ---------------------
344
- * [START] SCRIPTS LIST
345
- * ---------------------
346
- */
347
- ?>
348
- <h3><span style="font-size: 120%; line-height: 130%;" class="dashicons dashicons-media-code"></span> &nbsp; <?php _e('Scripts (.js files)', WPACU_PLUGIN_NAME); ?></h3>
349
-
350
- <?php
351
- if ($data['total_scripts']) {
352
- ?>
353
- <h4>&#10141; Total enqueued JavaScript files: <strong><?php echo $data['total_scripts']; ?></strong></h4>
354
- <?php
355
- }
356
- ?>
357
-
358
- <?php
359
- if (! empty($data['all']['scripts'])) {
360
- ?>
361
- <p><?php echo sprintf(__('The following scripts are loading on this page. Please select the ones that are %sNOT NEEDED%s. If you are not sure which ones to unload, it is better to leave them enabled and consult with a developer about unloading the assets.', WPACU_PLUGIN_NAME), '<span style="color: #CC0000;"><strong>', '</strong></span>'); ?></p>
362
- <p><?php echo __('"Load in on this page (make exception)" will take effect when a bulk unload rule is used. Otherwise, the asset will load anyway unless you select it for unload.', WPACU_PLUGIN_NAME); ?></p>
363
- <?php
364
- if ($data['core_scripts_loaded']) {
365
- ?>
366
- <div class="wpacu_note wpacu_warning"><em><?php
367
- echo sprintf(
368
- __('Assets that are marked with %s are part of WordPress core files. Be careful if you decide to unload them!', WPACU_PLUGIN_NAME),
369
- '<span class="dashicons dashicons-warning"></span>'
370
- );
371
- ?>
372
- </em></div><br />
373
- <?php
374
- }
375
- ?>
376
-
377
- <table class="wp-list-table widefat wpacu_widefat fixed striped wpacu_striped">
378
- <tbody>
379
- <?php
380
- foreach ($data['all']['scripts'] as $obj) {
381
- $active = (isset($data['current']['scripts']) && in_array($obj->handle, $data['current']['scripts']));
382
-
383
- $class = ($active) ? 'wpacu_not_load' : '';
384
- $checked = ($active) ? 'checked="checked"' : '';
385
-
386
- /*
387
- * $isGlobalRule is only used to apply a red background in the script's area to point out that the script is unloaded
388
- */
389
- $globalUnloaded = $bulkTypeUnloaded = $isPostTypeUnloaded = $isLoadException = $isGlobalRule = false;
390
-
391
- // Mark it as unloaded - Everywhere
392
- if (in_array($obj->handle, $data['global_unload']['scripts']) && !$class) {
393
- $globalUnloaded = $isGlobalRule = true;
394
- }
395
-
396
- // Mark it as unloaded - for the Current Post Type
397
- if ($data['bulk_unloaded_type'] && in_array($obj->handle, $data['bulk_unloaded'][$data['bulk_unloaded_type']]['scripts'])) {
398
- $bulkTypeUnloaded = $isGlobalRule = true;
399
-
400
- if ($data['bulk_unloaded_type'] === 'post_type') {
401
- $isPostTypeUnloaded = true;
402
- }
403
- }
404
-
405
- if ($isGlobalRule) {
406
- if (in_array($obj->handle, $data['load_exceptions']['scripts'])) {
407
- $isLoadException = true;
408
- } else {
409
- $class .= ' wpacu_not_load';
410
- }
411
- }
412
-
413
- $class .= ' script_'.$obj->handle;
414
- ?>
415
- <tr class="wpacu_asset_row <?php echo $class; ?>">
416
- <td valign="top" style="width: 100%;">
417
- <p style="margin-top: 0;">
418
- <label for="script_<?php echo $obj->handle; ?>"> <?php _e('Handle:', WPACU_PLUGIN_NAME); ?> <strong><span style="color: green;"><?php echo $obj->handle; ?></span></strong></label>
419
- <?php
420
- if (isset($obj->wp) && $obj->wp) {
421
- ?>
422
- <span class="dashicons dashicons-warning"></span>
423
- <?php
424
- }
425
- ?>
426
- </p>
427
-
428
- <?php
429
- // Unloaded Everywhere
430
- if ($globalUnloaded) {
431
- ?>
432
- <p><strong style="color: #d54e21;">This JavaScript file is unloaded everywhere</strong></p>
433
- <?php
434
- }
435
- ?>
436
-
437
- <div style="padding: 5px 10px; margin: 15px 0; background: white; border: 1px solid #eee; border-radius: 5px;">
438
- <ul class="wpacu_asset_options">
439
- <li>
440
- <label><input id="script_<?php echo $obj->handle; ?>" <?php if ($globalUnloaded) { echo 'disabled="disabled"'; } echo $checked; ?> name="<?php echo WPACU_PLUGIN_NAME; ?>[scripts][]" class="icheckbox_square-red" type="checkbox" value="<?php echo $obj->handle; ?>" /> &nbsp;Unload on this page</label>
441
- </li>
442
- </ul>
443
- </div>
444
-
445
- <div style="padding: 5px 10px; margin: 15px 0; background: white; border: 1px solid #eee; border-radius: 5px;">
446
- <ul class="wpacu_asset_options">
447
- <?php
448
- // [START] UNLOAD EVERYWHERE
449
- if ($globalUnloaded) {
450
- ?>
451
- <li>
452
- <label><input data-handle="<?php echo $obj->handle; ?>"
453
- class="wpacu_bulk_option wpacu_script"
454
- type="radio"
455
- name="wpacu_options_scripts[<?php echo $obj->handle; ?>]"
456
- checked="checked"
457
- value="default" />
458
- Keep the unload global rule</label>
459
- </li>
460
-
461
- <li>
462
- <label><input data-handle="<?php echo $obj->handle; ?>"
463
- class="wpacu_bulk_option wpacu_script"
464
- type="radio"
465
- name="wpacu_options_scripts[<?php echo $obj->handle; ?>]"
466
- value="remove" />
467
- Remove global unload rule</label>
468
- </li>
469
- <?php
470
- } else {
471
- ?>
472
- <li>
473
- <label><input data-handle="<?php echo $obj->handle; ?>"
474
- class="wpacu_global_unload wpacu_global_script"
475
- id="wpacu_global_unload_script_<?php echo $obj->handle; ?>"
476
- type="checkbox"
477
- name="wpacu_global_unload_scripts[]"
478
- value="<?php echo $obj->handle; ?>"/>
479
- Unload Everywhere</label>
480
- </li>
481
- <?php
482
- }
483
- // [END] UNLOAD EVERYWHERE
484
- ?>
485
-
486
- </ul>
487
- </div>
488
-
489
- <?php if ($data['bulk_unloaded_type'] === 'post_type') { ?>
490
- <div style="padding: 5px 10px; margin: 15px 0; background: white; border: 1px solid #eee; border-radius: 5px;">
491
- <?php } ?>
492
-
493
- <?php
494
- // Unloaded On All Pages Belonging to the page's Post Type
495
- if ($isPostTypeUnloaded) {
496
- ?>
497
- <p><strong style="color: #d54e21;">This JavaScript file is unloaded on all <u><?php echo $data['post_type']; ?></u> post types.</strong></p>
498
- <div class="clear"></div>
499
- <?php
500
- }
501
- ?>
502
-
503
- <ul class="wpacu_asset_options">
504
- <?php
505
- if ($data['bulk_unloaded_type'] === 'post_type') {
506
- // [START] ALL PAGES HAVING THE SAME POST TYPE
507
- if ($isPostTypeUnloaded) {
508
- ?>
509
- <li>
510
- <label><input data-handle="<?php echo $obj->handle; ?>"
511
- class="wpacu_post_type_option wpacu_post_type_script wpacu_keep_bulk_rule"
512
- type="radio"
513
- name="wpacu_options_post_type_scripts[<?php echo $obj->handle; ?>]"
514
- checked="checked"
515
- value="default"/>
516
- Keep rule</label>
517
- </li>
518
-
519
- <li>
520
- <label><input data-handle="<?php echo $obj->handle; ?>"
521
- class="wpacu_post_type_option wpacu_remove_bulk_rule wpacu_post_type_script"
522
- type="radio"
523
- name="wpacu_options_post_type_scripts[<?php echo $obj->handle; ?>]"
524
- value="remove"/>
525
- Remove rule</label>
526
- </li>
527
- <?php
528
- } else {
529
- ?>
530
- <li>
531
- <label><input data-handle="<?php echo $obj->handle; ?>"
532
- class="wpacu_bulk_unload wpacu_post_type_unload wpacu_post_type_script"
533
- id="wpacu_global_unload_post_type_script_<?php echo $obj->handle; ?>"
534
- type="checkbox"
535
- name="wpacu_bulk_unload_scripts[post_type][<?php echo $data['post_type']; ?>][]"
536
- value="<?php echo $obj->handle; ?>"/>
537
- Unload on All Pages of <strong><?php echo $data['post_type']; ?></strong> post type</label>
538
- </li>
539
- <?php
540
- }
541
- }
542
- // [END] ALL PAGES HAVING THE SAME POST TYPE
543
- ?>
544
- </ul>
545
- <?php if ($data['bulk_unloaded_type'] === 'post_type') { ?>
546
- </div>
547
- <?php } ?>
548
-
549
- <?php
550
- do_action('wpacu_pro_bulk_unload_output', $data, $obj, 'js');
551
- ?>
552
-
553
- <ul class="wpacu_asset_options">
554
- <li id="wpacu_load_it_option_script_<?php echo $obj->handle; ?>">
555
- <label><input data-handle="<?php echo $obj->handle; ?>"
556
- id="wpacu_script_load_it_<?php echo $obj->handle; ?>"
557
- class="wpacu_load_it_option wpacu_script wpacu_load_exception"
558
- type="checkbox"
559
- name="wpacu_scripts_load_it[]"
560
- <?php if ($isLoadException) { ?> checked="checked" <?php } ?>
561
- value="<?php echo $obj->handle; ?>" />
562
- Load it on this page (make exception<?php if (! $isGlobalRule) { echo ' * works only IF any of rules above is selected'; } ?>)</label>
563
- </li>
564
- </ul>
565
- <?php
566
- if (isset($obj->src) && $obj->src != '') {
567
- ?>
568
- <p><?php _e('Source:', WPACU_PLUGIN_NAME); ?> <a target="_blank" href="<?php echo $obj->srcHref; ?>"><?php echo $obj->src; ?></a></p>
569
- <?php } ?>
570
-
571
- <?php
572
- if (! empty($obj->deps)) {
573
- ?>
574
- <p><?php echo __('Depends on:', WPACU_PLUGIN_NAME) . ' ' . implode(', ', $obj->deps); ?></p>
575
- <?php
576
- }
577
-
578
- if (isset($obj->ver) && $obj->ver != '') {
579
- ?>
580
- <p><?php _e('Version:', WPACU_PLUGIN_NAME); ?> <?php echo $obj->ver; ?></p>
581
- <?php
582
- }
583
-
584
- if (isset($obj->extra->data) && ! empty($obj->extra->data)) { ?>
585
- <p><?php _e('Inline:', WPACU_PLUGIN_NAME); ?> <em><?php echo strip_tags($obj->extra->data); ?></em></p>
586
- <?php
587
- }
588
-
589
- if (isset($obj->position) && $obj->position != '') {
590
- ?>
591
- <p><?php _e('Position:', WPACU_PLUGIN_NAME); ?> <?php echo ($obj->position == 'head') ? 'HEAD' : 'BODY'; ?></p>
592
- <?php
593
- }
594
- ?>
595
- </td>
596
- </tr>
597
- <?php
598
- }
599
- ?>
600
- </tbody>
601
- </table>
602
- <?php
603
- } else {
604
- echo __('It looks like there are no public .js files loaded or the ones visible do not follow <a href="https://codex.wordpress.org/Function_Reference/wp_enqueue_script">the WordPress way of enqueuing scripts</a>.', WPACU_PLUGIN_NAME);
605
- }
606
- /*
607
- * -------------------
608
- * [END] SCRIPTS LIST
609
- * -------------------
610
- */
611
 
612
  /*
613
  Bug Fix: Make sure that savePost() from Update class is triggered ONLY if the meta box is loaded
75
  <?php
76
  }
77
 
78
+ include_once dirname(__FILE__).'/meta-box-loaded-assets/default.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
 
80
  /*
81
  Bug Fix: Make sure that savePost() from Update class is triggered ONLY if the meta box is loaded
templates/settings-bulk-unloads.php CHANGED
@@ -8,7 +8,7 @@ if (! isset($data)) {
8
 
9
  // TODO: Make sure other bulk unloaded elements such as "author", "taxonomy" etc. are here if pro version is enabled
10
  ?>
11
- <h1><?php echo apply_filters('wpacu_plugin_page_title', __('WP Asset CleanUp Lite', WPACU_PLUGIN_NAME)); ?></h1>
12
  <h2><?php _e('Bulk Unloads', WPACU_PLUGIN_NAME); ?></h2>
13
 
14
  <p>If <u>any of the options below are used</u>, then the assets will be shown here. <strong>Although, you can manage them when editing a page/post, this page will make things easier by seeing all the bulk unloads:</strong></p>
8
 
9
  // TODO: Make sure other bulk unloaded elements such as "author", "taxonomy" etc. are here if pro version is enabled
10
  ?>
11
+ <h1><?php echo apply_filters('wpacu_plugin_page_title', __('Asset CleanUp Lite', WPACU_PLUGIN_NAME)); ?></h1>
12
  <h2><?php _e('Bulk Unloads', WPACU_PLUGIN_NAME); ?></h2>
13
 
14
  <p>If <u>any of the options below are used</u>, then the assets will be shown here. <strong>Although, you can manage them when editing a page/post, this page will make things easier by seeing all the bulk unloads:</strong></p>
templates/settings-frontend.php CHANGED
@@ -9,7 +9,7 @@ if (! isset($data)) {
9
 
10
  <form action="#wpacu_wrap_assets" method="post">
11
  <div id="wpacu_wrap_assets">
12
- <h1><?php echo apply_filters('wpacu_plugin_page_title', 'WP Asset CleanUp Lite'); ?></h1>
13
  <?php
14
  if ($data['is_updateable']) {
15
  ?>
@@ -30,31 +30,34 @@ if (! isset($data)) {
30
  <?php
31
  }
32
 
 
33
  do_action('wpacu_pro_frontend_before_asset_list');
 
34
 
35
  require_once 'meta-box-loaded.php';
36
  } else {
37
  // Category, Tag, Search, 404, Author, Date pages (not supported by Lite version)
 
38
 
39
  if (\WpAssetCleanUp\Main::isWpDefaultSearchPage()) {
40
- echo '<span class="dashicons dashicons-search"></span> This is a <strong>WordPress Search Page</strong> and it is available in WP Asset CleanUp Pro.';
41
  } elseif (is_404()) {
42
- echo '<span class="dashicons dashicons-warning"></span> This is a <strong>404 (Not Found) Page</strong> and it is available in WP Asset CleanUp Pro.';
43
  } elseif (is_author()) {
44
- echo '<span class="dashicons dashicons-admin-users"></span> This is an <strong>Author Page</strong> and it is available in WP Asset CleanUp Pro.';
45
  } elseif (is_category()) {
46
- echo '<span class="dashicons dashicons-category"></span> This is a <strong>Category (Taxonomy) Page</strong> and it is available in WP Asset CleanUp Pro.';
47
  } elseif (function_exists('is_product_category') && is_product_category()) {
48
- echo '<img src="'.WPACU_PLUGIN_URL . '/assets/icons/woocommerce-icon-logo.svg'.'" alt="" style="height: 40px !important; margin-top: -6px; margin-right: 5px;" align="middle" /> This is a <strong>WooCommerce Product Category (Taxonomy) Page</strong> and it is available in WP Asset CleanUp Pro.';
49
  } elseif (is_date()) {
50
- echo '<span class="dashicons dashicons-calendar-alt"></span> This is a <strong>Date (Archive) Page</strong> and it is available in WP Asset CleanUp Pro.';
51
  } elseif (is_tag()) {
52
- echo '<span class="dashicons dashicons-tag"></span> This is a <strong>Tag (Archive) Page</strong> and it is available in WP Asset CleanUp Pro.';
53
  } elseif (is_tax()) {
54
- echo '<span class="dashicons dashicons-tag"></span> This is a <strong>Taxonomy Page</strong> and it is available in WP Asset CleanUp Pro.';
55
  }
56
  ?>
57
- <p><a class="go-pro-button" target="_blank" href="https://www.gabelivan.com/items/wp-asset-cleanup-pro/"><span class="dashicons dashicons-star-filled"></span>&nbsp; Get WP Asset CleanUp Pro</a> <em>* starting from $29</em></p>
58
  <?php
59
  }
60
 
@@ -66,7 +69,7 @@ if (! isset($data)) {
66
  name="submit"><span class="dashicons dashicons-update"></span> <?php esc_attr_e('UPDATE', WPACU_PLUGIN_NAME); ?></button>
67
  </div>
68
 
69
- <p align="right"><small>Powered by WP Asset CleanUp</small></p>
70
  <?php } ?>
71
  </div>
72
 
9
 
10
  <form action="#wpacu_wrap_assets" method="post">
11
  <div id="wpacu_wrap_assets">
12
+ <h1><?php echo apply_filters('wpacu_plugin_page_title', 'Asset CleanUp Lite'); ?></h1>
13
  <?php
14
  if ($data['is_updateable']) {
15
  ?>
30
  <?php
31
  }
32
 
33
+ // [@pro]
34
  do_action('wpacu_pro_frontend_before_asset_list');
35
+ // [/@pro]
36
 
37
  require_once 'meta-box-loaded.php';
38
  } else {
39
  // Category, Tag, Search, 404, Author, Date pages (not supported by Lite version)
40
+ $contentUnlockFeature = ' <p style="border-radius: 10px; padding: 10px; background: #f2faf2; border: 1px solid #c0e8c0; width: auto; display: inline-block;">To unlock this feature, you can get the premium extension.</p>';
41
 
42
  if (\WpAssetCleanUp\Main::isWpDefaultSearchPage()) {
43
+ echo '<span class="dashicons dashicons-search"></span> This is a <strong>WordPress Search Page</strong> and unloading the unneeded CSS &amp; JS can be done in Asset CleanUp Pro.'.$contentUnlockFeature;
44
  } elseif (is_404()) {
45
+ echo '<span class="dashicons dashicons-warning"></span> This is a <strong>404 (Not Found) Page</strong> and unloading the unneeded CSS &amp; JS can be done in Asset CleanUp Pro.'.$contentUnlockFeature;
46
  } elseif (is_author()) {
47
+ echo '<span class="dashicons dashicons-admin-users"></span> This is an <strong>Author Page</strong> and unloading the unneeded CSS &amp; JS can be done in Asset CleanUp Pro.'.$contentUnlockFeature;
48
  } elseif (is_category()) {
49
+ echo '<span class="dashicons dashicons-category"></span> This is a <strong>Category (Taxonomy) Page</strong> and unloading the unneeded CSS &amp; JS can be done in Asset CleanUp Pro.'.$contentUnlockFeature;
50
  } elseif (function_exists('is_product_category') && is_product_category()) {
51
+ echo '<img src="'.WPACU_PLUGIN_URL . '/assets/icons/woocommerce-icon-logo.svg'.'" alt="" style="height: 40px !important; margin-top: -6px; margin-right: 5px;" align="middle" /> This is a <strong>WooCommerce Product Category (Taxonomy) Page</strong> and unloading the unneeded CSS &amp; JS can be done in Asset CleanUp Pro. '.$contentUnlockFeature;
52
  } elseif (is_date()) {
53
+ echo '<span class="dashicons dashicons-calendar-alt"></span> This is a <strong>Date (Archive) Page</strong> and unloading the unneeded CSS &amp; JS can be done in Asset CleanUp Pro.'.$contentUnlockFeature;
54
  } elseif (is_tag()) {
55
+ echo '<span class="dashicons dashicons-tag"></span> This is a <strong>Tag (Archive) Page</strong> and unloading the unneeded CSS &amp; JS can be done in Asset CleanUp Pro.'.$contentUnlockFeature;
56
  } elseif (is_tax()) {
57
+ echo '<span class="dashicons dashicons-tag"></span> This is a <strong>Taxonomy Page</strong> and unloading the unneeded CSS &amp; JS can be done in Asset CleanUp Pro.'.$contentUnlockFeature;
58
  }
59
  ?>
60
+ <p><a class="go-pro-button" target="_blank" href="https://www.gabelivan.com/items/wp-asset-cleanup-pro/"><span class="dashicons dashicons-cart"></span>&nbsp; Upgrade to Asset CleanUp Pro</a> <em>* starting from $29</em></p>
61
  <?php
62
  }
63
 
69
  name="submit"><span class="dashicons dashicons-update"></span> <?php esc_attr_e('UPDATE', WPACU_PLUGIN_NAME); ?></button>
70
  </div>
71
 
72
+ <p align="right"><small>Powered by Asset CleanUp Lite, version <?php echo WPACU_PLUGIN_VERSION; ?></small></p>
73
  <?php } ?>
74
  </div>
75
 
templates/settings-home-page.php CHANGED
@@ -6,7 +6,7 @@ if (! isset($data)) {
6
  exit;
7
  }
8
  ?>
9
- <h1><?php echo apply_filters('wpacu_plugin_page_title', __('WP Asset CleanUp Lite', WPACU_PLUGIN_NAME)); ?></h1>
10
  <h2><?php _e('Home Page Scripts &amp; Styles Management', WPACU_PLUGIN_NAME); ?></h2>
11
 
12
  <?php
6
  exit;
7
  }
8
  ?>
9
+ <h1><?php echo apply_filters('wpacu_plugin_page_title', __('Asset CleanUp Lite', WPACU_PLUGIN_NAME)); ?></h1>
10
  <h2><?php _e('Home Page Scripts &amp; Styles Management', WPACU_PLUGIN_NAME); ?></h2>
11
 
12
  <?php
templates/settings-plugin.php CHANGED
@@ -7,7 +7,7 @@ if (! isset($data)) {
7
  }
8
  ?>
9
  <div class="wrap">
10
- <h1><?php echo apply_filters('wpacu_plugin_page_title', __('WP Asset CleanUp Lite', WPACU_PLUGIN_NAME)); ?></h1>
11
 
12
  <form method="post" action="">
13
  <input type="hidden" name="wpacu_settings_page" value="1" />
@@ -30,7 +30,9 @@ if (! isset($data)) {
30
  <p><small>Note that sometimes the assets list is not loading within the Dashboard. That could be because "mod_security" Apache module is enabled or some securiy plugins are blocking the AJAX request. If this option doesn't work, consider managing the list in the front-end view.</small></p>
31
  </td>
32
  </tr>
33
- <tr valign="top">
 
 
34
  <th scope="row">
35
  <label for="wpacu_dom_get_type">Assets Retrieval Mode (if managed in the Dashboard)</label>
36
  </th>
7
  }
8
  ?>
9
  <div class="wrap">
10
+ <h1><?php echo apply_filters('wpacu_plugin_page_title', __('Asset CleanUp Lite', WPACU_PLUGIN_NAME)); ?></h1>
11
 
12
  <form method="post" action="">
13
  <input type="hidden" name="wpacu_settings_page" value="1" />
30
  <p><small>Note that sometimes the assets list is not loading within the Dashboard. That could be because "mod_security" Apache module is enabled or some securiy plugins are blocking the AJAX request. If this option doesn't work, consider managing the list in the front-end view.</small></p>
31
  </td>
32
  </tr>
33
+ <tr id="wpacu-settings-assets-retrieval-mode"
34
+ <?php if (! ($data['dashboard_show'] == 1)) { echo 'style="display: none;"'; } ?>
35
+ valign="top">
36
  <th scope="row">
37
  <label for="wpacu_dom_get_type">Assets Retrieval Mode (if managed in the Dashboard)</label>
38
  </th>
wpacu.php CHANGED
@@ -1,29 +1,43 @@
1
  <?php
2
  /*
3
- * Plugin Name: WP Asset CleanUp Lite (Page Speed Optimizer)
4
  * Plugin URI: https://wordpress.org/plugins/wp-asset-clean-up/
5
- * Version: 1.2.6.7
6
- * Description: Prevent Chosen Scripts & Styles from loading in Posts/Pages that you don't need
7
  * Author: Gabriel Livan
8
  * Author URI: http://www.gabelivan.com/
9
  */
10
 
 
 
11
  // Exit if accessed directly
12
  if (! defined('ABSPATH')) {
13
  exit;
14
  }
15
 
16
- // Could be already set by the premium extension
17
- // Keep the text domain the same
18
- if (! defined('WPACU_PLUGIN_NAME')) {
19
- define('WPACU_PLUGIN_NAME', 'wpassetcleanup');
 
 
 
 
 
 
 
 
 
20
  }
21
 
 
22
  define('WPACU_PLUGIN_CLASSES_PATH', dirname(__FILE__).'/classes/');
23
  define('WPACU_PLUGIN_FILE', __FILE__);
24
  define('WPACU_PLUGIN_BASE', plugin_basename(WPACU_PLUGIN_FILE));
25
  define('WPACU_PLUGIN_URL', plugins_url('', WPACU_PLUGIN_FILE));
26
 
 
 
27
  // Do not load the plugin if the PHP version is below 5.3
28
  $wpacuWrongPhp = version_compare(PHP_VERSION, '5.3.0', '<');
29
 
@@ -40,6 +54,7 @@ if (is_admin() && $wpacuWrongPhp) { // Dashboard
40
 
41
  // The premium extension too (if any)
42
  deactivate_plugins('wp-asset-clean-up-pro/wpacu-pro.php');
 
43
  }
44
 
45
  /**
@@ -48,7 +63,7 @@ if (is_admin() && $wpacuWrongPhp) { // Dashboard
48
  function wpAssetCleanUpWrongPhpNotice()
49
  {
50
  echo '<div class="error is-dismissible"><p>'.
51
- __('<strong>WP Asset CleanUp</strong> requires <span style="color: green;"><strong>5.3+</strong> PHP version</span> installed. You have <strong>'.PHP_VERSION.'</strong>. If your website is working in 5.3+ (check with your developers if you are not sure), then an upgrade is highly recommended. The plugin has been deactivated.', WPACU_PLUGIN_NAME).
52
  '</p></div>';
53
 
54
  if (array_key_exists('active', $_GET)) {
1
  <?php
2
  /*
3
+ * Plugin Name: Asset CleanUp LITE: Page Speed Optimizer
4
  * Plugin URI: https://wordpress.org/plugins/wp-asset-clean-up/
5
+ * Version: 1.2.6.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://www.gabelivan.com/
9
  */
10
 
11
+ define('WPACU_PLUGIN_VERSION', '1.2.6.9');
12
+
13
  // Exit if accessed directly
14
  if (! defined('ABSPATH')) {
15
  exit;
16
  }
17
 
18
+ // Premium plugin version already exists, is it active?
19
+ // Do not load the LITE version as it's pointless
20
+ // This action is valid starting from LITE version 1.2.6.8
21
+ // From 1.0.3, the PRO version works independently (does not need anymore LITE to be active and act as a parent plugin)
22
+ if (! is_admin()) {
23
+ include_once(ABSPATH . 'wp-admin/includes/plugin.php');
24
+ }
25
+
26
+ // If the pro version (version above 1.0.2) was triggered first, we'll just check one of its constants
27
+ // If the lite version was triggered first, then we'll check if the pro version is active
28
+ if ((defined('WPACU_PRO_NO_LITE_NEEDED') && WPACU_PRO_PLUGIN_VERSION === true)
29
+ || (file_exists(dirname(dirname(__FILE__)).'/wp-asset-clean-up-pro/wpacu.php') && is_plugin_active('wp-asset-clean-up-pro/wpacu.php'))) {
30
+ return;
31
  }
32
 
33
+ define('WPACU_PLUGIN_NAME', 'wpassetcleanup');
34
  define('WPACU_PLUGIN_CLASSES_PATH', dirname(__FILE__).'/classes/');
35
  define('WPACU_PLUGIN_FILE', __FILE__);
36
  define('WPACU_PLUGIN_BASE', plugin_basename(WPACU_PLUGIN_FILE));
37
  define('WPACU_PLUGIN_URL', plugins_url('', WPACU_PLUGIN_FILE));
38
 
39
+ define('WPACU_PLUGIN_GO_PRO_LINK', 'https://www.gabelivan.com/items/wp-asset-cleanup-pro/');
40
+
41
  // Do not load the plugin if the PHP version is below 5.3
42
  $wpacuWrongPhp = version_compare(PHP_VERSION, '5.3.0', '<');
43
 
54
 
55
  // The premium extension too (if any)
56
  deactivate_plugins('wp-asset-clean-up-pro/wpacu-pro.php');
57
+ deactivate_plugins('wp-asset-clean-up-pro/wpacu.php');
58
  }
59
 
60
  /**
63
  function wpAssetCleanUpWrongPhpNotice()
64
  {
65
  echo '<div class="error is-dismissible"><p>'.
66
+ __('<strong>Asset CleanUp Lite</strong> requires <span style="color: green;"><strong>5.3+</strong> PHP version</span> installed. You have <strong>'.PHP_VERSION.'</strong>. If your website is working in 5.3+ (check with your developers if you are not sure), then an upgrade is highly recommended. The plugin has been deactivated.', WPACU_PLUGIN_NAME).
67
  '</p></div>';
68
 
69
  if (array_key_exists('active', $_GET)) {