Version Description
- Added "Disable jQuery Migrate Site-Wide?" and "Disable Comment Reply Site-Wide?" (which belong to WordPress core files and often are not used in a WordPress website) to "Settings" page for the convenience of the user
- Bug Fix: jQuery Migrate can be properly unloaded now without affecting the load of jQuery
Download this release
Release Info
Developer | gabelivan |
Plugin | Asset CleanUp: Page Speed Booster |
Version | 1.2.6.2 |
Comparing to | |
See all releases |
Code changes from version 1.2.6.1 to 1.2.6.2
- classes/Main.php +12 -1
- classes/Settings.php +128 -1
- classes/Update.php +56 -29
- readme.txt +5 -1
- templates/settings-plugin.php +54 -9
- wpacu.php +1 -1
classes/Main.php
CHANGED
@@ -287,7 +287,7 @@ class Main
|
|
287 |
|
288 |
/**
|
289 |
* See if there is any list with scripts to be removed in JSON format
|
290 |
-
* Only the handles (the ID of the scripts)
|
291 |
*/
|
292 |
public function filterScripts()
|
293 |
{
|
@@ -373,6 +373,17 @@ class Main
|
|
373 |
foreach ($list as $handle) {
|
374 |
$handle = trim($handle);
|
375 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
376 |
wp_deregister_script($handle);
|
377 |
wp_dequeue_script($handle);
|
378 |
}
|
287 |
|
288 |
/**
|
289 |
* See if there is any list with scripts to be removed in JSON format
|
290 |
+
* Only the handles (the ID of the scripts) are saved
|
291 |
*/
|
292 |
public function filterScripts()
|
293 |
{
|
373 |
foreach ($list as $handle) {
|
374 |
$handle = trim($handle);
|
375 |
|
376 |
+
// Special Action for 'jquery-migrate' handler as its tied to 'jquery'
|
377 |
+
if ($handle === 'jquery-migrate' && isset($this->wpScripts['registered']['jquery'])) {
|
378 |
+
$jQueryRegScript = $this->wpScripts['registered']['jquery'];
|
379 |
+
|
380 |
+
if (isset($jQueryRegScript->deps)) {
|
381 |
+
$jQueryRegScript->deps = array_diff($jQueryRegScript->deps, array('jquery-migrate'));
|
382 |
+
}
|
383 |
+
|
384 |
+
continue;
|
385 |
+
}
|
386 |
+
|
387 |
wp_deregister_script($handle);
|
388 |
wp_dequeue_script($handle);
|
389 |
}
|
classes/Settings.php
CHANGED
@@ -11,10 +11,15 @@ class Settings
|
|
11 |
* @var array
|
12 |
*/
|
13 |
public $settingsKeys = array(
|
|
|
14 |
'frontend_show',
|
15 |
'dashboard_show',
|
16 |
'dom_get_type',
|
17 |
-
'disable_emojis'
|
|
|
|
|
|
|
|
|
18 |
);
|
19 |
|
20 |
/**
|
@@ -38,6 +43,7 @@ class Settings
|
|
38 |
|
39 |
if (array_key_exists('page', $_GET) && $_GET['page'] === 'wpassetcleanup_settings') {
|
40 |
add_action('admin_notices', array($this, 'notices'));
|
|
|
41 |
}
|
42 |
}
|
43 |
|
@@ -93,6 +99,16 @@ class Settings
|
|
93 |
}
|
94 |
}
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
Main::instance()->parseTemplate('settings-plugin', $data, true);
|
97 |
}
|
98 |
|
@@ -165,7 +181,118 @@ class Settings
|
|
165 |
*/
|
166 |
public function update($settings)
|
167 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
update_option(WPACU_PLUGIN_NAME . '_settings', json_encode($settings), 'no');
|
169 |
$this->status['updated'] = true;
|
170 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
}
|
11 |
* @var array
|
12 |
*/
|
13 |
public $settingsKeys = array(
|
14 |
+
// Stored in 'wpassetcleanup_settings'
|
15 |
'frontend_show',
|
16 |
'dashboard_show',
|
17 |
'dom_get_type',
|
18 |
+
'disable_emojis',
|
19 |
+
|
20 |
+
// Stored in 'wpassetcleanup_global_unload' option
|
21 |
+
'disable_jquery_migrate',
|
22 |
+
'disable_comment_reply'
|
23 |
);
|
24 |
|
25 |
/**
|
43 |
|
44 |
if (array_key_exists('page', $_GET) && $_GET['page'] === 'wpassetcleanup_settings') {
|
45 |
add_action('admin_notices', array($this, 'notices'));
|
46 |
+
add_action('admin_head', array($this, 'inlineHead'));
|
47 |
}
|
48 |
}
|
49 |
|
99 |
}
|
100 |
}
|
101 |
|
102 |
+
$globalUnloadList = Main::instance()->getGlobalUnload();
|
103 |
+
|
104 |
+
if (in_array('jquery-migrate', $globalUnloadList['scripts'])) {
|
105 |
+
$data['disable_jquery_migrate'] = 1;
|
106 |
+
}
|
107 |
+
|
108 |
+
if (in_array('comment-reply', $globalUnloadList['scripts'])) {
|
109 |
+
$data['disable_comment_reply'] = 1;
|
110 |
+
}
|
111 |
+
|
112 |
Main::instance()->parseTemplate('settings-plugin', $data, true);
|
113 |
}
|
114 |
|
181 |
*/
|
182 |
public function update($settings)
|
183 |
{
|
184 |
+
global $wpacuUpdate;
|
185 |
+
|
186 |
+
$disableJQueryMigrate = (isset($_POST[WPACU_PLUGIN_NAME.'_global_unloads']['disable_jquery_migrate']));
|
187 |
+
$disableCommentReply = (isset($_POST[WPACU_PLUGIN_NAME.'_global_unloads']['disable_comment_reply']));
|
188 |
+
|
189 |
+
/*
|
190 |
+
* Add element(s) to the global unload rules
|
191 |
+
*/
|
192 |
+
if ($disableJQueryMigrate || $disableCommentReply) {
|
193 |
+
$unloadList = array();
|
194 |
+
|
195 |
+
// Add jQuery Migrate to the global unload rules
|
196 |
+
if ($disableJQueryMigrate) {
|
197 |
+
$unloadList[] = 'jquery-migrate';
|
198 |
+
}
|
199 |
+
|
200 |
+
// Add Comment Reply to the global unload rules
|
201 |
+
if ($disableCommentReply) {
|
202 |
+
$unloadList[] = 'comment-reply';
|
203 |
+
}
|
204 |
+
|
205 |
+
$wpacuUpdate->saveToEverywhereUnloads(array(), $unloadList);
|
206 |
+
}
|
207 |
+
|
208 |
+
/*
|
209 |
+
* Remove element(s) from the global unload rules
|
210 |
+
*/
|
211 |
+
if (! $disableJQueryMigrate || ! $disableCommentReply) {
|
212 |
+
$removeFromUnloadList = array();
|
213 |
+
|
214 |
+
// Remove jQuery Migrate from global unload rules
|
215 |
+
if (! $disableJQueryMigrate) {
|
216 |
+
$removeFromUnloadList['jquery-migrate'] = 'remove';
|
217 |
+
}
|
218 |
+
|
219 |
+
// Remove Comment Reply from global unload rules
|
220 |
+
if (! $disableCommentReply) {
|
221 |
+
$removeFromUnloadList['comment-reply'] = 'remove';
|
222 |
+
}
|
223 |
+
|
224 |
+
$wpacuUpdate->removeEverywhereUnloads(array(), $removeFromUnloadList);
|
225 |
+
}
|
226 |
+
|
227 |
update_option(WPACU_PLUGIN_NAME . '_settings', json_encode($settings), 'no');
|
228 |
$this->status['updated'] = true;
|
229 |
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
*
|
233 |
+
*/
|
234 |
+
public function inlineHead()
|
235 |
+
{
|
236 |
+
?>
|
237 |
+
<style type="text/css">
|
238 |
+
.wpacu_switch {
|
239 |
+
position: relative;
|
240 |
+
display: inline-block;
|
241 |
+
width: 60px;
|
242 |
+
height: 34px;
|
243 |
+
}
|
244 |
+
|
245 |
+
.wpacu_switch input {
|
246 |
+
display: none;
|
247 |
+
}
|
248 |
+
|
249 |
+
.wpacu_slider {
|
250 |
+
position: absolute;
|
251 |
+
cursor: pointer;
|
252 |
+
top: 0;
|
253 |
+
left: 0;
|
254 |
+
right: 0;
|
255 |
+
bottom: 0;
|
256 |
+
background-color: #ccc;
|
257 |
+
-webkit-transition: .4s;
|
258 |
+
transition: .4s;
|
259 |
+
}
|
260 |
+
|
261 |
+
.wpacu_slider:before {
|
262 |
+
position: absolute;
|
263 |
+
content: "";
|
264 |
+
height: 26px;
|
265 |
+
width: 26px;
|
266 |
+
left: 4px;
|
267 |
+
bottom: 4px;
|
268 |
+
background-color: white;
|
269 |
+
-webkit-transition: .4s;
|
270 |
+
transition: .4s;
|
271 |
+
}
|
272 |
+
|
273 |
+
.toplevel_page_wpassetcleanup_settings input:checked + .wpacu_slider {
|
274 |
+
background-color: #52af00;
|
275 |
+
}
|
276 |
+
|
277 |
+
.toplevel_page_wpassetcleanup_settings input:focus + .wpacu_slider {
|
278 |
+
box-shadow: 0 0 1px #52af00;
|
279 |
+
}
|
280 |
+
|
281 |
+
.toplevel_page_wpassetcleanup_settings input:checked + .wpacu_slider:before {
|
282 |
+
-webkit-transform: translateX(26px);
|
283 |
+
-ms-transform: translateX(26px);
|
284 |
+
transform: translateX(26px);
|
285 |
+
}
|
286 |
+
|
287 |
+
/* Rounded sliders */
|
288 |
+
.toplevel_page_wpassetcleanup_settings .wpacu_slider.wpacu_round {
|
289 |
+
border-radius: 34px;
|
290 |
+
}
|
291 |
+
|
292 |
+
.toplevel_page_wpassetcleanup_settings .wpacu_slider.wpacu_round:before {
|
293 |
+
border-radius: 50%;
|
294 |
+
}
|
295 |
+
</style>
|
296 |
+
<?php
|
297 |
+
}
|
298 |
}
|
classes/Update.php
CHANGED
@@ -141,9 +141,26 @@ class Update
|
|
141 |
// If globally disabled, make exception to load for submitted assets
|
142 |
$this->saveLoadExceptions('post', $postId);
|
143 |
|
144 |
-
|
145 |
-
|
146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
|
148 |
// Any bulk unloads or removed? (e.g. all pages of a certain post type)
|
149 |
$this->saveToBulkUnloads();
|
@@ -168,9 +185,24 @@ class Update
|
|
168 |
// If globally disabled, make exception to load for submitted assets
|
169 |
$this->saveLoadExceptions('front_page');
|
170 |
|
171 |
-
|
172 |
-
|
173 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
}
|
175 |
|
176 |
/**
|
@@ -267,17 +299,12 @@ class Update
|
|
267 |
}
|
268 |
}
|
269 |
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
|
|
274 |
{
|
275 |
-
$postStyles = (isset($_POST['wpacu_global_unload_styles']) && is_array($_POST['wpacu_global_unload_styles']))
|
276 |
-
? $_POST['wpacu_global_unload_styles'] : array();
|
277 |
-
|
278 |
-
$postScripts = (isset($_POST['wpacu_global_unload_scripts']) && is_array($_POST['wpacu_global_unload_scripts']))
|
279 |
-
? $_POST['wpacu_global_unload_scripts'] : array();
|
280 |
-
|
281 |
// Is there any entry already in JSON format?
|
282 |
$existingListJson = get_option(WPACU_PLUGIN_NAME.'_global_unload');
|
283 |
|
@@ -295,15 +322,15 @@ class Update
|
|
295 |
}
|
296 |
|
297 |
// Append to the list anything from the POST (if any)
|
298 |
-
if (! empty($
|
299 |
-
foreach ($
|
300 |
-
$existingList['styles'][] = $
|
301 |
}
|
302 |
}
|
303 |
|
304 |
-
if (! empty($
|
305 |
-
foreach ($
|
306 |
-
$existingList['scripts'][] = $
|
307 |
}
|
308 |
}
|
309 |
|
@@ -317,14 +344,14 @@ class Update
|
|
317 |
);
|
318 |
}
|
319 |
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
|
|
|
|
|
|
324 |
{
|
325 |
-
$stylesList = isset($_POST['wpacu_options_styles']) ? $_POST['wpacu_options_styles'] : array();
|
326 |
-
$scriptsList = isset($_POST['wpacu_options_scripts']) ? $_POST['wpacu_options_scripts'] : array();
|
327 |
-
|
328 |
$removeStylesList = $removeScriptsList = array();
|
329 |
|
330 |
$isUpdated = false;
|
141 |
// If globally disabled, make exception to load for submitted assets
|
142 |
$this->saveLoadExceptions('post', $postId);
|
143 |
|
144 |
+
/*
|
145 |
+
* Any global (all pages / everywhere) UNLOADS?
|
146 |
+
* Coming from a POST request
|
147 |
+
*/
|
148 |
+
$reqStyles = (isset($_POST['wpacu_global_unload_styles']) && is_array($_POST['wpacu_global_unload_styles']))
|
149 |
+
? $_POST['wpacu_global_unload_styles'] : array();
|
150 |
+
|
151 |
+
$reqScripts = (isset($_POST['wpacu_global_unload_scripts']) && is_array($_POST['wpacu_global_unload_scripts']))
|
152 |
+
? $_POST['wpacu_global_unload_scripts'] : array();
|
153 |
+
|
154 |
+
$this->saveToEverywhereUnloads($reqStyles, $reqScripts);
|
155 |
+
|
156 |
+
/*
|
157 |
+
* Any global (all pages / everywhere) REMOVED?
|
158 |
+
* Coming from a POST request
|
159 |
+
*/
|
160 |
+
$stylesList = isset($_POST['wpacu_options_styles']) ? $_POST['wpacu_options_styles'] : array();
|
161 |
+
$scriptsList = isset($_POST['wpacu_options_scripts']) ? $_POST['wpacu_options_scripts'] : array();
|
162 |
+
|
163 |
+
$this->removeEverywhereUnloads($stylesList, $scriptsList);
|
164 |
|
165 |
// Any bulk unloads or removed? (e.g. all pages of a certain post type)
|
166 |
$this->saveToBulkUnloads();
|
185 |
// If globally disabled, make exception to load for submitted assets
|
186 |
$this->saveLoadExceptions('front_page');
|
187 |
|
188 |
+
/*
|
189 |
+
* Any global (all pages / everywhere) UNLOADS?
|
190 |
+
*/
|
191 |
+
$reqStyles = (isset($_POST['wpacu_global_unload_styles']) && is_array($_POST['wpacu_global_unload_styles']))
|
192 |
+
? $_POST['wpacu_global_unload_styles'] : array();
|
193 |
+
|
194 |
+
$reqScripts = (isset($_POST['wpacu_global_unload_scripts']) && is_array($_POST['wpacu_global_unload_scripts']))
|
195 |
+
? $_POST['wpacu_global_unload_scripts'] : array();
|
196 |
+
|
197 |
+
$this->saveToEverywhereUnloads($reqStyles, $reqScripts);
|
198 |
+
|
199 |
+
/*
|
200 |
+
* Any global (all pages / everywhere) REMOVED?
|
201 |
+
*/
|
202 |
+
$stylesList = isset($_POST['wpacu_options_styles']) ? $_POST['wpacu_options_styles'] : array();
|
203 |
+
$scriptsList = isset($_POST['wpacu_options_scripts']) ? $_POST['wpacu_options_scripts'] : array();
|
204 |
+
|
205 |
+
$this->removeEverywhereUnloads($stylesList, $scriptsList);
|
206 |
}
|
207 |
|
208 |
/**
|
299 |
}
|
300 |
}
|
301 |
|
302 |
+
/**
|
303 |
+
* @param array $reqStyles
|
304 |
+
* @param array $reqScripts
|
305 |
+
*/
|
306 |
+
public function saveToEverywhereUnloads($reqStyles = array(), $reqScripts = array())
|
307 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
// Is there any entry already in JSON format?
|
309 |
$existingListJson = get_option(WPACU_PLUGIN_NAME.'_global_unload');
|
310 |
|
322 |
}
|
323 |
|
324 |
// Append to the list anything from the POST (if any)
|
325 |
+
if (! empty($reqStyles)) {
|
326 |
+
foreach ($reqStyles as $reqStyleHandle) {
|
327 |
+
$existingList['styles'][] = $reqStyleHandle;
|
328 |
}
|
329 |
}
|
330 |
|
331 |
+
if (! empty($reqScripts)) {
|
332 |
+
foreach ($reqScripts as $reqScriptHandle) {
|
333 |
+
$existingList['scripts'][] = $reqScriptHandle;
|
334 |
}
|
335 |
}
|
336 |
|
344 |
);
|
345 |
}
|
346 |
|
347 |
+
/**
|
348 |
+
* @param array $stylesList
|
349 |
+
* @param array $scriptsList
|
350 |
+
*
|
351 |
+
* @return bool
|
352 |
+
*/
|
353 |
+
public function removeEverywhereUnloads($stylesList = array(), $scriptsList = array())
|
354 |
{
|
|
|
|
|
|
|
355 |
$removeStylesList = $removeScriptsList = array();
|
356 |
|
357 |
$isUpdated = false;
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: speed, pagespeed, dequeue style, dequeue script, unload style, unload scri
|
|
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.6.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl.html
|
10 |
|
@@ -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.6.1 =
|
106 |
* Bug Fix for PHP versions lower than 5.6 - Menu.php triggered a PHP warning as PHP constants were not allowed in class constants
|
107 |
|
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.6.2
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl.html
|
10 |
|
102 |
4. Scripts (.JS) are selected for site-wide unload
|
103 |
|
104 |
== Changelog ==
|
105 |
+
= 1.2.6.2 =
|
106 |
+
* Added "Disable jQuery Migrate Site-Wide?" and "Disable Comment Reply Site-Wide?" (which belong to WordPress core files and often are not used in a WordPress website) to "Settings" page for the convenience of the user
|
107 |
+
* Bug Fix: jQuery Migrate can be properly unloaded now without affecting the load of jQuery
|
108 |
+
|
109 |
= 1.2.6.1 =
|
110 |
* Bug Fix for PHP versions lower than 5.6 - Menu.php triggered a PHP warning as PHP constants were not allowed in class constants
|
111 |
|
templates/settings-plugin.php
CHANGED
@@ -18,10 +18,14 @@ if (! isset($data)) {
|
|
18 |
<th scope="row">
|
19 |
<label for="wpacu_dashboard">Manage in the Dashboard?</label>
|
20 |
</th>
|
21 |
-
<td
|
|
|
|
|
22 |
<?php echo (($data['dashboard_show'] == 1) ? 'checked="checked"' : ''); ?>
|
23 |
name="<?php echo WPACU_PLUGIN_NAME.'_settings'; ?>[dashboard_show]"
|
24 |
-
value="1"
|
|
|
|
|
25 |
<p><small>The assets would be retrieved via AJAX call(s) that will fetch the post/page URL and extract all the styles & scripts that are enqueued.</small></p>
|
26 |
<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>
|
27 |
</td>
|
@@ -44,29 +48,70 @@ if (! isset($data)) {
|
|
44 |
<th scope="row">
|
45 |
<label for="wpacu_frontend">Manage in the Front-end?</label>
|
46 |
</th>
|
47 |
-
<td
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
51 |
<p><small>The area will be shown through the <code>wp_footer</code> action so in case you do not see the asset list at the bottom of the page, make sure the theme is using <a href="https://codex.wordpress.org/Function_Reference/wp_footer"><code>wp_footer()</code></a> function before the <code></body></code> tag. Any theme that follows the standards should have it. If not, you will have to add it to make sure other plugins and code from functions.php will work fine.</small></p>
|
52 |
</td>
|
53 |
</tr>
|
54 |
</table>
|
55 |
|
56 |
-
<h2><?php _e('Unload
|
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
|
|
|
|
|
64 |
<?php echo (($data['disable_emojis'] == 1) ? 'checked="checked"' : ''); ?>
|
65 |
name="<?php echo WPACU_PLUGIN_NAME.'_settings'; ?>[disable_emojis]"
|
66 |
-
value="1"
|
|
|
|
|
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(); ?>
|
18 |
<th scope="row">
|
19 |
<label for="wpacu_dashboard">Manage in the Dashboard?</label>
|
20 |
</th>
|
21 |
+
<td>
|
22 |
+
<label class="wpacu_switch">
|
23 |
+
<input id="wpacu_dashboard" type="checkbox"
|
24 |
<?php echo (($data['dashboard_show'] == 1) ? 'checked="checked"' : ''); ?>
|
25 |
name="<?php echo WPACU_PLUGIN_NAME.'_settings'; ?>[dashboard_show]"
|
26 |
+
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
|
27 |
+
|
28 |
+
<label for="wpacu_dashboard"><small>This will show the list of assets in a meta box on edit the post (any type) / page within the Dashboard</small></label>
|
29 |
<p><small>The assets would be retrieved via AJAX call(s) that will fetch the post/page URL and extract all the styles & scripts that are enqueued.</small></p>
|
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>
|
48 |
<th scope="row">
|
49 |
<label for="wpacu_frontend">Manage in the Front-end?</label>
|
50 |
</th>
|
51 |
+
<td>
|
52 |
+
<label class="wpacu_switch">
|
53 |
+
<input id="wpacu_frontend"
|
54 |
+
type="checkbox"
|
55 |
+
<?php echo (($data['frontend_show'] == 1) ? 'checked="checked"' : ''); ?>
|
56 |
+
name="<?php echo WPACU_PLUGIN_NAME.'_settings'; ?>[frontend_show]"
|
57 |
+
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
|
58 |
+
|
59 |
+
<label for="wpacu_frontend"><small>If you are logged in, this will make the list of assets show below the page that you view (either home page, a post or a page).</small></label>
|
60 |
<p><small>The area will be shown through the <code>wp_footer</code> action so in case you do not see the asset list at the bottom of the page, make sure the theme is using <a href="https://codex.wordpress.org/Function_Reference/wp_footer"><code>wp_footer()</code></a> function before the <code></body></code> tag. Any theme that follows the standards should have it. If not, you will have to add it to make sure other plugins and code from functions.php will work fine.</small></p>
|
61 |
</td>
|
62 |
</tr>
|
63 |
</table>
|
64 |
|
65 |
+
<h2><?php _e('Site-Wide Unload For Common WordPress Core CSS & JS Files', WPACU_PLUGIN_NAME); ?></h2>
|
66 |
|
67 |
<table class="form-table">
|
68 |
<tr valign="top">
|
69 |
<th scope="row">
|
70 |
<label for="wpacu_disable_emojis">Disable Emojis Site-Wide?</label>
|
71 |
</th>
|
72 |
+
<td>
|
73 |
+
<label class="wpacu_switch">
|
74 |
+
<input id="wpacu_disable_emojis" type="checkbox"
|
75 |
<?php echo (($data['disable_emojis'] == 1) ? 'checked="checked"' : ''); ?>
|
76 |
name="<?php echo WPACU_PLUGIN_NAME.'_settings'; ?>[disable_emojis]"
|
77 |
+
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
|
78 |
+
|
79 |
+
<label for="wpacu_disable_emojis"><small>This will unload WordPress' Emojis (the smiley icons)</small></label>
|
80 |
<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>
|
81 |
</td>
|
82 |
</tr>
|
83 |
+
|
84 |
+
<tr valign="top">
|
85 |
+
<th scope="row">
|
86 |
+
<label for="wpacu_disable_jquery_migrate">Disable jQuery Migrate Site-Wide?</label>
|
87 |
+
</th>
|
88 |
+
<td>
|
89 |
+
<label class="wpacu_switch">
|
90 |
+
<input id="wpacu_disable_jquery_migrate" type="checkbox"
|
91 |
+
<?php echo (($data['disable_jquery_migrate'] == 1) ? 'checked="checked"' : ''); ?>
|
92 |
+
name="<?php echo WPACU_PLUGIN_NAME.'_global_unloads'; ?>[disable_jquery_migrate]"
|
93 |
+
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
|
94 |
+
|
95 |
+
<label for="wpacu_disable_jquery_migrate"><small>This will unload jQuery Migrate (<em>jquery-migrate(.min).js</em>)</small></label>
|
96 |
+
<p><small>This is a JavaScript library that allows older jQuery code (up to version jQuery 1.9) to run on the latest version of jQuery avoiding incompatibility problems. Unless your website is using an old theme or has a jQuery plugin that was written a long time ago, this file is likely not needed to load. Consider disabling it to improve page loading time. Make sure to properly test the website.</small></p>
|
97 |
+
</td>
|
98 |
+
</tr>
|
99 |
+
|
100 |
+
<tr valign="top">
|
101 |
+
<th scope="row">
|
102 |
+
<label for="wpacu_disable_comment_reply">Disable Comment Reply Site-Wide?</label>
|
103 |
+
</th>
|
104 |
+
<td>
|
105 |
+
<label class="wpacu_switch">
|
106 |
+
<input id="wpacu_disable_comment_reply" type="checkbox"
|
107 |
+
<?php echo (($data['disable_comment_reply'] == 1) ? 'checked="checked"' : ''); ?>
|
108 |
+
name="<?php echo WPACU_PLUGIN_NAME.'_global_unloads'; ?>[disable_comment_reply]"
|
109 |
+
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
|
110 |
+
|
111 |
+
<label for="wpacu_disable_comment_reply"><small>This will unload Comment Reply (<em>/wp-includes/js/comment-reply(.min).js</em>)</small></label>
|
112 |
+
<p><small>This is safe to unload if you're not using WordPress as a blog, do not want visitors to leave comments or you've replaced the default WordPress comments with a comment platform such as Disqus or Facebook.</small></p>
|
113 |
+
</td>
|
114 |
+
</tr>
|
115 |
</table>
|
116 |
|
117 |
<?php submit_button(); ?>
|
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.
|
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.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/
|