Version Description
- New Feature: Disable Emojis Site-Wide
- Hide "WP Asset Clean Up" menu if the logged in user doesn't have 'manage_options' capabilities (technically, it's just for administrators)
Download this release
Release Info
Developer | gabelivan |
Plugin | Asset CleanUp: Page Speed Booster |
Version | 1.2.6 |
Comparing to | |
See all releases |
Code changes from version 1.2.5.3 to 1.2.6
- classes/Main.php +43 -0
- classes/Menu.php +24 -13
- classes/OwnAssets.php +1 -1
- classes/Settings.php +2 -1
- readme.txt +6 -2
- templates/settings-plugin.php +18 -1
- wpacu.php +1 -1
classes/Main.php
CHANGED
@@ -84,6 +84,11 @@ class Main
|
|
84 |
*/
|
85 |
public $isFrontendView = false;
|
86 |
|
|
|
|
|
|
|
|
|
|
|
87 |
/**
|
88 |
* @var array
|
89 |
*/
|
@@ -136,6 +141,7 @@ class Main
|
|
136 |
|
137 |
$this->frontendShow = $this->settings['frontend_show'];
|
138 |
$this->dashboardShow = $this->settings['dashboard_show'];
|
|
|
139 |
|
140 |
if ($this->dashboardShow && $this->settings['dom_get_type'] != '') {
|
141 |
self::$domGetType = $this->settings['dom_get_type'];
|
@@ -185,6 +191,10 @@ class Main
|
|
185 |
|
186 |
add_action('add_meta_boxes', array($this, 'addMetaBox'));
|
187 |
}
|
|
|
|
|
|
|
|
|
188 |
}
|
189 |
|
190 |
/**
|
@@ -1177,4 +1187,37 @@ class Main
|
|
1177 |
{
|
1178 |
return (array_key_exists('page', $_GET) && $_GET['page'] === WPACU_PLUGIN_NAME.'_settings');
|
1179 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1180 |
}
|
84 |
*/
|
85 |
public $isFrontendView = false;
|
86 |
|
87 |
+
/**
|
88 |
+
* @var bool|mixed
|
89 |
+
*/
|
90 |
+
public $disableEmojis = false;
|
91 |
+
|
92 |
/**
|
93 |
* @var array
|
94 |
*/
|
141 |
|
142 |
$this->frontendShow = $this->settings['frontend_show'];
|
143 |
$this->dashboardShow = $this->settings['dashboard_show'];
|
144 |
+
$this->disableEmojis = $this->settings['disable_emojis'];
|
145 |
|
146 |
if ($this->dashboardShow && $this->settings['dom_get_type'] != '') {
|
147 |
self::$domGetType = $this->settings['dom_get_type'];
|
191 |
|
192 |
add_action('add_meta_boxes', array($this, 'addMetaBox'));
|
193 |
}
|
194 |
+
|
195 |
+
if ($this->disableEmojis == 1) {
|
196 |
+
add_action('init', array($this, 'doDisableEmojis'));
|
197 |
+
}
|
198 |
}
|
199 |
|
200 |
/**
|
1187 |
{
|
1188 |
return (array_key_exists('page', $_GET) && $_GET['page'] === WPACU_PLUGIN_NAME.'_settings');
|
1189 |
}
|
1190 |
+
|
1191 |
+
/**
|
1192 |
+
*
|
1193 |
+
*/
|
1194 |
+
public function doDisableEmojis()
|
1195 |
+
{
|
1196 |
+
// Emojis Actions and Filters
|
1197 |
+
remove_action('admin_print_styles', 'print_emoji_styles');
|
1198 |
+
remove_action('wp_head', 'print_emoji_detection_script', 7);
|
1199 |
+
remove_action('admin_print_scripts', 'print_emoji_detection_script');
|
1200 |
+
remove_action('wp_print_styles', 'print_emoji_styles');
|
1201 |
+
|
1202 |
+
remove_filter('wp_mail', 'wp_staticize_emoji_for_email');
|
1203 |
+
remove_filter('the_content_feed', 'wp_staticize_emoji');
|
1204 |
+
remove_filter('comment_text_rss', 'wp_staticize_emoji');
|
1205 |
+
|
1206 |
+
// TinyMCE Emojis
|
1207 |
+
add_filter('tiny_mce_plugins', array($this, 'removeEmojisTinymce'));
|
1208 |
+
}
|
1209 |
+
|
1210 |
+
/**
|
1211 |
+
* @param $plugins
|
1212 |
+
*
|
1213 |
+
* @return array
|
1214 |
+
*/
|
1215 |
+
public function removeEmojisTinymce($plugins)
|
1216 |
+
{
|
1217 |
+
if (is_array($plugins)) {
|
1218 |
+
return array_diff($plugins, array('wpemoji'));
|
1219 |
+
}
|
1220 |
+
|
1221 |
+
return array();
|
1222 |
+
}
|
1223 |
}
|
classes/Menu.php
CHANGED
@@ -7,6 +7,16 @@ namespace WpAssetCleanUp;
|
|
7 |
*/
|
8 |
class Menu
|
9 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
/**
|
11 |
* Menu constructor.
|
12 |
*/
|
@@ -20,42 +30,43 @@ class Menu
|
|
20 |
*/
|
21 |
public function activeMenu()
|
22 |
{
|
23 |
-
|
24 |
-
|
|
|
25 |
|
26 |
add_menu_page(
|
27 |
__('WP Asset CleanUp', WPACU_PLUGIN_NAME),
|
28 |
__('WP Asset Clean Up', WPACU_PLUGIN_NAME),
|
29 |
-
|
30 |
-
|
31 |
array(new Settings, 'settingsPage'),
|
32 |
'dashicons-filter'
|
33 |
);
|
34 |
|
35 |
add_submenu_page(
|
36 |
-
|
37 |
__('Home Page', WPACU_PLUGIN_NAME),
|
38 |
__('Home Page', WPACU_PLUGIN_NAME),
|
39 |
-
|
40 |
WPACU_PLUGIN_NAME.'_home_page',
|
41 |
array(new HomePage, 'page')
|
42 |
);
|
43 |
|
44 |
add_submenu_page(
|
45 |
-
|
46 |
__('Bulk Unloads', WPACU_PLUGIN_NAME),
|
47 |
__('Bulk Unloads', WPACU_PLUGIN_NAME),
|
48 |
-
|
49 |
WPACU_PLUGIN_NAME.'_bulk_unloads',
|
50 |
array(new BulkUnloads, 'pageBulkUnloads')
|
51 |
);
|
52 |
|
53 |
if (WPACU_PLUGIN_HAS_PREMIUM_EXT !== false) {
|
54 |
add_submenu_page(
|
55 |
-
|
56 |
__('Custom Unload Rules', WPACU_PLUGIN_NAME),
|
57 |
__('Custom Unload Rules', WPACU_PLUGIN_NAME),
|
58 |
-
|
59 |
WPACU_PLUGIN_NAME . '_advanced_rules',
|
60 |
array(new AdvancedRules, 'page')
|
61 |
);
|
@@ -63,15 +74,15 @@ class Menu
|
|
63 |
|
64 |
// Get Help | Support Page
|
65 |
add_submenu_page(
|
66 |
-
|
67 |
__('Get Help', WPACU_PLUGIN_NAME),
|
68 |
__('Get Help', WPACU_PLUGIN_NAME),
|
69 |
-
|
70 |
WPACU_PLUGIN_NAME.'_get_help',
|
71 |
array(new GetHelp, 'page')
|
72 |
);
|
73 |
|
74 |
// Rename first item from the menu which has the same title as the menu page
|
75 |
-
$GLOBALS['submenu'][
|
76 |
}
|
77 |
}
|
7 |
*/
|
8 |
class Menu
|
9 |
{
|
10 |
+
/**
|
11 |
+
* @var string
|
12 |
+
*/
|
13 |
+
static $capability = 'manage_options';
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @var string
|
17 |
+
*/
|
18 |
+
static $slug = WPACU_PLUGIN_NAME . '_settings';
|
19 |
+
|
20 |
/**
|
21 |
* Menu constructor.
|
22 |
*/
|
30 |
*/
|
31 |
public function activeMenu()
|
32 |
{
|
33 |
+
if (! current_user_can(self::$capability)) {
|
34 |
+
return;
|
35 |
+
}
|
36 |
|
37 |
add_menu_page(
|
38 |
__('WP Asset CleanUp', WPACU_PLUGIN_NAME),
|
39 |
__('WP Asset Clean Up', WPACU_PLUGIN_NAME),
|
40 |
+
self::$capability,
|
41 |
+
self::$slug,
|
42 |
array(new Settings, 'settingsPage'),
|
43 |
'dashicons-filter'
|
44 |
);
|
45 |
|
46 |
add_submenu_page(
|
47 |
+
self::$slug,
|
48 |
__('Home Page', WPACU_PLUGIN_NAME),
|
49 |
__('Home Page', WPACU_PLUGIN_NAME),
|
50 |
+
self::$capability,
|
51 |
WPACU_PLUGIN_NAME.'_home_page',
|
52 |
array(new HomePage, 'page')
|
53 |
);
|
54 |
|
55 |
add_submenu_page(
|
56 |
+
self::$slug,
|
57 |
__('Bulk Unloads', WPACU_PLUGIN_NAME),
|
58 |
__('Bulk Unloads', WPACU_PLUGIN_NAME),
|
59 |
+
self::$capability,
|
60 |
WPACU_PLUGIN_NAME.'_bulk_unloads',
|
61 |
array(new BulkUnloads, 'pageBulkUnloads')
|
62 |
);
|
63 |
|
64 |
if (WPACU_PLUGIN_HAS_PREMIUM_EXT !== false) {
|
65 |
add_submenu_page(
|
66 |
+
self::$slug,
|
67 |
__('Custom Unload Rules', WPACU_PLUGIN_NAME),
|
68 |
__('Custom Unload Rules', WPACU_PLUGIN_NAME),
|
69 |
+
self::$capability,
|
70 |
WPACU_PLUGIN_NAME . '_advanced_rules',
|
71 |
array(new AdvancedRules, 'page')
|
72 |
);
|
74 |
|
75 |
// Get Help | Support Page
|
76 |
add_submenu_page(
|
77 |
+
self::$slug,
|
78 |
__('Get Help', WPACU_PLUGIN_NAME),
|
79 |
__('Get Help', WPACU_PLUGIN_NAME),
|
80 |
+
self::$capability,
|
81 |
WPACU_PLUGIN_NAME.'_get_help',
|
82 |
array(new GetHelp, 'page')
|
83 |
);
|
84 |
|
85 |
// Rename first item from the menu which has the same title as the menu page
|
86 |
+
$GLOBALS['submenu'][self::$slug][0][0] = esc_attr__('Settings', WPACU_PLUGIN_NAME);
|
87 |
}
|
88 |
}
|
classes/OwnAssets.php
CHANGED
@@ -4,7 +4,7 @@ namespace WpAssetCleanUp;
|
|
4 |
/**
|
5 |
* Class OwnAssets
|
6 |
*
|
7 |
-
* These are plugin's own assets and they are used only when you're logged and do not show in the list for unload
|
8 |
*
|
9 |
* @package WpAssetCleanUp
|
10 |
*/
|
4 |
/**
|
5 |
* Class OwnAssets
|
6 |
*
|
7 |
+
* These are plugin's own assets (CSS, JS etc.) and they are used only when you're logged in and do not show in the list for unload
|
8 |
*
|
9 |
* @package WpAssetCleanUp
|
10 |
*/
|
classes/Settings.php
CHANGED
@@ -13,7 +13,8 @@ class Settings
|
|
13 |
public $settingsKeys = array(
|
14 |
'frontend_show',
|
15 |
'dashboard_show',
|
16 |
-
'dom_get_type'
|
|
|
17 |
);
|
18 |
|
19 |
/**
|
13 |
public $settingsKeys = array(
|
14 |
'frontend_show',
|
15 |
'dashboard_show',
|
16 |
+
'dom_get_type',
|
17 |
+
'disable_emojis'
|
18 |
);
|
19 |
|
20 |
/**
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== WP Asset CleanUp (Page Speed Optimizer) ===
|
2 |
Contributors: gabelivan
|
3 |
-
Tags: speed, pagespeed, dequeue style, dequeue script, unload style, unload script,
|
4 |
Donate link: https://www.gabelivan.com/donate/
|
5 |
Requires at least: 4.0
|
6 |
-
Tested up to: 4.9
|
7 |
Stable tag: 1.2.5.3
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl.html
|
@@ -102,6 +102,10 @@ If that's the case, then it's advisable to consult with a developer (ideally the
|
|
102 |
4. Scripts (.JS) are selected for site-wide unload
|
103 |
|
104 |
== Changelog ==
|
|
|
|
|
|
|
|
|
105 |
= 1.2.5.3 =
|
106 |
* Bug Fix: PHP Warning when array was passed to json_decode(), instead of string
|
107 |
|
1 |
=== WP Asset CleanUp (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.gabelivan.com/donate/
|
5 |
Requires at least: 4.0
|
6 |
+
Tested up to: 4.9.6
|
7 |
Stable tag: 1.2.5.3
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl.html
|
102 |
4. Scripts (.JS) are selected for site-wide unload
|
103 |
|
104 |
== Changelog ==
|
105 |
+
= 1.2.6 =
|
106 |
+
* New Feature: Disable Emojis Site-Wide
|
107 |
+
* Hide "WP Asset Clean Up" menu if the logged in user doesn't have 'manage_options' capabilities (technically, it's just for administrators)
|
108 |
+
|
109 |
= 1.2.5.3 =
|
110 |
* Bug Fix: PHP Warning when array was passed to json_decode(), instead of string
|
111 |
|
templates/settings-plugin.php
CHANGED
@@ -8,10 +8,11 @@ if (! isset($data)) {
|
|
8 |
?>
|
9 |
<div class="wrap">
|
10 |
<h1><?php _e('WP Asset CleanUp', WPACU_PLUGIN_NAME); ?></h1>
|
11 |
-
<h2><?php _e('Plugin Settings', WPACU_PLUGIN_NAME); ?></h2>
|
12 |
|
13 |
<form method="post" action="">
|
14 |
<input type="hidden" name="wpacu_settings_page" value="1" />
|
|
|
|
|
15 |
<table class="form-table">
|
16 |
<tr valign="top">
|
17 |
<th scope="row">
|
@@ -52,6 +53,22 @@ if (! isset($data)) {
|
|
52 |
</tr>
|
53 |
</table>
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
<?php submit_button(); ?>
|
56 |
</form>
|
57 |
</div>
|
8 |
?>
|
9 |
<div class="wrap">
|
10 |
<h1><?php _e('WP Asset CleanUp', WPACU_PLUGIN_NAME); ?></h1>
|
|
|
11 |
|
12 |
<form method="post" action="">
|
13 |
<input type="hidden" name="wpacu_settings_page" value="1" />
|
14 |
+
<h2><?php _e('Plugin Usage Settings', WPACU_PLUGIN_NAME); ?></h2>
|
15 |
+
|
16 |
<table class="form-table">
|
17 |
<tr valign="top">
|
18 |
<th scope="row">
|
53 |
</tr>
|
54 |
</table>
|
55 |
|
56 |
+
<h2><?php _e('Unload Settings', WPACU_PLUGIN_NAME); ?></h2>
|
57 |
+
|
58 |
+
<table class="form-table">
|
59 |
+
<tr valign="top">
|
60 |
+
<th scope="row">
|
61 |
+
<label for="wpacu_disable_emojis">Disable Emojis Site-Wide?</label>
|
62 |
+
</th>
|
63 |
+
<td><input id="wpacu_disable_emojis" type="checkbox"
|
64 |
+
<?php echo (($data['disable_emojis'] == 1) ? 'checked="checked"' : ''); ?>
|
65 |
+
name="<?php echo WPACU_PLUGIN_NAME.'_settings'; ?>[disable_emojis]"
|
66 |
+
value="1" /> <label for="wpacu_disable_emojis"><small>This will remove WordPress' Emojis (the smiley icons)</small></label>
|
67 |
+
<p><small>As of WordPress 4.2, a new feature was introduced that allows you to use the new Emojis. While on some WordPress setups is useful, in many situations (especially when you are not using WordPress as a blog), you just don’t need them and the file /wp-includes/js/wp-emoji-release.min.js is loaded along with extra inline JavaScript code which add up to the number of loaded HTTP requests.</small></p>
|
68 |
+
</td>
|
69 |
+
</tr>
|
70 |
+
</table>
|
71 |
+
|
72 |
<?php submit_button(); ?>
|
73 |
</form>
|
74 |
</div>
|
wpacu.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
* Plugin Name: WP Asset CleanUp (Page Speed Optimizer)
|
4 |
* Plugin URI: https://wordpress.org/plugins/wp-asset-clean-up/
|
5 |
-
* Version: 1.2.
|
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/
|
2 |
/*
|
3 |
* Plugin Name: WP Asset CleanUp (Page Speed Optimizer)
|
4 |
* Plugin URI: https://wordpress.org/plugins/wp-asset-clean-up/
|
5 |
+
* Version: 1.2.6
|
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/
|