This commit is contained in:
2024-05-20 15:37:46 +03:00
commit 00b7dbd0b7
10404 changed files with 3285853 additions and 0 deletions

View File

@ -0,0 +1,37 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
?>
<p class="area-title"><?php _e('Higher search ranking', 'wp-asset-clean-up'); ?> <span style="font-size: 22px;"><img draggable="false" class="wpacu-emoji" alt="📈" src="https://s.w.org/images/core/emoji/12.0.0-1/svg/1f4c8.svg" /></span></p>
<p><?php _e('Since 2010, there has been a signal in Google search ranking algorithms: site speed, which reflects how quickly a website responds to web requests.', 'wp-asset-clean-up'); ?></p>
<p><?php _e('Speeding up websites is important — not just to site owners, but to all Internet users.', 'wp-asset-clean-up'); ?> <?php _e('Faster sites create happy users and Google has seen in their internal studies that when a site responds slowly, visitors spend less time there.', 'wp-asset-clean-up'); ?> <?php _e('But faster sites don\'t just improve user experience', 'wp-asset-clean-up'); ?>; <?php _e('recent data shows that improving site speed also reduces operating costs.', 'wp-asset-clean-up'); ?> <?php _e('Like Google, their users place a lot of value in speed — that\'s why they\'ve decided to take site speed into account in their search rankings. They use a variety of sources to determine the speed of a site relative to other sites.', 'wp-asset-clean-up'); ?>
<p><span class="dashicons dashicons-video-alt3"></span> <a href="https://www.youtube.com/watch?v=SO4YuDAkplU" target="_blank"><?php _e('How does Google determine page speed?', 'wp-asset-clean-up'); ?></a></p>
<hr />
<p class="area-title"><?php _e('Visitor Experience', 'wp-asset-clean-up'); ?> <span style="font-size: 24px;"><img draggable="false" class="wpacu-emoji" alt="😊" src="https://s.w.org/images/core/emoji/12.0.0-1/svg/1f60a.svg" /></span></p>
<p><?php _e('For a customer (it\'s likely happened to you too) that wants to purchase something online, it\'s very frustrating to land on slow loading website.', 'wp-asset-clean-up'); ?> <?php _e('A blazing fast website, will keep your visitors happy, engaged, which will directly influence conversions.', 'wp-asset-clean-up'); ?> <?php _e('If a visitor doesn\'t get what he wants in a time he/she thinks it\'s reasonable, they will probably head to another website belonging to a competitor.', 'wp-asset-clean-up'); ?> <?php _e('As today\'s users expect a fast and streamlined web experience, you\'re losing business if you neglect this often overlooked aspect.', 'wp-asset-clean-up'); ?></p>
<hr />
<p class="area-title"><?php _e('Better Developer Experience', 'wp-asset-clean-up'); ?> <span style="font-size: 24px;"><img draggable="false" class="wpacu-emoji" alt="⚙" src="https://s.w.org/images/core/emoji/12.0.0-1/svg/2699.svg" /></span></p>
<p><?php _e('As developers, we often go through the HTML source code of the website, access the server (e.g. Apache, NGINX) logs that has the HTTP requests, and have to sometimes solve code conflict problems (e.g. between plugins) due to poorly written code.', 'wp-asset-clean-up'); ?> <?php _e('By preventing unnecessary files to load, having less HTTP requests, and cleaner HTML code, you will be able to easily go through the code (which is smaller).', 'wp-asset-clean-up'); ?> <?php _e('Your log files will take less space on the server, will be easier to backup and analyse, and by having less JavaScript files loading, you will be reduce the changes of getting less JS errors that could interfere with the functionality of your website.', 'wp-asset-clean-up'); ?></p>
<hr />
<p class="area-title"><?php _e('Higher Revenue', 'wp-asset-clean-up'); ?> <span style="font-size: 24px;"><img draggable="false" class="wpacu-emoji" alt="💯" src="https://s.w.org/images/core/emoji/12.0.0-1/svg/1f4af.svg" /></span></p>
<p><?php _e('Just about any major retailer is taking site speed as a very important factor for increasing conversions.', 'wp-asset-clean-up'); ?> <?php _e('According to Strangeloop, 57% of online customers will leave a website after waiting 3 seconds for the page to load. Moreover, 80% of those people will not return to that page. Some of them will tell others about their negative experience. This has a direct impact on the conversion rate, revenue and brand image.', 'wp-asset-clean-up'); ?></p>
<p style="margin-bottom: 0;"><em>"<?php echo sprintf(esc_html__('%s of users say they\'ve felt STRESS OR ANGER while using a slow website.', 'wp-asset-clean-up'), '78%'); ?>"</em></p>
<p style="margin-top: 5px; margin-bottom: 0;"><em>"<?php echo sprintf(esc_html__('%s of users say that slow online transaction make them ANXIOUS about the success of the transaction.', 'wp-asset-clean-up'), '44%'); ?>"</em></p>
<p style="margin-top: 5px;"><em>"<?php echo sprintf(esc_html__('%s of people have THROWN THEIR PHONE while using a slow mobile site.', 'wp-asset-clean-up'), '4%'); ?>"</em></p>
<?php add_thickbox(); ?>
<div id="wpacu-brain-slow-website-info" style="display:none;">
<img alt="" style="width: 100%;"
src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/images/your-brain-on-a-slow-website-infographic.jpg" />
</div>
<span class="dashicons dashicons-format-image"></span> <a href="#TB_inline?&width=1024&height=550&inlineId=wpacu-brain-slow-website-info"
class="thickbox"><?php echo sprintf(esc_html__('View "%s" Infographic', 'wp-asset-clean-up'), 'This Is Your Brain On A Slow Website'); ?></a>

View File

@ -0,0 +1,33 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
?>
<p><?php _e('Often, our WordPress websites are loaded with elements that are not needed to load on specific pages or even everywhere.', 'wp-asset-clean-up'); ?> <?php _e('These assets (CSS &amp; JavaScript files) as well as inline code are adding up to the total size of the page, thus taking more time for the page to load.', 'wp-asset-clean-up'); ?></p>
<p><?php _e('This could end up in a slow website that leads to page abandonment, poor ranking in Google search and sometimes conflict JavaScript errors where too many scripts are loading and one of them (or more) have poorly written code that is not autonomous and badly interacts with other code.', 'wp-asset-clean-up'); ?></p>
<hr />
<p class="area-title"><?php echo sprintf(esc_html__('What %s really does?', 'wp-asset-clean-up'), WPACU_PLUGIN_TITLE); ?> <span style="font-size: 24px;"><img draggable="false" class="wpacu-emoji" alt="🚀" src="https://s.w.org/images/core/emoji/12.0.0-1/svg/1f680.svg" /></span></p>
<p><?php echo WPACU_PLUGIN_TITLE; ?> is a <strong>front-end optimisation performance plugin</strong> and let's you select the assets that are not needed to load on your website and combine the remaining loaded ones into fewer files, which will in the end reduce considerably the number of HTTP requests and optimize the front-end side of your pages. <a target="_blank" href="https://developer.yahoo.com/performance/rules.html"><?php _e('Read more', 'wp-asset-clean-up'); ?></a></p>
<p>Once the setup is completed, the pages will have a better speed score since there will be less HTTP requests (.css &amp; .js files) loaded by the browser (this can be tested using tools such as GTMetrix) and combined with a backend page caching system it will improve the page speed even more.
<p><?php _e('Page caching solutions include', 'wp-asset-clean-up'); ?>:</p>
<ul style="font-size: 14px; list-style: disc; margin-left: 25px;">
<li style="line-height: 21px; margin-bottom: 15px;">A plugin such as <a target="_blank" href="https://wordpress.org/plugins/wp-fastest-cache/">WP Fastest Cache</a> that creates static HTML files (which are lighter thanks to <?php echo WPACU_PLUGIN_TITLE; ?>) and reads them avoiding PHP code processing within the active plugins &amp; theme, including database queries which can use lots of server resources if you have high traffic. <?php echo sprintf(esc_html__('The page caching improves the %sTTFB%s (time to first byte) which measures the duration from the user or client making an HTTP request to the first byte of the page being received by the client\'s browser.', 'wp-asset-clean-up'), '<a href="https://web.dev/ttfb/">', '</a>'); ?></li>
<li style="line-height: 21px; margin-bottom: 20px;">
<?php echo sprintf(
esc_html__('A hosting service that has its in-built WordPress caching like %sWPEngine%s or Kinsta, a web application accelerator like Varnish that can be setup the server etc.', 'wp-asset-clean-up'),
'<a href="https://www.gabelivan.com/visit/wp-engine">',
'</a>'
); ?>
</li>
</ul>
<p style="line-height: normal;"><small><strong><?php _e('Disclaimer', 'wp-asset-clean-up'); ?>:</strong> <?php _e('The recommendations above are based from my own experience as a developer &amp; user and I\'m happy to recommend them to whoever wants superior WordPress performance.', 'wp-asset-clean-up'); ?> <?php _e('The links are affiliate related and I might get a commission if you decide to make a purchase.', 'wp-asset-clean-up'); ?></small></p>
<hr />
<p class="area-title">Example (Stripping ~66% of "crap") <span style="font-size: 24px;"><img draggable="false" class="wpacu-emoji" alt="✨" src="https://s.w.org/images/core/emoji/12.0.0-1/svg/2728.svg" /></span></p>
<p>Let's suppose you have a page where 30 files (CSS &amp; JS) are loaded. All have a total size of 1.5 MB. Using <?php echo WPACU_PLUGIN_TITLE; ?>, you can reduce the number to 12 files by unloading the other 18 files which are useless on the page. You've reduced the total size to 0.7 MB, this resulting in less time in downloading the assets, thus the page will load faster. If you also combine and minify the remaining 12 files, the total assets size becomes smaller to 0.5 MB. In the end, <strong>the assets will load 3 times faster and improve your page speed score</strong>. Moreover, the HTML source code will be cleaner and easier to go through in case you're a developer and need to do any debugging or just check something in the code.</p>
<hr />
<p class="area-title"><?php _e('Not sure how to configure it?', 'wp-asset-clean-up'); ?> <span style="font-size: 24px;"><img draggable="false" class="wpacu-emoji" alt="🤔" src="https://s.w.org/images/core/emoji/12.0.0-1/svg/1f914.svg" /></span></p>
<p><?php _e('No problem!', 'wp-asset-clean-up'); ?> <?php _e('You can enable "Test Mode" and any changes you make, will only be visible for you (the logged-in administrator), while the regular visitors will see the pages as if the plugin is not active.', 'wp-asset-clean-up'); ?> <?php _e('Once all is good, you can disable "Test Mode" (thus applying the settings to everyone), clear the page caching (if using a plugin or a server-side solution such as Varnish) and check out the page speed score.', 'wp-asset-clean-up'); ?> <a target="_blank" href="https://assetcleanup.com/docs/?p=84"><?php _e('Read more', 'wp-asset-clean-up'); ?></a></p>

View File

@ -0,0 +1,170 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
$svgTick = <<<HTML
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 36 36"><path fill="#008000" d="M34.459 1.375c-1.391-.902-3.248-.506-4.149.884L13.5 28.17l-8.198-7.58c-1.217-1.125-3.114-1.051-4.239.166-1.125 1.216-1.051 3.115.166 4.239l10.764 9.952s.309.266.452.359c.504.328 1.07.484 1.63.484.982 0 1.945-.482 2.52-1.368L35.343 5.524c.902-1.39.506-3.248-.884-4.149z"/></svg>
HTML;
$svgNa = '<img draggable="false" class="wpacu-emoji" alt="" src="'.WPACU_PLUGIN_URL.'/assets/icons/icon-n-a.svg">';
?>
<div class="wpacu-lite-vs-pro-wrap">
<table>
<thead>
<tr class="first">
<th class="hide"></th>
<th class="bg-lite">LITE</th>
<th class="bg-pro">PRO</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong><?php _e('License Price', 'wp-asset-clean-up'); ?></strong> <small>* <?php echo sprintf(
__('after the first year, you will save %s off the initial purchase price, and be charged only %s', 'wp-asset-clean-up'),
'30%',
'$32<sup>.90</sup>'
);
?></small></td>
<td><span class="txt-top">$</span><span class="txt-l">0</span></td>
<td><span class="txt-top">$</span><span class="txt-l">49</span></td>
</tr>
<tr>
<td><?php _e('Manage CSS &amp; JavaScript files on Homepage, Posts, Pages &amp; Custom Post Types (e.g. WooCommerce product pages, Easy Digital Downloads download items)', 'wp-asset-clean-up'); ?></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Bulk Unloads: Everywhere (Site-Wide), On Specific Pages &amp; Post Types, Add load exceptions', 'wp-asset-clean-up'); ?></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Manage the CSS &amp; JavaScript files within the Dashboard (default) and Front-end view (bottom of the page) if chosen', 'wp-asset-clean-up'); ?></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Enable "Test Mode" to only apply the plugin\'s changes for the logged-in administrator for debugging purposes', 'wp-asset-clean-up'); ?> * <a href="https://www.assetcleanup.com/docs/?p=84"><small>Read more</small></a></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Minify remaining loaded CSS &amp; JavaScript files (with option to add exceptions)', 'wp-asset-clean-up'); ?></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Combine remaining loaded CSS &amp; JavaScript files into fewer files from each <code>&lt;HEAD&gt;</code> and <code>&lt;BODY&gt;</code> location (with option to add exceptions)', 'wp-asset-clean-up'); ?></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php echo sprintf(__('Remove unused elements from the <code>&lt;HEAD&gt;</code> and <code>&lt;BODY&gt;</code> including the following link tags: %s.', 'wp-asset-clean-up'), 'Really Simple Discovery (RSD), Windows Live Writer, REST API, Posts/Pages Shortlink, Post\'s Relational, WordPress Generators (also good for security), RSS Feed Links'); ?> <?php _e('Valid HTML comments are also stripped (exceptions can be added) while conditional Internet Explorer comments are preserved.', 'wp-asset-clean-up'); ?></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Site-Wide Unload For Common Elements that are often unused such as: WordPress Emojis, jQuery Migrate, Comment Reply (if not using WP as a blog)', 'wp-asset-clean-up'); ?></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Disable RSS Feeds', 'wp-asset-clean-up'); ?></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Disable XML-RPC Protocol Support partially or completely', 'wp-asset-clean-up'); ?></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Inline Chosen CSS Files', 'wp-asset-clean-up'); ?> * <a target="_blank" href="https://gtmetrix.com/inline-small-css.html"><small>Read more</small></a></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Inline Chosen JavaScript Files', 'wp-asset-clean-up'); ?> * <a target="_blank" href="https://gtmetrix.com/inline-small-javascript.html"><small>Read more</small></a></td>
<td><span class="na"><?php echo wp_kses($svgNa, array('img' => array('draggable' => array(), 'class' => array(), 'alt' => array(), 'src' => array()))); ?></span></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Instruct the browser to download a CSS/JS file based on the visitor\'s screen size (e.g. download it on a desktop device, but not on mobile one)', 'wp-asset-clean-up'); ?> * <a href="https://www.assetcleanup.com/docs/?p=1023"><small>Read more</small></a></td>
<td><span class="na"><?php echo wp_kses($svgNa, array('img' => array('draggable' => array(), 'class' => array(), 'alt' => array(), 'src' => array()))); ?></span></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Unload CSS/JS on all pages of a specific post type based on their taxonomy', 'wp-asset-clean-up'); ?> * <small>e.g. you can choose to unload assets on all articles that belong to a specific category or have a certain tag, or unload assets on all product (WooCommerce) pages</small> * <a href="https://www.assetcleanup.com/docs/?p=1415"><small>Read more</small></a></td>
<td><span class="na"><?php echo wp_kses($svgNa, array('img' => array('draggable' => array(), 'class' => array(), 'alt' => array(), 'src' => array()))); ?></span></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Unload CSS/JS for URLs with request URI matching certain RegEx(es) &amp; add load exceptions based on Regex(es) <small>e.g. you can unload a CSS file site-wide, but keep it loaded if the page URL matches the <code>#/product/#</code> RegEx</small>', 'wp-asset-clean-up'); ?></td>
<td><span class="na"><?php echo wp_kses($svgNa, array('img' => array('draggable' => array(), 'class' => array(), 'alt' => array(), 'src' => array()))); ?></span></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Unload plugins in the frontend view (for guest visitors)', 'wp-asset-clean-up'); ?> * <small>This will not just unload the CSS/JS files loaded from the plugins, but everything else related to them (e.g. slow database queries)</small> * <a href="https://www.assetcleanup.com/docs/?p=372"><small>Read more</small></a></td>
<td><span class="na"><?php echo wp_kses($svgNa, array('img' => array('draggable' => array(), 'class' => array(), 'alt' => array(), 'src' => array()))); ?></span></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Unload plugins within the Dashboard /wp-admin/', 'wp-asset-clean-up'); ?> * <small>Do you have any slow pages that are loading within the Dashboard? You can reduce seconds in page load for some bulky ones or fix plugin conflicts</small> * <a href="https://www.assetcleanup.com/docs/?p=1128"><small>Read more</small></a></td>
<td><span class="na"><?php echo wp_kses($svgNa, array('img' => array('draggable' => array(), 'class' => array(), 'alt' => array(), 'src' => array()))); ?></span></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Defer CSS loaded in the <code>&lt;BODY&gt;</code>', 'wp-asset-clean-up'); ?> to reduce render-blocking resources</td>
<td><span class="na"><?php echo wp_kses($svgNa, array('img' => array('draggable' => array(), 'class' => array(), 'alt' => array(), 'src' => array()))); ?></span></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Manage CSS &amp; JavaScript files on Categories, Tags, Custom Taxonomy pages, Date &amp; Author Archive Pages, Search Results &amp; 404 Not Found pages', 'wp-asset-clean-up'); ?></td>
<td><span class="na"><?php echo wp_kses($svgNa, array('img' => array('draggable' => array(), 'class' => array(), 'alt' => array(), 'src' => array()))); ?></span></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Manage hardcoded (non-enqueued) CSS &amp; JavaScript files', 'wp-asset-clean-up'); ?></td>
<td><span class="na"><?php echo wp_kses($svgNa, array('img' => array('draggable' => array(), 'class' => array(), 'alt' => array(), 'src' => array()))); ?></span></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Move CSS &amp; JavaScript files from <code>&lt;HEAD&gt;</code> to <code>&lt;BODY&gt;</code> (to reduce render-blocking) or vice-versa (for very early triggering)', 'wp-asset-clean-up'); ?></td>
<td><span class="na"><?php echo wp_kses($svgNa, array('img' => array('draggable' => array(), 'class' => array(), 'alt' => array(), 'src' => array()))); ?></span></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Apply "async" and "defer" attributes to loaded JavaScript files', 'wp-asset-clean-up'); ?></td>
<td><span class="na"><?php echo wp_kses($svgNa, array('img' => array('draggable' => array(), 'class' => array(), 'alt' => array(), 'src' => array()))); ?></span></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Priority in releasing new features &amp; other improvements (updates that are meant for both Lite and Pro plugins are first released to the Pro users)', 'wp-asset-clean-up'); ?></td>
<td><span class="na"><?php echo wp_kses($svgNa, array('img' => array('draggable' => array(), 'class' => array(), 'alt' => array(), 'src' => array()))); ?></span></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td><?php _e('Priority Customer Support', 'wp-asset-clean-up'); ?></td>
<td><span class="na"><?php echo wp_kses($svgNa, array('img' => array('draggable' => array(), 'class' => array(), 'alt' => array(), 'src' => array()))); ?></span></td>
<td><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?></td>
</tr>
<tr>
<td colspan="3" style="text-align: center; padding: 10px;">
<h3 style="margin: 0;"><?php echo wp_kses($svgTick, array('svg' => array('xmlns' => array(), 'viewbox' => array()), 'path' => array('fill' => array(), 'd' => array()))); ?>&nbsp; <em>30 Day Money Back Guarantee</em></h3>
<p style="margin-top: 8px;">If youre not satisfied with your purchase for any reason, you can request a refund within 30 days, and you will get the payment refunded.</p>
<hr />
<a class="button button-primary button-hero" href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL . '?utm_source=plugin_getting_started&utm_medium=lite_vs_pro'); ?>">
<span class="dashicons dashicons-star-filled" style="line-height: 50px;"></span> &nbsp;<?php _e('Upgrade to Pro to unlock all benefits', 'wp-asset-clean-up'); ?></a>
&nbsp;
<a class="button button-default button-hero" href="https://www.gabelivan.com/contact/">
<span class="dashicons dashicons-admin-comments" style="line-height: 50px;"></span> &nbsp;<?php _e('I have some questions', 'wp-asset-clean-up'); ?></a>
</td>
</tr>
</tbody>
</table>
</div>

View File

@ -0,0 +1,33 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
?>
<p>For the <em>homepage</em>, you can go to "CSS/JS Load Manager" -&gt; "<a href="<?php echo esc_url(admin_url('admin.php?page='.WPACU_PLUGIN_ID.'_assets_manager')); ?>">Homepage</a>" from the plugin's menu and you will notice the list of all the styles &amp;scripts files that are loading there. For each file, you will see options that you can enabled/disable.</p>
<p>For <em>posts, pages &amp; custom post types</em>, you can edit the page within the Dashboard or via the front-end view (if you enabled the option in "Settings") and scroll to "<?php echo WPACU_PLUGIN_TITLE; ?>: CSS &amp; JavaScript Manager" metabox area (if not hidden from "Settings" -&gt; "Plugin Usage Preferences") where you can manage all the CSS &amp; JS files loading on that post/page.</p>
<p>To view all the WordPress pages where <?php echo WPACU_PLUGIN_TITLE; ?> can do optimization for, go to "<a href="<?php echo esc_url(admin_url('admin.php?page='.WPACU_PLUGIN_ID.'_assets_manager&wpacu_for=homepage')); ?>"><?php _e('CSS/JS Load Manager', 'wp-asset-clean-up'); ?></a>".</p>
<hr />
<p style="font-size: 16px;"><strong>Common Example: "Contact Form 7" plugin</strong></p>
<p>At the time of writing this (January 1, 2019), the plugin loads 2 files everywhere (site-wide), when most of the WordPress websites only use them in the contact page. These files are:</p>
<ul style="list-style: disc; margin-left: 25px;">
<li><em>/wp-content/plugins/contact-form-7/includes/css/styles.css?ver=5.1.1</em> (Stylesheet File)</li>
<li><em>/wp-content/plugins/contact-form-7/includes/js/scripts.js?ver=5.1.1</em> (JavaScript File)</li>
</ul>
<p>Moreover, the JavaScript file has an inline code associated with it, which looks something like this:</p>
<pre><code>&lt;script type=&#39;text/javascript&#39;&gt;
/* &lt;![CDATA[ */
var wpcf7 = {&quot;apiSettings&quot;:{&quot;root&quot;:&quot;https:\/\/www.yourdomain.com\/wp-json\/contact-form-7\/v1&quot;,&quot;namespace&quot;:&quot;contact-form-7\/v1&quot;},&quot;cached&quot;:&quot;1&quot;};
/* ]]&gt; */
&lt;/script&gt;</code></pre>
<p style="margin-top: 0;">These extra files loading, as well as the HTML code used to call them, not to mention the inline code associated with the JS file, add up to the total size of the page: the number of HTTP requests and the HTML source code size (this is a minor thing, but when dealing with tens of files, it adds up).</p>
<p>Just like "Contact Form 7", there are plenty of other files that are loading from plugins and the active theme which shouldn't be loaded in many pages. Think about pages that have mostly text such as "Terms and Conditions", "Privacy Policy" or the "404 (Not Found)" page. These ones can be stripped by a lot of "crap" which will boost the speed score and offer a better visitor experience.</p>
<p>Once you unload the right (the ones you know are not useful) files and test everything (via "Test Mode" to make sure your visitors will not be affected in case you break any page functionality), you can clear the cache if you're using a caching plugin and test your page speed score in GTMetrix or other similar tool that measures the page load. You will see an improvement. <span style="vertical-align: bottom; font-size: 20px; line-height: 20px;"><img draggable="false" class="wpacu-emoji" alt="😀" src="https://s.w.org/images/core/emoji/12.0.0-1/svg/1f600.svg" /></span></p>

View File

@ -0,0 +1,90 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
?>
<div class="wpacu-video-areas">
<div class="wpacu-video-area-wrapper">
<div class="wpacu-col-left wpacu-video-wrapper">
<iframe width="560" height="315" src="https://www.youtube.com/embed/ATXACFtcyKs?start=441" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<div class="wpacu-col-right">
<p>If you are using heavy themes such as Avada, visual builders like Divi, Elementor, Beaver Builder or anything else that causes bloat, this tutorial will teach you optimizations which will significantly speed up ANY WordPress website. <strong><em>At ~07:21 within the video, the stripping of the "fat" topic is brought, followed by the setup of Asset CleanUp.</em></strong></p>
<p>There are three main thing that typically degrade performance and make a WordPress website run slowly. Fix these, and you'll have a fast loading website:</p>
<ol>
<li>Plugins (and WordPress core) loads scripts and styles onto all pages of your site, even when they only need to be present on a single page.</li>
<li>Excessively large files (like images) are being loaded on the page - resulting in slow load times. Compress these files to speed things up.</li>
<li>Bad web hosting providers don't deliver your page to the visitor quickly - resulting in slow load times even for a lightweight page.</li>
</ol>
</div>
</div>
<div class="wpacu-video-area-wrapper">
<div class="wpacu-col-left wpacu-video-wrapper">
<iframe width="560" height="315" src="https://www.youtube.com/embed/B8_QLVAgQiU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<div class="wpacu-col-right">
<p>This is a video tutorial explaining how to improve the loading speed of your WordPress blog or any specific page on your blog through the Asset CleanUp WordPress Plugin.</p>
<p>Google PageSpeed Insights is used to analyze the page load and the following improvements were achieved just by stripping the "fat":</p>
<ul>
<li><strong>17</strong>/100 to <strong>27</strong>/100 for Mobile</li>
<li><strong>61</strong>/100 to <strong>81</strong>/100 for Desktop</li>
</ul>
</div>
</div>
<div class="wpacu-video-area-wrapper">
<div class="wpacu-col-left wpacu-video-wrapper">
<iframe width="560" height="315" src="https://www.youtube.com/embed/zDix8THVpA8?start=845" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<div class="wpacu-col-right">
<p>This video from WPCasts, shows how to use Asset CleanUp to reduce the number of HTTP requests and the MB transferred.</p>
<p><strong>At ~14:05 within the video, Asset CleanUp comes into play.</strong></p>
</div>
</div>
<div class="wpacu-video-area-wrapper">
<div class="wpacu-col-left wpacu-video-wrapper">
<iframe width="560" height="315" src="https://www.youtube.com/embed/fbwczibhNqQ" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<div class="wpacu-col-right">
<p>This video from "Acabado Theme Customization", shows how Asset CleanUp can help you increase your loading times for your visitors without a bunch of effort, it just takes some time and patience to learn and you can increase scores and speed dramatically.</p>
<p>It involves an increase of speed from <strong>76</strong>/100 via Mobile in Google PageSpeed Insights to <strong>99</strong>/100 by optimizing the homepage which should not load so many useless CSS &amp; JavaScript files.</p>
</div>
</div>
<div class="wpacu-video-area-wrapper">
<div class="wpacu-col-left wpacu-video-wrapper">
<iframe width="560" height="315" src="https://www.youtube.com/embed/5By-lvZPENU?start=1120" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<div class="wpacu-col-right">
<p>This video from "NodeFlame Labs" is about speeding up your web pages and <strong>starts showing how to use the plugin and dequeue unused scripts &amp; styles at ~18:40</strong>.</p>
<p>It involves an increase of speed from <strong>71</strong>/100 via Mobile in Google PageSpeed Insights to <strong>78</strong>/100 by unloading a bunch of unnecessary CSS/JS files.</p>
</div>
</div>
<div class="wpacu-video-area-wrapper">
<div class="wpacu-col-left wpacu-video-wrapper">
<a target="_blank" href="https://www.youtube.com/watch?v=garf1tL6PTU&start=1925"><img src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/images/sproutedweb-asset-cleanup-elementor-video.jpg" style="width: 560px;" alt="" /></a>
</div>
<div class="wpacu-col-right">
<p>This video from SproutedWeb, covers some basic Performance Fundamentals, shows the latest Benchmarks for Elementor v2.5.3 (on WP Engine, PHP 7.2, WP 5.1).</p>
<p>They also cover the basics of how to read a Waterfall Chart, and how to trim a lot of the fat on Elementor pages.</p>
<p><strong>At ~32:05 within the video, Asset CleanUp comes into play.</strong></p>
</div>
</div>
<div class="wpacu-video-area-wrapper">
<div class="wpacu-col-left wpacu-video-wrapper">
<iframe width="560" height="315" src="https://www.youtube.com/embed/FiYYtr-9jGA" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<div class="wpacu-col-right">
<p><strong><span class="dashicons dashicons-info"></span> This video is for Portuguese speakers.</strong></p>
<p>Veja Outras dicas de Performance WordPress para deixar o seu site ainda mais rápido.</p>
<p>Tutorial: <a target="_blank" href="https://blog.escolaninjawp.com.br/performance-wordpress/">https://blog.escolaninjawp.com.br/performance-wordpress/</a></p>
</div>
</div>
</div>

View File

@ -0,0 +1,103 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
?>
<!-- [Page Options Area] -->
<?php
$hasPostsWithOptions = isset($data['page_options_results']['posts']) && ! empty($data['page_options_results']['posts']);
$hasHomepageWithOptions = isset( $data['page_options_results']['homepage']['options'] ) && ! empty( $data['page_options_results']['homepage']['options'] );
$hasAtLeastOneRecord = $hasPostsWithOptions || $hasHomepageWithOptions;
?>
<div id="wpacu-page-options-wrap">
<h3><span class="dashicons dashicons-admin-generic"></span> <?php _e('Page Options', 'wp-asset-clean-up'); ?></h3>
<div style="padding: 10px; background: white; border: 1px solid #ccd0d4; box-shadow: 0 1px 1px rgba(0,0,0,.04);">
<?php
if ($hasAtLeastOneRecord) {
?>
<p>On the pages listed below, there are special options set. <a target="_blank" style="text-decoration: none;" href="https://www.assetcleanup.com/docs/?p=1318"><span class="dashicons dashicons-info"></span> Read more</a></p>
<table class="wp-list-table wpacu-list-table widefat plugins striped" style="margin: 10px 0 0; width: 100%;">
<?php
}
if ( $hasHomepageWithOptions ) {
$optionsForCurrentPage = array();
foreach ($data['page_options_results']['homepage']['options'] as $optionKey => $optionValue) {
if (isset($data['page_options_to_text'][$optionKey]) && $optionValue) {
$optionsForCurrentPage[] = $data['page_options_to_text'][$optionKey];
}
}
?>
<tr>
<td><span class="dashicons dashicons-admin-home"></span> Homepage (e.g. latest posts)<br /><small><a target="_blank" href="<?php echo get_site_url(); ?>"><?php echo get_site_url(); ?></a></small></td>
<td><?php echo implode (', ', $optionsForCurrentPage); ?></td>
</tr>
<?php
}
if ( $hasPostsWithOptions ) {
foreach ($data['page_options_results']['posts'] as $results) {
$rowStyle = '';
$postExists = true;
if (get_post($results['post_id']) === null) {
$postExists = false;
$postStatus = $postStatusText = '';
$rowStyle = 'style="opacity: 0.6;"';
} else {
$postStatus = $postStatusText = get_post_status( $results['post_id'] );
if ( ! in_array( $postStatus, array( 'publish', 'private' ) ) ) {
$rowStyle = 'style="opacity: 0.6;"';
$postStatusText = '<span style="color: #cc0000;">' . $postStatus . '</span>';
}
}
?>
<tr <?php echo wp_kses($rowStyle, array('style' => array())); ?>>
<td>
<?php if ($postExists) { ?>
<?php echo get_the_title($results['post_id']); ?> / ID: <?php echo (int)$results['post_id']; ?>, Status: <?php echo wp_kses($postStatusText, array('span' => array('style' => array()))); ?><br /><small><a target="_blank" href="<?php echo get_permalink($results['post_id']); ?>"><?php echo get_permalink($results['post_id']); ?></a></small>
<?php } else { ?>
ID: <s style="color: #cc0000;" class="wpacu-tooltip" title="N/A (post deleted)"><?php echo (int)$results['post_id']; ?></s>
<?php } ?>
</td>
<td>
<?php
$optionsForCurrentPage = array();
foreach ($results['options'] as $optionKey => $optionValue) {
if ($optionKey === '_page_uri') {
// Hidden and irrelevant
continue;
}
if (isset($data['page_options_to_text'][$optionKey]) && $optionValue) {
$optionsForCurrentPage[] = $data['page_options_to_text'][$optionKey];
}
}
echo implode (', ', $optionsForCurrentPage);
?>
</td>
</tr>
<?php
}
}
if ($hasAtLeastOneRecord) {
?>
</table>
<?php
}
?>
<?php if ( ! $hasAtLeastOneRecord ) { ?>
There are no special options set for any page. <a style="text-decoration: none;" target="_blank" href="https://www.assetcleanup.com/docs/?p=1318"><span class="dashicons dashicons-info"></span> Read more</a>
<?php } ?>
</div>
</div>
<!-- [/Page Options Area] -->

View File

@ -0,0 +1,74 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
?>
<hr style="margin: 15px 0;"/>
<h3><span class="dashicons dashicons-media-code"></span> <?php _e('Scripts (.js)', 'wp-asset-clean-up'); ?>
<?php
if (isset($data['handles']['scripts']) && count($data['handles']['scripts']) > 0) {
echo ' &#10230; Total handles with rules: '.count($data['handles']['scripts']);
}
?></h3>
<?php
if (isset($data['handles']['scripts']) && ! empty($data['handles']['scripts'])) {
?>
<table class="wp-list-table wpacu-overview-list-table widefat fixed striped">
<thead>
<tr class="wpacu-top">
<td><strong>Handle</strong></td>
<td><strong>Unload &amp; Load Exception Rules</strong></td>
</tr>
</thead>
<?php
foreach ($data['handles']['scripts'] as $handle => $handleData) {
// [wpacu_lite]
// Traces from the PRO version in case a downgrade to LITE was made
$hasProTraces = (strpos($handle, 'wpacu_hardcoded_') !== false);
$trStyle = $hasProTraces ? 'opacity: 0.5;' : '';
// [/wpacu_lite]
?>
<tr class="wpacu_global_rule_row wpacu_bulk_change_row" style="<?php echo esc_attr($trStyle); ?>">
<td>
<?php
\WpAssetCleanUp\Overview::renderHandleTd($handle, 'scripts', $data);
if ($hasProTraces) {
echo ' &#10230; Inactive rule left from the PRO version';
}
?>
</td>
<td>
<?php
$handleData['handle'] = $handle;
$handleData['asset_type'] = 'scripts';
$handleChangesOutput = \WpAssetCleanUp\Overview::renderHandleChangesOutput($handleData);
if (! empty($handleChangesOutput)) {
echo '<ul style="margin: 0;">' . "\n";
foreach ( $handleChangesOutput as $handleChangesOutputPart ) {
echo '<li>' . $handleChangesOutputPart . '</li>' . "\n";
}
echo '</ul>';
} else {
echo '<em style="color: #6d6d6d;">'.__('No unload/load exception rules of any kind are set for this JavaScript file', 'wp-asset-clean-up').'</em>.';
}
?>
</td>
</tr>
<?php
}
?>
</table>
<?php
} else {
?>
<p><?php _e('There is no data added to (e.g. unload, load exceptions, notes, async/defer attributes, changing of location, preloading, etc.) to any SCRIPT tag.', 'wp-asset-clean-up'); ?></p>
<?php
}

View File

@ -0,0 +1,101 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
?>
<hr style="margin: 15px 0;"/>
<!-- [Special Settings Area] -->
<?php
$specialSettings = array(
// Cache plugins caching: clear it or not after Asset CleanUp Lite/Pro caching is cleared
'do_not_also_clear_autoptimize_cache' => (defined('WPACU_DO_NOT_ALSO_CLEAR_AUTOPTIMIZE_CACHE') && WPACU_DO_NOT_ALSO_CLEAR_AUTOPTIMIZE_CACHE),
'do_not_also_clear_cache_enabler_cache' => (defined('WPACU_DO_NOT_ALSO_CLEAR_CACHE_ENABLER_CACHE') && WPACU_DO_NOT_ALSO_CLEAR_CACHE_ENABLER_CACHE),
'load_on_oxygen_builder_edit' => (defined('WPACU_LOAD_ON_OXYGEN_BUILDER_EDIT') && WPACU_LOAD_ON_OXYGEN_BUILDER_EDIT),
'load_on_divi_builder_edit' => (defined('WPACU_LOAD_ON_DIVI_BUILDER_EDIT') && WPACU_LOAD_ON_DIVI_BUILDER_EDIT),
'load_on_bricks_builder' => (defined('WPACU_LOAD_ON_BRICKS_BUILDER') && WPACU_LOAD_ON_BRICKS_BUILDER),
);
$noSpecialSettings = empty(array_filter($specialSettings));
?>
<div id="wpacu-special-settings-wrap">
<h3><span class="dashicons dashicons-admin-generic"></span> <?php _e('Special Settings', 'wp-asset-clean-up'); ?></h3>
<div style="padding: 10px; background: white; border: 1px solid #ccd0d4; box-shadow: 0 1px 1px rgba(0,0,0,.04);">
<div>To avoid broken functionality, Asset CleanUp Pro does not load by default when certain URLs are loading (e.g. on REST Calls, when using specific Page Builders). Some experienced users would want to change this behaviour and allow the plugin to load and trigger its unload rules. Through special settings, you can do that. <a target="_blank" style="text-decoration: none;" href="https://www.assetcleanup.com/docs/?p=1495"><span class="dashicons dashicons-info"></span> Read more</a></div>
<?php
if ($noSpecialSettings) {
?>
<p style="margin: 15px 0 0;">There are no special settings set.</p>
<?php
} else {
?>
<div style="margin: 15px 0 0;">
<table class="wp-list-table widefat fixed striped">
<thead>
<tr class="wpacu-top">
<td><strong>Setting</strong></td>
<td><strong>Description</strong></td>
</tr>
</thead>
<tbody>
<?php
if ($specialSettings['do_not_also_clear_autoptimize_cache']) {
?>
<tr>
<td><span style="color: green;">Do not also clear Autoptimize cache after <?php echo WPACU_PLUGIN_TITLE; ?> caching is cleared</span></td>
<td>The constant <code>WPACU_DO_NOT_ALSO_CLEAR_AUTOPTIMIZE_CACHE</code> is set to <code style="color: blue;">true</code>. <a style="text-decoration: none; white-space: nowrap;" target="_blank" href="https://www.assetcleanup.com/docs/?p=1502#wpacu-autoptimize"><span class="dashicons dashicons-info"></span> Read more</a></td>
</tr>
<?php
}
if ($specialSettings['do_not_also_clear_cache_enabler_cache']) {
?>
<tr>
<td><span style="color: green;">Do not also clear "Cache Enabler" cache after <?php echo WPACU_PLUGIN_TITLE; ?> caching is cleared</span></td>
<td>The constant <code>WPACU_DO_NOT_ALSO_CLEAR_CACHE_ENABLER_CACHE</code> is set to <code style="color: blue;">true</code>. <a style="text-decoration: none; white-space: nowrap;" target="_blank" href="https://www.assetcleanup.com/docs/?p=1502#wpacu-cache-enabler"><span class="dashicons dashicons-info"></span> Read more</a></td>
</tr>
<?php
}
// [Page Builders]
if ($specialSettings['load_on_oxygen_builder_edit']) {
?>
<tr>
<td><span style="color: green;">Load plugin unload rules when using Oxygen Builder</span></td>
<td>The constant <code>WPACU_LOAD_ON_OXYGEN_BUILDER_EDIT</code> is set to <code style="color: blue;">true</code>. Whenever you're editing a page using Oxygen Builder, any matching unload rules set using the following options will take effect: 1) <em>"Plugins Manager" -- "IN FRONTEND VIEW (your visitors)"</em> / 2) <em>"CSS &amp; JS MANAGER" -- "MANAGE CSS/JS"</em>. <a style="text-decoration: none; white-space: nowrap;" target="_blank" href="https://www.assetcleanup.com/docs/?p=1200"><span class="dashicons dashicons-info"></span> Read more</a></td>
</tr>
<?php
}
if ($specialSettings['load_on_divi_builder_edit']) {
?>
<tr>
<td><span style="color: green;">Load plugin unload rules when using Divi Builder</span></td>
<td>The constant <code>WPACU_LOAD_ON_DIVI_BUILDER_EDIT</code> is set to <code style="color: blue;">true</code>. Whenever you're editing a page using Divi Builder, any matching unload rules set using the following options will take effect: 1) <em>"Plugins Manager" -- "IN FRONTEND VIEW (your visitors)"</em> / 2) <em>"CSS &amp; JS MANAGER" -- "MANAGE CSS/JS"</em>. <a style="text-decoration: none; white-space: nowrap;" target="_blank" href="https://www.assetcleanup.com/docs/?p=1260"><span class="dashicons dashicons-info"></span> Read more</a></td>
</tr>
<?php
}
if ($specialSettings['load_on_bricks_builder']) {
?>
<tr>
<td><span style="color: green;">Load plugin unload rules when using Bricks Builder</span></td>
<td>The constant <code>WPACU_LOAD_ON_BRICKS_BUILDER</code> is set to <code style="color: blue;">true</code>. Whenever you're editing a page using Bricks Builder, any matching unload rules set using the following options will take effect: 1) <em>"Plugins Manager" -- "IN FRONTEND VIEW (your visitors)"</em> / 2) <em>"CSS &amp; JS MANAGER" -- "MANAGE CSS/JS"</em>. <a style="text-decoration: none; white-space: nowrap;" target="_blank" href="https://www.assetcleanup.com/docs/?p=1450"><span class="dashicons dashicons-info"></span> Read more</a></td>
</tr>
<?php
}
// [/Page Builders]
?>
</tbody>
</table>
</div>
<?php
}
?>
</div>
</div>
<!-- [/Special Settings Area] -->

View File

@ -0,0 +1,74 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
?>
<hr style="margin: 15px 0;"/>
<h3><span class="dashicons dashicons-admin-appearance"></span> <?php _e('Stylesheets (.css)', 'wp-asset-clean-up'); ?>
<?php
if (isset($data['handles']['styles']) && count($data['handles']['styles']) > 0) {
echo ' &#10230; Total handles with rules: '.count($data['handles']['styles']);
}
?></h3>
<?php
if (isset($data['handles']['styles']) && ! empty($data['handles']['styles'])) {
?>
<table class="wp-list-table wpacu-overview-list-table widefat fixed striped">
<thead>
<tr class="wpacu-top">
<td><strong>Handle</strong></td>
<td><strong>Unload &amp; Load Exception Rules</strong></td>
</tr>
</thead>
<?php
foreach ($data['handles']['styles'] as $handle => $handleData) {
// [wpacu_lite]
// Traces from the PRO version in case a downgrade to LITE was made
$hasProTraces = (strpos($handle, 'wpacu_hardcoded_') !== false);
$trStyle = $hasProTraces ? 'opacity: 0.5;' : '';
// [/wpacu_lite]
?>
<tr class="wpacu_global_rule_row wpacu_bulk_change_row" style="<?php echo esc_attr($trStyle); ?>">
<td>
<?php
\WpAssetCleanUp\Overview::renderHandleTd($handle, 'styles', $data);
if ($hasProTraces) {
echo ' &#10230; Inactive rule left from the PRO version';
}
?>
</td>
<td>
<?php
$handleData['handle'] = $handle;
$handleData['asset_type'] = 'styles';
$handleChangesOutput = \WpAssetCleanUp\Overview::renderHandleChangesOutput($handleData);
if (! empty($handleChangesOutput)) {
echo '<ul style="margin: 0;">' . "\n";
foreach ( $handleChangesOutput as $handleChangesOutputPart ) {
echo '<li>' . $handleChangesOutputPart . '</li>' . "\n";
}
echo '</ul>';
} else {
echo '<em style="color: #6d6d6d;">'.__('No unload/load exception rules of any kind are set for this stylesheet file', 'wp-asset-clean-up').'</em>.';
}
?>
</td>
</tr>
<?php
}
?>
</table>
<?php
} else {
?>
<p><?php _e('There is no data added to (e.g. unload, load exceptions, notes, changing of location, preloading, etc.) to any stylesheet.', 'wp-asset-clean-up'); ?></p>
<?php
}

View File

@ -0,0 +1,45 @@
<?php
if (! isset($data)) {
exit;
}
?>
<div data-wpacu-plugin-path="<?php echo esc_attr($data['plugin_path']); ?>"
class="wpacu_plugin_unload_rules_options_wrap">
<div class="wpacu_plugin_rules_wrap">
<fieldset>
<legend><strong>Unload this plugin</strong> within the Dashboard:</legend>
<ul class="wpacu_plugin_rules">
<li>
<label for="wpacu_global_unload_plugin_<?php echo \WpAssetCleanUp\Misc::sanitizeValueForHtmlAttr($data['plugin_path']); ?>"
<input data-wpacu-plugin-path="<?php echo esc_attr($data['plugin_path']); ?>"
disabled="disabled"
class="disabled wpacu_plugin_unload_site_wide wpacu_plugin_unload_rule_input"
id="wpacu_global_unload_plugin_<?php echo \WpAssetCleanUp\Misc::sanitizeValueForHtmlAttr($data['plugin_path']); ?>"
type="checkbox"
value="unload_site_wide" />
<a class="go-pro-link-no-style"
target="_blank"
href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL . '?utm_source=manage_asset&utm_medium=unload_plugin_all_pages_in_admin'); ?>"><span class="wpacu-tooltip" style="width: 200px; margin-left: -108px;">This feature is locked for Pro users<br />Click here to upgrade!</span><img width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" valign="top" alt="" /></a>&nbsp; Unload on all admin pages</label>
</li>
<li>
<label for="wpacu_unload_it_regex_option_<?php echo \WpAssetCleanUp\Misc::sanitizeValueForHtmlAttr($data['plugin_path']); ?>"
style="margin-right: 0;">
<input data-wpacu-plugin-path="<?php echo esc_attr($data['plugin_path']); ?>"
disabled="disabled"
id="wpacu_unload_it_regex_option_<?php echo \WpAssetCleanUp\Misc::sanitizeValueForHtmlAttr($data['plugin_path']); ?>"
class="disabled wpacu_plugin_unload_regex_option wpacu_plugin_unload_rule_input"
type="checkbox"
value="unload_via_regex">
<a class="go-pro-link-no-style"
target="_blank"
href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL . '?utm_source=manage_asset&utm_medium=unload_plugin_via_regex_in_admin'); ?>"><span class="wpacu-tooltip" style="width: 200px; margin-left: -108px;">This feature is locked for Pro users<br />Click here to upgrade!</span><img width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" valign="top" alt="" /></a> &nbsp;<span>Unload it for admin URLs with request URI matching the RegEx(es):</span></label>
<a class="help_link unload_it_regex"
target="_blank"
href="https://assetcleanup.com/docs/?p=372#wpacu-unload-plugins-via-regex"><span style="color: #74777b;" class="dashicons dashicons-editor-help"></span></a>
</li>
</ul>
</fieldset>
</div>
<div class="wpacu_clearfix"></div>
</div>
<!-- [End] Unload Rules -->

View File

@ -0,0 +1,77 @@
<?php
if (! isset($data)) {
exit;
}
?>
<div class="wpacu-wrap" id="wpacu-plugins-load-manager-wrap">
<?php
$pluginsRows = array();
foreach ($data['active_plugins'] as $pluginData) {
$data['plugin_path'] = $pluginPath = $pluginData['path'];
list($pluginDir) = explode('/', $pluginPath);
ob_start();
?>
<tr>
<td class="wpacu_plugin_icon" width="46">
<?php if(isset($data['plugins_icons'][$pluginDir])) { ?>
<img width="44" height="44" alt="" src="<?php echo esc_attr($data['plugins_icons'][$pluginDir]); ?>" />
<?php } else { ?>
<div><span class="dashicons dashicons-admin-plugins"></span></div>
<?php } ?>
</td>
<td class="wpacu_plugin_details" id="wpacu-dash-manage-<?php echo esc_attr($pluginData['path']); ?>">
<span class="wpacu_plugin_title"><?php echo esc_html($pluginData['title']); ?></span>
<span class="wpacu_plugin_path">&nbsp;<?php echo esc_html($pluginData['path']); ?></span>
<?php
if ($pluginData['network_activated']) {
echo '&nbsp;<span title="Network Activated" class="dashicons dashicons-admin-multisite wpacu-tooltip"></span>';
}
?>
<div class="wpacu_clearfix"></div>
<!-- [Start] Unload Rules -->
<?php
include '_dash-areas/_unloads.php';
?>
<!-- [End] Unload Rules -->
</td>
</tr>
<?php
$trOutput = ob_get_clean();
$pluginsRows['always_loaded'][] = $trOutput;
}
if (isset($pluginsRows['always_loaded']) && ! empty($pluginsRows['always_loaded'])) {
if (isset($pluginsRows['has_unload_rules']) && count($pluginsRows['has_unload_rules']) > 0) {
?>
<div style="margin-top: 35px;"></div>
<?php
}
$totalAlwaysLoadedPlugins = count($pluginsRows['always_loaded']);
?>
<h3><span style="color: green;" class="dashicons dashicons-admin-plugins"></span> <span style="color: green;"><?php echo (int)$totalAlwaysLoadedPlugins; ?></span> active plugin<?php echo ($totalAlwaysLoadedPlugins > 1) ? 's' : ''; ?> (loaded by default)</h3>
<table class="wp-list-table wpacu-list-table widefat plugins striped">
<?php
foreach ( $pluginsRows['always_loaded'] as $pluginRowOutput ) {
echo \WpAssetCleanUp\Misc::stripIrrelevantHtmlTags($pluginRowOutput) . "\n";
}
?>
</table>
<?php
}
?>
<div id="wpacu-update-button-area" style="margin-left: 0;">
<p class="submit"><a target="_blank" disabled="disabled" class="go-pro-link-no-style button button-primary"
href="https://www.gabelivan.com/items/wp-asset-cleanup-pro/?utm_source=manage_asset&utm_medium=plugins_manager_area_dash_tab_submit_button"
style="cursor: pointer; font-style: normal; padding-top: 5px;" id="submit"><span
class="wpacu-tooltip" style="width: 200px; margin-left: -108px;">This feature is locked for Pro users<br/>Click here to upgrade!</span>
<img width="20" height="20" src="<?php echo esc_url( WPACU_PLUGIN_URL ); ?>/assets/icons/icon-lock.svg"
valign="middle" alt=""/> &nbsp;<?php echo esc_attr( __( 'Apply changes within /wp-admin/',
'wp-asset-clean-up' ) ); ?></a></p>
</div>
</div>

View File

@ -0,0 +1,138 @@
<?php
// This file is included from /templates/_admin-page-plugins-manager/_front.php
if (! isset($data)) {
exit;
}
?>
<div data-wpacu-plugin-path="<?php echo esc_attr($data['plugin_path']); ?>"
class="wpacu_plugin_unload_rules_options_wrap">
<div class="wpacu_plugin_rules_wrap">
<fieldset>
<legend><strong>Unload this plugin</strong> in the front-end:</legend>
<ul class="wpacu_plugin_rules">
<li>
<label for="wpacu_global_unload_plugin_<?php echo \WpAssetCleanUp\Misc::sanitizeValueForHtmlAttr($data['plugin_path']); ?>">
<input data-wpacu-plugin-path="<?php echo esc_attr($data['plugin_path']); ?>"
style="margin-right: 0;"
disabled="disabled"
class="disabled wpacu_plugin_unload_site_wide wpacu_plugin_unload_rule_input"
id="wpacu_global_unload_plugin_<?php echo \WpAssetCleanUp\Misc::sanitizeValueForHtmlAttr($data['plugin_path']); ?>"
type="checkbox"
value="unload_site_wide" />
<a class="go-pro-link-no-style"
href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL . '?utm_source=manage_asset&utm_medium=unload_plugin_site_wide'); ?>"><span class="wpacu-tooltip" style="width: 200px; margin-left: -108px;">This feature is locked for Pro users<br />Click here to upgrade!</span><img width="20" height="20" style="vertical-align: text-bottom;" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" alt="" /></a>&nbsp;
<span>On all pages</span></label>
</li>
<li>
<label for="wpacu_home_page_unload_plugin_<?php echo \WpAssetCleanUp\Misc::sanitizeValueForHtmlAttr($data['plugin_path']); ?>">
<input data-wpacu-plugin-path="<?php echo esc_attr($data['plugin_path']); ?>"
style="margin-right: 0;"
disabled="disabled"
class="disabled wpacu_plugin_unload_home_page wpacu_plugin_unload_rule_input"
id="wpacu_home_page_unload_plugin_<?php echo \WpAssetCleanUp\Misc::sanitizeValueForHtmlAttr($data['plugin_path']); ?>"
type="checkbox"
name="wpacu_plugins[<?php echo esc_attr($data['plugin_path']); ?>][status][]"
value="unload_home_page" />
<a class="go-pro-link-no-style"
href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL . '?utm_source=manage_asset&utm_medium=unload_plugin_on_home_page'); ?>"><span class="wpacu-tooltip" style="width: 200px; margin-left: -108px;">This feature is locked for Pro users<br />Click here to upgrade!</span><img width="20" height="20" style="vertical-align: text-bottom;" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" alt="" /></a>&nbsp;
<span>On the homepage</span></label>
</li>
<!-- [Unload based on the post type] -->
<li>
<label for="wpacu_via_post_type_unload_plugin_<?php echo \WpAssetCleanUp\Misc::sanitizeValueForHtmlAttr($data['plugin_path']); ?>">
<input data-wpacu-plugin-path="<?php echo esc_attr($data['plugin_path']); ?>"
style="margin-right: 0;"
class="disabled wpacu_plugin_unload_via_post_type wpacu_plugin_unload_rule_input"
id="wpacu_via_post_type_unload_plugin_<?php echo \WpAssetCleanUp\Misc::sanitizeValueForHtmlAttr($data['plugin_path']); ?>"
type="checkbox"
disabled="disabled"
name="wpacu_plugins[<?php echo esc_attr($data['plugin_path']); ?>][status][]"
value="unload_via_post_type" />
<a class="go-pro-link-no-style"
href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL . '?utm_source=manage_asset&utm_medium=unload_plugin_on_pages_of_post_types'); ?>"><span class="wpacu-tooltip" style="width: 200px; margin-left: -108px;">This feature is locked for Pro users<br />Click here to upgrade!</span><img width="20" height="20" style="vertical-align: text-bottom;" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" alt="" /></a>&nbsp;
<span>On pages of these post types:</span>
</label>
<a class="help_link"
target="_blank"
href="https://www.assetcleanup.com/docs/?p=1613"><span style="color: #74777b;" class="dashicons dashicons-editor-help"></span></a>
</li>
<!-- [/Unload based on the post type] -->
<!-- [Unload on taxonomy pages] -->
<li>
<label for="wpacu_via_taxonomy_unload_plugin_<?php echo \WpAssetCleanUp\Misc::sanitizeValueForHtmlAttr($data['plugin_path']); ?>">
<input data-wpacu-plugin-path="<?php echo esc_attr($data['plugin_path']); ?>"
style="margin-right: 0;"
disabled="disabled"
class="disabled wpacu_plugin_unload_via_tax wpacu_plugin_unload_rule_input"
id="wpacu_via_taxonomy_unload_plugin_<?php echo \WpAssetCleanUp\Misc::sanitizeValueForHtmlAttr($data['plugin_path']); ?>"
type="checkbox"
name="wpacu_plugins[<?php echo esc_attr($data['plugin_path']); ?>][status][]"
value="unload_via_tax" />
<a class="go-pro-link-no-style"
href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL . '?utm_source=manage_asset&utm_medium=unload_plugin_on_taxonomy_pages'); ?>"><span class="wpacu-tooltip" style="width: 200px; margin-left: -108px;">This feature is locked for Pro users<br />Click here to upgrade!</span><img width="20" height="20" style="vertical-align: text-bottom;" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" alt="" /></a>&nbsp;
<span>On these taxonomy pages:</span></label>
<a class="help_link"
target="_blank"
href="https://www.assetcleanup.com/docs/?p=1579"><span style="color: #74777b;" class="dashicons dashicons-editor-help"></span></a>
</li>
<!-- [/Unload on taxonomy pages] -->
<!-- [Unload on archive (post list) pages] -->
<li>
<label for="wpacu_via_archive_type_unload_plugin_<?php echo \WpAssetCleanUp\Misc::sanitizeValueForHtmlAttr($data['plugin_path']); ?>">
<input data-wpacu-plugin-path="<?php echo esc_attr($data['plugin_path']); ?>"
style="margin-right: 0;"
disabled="disabled"
class="disabled wpacu_plugin_unload_via_archive wpacu_plugin_unload_rule_input"
id="wpacu_via_archive_type_unload_plugin_<?php echo \WpAssetCleanUp\Misc::sanitizeValueForHtmlAttr($data['plugin_path']); ?>"
type="checkbox"
name="wpacu_plugins[<?php echo esc_attr($data['plugin_path']); ?>][status][]"
value="unload_via_archive" />
<a class="go-pro-link-no-style"
href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL . '?utm_source=manage_asset&utm_medium=unload_plugin_on_archive_pages'); ?>"><span class="wpacu-tooltip" style="width: 200px; margin-left: -108px;">This feature is locked for Pro users<br />Click here to upgrade!</span><img width="20" height="20" style="vertical-align: text-bottom;" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" alt="" /></a>&nbsp;
<span>On these archive (page list) pages:</span></label>
<a class="help_link"
target="_blank"
href="https://www.assetcleanup.com/docs/?p=1647"><span style="color: #74777b;" class="dashicons dashicons-editor-help"></span></a>
</li>
<!-- [/Unload on archive (post list) pages] -->
<li>
<label for="wpacu_unload_it_regex_option_<?php echo \WpAssetCleanUp\Misc::sanitizeValueForHtmlAttr($data['plugin_path']); ?>"
style="margin-right: 0;">
<input data-wpacu-plugin-path="<?php echo esc_attr($data['plugin_path']); ?>"
style="margin-right: 0;"
disabled="disabled"
id="wpacu_unload_it_regex_option_<?php echo \WpAssetCleanUp\Misc::sanitizeValueForHtmlAttr($data['plugin_path']); ?>"
class="disabled wpacu_plugin_unload_regex_option wpacu_plugin_unload_rule_input"
type="checkbox"
value="unload_via_regex">
<a class="go-pro-link-no-style"
href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL . '?utm_source=manage_asset&utm_medium=unload_plugin_via_regex'); ?>"><span class="wpacu-tooltip" style="width: 200px; margin-left: -108px;">This feature is locked for Pro users<br />Click here to upgrade!</span><img width="20" height="20" style="vertical-align: text-bottom;" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" alt="" /></a>&nbsp;
<span>If request URI matches these RegEx(es):</span>
</label>
<a class="help_link unload_it_regex"
target="_blank"
href="https://assetcleanup.com/docs/?p=372#wpacu-unload-plugins-via-regex"><span style="color: #74777b;" class="dashicons dashicons-editor-help"></span></a>
</li>
<li>
<label for="wpacu_unload_it_logged_in_plugin_<?php echo \WpAssetCleanUp\Misc::sanitizeValueForHtmlAttr($data['plugin_path']); ?>" style="margin-right: 0;">
<input data-wpacu-plugin-path="<?php echo esc_attr($data['plugin_path']); ?>"
style="margin-right: 0;"
disabled="disabled"
id="wpacu_unload_it_logged_in_plugin_<?php echo \WpAssetCleanUp\Misc::sanitizeValueForHtmlAttr($data['plugin_path']); ?>"
class="disabled wpacu_plugin_unload_logged_in"
type="checkbox"
name="wpacu_plugins[<?php echo esc_attr($data['plugin_path']); ?>][status][]"
value="unload_logged_in" />
<a class="go-pro-link-no-style"
href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL . '?utm_source=manage_asset&utm_medium=unload_plugin_if_logged_in'); ?>"><span class="wpacu-tooltip" style="width: 200px; margin-left: -132px;">This feature is locked for Pro users<br />Click here to upgrade!</span><img width="20" height="20" style="vertical-align: text-bottom;" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" alt="" /></a>&nbsp;
<span>If the user is logged in</span>
</label>
</li>
</ul>
<div class="wpacu_clearfix"></div>
</fieldset>
</div>
</div>

View File

@ -0,0 +1,76 @@
<?php
if (! isset($data)) {
exit;
}
?>
<div class="wpacu-wrap" id="wpacu-plugins-load-manager-wrap">
<?php
$pluginsRows = array();
foreach ($data['active_plugins'] as $pluginData) {
$data['plugin_path'] = $pluginPath = $pluginData['path'];
list($pluginDir) = explode('/', $pluginPath);
ob_start();
?>
<tr>
<td class="wpacu_plugin_icon" width="46">
<?php if (isset($data['plugins_icons'][$pluginDir])) { ?>
<img width="44" height="44" alt="" src="<?php echo esc_url($data['plugins_icons'][$pluginDir]); ?>" />
<?php } else { ?>
<div><span class="dashicons dashicons-admin-plugins"></span></div>
<?php } ?>
</td>
<td class="wpacu_plugin_details" id="wpacu-front-manage-<?php echo esc_attr($pluginData['path']); ?>">
<span class="wpacu_plugin_title"><?php echo esc_html($pluginData['title']); ?></span>
<span class="wpacu_plugin_path">&nbsp;<?php echo esc_html($pluginData['path']); ?></span>
<?php
if ($pluginData['network_activated']) {
echo '&nbsp;<span title="Network Activated" class="dashicons dashicons-admin-multisite wpacu-tooltip"></span>';
}
?>
<div class="wpacu_clearfix"></div>
<!-- [Start] Unload Rules -->
<?php
include '_front-areas/_unloads.php';
?>
<!-- [End] Unload Rules -->
</td>
</tr>
<?php
$trOutput = ob_get_clean();
$pluginsRows['always_loaded'][] = $trOutput;
}
if (isset($pluginsRows['always_loaded']) && ! empty($pluginsRows['always_loaded'])) {
if (isset($pluginsRows['has_unload_rules']) && count($pluginsRows['has_unload_rules']) > 0) {
?>
<div style="margin-top: 35px;"></div>
<?php
}
$totalAlwaysLoadedPlugins = count($pluginsRows['always_loaded']);
?>
<h3><span style="color: green;" class="dashicons dashicons-admin-plugins"></span> <span style="color: green;"><?php echo (int)$totalAlwaysLoadedPlugins; ?></span> active plugin<?php echo ($totalAlwaysLoadedPlugins > 1) ? 's' : ''; ?> (loaded by default)</h3>
<table class="wp-list-table wpacu-list-table widefat plugins striped">
<?php
foreach ( $pluginsRows['always_loaded'] as $pluginRowOutput ) {
echo \WpAssetCleanUp\Misc::stripIrrelevantHtmlTags($pluginRowOutput) . "\n";
}
?>
</table>
<?php
}
?>
<div id="wpacu-update-button-area" style="margin-left: 0;">
<p class="submit"><a target="_blank" disabled="disabled" class="go-pro-link-no-style button button-primary"
href="https://www.gabelivan.com/items/wp-asset-cleanup-pro/?utm_source=manage_asset&utm_medium=plugins_manager_area_front_tab_submit_button"
style="cursor: pointer; font-style: normal; padding-top: 5px;" id="submit"><span
class="wpacu-tooltip" style="width: 200px; margin-left: -108px;">This feature is locked for Pro users<br/>Click here to upgrade!</span>
<img width="20" height="20" src="<?php echo esc_url( WPACU_PLUGIN_URL ); ?>/assets/icons/icon-lock.svg"
valign="middle" alt=""/> &nbsp;<?php echo esc_attr( __( 'Apply changes within frontend view',
'wp-asset-clean-up' ) ); ?></a></p>
</div>
</div>

View File

@ -0,0 +1,9 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
?>
<p>This is the list of all the CSS/JS that had its original position changed (e.g. from <code>&lt;HEAD&gt;</code> to <code>&lt;BODY&gt;</code> (also known as: footer) to reduce render blocking resources, or from <code>&lt;BODY&gt;</code> to <code>&lt;HEAD&gt;</code> for early triggering). Changing the location of an asset is available in the<img style="opacity: 0.6;" width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" valign="top" alt="" /> <a href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL . '?utm_source=plugin_bulk_changes&utm_medium=assets_positions'); ?>">Pro version</a> only.</p>

View File

@ -0,0 +1,301 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
if (! defined('WPACU_USE_MODAL_BOX')) {
define('WPACU_USE_MODAL_BOX', true);
}
$possibleWpacuFor = array('everywhere', 'post_types', 'taxonomies', 'authors', 'search_results', 'dates', '404_not_found');
if ( ! in_array($data['for'], $possibleWpacuFor) ) {
exit('Invalid request');
}
// [wpacu_lite]
$availableForPro = '<span class="wpacu-tooltip">'
.esc_html__('Available for Pro users', 'wp-asset-clean-up').
'<br />'.esc_html__('Click to upgrade!', 'wp-asset-clean-up')
.'</span>'.
' <img style="opacity: 0.4;" width="20" height="20" src="'.WPACU_PLUGIN_URL.'/assets/icons/icon-lock.svg" valign="top" alt="" />';
// [/wpacu_lite]
?>
<nav class="nav-tab-wrapper">
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_bulk_unloads')); ?>" class="nav-tab <?php if ($data['for'] === 'everywhere') { ?>nav-tab-active<?php } ?>"><?php esc_html_e('Everywhere', 'wp-asset-clean-up'); ?></a>
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_bulk_unloads&wpacu_for=post_types')); ?>" class="nav-tab <?php if ($data['for'] === 'post_types') { ?>nav-tab-active<?php } ?>">Posts, Pages &amp; Custom Post Types</a>
<a href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=plugin_bulk_unloaded&utm_medium=tab_link'); ?>" target="_blank" class="nav-tab go-pro-link-no-style no-transition"><?php echo wp_kses($availableForPro, array('span' => array('class' => array()), 'br' => array(), 'img' => array('style' => array(), 'width' => array(), 'height' => array(), 'src' => array(), 'valign' => array(), 'alt' => array()))); ?> &nbsp;Taxonomies</a>
<a href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=plugin_bulk_unloaded&utm_medium=tab_link'); ?>" target="_blank" class="nav-tab go-pro-link-no-style no-transition"><?php echo wp_kses($availableForPro, array('span' => array('class' => array()), 'br' => array(), 'img' => array('style' => array(), 'width' => array(), 'height' => array(), 'src' => array(), 'valign' => array(), 'alt' => array()))); ?> &nbsp;Authors</a>
<a href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=plugin_bulk_unloaded&utm_medium=tab_link'); ?>" target="_blank" class="nav-tab go-pro-link-no-style no-transition"><?php echo wp_kses($availableForPro, array('span' => array('class' => array()), 'br' => array(), 'img' => array('style' => array(), 'width' => array(), 'height' => array(), 'src' => array(), 'valign' => array(), 'alt' => array()))); ?> &nbsp;Search Results</a>
<a href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=plugin_bulk_unloaded&utm_medium=tab_link'); ?>" target="_blank" class="nav-tab go-pro-link-no-style no-transition"><?php echo wp_kses($availableForPro, array('span' => array('class' => array()), 'br' => array(), 'img' => array('style' => array(), 'width' => array(), 'height' => array(), 'src' => array(), 'valign' => array(), 'alt' => array()))); ?> &nbsp;Dates</a>
<a href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=plugin_bulk_unloaded&utm_medium=tab_link'); ?>" target="_blank" class="nav-tab go-pro-link-no-style no-transition"><?php echo wp_kses($availableForPro, array('span' => array('class' => array()), 'br' => array(), 'img' => array('style' => array(), 'width' => array(), 'height' => array(), 'src' => array(), 'valign' => array(), 'alt' => array()))); ?> &nbsp;404 Not Found</a>
</nav>
<div class="wpacu_clearfix"></div>
<?php
do_action('wpacu_admin_notices');
if ($data['for'] === 'post_types') {
?>
<div style="margin: 15px 0;">
<form id="wpacu_post_type_form" method="get" action="<?php echo esc_url(admin_url('admin.php')); ?>">
<input type="hidden" name="page" value="wpassetcleanup_bulk_unloads" />
<input type="hidden" name="wpacu_for" value="post_types" />
<div style="margin: 0 0 10px 0;">Select the page or post type (including custom ones) for which you want to see the unloaded scripts &amp; styles:</div>
<?php \WpAssetCleanUp\BulkChanges::buildPostTypesListDd($data['post_types_list'], $data['post_type']); ?>
</form>
</div>
<?php
}
?>
<form action="" method="post">
<?php
if ($data['for'] === 'everywhere') {
?>
<div class="wpacu_clearfix"></div>
<div class="alert">
<p>This is the list of the assets that are <strong>unloaded everywhere</strong> (site-wide) on all pages (including home page). &nbsp;&nbsp;<a id="wpacu-add-bulk-rules-info-target" href="#wpacu-add-bulk-rules-info" style="text-decoration: none;"><span class="dashicons dashicons-info"></span> How the list below gets filled with site-wide rules?</a></p>
<p>If you want to remove this rule and have them loading, use the "Remove site-wide rule" checkbox.</p>
<div style="margin: 0; background: white; padding: 10px; border: 1px solid #ccc; width: auto; display: inline-block;">
<ul>
<li>This list fills once you select "<em>Unload everywhere</em>" when you edit posts/pages for the assets that you want to prevent from loading on every page.</li>
<li>On this page you can only remove the global rules that were added while editing the pages/posts.</li>
</ul>
</div>
</div>
<div class="wpacu_clearfix"></div>
<div style="padding: 0 10px 0 0;">
<p style="margin-bottom: 10px;"><strong><?php _e('Stylesheets (.css) Unloaded', 'wp-asset-clean-up'); ?></strong></p>
<?php
if (! empty($data['values']['styles'])) {
?>
<table class="wp-list-table widefat fixed striped">
<tr>
<td><strong>Handle</strong></td>
<td><strong>Actions</strong></td>
</tr>
<?php
foreach ($data['values']['styles'] as $handle) {
?>
<tr class="wpacu_global_rule_row wpacu_bulk_change_row">
<td>
<?php wpacuRenderHandleTd($handle, 'styles', $data); ?>
</td>
<td>
<label><input type="checkbox"
class="wpacu_bulk_rule_checkbox"
name="wpacu_options_styles[<?php echo esc_attr($handle); ?>]"
value="remove" /> Remove site-wide rule</label>
</td>
</tr>
<?php
}
?>
</table>
<?php
} else {
?>
<p><?php _e('There are no site-wide unloaded styles.', 'wp-asset-clean-up'); ?></p>
<?php
}
?>
<hr style="margin: 15px 0;"/>
<p style="margin-bottom: 10px;"><strong><?php _e('Scripts (.js) Unloaded', 'wp-asset-clean-up'); ?></strong></p>
<?php
if (! empty($data['values']['scripts'])) {
?>
<table class="wp-list-table widefat fixed striped">
<tr>
<td><strong>Handle</strong></td>
<td><strong>Actions</strong></td>
</tr>
<?php
foreach ($data['values']['scripts'] as $handle) {
?>
<tr class="wpacu_global_rule_row wpacu_bulk_change_row">
<td>
<?php wpacuRenderHandleTd($handle, 'scripts', $data); ?>
</td>
<td>
<label><input type="checkbox"
class="wpacu_bulk_rule_checkbox"
name="wpacu_options_scripts[<?php echo esc_attr($handle); ?>]"
value="remove" /> Remove site-wide rule</label>
</td>
</tr>
<?php
}
?>
</table>
<?php
} else {
?>
<p><?php _e('There are no site-wide unloaded scripts.', 'wp-asset-clean-up'); ?></p>
<?php
}
?>
</div>
<?php
}
if ($data['for'] === 'post_types') {
?>
<div class="wpacu_clearfix"></div>
<div class="alert">
<p>This is the list of the assets that are <strong>unloaded</strong> on all pages belonging to the <strong><u><?php echo esc_html($data['post_type']); ?></u></strong> post type. &nbsp;&nbsp;<a id="wpacu-add-bulk-rules-info-target" href="#wpacu-add-bulk-rules-info" style="text-decoration: none;"><span class="dashicons dashicons-info"></span> How the list below gets filled with site-wide rules?</a></p>
<p>If you want to make an asset load again, use the "Remove bulk rule" checkbox.</p>
<div style="margin: 0; background: white; padding: 10px; border: 1px solid #ccc; width: auto; display: inline-block;">
<ul>
<li>This list fills once you select "<em>Unload on All Pages of <strong><?php echo esc_html($data['post_type']); ?></strong> post type</em>" when you edit posts/pages for the assets that you want to prevent from loading.</li>
<li>On this page you can only remove the global rules that were added while editing <strong><?php echo esc_html($data['post_type']); ?></strong> post types.</li>
</ul>
</div>
</div>
<div class="wpacu_clearfix"></div>
<div style="padding: 0 10px 0 0;">
<p style="margin-bottom: 10px;"><strong><?php _e('Stylesheets (.css) Unloaded', 'wp-asset-clean-up'); ?></strong></p>
<?php
if (! empty($data['values']['styles'])) {
?>
<table class="wp-list-table widefat fixed striped">
<tr>
<td><strong>Handle</strong></td>
<td><strong>Actions</strong></td>
</tr>
<?php
foreach ($data['values']['styles'] as $handle) {
?>
<tr class="wpacu_global_rule_row wpacu_bulk_change_row">
<td><?php wpacuRenderHandleTd($handle, 'styles', $data); ?></td>
<td>
<label><input type="checkbox"
class="wpacu_bulk_rule_checkbox"
name="wpacu_options_post_type_styles[<?php echo esc_attr($handle); ?>]"
value="remove" /> Remove bulk rule</label>
</td>
</tr>
<?php
}
?>
</table>
<?php
} else {
?>
<p>There are no bulk unloaded styles for the <strong><?php echo esc_html($data['post_type']); ?></strong> post type.</p>
<?php
}
?>
<hr style="margin: 15px 0;"/>
<p style="margin-bottom: 10px;"><strong><?php _e('Scripts (.js) Unloaded', 'wp-asset-clean-up'); ?></strong></p>
<?php
if (! empty($data['values']['scripts'])) {
?>
<table class="wp-list-table widefat fixed striped">
<tr>
<td><strong>Handle</strong></td>
<td><strong>Actions</strong></td>
</tr>
<?php
foreach ($data['values']['scripts'] as $handle) {
?>
<tr class="wpacu_global_rule_row wpacu_bulk_change_row">
<td><?php wpacuRenderHandleTd($handle, 'scripts', $data); ?></td>
<td>
<label><input type="checkbox"
class="wpacu_bulk_rule_checkbox"
name="wpacu_options_post_type_scripts[<?php echo esc_attr($handle); ?>]"
value="remove" /> Remove bulk rule</label>
</td>
</tr>
<?php
}
?>
</table>
<?php
} else {
?>
<p>There are no bulk unloaded scripts for the <strong><?php echo esc_html($data['post_type']); ?></strong> post type.</p>
<?php
}
?>
</div>
<?php
}
$noAssetsToRemove = (empty($data['values']['styles']) && empty($data['values']['scripts']));
?>
<?php wp_nonce_field($data['nonce_action'], $data['nonce_name']); ?>
<input type="hidden" name="wpacu_for" value="<?php echo esc_attr($data['for']); ?>" />
<input type="hidden" name="wpacu_update" value="1" />
<?php
if ($data['for'] === 'post_types' && isset($data['post_type'])) {
?>
<input type="hidden" name="wpacu_post_type" value="<?php echo esc_attr($data['post_type']); ?>" />
<?php
}
?>
<div class="wpacu_clearfix"></div>
<div id="wpacu-update-button-area" class="no-left-margin">
<p class="submit">
<?php
wp_nonce_field('wpacu_bulk_unloads_update', 'wpacu_bulk_unloads_update_nonce' );
?>
<input type="submit"
name="submit"
id="submit"
<?php if ($noAssetsToRemove) { ?>
disabled="disabled"
<?php } ?>
class="button button-primary"
value="<?php esc_attr_e('Apply changes', 'wp-asset-clean-up'); ?>" />
<?php
if ($noAssetsToRemove) {
?>
&nbsp;<small><?php _e('Note: As there are no unloaded assets (scripts &amp; styles) to be managed, the button is disabled.', 'wp-asset-clean-up'); ?></small>
<?php
}
?>
</p>
<div id="wpacu-updating-settings" style="margin-left: 150px;">
<img src="<?php echo esc_url(admin_url('images/spinner.gif')); ?>" align="top" width="20" height="20" alt="" />
</div>
</div>
</form>
<!-- Start Site-Wide Modal -->
<div id="wpacu-add-bulk-rules-info" class="wpacu-modal">
<div class="wpacu-modal-content">
<span class="wpacu-close">&times;</span>
<h2><?php _e('Unloading CSS/JS site-wide or for a group of pages', 'wp-asset-clean-up'); ?></h2>
<p>This is an overview of all the assets that have bulk changes applied. Anything you see on this page is filled the moment you go to edit a page via the "CSS/JS Load Manager" (e.g. homepage or a post) and use options such as:</p>
<ul style="list-style: disc; margin-left: 20px;">
<li>Unload site-wide (everywhere)</strong></li>
<li>Unload on All Pages of `product` post type</li>
<li>Unload on All Pages of `product_cat` taxonomy type etc.</li>
</ul>
<p>A bulk change is considered anything that is applied once, and it has effect on multiple pages of the same kind or site-wide.</p>
</div>
</div>
<!-- End Site-Wide Modal -->

View File

@ -0,0 +1,135 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
if (! defined('WPACU_USE_MODAL_BOX')) {
define('WPACU_USE_MODAL_BOX', true);
}
use WpAssetCleanUp\Preloads;
$assetsPreloaded = Preloads::instance()->getPreloads();
$hasCssPreloads = isset($assetsPreloaded['styles']) && ! empty($assetsPreloaded['styles']);
$hasJsPreloads = isset($assetsPreloaded['scripts']) && ! empty($assetsPreloaded['scripts']);
$isUpdateable = $hasCssPreloads || $hasJsPreloads;
do_action('wpacu_admin_notices');
?>
<p>This is the list of all the CSS/JS that were preloaded. &nbsp;&nbsp;<a id="wpacu-preloaded-assets-info-target" href="#wpacu-preloaded-assets-info" style="text-decoration: none;"><span class="dashicons dashicons-info"></span> How the list below gets filled?</a></p>
<form action="" method="post">
<h2>Styles (.css)</h2>
<?php if ($hasCssPreloads) { ?>
<table style="width: 96%;" class="wp-list-table widefat fixed striped">
<tr>
<td style="min-width: 400px;"><strong>Handle</strong></td>
<td><strong>Actions</strong></td>
</tr>
<?php
ksort($assetsPreloaded['styles']);
foreach ($assetsPreloaded['styles'] as $styleHandle => $preloadedStatus) {
?>
<tr class="wpacu_bulk_change_row">
<td>
<?php
$data['assets_info'][ 'styles' ][ $styleHandle ] ['preloaded_status'] = $preloadedStatus;
wpacuRenderHandleTd($styleHandle, 'styles', $data);
?>
</td>
<td>
<label><input type="checkbox"
class="wpacu_remove_preload"
name="wpacu_styles_remove_preloads[<?php echo esc_attr($styleHandle); ?>]"
value="remove" /> Remove preload for this CSS file</label>
</td>
</tr>
<?php
}
?>
</table>
<?php } else { ?>
<p>There are no preloaded stylesheets.</p>
<?php } ?>
<div style="margin: 20px 0; width: 96%;">
<hr/>
</div>
<h2>Scripts (.js)</h2>
<?php if ($hasJsPreloads) { ?>
<table style="width: 96%;" class="wp-list-table widefat fixed striped">
<tr>
<td style="min-width: 400px;"><strong>Handle</strong></td>
<td><strong>Actions</strong></td>
</tr>
<?php
ksort($assetsPreloaded['scripts']);
foreach ($assetsPreloaded['scripts'] as $scriptHandle => $preloadedStatus) {
?>
<tr class="wpacu_bulk_change_row">
<td><?php wpacuRenderHandleTd($scriptHandle, 'scripts', $data); ?></td>
<td>
<label><input type="checkbox"
class="wpacu_remove_preload"
name="wpacu_scripts_remove_preloads[<?php echo esc_attr($scriptHandle); ?>]"
value="remove" /> Remove preload for this JS file</label>
</td>
</tr>
<?php
}
?>
</table>
<?php } else { ?>
<p>There are no preloaded scripts.</p>
<?php } ?>
<?php
if ($isUpdateable) {
wp_nonce_field('wpacu_remove_preloaded_assets', 'wpacu_remove_preloaded_assets_nonce');
}
?>
<div id="wpacu-update-button-area" class="no-left-margin">
<p style="margin: 20px 0 0 0;">
<input type="submit"
name="submit"
<?php if (! $isUpdateable) { ?>disabled="disabled"<?php } ?>
class="wpacu-remove-preloads-btn button button-primary"
value="Remove preload for chosen CSS/JS" />
<?php
if (! $isUpdateable) {
?>
&nbsp;&nbsp; <small>Note: As there are no preloaded CSS/JS, the update button is not enabled.</small>
<?php
}
?>
</p>
<div id="wpacu-updating-settings" style="margin-left: 285px; top: 10px;">
<img src="<?php echo esc_url(admin_url('images/spinner.gif')); ?>" align="top" width="20" height="20" alt="" />
</div>
</div>
</form>
<!-- Start Site-Wide Modal -->
<div id="wpacu-preloaded-assets-info" class="wpacu-modal">
<div class="wpacu-modal-content">
<span class="wpacu-close">&times;</span>
<h2><?php _e('Preloading CSS/JS site-wide', 'wp-asset-clean-up'); ?></h2>
<p>This is an overview of all the assets (Stylesheets &amp; Scripts) that have were selected for preloading. Anything you see on this page is filled the moment you go to edit a page via the "CSS/JS Load Manager" (e.g. homepage or a post) and use the "Preload" option (drop-down) on any of the assets.</p>
<p>The preload for a CSS/JS can also be removed by editing a page that loads that particular file and just select "No (default)" option.</p>
<p>This is considered a bulk change because the preloading for the chosen file is applied site-wide (not just on the page where you activated the preloading).</p>
</div>
</div>
<!-- End Site-Wide Modal -->

View File

@ -0,0 +1,20 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
?>
<div class="wpacu_clearfix"></div>
<div class="alert">
<div style="width: 95%; line-height: 22px; margin: 10px 0 0; background: white; padding: 10px; border: 1px solid #ccc; display: inline-block;">
<h4 style="margin: 0;">How the list below gets filled?</h4>
This list fills once you make an exception for a CSS/JS asset (handle) to load through the option "<em>Load it for URLs with request URI matching this RegEx</em>" <strong>IF</strong> if the targeted CSS/JS file is already bulk unloaded (e.g. site-wide, on all post pages, etc.) by specifying a RegEx. If you wish to add new load exception RegEx rules for other CSS/JS files, access the "<em>CSS &amp; JavaScript Load Manager</em>" for a page that loads the targeted file.
</div>
</div>
<div class="wpacu_clearfix"></div>
<p>This feature is available only in the<img style="opacity: 0.6;" width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" valign="top" alt="" /> <a href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=plugin_bulk_changes&utm_medium=regex_unloads'); ?>"> Pro version</a>.</p>

View File

@ -0,0 +1,21 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
?>
<div class="wpacu_clearfix"></div>
<div class="alert">
<div style="margin: 10px 0 0; background: white; padding: 10px; border: 1px solid #ccc; width: 95%; line-height: 22px; display: inline-block;">
<h4 style="margin: 0;">How the list below gets filled?</h4>
This list fills once you choose an CSS/JS asset (handle) to unload through the option "<em>Unload it for URLs with request URI matching this RegEx</em>".
On this page you can edit/remove the rule that was added. If you wish to add new RegEx rules for other CSS/JS files, access the "<em>CSS &amp; JavaScript Load Manager</em>" for a page that loads the targeted file.
</div>
</div>
<div class="wpacu_clearfix"></div>
<p>This feature is available only in the<img style="opacity: 0.6;" width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" valign="top" alt="" /> <a href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=plugin_bulk_changes&utm_medium=regex_unloads'); ?>"> Pro version</a>.</p>

View File

@ -0,0 +1,9 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
?>
<p>This is the list of all the JavaScript files (<code>&lt;script&gt;</code> tags) that have "async" and "defer" attributes applied site-wide (everywhere). This feature is available only in the<img style="opacity: 0.6;" width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" valign="top" alt="" /> <a href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=plugin_bulk_changes&utm_medium=script_attrs'); ?>"> Pro version</a>.</p>

View File

@ -0,0 +1,92 @@
<?php
/*
* No direct access to this file
*/
use WpAssetCleanUp\Misc;
use WpAssetCleanUp\OptimiseAssets\OptimizeCommon;
if (! isset($data, $selectedTabArea)) {
exit;
}
global $wp_version;
$tabIdArea = 'wpacu-setting-cdn-rewrite-urls';
$styleTabContent = ($selectedTabArea === $tabIdArea) ? 'style="display: table-cell;"' : '';
$wpacuCloudFlareIconUrl = WPACU_PLUGIN_URL . '/assets/icons/icon-cloudflare.svg';
?>
<div id="<?php echo esc_attr($tabIdArea); ?>" class="wpacu-settings-tab-content" <?php echo wp_kses($styleTabContent, array('style' => array())); ?>>
<h2 class="wpacu-settings-area-title"><?php _e('Rewrite cached static assets URLs with the CDN ones if necessary', 'wp-asset-clean-up'); ?></h2>
<div class="wpacu-warning" style="margin: 0 0 20px;">
<p style="margin: 0;"><strong>Note:</strong> This option is only needed if you <strong>already use a CDN</strong> (apart from Cloudflare) and the URL to any cached CSS/JS from Asset CleanUp Pro is the local one and not the one from CDN. <span style="white-space: nowrap;"><a style="display: inline; text-decoration: none; color: #0073aa;" target="_blank" href="https://assetcleanup.com/docs/?p=957"><span style="font-size: 25px; margin-top: -2px;" class="dashicons dashicons-editor-help"></span</a> <a style="display: inline; margin-left: 6px;" target="_blank" href="https://assetcleanup.com/docs/?p=957">Read more about it</a></span></p>
<p id="wpacu-site-uses-cloudflare" style="display: none; margin: 10px 0 0 0;"><img alt="" style="margin-left: 4px; vertical-align: middle; width: 22px; height: 22px;" src="<?php echo esc_url($wpacuCloudFlareIconUrl); ?>" /> Cloudflare CDN/Proxy is used for your website, meaning that a CDN is already active. Unless the assets are already set to load from a different CDN for any reason, then you <strong>do not need</strong> to enable this feature.</p>
</div>
<table class="wpacu-form-table">
<tr valign="top">
<th scope="row" class="setting_title">
<label for="wpacu_cdn_rewrite_enable"><?php esc_html_e('Enable CDN URL rewrite?', 'wp-asset-clean-up'); ?></label>
<p class="wpacu_subtitle"><small><em><?php echo sprintf(esc_html__('This applies ONLY to files saved in %s', 'wp-asset-clean-up'), '<code style="font-size: inherit;">'.str_replace(Misc::getWpRootDirPath(), '', '/' . WP_CONTENT_DIR . OptimizeCommon::getRelPathPluginCacheDir().'</code>')); ?></em></small></p>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_cdn_rewrite_enable"
data-target-opacity="wpacu_cdn_rewrite_enable_area"
type="checkbox"
<?php
echo (($data['cdn_rewrite_enable'] == 1) ? 'checked="checked"' : '');
?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[cdn_rewrite_enable]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;If you're using a CDN enabled through your hosting company or by another party plugin, the external URL is not always recognisable by <?php echo WPACU_PLUGIN_TITLE; ?> and it's considered an external URL unconnected to your website's CSS/JS files. To fix, this, please put the CDN's CNAME/URL in the inputs below to make sure the files are detected as local files and optimized accordingly.
<?php
$cdnRewriteAreaStyle = ($data['cdn_rewrite_enable'] == 1) ? 'opacity: 1;' : 'opacity: 0.4;';
?>
<div id="wpacu_cdn_rewrite_enable_area" style="<?php echo esc_attr($cdnRewriteAreaStyle); ?>">
<div style="margin-top: 20px; margin-bottom: 0;"></div>
<table>
<tr>
<td style="vertical-align: top;" valign="top">For Stylesheet (.css) Files:&nbsp;&nbsp;</td>
<td style="padding-bottom: 10px;">
<label for="wpacu_cdn_rewrite_url_css"><input id="wpacu_cdn_rewrite_url_css"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[cdn_rewrite_url_css]"
value="<?php echo esc_attr($data['cdn_rewrite_url_css']); ?>"
style="width: 300px;" /><br />
</label>
<ul style="font-style: italic; line-height: 13px; font-size: 12px; margin-top: 5px; margin-bottom: 0;">
<li>e.g. //css-zone-name.kxcdn.com</li>
<li>zone-name.kxcdn.com etc.</li>
</ul>
</td>
</tr>
<tr>
<td style="vertical-align: top;" valign="top">For JavaScript (.js) Files:&nbsp;&nbsp;</td>
<td style="padding-bottom: 3px;"><label for="wpacu_cdn_rewrite_url_js">
<input id="wpacu_cdn_rewrite_url_js"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[cdn_rewrite_url_js]"
value="<?php echo esc_attr($data['cdn_rewrite_url_js']); ?>"
style="width: 300px;" /><br />
</label>
<ul style="font-style: italic; line-height: 13px; font-size: 12px; margin-top: 5px;">
<li>e.g. //js-zone-name.kxcdn.com</li>
<li>zone-name.kxcdn.com etc.</li>
</ul>
</td>
</tr>
</table>
<hr />
<p style="margin-top: 10px;"><strong>Note:</strong> Most of the time the CNAME / CDN URL is the same for both CSS &amp; JS files. You can use the same value in both fields.</p>
<p class="wpacu-warning" style="font-size: inherit;">
<span class="dashicons dashicons-warning"></span> If you're unsure if the <strong>C</strong>ontent <strong>D</strong>elivery <strong>N</strong>etwork's CNAME/URL is the right one, please enable "Test Mode" to test it out, thus making sure the layout won't be broken for your website visitors.
</p>
</div>
</td>
</tr>
</table>
</div>

View File

@ -0,0 +1,148 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data, $selectedTabArea)) {
exit;
}
$tabIdArea = 'wpacu-setting-common-files-unload';
$styleTabContent = ($selectedTabArea === $tabIdArea) ? 'style="display: table-cell;"' : '';
?>
<div id="<?php echo esc_attr($tabIdArea); ?>" class="wpacu-settings-tab-content" <?php echo wp_kses($styleTabContent, array('style' => array())); ?>>
<h2 class="wpacu-settings-area-title"><?php _e('Site-Wide Unload For Common CSS &amp; JS Files', 'wp-asset-clean-up'); ?></h2>
<p><?php _e('This area allows you to quickly add the rule "Unload Site-wide" for the scripts below, which are often used in WordPress environments.', 'wp-asset-clean-up'); ?></p>
<table class="wpacu-form-table">
<tr valign="top">
<th scope="row" class="setting_title">
<label for="wpacu_disable_emojis"><?php echo sprintf(esc_html__('Disable %s Site-Wide', 'wp-asset-clean-up'), 'Emojis'); ?></label>
<p class="wpacu_subtitle"><small><em><?php echo sprintf(esc_html__('It will fallback to the default browser\'s Emojis and not fetch the ones from %s', 'wp-asset-clean-up'), 'https://s.w.org/'); ?></em></small></p>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_disable_emojis"
type="checkbox"
<?php echo (($data['disable_emojis'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[disable_emojis]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;
<?php echo sprintf(esc_html__('This will unload %s', 'wp-asset-clean-up'), 'WordPress\' Emojis'); ?> (the smiley icons)
<p style="margin-top: 10px;">
<?php _e('As of WordPress 4.2, a new feature was introduced that allows you to use the new Emojis.', 'wp-asset-clean-up'); ?>
<?php echo esc_html__('While on some WordPress setups is useful, in many situations (especially when you are not using WordPress as a blog), you just dont need them.', 'wp-asset-clean-up'); ?>
<?php echo sprintf(__('The file <em>%s</em> (12 KB) is loaded (along with extra inline JavaScript code) which adds up to the number of loaded HTTP requests.', 'wp-asset-clean-up'), '/wp-includes/js/wp-emoji-release.min.js'); ?>
</p>
</td>
</tr>
<tr valign="top">
<th scope="row" class="setting_title">
<label for="wpacu_disable_wp_embed"><?php echo sprintf(esc_html__('Disable %s Site-Wide', 'wp-asset-clean-up'), 'oEmbed (Embeds)'); ?></label>
<p style="margin-top: 2px;" class="wpacu_subtitle"><small><a target="_blank" href="https://wordpress.org/support/article/embeds/">Read more about Embeds</a></small></p>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_disable_wp_embed"
type="checkbox"
<?php echo (($data['disable_oembed'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[disable_oembed]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;
<?php echo sprintf(esc_html__('This will remove %s', 'wp-asset-clean-up'), 'oEmbed feature'); ?>
<div style="margin-top: 10px;">
<?php _e('As of WordPress 4.4, a new oEmbed feature was introduced allowing you to embed videos (e.g. from YouTube), Tweets and and other similar things on your website by pasting a URL, which WordPress converts, providing a live preview of the embedded element in the visual editor.', 'wp-asset-clean-up'); ?>
<?php _e('You can disable this feature if you do not need it.', 'wp-asset-clean-up'); ?>
<p><?php _e('The situations where you might want to keep it enabled include:', 'wp-asset-clean-up'); ?>
<ul>
<li>- You want other users to embed your WordPress blog articles on their site.</li>
<li>- You would like to embed other websites' articles, YouTube videos, Tweets etc. on you WordPress blog articles.</li>
</ul>
<?php echo sprintf(__('If this option is kept enabled, the file <em>%s</em> is also loaded which adds up to the number of loaded HTTP requests.', 'wp-asset-clean-up'), '/wp-includes/js/wp-embed.min.js'); ?>
</div>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="wpacu_disable_dashicons_for_guests"><?php echo sprintf(__('Disable %s if Toolbar is hidden (Site-Wide)', 'wp-asset-clean-up'), 'Dashicons'); ?></label>
<p style="margin-top: 2px;" class="wpacu_subtitle"><small>The top admin bar (toolbar) requires Dashicons to function properly.<br /><a target="_blank" href="https://developer.wordpress.org/resource/dashicons/">Read about Dashicons</a> | <a target="_blank" href="https://wordpress.org/support/article/toolbar/">Read about Toolbar</a></small></p>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_disable_dashicons_for_guests" type="checkbox"
<?php echo (($data['disable_dashicons_for_guests'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_global_unloads'; ?>[disable_dashicons_for_guests]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;
<?php echo sprintf(__('This will unload %s if the toolbar (top admin bar) is not showing up. This is be because the toolbar requires Dashicons to load properly, otherwise its layout will be broken.', 'wp-asset-clean-up'), 'Dashicons'); ?> -&gt; <em>/wp-includes/css/dashicons.min.css</em> (46 KB + the size of the actual font file loaded based on the browser)
<p style="margin-top: 10px;"><?php _e('This is a CSS file that loads the official icon font of the WordPress admin as of 3.8. While needed for showing up the icons loaded within the top admin bar and in the styling of other plugins such as Query Monitor, it is sometimes loaded site-wide for guests (non logged-in users) when it is not needed.', 'wp-asset-clean-up'); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="wpacu_disable_wp_block_library"><?php echo sprintf(__('Disable %s Site-Wide', 'wp-asset-clean-up'), 'Gutenberg CSS Block Library'); ?> <span style="color: #cc0000;" class="dashicons dashicons-wordpress-alt wordpress-core-file"><span class="wpacu-tooltip">WordPress Core File<br />Not sure if needed or not? In this case, it's better to leave it loaded to avoid breaking the website.</span></span></label>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_disable_wp_block_library" type="checkbox"
<?php echo (($data['disable_wp_block_library'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_global_unloads'; ?>[disable_wp_block_library]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;
<?php echo sprintf(__('This will unload %s', 'wp-asset-clean-up'), 'Gutenberg Blocks CSS file'); ?> -&gt; (<em>/wp-includes/css/dist/block-library/style.min.css</em>) (52 KB) - <span style="color: #0073aa; vertical-align: middle;" class="dashicons dashicons-info"></span> <a href="https://assetcleanup.com/docs/?p=713" target="_blank">Not sure if you need it or not? Use Coverage from Chrome DevTools!</a>
<p style="margin-top: 10px;"><?php _e('If you\'re not using Gutenberg blocks in your posts/page (e.g. you prefer the Classic Editor), then you can unload this file site-wide to avoid an extra render-blocking external CSS file load.', 'wp-asset-clean-up'); ?></p>
<?php
if ($extraTip = \WpAssetCleanUp\Tips::ceGutenbergCssLibraryBlockTip()) {
echo '<p class="wpacu-warning" style="font-size: 100%;"><strong>Extra Tip:</strong> '.$extraTip.'</p>';
}
?>
</td>
</tr>
<?php
global $wp_version;
$isjQueryMigrateUnloaded = $wp_version >= 5.5;
$jqueryMigrateUnloadOpacity = $isjQueryMigrateUnloaded ? 0.65 : 1;
?>
<tr valign="top">
<th scope="row" style="opacity: <?php echo esc_attr($jqueryMigrateUnloadOpacity); ?>;">
<label for="wpacu_disable_jquery_migrate"><?php echo sprintf(__('Disable %s Site-Wide', 'wp-asset-clean-up'), 'jQuery Migrate'); ?> <span style="color: #cc0000;" class="dashicons dashicons-wordpress-alt wordpress-core-file"><span class="wpacu-tooltip">WordPress Core File<br />Not sure if needed or not? In this case, it's better to leave it loaded to avoid breaking the website.</span></span></label>
</th>
<td>
<?php if ($isjQueryMigrateUnloaded) { ?>
<div style="margin-bottom: 10px;" class="wpacu-warning">
<p style="margin-top: 0;"><span style="color: darkorange;" class="dashicons dashicons-warning"></span> Starting from WordPress 5.5, jQuery Migrate is no longer loaded, thus this option is no longer relevant for your website (which uses WordPress <?php echo esc_html($wp_version); ?>) as it acts as being always enabled. If you need to have jQuery Migrate loaded as it was before, please check the <strong><a rel="noopener noreferrer" target="_blank" href="https://wordpress.org/plugins/enable-jquery-migrate-helper/">Enable jQuery Migrate Helper</a></strong> plugin</p>
</div>
<?php } ?>
<label class="wpacu_switch" style="opacity: <?php echo esc_attr($jqueryMigrateUnloadOpacity); ?>;">
<input id="wpacu_disable_jquery_migrate" type="checkbox"
<?php echo (($data['disable_jquery_migrate'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_global_unloads'; ?>[disable_jquery_migrate]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;
<span style="opacity: <?php echo esc_attr($jqueryMigrateUnloadOpacity); ?>;"><?php echo sprintf(__('This will unload %s', 'wp-asset-clean-up'), 'jQuery Migrate'); ?> (<em>jquery-migrate(.min).js</em>)</span>
<p style="margin-top: 10px; opacity: <?php echo esc_attr($jqueryMigrateUnloadOpacity); ?>;"><?php _e('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.', 'wp-asset-clean-up'); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="wpacu_disable_comment_reply"><?php echo sprintf(__('Disable %s Site-Wide', 'wp-asset-clean-up'), 'Comment Reply'); ?> <span style="color: #cc0000;" class="dashicons dashicons-wordpress-alt wordpress-core-file"><span class="wpacu-tooltip">WordPress Core File<br /><?php _e('Not sure if needed or not? In this case, it\'s better to leave it loaded to avoid breaking the website.', 'wp-asset-clean-up'); ?></span></span></label>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_disable_comment_reply" type="checkbox"
<?php echo (($data['disable_comment_reply'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_global_unloads'; ?>[disable_comment_reply]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;
<?php echo sprintf(__('This will unload %s', 'wp-asset-clean-up'), 'Comment Reply'); ?> (<em>/wp-includes/js/comment-reply(.min).js</em>)
<p style="margin-top: 10px;"><?php _e('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.', 'wp-asset-clean-up'); ?></p>
</td>
</tr>
</table>
</div>

View File

@ -0,0 +1,75 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data, $selectedTabArea)) {
exit;
}
$tabIdArea = 'wpacu-setting-disable-rss-feed';
$styleTabContent = ($selectedTabArea === $tabIdArea) ? 'style="display: table-cell;"' : '';
$disableRssFeedAreaStyle = ($data['disable_rss_feed'] == 1) ? 'opacity: 1;' : 'opacity: 0.4;';
?>
<div id="<?php echo esc_attr($tabIdArea); ?>" class="wpacu-settings-tab-content" <?php echo wp_kses($styleTabContent, array('style' => array())); ?>>
<h2 class="wpacu-settings-area-title"><?php _e('Disable RSS Feed &amp; its references from &lt;HEAD&gt;', 'wp-asset-clean-up'); ?></h2>
<p style="margin-top: 10px;">If you do not use WordPress for blogging purposes at all, and it doesn't have any blog posts (apart from the main pages that you added), then you can disable the RSS feeds, remove the main feed &amp; comments link frm the <code>&lt;HEAD&gt;</code> section of the HTML source code.</p>
<table class="wpacu-form-table">
<!-- Disable RSS Feed -->
<tr valign="top">
<th scope="row">
<label for="wpacu_disable_rss_feed">Disable RSS Feed?</label>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_disable_rss_feed"
data-target-opacity="wpacu_disable_rss_feed_message_area"
type="checkbox"
<?php echo (($data['disable_rss_feed'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[disable_rss_feed]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>&nbsp;
This will show an error message that you can customize below whenever someone is accessing the website's RSS links (e.g. <code><?php echo get_feed_link(); ?></code>). If this option is turned ON (disabling any RSS feed), the extra options below will also be turned ON as RSS links will not be relevant anymore.
<div style="margin: 6px 0 0; <?php echo $disableRssFeedAreaStyle; ?>"
id="wpacu_disable_rss_feed_message_area">
<textarea id="wpacu_disable_rss_feed_message"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[disable_rss_feed_message]"
rows="5"
style="width: 100%;"><?php echo esc_textarea($data['disable_rss_feed_message']); ?></textarea></div>
</td>
</tr>
<!-- Remove Main RSS Feed Link -->
<tr valign="top">
<th scope="row">
<label for="wpacu_remove_main_feed_link">Remove Main RSS Feed Link?</label>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_remove_main_feed_link"
type="checkbox"
<?php echo (($data['remove_main_feed_link'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[remove_main_feed_link]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;
<code>e.g. &lt;link rel=&quot;alternate&quot; type=&quot;application/rss xml&quot; title=&quot;Your Site Title &amp;raquo; Feed&quot; href=&quot;https://www.yourwebsite.com/feed/&quot; /&gt;</code>
</td>
</tr>
<!-- Remove Comment Feeds Link -->
<tr valign="top">
<th scope="row">
<label for="wpacu_remove_comment_feed_link">Remove Comment RSS Feed Link?</label>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_remove_comment_feed_link"
type="checkbox"
<?php echo (($data['remove_comment_feed_link'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[remove_comment_feed_link]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;
<code>e.g. &lt;link rel=&quot;alternate&quot; type=&quot;application/rss xml&quot; title=&quot;Your Website Title &amp;raquo; Comments Feed&quot; href=&quot;https://www.yourdomain.com/comments/feed/&quot; /&gt;</code>
</td>
</tr>
</table>
</div>

View File

@ -0,0 +1,39 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data, $selectedTabArea)) {
exit;
}
$tabIdArea = 'wpacu-setting-disable-xml-rpc';
$styleTabContent = ($selectedTabArea === $tabIdArea) ? 'style="display: table-cell;"' : '';
?>
<div id="<?php echo esc_attr($tabIdArea); ?>" class="wpacu-settings-tab-content" <?php echo wp_kses($styleTabContent, array('style' => array())); ?>>
<h2 class="wpacu-settings-area-title"><?php _e('Disable XML-RPC Protocol Support partially or completely', 'wp-asset-clean-up'); ?></h2>
<table class="wpacu-form-table">
<!-- Disable "XML-RPC" protocol support? -->
<tr valign="top">
<td>
<select id="wpacu_disable_xmlrpc"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[disable_xmlrpc]">
<option <?php if (! in_array($data['disable_xmlrpc'], array('disable_pingback', 'disable_all'))) { echo 'selected="selected"'; } ?>
value="keep_it_on">Keep it enabled (default)</option>
<option <?php if ($data['disable_xmlrpc'] === 'disable_pingback') { echo 'selected="selected"'; } ?>
value="disable_pingback">Disable XML-RPC Pingback Only
<option <?php if ($data['disable_xmlrpc'] === 'disable_all') { echo 'selected="selected"'; } ?>
value="disable_all">Disable XML-RPC Completely</option>
</select>
<code>&lt;link rel=&quot;pingback&quot; href=&quot;https://www.yourwebsite.com/xmlrpc.php&quot; /&gt;</code>
<p style="margin-bottom: 10px;">This will disable XML-RPC protocol support and cleans up the "pingback" tag from the HEAD section of your website.</p>
<p style="margin-bottom: 10px;">This is an API service used by WordPress for 3rd party applications, such as mobile apps, communication between blogs, plugins such as Jetpack. If you use, or are planning to use a remote system to post content to your website, you can keep this feature enabled (which it is by default). Many users do not use this function at all and if you're one of them, you can disable it.</p>
<p style="margin-bottom: 10px;"><strong>Disable XML-RPC Pingback Only</strong>: If you need the XML-RPC protocol support, but you do not use the pingbacks which are used by your website to notify another website that you have linked to it from your page(s), you can just disable the pinbacks and keep the other XML-RPC functionality. This is also a security measure to prevent DDoS attacks.</p>
<p style="margin-bottom: 0;"><strong>Disable XML-RPC Completely</strong>: If you do not use Jetpack plugin for off-site server communication or you only use the Dashboard to post content (without any remote software connection to the WordPress website such as Windows Live Writer or mobile apps), then you can disable the XML-RPC functionality. You can always re-enable it whenever you believe you'll need it.</p>
</td>
</tr>
</table>
</div>

View File

@ -0,0 +1,71 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data, $selectedTabArea, $selectedSubTabArea)) {
exit;
}
$tabIdArea = 'wpacu-setting-google-fonts';
$styleTabContent = ($selectedTabArea === $tabIdArea) ? 'style="display: table-cell;"' : '';
$ddOptions = array(
'swap' => 'swap (most used)',
'auto' => 'auto',
'block' => 'block',
'fallback' => 'fallback',
'optional' => 'optional'
);
?>
<div id="<?php echo esc_attr($tabIdArea); ?>" class="wpacu-settings-tab-content" <?php echo wp_kses($styleTabContent, array('style' => array())); ?>>
<h2 class="wpacu-settings-area-title"><?php _e('Google Fonts: Load Optimizer', 'wp-asset-clean-up'); ?></h2>
<div class="wpacu-sub-tabs-wrap"> <!-- Sub-tabs wrap -->
<!-- Sub-nav menu -->
<input class="wpacu-nav-input"
id="wpacu-google-fonts-optimize-tab-item"
type="radio"
name="wpacu_sub_tab_area"
value="wpacu-google-fonts-optimize"
<?php if (in_array($selectedSubTabArea, array('wpacu-google-fonts-optimize', ''))) { ?>checked="checked"<?php } ?> />
<label class="wpacu-nav-label"
for="wpacu-google-fonts-optimize-tab-item">Optimize Font Delivery</label>
<input class="wpacu-nav-input"
id="wpacu-google-fonts-remove-tab-item"
type="radio"
name="wpacu_sub_tab_area"
value="wpacu-google-fonts-remove"
<?php if ($selectedSubTabArea === 'wpacu-google-fonts-remove') { ?>checked="checked"<?php } ?> />
<label class="wpacu-nav-label"
for="wpacu-google-fonts-remove-tab-item">Remove All</label>
<!-- /Sub-nav menu -->
<section class="wpacu-sub-tabs-item" id="wpacu-google-fonts-optimize-tab-item-area">
<?php include_once __DIR__.'/_fonts-google/_optimize-area.php'; ?>
</section>
<section class="wpacu-sub-tabs-item" id="wpacu-google-fonts-remove-tab-item-area">
<?php include_once __DIR__.'/_fonts-google/_remove-area.php'; ?>
</section>
</div> <!-- /Sub-tabs wrap -->
</div>
<div id="wpacu-google-fonts-display-info" class="wpacu-modal" style="padding-top: 70px;">
<div class="wpacu-modal-content" style="max-width: 800px;">
<span class="wpacu-close">&times;</span>
<h3 style="margin-top: 2px; margin-bottom: 5px;">font-display: <span style="background: #f2faf2;">swap</span></h3>
<p style="margin-top: 0; margin-bottom: 24px;">The text is shown immediately (without any block period, no invisible text) in the fallback font until the custom font loads, then it's swapped with the custom font. You get a <strong>FOUT</strong> (<em>flash of unstyled text</em>).</p>
<h3 style="margin-bottom: 5px;">font-display: <span style="background: #f2faf2;">block</span></h3>
<p style="margin-top: 0; margin-bottom: 24px;">The text blocks (is invisible) for a short period. Then, if the custom font hasn't been downloaded yet, the browser swaps (renders the text in the fallback font), for however long it takes the custom font to be downloaded, and then re-renders the text in the custom font. You get a <strong>FOIT</strong> (<em>flash of invisible text</em>).</p>
<h3 style="margin-bottom: 5px;">font-display: <span style="background: #f2faf2;">fallback</span></h3>
<p style="margin-top: 0; margin-bottom: 24px;">This is somewhere in between block and swap. The text is invisible for a short period of time (100ms). Then if the custom font hasn't downloaded, the text is shown in a fallback font (for about 3s), then swapped after the custom font loads.</p>
<h3 style="margin-bottom: 5px;">font-display: <span style="background: #f2faf2;">optional</span></h3>
<p style="margin-top: 0; margin-bottom: 24px;">This behaves just like fallback, only the browser can decide to not use the custom font at all, based on the user's connection speed (if you're on a slow 3G or less, it will take forever to download the custom font and then swapping to it will be too late and extremely annoying)</p>
<h3 style="margin-bottom: 5px;">font-display: <span style="background: #f2faf2;">auto</span></h3>
<p style="margin-top: 0; margin-bottom: 0;">The default. Typical browser font loading behavior will take place. This behavior may be FOIT, or FOIT with a relatively long invisibility period. This may change as browser vendors decide on better default behaviors.</p>
</div>
</div>

View File

@ -0,0 +1,204 @@
<?php
if (! isset($data, $ddOptions)) {
exit;
}
?>
<?php
if ($data['google_fonts_remove']) {
?>
<div class="wpacu-warning" style="font-size: inherit;"><span class="dashicons dashicons-warning"></span> As the option to remove Google Fonts is turned <strong>on</strong>, the options below are irrelevant. If you turn <strong>off</strong> "Remove Google Fonts" and save settings, this notice will disappear and the options below will take effect as the fonts will be loading.</div>
<?php
}
?>
<table class="wpacu-form-table">
<tr valign="top">
<th scope="row" class="setting_title">
<label for="wpacu_google_fonts_combine"><?php _e('Combine Multiple Requests Into Fewer Ones', 'wp-asset-clean-up'); ?></label>
<p class="wpacu_subtitle"><small><em>And choose the loading option</em></small></p>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_google_fonts_combine"
type="checkbox"
data-target-opacity="google_fonts_combine_wrap"
<?php echo (($data['google_fonts_combine'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[google_fonts_combine]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;<?php _e('This option combines multiple font requests into fewer requests', 'wp-asset-clean-up'); ?>. Once it's active, you can choose how the load takes place, depending on your website, by choosing one of the radio options below. <strong>You can enable this option even if you know you have one LINK request. If no combination will take place, the loading type below will be applied.</strong> Note that the asynchronous loading could cause a <strong>FOUT</strong> (flash of unstyled text) until the Google fonts get loaded, so it's recommended to test it out after the change.
<div id="google_fonts_combine_wrap" <?php if (! $data['google_fonts_combine']) { ?>style="opacity: 0.4;"<?php } ?>>
<div class="google_fonts_load_types">
<div style="flex-basis: 70%; padding-right: 20px;" class="wpacu-fancy-radio"><label for="google_fonts_combine_type_rb"><input id="google_fonts_combine_type_rb" class="google_fonts_combine_type" type="radio" name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[google_fonts_combine_type]" <?php if (! $data['google_fonts_combine_type']) { ?>checked="checked"<?php } ?> value="" />Render-blocking (default)</label></div>
<div style="flex-basis: 90%; padding-right: 20px;" class="wpacu-fancy-radio"><label for="google_fonts_combine_type_async"><input id="google_fonts_combine_type_async" class="google_fonts_combine_type" type="radio" name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[google_fonts_combine_type]" <?php if ($data['google_fonts_combine_type'] === 'async') { ?>checked="checked"<?php } ?> value="async" />Asynchronous via Web Font Loader (webfont.js)</label></div>
<div style="flex-basis: 90%;" class="wpacu-fancy-radio"><label for="google_fonts_combine_type_async_preload"><input id="google_fonts_combine_type_async_preload" class="google_fonts_combine_type" type="radio" name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[google_fonts_combine_type]" <?php if ($data['google_fonts_combine_type'] === 'async_preload') { ?>checked="checked"<?php } ?> value="async_preload" />Asynchronous by preloading the CSS stylesheet</label></div>
</div>
<!-- Render-blocking (default) info -->
<div id="wpacu_google_fonts_combine_type_rb_info_area" class="wpacu_google_fonts_combine_type_area" <?php if ($data['google_fonts_combine_type']) { echo 'style="display: none;"'; } ?>>
<p><strong>Example</strong> The following LINK tags will be merged into one tag:</p>
<ul>
<li><code>&lt;link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Droid+Sans"&gt;</code></li>
<li><code>&lt;link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inconsolata:bold"&gt;</code></li>
</ul>
<hr />
<ul>
<li><code>&lt;link rel="stylesheet" id="wpacu-combined-google-fonts-css" href="https://fonts.googleapis.com/css?family=Droid+Sans|Inconsolata:bold"&gt;</code></li>
</ul>
<p><strong>Result:</strong> This simple feature saves one round trip to the server for each additional font requested (reducing the number of HTTP requests), and also protects against blocking on older browsers which only have 2 connections open per domain at a time.</p>
</div>
<!-- /Render-blocking (default) info -->
<!-- Async info -->
<div id="wpacu_google_fonts_combine_type_async_info_area" class="wpacu_google_fonts_combine_type_area" <?php if ($data['google_fonts_combine_type'] !== 'async') { echo 'style="display: none;"'; } ?>>
<p><strong>Example</strong> The following LINK tags will be converted into an inline JavaScript tag place:</p>
<ul>
<li><code>&lt;link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Droid+Sans"&gt;</code></li>
<li><code>&lt;link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inconsolata:bold"&gt;</code></li>
</ul>
<hr />
<ul>
<li>
<code>
<?php
$typeAttr = \WpAssetCleanUp\Misc::getScriptTypeAttribute();
$asyncWebFontLoaderSnippet = <<<HTML
&lt;script id='wpacu-google-fonts-async-load' {$typeAttr}&gt;
WebFontConfig = { google: { families: ['Droid+Sans', 'Inconsolata:bold'] } };
(function(wpacuD) {
&nbsp;&nbsp;var wpacuWf = wpacuD.createElement('script'), wpacuS = wpacuD.scripts[0];
&nbsp;&nbsp;wpacuWf.src = ('https:' === document.location.protocol ? 'https' : 'http')
&nbsp;&nbsp;&nbsp;&nbsp;+ '://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js';
&nbsp;&nbsp;wpacuWf.async = true;
&nbsp;&nbsp;wpacuS.parentNode.insertBefore(wpacuWf, wpacuS);
})(document);
&lt;/script&gt;&lt;noscript&gt;&lt;link rel="stylesheet" id="wpacu-combined-google-fonts-css" href="https://fonts.googleapis.com/css?family=Droid+Sans|Inconsolata:bold"&gt;&lt;/noscript&gt;
HTML;
echo nl2br($asyncWebFontLoaderSnippet);
?>
</code>
<p style="margin-top: 5px;"><small><strong>Note:</strong> The inline tag's contents will be minified in the resulting HTML code. A NOSCRIPT tag is appended to the SCRIPT tag as a fallback in case JavaScript is disabled for any reason.</small></p>
</li>
</ul>
<p>Using the Web Font Loader asynchronously avoids blocking your page while loading the JavaScript. A <strong>disadvantage</strong> is that the rest of the page might render before the Web Font Loader is loaded and executed, which can cause a <strong>Flash of Unstyled Text (FOUT)</strong>.</p>
</div>
<!-- /Async info -->
<!-- Async preload info -->
<div id="wpacu_google_fonts_combine_type_async_preload_info_area" class="wpacu_google_fonts_combine_type_area" <?php if ($data['google_fonts_combine_type'] !== 'async_preload') { echo 'style="display: none;"'; } ?>>
<p><strong>Example</strong> The following LINK tags will be converted into a non-render blocking LINK "preload" tag:</p>
<ul>
<li><code>&lt;link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Droid+Sans"&gt;</code></li>
<li><code>&lt;link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inconsolata:bold"&gt;</code></li>
</ul>
<hr />
<ul>
<li>
<code>
<?php
$asyncPreloadSnippet = <<<HTML
&lt;link rel="preload" as="style" onload="this.onload=null;this.rel='stylesheet'" id="wpacu-combined-google-fonts-css-preload" href="https://fonts.googleapis.com/css?family=Droid+Sans|Inconsolata:bold"&gt;
&lt;noscript&gt;&lt;link rel="stylesheet" id="wpacu-combined-google-fonts-css" href="https://fonts.googleapis.com/css?family=Droid+Sans|Inconsolata:bold"&gt;&lt;/noscript&gt;
HTML;
echo nl2br($asyncPreloadSnippet);
?>
</code>
<p style="margin-top: 5px;"><small><strong>Note:</strong> A NOSCRIPT tag is appended to the LINK "preload" tag as a fallback in case JavaScript is disabled for any reason. For some browsers like Mozilla Firefox that don't support preloading as well as Google Chrome, an extra fallback script is loaded in the HEAD section of the website. <a target="_blank" href="https://github.com/filamentgroup/loadCSS">Read more about loadCSS</a></small></p>
</li>
</ul>
</div>
<!-- /Async preload info -->
</div>
</td>
</tr>
<tr valign="top">
<th scope="row" class="setting_title">
<?php echo sprintf(__('Apply %s CSS property value', 'wp-asset-clean-up'), '<span style="background: #f5f5f5; padding: 4px;">font-display:</span>'); ?>
</th>
<td>
<select name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[google_fonts_display]">
<option value="">Do not apply (default)</option>
<?php
foreach ($ddOptions as $ddOptionValue => $ddOptionText) {
$selectedOption = ($data['google_fonts_display'] === $ddOptionValue) ? 'selected="selected"' : '';
echo '<option '.$selectedOption.' value="'.$ddOptionValue.'">'.$ddOptionText.'</option>'."\n";
}
?>
</select>
&nbsp;
<?php _e('This feature applies site-wide "&display=" with the chosen value to all the Google Font URL requests (if the parameter is not already set in the URL).', 'wp-asset-clean-up'); ?>
<?php _e('This will result in printing of "font-display" CSS property within @font-face.', 'wp-asset-clean-up'); ?>
<span style="color: #0073aa;" class="dashicons dashicons-info"></span> <a id="wpacu-google-fonts-display-info-target" href="#wpacu-google-fonts-display-info"><?php _e('Read more', 'wp-asset-clean-up'); ?></a>
<hr />
<ul>
<li><code>&lt;link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Mono<strong>&amp;display=swap</strong>"&gt;</code></li>
<li><code>&lt;link rel="stylesheet" id="wpacu-combined-google-fonts-css" href="https://fonts.googleapis.com/css?family=Droid+Sans|Inconsolata:bold<strong>&amp;display=swap</strong>"&gt;</code></li>
</ul>
<hr />
<p><?php _e('Deciding the behavior for a web font as it is loading can be an important performance tuning technique. If applied, this option ensures text remains visible during webfont load.', 'wp-asset-clean-up'); ?> <?php _e('The <code>font-display</code> CSS property defines how font files are loaded and display by the browser.', 'wp-asset-clean-up'); ?></p>
<strong>Read more about this:</strong>
<a target="_blank" href="https://css-tricks.com/hey-hey-font-display/">Hey hey `font-display`</a> &nbsp;|&nbsp;
<a target="_blank" href="https://css-tricks.com/font-display-masses/">`font-display` for the Masses</a> &nbsp;|&nbsp;
<a target="_blank" href="https://developers.google.com/web/updates/2016/02/font-display">Controlling Font Performance with font-display</a> &nbsp;|&nbsp;
<a target="_blank" href="https://font-display.glitch.me/">https://font-display.glitch.me/</a> &nbsp;|&nbsp;
<a target="_blank" href="https://vimeo.com/241111413">Video: Fontastic Web Performance</a>
</td>
</tr>
<tr valign="top">
<th scope="row" class="setting_title">
<?php _e('Preconnect?', 'wp-asset-clean-up'); ?>
<p class="wpacu_subtitle"><small><em><?php _e('Don\'t let the browser wait until it sees the CSS call font files before it begins DNS/TCP/TLS', 'wp-asset-clean-up'); ?></em></small></p>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_google_fonts_preconnect"
type="checkbox"
data-target-opacity="google_fonts_preconnect_wrap"
<?php echo (($data['google_fonts_preconnect'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[google_fonts_preconnect]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;If you know your website requests resources from Google Fonts (fonts.gstatic.com), then adding the preconnect resource hint will instruct the browser to preconnect to Google Fonts while it is loading the CSS, saving load time.
<hr />
<div id="google_fonts_preconnect_wrap">
<p style="margin-bottom: 5px;">This will generate the following output within <code>&lt;HEAD&gt;</code> and <code>&lt;/HEAD&gt;</code>:</p>
<code>&lt;link href='https://fonts.gstatic.com' crossorigin rel='preconnect' /&gt;</code>
</div>
</td>
</tr>
<tr valign="top">
<th scope="row" class="setting_title">
<?php _e('Preload Google Font Files', 'wp-asset-clean-up'); ?>
<p class="wpacu_subtitle"><small><em><?php _e('One per line', 'wp-asset-clean-up'); ?>, only external Google Font Files are allowed</em></small></p>
</th>
<td>
<div style="margin: 0 0 6px;"><?php _e('If you wish to preload any of the Google Font Files (e.g. ending in .woff2), you can add their URL here (one per line)', 'wp-asset-clean-up'); ?>:</div>
<textarea style="width:100%;"
rows="5"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[google_fonts_preload_files]"><?php echo esc_textarea($data['google_fonts_preload_files']); ?></textarea>
<hr />
<p>To get the URL to the actual font file, you have to open the Google Fonts Link (e.g. https://fonts.googleapis.com/css?family=Open+Sans:bold), locate the actual @font-face (or all of them, depends on the circumstances), and then copy the value of the <code>url</code> within the 'src:' property.</p>
<strong>Examples:</strong>
<div style="margin-top: 5px;">
<div><code>https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu72xKKTU1Kvnz.woff2</code></div>
<div><code>https://fonts.gstatic.com/s/robotomono/v7/L0x5DF4xlVMF-BfR8bXMIjhFq3-cXbKDO1w.woff2</code></div>
</div>
<hr />
<strong>Generated Output</strong>, printed within <code>&lt;HEAD&gt;</code> and <code>&lt;/HEAD&gt;</code>
<div style="margin-top: 5px;">
<div style="margin-bottom: 8px;"><code>&lt;link rel="preload" as="font" href="https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu72xKKTU1Kvnz.woff2" data-wpacu-preload-font="1" crossorigin&gt;</code></div>
<div style="margin-bottom: 8px;"><code>&lt;link rel="preload" as="font" href="https://fonts.gstatic.com/s/robotomono/v7/L0x5DF4xlVMF-BfR8bXMIjhFq3-cXbKDO1w.woff2" data-wpacu-preload-font="1" crossorigin&gt;</code></div>
</div>
</td>
</tr>
</table>

View File

@ -0,0 +1,78 @@
<?php
use WpAssetCleanUp\Misc;
use WpAssetCleanUp\OptimiseAssets\OptimizeCommon;
if (! isset($data)) {
exit;
}
?>
<table class="wpacu-form-table">
<tr valign="top">
<th scope="row" class="setting_title">
<label for="wpacu_google_fonts_remove"><?php _e('Remove Google Fonts', 'wp-asset-clean-up'); ?></label>
</th>
<td style="padding-bottom: 10px;">
<label class="wpacu_switch">
<input id="wpacu_google_fonts_remove"
type="checkbox"
data-target-opacity="google_fonts_remove_wrap"
<?php echo (($data['google_fonts_remove'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[google_fonts_remove]"
value="1" /> <span class="wpacu_slider wpacu_round"></span></label>
&nbsp;This option removes the Google Fonts requests from your website including: <code>&lt;LINK&gt;</code> tags (included preloaded ones), @import within CSS stylesheet files / <code>&lt;STYLE&gt;</code> tags and any @font-face that loads font files from <em>fonts.gstatic.com</em>)
</td>
</tr>
</table>
<div id="google_fonts_remove_wrap" style="padding: 0 10px 10px; <?php if (! $data['google_fonts_remove']) { ?>opacity: 0.4;<?php } ?>">
<hr />
<p style="margin-bottom: 10px;"><strong style="border-bottom: 1px dotted black;">Possible reasons to remove Google Font requests</strong></p>
<ul style="list-style: circle; margin-left: 22px; margin-top: 0;">
<li>You have your own font files that you wish to implement and don't need to have any requests to Google Fonts</li>
<li>You're already using your own local fonts and you just installed a plugin that makes requests to Google Fonts leading to extra external requests which are affecting the performance</li>
</ul>
<hr />
<p style="margin-bottom: 10px;"><strong style="border-bottom: 1px dotted black;">What kind of content will be stripped?</strong> * some examples:</p>
<strong>&#10230; LINK tags</strong>
<ul style="list-style: none; margin-left: 0; margin-top: 8px; margin-bottom: 20px;">
<li><code>&lt;link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Roboto' /&gt;</code></li>
<li><code>&lt;link rel='preload' as='style' href='https://fonts.googleapis.com/css?family=Roboto' /&gt;</code></li>
<li><code>&lt;link rel='preload' as='font' href='https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu7mxKKTU1Kvnz.woff2' crossorigin /&gt;</code></li>
<li><code>&lt;link rel='dns-prefetch' href='//fonts.googleapis.com' /&gt;</code></li>
<li><code>&lt;link rel='preconnect' href='https://fonts.gstatic.com' crossorigin /&gt;</code></li>
</ul>
<strong>&#10230; @import &amp; @font-face in CSS files (from the same domain) or STYLE tags</strong>
<ul style="list-style: none; margin-left: 0; margin-top: 8px;">
<li><code>@import "https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300";</code></li>
<li><code>@import url("https://fonts.googleapis.com/css?family=Verdana:700");</code></li>
<li><?php
$cssFontFaceSample = <<<CSS
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu7mxKKTU1Kvnz.woff2) format('woff2');
unicode-range: U+1F00-1FFF;
}
CSS;
echo '<code>'.$cssFontFaceSample.'</code>';
?></li>
</ul>
<strong>&#10230; URLs to Google Fonts within JavaScript files &amp; inline SCRIPT tags</strong>
<ul style="list-style: none; margin-left: 0; margin-top: 8px; margin-bottom: 0;">
<li><code>loadCss("<span style="background-color: #f2faf2;">https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300</span>");</code></li>
<li><code>WebFontConfig={google:{/* code here */}};(function(d) { var wf=d.createElement('script'), s=d.scripts[0]; wf.src='<span style="background-color: #f2faf2;">https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js</span>'; wf.async=!0; s.parentNode.insertBefore(wf,s)})(document);</code>, etc.</li>
</ul>
<p style="font-size: inherit; font-style: italic; margin-top: 0;"><small>* CDN requests for Web Font Loader from Google, Cloudflare and jsDelivr are detected and stripped.</small></p>
<p style="margin-bottom: 6px;"><strong style="border-bottom: 1px dotted black;">Is this solution working 100% for any website?</strong></p>
If you're already using "WebFontConfig" and it's hardcoded in your theme or one of the plugins, it's not easy to strip it via an universal pattern as its code can be scattered in various places and some attempts to strip it off might broke the JavaScript file that triggers it. Thus, in rare cases, you might have some traces left of Google Font requests and you'll need to strip that manually.
<p style="margin-top: 10px; font-size: inherit;" class="wpacu-warning"><strong>Note:</strong> After you enable this option, any options from "Optimize Font Delivery" won't trigger anymore. If @import or @font-face matches are found in CSS files, the new updated files will be cached and stored in <strong>/<?php echo str_replace(Misc::getWpRootDirPath(), '', WP_CONTENT_DIR) . OptimizeCommon::getRelPathPluginCacheDir(); ?></strong>. The original files (from either plugins or the theme) won't be altered in any way.</p>
</div>

View File

@ -0,0 +1,122 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data, $selectedTabArea)) {
exit;
}
$tabIdArea = 'wpacu-setting-local-fonts';
$styleTabContent = ($selectedTabArea === $tabIdArea) ? 'style="display: table-cell;"' : '';
$ddOptions = array(
'swap' => 'swap (most used)',
'auto' => 'auto',
'block' => 'block',
'fallback' => 'fallback',
'optional' => 'optional'
);
?>
<div id="<?php echo esc_attr($tabIdArea); ?>" class="wpacu-settings-tab-content" <?php echo wp_kses($styleTabContent, array('style' => array())); ?>>
<h2 class="wpacu-settings-area-title"><?php esc_html_e('Local Fonts Optimization', 'wp-asset-clean-up'); ?></h2>
<table class="wpacu-form-table">
<tr valign="top">
<th scope="row" class="setting_title">
<?php echo sprintf(esc_html__('Apply %s CSS property value', 'wp-asset-clean-up'), '<span style="background: #f5f5f5; padding: 4px;">font-display:</span>'); ?>
</th>
<td>
<a class="go-pro-link-no-style" target="_blank" href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=plugin_usage_settings&utm_medium=local_fonts_optimization'); ?>"><span class="wpacu-tooltip" style="width: 186px;"><?php esc_html_e('This is a feature available in the Pro version! Unlock it!', 'wp-asset-clean-up'); ?></span> <img style="opacity: 0.6;" width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL.'/assets/icons/icon-lock.svg'); ?>" valign="top" alt="" /></a>&nbsp;
&nbsp;<select
<?php /* [wpacu_lite] */ ?>
style="opacity: 0.5;"
<?php /* [/wpacu_lite] */ ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[local_fonts_display]">
<option value="">Do not apply (default)</option>
<?php
foreach ($ddOptions as $ddOptionValue => $ddOptionText) {
$selectedOption = ($data['local_fonts_display'] === $ddOptionValue) ? 'selected="selected"' : '';
echo '<option '.$selectedOption.' value="'.$ddOptionValue.'">'.$ddOptionText.'</option>'."\n";
}
?>
</select> &nbsp; / &nbsp;
<div style="display: inline-block; opacity: 0.5;">
Overwrite any existing "font-display" value? &nbsp;
<label for="wpacu_local_fonts_display_overwrite_no"><input id="wpacu_local_fonts_display_overwrite_no"
disabled="disabled"
checked="checked"
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[local_fonts_display_overwrite]"
value="" />No</label>
&nbsp;&nbsp;&nbsp;
<label for="wpacu_local_fonts_display_overwrite_yes"><input id="wpacu_local_fonts_display_overwrite_yes"
disabled="disabled"
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[local_fonts_display_overwrite]"
value="1" />Yes</label>
</div>
&nbsp;
<p><?php _e('This feature applies site-wide "font-display:" property (if none set already in the file) within @font-face in every loaded CSS file.', 'wp-asset-clean-up'); ?> &nbsp; <span style="color: #0073aa;" class="dashicons dashicons-info"></span>&nbsp;<a id="wpacu-local-fonts-display-info-target" href="#wpacu-local-fonts-display-info"><?php _e('Read more', 'wp-asset-clean-up'); ?></a></p>
<p><?php echo sprintf(__('The new generated CSS files will be loaded from <code>%s</code>, as the existing files from plugins/themes will not be altered in any way.', 'wp-asset-clean-up'), \WpAssetCleanUp\OptimiseAssets\OptimizeCommon::getRelPathPluginCacheDir()); ?></p>
<hr />
<p><?php esc_html_e('Deciding the behavior for a web font as it is loading can be an important performance tuning technique. If applied, this option ensures text remains visible during webfont load.', 'wp-asset-clean-up'); ?> <?php _e('The <code>font-display</code> CSS property defines how font files are loaded and display by the browser.', 'wp-asset-clean-up'); ?></p>
<strong>Read more about this:</strong>
<a target="_blank" href="https://css-tricks.com/hey-hey-font-display/">Hey hey `font-display`</a> &nbsp;|&nbsp;
<a target="_blank" href="https://css-tricks.com/font-display-masses/">`font-display` for the Masses</a> &nbsp;|&nbsp;
<a target="_blank" href="https://developers.google.com/web/updates/2016/02/font-display">Controlling Font Performance with font-display</a> &nbsp;|&nbsp;
<a target="_blank" href="https://font-display.glitch.me/">https://font-display.glitch.me/</a> &nbsp;|&nbsp;
<a target="_blank" href="https://vimeo.com/241111413">Video: Fontastic Web Performance</a>
</td>
</tr>
<tr valign="top">
<th scope="row" class="setting_title">
<?php _e('Preload Local Font Files', 'wp-asset-clean-up'); ?>
<p class="wpacu_subtitle"><small><em><?php _e('One per line', 'wp-asset-clean-up'); ?></em></small></p>
</th>
<td>
<div style="margin: 0 0 6px;"><?php _e('If you wish to preload any of the Local Font Files (ending in .woff, .woff2, .ttf etc.), you can add their URI here like in the examples below (one per line)', 'wp-asset-clean-up'); ?>:</div>
<textarea style="width:100%;"
rows="5"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[local_fonts_preload_files]"><?php echo esc_textarea($data['local_fonts_preload_files']); ?></textarea>
<hr />
<strong>Examples:</strong>
<div style="margin-top: 5px;">
<div><code>/wp-content/themes/your-theme-dir/fonts/lato.woff</code></div>
<div><code>/wp-content/plugins/plugin-title-here/fonts/fontawesome-webfont.ttf?v=4.5.0</code></div>
</div>
<hr />
<strong>Generated Output</strong>, printed within <code>&lt;HEAD&gt;</code> and <code>&lt;/HEAD&gt;</code>
<div style="margin-top: 5px;">
<div style="margin-bottom: 8px;"><code>&lt;link rel="preload" as="font" href="/wp-content/themes/your-theme-dir/fonts/lato.woff" data-wpacu-preload-font="1" crossorigin&gt;</code></div>
<div style="margin-bottom: 8px;"><code>&lt;link rel="preload" as="font" href="/wp-content/plugins/plugin-title-here/fonts/fontawesome-webfont.ttf?v=4.5.0" data-wpacu-preload-font="1" crossorigin&gt;</code></div>
</div>
</td>
</tr>
</table>
</div>
<div id="wpacu-local-fonts-display-info" class="wpacu-modal" style="padding-top: 60px;">
<div class="wpacu-modal-content" style="max-width: 800px;">
<span class="wpacu-close">&times;</span>
<h3 style="margin-top: 2px; margin-bottom: 4px;">font-display: <span style="background: #f2faf2;">swap</span></h3>
<p style="margin-top: 0; margin-bottom: 22px;">The text is shown immediately (without any block period, no invisible text) in the fallback font until the custom font loads, then it's swapped with the custom font. You get a <strong>FOUT</strong> (<em>flash of unstyled text</em>).</p>
<h3 style="margin-bottom: 4px;">font-display: <span style="background: #f2faf2;">block</span></h3>
<p style="margin-top: 0; margin-bottom: 22px;">The text blocks (is invisible) for a short period. Then, if the custom font hasn't been downloaded yet, the browser swaps (renders the text in the fallback font), for however long it takes the custom font to be downloaded, and then re-renders the text in the custom font. You get a <strong>FOIT</strong> (<em>flash of invisible text</em>).</p>
<h3 style="margin-bottom: 4px;">font-display: <span style="background: #f2faf2;">fallback</span></h3>
<p style="margin-top: 0; margin-bottom: 22px;">This is somewhere in between block and swap. The text is invisible for a short period of time (100ms). Then if the custom font hasn't downloaded, the text is shown in a fallback font (for about 3s), then swapped after the custom font loads.</p>
<h3 style="margin-bottom: 4px;">font-display: <span style="background: #f2faf2;">optional</span></h3>
<p style="margin-top: 0; margin-bottom: 22px;">This behaves just like fallback, only the browser can decide to not use the custom font at all, based on the user's connection speed (if you're on a slow 3G or less, it will take forever to download the custom font and then swapping to it will be too late and extremely annoying)</p>
<h3 style="margin-bottom: 4px;">font-display: <span style="background: #f2faf2;">auto</span></h3>
<p style="margin-top: 0; margin-bottom: 0;">The default. Typical browser font loading behavior will take place. This behavior may be FOIT, or FOIT with a relatively long invisibility period. This may change as browser vendors decide on better default behaviors.</p>
<h3 style="margin-bottom: 4px;">Example of a @font-face CSS output</h3>
<code>@font-face{font-family:'proxima-nova-1';src:url("/wp-content/themes/my-theme-dir/fonts/proxima-nova-light.woff2") format("woff2"),url("/wp-content/themes/my-theme-dir/fonts/proxima-nova-light.woff") format("woff");font-weight:300;font-style:normal;font-stretch:normal;<span style="background: #f2faf2;">font-display:swap</span>}</code>
</div>
</div>

View File

@ -0,0 +1,195 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data, $selectedTabArea)) {
exit;
}
$tabIdArea = 'wpacu-setting-html-source-cleanup';
$styleTabContent = ($selectedTabArea === $tabIdArea) ? 'style="display: table-cell;"' : '';
?>
<div id="<?php echo esc_attr($tabIdArea); ?>" class="wpacu-settings-tab-content" <?php echo wp_kses($styleTabContent, array('style' => array())); ?>>
<h2 class="wpacu-settings-area-title"><?php _e('Remove unused elements from the &lthead&gt; section', 'wp-asset-clean-up'); ?></h2>
<p>There are elements that are enabled by default in many WordPress environments, but not necessary to be enabled. Cleanup the unnecessary code between <code>&lt;head&gt;</code> and <code>&lt;/head&gt;</code>.</p>
<table class="wpacu-form-table">
<!-- Remove "Really Simple Discovery (RSD)" link? -->
<tr valign="top">
<th scope="row">
<label for="wpacu_remove_rsd_link">Remove "Really Simple Discovery (RSD)" link tag?</label>
</th>
<td>
<?php
$opacityStyle = '';
if ($data['disable_xmlrpc'] === 'disable_all') {
$opacityStyle = 'opacity: 0.4;';
}
?>
<label class="wpacu_switch" style="<?php echo $opacityStyle; ?>">
<input id="wpacu_remove_rsd_link" type="checkbox"
<?php echo (($data['remove_rsd_link'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[remove_rsd_link]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;
<code style="<?php echo $opacityStyle; ?>">&lt;link rel=&quot;EditURI&quot; type=&quot;application/rsd xml&quot; title=&quot;RSD&quot; href=&quot;http://yourwebsite.com/xmlrpc.php?rsd&quot; /&gt;</code>
<p style="margin-top: 10px; <?php echo $opacityStyle; ?>">XML-RPC clients use this discovery method. If you do not know what this is and don't use service integrations such as <a href="http://www.flickr.com/services/api/request.xmlrpc.html">Flickr</a> on your WordPress website, you can remove it.</p>
<?php if ($data['disable_xmlrpc'] === 'disable_all') { ?>
<p style="margin-top: 10px; color: #cc0000;"><strong>Note:</strong> As you already chosen to completely disable "<a data-wpacu-vertical-link-target="wpacu-setting-disable-xml-rpc" href="#wpacu-setting-disable-xml-rpc">Disable XML-RPC</a>", the "Really Simple Discovery (RSD)" link tag is already removed.</p>
<?php } ?>
</td>
</tr>
<!-- Remove "Windows Live Writer" link? -->
<tr valign="top">
<th scope="row">
<label for="wpacu_remove_wlw_link">Remove "Windows Live Writer" link tag?</label>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_remove_wlw_link" type="checkbox"
<?php echo (($data['remove_wlw_link'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[remove_wlw_link]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;
<code>&lt;link rel=&quot;wlwmanifest&quot; type=&quot;application/wlwmanifest xml&quot; href=&quot;https://yourwebsite.com/wp-includes/wlwmanifest.xml&quot; /&gt;</code>
<p style="margin-top: 10px;">If you do not use Windows Live Writer to edit your blog contents, then it's safe to remove this.</p>
</td>
</tr>
<!-- Remove "REST API" link? -->
<tr valign="top">
<th scope="row">
<label for="wpacu_remove_rest_api_link">Remove "REST API" link tag?</label>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_remove_rest_api_link" type="checkbox"
<?php echo (($data['remove_rest_api_link'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[remove_rest_api_link]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;
<code>&lt;link rel=&#39;https://api.w.org/&#39; href=&#39;https://yourwebsite.com/wp-json/&#39; /&gt;</code>
<p style="margin-top: 10px;">Are you accessing your content through endpoints (e.g. https://yourwebsite.com/wp-json/, https://yourwebsite.com/wp-json/wp/v2/posts/1 - <em>1</em> in this example is the POST ID)? If not, you can remove this.</p>
</td>
</tr>
<!-- Remove "Shortlink"? -->
<tr valign="top">
<th scope="row">
<label for="wpacu_remove_shortlink">Remove Pages/Posts "Shortlink" tag?</label>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_remove_shortlink" type="checkbox"
<?php echo (($data['remove_shortlink'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[remove_shortlink]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;
<code>&lt;link rel=&#39;shortlink&#39; href=&quot;https://yourdomain.com/?p=1&quot;&gt;</code>
<p style="margin-top: 10px;">Are you using SEO friendly URLs and do not need the default WordPress shortlink? You can just remove this as it bulks out the head section of your website.</p>
</td>
</tr>
<!-- Remove "Post's Relational Links" tag? -->
<tr valign="top">
<th scope="row">
<label for="wpacu_remove_posts_rel_links">Remove "Post's Relational Links" tag?</label>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_remove_posts_rel_links" type="checkbox"
<?php echo (($data['remove_posts_rel_links'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[remove_posts_rel_links]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;
<code>&lt;link rel=&#39;prev&#39; title=&#39;Post title&#39; href=&#39;https://yourdomain.com/prev-post-slug-here/&#39; /&gt;</code> <strong>&amp;</strong> <code>&lt;link rel=&#39;next&#39; title=&#39;Post title&#39; href=&#39;https://yourdomain.com/next-post-slug-here/&#39; /&gt;</code>
<p style="margin-top: 10px;">This removes relational links for the posts adjacent to the current post for single post pages.</p>
</td>
</tr>
<tr valign="top">
<th scope="row">&nbsp;</th>
<td>
<div class="wpacu-notice wpacu-warning" style="font-size: inherit; margin-top: 0 !important; line-height: 1.4rem;">
<span class="dashicons dashicons-warning" style="font-size: 22px; color: #ff9800 !important;"></span>
The option to disable RSS feeds has been moved to its own area in "<a data-wpacu-vertical-link-target="wpacu-setting-disable-rss-feed" href="#wpacu-setting-disable-rss-feed">Disable RSS Feed</a>" (vertical menu) starting from v1.2.1.2.
</div>
</td>
</tr>
<!-- Remove "WordPress version" meta tag? -->
<tr valign="top">
<th scope="row">
<label for="wpacu_remove_wp_version">Remove "WordPress version" meta tag?</label>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_remove_wp_version" type="checkbox"
<?php echo (($data['remove_wp_version'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[remove_wp_version]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;
<code>&lt;meta name=&quot;generator&quot; content=&quot;WordPress 4.9.8&quot; /&gt;</code>
<p style="margin-top: 10px;">This is good for security purposes as well, since it hides the WordPress version you're using (in case of hacking attempts).</p>
</td>
</tr>
<!-- Remove "WordPress version" meta tag and all other tags? -->
<tr valign="top">
<th scope="row">
<label for="wpacu_remove_generator_tag">Remove All "generator" meta tags?</label>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_remove_generator_tag"
type="checkbox"
<?php echo (($data['remove_generator_tag'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[remove_generator_tag]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;
<code>e.g. &lt;meta name=&quot;generator&quot; content=&quot;Easy Digital Downloads v2.9.8&quot; /&gt;</code>
<p style="margin-top: 10px;">This will remove all meta tags with the "generator" name, including the "WordPress version" meta tag. You could use a plugin or a theme that has added a generator notice, but you do not need to have it there. Moreover, it will hide the version of the plugins and theme you're using which is good for security reasons.</p>
</td>
</tr>
</table>
<hr />
<h2><?php _e('Remove extra elements from the generated page source', 'wp-asset-clean-up'); ?></h2>
<table class="wpacu-form-table">
<tr valign="top">
<th scope="row">
<label for="wpacu_remove_html_comments">Strip HTML comments?</label>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_remove_html_comments"
data-target-opacity="wpacu_remove_html_comments_area"
type="checkbox"
<?php echo (($data['remove_html_comments'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[remove_html_comments]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp; This feature will strip all comments except the Internet Explorer conditional ones. If you wish to keep specific comments, use the textarea below to add exception patterns (one per line).
<?php
$removeHtmlCommentsAreaStyle = ($data['remove_html_comments'] == 1) ? 'opacity: 1;' : 'opacity: 0.4;';
?>
<div id="wpacu_remove_html_comments_area" style="<?php echo esc_attr($removeHtmlCommentsAreaStyle); ?>">
<div style="margin: 14px 0 8px;"><label for="wpacu_remove_html_comments_exceptions">Do not remove comments containing the following (case insensitive) text:</label></div>
<textarea id="wpacu_remove_html_comments_exceptions"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[remove_html_comments_exceptions]"
rows="4"
style="width: 100%;"><?php echo esc_textarea($data['remove_html_comments_exceptions']); ?></textarea>
<div class="wpacu-notice wpacu-warning" style="font-size: inherit; line-height: 1.4rem;">
<span class="dashicons dashicons-warning" style="font-size: 22px; color: #ff9800 !important;"></span>
There are comments which might not be stripped from the final HTML source and this is due to the source being updated outside the WordPress environment or by caching plugins that add their own signatures before rendering the cached pages. <a target="_blank" href="https://assetcleanup.com/docs/?p=116">Read more</a> about how you can strip those comments too!
</div>
</div>
</td>
</tr>
</table>
</div>

View File

@ -0,0 +1,380 @@
<?php
/*
* No direct access to this file
*/
use WpAssetCleanUp\Misc;
use WpAssetCleanUp\OptimiseAssets\OptimizeCommon;
use WpAssetCleanUp\OptimiseAssets\OptimizeCss;
if (! isset($data, $selectedTabArea)) {
exit;
}
global $wp_version;
$tabIdArea = 'wpacu-setting-optimize-css';
$styleTabContent = ($selectedTabArea === $tabIdArea) ? 'style="display: table-cell;"' : '';
?>
<div id="<?php echo esc_attr($tabIdArea); ?>" class="wpacu-settings-tab-content" <?php echo wp_kses($styleTabContent, array('style' => array())); ?>>
<h2 class="wpacu-settings-area-title"><?php _e('Minify / Combine loaded CSS files to reduce total page size and the number of HTTP requests', 'wp-asset-clean-up'); ?></h2>
<?php
$wpRocketIssues = array();
if (($wpRocketIssues['minify_html'] = Misc::isWpRocketMinifyHtmlEnabled())
|| ($wpRocketIssues['optimize_css_delivery'] = OptimizeCss::isWpRocketOptimizeCssDeliveryEnabled())) {
?>
<div class="wpacu-warning" style="font-size: 13px; margin-bottom: 18px; border: 1px solid #cc000059;">
<span class="dashicons dashicons-warning" style="color: #cc0000;"></span> <strong>Incompatibility Notice:</strong>
<?php if (isset($wpRocketIssues['minify_html']) && $wpRocketIssues['minify_html']) { ?>
<p style="margin-bottom: 0;">At this time, "<strong>Combine loaded CSS (Stylesheets) into fewer files</strong>" &amp; "<strong>Defer CSS Loaded in the &lt;BODY&gt; (Footer)</strong>" options do not take any effect as "<em>Minify HTML</em>" is active in "WP Rocket" -&gt; "File Optimization" Settings. If you wish to keep WP Rocket's Minify HTML on, consider optimizing CSS with WP Rocket while cleaning the useless CSS with <?php echo WPACU_PLUGIN_TITLE; ?>.</p>
<?php } ?>
<?php if (isset($wpRocketIssues['optimize_css_delivery']) && $wpRocketIssues['optimize_css_delivery']) { ?>
<p style="margin-bottom: 0;"><?php echo WPACU_PLUGIN_TITLE; ?>'s "<strong>Combine loaded CSS (Stylesheets) into fewer files</strong>" &amp; "<strong>Defer CSS Loaded in the &lt;BODY&gt; (Footer)</strong>" options do not take any effect as "<em>Optimize CSS Delivery</em>" is active in "WP Rocket" -&gt; "File Optimization" Settings. The feature is changing the way CSS is delivered by adding critical CSS to the HEAD section of the website as well as preloading the rest of the CSS files before applying their syntax on page loading. This doesn't affect the performance of your website as you can eliminate the bloat with <?php echo WPACU_PLUGIN_TITLE; ?> and use WP Rocket for CSS Optimization/Delivery if that's what works best for your website.</p>
<?php } ?>
</div>
<?php
}
?>
<table class="wpacu-form-table">
<?php
$minifyCssDisabled = ! empty($data['is_optimize_css_enabled_by_other_party']);
?>
<tr valign="top">
<th scope="row" class="setting_title">
<label for="wpacu_minify_css_enable"><?php _e('CSS Files Minification', 'wp-asset-clean-up'); ?></label>
<p class="wpacu_subtitle"><small><em><?php _e('Helps decrease the total page size even further', 'wp-asset-clean-up'); ?></em></small></p>
</th>
<td>
<label class="wpacu_switch <?php if (! empty($data['is_optimize_css_enabled_by_other_party'])) { echo 'wpacu_disabled'; } ?>">
<input id="wpacu_minify_css_enable"
data-target-opacity="wpacu_minify_css_area"
type="checkbox"
<?php
if ($minifyCssDisabled) {
echo 'disabled="disabled"';
} else {
echo ($data['minify_loaded_css'] == 1) ? 'checked="checked"' : '';
}
?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[minify_loaded_css]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;<?php _e('This will take the remaining enqueued CSS files, minify them and load them from the cache.', 'wp-asset-clean-up'); ?>
<?php _e('You might want to minify the local files, the inline CSS code within STYLE tags or both.', 'wp-asset-clean-up'); ?>
<?php
if ($minifyCssDisabled) {
?>
<div style="border-left: 4px solid green; background: #f2faf2; padding: 10px; margin-top: 10px;">
<ul style="margin: 0;">
<li>This option is locked as optimize/minify stylesheets (CSS) is already enabled in the following plugins: <strong><?php echo implode(', ', $data['is_optimize_css_enabled_by_other_party']); ?></strong>. <?php echo WPACU_PLUGIN_TITLE; ?> works together with the mentioned plugin(s).</li>
<li>Eliminate the bloat first via <a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_assets_manager')); ?>">CSS & JAVASCRIPT LOAD MANAGER</a>, then minify the remaining CSS with any plugin you prefer.</li>
</ul>
</div>
<?php
}
$minifyCssExceptionsAreaStyle = empty($data['is_optimize_css_enabled_by_other_party']) && ($data['minify_loaded_css'] == 1) ? 'opacity: 1;' : 'opacity: 0.4;';
?>
<div id="wpacu_minify_css_area" style="<?php echo esc_attr($minifyCssExceptionsAreaStyle); ?>">
<div style="margin-top: 8px; padding: 12px; background: #f2faf2; border-radius: 10px;">
<ul style="margin: 0;">
<li style="float: left; margin-right: 30px; margin-bottom: 0; line-height: 32px;" class="wpacu-fancy-radio">
<label for="minify_loaded_css_for_link_href_radio">
<input id="minify_loaded_css_for_link_href_radio"
style="margin: -1px 0 0;"
<?php
echo in_array($data['minify_loaded_css_for'], array('href', '')) ? 'checked="checked"' : '';
?>
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[minify_loaded_css_for]"
value="href" />
&nbsp;<?php _e('LINK tags with "href" attribute', 'wp-asset-clean-up'); ?> (<?php _e('default', 'wp-asset-clean-up'); ?>)
</label>
</li>
<li style="float: left; margin-right: 30px; margin-bottom: 0; line-height: 32px;" class="wpacu-fancy-radio">
<label for="minify_loaded_css_for_style_inline_radio">
<input id="minify_loaded_css_for_style_inline_radio"
style="margin: -1px 0 0;"
<?php echo (($data['minify_loaded_css_for'] === 'inline') ? 'checked="checked"' : ''); ?>
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[minify_loaded_css_for]"
value="inline" />
&nbsp;<?php _e('STYLE tags with inline CSS code ', 'wp-asset-clean-up'); ?>
</label>
</li>
<li style="float: left; margin-bottom: 0; line-height: 32px;" class="wpacu-fancy-radio">
<label for="minify_loaded_css_for_link_style_all_radio">
<input id="minify_loaded_css_for_link_style_all_radio"
style="margin: -1px 0 0;"
<?php echo (($data['minify_loaded_css_for'] === 'all') ? 'checked="checked"' : ''); ?>
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[minify_loaded_css_for]"
value="all" />
&nbsp;<?php _e('All LINK &amp; STYLE tags', 'wp-asset-clean-up'); ?> * <small>both options</small>
</label>
</li>
</ul>
<div style="clear: both;"></div>
</div>
<div id="wpacu_minify_css_exceptions_area">
<div style="margin: 0 0 6px;"><?php _e('Do not minify the CSS files matching the patterns below (one per line)', 'wp-asset-clean-up'); ?>:</div>
<label for="wpacu_minify_css_exceptions">
<textarea style="width: 100%;"
rows="4"
id="wpacu_minify_css_exceptions"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[minify_loaded_css_exceptions]"><?php echo esc_textarea($data['minify_loaded_css_exceptions']); ?></textarea>
</label>
</div>
<ul style="list-style: none; margin-left: 18px; margin-bottom: 0;">
<li style="margin-bottom: 18px;"><span style="color: #ffc107;" class="dashicons dashicons-lightbulb"></span> The stylesheets (.css) cached files will be re-generated once the file version changes (the value from <code>?ver=</code>). In addition, the version number (value) from the source will be appended to the new cached .css file name (e.g. new-file-name-here-ver-1.2.css).</li>
<li><span style="color: #ffc107;" class="dashicons dashicons-lightbulb"></span> <?php _e('For maximum performance and to reduce server resources, the following stylesheet files will not be minified since they are already optimised and minified by the WordPress core contributors &amp; developers', 'wp-asset-clean-up'); ?>:
<div style="margin: 15px 0 0 28px;">
<ul style="list-style: disc;">
<li>CSS WordPress core files that end up in .min.css (e.g. <code>/wp-includes/css/dashicons.min.css</code>, <code>/wp-includes/css/admin-bar.min.css</code>, etc.)</li>
<li>CSS files from <code>/wp-content/uploads/elementor/</code> (if Elementor builder plugin is used) and <code>/wp-content/uploads/oxygen/</code> (if Oxygen builder plugin is used)</li>
<li>Specific CSS files from WooCommerce (e.g. the ones located in <code>/wp-content/plugins/woocommerce/assets/css/</code>) if the plugin is used, etc.</li>
</ul>
</div>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<td colspan="2" style="padding: 0;">
<div class="wpacu-combine-notice-default wpacu_hide" style="line-height: 22px; background: #f8f8f8; border-left: 4px solid #008f9c; padding: 10px; margin: 0 0 15px;">
<strong><?php _e('NOTE', 'wp-asset-clean-up'); ?>:</strong> <?php _e('Concatenating assets is no longer a recommended practice in HTTP/2', 'wp-asset-clean-up'); ?>. &nbsp; <a id="wpacu-http2-info-css-target" href="#wpacu-http2-info-css"><?php _e('Read more', 'wp-asset-clean-up'); ?></a> &nbsp;/&nbsp; <a class="wpacu_verify_http2_protocol" target="_blank" href="https://tools.keycdn.com/http2-test"><strong><?php _e('Verify if the website is delivered through the HTTP/2 network protocol', 'wp-asset-clean-up'); ?></strong></a>
</div>
<div class="wpacu-combine-notice-http-2-detected wpacu_hide" style="line-height: 22px; background: #f8f8f8; border-left: 4px solid #008f9c; padding: 10px; margin: 0 0 15px;">
<span class="wpacu_http2_protocol_is_supported" style="color: green; font-weight: 400;"><span class="dashicons dashicons-yes-alt"></span> Your website `<span style="font-weight: 500;"><?php echo get_site_url(); ?></span>` is delivered through the HTTP/2 network protocol, thus, the website will be as fast without using this feature which might require maintenance once in a while.</span> <a class="wpacu-http2-info-css-target" href="#wpacu-http2-info-css"><?php _e('Read more', 'wp-asset-clean-up'); ?></a>
</div>
</td>
</tr>
<?php
$combineCssDisabled = ! empty($data['is_optimize_css_enabled_by_other_party']);
?>
<tr valign="top">
<th scope="row" class="setting_title">
<label for="wpacu_combine_loaded_css_enable"><?php _e('Combine loaded CSS (Stylesheets) into fewer files', 'wp-asset-clean-up'); ?></label>
<p class="wpacu_subtitle"><small><em><?php _e('Helps reducing the number of HTTP Requests even further', 'wp-asset-clean-up'); ?></em></small></p>
</th>
<td>
<label class="wpacu_switch <?php if ($combineCssDisabled) { echo 'wpacu_disabled'; } ?>">
<input id="wpacu_combine_loaded_css_enable"
data-target-opacity="wpacu_combine_loaded_css_info_area"
type="checkbox"
<?php
if ($combineCssDisabled) {
echo 'disabled="disabled"';
} else {
echo in_array( $data['combine_loaded_css'], array( 'for_admin', 'for_all', 1 ) ) ? 'checked="checked"' : '';
}
?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[combine_loaded_css]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;<small>* if <code style="font-size: inherit;"><?php echo '/'.str_replace(Misc::getWpRootDirPath(), '', WP_CONTENT_DIR) . \WpAssetCleanUp\OptimiseAssets\OptimizeCommon::getRelPathPluginCacheDir(); ?></code> directory is not writable for some reason, this feature will not work; requires the DOMDocument XML DOM Parser to be enabled in PHP (which it is by default) for maximum performance</small>
&nbsp;
<?php
if (! empty($data['is_optimize_css_enabled_by_other_party'])) {
?>
<div style="border-left: 4px solid green; background: #f2faf2; padding: 10px; margin-top: 10px;">
<ul style="margin: 0;">
<li>This option is locked as optimize/minify stylesheets (CSS) is already enabled in the following plugins: <strong><?php echo implode(', ', $data['is_optimize_css_enabled_by_other_party']); ?></strong></li>
<li><?php echo WPACU_PLUGIN_TITLE; ?> works together with the mentioned plugin(s). Eliminate the bloat first via <a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_assets_manager')); ?>">CSS & JAVASCRIPT LOAD MANAGER</a>, then concatenate (if necessary) the remaining CSS with any plugin you prefer.</li>
</ul>
</div>
<?php
}
?>
<div id="wpacu_combine_loaded_css_info_area" <?php if (empty($data['is_optimize_css_enabled_by_other_party']) && in_array($data['combine_loaded_css'], array('for_admin', 'for_all', 1))) { ?> style="opacity: 1;" <?php } else { ?>style="opacity: 0.4;"<?php } ?>>
<div style="margin-top: 8px; padding: 12px; background: #f2faf2; border-radius: 10px;">
<ul style="margin: 0;">
<li style="float: left; margin-right: 30px; margin-bottom: 0; line-height: 32px;" class="wpacu-fancy-radio">
<label for="combine_loaded_css_for_guests_radio">
<input id="combine_loaded_css_for_guests_radio"
style="margin: -1px 0 0;"
<?php echo (in_array($data['combine_loaded_css_for'], array('guests', '')) ? 'checked="checked"' : ''); ?>
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[combine_loaded_css_for]"
value="guests" />
&nbsp;<?php _e('Apply it only for guest visitors', 'wp-asset-clean-up'); ?> (<?php _e('default', 'wp-asset-clean-up'); ?>)
</label>
</li>
<li style="float: left; margin-bottom: 0; line-height: 32px;" class="wpacu-fancy-radio">
<label for="combine_loaded_css_for_all_radio">
<input id="combine_loaded_css_for_all_radio"
style="margin: -1px 0 0;"
<?php echo (($data['combine_loaded_css_for'] === 'all') ? 'checked="checked"' : ''); ?>
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[combine_loaded_css_for]"
value="all" />
&nbsp;<?php _e('Apply it for all visitors (not recommended)', 'wp-asset-clean-up'); ?> * <small>to avoid using extra disk space</small>
</label>
</li>
</ul>
<div style="clear: both;"></div>
</div>
<p style="margin-top: 10px;"><strong>Note:</strong> When a stylesheet is added to a combined group of files, any other inline content (e.g. added via <code style="font-size: inherit;">wp_add_inline_style()</code>) associated with it, will also be added to the combined files. This reduces the number of DOM elements as well makes sure the CSS code will load in the right (set) order.</p>
<hr />
<div id="wpacu_combine_loaded_css_exceptions_area">
<div style="margin: 8px 0 6px;"><?php _e('Do not combine the CSS files matching the patterns below', 'wp-asset-clean-up'); ?> (<?php _e('one per line', 'wp-asset-clean-up'); ?>):</div>
<label for="combine_loaded_css_exceptions">
<textarea style="width: 100%;"
rows="4"
id="combine_loaded_css_exceptions"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[combine_loaded_css_exceptions]"><?php echo esc_textarea($data['combine_loaded_css_exceptions']); ?></textarea>
</label>
<p>Pattern Examples (you don't have to add the full URL, as it's recommended to use relative paths):</p>
<code>/wp-includes/css/dashicons.min.css<br />/wp-includes/css/admin-bar.min.css<br />/wp-content/plugins/plugin-title/css/(.*?).css</code>
</div>
<p>This scans the remaining CSS files (left after cleaning up the unnecessary ones) from the <code>&lt;head&gt;</code> and <code>&lt;body&gt;</code> locations and combines them into ~2 files (one in each location). To be 100% sure everything works fine after activation, consider enabling this feature only for logged-in administrator, so only you can see the updated page. If all looks good, you can later uncheck the option to apply the feature to everyone else.</p>
<hr />
<p style="margin: 8px 0 4px;"><span style="color: #ffc107;" class="dashicons dashicons-lightbulb"></span> This feature will not work <strong>IF</strong>:</p>
<ul style="margin-top: 0; margin-left: 35px; list-style: disc;">
<li>"Test Mode" is enabled, this feature will not take effect for the guest users, and it will apply the changes only for you.</li>
<li>The URL has query strings (e.g. an URL such as //www.yourdomain.com/product/title-here/?param=1&amp;param_two=value_here)</li>
</ul>
</div>
<hr />
</td>
</tr>
<tr valign="top">
<th scope="row" class="setting_title">
<label for="wpacu_inline_css_files_enable"><?php _e('Inline CSS Files', 'wp-asset-clean-up'); ?></label>
<p class="wpacu_subtitle"><small><em><?php _e('This will work for local (same domain) files. External requests tags will not be altered (e.g. stackpath.bootstrapcdn.com, ajax.googleapis.com etc.).', 'wp-asset-clean-up'); ?></em></small></p>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_inline_css_files_enable"
data-target-opacity="wpacu_inline_css_files_info_area"
type="checkbox"
<?php
echo (($data['inline_css_files'] == 1) ? 'checked="checked"' : '');
?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[inline_css_files]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;<?php _e('This is usually good for small stylesheet files to save the overhead of fetching them and thus reduce the number of HTTP requests', 'wp-asset-clean-up'); ?>. You can choose automatic inlining for CSS files smaller than a specific size (in KB) or manually place the relative paths to the files (e.g. in case there is an exception for a larger file you wish to inline or just don't want to use the automatic inlining).
<?php
$inlineCssFiles = ($data['inline_css_files'] == 1) ? 'opacity: 1;' : 'opacity: 0.4;';
?>
<div id="wpacu_inline_css_files_info_area" style="<?php echo esc_attr($inlineCssFiles); ?>">
<p style="margin-top: 8px; padding: 10px; background: #f2faf2;">
<label for="wpacu_inline_css_files_below_size_checkbox">
<input id="wpacu_inline_css_files_below_size_checkbox"
<?php echo ($data['inline_css_files_below_size'] == 1 ? 'checked="checked"' : ''); ?>
type="checkbox"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[inline_css_files_below_size]"
value="1" />
<?php echo sprintf(__('Inline Stylesheet (.css) Files Smaller Than %s KB', 'wp-asset-clean-up'), '<input type="number" min="1" style="width: 60px;" name="'.WPACU_PLUGIN_ID.'_settings[inline_css_files_below_size_input]" value="'.$data['inline_css_files_below_size_input'].'" />'); ?>
</label>
</p>
<div id="wpacu_inline_css_files_list_area">
<div style="margin: 12px 0 6px;"><?php _e('Alternatively or in addition to automatic inlining, you can place the relative path(s) or part of them to the files you wish to inline below:', 'wp-asset-clean-up'); ?> (<strong><?php _e('one per line', 'wp-asset-clean-up'); ?></strong>):</div>
<p style="margin-top: 8px;"><span class="dashicons dashicons-warning" style="color: #ffc107;"></span> <strong>Note:</strong> Please input the sources to the original CSS files (one per line) like in the examples below, not to the cached/optimized ones (which are usually located in <em><?php echo str_replace(site_url(), '', WP_CONTENT_URL) . OptimizeCommon::getRelPathPluginCacheDir(); ?></em>). RegExes are accepted. Note that the hash (#) is automatically used as delimiter so you don't need to add it below.</p>
<label for="wpacu_inline_css_files_list">
<textarea style="width: 100%;"
rows="4"
id="wpacu_inline_css_files_list"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[inline_css_files_list]"><?php echo esc_textarea($data['inline_css_files_list']); ?></textarea>
</label>
<p style="margin-bottom: 6px;"><strong>Examples</strong> (you don't have to add the full URL, as it's recommended to use relative paths, especially if you use dev/staging environments or change the domain name of your website):</p>
<code>/wp-content/plugins/plugin-title/styles/small-file.css<br />/wp-content/themes/my-wp-theme-dir/css/small.css</code>
</div>
</div>
<hr />
</td>
</tr>
<!-- [wpacu_lite] -->
<!-- Pro Feature -->
<tr valign="top">
<th scope="row" class="setting_title">
<label style="cursor: auto;"><?php _e('Defer CSS Loaded in the <code>&lt;BODY&gt;</code> (Footer)', 'wp-asset-clean-up'); ?> <a class="go-pro-link-no-style" target="_blank" href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=plugin_usage_settings&utm_medium=local_fonts_optimization'); ?>"><span class="wpacu-tooltip" style="width: 186px;"><?php _e('This is a feature available in the Pro version! Unlock it!', 'wp-asset-clean-up'); ?></span> <img style="opacity: 0.6;" width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL.'/assets/icons/icon-lock.svg'); ?>" valign="top" alt="" /></a></label>
</th>
<td>
<div>
<ul style="margin: 0;">
<li style="margin-bottom: 13px;" class="wpacu-fancy-radio"><label for="wpacu_defer_css_loaded_body_moved"><input style="margin: 0;" disabled="disabled" id="wpacu_defer_css_loaded_body_moved" type="radio" name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[defer_css_loaded_body]" checked="checked" /> &nbsp;Yes, for any stylesheet LINK tags moved from HEAD to BODY via Asset CleanUp Pro * <em>default</em></label></li>
<li style="margin-bottom: 13px;" class="wpacu-fancy-radio"><label for="wpacu_defer_css_loaded_body_all"><input style="margin: 0;" disabled="disabled" id="wpacu_defer_css_loaded_body_all" type="radio" name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[defer_css_loaded_body]" /> &nbsp;Yes, for all the stylesheet LINK tags that are moved or already loaded in the BODY</label></li>
<li class="wpacu-fancy-radio"><label for="wpacu_defer_css_loaded_body_no"><input disabled="disabled" id="wpacu_defer_css_loaded_body_no" type="radio" name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[defer_css_loaded_body]" /> &nbsp;No, leave the stylesheet LINK tags from the BODY as they are without any alteration</label></li>
</ul>
</div>
<div>
<p><strong>Note:</strong> By default, any CSS you move from <code>&lt;HEAD&gt;</code> to <code>&lt;BODY&gt;</code> when changing its position (when managing assets via the "CSS & JAVASCRIPT LOAD MANAGER") is deferred. In most cases, CSS loaded in the BODY is not meant to be render-blocking and should start loading later after the HTML document has been completely loaded and parsed. For instance, it could be the styling for a modal box that is showing up later after the page loads or a content slider that is at the bottom of a page and doesn't need to be loaded very soon as it's not needed above the fold.</p>
<p class="wpacu-warning" style="font-size: inherit;">This helps improve "Eliminate render-blocking resources" score in PageSpeed Insights and the browser is rendering the first content of the page sooner (as the CSS is not render-blocking) offering a better user experience.</p>
</div>
</td>
</tr>
<!-- [/wpacu_lite] -->
<tr valign="top">
<th scope="row" class="setting_title">
<label for="wpacu_cache_dynamic_loaded_css_enable"><?php _e('Cache Dynamic Loaded CSS', 'wp-asset-clean-up'); ?></label>
<p class="wpacu_subtitle"><small><span class="dashicons dashicons-warning"></span> <em><?php _e('Please do not enable this option unless you have non-static (dynamic) loaded CSS', 'wp-asset-clean-up'); ?>.</em></small></p>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_cache_dynamic_loaded_css_enable"
data-target-opacity="wpacu_cache_dynamic_loaded_css_info_area"
type="checkbox"
<?php
echo (($data['cache_dynamic_loaded_css'] == 1) ? 'checked="checked"' : '');
?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[cache_dynamic_loaded_css]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;<?php _e('Avoid loading the whole WP environment whenever a dynamic request is made such as <code>/?custom-css=value_here</code>, or <code>/wp-content/plugins/plugin-name-here/css/generate-style.php?ver=1</code>', 'wp-asset-clean-up'); ?>.
<hr />
<p>e.g. <code>&lt;link type="text/css" href="//yourwebsite.com/wp-content/plugins/plugin-name-here/css/generate-style.php?ver=<?php echo esc_html($wp_version); ?>" /&gt;</code></p>
<?php
$cacheDynamicLoadedCssAreaStyle = ($data['cache_dynamic_loaded_css'] == 1) ? 'opacity: 1;' : 'opacity: 0.4;';
?>
<div id="wpacu_cache_dynamic_loaded_css_info_area" style="<?php echo esc_attr($cacheDynamicLoadedCssAreaStyle); ?>">
<p>Some plugins and themes have options to create your own CSS/layout and save it within the Dashboard. Instead of creating static CSS files from the saved settings, the changes you made are retrieved from the database and the CSS content is created "on the fly", thus using more resources by loading the whole WP environment and make MySQL (or whatever database type if used) requests in order to print the CSS content. <?php echo WPACU_PLUGIN_TITLE; ?> detects such requests and caches the output for faster retrieval. This very important especially if your website has lots of visits (imagine WordPress loading several times only from one visitor) and you're on a shared environment with limited resources. This will also make the user experience better by decreasing the page rendering time.</p>
</div>
</td>
</tr>
</table>
</div>
<div id="wpacu-http2-info-css" class="wpacu-modal" style="padding-top: 100px;">
<div class="wpacu-modal-content" style="max-width: 800px;">
<span class="wpacu-close">&times;</span>
<h2 style="margin-top: 5px;"><?php _e('Combining CSS files in HTTP/2 protocol', 'wp-asset-clean-up'); ?></h2>
<p><?php _e('While it\'s still a good idea to combine assets into fewer (or only one) files in HTTP/1 (since you are restricted to the number of open connections), doing the same in HTTP/2 is no longer a performance optimization due to the ability to transfer multiple small files simultaneously without much overhead.', 'wp-asset-clean-up'); ?></p>
<hr />
<p><?php _e('In HTTP/2 some of the issues that were addressed are', 'wp-asset-clean-up'); ?>:</p>
<ul>
<li><strong>Multiplexing</strong>: <?php _e('allows concurrent requests across a single TCP connection', 'wp-asset-clean-up'); ?></li>
<li><strong>Server Push</strong>: <?php _e('whereby a server can push vital resources to the browser before being asked for them.', 'wp-asset-clean-up'); ?></li>
</ul>
<hr />
<p><?php _e('Since HTTP requests are loaded concurrently in HTTP/2, it\'s better to only serve the files that your visitors need and don\'t worry much about concatenation.', 'wp-asset-clean-up'); ?></p>
<p><?php _e('Note that page speed testing tools such as PageSpeed Insights, YSlow, Pingdom Tools or GTMetrix still recommend combining CSS/JS files because they haven\'t updated their recommendations based on HTTP/1 or HTTP/2 protocols so you should take into account the actual load time, not the performance grade.', 'wp-asset-clean-up'); ?></p>
<hr />
<p style="margin-bottom: 12px;"><?php _e('If you do decide to move on with the concatenation (which at least would improve the GTMetrix performance grade from a cosmetic point of view), please remember to <strong>test thoroughly</strong> the pages that have the assets combined (pay attention to any JavaScript errors in the browser\'s console which is accessed via right click &amp; "Inspect") as, in rare cases, due to the order in which the scripts were loaded and the way their code was written, it could break some functionality.', 'wp-asset-clean-up'); ?></p>
</div>
</div>

View File

@ -0,0 +1,560 @@
<?php
/*
* No direct access to this file
*/
use WpAssetCleanUp\Misc;
use WpAssetCleanUp\OptimiseAssets\OptimizeCommon;
if (! isset($data, $selectedTabArea)) {
exit;
}
global $wp_version;
$tabIdArea = 'wpacu-setting-optimize-js';
$styleTabContent = ($selectedTabArea === $tabIdArea) ? 'style="display: table-cell;"' : '';
?>
<div id="<?php echo esc_attr($tabIdArea); ?>" class="wpacu-settings-tab-content" <?php echo wp_kses($styleTabContent, array('style' => array())); ?>>
<h2 class="wpacu-settings-area-title"><?php _e('Minify / Combine loaded JavaScript files to reduce total page size and the number of HTTP requests', 'wp-asset-clean-up'); ?></h2>
<?php
if (Misc::isWpRocketMinifyHtmlEnabled()) {
?>
<div class="wpacu-warning" style="font-size: 13px; margin-bottom: 18px; border: 1px solid #cc000059;">
<span class="dashicons dashicons-warning" style="color: #cc0000;"></span> <strong>Incompatibility Notice:</strong> At this time, "<strong>Combine loaded JS (JavaScript) into fewer files</strong>" option is not taking any effect as "<em>Minify HTML</em>" is active in "WP Rocket" -&gt; "File Optimization" Settings. If you wish to keep WP Rocket's Minify HTML on, consider optimizing JavaScript files with WP Rocket while cleaning the useless JavaScript with <?php echo WPACU_PLUGIN_TITLE; ?>.
</div>
<?php
}
?>
<table class="wpacu-form-table">
<tr valign="top">
<th scope="row" class="setting_title">
<label for="wpacu_minify_js_enable"><?php _e('JavaScript Files Minification', 'wp-asset-clean-up'); ?></label>
<p class="wpacu_subtitle"><small><em><?php _e('Helps decrease the total page size even further', 'wp-asset-clean-up'); ?></em></small></p>
</th>
<td>
<label class="wpacu_switch <?php if (! empty($data['is_optimize_js_enabled_by_other_party'])) { echo 'wpacu_disabled'; } ?>">
<input id="wpacu_minify_js_enable"
data-target-opacity="wpacu_minify_js_area"
type="checkbox"
<?php
echo (($data['minify_loaded_js'] == 1) ? 'checked="checked"' : '');
?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[minify_loaded_js]"
value="1" /> <span class="wpacu_slider wpacu_round"></span></label>
&nbsp;&nbsp;<?php _e('This will take the remaining enqueued JavaScript files, minify them and load them from the cache.', 'wp-asset-clean-up'); ?>
<?php _e('You might want to minify the local files, the inline JS code within SCRIPT tags or both.', 'wp-asset-clean-up'); ?>
<div style="clear: both; margin-top: 12px;"></div>
<?php
if (! empty($data['is_optimize_js_enabled_by_other_party'])) {
?>
<div style="border-left: 4px solid green; background: #f2faf2; padding: 10px; margin-top: 10px;">
<ul style="margin: 0;">
<li>This option is locked as optimize/minify JavaScript (JS) is already enabled in the following plugins: <strong><?php echo implode(', ', $data['is_optimize_js_enabled_by_other_party']); ?></strong>. <?php echo WPACU_PLUGIN_TITLE; ?> works together with the mentioned plugin(s).</li>
<li>Eliminate the bloat first via <a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_assets_manager')); ?>">CSS & JAVASCRIPT LOAD MANAGER</a>, then minify the remaining JS with any plugin you prefer.</li>
</ul>
</div>
<?php
}
$minifyJsExceptionsAreaStyle = empty($data['is_optimize_js_enabled_by_other_party']) && ($data['minify_loaded_js'] == 1) ? 'opacity: 1;' : 'opacity: 0.4;';
?>
<div id="wpacu_minify_js_area" style="<?php echo esc_attr($minifyJsExceptionsAreaStyle); ?>">
<div style="margin-top: 8px; padding: 12px; background: #f2faf2; border-radius: 10px;">
<ul style="margin: 0;">
<li style="float: left; margin-right: 30px; margin-bottom: 0; line-height: 32px;" class="wpacu-fancy-radio">
<label for="minify_loaded_js_for_script_src_radio">
<input id="minify_loaded_js_for_script_src_radio"
style="margin: -1px 0 0;"
<?php echo (in_array($data['minify_loaded_js_for'], array('src', '')) ? 'checked="checked"' : ''); ?>
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[minify_loaded_js_for]"
value="src" />
&nbsp;<?php _e('SCRIPT tags with "src" attribute', 'wp-asset-clean-up'); ?> (<?php _e('default', 'wp-asset-clean-up'); ?>)
</label>
</li>
<li style="float: left; margin-right: 30px; margin-bottom: 0; line-height: 32px;" class="wpacu-fancy-radio">
<label for="minify_loaded_js_for_script_inline_radio">
<input id="minify_loaded_js_for_script_inline_radio"
style="margin: -1px 0 0;"
<?php echo (($data['minify_loaded_js_for'] === 'inline') ? 'checked="checked"' : ''); ?>
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[minify_loaded_js_for]"
value="inline" />
&nbsp;<?php _e('SCRIPT tags with inline JS code ', 'wp-asset-clean-up'); ?>
</label>
</li>
<li style="float: left; margin-bottom: 0; line-height: 32px;" class="wpacu-fancy-radio">
<label for="minify_loaded_js_for_script_all_radio">
<input id="minify_loaded_js_for_script_all_radio"
style="margin: -1px 0 0;"
<?php echo (($data['minify_loaded_js_for'] === 'all') ? 'checked="checked"' : ''); ?>
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[minify_loaded_js_for]"
value="all" />
&nbsp;<?php _e('All SCRIPT tags', 'wp-asset-clean-up'); ?> * <small>both options</small>
</label>
</li>
</ul>
<div style="clear: both;"></div>
</div>
<div id="wpacu_minify_js_exceptions_area">
<div style="margin: 8px 0 6px;"><?php _e('Do not minify the JavaScript files matching the patterns below (one per line)', 'wp-asset-clean-up'); ?>:</div>
<label for="wpacu_minify_js_exceptions">
<textarea style="width: 100%;"
rows="4"
id="wpacu_minify_js_exceptions"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[minify_loaded_js_exceptions]"><?php echo esc_textarea($data['minify_loaded_js_exceptions']); ?></textarea>
</label>
</div>
<ul style="list-style: none; margin-left: 18px; margin-bottom: 0;">
<li style="margin-bottom: 18px;"><span style="color: #ffc107;" class="dashicons dashicons-lightbulb"></span> The CSS/JS cached files will be re-generated once the file version changes (the value from <code>?ver=</code>). In addition, the versioning value from the source will be appended to the new cached CSS/JS file name (e.g. new-file-name-here-ver-1.2).</li>
<li><span style="color: #ffc107;" class="dashicons dashicons-lightbulb"></span> <?php _e('For maximum performance and to reduce server resources, the following JavaScript files will not be minified since they are already optimised and minified by the WordPress core contributors &amp; developers', 'wp-asset-clean-up'); ?>:
<div style="margin: 8px 0 0 28px;">
<ul style="list-style: disc;">
<li>JS WordPress core files that end up in .min.js (e.g. <code>/wp-includes/js/jquery/jquery-migrate.min.js</code>, <code>/wp-includes/js/jquery/ui/datepicker.min.js</code> etc.)</li>
<li><?php echo sprintf(__('jQuery library from %s', 'wp-asset-clean-up'), '<code>/wp-includes/js/jquery/jquery.js</code>'); ?></li>
</ul>
</div>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<td colspan="2" style="padding: 0;">
<div class="wpacu-combine-notice-default wpacu_hide" style="line-height: 22px; background: #f8f8f8; border-left: 4px solid #008f9c; padding: 10px; margin: 0 0 15px;">
<strong><?php _e('NOTE', 'wp-asset-clean-up'); ?>:</strong> <?php _e('Concatenating assets is no longer a recommended practice in HTTP/2', 'wp-asset-clean-up'); ?>. &nbsp; <a data-id="wpacu-http2-info-js" class="wpacu-http2-info-js-target" href="#wpacu-http2-info-js"><?php _e('Read more', 'wp-asset-clean-up'); ?></a> &nbsp;/&nbsp; <a class="wpacu_verify_http2_protocol" target="_blank" href="https://tools.keycdn.com/http2-test"><strong><?php _e('Verify if the website is delivered through the HTTP/2 network protocol', 'wp-asset-clean-up'); ?></strong></a>
</div>
<div class="wpacu-combine-notice-http-2-detected wpacu_hide" style="line-height: 22px; background: #f8f8f8; border-left: 4px solid #008f9c; padding: 10px; margin: 0 0 15px;">
<span class="wpacu_http2_protocol_is_supported" style="color: green; font-weight: 400;"><span class="dashicons dashicons-yes-alt"></span> Your website `<span style="font-weight: 500;"><?php echo get_site_url(); ?></span>` is delivered through the HTTP/2 network protocol, thus the website will be as fast without using this feature which might require maintenance once in a while.</span> <a class="wpacu-http2-info-js-target" href="#wpacu-http2-info-js"><?php _e('Read more', 'wp-asset-clean-up'); ?></a>
</div>
</td>
</tr>
<?php
$wpRocketIsEnabledWithDelayJs = (defined('WPACU_WP_ROCKET_DELAY_JS_ENABLED') && WPACU_WP_ROCKET_DELAY_JS_ENABLED);
$combineJsIsDisabled = (! empty($data['is_optimize_js_enabled_by_other_party']) || $wpRocketIsEnabledWithDelayJs);
?>
<tr valign="top">
<th scope="row" class="setting_title">
<label for="wpacu_combine_loaded_js_enable"><?php _e('Combine loaded JS (JavaScript) into fewer files', 'wp-asset-clean-up'); ?></label>
<p class="wpacu_subtitle"><small><em><?php _e('Helps reducing the number of HTTP Requests even further', 'wp-asset-clean-up'); ?></em></small></p>
</th>
<td>
<label class="wpacu_switch <?php if ($combineJsIsDisabled) { echo 'wpacu_disabled'; } ?>">
<input id="wpacu_combine_loaded_js_enable"
data-target-opacity="wpacu_combine_loaded_js_info_area"
type="checkbox"
<?php
if ($combineJsIsDisabled) {
echo 'disabled="disabled"';
} else {
echo in_array( $data['combine_loaded_js'], array( 'for_admin', 'for_all', 1 ) ) ? 'checked="checked"' : '';
}
?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[combine_loaded_js]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;<small>* if <code style="font-size: inherit;"><?php echo '/'.str_replace(Misc::getWpRootDirPath(), '', WP_CONTENT_DIR) . \WpAssetCleanUp\OptimiseAssets\OptimizeCommon::getRelPathPluginCacheDir(); ?></code> directory is not writable for some reason, this feature will not work; requires the DOMDocument XML DOM Parser to be enabled in PHP (which it is by default) for maximum performance</small>
<?php
if (! empty($data['is_optimize_js_enabled_by_other_party'])) {
?>
<div style="border-left: 4px solid green; background: #f2faf2; padding: 10px; margin-top: 10px;">
<ul style="margin: 0;">
<li>This option is locked as optimize/minify JavaScript (JS) is already enabled in the following plugins: <strong><?php echo implode(', ', $data['is_optimize_js_enabled_by_other_party']); ?></strong>.</li>
<li><?php echo WPACU_PLUGIN_TITLE; ?> works together with the mentioned plugin(s). Eliminate the bloat first via <a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_assets_manager')); ?>">CSS & JAVASCRIPT LOAD MANAGER</a>, then concatenate (if necessary) the JS using any plugin you prefer.</li>
</ul>
</div>
<?php
} elseif ($wpRocketIsEnabledWithDelayJs) {
?>
<div style="border-left: 4px solid green; background: #f2faf2; padding: 10px; margin-top: 10px;">
<ul style="margin: 0;">
<li>This option is locked to avoid any compatibility problems because a similar option is enabled in WP Rocket: <a target="_blank" href="<?php echo admin_url('options-general.php?page=wprocket#file_optimization'); ?>"><em>"FILE OPTIMIZATION" - "JavaScript Files" - "Delay JavaScript execution"</em></a>.</li>
<li>Both WP Rocket &amp; <?php echo WPACU_PLUGIN_TITLE; ?> can be used together as long as features are not mixed.</li>
</ul>
</div>
<?php
}
?>
<div id="wpacu_combine_loaded_js_info_area" <?php if (empty($data['is_optimize_js_enabled_by_other_party'] || $wpRocketIsEnabledWithDelayJs) && in_array($data['combine_loaded_js'], array('for_admin', 'for_all', 1))) { ?> style="opacity: 1;" <?php } else { ?>style="opacity: 0.4;"<?php } ?>>
<div style="margin-top: 8px; padding: 12px; background: #f2faf2; border-radius: 10px;">
<ul style="margin: 0;">
<li style="float: left; margin-right: 30px; margin-bottom: 0; line-height: 32px;" class="wpacu-fancy-radio">
<label for="combine_loaded_js_for_guests_radio">
<input id="combine_loaded_js_for_guests_radio"
style="margin: -1px 0 0;"
<?php echo (in_array($data['combine_loaded_js_for'], array('guests', '')) ? 'checked="checked"' : ''); ?>
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[combine_loaded_js_for]"
value="guests" />
&nbsp;<?php _e('Apply it only for guest visitors', 'wp-asset-clean-up'); ?> (<?php _e('default', 'wp-asset-clean-up'); ?>)
</label>
</li>
<li style="float: left; margin-bottom: 0; line-height: 32px;" class="wpacu-fancy-radio">
<label for="combine_loaded_js_for_all_radio">
<input id="combine_loaded_js_for_all_radio"
style="margin: -1px 0 0;"
<?php echo (($data['combine_loaded_js_for'] === 'all') ? 'checked="checked"' : ''); ?>
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[combine_loaded_js_for]"
value="all" />
&nbsp;<?php _e('Apply it for all visitors (not recommended)', 'wp-asset-clean-up'); ?> * <small>to avoid using extra disk space</small>
</label>
</li>
</ul>
<div style="clear: both;"></div>
</div>
<p style="margin-top: 10px;"><strong>Note:</strong> When a file is added to a combined group of files, the CDATA as well as any other inline content (e.g. added via <code style="font-size: inherit;">wp_add_inline_script()</code>) associated with it will also be added to the combined files. This reduces the number of DOM elements as well makes sure that, in case, the combined file is deferred, the code from the inline tags is triggered at the same time as the one from the file</p>
<div style="padding: 10px; background: #f2faf2;">
<p>
<label for="wpacu_combine_loaded_js_defer_body_checkbox">
<input id="wpacu_combine_loaded_js_defer_body_checkbox"
<?php echo (($data['combine_loaded_js_defer_body'] == 1) ? 'checked="checked"' : ''); ?>
type="checkbox"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[combine_loaded_js_defer_body]"
value="1" />
Defer loading JavaScript combined files from <code>&lt;body&gt;</code> (applies <code>defer="defer"</code> attribute to the combined script tags)
</label>
</p>
<p>
<label for="combine_loaded_js_try_catch_checkbox">
<input id="combine_loaded_js_try_catch_checkbox"
<?php echo (($data['combine_loaded_js_try_catch'] == 1) ? 'checked="checked"' : ''); ?>
type="checkbox"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[combine_loaded_js_try_catch]"
value="1" />
Wrap each JavaScript file included in the combined group in its own <em>try {} catch(e) {}</em> statement in case it has an error and it would affect the execution of the other included files * <small>use it if you have JS errors in the console inside the combined file</small>
</label>
</p>
</div>
<hr />
<div id="wpacu_combine_loaded_js_exceptions_area">
<div style="margin: 0 0 6px;"><?php _e('Do not combine the JavaScript files matching the patterns below (one per line, see pattern examples below)', 'wp-asset-clean-up'); ?>:</div>
<label for="combine_loaded_js_exceptions">
<textarea style="width: 100%;"
rows="4"
id="combine_loaded_js_exceptions"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[combine_loaded_js_exceptions]"><?php echo esc_textarea($data['combine_loaded_js_exceptions']); ?></textarea>
</label>
<p><?php _e('Pattern Examples (you don\'t have to add the full URL, as it\'s recommended to use relative paths)', 'wp-asset-clean-up'); ?>:</p>
<code>/wp-includes/js/admin-bar.min.js<br />/wp-includes/js/masonry.min.js<br />/wp-content/plugins/plugin-title/js/(.*?).js</code>
<div style="margin-top: 15px; margin-bottom: 0;"><hr /></div>
</div>
<!--
-->
<p style="margin: 8px 0;">
<?php _e('This results in as less JS combination groups as possible (this combines all JS files into 2/3 files, keeping their HEAD and BODY locations and most of the inline script tags before them for maximum compatibility)', 'wp-asset-clean-up'); ?> - <span style="color: #0073aa;" class="dashicons dashicons-info"></span> <a id="wpacu-combine-js-method-info-target" href="#wpacu-combine-js-method-info"><?php _e('Read more', 'wp-asset-clean-up'); ?></a>
</p>
<hr />
<div class="clearfix"></div>
<p style="margin: 8px 0;"><span style="color: #ffc107;" class="dashicons dashicons-lightbulb"></span> To be 100% sure everything works fine after activation, consider using the checkbox option above to apply the changes only for logged-in administrator (yourself). If all looks good, you can later uncheck so the changes will apply to everyone.</p>
<hr />
<p style="margin: 8px 0;"><span style="color: #ffc107;" class="dashicons dashicons-lightbulb"></span> Any scripts having "defer" or "async" attributes (which are there for a reason) will be combined in their own groups and not together with other render-blocking scripts.</p>
<hr />
<p style="margin: 8px 0;"><span style="color: #ffc107;" class="dashicons dashicons-lightbulb"></span> This feature will not work <strong>IF</strong>:</p>
<ul style="list-style: disc; margin-left: 35px; margin-bottom: 0;">
<li>"Test Mode" is enabled and a guest (not logged-in) user visits the page, as the feature's ultimate purpose is to make the plugin inactive for non logged-in administrators for ultimate debugging.</li>
<li>The URL has query strings (e.g. an URL such as //www.yourdomain.com/product/title-here/?param=1&amp;param_two=value_here)</li>
</ul>
</div>
<!--
-->
<div id="wpacu-combine-js-method-info" class="wpacu-modal">
<div class="wpacu-modal-content">
<span class="wpacu-close">&times;</span>
<h2><?php _e('How are the JavaScript files combined?', 'wp-asset-clean-up'); ?></h2>
<p style="margin-top: 0;"><?php _e('The plugin scans the remaining JavaScript files (left after cleaning up the unnecessary ones) from the <code>&lt;head&gt;</code> and <code>&lt;body&gt;</code> locations and combines them into one file per each location.', 'wp-asset-clean-up'); ?></p>
<p><?php _e('Any inline JavaScript code associated with the combined scripts, will not be altered or moved in any way.', 'wp-asset-clean-up'); ?></p>
<p><strong><?php _e('Example', 'wp-asset-clean-up'); ?>:</strong> <?php _e('If you have 5 JS files (including jQuery library) loading in the <code>&lt;head&gt;</code> location and 7 JS files loading in <code>&lt;body&gt;</code> location, you will end up with a total of 3 JS files: jQuery library &amp; jQuery Migrate (they are not combined together with other JS files for maximum performance) in 1 file and the 2 JS files for HEAD and BODY, respectively.', 'wp-asset-clean-up'); ?></p>
</div>
</div>
</td>
</tr>
<tr valign="top">
<th scope="row" class="setting_title">
<label for="wpacu_inline_js_files_enable"><?php esc_html_e('Inline JavaScript Files', 'wp-asset-clean-up'); ?>
<a class="go-pro-link-no-style" target="_blank" href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=optimize_js&utm_medium=inline_chosen_js_files'); ?>"><span class="wpacu-tooltip" style="width: 186px;"><?php esc_html_e('This is a feature available in the Pro version! Unlock it!', 'wp-asset-clean-up'); ?></span> <img style="opacity: 0.6;" width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL.'/assets/icons/icon-lock.svg'); ?>" valign="top" alt="" /></a>
</label>
<p class="wpacu_subtitle"><small><em><?php esc_html_e('This will work for local (same domain) files. External requests tags will not be altered (e.g. cdnjs.cloudflare.com, ajax.googleapis.com etc.).', 'wp-asset-clean-up'); ?></em></small></p>
</th>
<td>
<label class="wpacu_switch wpacu_disabled"><!-- Disabled: Available only in the Pro version -->
<input id="wpacu_inline_js_files_enable"
data-target-opacity="wpacu_inline_js_files_info_area"
type="checkbox"
<?php
echo (($data['inline_js_files'] == 1) ? 'checked="checked"' : '');
?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[inline_js_files]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;<?php _e('This is usually good for small JavaScript files to save the overhead of fetching them and thus reduce the number of HTTP requests', 'wp-asset-clean-up'); ?>. You can choose automatic inlining for JS files smaller than a specific size (in KB) or manually place the relative paths to the files (e.g. in case there is an exception for a larger file you wish to inline or just don't want to use the automatic inlining).
<?php
if (! empty($data['is_optimize_js_enabled_by_other_party'])) {
?>
<div style="border-left: 4px solid green; background: #f2faf2; padding: 10px; margin-top: 10px;">
<ul style="margin: 0;">
<li>This option is not available as optimize/minify JavaScript (JS) is already enabled in the following plugins: <strong><?php echo implode(', ', $data['is_optimize_js_enabled_by_other_party']); ?></strong>.</li>
<li><?php echo WPACU_PLUGIN_TITLE; ?> works together with the mentioned plugin(s). Eliminate the bloat first via <a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_assets_manager')); ?>">CSS & JAVASCRIPT LOAD MANAGER</a>, then concatenate (if necessary) the JS using any plugin you prefer.</li>
</ul>
</div>
<?php
}
?>
<div id="wpacu_inline_js_files_info_area" <?php if (empty($data['is_optimize_css_enabled_by_other_party']) && $data['inline_js_files'] == 1) { ?> style="opacity: 1;" <?php } else { ?>style="opacity: 0.4;"<?php } ?>>
<p class="wpacu-warning" style="margin: 10px 0; font-size: 13px; padding: 4px 9px;">
<small><strong style="color: orange;"><span class="dashicons dashicons-warning"></span></strong> Please be extra careful if you decide to use this feature as inlining JavaScript files can be trickier than inlining CSS ones due to the more complex syntax and various attributes that might set to the external JS file such as "async" &amp; "defer" (the content of any JS having this attribute will be wrapped between <code>document.addEventListener('DOMContentLoaded', function() {</code> and <code>});</code>.</small>
</p>
<p style="margin-top: 8px; padding: 10px; background: #f2faf2;">
<label for="wpacu_inline_js_files_below_size_checkbox">
<input id="wpacu_inline_js_files_below_size_checkbox"
<?php echo ($data['inline_js_files_below_size'] == 1 ? 'checked="checked"' : ''); ?>
type="checkbox"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[inline_js_files_below_size]"
value="1" />
<?php echo sprintf(__('Inline JavaScript (.js) Files Smaller Than %s KB', 'wp-asset-clean-up'), '<input type="number" min="1" style="width: 60px;" name="'.WPACU_PLUGIN_ID.'_settings[inline_js_files_below_size_input]" value="'.$data['inline_js_files_below_size_input'].'" />'); ?>
</label>
</p>
<div id="wpacu_inline_js_files_list_area">
<div style="margin: 12px 0 6px;"><?php _e('Alternatively or in addition to automatic inlining, you can place the relative path(s) or part of them to the files you wish to inline below:', 'wp-asset-clean-up'); ?> (<strong><?php _e('one per line', 'wp-asset-clean-up'); ?></strong>):</div>
<p style="margin-top: 8px;"><span class="dashicons dashicons-warning" style="color: #ffc107;"></span> <strong>Note:</strong> Please input the sources to the original JavaScript files (one per line) like in the examples below, not to the cached/optimized ones (which are usually located in <em><?php echo str_replace(site_url(), '', WP_CONTENT_URL) . OptimizeCommon::getRelPathPluginCacheDir(); ?></em>). RegExes are accepted. Note that the hash (#) is automatically used as delimiter so you don't need to add it below.</p>
<label for="wpacu_inline_js_files_list">
<textarea style="width: 100%;"
rows="4"
id="wpacu_inline_js_files_list"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[inline_js_files_list]"><?php echo esc_textarea($data['inline_js_files_list']); ?></textarea>
</label>
<p style="margin-bottom: 6px;"><strong>Examples</strong> (you don't have to add the full URL, as it's recommended to use relative paths, especially if you use dev/staging environments or change the domain name of your website):</p>
<code>/wp-content/plugins/plugin-title/scripts/small-file.js<br />/wp-content/themes/my-wp-theme-dir/js/small.js</code>
</div>
</div>
</td>
</tr>
<tr valign="top">
<th scope="row" class="setting_title">
<label for="wpacu_move_inline_jquery_after_src_tag_enable"><?php _e('Move jQuery Inline Code After jQuery library is called', 'wp-asset-clean-up'); ?></label>
<p class="wpacu_subtitle"><small><em><?php _e('Please enable it only if you have JavaScript errors showing up in the browser\'s console related to jQuery.', 'wp-asset-clean-up'); ?>.</em></small></p>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_move_inline_jquery_after_src_tag_enable"
data-target-opacity="wpacu_move_inline_jquery_after_src_tag_info_area"
type="checkbox"
<?php
echo (($data['move_inline_jquery_after_src_tag'] == 1) ? 'checked="checked"' : '');
?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[move_inline_jquery_after_src_tag]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;<?php _e('Useful in case plugins/themes insert jQuery inline code in the post/page content (e.g. via shortcodes) or inside the HEAD section before jQuery library is called.', 'wp-asset-clean-up'); ?> <span style="color: #0073aa;" class="dashicons dashicons-info"></span> <a id="wpacu-move-inline-jquery-target" href="#wpacu-move-inline-jquery"><?php _e('View Examples', 'wp-asset-clean-up'); ?></a>
<?php
$moveInlineJQueryAfterSrcTagStyle = ($data['move_inline_jquery_after_src_tag'] == 1) ? 'opacity: 1;' : 'opacity: 0.4;';
?>
<div id="wpacu_move_inline_jquery_after_src_tag_info_area" style="<?php echo esc_attr($moveInlineJQueryAfterSrcTagStyle); ?>">
<p><?php _e('This feature moves any of these inline SCRIPT tags after the HTML tag that loads jQuery (generated for the "jquery-core" handle) aiming to fix "jQuery is undefined errors".', 'wp-asset-clean-up'); ?></p>
<p>The option should be enabled if any of the following applies:</p>
<ul style="list-style: disc; margin-left: 20px;">
<li>You have moved "jquery-core" to BODY to reduce render-blocking resources and you get "jQuery is undefined" errors because inline jQuery scripts are loaded (usually hardcoded) before the jQuery library tag.</li>
<li>jQuery already loads in the HEAD (that's the default behaviour), but inline jQuery code is printed (e.g. hardcoded &amp; without using the function <code>wp_add_inline_script()</code> with 'jquery' dependency) before jQuery library's script tag (either from a plugin or the theme).</li>
</ul>
</div>
</td>
</tr>
<!-- [wpacu_pro] -->
<tr valign="top">
<th scope="row" class="setting_title">
<label for="wpacu_move_scripts_to_body_enable"><?php echo wp_kses(__('Move All <code>&lt;SCRIPT&gt;</code> tags From HEAD to BODY', 'wp-asset-clean-up'), array('code' => array())); ?> <a class="go-pro-link-no-style" target="_blank" href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=optimize_js&utm_medium=move_scripts_to_body'); ?>"><span class="wpacu-tooltip" style="width: 186px;"><?php esc_html_e('This is a feature available in the Pro version! Unlock it!', 'wp-asset-clean-up'); ?></span> <img style="opacity: 0.6;" width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" valign="top" alt="" /></a></label>
<p class="wpacu_subtitle"><small><em><?php _e('This triggers late after all other optimizations are applied for maximum compatibility', 'wp-asset-clean-up'); ?>.</em></small></p>
</th>
<td>
<label class="wpacu_switch wpacu_disabled"><!-- Disabled: Available only in the Pro version -->
<input id="wpacu_move_scripts_to_body_enable"
data-target-opacity="wpacu_move_scripts_to_body_info_area"
type="checkbox"
<?php
echo (($data['move_scripts_to_body'] == 1) ? 'checked="checked"' : '');
?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[move_scripts_to_body]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;<?php _e('This is useful if you want to reduce render-blocking resources and it will move all the <code>&lt;SCRIPT&gt;</code> tags (inline &amp; external) right after the <code>&lt;BODY&gt;</code> opening tag', 'wp-asset-clean-up'); ?>. <span style="color: #0073aa;" class="dashicons dashicons-info"></span> <a id="wpacu-move-scripts-to-body-examples-target" href="#wpacu-move-scripts-to-body-examples"><?php _e('View Examples', 'wp-asset-clean-up'); ?></a>
<?php
$moveScriptsToBodyStyle = ($data['move_scripts_to_body'] == 1) ? 'opacity: 1;' : 'opacity: 0.4;';
?>
<div id="wpacu_move_scripts_to_body_info_area" style="<?php echo esc_attr($moveScriptsToBodyStyle); ?>">
<p>The option could be enabled if any of the following applies:</p>
<ul style="list-style: disc; margin-left: 20px;">
<li>There are a few SCRIPT tags left in the HEAD (usually hardcoded and not manageable in the CSS/JS list) and you are sure they can be moved to the BODY without any issues.</li>
<li>jQuery library is loaded in the HEAD (sometimes the only render-blocking resources there) and you had difficulties moving it to the BODY as there are themes/plugins which are hardcoding it in the HEAD or dequeue &amp; enqueue it incorrectly.</li>
</ul>
<p>In case there is JavaScript that you wish to keep in the HEAD, you can add a unique string from the SCRIPT tag(s) in the textarea below (one per line):</p>
<label for="wpacu_move_scripts_to_body_exceptions">
<textarea style="width: 100%;"
rows="4"
id="wpacu_move_scripts_to_body_exceptions"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[move_scripts_to_body_exceptions]"><?php echo esc_textarea($data['move_scripts_to_body_exceptions']); ?></textarea>
</label>
<p><small><strong>Note:</strong> A situation when SCRIPT tags should be loaded in the <code>&lt;HEAD&gt;</code> is when the page gets loaded as an AMP (Accelerated Mobile Page) via various plugins. If have SCRIPT tags loading .js from cdn.ampproject.org, you can add a unique string to the exclusion such as <code>//cdn.ampproject.org/</code> which will detects tags like <code>&lt;script type='text/javascript' src='https://cdn.ampproject.org/v0.js' async&gt;&lt;/script&gt;</code> and keep them in the &lt;HEAD&gt;</small></p>
</div>
</td>
</tr>
<!-- [/wpacu_pro] -->
<tr valign="top">
<th scope="row" class="setting_title">
<label for="wpacu_cache_dynamic_loaded_js_enable"><?php _e('Cache Dynamic Loaded JavaScript', 'wp-asset-clean-up'); ?></label>
<p class="wpacu_subtitle"><small><span class="dashicons dashicons-warning"></span> <em><?php _e('Please do not enable this option unless you have non-static (dynamic) loaded JavaScript', 'wp-asset-clean-up'); ?>.</em></small></p>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_cache_dynamic_loaded_js_enable"
data-target-opacity="wpacu_cache_dynamic_loaded_js_info_area"
type="checkbox"
<?php
echo (($data['cache_dynamic_loaded_js'] == 1) ? 'checked="checked"' : '');
?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[cache_dynamic_loaded_js]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;<?php _e('Avoid loading the whole WP environment whenever a dynamic request is made such as <code>/?custom-javascript=value_here</code>, or <code>/wp-content/plugins/plugin-name-here/js/generate-script-output.php?ver=1</code>', 'wp-asset-clean-up'); ?>
<p>e.g. <code>&lt;script type="text/javascript" src="//yourwebsite.com/wp-content/plugins/plugin-name-here/js/generate-script-output.php?ver=<?php echo esc_html($wp_version); ?>"&gt;&lt;/script&gt;</code></p>
<hr />
<?php
$cacheDynamicLoadedJsAreaStyle = ($data['cache_dynamic_loaded_js'] == 1) ? 'opacity: 1;' : 'opacity: 0.4;';
?>
<div id="wpacu_cache_dynamic_loaded_js_info_area" style="<?php echo esc_attr($cacheDynamicLoadedJsAreaStyle); ?>">
<p>Some plugins and themes have options to create your own layout / customise specific functionality settings and save the changes from the Dashboard. Instead of creating static JS files from the saved settings, the changes you made are retrieved from the database and the JavaScript content is created "on the fly", thus using more resources by loading the whole WP environment and make MySQL (or whatever database type if used) requests in order to print the JavaScript content. <?php echo WPACU_PLUGIN_TITLE; ?> detects such requests and caches the output for faster retrieval. This very important especially if your website has lots of visits (imagine WordPress loading several times only from one visitor) and you're on a shared environment with limited resources. This will also make the user experience better by decreasing the page rendering time.</p>
</div>
</td>
</tr>
</table>
</div>
<div id="wpacu-http2-info-js" class="wpacu-modal" style="padding-top: 100px;">
<div class="wpacu-modal-content" style="max-width: 800px;">
<span class="wpacu-close">&times;</span>
<h2 style="margin-top: 5px;"><?php _e('Combining JavaScript files in HTTP/2 protocol', 'wp-asset-clean-up'); ?></h2>
<p><?php _e('While it\'s still a good idea to combine assets into fewer (or only one) files in HTTP/1 (since you are restricted to the number of open connections), doing the same in HTTP/2 is no longer a performance optimization due to the ability to transfer multiple small files simultaneously without much overhead.', 'wp-asset-clean-up'); ?></p>
<hr />
<p><?php _e('In HTTP/2 some of the issues that were addressed are', 'wp-asset-clean-up'); ?>:</p>
<ul>
<li><strong>Multiplexing</strong>: <?php _e('allows concurrent requests across a single TCP connection', 'wp-asset-clean-up'); ?></li>
<li><strong>Server Push</strong>: <?php _e('whereby a server can push vital resources to the browser before being asked for them.', 'wp-asset-clean-up'); ?></li>
</ul>
<hr />
<p><?php _e('Since HTTP requests are loaded concurrently in HTTP/2, it\'s better to only serve the files that your visitors need and don\'t worry much about concatenation.', 'wp-asset-clean-up'); ?></p>
<p><?php _e('Note that page speed testing tools such as PageSpeed Insights, YSlow, Pingdom Tools or GTMetrix still recommend combining CSS/JS files because they haven\'t updated their recommendations based on HTTP/1 or HTTP/2 protocols so you should take into account the actual load time, not the performance grade.', 'wp-asset-clean-up'); ?></p>
<hr />
<p style="margin-bottom: 12px;"><?php _e('If you do decide to move on with the concatenation (which at least would improve the GTMetrix performance grade from a cosmetic point of view), please remember to <strong>test thoroughly</strong> the pages that have the assets combined (pay attention to any JavaScript errors in the browser\'s console which is accessed via right click &amp; "Inspect") as, in rare cases, due to the order in which the scripts were loaded and the way their code was written, it could break some functionality.', 'wp-asset-clean-up'); ?></p>
</div>
</div>
<div id="wpacu-move-inline-jquery" class="wpacu-modal" style="padding-top: 80px;">
<div class="wpacu-modal-content" style="max-width: 800px;">
<span class="wpacu-close">&times;</span>
<h2 style="margin-top: 5px;"><?php _e('Examples of jQuery related inline code moved after the library is called', 'wp-asset-clean-up'); ?></h2>
<p><strong>Example #1 (without jQuery Migrate loaded)</strong></p>
<span>FROM</span>
<p style="margin-top: 0;">
<code>&lt;script type="text/javascript"&gt;jQuery(document).ready(function($) { /* code here */ });&lt;/script&gt;</code><br />
<code>&lt;script type="text/javascript" src="/wp-includes/js/jquery.js"&gt;&lt;/script&gt;</code>
</p>
<span>TO</span>
<p style="margin-top: 0;">
<code>&lt;script type="text/javascript" src="/wp-includes/js/jquery.js"&gt;&lt;/script&gt;</code><br />
<code>&lt;script type="text/javascript"&gt;jQuery(document).ready(function($) { /* code here */ });&lt;/script&gt;</code>
</p>
<hr />
<p><strong>Example #2 (with jQuery Migrate loaded)</strong></p>
<span>FROM</span>
<p style="margin-top: 0;">
<code>&lt;script type="text/javascript"&gt;jQuery(document).ready(function($) { /* code here */ });&lt;/script&gt;</code><br />
<code>&lt;script type="text/javascript"&gt;$(document).ready(function() { /* another code here */ });&lt;/script&gt;</code><br />
<code>&lt;script type="text/javascript" src="/wp-includes/js/jquery.js"&gt;&lt;/script&gt;</code><br />
<code>&lt;script type="text/javascript" src="/wp-includes/js/jquery-migrate.min.js"&gt;&lt;/script&gt;</code>
</p>
<span>TO</span>
<p style="margin-top: 0;">
<code>&lt;script type="text/javascript" src="/wp-includes/js/jquery.js"&gt;&lt;/script&gt;</code><br />
<code>&lt;script type="text/javascript" src="/wp-includes/js/jquery-migrate.min.js"&gt;&lt;/script&gt;</code><br />
<code>&lt;script type="text/javascript"&gt;jQuery(document).ready(function($) { /* code here */ });&lt;/script&gt;</code><br />
<code>&lt;script type="text/javascript"&gt;$(document).ready(function() { /* another code here */ });&lt;/script&gt;</code>
</p>
</div>
</div>
<div id="wpacu-move-scripts-to-body-examples" class="wpacu-modal" style="padding-top: 70px;">
<div class="wpacu-modal-content" style="max-width: 800px;">
<span class="wpacu-close">&times;</span>
<h2 style="margin-top: 5px;"><?php _e('Examples of SCRIPTS moved from HEAD to BODY', 'wp-asset-clean-up'); ?></h2>
<span><strong>FROM</strong></span>
<pre style="margin-top: 4px; margin-bottom: 8px; white-space: pre;">
<code>&lt;head&gt;</code>
<code>&lt;title&gt;Your page title here&lt;/title&gt;</code>
<code>...</code>
<code>...</code>
<code>&lt;script type="text/javascript" src="/wp-includes/js/jquery.js"&gt;&lt;/script&gt;</code>
<code>&lt;script type="text/javascript"&gt;/* code here */&lt;/script&gt;</code>
<code>&lt;/head&gt;</code>
<code>&lt;body&gt;</code>
<code>...</code>
<code>&lt;/body&gt;</code>
</pre>
<div style="margin-top: -6px; margin-bottom: 14px;"><hr /></div>
<span><strong>TO</strong></span>
<pre style="margin-top: 4px; margin-bottom: 0; white-space: pre;">
<code>&lt;head&gt;</code>
<code>&lt;title>Your page title here&lt;/title&gt;</code>
<code>...</code>
<code>...</code>
<code>&lt;/head&gt;</code>
<code>&lt;body&gt;</code>
<code>&lt;script type="text/javascript" src="/wp-includes/js/jquery.js"&gt;&lt;/script&gt;</code>
<code>&lt;script type="text/javascript"&gt;/* code here */&lt;/script&gt;</code>
<code>...</code>
<code>&lt;/body&gt;</code>
</pre>
</div>
</div>

View File

@ -0,0 +1,525 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data, $selectedTabArea)) {
exit;
}
use WpAssetCleanUp\Misc;
$tabIdArea = 'wpacu-setting-plugin-usage-settings';
$styleTabContent = ($selectedTabArea === $tabIdArea) ? 'style="display: table-cell;"' : '';
$postTypesList = get_post_types(array('public' => true));
// Hide hardcoded irrelevant post types
foreach (\WpAssetCleanUp\MetaBoxes::$noMetaBoxesForPostTypes as $noMetaBoxesForPostType) {
unset($postTypesList[$noMetaBoxesForPostType]);
}
?>
<div id="<?php echo esc_attr($tabIdArea); ?>" class="wpacu-settings-tab-content" <?php echo wp_kses($styleTabContent, array('style' => array())); ?>>
<h2 class="wpacu-settings-area-title"><?php _e('General &amp; Files Management', 'wp-asset-clean-up'); ?></h2>
<p><?php _e('Choose how the assets are retrieved and whether you would like to see them within the Dashboard / Front-end view', 'wp-asset-clean-up'); ?>; <?php _e('Decide how the management list of CSS &amp; JavaScript files will show up and get sorted, depending on your preferences.', 'wp-asset-clean-up'); ?></p>
<table class="wpacu-form-table">
<tr valign="top">
<th scope="row">
<label for="wpacu_dashboard"><?php _e('Manage in the Dashboard', 'wp-asset-clean-up'); ?></label>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_dashboard"
data-target-opacity="wpacu_manage_dashboard_assets_list"
type="checkbox"
<?php echo (($data['dashboard_show'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[dashboard_show]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;
<?php _e('This will show the list of assets in a meta box on edit the post (any type) / page within the Dashboard', 'wp-asset-clean-up'); ?>
<div id="wpacu_manage_dashboard_assets_list" <?php if ($data['dashboard_show'] != 1) { echo 'style="opacity: 0.4;"'; } ?>>
<p><?php _e('The assets would be retrieved via AJAX call(s) that will fetch the post/page URL and extract all the styles &amp; scripts that are enqueued.', 'wp-asset-clean-up'); ?></p>
<p><?php _e('Note that sometimes the assets list is not loading within the Dashboard. That could be because "mod_security" Apache module is enabled or some security plugins are blocking the AJAX request. If this option doesn\'t work, consider managing the list in the front-end view.', 'wp-asset-clean-up'); ?></p>
<div id="wpacu-settings-assets-retrieval-mode" <?php if (! ($data['dashboard_show'] == 1)) { echo 'style="display: none;"'; } ?>>
<ul id="wpacu-dom-get-type-selections">
<li>
<label><?php _e('Select a retrieval way', 'wp-asset-clean-up'); ?>:</label>
</li>
<li>
<label>
<input class="wpacu-dom-get-type-selection"
data-target="wpacu-dom-get-type-direct-info"
<?php if ($data['dom_get_type'] === 'direct') { ?>checked="checked"<?php } ?>
type="radio" name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[dom_get_type]"
value="direct" /> <?php _e('Direct', 'wp-asset-clean-up'); ?>
</label>
</li>
<li>
<label>
<input class="wpacu-dom-get-type-selection"
data-target="wpacu-dom-get-type-wp-remote-post-info"
<?php if ($data['dom_get_type'] === 'wp_remote_post') { ?>checked="checked"<?php } ?>
type="radio" name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[dom_get_type]"
value="wp_remote_post" /> WP Remote Post
</label>
</li>
</ul>
<div class="wpacu_clearfix" style="height: 0;"></div>
<ul id="wpacu-dom-get-type-infos">
<li <?php if ($data['dom_get_type'] !== 'direct') { ?>style="display: none;"<?php } ?>
class="wpacu-dom-get-type-info"
id="wpacu-dom-get-type-direct-info">
<strong><?php _e('Direct', 'wp-asset-clean-up'); ?></strong> - <?php _e('This one makes an AJAX call directly on the URL for which the assets are retrieved, then an extra WordPress AJAX call to process the list. Sometimes, due to some external factors (e.g. mod_security module from Apache, security plugin or the fact that non-http is forced for the front-end view and the AJAX request will be blocked), this might not work and another choice method might work better. This used to be the only option available, prior to version 1.2.4.4 and is set as default.', 'wp-asset-clean-up'); ?>
</li>
<li <?php if ($data['dom_get_type'] !== 'wp_remote_post') { ?>style="display: none;"<?php } ?>
class="wpacu-dom-get-type-info"
id="wpacu-dom-get-type-wp-remote-post-info">
<strong>WP Remote Post</strong> - <?php _e('It makes a WordPress AJAX call and gets the HTML source code through wp_remote_post(). This one is less likely to be blocked as it is made on the same protocol (no HTTP request from HTTPS). However, in some cases (e.g. a different load balancer configuration), this might not work when the call to fetch a domain\'s URL (your website) is actually made from the same domain.', 'wp-asset-clean-up'); ?>
</li>
</ul>
</div>
<hr /><div class="wpacu_clearfix" style="height: 0;"></div>
<input type="hidden" name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[show_assets_meta_box]" value="0" />
<fieldset style="margin: 15px 0 0 0; padding: 10px; border: 1px solid #8c8f94; border-radius: 10px;">
<legend style="border: 1px solid #8c8f94; padding: 10px; border-radius: 10px;"><label for="wpacu-show-assets-meta-box-checkbox"><input <?php echo (($data['show_assets_meta_box'] == 1) ? 'checked="checked"' : ''); ?> id="wpacu-show-assets-meta-box-checkbox" type="checkbox" name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[show_assets_meta_box]" value="1" /> Show "<?php echo WPACU_PLUGIN_TITLE; ?>: CSS &amp; JavaScript Manager / Page Options" meta box (applies only to edit post/page/taxonomy area)</label></legend>
<div id="wpacu-show-assets-enabled-area" style="<?php echo (! $data['show_assets_meta_box']) ? 'display: none;' : ''; ?>">
<p style="margin-top: 8px;"><?php _e('When you are in the Dashboard and edit a post, page, custom post type, category or custom taxonomy and rarely manage loaded CSS/JS from the "Asset CleanUp: CSS & JavaScript Manager", you can choose to fetch the list when you click on a button. This will help declutter the edit page on load and also save resources as AJAX calls to the front-end won\'t be made to retrieve the assets\' list.', 'wp-asset-clean-up'); ?></p>
<ul style="margin-bottom: 0;">
<li>
<label for="assets_list_show_status_default">
<input id="assets_list_show_status_default"
<?php if (! $data['assets_list_show_status'] || $data['assets_list_show_status'] === 'default') { ?>checked="checked"<?php } ?>
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[assets_list_show_status]"
value="default" /> <?php _e('Fetch the assets automatically and show the list', 'wp-asset-clean-up'); ?> (<?php _e('Default', 'wp-asset-clean-up'); ?>)
</label>
</li>
<li>
<label for="assets_list_show_status_fetch_on_click">
<input id="assets_list_show_status_fetch_on_click"
<?php if ($data['assets_list_show_status'] === 'fetch_on_click') { ?>checked="checked"<?php } ?>
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[assets_list_show_status]"
value="fetch_on_click" /> <?php _e('Fetch the assets on a button click', 'wp-asset-clean-up'); ?>
</label>
</li>
</ul><div class="wpacu_clearfix" style="height: 0; clear: both;"></div>
<hr />
<div id="wpacu-settings-hide-meta-boxes">
<label for="wpacu-hide-meta-boxes-for-post-types">Hide the meta box for the following public post types (multiple selection drop-down):</label><br />
<select style="margin-top: 4px; min-width: 340px;"
id="wpacu-hide-meta-boxes-for-post-types"
<?php if ($data['input_style'] !== 'standard') { ?>
data-placeholder="Choose Post Type(s)..."
class="wpacu_chosen_select"
<?php } ?>
multiple="multiple"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[hide_meta_boxes_for_post_types][]">
<?php foreach ($postTypesList as $postTypeKey => $postTypeValue) { ?>
<option <?php if (in_array($postTypeKey, $data['hide_meta_boxes_for_post_types'])) { echo 'selected="selected"'; } ?>
value="<?php echo esc_attr($postTypeKey); ?>"><?php echo esc_html($postTypeValue); ?></option>
<?php } ?>
</select>
<p id="wpacu-hide-meta-boxes-for-post-types-info" style="margin-top: 4px;"><small>Sometimes, you might have a post type marked as 'public', but it's not queryable or doesn't have a public URL of its own, making the assets list irrelevant. Or, you have finished optimising pages for a particular post type and you wish to have the assets list hidden. You can choose to hide the meta boxes for these particular post types.</small></p>
</div>
</div>
<div id="wpacu-show-assets-disabled-area" style="<?php echo ($data['show_assets_meta_box'] == 1) ? 'display: none;' : ''; ?>">
<p>In order to view the options related to the CSS &amp; JS manager meta box located within the edit post/page/taxonomy area, the above option needs to be enabled.</p>
</div>
</fieldset>
</div>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="wpacu_frontend"><?php _e('Manage in the Front-end', 'wp-asset-clean-up'); ?></label>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_frontend"
data-target-opacity="wpacu_frontend_manage_assets_list"
type="checkbox"
<?php echo (($data['frontend_show'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[frontend_show]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;
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).
<div id="wpacu_frontend_manage_assets_list" <?php if ($data['frontend_show'] != 1) { echo 'style="opacity: 0.4;"'; } ?>>
<p style="margin-top: 10px;">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>&lt;/body&gt;</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.</p>
<div id="wpacu-settings-frontend-exceptions" <?php if (! ($data['frontend_show'] == 1)) { echo 'style="display: none;"'; } ?>>
<div style="margin: 0 0 10px;"><label for="wpacu_frontend_show_exceptions"><span class="dashicons dashicons-info"></span> In some situations, you might want to avoid showing the CSS/JS list at the bottom of the pages (e.g. you're using a page builder such as Divi, you often load specific pages as an admin and you don't need to manage assets there or you do it rarely etc.). If that's the case, you can use the following textarea to prevent the list from showing up on pages where the <strong>URI contains</strong> the specified strings (<?php _e('one per line', 'wp-asset-clean-up'); ?>):</label></div>
<textarea id="wpacu_frontend_show_exceptions"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[frontend_show_exceptions]"
rows="5"
style="width: 100%;"><?php echo esc_textarea($data['frontend_show_exceptions']); ?></textarea>
<p><strong>Example:</strong> If the URI contains <strong>et_fb=1</strong> which triggers the front-end Divi page builder, then you can specify it in the list above (it's added by default) to prevent the asset list from showing below the page builder area.</p>
</div>
</div>
</td>
</tr>
<tr valign="top">
<th scope="row" class="setting_title">
<label for="wpacu_frontend"><?php _e('Allow managing assets to:', 'wp-asset-clean-up'); ?></label>
<p class="wpacu_subtitle"><small><em><?php _e('Only the chosen administrators will have access to the plugin\'s CSS &amp; JS Manager.', 'wp-asset-clean-up'); ?></em></small></p>
</th>
<td>
<?php
$currentUserId = get_current_user_id();
$args = array(
'role' => 'administrator',
'orderby' => 'user_nicename',
'order' => 'ASC'
);
$users = get_users( $args );
?>
<select style="vertical-align: top;" id="wpacu-allow-manage-assets-to-select" name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[allow_manage_assets_to]">
<option <?php if (in_array($data['allow_manage_assets_to'], array('', 'any_admin'))) { ?>selected="selected"<?php } ?> value="any_admin">any administrator</option>
<option <?php if ($data['allow_manage_assets_to'] === 'chosen') { ?>selected="selected"<?php } ?> value="chosen">only to the following administrator(s):</option>
</select>
&nbsp;
<div <?php if (in_array($data['allow_manage_assets_to'], array('', 'any_admin'))) { ?>class="wpacu_hide"<?php } ?>
id="wpacu-allow-manage-assets-to-select-list-area">
<select id="wpacu-allow-manage-assets-to-select-list"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[allow_manage_assets_to_list][]"
<?php if ($data['input_style'] !== 'standard') { ?>
data-placeholder="Choose the admin(s) who will access the list..."
<?php } ?>
multiple="multiple">
<?php
foreach ( $users as $user ) {
$appendText = $selected = '';
if ($currentUserId === $user->ID) {
$appendText = ' &#10141; yourself';
}
if (isset($data['allow_manage_assets_to_list']) && is_array($data['allow_manage_assets_to_list']) && in_array($user->ID, $data['allow_manage_assets_to_list'])) {
$selected = 'selected="selected"';
}
echo '<option '.$selected.' value="'.$user->ID.'">' . esc_html( $user->display_name ) . ' (' . esc_html( $user->user_email ) . ')'.$appendText.'</option>';
}
?>
</select>
<div style="margin: 2px 0 0;"><small>This is a multiple selection drop-down. If nothing is chosen from the list, it will default to "any administrator".</small></div>
</div>
<div style="margin: 10px 0 0;"><p>Some people that have admin access might be confused by the CSS/JS manager (which could be for the developer of the website). If they are mostly editing articles, updating WooCommerce products and so on, there's no point for them to keep seeing a cluttered edit post/page with CSS/JS assets that can even be changed by mistake. You can leave this only to the developers with "administrator" roles.</p></div>
</td>
</tr>
<tr valign="top">
<th scope="row" class="setting_title">
<label for="wpacu_assets_list_layout"><?php _e('Assets List Layout', 'wp-asset-clean-up'); ?></label>
<p class="wpacu_subtitle"><small><em><?php _e('You can decide how would you like to view the list of the enqueued CSS &amp; JavaScript', 'wp-asset-clean-up'); ?></em></small></p>
</th>
<td>
<label>
<?php echo \WpAssetCleanUp\Settings::generateAssetsListLayoutDropDown($data['assets_list_layout'], WPACU_PLUGIN_ID . '_settings[assets_list_layout]' ); ?>
</label>
<div id="wpacu-assets-list-by-location-selected" style="margin: 10px 0; <?php if ($data['assets_list_layout'] !== 'by-location') { ?> display: none; <?php } ?>">
<div style="margin-bottom: 6px;"><?php _e('When list is grouped by location, keep the assets from each of the plugins in the following state', 'wp-asset-clean-up'); ?>:</div>
<ul class="assets_list_layout_areas_status_choices">
<li>
<label for="assets_list_layout_plugin_area_status_expanded">
<input id="assets_list_layout_plugin_area_status_expanded"
<?php if (! $data['assets_list_layout_plugin_area_status'] || $data['assets_list_layout_plugin_area_status'] === 'expanded') { ?>checked="checked"<?php } ?>
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[assets_list_layout_plugin_area_status]"
value="expanded"> <?php _e('Expanded', 'wp-asset-clean-up'); ?> (<?php _e('Default', 'wp-asset-clean-up'); ?>)
</label>
</li>
<li>
<label for="assets_list_layout_plugin_area_status_contracted">
<input id="assets_list_layout_plugin_area_status_contracted"
<?php if ($data['assets_list_layout_plugin_area_status'] === 'contracted') { ?>checked="checked"<?php } ?>
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[assets_list_layout_plugin_area_status]"
value="contracted"> <?php _e('Contracted', 'wp-asset-clean-up'); ?>
</label>
</li>
</ul>
<div class="clear"></div>
</div>
<div class="wpacu_clearfix"></div>
<p style="margin-top: 8px;"><?php _e('These are various ways in which the list of assets that you will manage will show up. Depending on your preference, you might want to see the list of styles &amp; scripts first, or all together sorted in alphabetical order etc.', 'wp-asset-clean-up'); ?> <?php _e('Options that are disabled are available in the Pro version.', 'wp-asset-clean-up'); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label><?php _e('On Assets List Layout Load, keep the groups:', 'wp-asset-clean-up'); ?></label>
</th>
<td>
<ul class="assets_list_layout_areas_status_choices">
<li>
<label for="assets_list_layout_areas_status_expanded">
<input id="assets_list_layout_areas_status_expanded"
<?php if (! $data['assets_list_layout_areas_status'] || $data['assets_list_layout_areas_status'] === 'expanded') { ?>checked="checked"<?php } ?>
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[assets_list_layout_areas_status]"
value="expanded"> <?php _e('Expanded', 'wp-asset-clean-up'); ?> (<?php _e('Default', 'wp-asset-clean-up'); ?>)
</label>
</li>
<li>
<label for="assets_list_layout_areas_status_contracted">
<input id="assets_list_layout_areas_status_contracted"
<?php if ($data['assets_list_layout_areas_status'] === 'contracted') { ?>checked="checked"<?php } ?>
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[assets_list_layout_areas_status]"
value="contracted"> <?php _e('Contracted', 'wp-asset-clean-up'); ?>
</label>
</li>
</ul>
<div class="wpacu_clearfix"></div>
<p><?php _e('Sometimes, when you have plenty of elements in the edit page, you might want to contract the list of assets when you\'re viewing the page as it will save space. This can be a good practice, especially when you finished optimising the pages and you don\'t want to keep seeing the long list of files every time you edit a page.', 'wp-asset-clean-up'); ?></p>
<p><strong><?php _e('Note', 'wp-asset-clean-up'); ?>:</strong> <?php _e('This does not include the assets rows within the groups which are expanded &amp; contracted individually, depending on your preference.', 'wp-asset-clean-up'); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label><?php _e('On Assets List Layout Load, keep "Inline code associated with this handle" area', 'wp-asset-clean-up'); ?>:</label>
</th>
<td>
<ul class="assets_list_inline_code_status_choices">
<li>
<label for="assets_list_inline_code_status_contracted">
<input id="assets_list_inline_code_status_contracted"
<?php if ($data['assets_list_inline_code_status'] === 'contracted') { ?>checked="checked"<?php } ?>
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[assets_list_inline_code_status]"
value="contracted"> <?php _e('Contracted', 'wp-asset-clean-up'); ?> (<?php _e('Default', 'wp-asset-clean-up'); ?>)
</label>
</li>
<li>
<label for="assets_list_inline_code_status_expanded">
<input id="assets_list_inline_code_status_expanded"
<?php if (! $data['assets_list_inline_code_status'] || $data['assets_list_inline_code_status'] === 'expanded') { ?>checked="checked"<?php } ?>
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[assets_list_inline_code_status]"
value="expanded"> <?php _e('Expanded', 'wp-asset-clean-up'); ?>
</label>
</li>
</ul>
<div class="wpacu_clearfix"></div>
<p><?php echo sprintf(
__('Some assets (CSS &amp; JavaScript) have inline code associate with them and often, they are quite large, making the asset row bigger and requiring you to scroll more until you reach a specific area. By setting it to "%s", it will hide all the inline code by default and you can view it by clicking on the toggle link inside the asset row.', 'wp-asset-clean-up'),
__('Contracted', 'wp-asset-clean-up')
); ?></p>
</td>
</tr>
<tr valign="top">
<th scope="row" class="setting_title">
<label><?php _e('Input Fields Style', 'wp-asset-clean-up'); ?>:</label>
<p class="wpacu_subtitle"><small><em><?php _e('How would you like to view the checkboxes / selectors?', 'wp-asset-clean-up'); ?></em></small></p>
<p class="wpacu_read_more"><a href="https://assetcleanup.com/docs/?p=95" target="_blank"><?php _e('Read More', 'wp-asset-clean-up'); ?></a></p>
</th>
<td>
<ul class="input_style_choices">
<li>
<label for="input_style_enhanced">
<input id="input_style_enhanced"
<?php if (! $data['input_style'] || $data['input_style'] === 'enhanced') { ?>checked="checked"<?php } ?>
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[input_style]"
value="enhanced"> <?php _e('Enhanced iPhone Style (Default)', 'wp-asset-clean-up'); ?>
</label>
</li>
<li>
<label for="input_style_standard">
<input id="input_style_standard"
<?php if ($data['input_style'] === 'standard') { ?>checked="checked"<?php } ?>
type="radio"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[input_style]"
value="standard"> <?php _e('Standard', 'wp-asset-clean-up'); ?>
</label>
</li>
</ul>
<div class="wpacu_clearfix"></div>
<p><?php _e('In case you prefer standard HTML checkboxes instead of the enhanced CSS3 iPhone style ones (on &amp; off) or you need a simple HTML layout in case you\'re using a screen reader software (e.g. for people with disabilities) which requires standard/clean HTML code, then you can choose "Standard" as an option.', 'wp-asset-clean-up'); ?> <span style="color: #004567;" class="dashicons dashicons-info"></span> <a href="https://assetcleanup.com/docs/?p=95" target="_blank">Read more</a></p>
</td>
</tr>
<tr valign="top">
<th scope="row" class="setting_title">
<label><?php echo sprintf(__('Hide %s menus', 'wp-asset-clean-up'), '"'.WPACU_PLUGIN_TITLE.'"'); ?></label>
<p class="wpacu_subtitle"><small><em><?php _e('Are you rarely using the plugin and want to make some space in the admin menus?', 'wp-asset-clean-up'); ?></em></small></p>
</th>
<td>
<ul style="padding: 0;">
<li style="margin-bottom: 14px;">
<label for="wpacu_hide_from_admin_bar">
<input id="wpacu_hide_from_admin_bar"
type="checkbox"
<?php echo (($data['hide_from_admin_bar'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[hide_from_admin_bar]"
value="1" /> <span class="wpacu_slider wpacu_round"></span>
<span>Hide it from the top admin bar</span> / This could be useful if your top admin bar is filled with too many items and you rarely use the plugin.</label> <span style="color: #004567;" class="dashicons dashicons-info"></span> <a href="https://assetcleanup.com/docs/?p=187" target="_blank">Read more</a>
</li>
<li>
<label for="wpacu_hide_from_side_bar">
<input id="wpacu_hide_from_side_bar"
type="checkbox"
<?php echo (($data['hide_from_side_bar'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[hide_from_side_bar]"
value="1" /> <span class="wpacu_slider wpacu_round"></span>
<span>Hide it from the left sidebar within the Dashboard</span> / The only access will be from <em>"Settings" -&gt; "<?php echo WPACU_PLUGIN_TITLE; ?>"</em>.</label> <span style="color: #004567;" class="dashicons dashicons-info"></span> <a href="https://assetcleanup.com/docs/?p=584" target="_blank">Read more</a>
</li>
</ul>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="wpacu_hide_core_files"><?php _e('Hide WordPress Core Files From The Assets List?', 'wp-asset-clean-up'); ?></label>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_hide_core_files"
type="checkbox"
<?php echo (($data['hide_core_files'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[hide_core_files]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;
<?php echo sprintf(__('WordPress Core Files have handles such as %s', 'wp-asset-clean-up'), "'jquery', 'wp-embed', 'comment-reply', 'dashicons'"); ?> etc.
<p style="margin-top: 10px;"><?php _e('They should only be unloaded by experienced developers when they are convinced that are not needed in particular situations. It\'s better to leave them loaded if you have any doubts whether you need them or not. By hiding them in the assets management list, you will see a smaller assets list (easier to manage) and you will avoid updating by mistake any option (unload, async, defer) related to any core file.', 'wp-asset-clean-up'); ?></p>
</td>
</tr>
<tr valign="top" id="wpacu-settings-allow-usage-tracking">
<th scope="row">
<label for="wpacu_allow_usage_tracking"><?php _e('Allow Usage Tracking', 'wp-asset-clean-up'); ?></label>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_allow_usage_tracking"
type="checkbox"
<?php echo (($data['allow_usage_tracking'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[allow_usage_tracking]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;
Allow <?php echo WPACU_PLUGIN_TITLE; ?> to anonymously track plugin usage in order to help us make the plugin better? No sensitive or personal data is collected. <span style="color: #004567;" class="dashicons dashicons-info"></span> <a id="wpacu-show-tracked-data-list-modal-target" href="#wpacu-show-tracked-data-list-modal">What kind of data will be sent for the tracking?</a>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="wpacu_fetch_cached_files_details_from"><?php _e('Fetch assets\' caching information from:', 'wp-asset-clean-up'); ?></label>
</th>
<td>
<select id="wpacu_fetch_cached_files_details_from"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[fetch_cached_files_details_from]">
<option <?php if ($data['fetch_cached_files_details_from'] === 'disk') { ?>selected="selected"<?php } ?> value="disk">Disk (default)</option>
<option <?php if ($data['fetch_cached_files_details_from'] === 'db') { ?>selected="selected"<?php } ?> value="db">Database</option>
<option <?php if ($data['fetch_cached_files_details_from'] === 'db_disk') { ?>selected="selected"<?php } ?> value="db_disk">Database &amp; Disk (50% / 50%)</option>
</select> &nbsp; <span style="color: #004567; vertical-align: middle;" class="dashicons dashicons-info"></span> <a style="vertical-align: middle;" id="wpacu-fetch-assets-details-location-modal-target" href="#wpacu-fetch-assets-details-location-modal">Read more</a>
</td>
</tr>
<tr valign="top">
<th scope="row">
<label for="wpacu_clear_cached_files_after"><?php _e('Clear previously cached CSS/JS files older than (x) days', 'wp-asset-clean-up'); ?></label>
</th>
<td>
<input id="wpacu_clear_cached_files_after"
type="number"
min="1"
style="width: 60px; margin-bottom: 10px;"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[clear_cached_files_after]"
value="<?php echo esc_attr($data['clear_cached_files_after']); ?>" /> day(s)
<br />This is relevant in case there are alterations made to the content of the CSS/JS files via minification, combination or any other settings that would require an update to the content of a file (e.g. apply "font-display" to @font-face in stylesheets). When the caching is cleared, the previously cached CSS/JS files stored in <code><?php echo \WpAssetCleanUp\OptimiseAssets\OptimizeCommon::getRelPathPluginCacheDir(); ?></code> that are older than (X) days will be deleted as they are outdated and likely not referenced anymore in any source code (e.g. old cached pages, Google Search cached version etc.). <span style="color: #004567;" class="dashicons dashicons-info"></span> <a href="https://assetcleanup.com/docs/?p=237" target="_blank">Read more</a>
</td>
</tr>
<?php
?>
<tr valign="top">
<th scope="row">
<label for="wpacu_frontend"><?php _e('Do not load the plugin on certain pages', 'wp-asset-clean-up'); ?></label>
</th>
<td>
&nbsp;If you wish to prevent Asset CleanUp Pro from triggering on certain pages (except the Dashboard) or group of pages for any reason (e.g. incompatibility with another plugin), you can specify some URI patterns in the following textarea (one per line), just like the examples shown below:
<div style="margin: 8px 0 5px;">
<textarea id="wpacu_do_not_load_plugin_patterns"
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[do_not_load_plugin_patterns]"
rows="4"
style="width: 100%;"><?php echo esc_textarea($data['do_not_load_plugin_patterns']); ?></textarea>
</div>
<div>
<p>You can either use specific strings or patterns (the # delimiter will be automatically applied to the <code>preg_match()</code> PHP function that would check if the requested URI is matched). Please do not include the domain name. Here are a few examples:</p>
<ul>
<li><code>/checkout/</code> - if it contains the string</li>
<li><code>/product/(.*?)/</code> - any product page (most likely from WooCommerce)</li>
</ul>
</div>
</td>
</tr>
</table>
</div>
<style <?php echo Misc::getStyleTypeAttribute(); ?>>
#wpacu-show-tracked-data-list-modal {
margin: 14px 0 0;
}
#wpacu-show-tracked-data-list-modal .table-striped {
border: none;
border-spacing: 0;
}
#wpacu-show-tracked-data-list-modal .table-striped tbody tr:nth-of-type(even) {
background-color: rgba(0, 143, 156, 0.05);
}
#wpacu-show-tracked-data-list-modal .table-striped tbody tr td:first-child {
font-weight: bold;
}
</style>
<div id="wpacu-show-tracked-data-list-modal" class="wpacu-modal" style="padding-top: 100px;">
<div class="wpacu-modal-content" style="max-width: 800px;">
<span class="wpacu-close">&times;</span>
<p>The following information will be sent to us, and it would be helpful to make the plugin better.</p>
<p>e.g. see which themes and plugins are used the most and make the plugin as compatible as possible with them, see the most used plugin settings, determine the most used languages after English which is helpful to prioritise translations etc.</p>
<?php
$pluginTrackingClass = new \WpAssetCleanUp\PluginTracking();
$pluginTrackingClass->setupData();
$pluginTrackingClass::showSentInfoDataTable($pluginTrackingClass->data);
?>
</div>
</div>
<div id="wpacu-fetch-assets-details-location-modal" class="wpacu-modal" style="padding-top: 100px;">
<div class="wpacu-modal-content" style="max-width: 800px;">
<span class="wpacu-close">&times;</span>
<p>Any optimized files (e.g. via minification, combination) have their caching information (such as original location, new optimized location, version) stored in the disk by default (in most cases, it's the most effective option) to avoid extra connections to the database for a few files' information.</p>
<p>However, if you already have a light database and lots of Apache/NGINX resources already in use by your theme/other plugins, you can balance the usage of <?php echo WPACU_PLUGIN_TITLE; ?>'s resources and go for the "Database &amp; Disk (50% / 50%)" option (Example: If, for instance, on a page, there are 19 CSS/JS files which are optimized &amp; cached, 10 would have their caching information fetched from the database while 9 from the disk).</p>
<p>The contents are stored like in the following example:</p>
<p><code>{"source_uri":"\/wp-content\/plugins\/plugin-title-here\/assets\/style.css","optimize_uri":"\/wp-content\/uploads\/asset-cleanup\/css\/item\/handle-title-here-v10-8683e3d8975dab70c7f368d58203e66e70fb3e06.css","ver":10}</code></p>
<p>Once this information is retrieved, the file's original URL will be updated to match the optimized one for the file's content stored in <code><?php echo \WpAssetCleanUp\OptimiseAssets\OptimizeCommon::getRelPathPluginCacheDir(); ?></code>.</p>
<p><strong>Note:</strong> If you are using a plugin such as WP-Optimize, WP Fastest Cache or the caching system provided by your hosting company, then this fetching process would be significantly reduced as visitors will access static HTML pages read from the caching. Technically, no SQL queries should be made as the WordPress environment would not be loaded as it happens with a non-cached page (e.g. when you are logged-in and access the front-end pages).</p>
</div>
</div>
<!-- -->

View File

@ -0,0 +1,42 @@
<?php
/*
* No direct access to this file
*/
use WpAssetCleanUp\Misc;
if (! isset($data, $selectedTabArea)) {
exit;
}
$tabIdArea = 'wpacu-setting-strip-the-fat';
$styleTabContent = ($selectedTabArea === $tabIdArea) ? 'style="display: table-cell;"' : '';
?>
<div id="<?php echo esc_attr($tabIdArea); ?>" class="wpacu-settings-tab-content" <?php echo wp_kses($styleTabContent, array('style' => array())); ?>>
<h2 class="wpacu-settings-area-title"><span class="dashicons dashicons-info"></span> <?php _e('Prevent useless and often large CSS &amp; JS files increasing your total page size', 'wp-asset-clean-up'); ?></h2>
<p class="wpacu-notice wpacu-warning" style="font-size: 13px;">Please read the following tips regarding the usage of <?php echo WPACU_PLUGIN_TITLE; ?> to avoid any inconveniences later on. This is useful if you haven't used a page speed booster plugin before or you're also using a caching plugin for the page caching feature. If you're already familiar with the plugin or read the explanations below, just mark this area as "read" using the slider button from the bottom of this page.</p>
<p>The core functionality of <?php echo WPACU_PLUGIN_TITLE; ?>, as its name suggests, is to help you unload CSS Stylesheets (.css) &amp; JavaScript (.js) files through the <a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_assets_manager')); ?>">CSS &amp; JavaScript load manager</a> wherever they are loading in excess. This has always been the main purpose of this page speed booster plugin.</p>
<p>It's recommended that you take this action first on whatever page you wish to optimize (e.g. homepage), before minification &amp; concatenation of the remaining loaded files (as you will eventually end up with less and smaller optimized files). They are extra features added to the plugin and are meant to further reduce the number of HTTP requests and also get a smaller page size as the minification will help with that.</p>
<p>If you're already using other plugin for minification and concatenation, and you're happy with its configuration and decide to keep it, you can just use <?php echo WPACU_PLUGIN_TITLE; ?> for stripping the "fat" and the other plugin such as WP Fastest Cache or Autoptimize will take the remaining files and optimize them. Don't enable minification/concatenation on both <?php echo WPACU_PLUGIN_TITLE; ?> and other caching plugin at the same time as this could lead to extra resources loaded and can generate conflicts or even duplicated files that will end up increasing the total page size.</p>
<hr />
<div style="margin: 20px 0 10px;"><strong style="font-size: 15px; line-height: 17px;">How are plugins such as WP Fastest Cache, Autoptimize or W3 Total Cache working together with <?php echo WPACU_PLUGIN_TITLE; ?>?</strong></div>
<p>Let's suppose you're optimising the homepage that has a total of 20 CSS/JS files loading and decided that 8 CSS &amp; JavaScript files are not needed there. Once they are prevented from loading (not deleted or altered in any way from their original source, this plugin doesn't do that), the remaining 12 files will be minified/combined (if you have this option enabled) by either <?php echo WPACU_PLUGIN_TITLE; ?>, WP Fastest Cache or other plugin you decided to do this and saved into smaller and fewer files. This will end up in a decreased total page size, deferred unused CSS &amp; less HTTP requests resulting in a faster page load and a higher page speed performance score (via tools such as GTMetrix).</p>
<hr />
<div style="margin: 20px 0 10px;"><strong style="font-size: 15px; line-height: 17px;"><?php _e('Is a decrease in the total page size or a higher page speed score guaranteed?', 'wp-asset-clean-up'); ?></strong></div>
<p>As long as you will prevent useless files from loading, then you will for sure have a lighter &amp; faster website. If anything changes in your hosting configuration, the size of your images or any external scripts etc. that you're website is loading, then you could end up with a slower website and that is not dependent on <?php echo WPACU_PLUGIN_TITLE; ?> nor any other WordPress performance plugin as there are external things which will never depend entirely on a plugin.</p>
<hr />
<div style="margin: 20px 0 10px;"><strong style="font-size: 15px; line-height: 17px;"><?php _e('Can this plugin make the pages load slower?', 'wp-asset-clean-up'); ?></strong></div>
<p><?php echo WPACU_PLUGIN_TITLE; ?> doesn't add any extra files to load in the front-end view that will increase the number of HTTP requests in any way as it will defy its purpose. It's main task is to prevent other files from loading and cleaning up the HTML code. Moreover, by enabling concatenation (if your website is not using the HTTP/2 protocol), you will reduce the number of HTTP requests further. If you're using another plugin that also has an option for minification/concatenation, and you have enabled the feature on both plugins (never do it), or haven't configured something the right way, you could end up with extra CSS/JS loaded that will eventually lead to a poorer page speed score and a slower website.</p>
<p><?php echo WPACU_PLUGIN_TITLE; ?> will never alter (in any way) or delete CSS &amp; JS files from their original source (e.g. plugins, themes). Files created through minification/concatenation are cached and stored in <code><em><?php echo '/'.str_replace(Misc::getWpRootDirPath(), '', WP_CONTENT_DIR) . \WpAssetCleanUp\OptimiseAssets\OptimizeCommon::getRelPathPluginCacheDir(); ?></em></code> directory.</p>
<hr />
<label class="wpacu_switch">
<input id="wpacu_wiki_read"
type="checkbox"
<?php echo (($data['wiki_read'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[wiki_read]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;<?php echo sprintf(__('I understand how the plugin works and I will make sure to make proper tests (via "%s" if necessary) after the changes I\'m making.', 'wp-asset-clean-up'), __('Test Mode', 'wp-asset-clean-up')); ?> <?php _e('I\'m aware that unloading the wrong CSS/JS files can break the layout and front-end functionality of the pages I\'m optimising.', 'wp-asset-clean-up'); ?>
</div>

View File

@ -0,0 +1,46 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data, $selectedTabArea)) {
exit;
}
$tabIdArea = 'wpacu-setting-test-mode';
$styleTabContent = ($selectedTabArea === $tabIdArea) ? 'style="display: table-cell;"' : '';
?>
<div id="<?php echo esc_attr($tabIdArea); ?>" class="wpacu-settings-tab-content" <?php echo wp_kses($styleTabContent, array('style' => array())); ?>>
<h2 class="wpacu-settings-area-title"><?php _e('Test Mode', 'wp-asset-clean-up'); ?></h2>
<p><?php echo sprintf(__('Have your visitors load the website without any %s settings while you\'re going through the plugin setup and unloading the useless CSS &amp; JavaScript!', 'wp-asset-clean-up'), WPACU_PLUGIN_TITLE); ?></p>
<table class="wpacu-form-table">
<tr valign="top">
<th scope="row" class="setting_title">
<label for="wpacu_enable_test_mode"><?php _e('Enable Test Mode?', 'wp-asset-clean-up'); ?></label>
<p class="wpacu_subtitle"><small><em><?php _e('Apply plugin\'s changes for the admin only', 'wp-asset-clean-up'); ?></em></small></p>
<p class="wpacu_read_more"><a target="_blank" href="https://assetcleanup.com/docs/?p=84"><?php _e('Read More', 'wp-asset-clean-up'); ?></a></p>
</th>
<td>
<label class="wpacu_switch">
<input id="wpacu_enable_test_mode"
type="checkbox"
<?php echo (($data['test_mode'] == 1) ? 'checked="checked"' : ''); ?>
name="<?php echo WPACU_PLUGIN_ID . '_settings'; ?>[test_mode]"
value="1" /> <span class="wpacu_slider wpacu_round"></span> </label>
&nbsp;
<?php _e('This is great for debugging when you\'re going through trial and error while removing unneeded CSS &amp; JavaScript on your website.', 'wp-asset-clean-up'); ?>
<div style="margin-top: 10px;" class="wpacu-warning">
<p style="margin-top: 0;"><?php _e('Your visitors will load the website with all the settings &amp; assets loaded (just like it was before you activated the plugin). Only YOU (the logged-in administrator) will see the plugin\'s settings &amp; unload rules applied.', 'wp-asset-clean-up'); ?></p>
<p><?php _e('To view the website as a guest visitor, just make sure you access it from a browser where you\'re not logged in, or you can test it in Incognito (Private) mode.', 'wp-asset-clean-up'); ?> (e.g. to access it in Chrome yo go to <em>File -&gt; New Incognito Window</em>, while on Firefox &amp; Safari, you access it via <em>File -&gt; New Private Window</em>) <img src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-incognito.png" alt="" style="height: 22px; width: 22px; vertical-align: middle; margin-right: 5px;" /></p>
</div>
<p><strong><?php _e('Example', 'wp-asset-clean-up'); ?>:</strong> <?php _e('For instance, you have an eCommerce website (e.g. WooCommerce, Easy Digital Downloads), and you\'re worried that unloading one wrong asset could break the "add to cart" functionality or the layout of the product page. You can enable this option, do the unloading for the CSS &amp; JavaScript files you believe are not needed on certain pages, test to check if everything is alright, and then disable test mode to enable the unloading for your visitors too (not only the admin).', 'wp-asset-clean-up'); ?></p>
<div class="wpacu-warning">
<p style="margin-top: 0;"><span class="dashicons dashicons-info"></span> <?php echo sprintf(__('<strong>Important:</strong> If you\'re using page speed test tools such as GTMetrix, Pingdom, Google PageSpeed Insights, etc., while test mode is enabled, you will not see any improvements in the reports because, technically, %s plugin is deactivated for guests users and anyone else (including bots and GTMetrix visits), the changes you made being visible only to you.', 'wp-asset-clean-up'), WPACU_PLUGIN_TITLE); ?></p>
<p><?php _e('Once everything is alright with the way your websites loads, after you stripped the "fat" from your pages, you can disable test mode to apply the changes to everyone and then run tests via GTMetrix or other similar tools.', 'wp-asset-clean-up'); ?></p>
</div>
</td>
</tr>
</table>
</div>

View File

@ -0,0 +1,27 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
$baseNamePageType = str_replace('.php', '', basename(__FILE__));
$baseNamePageType = trim($baseNamePageType, '_');
?>
<div style="margin: 25px 0 0;">
<p><?php echo wp_kses(
str_replace('[wpacu_chosen_page_type]', $baseNamePageType, $data['locked_for_pro']),
array('span' => array('class' => array()), 'a' => array('href' => array()))
); ?></p>
<hr />
<p>Shows all posts belonging to a specific author (e.g. https://yourwebsite.com/author/yourname/). The assets can be unloaded <strong>only in the front-end view</strong> (<em>"Manage in the Front-end?" from "Settings" tab has to be enabled</em>).</p>
<p><strong>Example:</strong> <code>//www.yoursite.com/blog/author/john-doe/</code></p>
<hr />
<strong>How to retrieve the loaded styles &amp; scripts?</strong>
<p style="margin-bottom: 0;"><span class="dashicons dashicons-yes" style="color: green;"></span> If "Manage in the Front-end?" is enabled, and you're logged in:</p>
<p style="margin-top: 0;">Go to the author archive page and scroll to the bottom of the page where you will see the list.</p>
</div>

View File

@ -0,0 +1,28 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
$baseNamePageType = str_replace('.php', '', basename(__FILE__));
$baseNamePageType = trim($baseNamePageType, '_');
?>
<div style="margin: 25px 0 0;">
<p><?php echo wp_kses(
str_replace('[wpacu_chosen_page_type]', $baseNamePageType, $data['locked_for_pro']),
array('span' => array('class' => array()), 'a' => array('href' => array()))
); ?></p>
<hr />
<p>Default Taxonomy (they are found in "Posts" &#187; "Categories", accessing a category link reveals all the posts from that category) &#10230; <a target="_blank" href="https://wordpress.org/support/article/posts-categories-screen/"><?php _e('read more', 'wp-asset-clean-up'); ?></a></p>
<strong>How to retrieve the loaded styles &amp; scripts?</strong>
<p style="margin-bottom: 0;"><span class="dashicons dashicons-yes" style="color: green;"></span> If "Manage in the Dashboard?" is enabled:</p>
<p style="margin-top: 0;">Go to <a target="_blank" href="<?php echo esc_url(admin_url('edit-tags.php?taxonomy=category')); ?>">"Posts" &#187; "Categories"</a> &#187; [Choose the category you want to manage the assets for and click on its name] -&gt; Scroll to "<?php echo esc_html(WPACU_PLUGIN_TITLE); ?>" area where you will see the loaded CSS &amp; JavaScript files.</p>
<hr />
<p style="margin-bottom: 0;"><span class="dashicons dashicons-yes" style="color: green;"></span> If "Manage in the Front-end?" is enabled, and you're logged in:</p>
<p style="margin-top: 0;">Go to the category's page permalink ("View" link under its name in the Dashboard list) such as <code>/www.yoursite.com/category/my-category-title/</code> where you want to manage the files and scroll to the bottom of the page where you will see the list.</p>
</div>

View File

@ -0,0 +1,35 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
?>
<div style="margin: 25px 0 0;">
<?php
$data['post_id'] = (isset($_GET['wpacu_post_id']) && $_GET['wpacu_post_id']) ? (int)$_GET['wpacu_post_id'] : false;
?>
<p>Popular examples: 'product' created by WooCommerce, 'download' created by Easy Digital Downloads etc. &#10230; <a target="_blank" href="https://wordpress.org/support/article/post-types/#custom-post-types"><?php _e('read more', 'wp-asset-clean-up'); ?></a></p>
<?php
$data['dashboard_edit_not_allowed'] = false;
require_once __DIR__.'/common/_is-dashboard-edit-allowed.php';
if ($data['dashboard_edit_not_allowed']) {
return; // stop here as the message about the restricted access has been printed
}
if ($data['post_id']) {
// There's a POST ID requested in the URL / Show the assets
$data['post_type'] = get_post_type($data['post_id']);
do_action('wpacu_admin_notices');
require_once __DIR__.'/_singular-page.php';
} else {
// There's no POST ID requested
$data['post_type'] = '';
require_once '_singular-page-search-form.php';
}
?>
</div>

View File

@ -0,0 +1,28 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
$baseNamePageType = str_replace('.php', '', basename(__FILE__));
$baseNamePageType = trim($baseNamePageType, '_');
?>
<div style="margin: 25px 0 0;">
<p><?php echo wp_kses(
str_replace('[wpacu_chosen_page_type]', $baseNamePageType, $data['locked_for_pro']),
array('span' => array('class' => array()), 'a' => array('href' => array()))
); ?></p>
<hr />
<p>Popular examples: 'product_cat' created by WooCommerce, 'download_category' created by Easy Digital Downloads etc. &#10230; <a target="_blank" href="https://wordpress.org/support/article/taxonomies/"><?php _e('read more', 'wp-asset-clean-up'); ?></a></p>
<strong>How to retrieve the loaded styles &amp; scripts?</strong>
<p style="margin-bottom: 0;"><span class="dashicons dashicons-yes" style="color: green;"></span> If "Manage in the Dashboard?" is enabled:</p>
<p style="margin-top: 0;">Go to "Products" -&gt; "Categories" -&gt; [Choose the category you want to manage the assets for and click on its name] -&gt; Scroll to "Asset CleanUp Pro" area where you will see the loaded CSS &amp; JavaScript files.</p>
<hr />
<p style="margin-bottom: 0;"><span class="dashicons dashicons-yes" style="color: green;"></span> If "Manage in the Front-end?" is enabled and you're logged in:</p>
<p style="margin-top: 0;">Go to the product category's page permalink ("View" link under its name in the Dashboard list) such as <code>//www.yoursite.com/product-category/clothing/</code> where you want to manage the files and scroll to the bottom of the page where you will see the list.</p>
</div>

View File

@ -0,0 +1,27 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
$baseNamePageType = str_replace('.php', '', basename(__FILE__));
$baseNamePageType = trim($baseNamePageType, '_');
?>
<div style="margin: 25px 0 0;">
<p><?php echo wp_kses(
str_replace('[wpacu_chosen_page_type]', $baseNamePageType, $data['locked_for_pro']),
array('span' => array('class' => array()), 'a' => array('href' => array()))
); ?></p>
<hr />
<p>Shows all posts based on the chosen date (e.g. https://yourwebsite.com/2018/08/). The assets can be unloaded <strong>only in the front-end view</strong> (<em>"Manage in the Front-end?" from "Settings" tab has to be enabled</em>).</p>
<p><strong>Example:</strong> <code>//www.yoursite.com/blog/2019/01/</code></p>
<hr />
<strong>How to retrieve the loaded styles &amp; scripts?</strong>
<p style="margin-bottom: 0;"><span class="dashicons dashicons-yes" style="color: green;"></span> If "Manage in the Front-end?" is enabled and you're logged in:</p>
<p style="margin-top: 0;">Go to the date archive page (any valid date you wish as the unload rules will apply to all date pages) and scroll to the bottom of the page where you will see the list.</p>
</div>

View File

@ -0,0 +1,145 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
?>
<div style="margin: 18px 0 0;" class="clearfix"></div>
<?php
if ( ! \WpAssetCleanUp\Main::instance()->currentUserCanViewAssetsList() ) {
?>
<div class="wpacu-error" style="padding: 10px;">
<?php echo sprintf(__('Only the administrators listed here can manage CSS/JS assets: %s"Settings" &#10141; "Plugin Usage Preferences" &#10141; "Allow managing assets to:"%s. If you believe you should have access to managing CSS/JS assets, you can add yourself to that list.', 'wp-asset-clean-up'), '<a target="_blank" href="'.esc_url(admin_url('admin.php?page=wpassetcleanup_settings&wpacu_selected_tab_area=wpacu-setting-plugin-usage-settings')).'">', '</a>'); ?></div>
<?php
return;
}
$data['dashboard_edit_not_allowed'] = false;
require_once __DIR__.'/common/_is-dashboard-edit-allowed.php';
if ($data['dashboard_edit_not_allowed']) {
return; // stop here as the message about the restricted access has been printed
}
$wpacuNoLoadInTargetPage = false;
if ($data['show_on_front'] === 'page' && $data['page_on_front']) {
/*
* Case 1: A "page" (post type) set as the homepage
*/
?>
<p><?php echo sprintf( __( 'To read more about creating a static front page in WordPress, %scheck the Codex%s.', 'wp-asset-clean-up' ), '<a target="_blank" href="https://codex.wordpress.org/Creating_a_Static_Front_Page">', '</a>' ); ?></p>
<?php
$data['is_homepage_tab'] = true;
$data['post_id'] = $data['page_on_front'];
$data['post_type'] = get_post_type($data['post_id']);
do_action('wpacu_admin_notices');
require_once __DIR__.'/_singular-page.php';
} else {
/*
* Case 2: Home as latest posts (default)
*/
$strAdminUrl = 'admin.php?page='.WPACU_PLUGIN_ID.'_assets_manager&wpacu_rand='.uniqid(time(), true);
if ( isset($_GET['wpacu_manage_dash']) || isset($_GET['force_manage_dash']) ) { // For debugging purposes
$strAdminUrl .= '&wpacu_manage_dash';
}
do_action('wpacu_admin_notices');
?>
<form id="wpacu_dash_assets_manager_form" method="post" action="<?php echo esc_url(admin_url($strAdminUrl)); ?>">
<input type="hidden"
name="wpacu_manage_home_page_assets"
value="1" />
<input type="hidden"
id="wpacu_ajax_fetch_assets_list_dashboard_view"
name="wpacu_ajax_fetch_assets_list_dashboard_view"
value="1" />
<p><span class="dashicons dashicons-admin-home"></span> <?php _e('Here you can unload files loaded on the home page. "Front page displays" (from "Settings" &#187; "Reading") is set to either "Your latest posts" (in "Settings" &#187; "Reading") OR a special layout (from a theme or plugin) was enabled.', 'wp-asset-clean-up'); ?> <?php echo sprintf(__('Changes will also apply to pages such as %s etc. in case the latest blog posts are paginated.', 'wp-asset-clean-up'), '<code>/page/2</code> <code>page/3</code>'); ?></p>
<?php
$wpacuNoLoadMatchesStatus = assetCleanUpHasNoLoadMatches($data['site_url'], true);
if ($wpacuNoLoadInTargetPage = in_array($wpacuNoLoadMatchesStatus, array('is_set_in_settings', 'is_set_in_page'))) {
if ($wpacuNoLoadMatchesStatus === 'is_set_in_settings') { // Asset CleanUp Pro is set not to load for the front-page
?>
<p class="wpacu_verified">
<strong>Target URL:</strong> <a target="_blank" href="<?php echo esc_url($data['site_url']); ?>"><span><?php echo esc_url($data['site_url']); ?></span></a>
</p>
<p class="wpacu-warning"
style="margin: 15px 0 0; padding: 10px; font-size: inherit; width: 99%;">
<span style="color: red;"
class="dashicons dashicons-info"></span> <?php echo sprintf(__('This homepage\'s URI is matched by one of the RegEx rules you have in <strong>"Settings"</strong> -&gt; <strong>"Plugin Usage Preferences"</strong> -&gt; <strong>"Do not load the plugin on certain pages"</strong>, thus %s is not loaded on that page and no CSS/JS are to be managed. If you wish to view the CSS/JS manager, please remove the matching RegEx rule and reload this page.', 'wp-asset-clean-up'), WPACU_PLUGIN_TITLE); ?>
</p>
<?php
} elseif ($wpacuNoLoadMatchesStatus === 'is_set_in_page') {
?>
<p class="wpacu_verified">
<strong>Target URL:</strong> <a target="_blank" href="<?php echo esc_url($data['site_url']); ?>"><span><?php echo esc_url($data['site_url']); ?></span></a>
</p>
<p class="wpacu-warning"
style="margin: 15px 0 0; padding: 10px; font-size: inherit; width: 99%;">
<span style="color: red;"
class="dashicons dashicons-info"></span> <?php echo sprintf(__('This homepage\'s URI is matched by the rule you have in the "Page Options", thus %s is not loaded on that page and no CSS/JS are to be managed. If you wish to view the CSS/JS manager, please uncheck the option and reload this page.', 'wp-asset-clean-up'), WPACU_PLUGIN_TITLE); ?>
</p>
<?php
}
$data['show_page_options'] = true;
if (isset($data['post_id']) && $data['post_id'] > 0) {
$pageOptionsType = 'post';
} else {
$pageOptionsType = 'front_page';
$data['post_id'] = 0;
}
$data['page_options'] = \WpAssetCleanUp\MetaBoxes::getPageOptions($data['post_id'], $pageOptionsType);
$data['page_options_with_assets_manager_no_load'] = true;
include dirname(__DIR__).'/meta-box-loaded-assets/_page-options.php';
} else {
?>
<div id="wpacu_meta_box_content">
<?php
// "Select a retrieval way:" is set to "Direct" (default one) in "Plugin Usage Preferences" -> "Manage in the Dashboard"
if ($data['wpacu_settings']['dom_get_type'] === 'direct') {
?>
<div id="wpacu-list-step-default-status" style="display: none;"><img src="<?php echo esc_url(admin_url('images/spinner.gif')); ?>" align="top" width="20" height="20" alt="" />&nbsp; Please wait...</div>
<div id="wpacu-list-step-completed-status" style="display: none;"><span style="color: green;" class="dashicons dashicons-yes-alt"></span> Completed</div>
<div>
<ul class="wpacu_meta_box_content_fetch_steps">
<li id="wpacu-fetch-list-step-1-wrap"><strong>Step 1</strong>: Fetch the assets from the home page... <span id="wpacu-fetch-list-step-1-status"><img src="<?php echo esc_url(admin_url('images/spinner.gif')); ?>" align="top" width="20" height="20" alt="" />&nbsp; Please wait...</li>
<li id="wpacu-fetch-list-step-2-wrap"><strong>Step 2</strong>: Build the list of the fetched assets and print it... <span id="wpacu-fetch-list-step-2-status"></span></li>
</ul>
</div>
<?php
} else {
// "Select a retrieval way:" is set to "WP Remote Post" (one AJAX call) in "Plugin Usage Preferences" -> "Manage in the Dashboard"
?>
<img src="<?php echo esc_url(admin_url('images/spinner.gif')); ?>" align="top" width="20" height="20" alt="" />
<?php _e('Retrieving the loaded scripts and styles for the home page. Please wait...', 'wp-asset-clean-up');
}
?>
<p><?php echo sprintf(
__('If you believe fetching the page takes too long and the assets should have loaded by now, I suggest you go to "Settings", make sure "Manage in front-end" is checked and then %smanage the assets in the front-end%s.', 'wp-asset-clean-up'),
'<a href="'.$data['site_url'].'#wpacu_wrap_assets">',
'</a>'
); ?></p>
</div>
<?php
}
wp_nonce_field($data['nonce_action'], $data['nonce_name']);
?>
<div id="wpacu-update-button-area" class="no-left-margin">
<p class="submit"><input type="submit" name="submit" id="submit" <?php if ($wpacuNoLoadInTargetPage) { echo 'style="display: inline-block;"'; } ?> class="hidden button button-primary" value="<?php esc_attr_e('Update', 'wp-asset-clean-up'); ?>"></p>
<div id="wpacu-updating-settings" style="margin-left: 100px;">
<img src="<?php echo esc_url(admin_url('images/spinner.gif')); ?>" align="top" width="20" height="20" alt="" />
</div>
</div>
</form>
<?php
}

View File

@ -0,0 +1,64 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
?>
<div style="margin: 18px 0 0;" class="clearfix"></div>
<?php
if ( ! \WpAssetCleanUp\Main::instance()->currentUserCanViewAssetsList() ) {
?>
<div class="wpacu-error" style="padding: 10px;">
<?php echo sprintf(__('Only the administrators listed here can manage CSS/JS assets: %s"Settings" &#10141; "Plugin Usage Preferences" &#10141; "Allow managing assets to:"%s. If you believe you should have access to managing CSS/JS assets, you can add yourself to that list.', 'wp-asset-clean-up'), '<a target="_blank" href="'.esc_url(admin_url('admin.php?page=wpassetcleanup_settings&wpacu_selected_tab_area=wpacu-setting-plugin-usage-settings')).'">', '</a>'); ?></div>
<?php
return;
}
$data['post_id'] = (isset($_GET['wpacu_post_id']) && $_GET['wpacu_post_id']) ? (int)$_GET['wpacu_post_id'] : false;
?>
<p>Post Type: 'attachment' (e.g. files from <a target="_blank" href="https://wordpress.org/support/article/media-library-screen/">"Media" &#187; "Library"</a>, the page loaded usually prints the image or other media type) &#10230; <a target="_blank" href="https://wordpress.org/support/article/edit-media/"><?php _e('read more', 'wp-asset-clean-up'); ?></a></p>
<?php
$data['dashboard_edit_not_allowed'] = false;
require_once __DIR__.'/common/_is-dashboard-edit-allowed.php';
if ($data['dashboard_edit_not_allowed']) {
return; // stop here as the message about the restricted access has been printed
}
?>
<div style="margin: 25px 0 0;">
<?php
if (\WpAssetCleanUp\MetaBoxes::isMediaWithPermalinkDeactivated()) {
?>
<div class="wpacu-notice-info" style="width: 95%; margin-bottom: 20px;">
<span class="dashicons dashicons-info"></span>
<?php
echo __('There are no CSS/JS to manage because <em>"Redirect attachment URLs to the attachment itself?"</em> is set to <em>"Yes"</em> in <em>"Search Appearance - Yoast SEO" - "Media"</em> tab).', 'wp-asset-clean-up');
?>
</div>
<?php
} else {
$data['dashboard_edit_not_allowed'] = false;
require_once __DIR__.'/common/_is-dashboard-edit-allowed.php';
if ($data['dashboard_edit_not_allowed']) {
return; // stop here as the message about the restricted access has been printed
}
if ($data['post_id']) {
// There's a POST ID requested in the URL / Show the assets
$data['post_type'] = 'attachment';
do_action('wpacu_admin_notices');
require_once __DIR__.'/_singular-page.php';
} else {
// There's no POST ID requested
$data['post_type'] = 'attachment';
require_once '_singular-page-search-form.php';
}
}
?>
</div>

View File

@ -0,0 +1,27 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
$baseNamePageType = str_replace('.php', '', basename(__FILE__));
$baseNamePageType = trim($baseNamePageType, '_');
?>
<div style="margin: 25px 0 0;">
<p><?php echo wp_kses(
str_replace('[wpacu_chosen_page_type]', $baseNamePageType, $data['locked_for_pro']),
array('span' => array('class' => array()), 'a' => array('href' => array()))
); ?></p>
<hr />
<p>This page (404.php within the theme) is reached when a request is not valid. It could be an old link that is not used anymore or the visitor typed the wrong URL to an article etc. (e.g. https://yourwebsite.com/this-is-a-non-existent-page.html). The assets can be unloaded <strong>only in the front-end view</strong> (<em>"Manage in the Front-end?" from "Settings" tab has to be enabled</em>). &#10230; <a target="_blank" href="https://codex.wordpress.org/Creating_an_Error_404_Page"><?php _e('read more', 'wp-asset-clean-up'); ?></a></p>
<p><strong>Example:</strong> <code>//www.yoursite.comn/blog/a-post-title-that-does-not-exist/</code></p>
<hr />
<strong>How to retrieve the loaded styles &amp; scripts?</strong>
<p style="margin-bottom: 0;"><span class="dashicons dashicons-yes" style="color: green;"></span> If "Manage in the Front-end?" (<em>from "Settings" -&gt; "Plugin Usage Preferences"</em>) is enabled and you're logged in:</p>
<p style="margin-top: 0;">Go to any page that returns a 404 error (it does not watter which URL you will have as the unload rules will apply to all 404 pages) and scroll to the bottom of the page where you will see the list.</p>
</div>

View File

@ -0,0 +1,34 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
?>
<div style="margin: 25px 0 0;">
<?php
$data['post_id'] = (isset($_GET['wpacu_post_id']) && $_GET['wpacu_post_id']) ? (int)$_GET['wpacu_post_id'] : false;
?>
<p>Post Type: 'page' (e.g. pages such as About, Contact etc.) &#10230; <a target="_blank" href="https://wordpress.org/support/article/pages-screen/"><?php _e('read more', 'wp-asset-clean-up'); ?></a></p>
<?php
$data['dashboard_edit_not_allowed'] = false;
require_once __DIR__.'/common/_is-dashboard-edit-allowed.php';
if ($data['dashboard_edit_not_allowed']) {
return; // stop here as the message about the restricted access has been printed
}
if ($data['post_id']) {
// There's a POST ID requested in the URL / Show the assets
$data['post_type'] = get_post_type($data['post_id']);
do_action('wpacu_admin_notices');
require_once __DIR__.'/_singular-page.php';
} else {
// There's no POST ID requested
$data['post_type'] = 'page';
require_once '_singular-page-search-form.php';
}
?>
</div>

View File

@ -0,0 +1,35 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
?>
<div style="margin: 25px 0 0;">
<?php
$data['post_id'] = (isset($_GET['wpacu_post_id']) && $_GET['wpacu_post_id']) ? (int)$_GET['wpacu_post_id'] : false;
?>
<p style="margin-bottom: 0;">Post Type: 'post' (e.g. blog entries) &#10230; <a target="_blank" href="https://wordpress.org/support/article/writing-posts/"><?php _e('read more', 'wp-asset-clean-up'); ?></a></p>
<div style="margin: 15px 0 0;" class="clearfix"></div>
<?php
$data['dashboard_edit_not_allowed'] = false;
require_once __DIR__.'/common/_is-dashboard-edit-allowed.php';
if ($data['dashboard_edit_not_allowed']) {
return; // stop here as the message about the restricted access has been printed
}
if ($data['post_id']) {
// There's a POST ID requested in the URL / Show the assets
$data['post_type'] = get_post_type($data['post_id']);
do_action('wpacu_admin_notices');
require_once __DIR__.'/_singular-page.php';
} else {
// There's no POST ID requested
$data['post_type'] = 'post';
require_once '_singular-page-search-form.php';
}
?>
</div>

View File

@ -0,0 +1,28 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
$baseNamePageType = str_replace('.php', '', basename(__FILE__));
$baseNamePageType = trim($baseNamePageType, '_');
?>
<div style="margin: 25px 0 0;">
<p><?php echo wp_kses(
str_replace('[wpacu_chosen_page_type]', $baseNamePageType, $data['locked_for_pro']),
array('span' => array('class' => array()), 'a' => array('href' => array()))
); ?></p>
<hr />
<p>Default Search Template (search.php &#187; this is the template that displays the search results; the query parameter "s" is within the URL). If you create a <a target="_blank" href="https://codex.wordpress.org/Creating_a_Search_Page">Search Page</a>, it will belong to the "Pages" page type. The assets can be unloaded <strong>only in the front-end view</strong> (<em>"Manage in the Front-end?" from "Settings" tab has to be enabled</em>).</p>
<p><strong>Example:</strong> <code>//www.yoursite.com/blog/?s=design</code></p>
<hr />
<strong>How to retrieve the loaded styles &amp; scripts?</strong>
<p style="margin-bottom: 0;"><span class="dashicons dashicons-yes" style="color: green;"></span> If "Manage in the Front-end?" is enabled, and you're logged in:</p>
<p style="margin-top: 0;">Go to the search results page (any search query as the managing will apply for any search term) and scroll to the bottom of the page where you will see the list.</p>
</div>

View File

@ -0,0 +1,87 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
?>
<div style="margin: 0 0 15px;">
<?php
$loadSearchFormForPages = true;
$searchPlaceholderText = sprintf(__('You can type a keyword or the ID to search the %s for which you want to manage its CSS/JS (e.g. unloading)', 'wp-asset-clean-up'), $data['post_type']);
// Anything that is not within the array, is a custom post type
if (isset($data['for'])) {
if ($data['for'] === 'custom-post-types') {
$postTypes = get_post_types( array( 'public' => true ) );
if ( ! empty($postTypes) ) {
$postTypesList = \WpAssetCleanUp\Misc::filterCustomPostTypesList($postTypes);
?>
After you choose the custom post type, you can then search within all the posts that are within your choice:
<select id="wpacu-custom-post-type-choice">
<?php foreach ($postTypesList as $listPostType => $listPostTypeLabel) { ?>
<option <?php if ($data['post_type'] === $listPostType) { echo 'selected="selected"'; } ?> value="<?php echo esc_attr($listPostType); ?>"><?php echo esc_html($listPostTypeLabel); ?></option>
<?php } ?>
</select>
<?php } else { ?>
<div style="padding: 10px; background: white; border-radius: 10px; border: 1px solid #c3c4c7;">
<span class="dashicons dashicons-warning" style="color: #004567;"></span> You do not have any custom post types available. Thus, this area is not usable. Once you will use plugins that have custom post types (e.g. WooCommerce with its "product" post type), or you will add them within your (child) theme, they will show up here, so you can manage the pages belonging to specific post types.
</div>
<?php } ?>
<div style="margin: 0 0 15px;"></div>
<?php
} elseif ($data['for'] === 'posts') {
$posts = get_posts(array('post_type' => 'post', 'post_status' => 'publish,private'));
if (empty($posts)) {
$loadSearchFormForPages = false; // no posts added
?>
<div style="padding: 10px; background: white; border-radius: 10px; border: 1px solid #c3c4c7;">
<span class="dashicons dashicons-warning" style="color: #004567;"></span> There aren't any posts added in <a style="text-decoration: none;" target="_blank" href="<?php echo admin_url('edit.php'); ?>"><span class="dashicons dashicons-admin-post"></span> "Posts" --&gt; "All Posts"</a>.
</div>
<?php
}
} elseif ($data['for'] === 'pages') {
$pages = get_pages(array('post_type' => 'page', 'post_status' => array('publish', 'private')));
if (empty($pages)) {
$loadSearchFormForPages = false; // no pages added
?>
<div style="padding: 10px; background: white; border-radius: 10px; border: 1px solid #c3c4c7;">
<span class="dashicons dashicons-warning" style="color: #004567;"></span> There aren't any pages added in <a style="text-decoration: none;" target="_blank" href="<?php echo admin_url('edit.php?post_type=page'); ?>"><span class="dashicons dashicons-admin-page"></span> "Pages" --&gt; "All Pages"</a>.
</div>
<?php
}
}
}
if (isset($postTypes) && empty($postTypes)) {
$loadSearchFormForPages = false; // no post types added
}
if ($loadSearchFormForPages) {
?>
<form id="wpacu-search-form-assets-manager">
Load assets manager for:
<input type="text"
class="search-field"
value=""
placeholder="<?php echo esc_attr($searchPlaceholderText); ?>"
style="max-width: 800px; width: 100%; padding-right: 15px;" />
* <small>Once the post is selected, the CSS &amp; JS manager will load to manage the assets for the chosen post</small>
<div style="display: none; padding: 10px; color: #cc0000;" id="wpacu-search-form-assets-manager-no-results"><span class="dashicons dashicons-warning"></span> <?php _e('There are no results based on your search', 'wp-asset-clean-up'); ?>. <?php echo sprintf(__('Remember that you can also use the %s ID in the input', 'wp-asset-clean-up'), $data['post_type']); ?>.</div>
</form>
<div style="display: none;" id="wpacu-post-chosen-loading-assets">
<img style="margin: 2px 0 4px;"
src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/loader-horizontal.svg?x=<?php echo time(); ?>"
align="top"
width="120"
alt="" />
</div>
<?php
}
?>
</div>

View File

@ -0,0 +1,142 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
?>
<div style="margin: 18px 0 0;" class="clearfix"></div>
<?php
$wpacuNoLoadInTargetPage = false;
if (isset($data['post_id']) && $data['post_id']) {
$data['fetch_url'] = \WpAssetCleanUp\Misc::getPageUrl( $data['post_id'] );
}
$strAdminUrl = 'admin.php?page='.WPACU_PLUGIN_ID.'_assets_manager&wpacu_for='.$data['for'];
if ( $data['for'] !== 'homepage' && isset($data['post_id']) && $data['post_id'] ) {
$strAdminUrl .= '&wpacu_post_id=' . $data['post_id'];
}
$strAdminUrl .= '&wpacu_rand='.uniqid(time(), true);
if ( isset($_GET['wpacu_manage_dash']) || isset($_REQUEST['force_manage_dash']) ) { // For debugging purposes
$strAdminUrl .= '&wpacu_manage_dash';
}
// Show the search form on tabs such as "Posts", "Pages", "Custom Post Types"
// Do not how it in the homepage (that was set to be a singular page) as it could confuse the admin
if ( ! (isset($data['is_homepage_tab']) && $data['is_homepage_tab']) ) {
require_once '_singular-page-search-form.php';
}
?>
<form id="wpacu_dash_assets_manager_form" method="post" action="<?php echo esc_url(admin_url($strAdminUrl)); ?>">
<input type="hidden"
id="wpacu_manage_singular_page_assets"
name="wpacu_manage_singular_page_assets"
value="1" />
<input type="hidden"
id="wpacu_manage_singular_page_id"
name="wpacu_manage_singular_page_id"
value="<?php echo (int)$data['post_id']; ?>" />
<input type="hidden"
id="wpacu_ajax_fetch_assets_list_dashboard_view"
name="wpacu_ajax_fetch_assets_list_dashboard_view"
value="1" />
<?php
if (isset($data['post_type']) && $data['post_type']) {
$postTypeObject = get_post_type_object( $data['post_type'] );
$postTypeLabels = $postTypeObject->labels;
$postName = $postTypeLabels->singular_name;
}
if (isset($data['is_homepage_tab']) && $data['is_homepage_tab']) {
$pageUrlTitle = __('Homepage URL', 'wp-asset-clean-up');
} else {
$pageUrlTitle = __('Page URL', 'wp-asset-clean-up');
}
?>
<div class="wpacu_verified">
<strong><?php echo esc_html($pageUrlTitle); ?>:</strong> <a target="_blank" href="<?php echo esc_url($data['fetch_url']); ?>"><span><?php echo esc_url($data['fetch_url']); ?></span></a>
| <strong><?php echo isset($postName) ? esc_html($postName) : ''; ?> Title:</strong> <?php echo get_the_title($data['post_id']); ?> | <strong>Post ID:</strong> <?php echo (int)$data['post_id']; ?>
</div>
<?php
$wpacuNoLoadMatchesStatus = assetCleanUpHasNoLoadMatches($data['fetch_url'], true);
if ($wpacuNoLoadInTargetPage = in_array($wpacuNoLoadMatchesStatus, array('is_set_in_settings', 'is_set_in_page'))) {
if ($wpacuNoLoadMatchesStatus === 'is_set_in_settings') { // Asset CleanUp Pro is set not to load for the front-page
?>
<p class="wpacu-warning"
style="margin: 15px 0 0; padding: 10px; font-size: inherit; width: 99%;">
<span style="color: red;"
class="dashicons dashicons-info"></span> <?php echo sprintf(__('This page\'s URI is matched by one of the RegEx rules you have in <strong>"Settings"</strong> -&gt; <strong>"Plugin Usage Preferences"</strong> -&gt; <strong>"Do not load the plugin on certain pages"</strong>, thus %s is not loaded on that page and no CSS/JS are to be managed. If you wish to view the CSS/JS manager, please remove the matching RegEx rule and reload this page.', 'wp-asset-clean-up'), WPACU_PLUGIN_TITLE); ?>
</p>
<?php
} elseif ($wpacuNoLoadMatchesStatus === 'is_set_in_page') { // Asset CleanUp Pro is set not to load for the front-page
?>
<p class="wpacu-warning"
style="margin: 15px 0 0; padding: 10px; font-size: inherit; width: 99%;">
<span style="color: red;"
class="dashicons dashicons-info"></span> <?php echo sprintf(__('This page\'s URI is matched by the rule you have in the "Page Options", thus %s is not loaded on that page and no CSS/JS are to be managed. If you wish to view the CSS/JS manager, please uncheck the following option shown below: <em>"Do not load Asset CleanUp Pro on this page (this will disable any functionality of the plugin"</em>.', 'wp-asset-clean-up'), WPACU_PLUGIN_TITLE); ?>
</p>
<?php
}
$data['show_page_options'] = true;
if ($data['post_id'] > 0) {
$pageOptionsType = 'post';
} elseif (isset($data['is_homepage_tab']) && $data['is_homepage_tab']) {
$pageOptionsType = 'front_page';
}
$data['page_options'] = \WpAssetCleanUp\MetaBoxes::getPageOptions($data['post_id'], $pageOptionsType);
$data['page_options_with_assets_manager_no_load'] = true;
include dirname(__DIR__).'/meta-box-loaded-assets/_page-options.php';
} else {
?>
<div id="wpacu_meta_box_content">
<?php
// "Select a retrieval way:" is set to "Direct" (default one) in "Plugin Usage Preferences" -> "Manage in the Dashboard"
if ($data['wpacu_settings']['dom_get_type'] === 'direct') {
?>
<div id="wpacu-list-step-default-status" style="display: none;"><img src="<?php echo esc_url(admin_url('images/spinner.gif')); ?>" align="top" width="20" height="20" alt="" />&nbsp; Please wait...</div>
<div id="wpacu-list-step-completed-status" style="display: none;"><span style="color: green;" class="dashicons dashicons-yes-alt"></span> Completed</div>
<div>
<ul class="wpacu_meta_box_content_fetch_steps">
<li id="wpacu-fetch-list-step-1-wrap"><strong>Step 1</strong>: Fetch the assets from the targeted page... <span id="wpacu-fetch-list-step-1-status"><img src="<?php echo esc_url(admin_url('images/spinner.gif')); ?>" align="top" width="20" height="20" alt="" />&nbsp; Please wait...</span></li>
<li id="wpacu-fetch-list-step-2-wrap"><strong>Step 2</strong>: Build the list of the fetched assets and print it... <span id="wpacu-fetch-list-step-2-status"></span></li>
</ul>
</div>
<?php
} else {
// "Select a retrieval way:" is set to "WP Remote Post" (one AJAX call) in "Plugin Usage Preferences" -> "Manage in the Dashboard"
?>
<img src="<?php echo esc_url(admin_url('images/spinner.gif')); ?>" align="top" width="20" height="20" alt="" />&nbsp;
<?php esc_html_e('Retrieving the loaded scripts and styles for the home page. Please wait...', 'wp-asset-clean-up');
}
?>
<p><?php echo sprintf(
__('If you believe fetching the page takes too long and the assets should have loaded by now, I suggest you go to "Settings", make sure "Manage in front-end" is checked and then %smanage the assets in the front-end%s.', 'wp-asset-clean-up'),
'<a href="'.esc_url($data['fetch_url']).'#wpacu_wrap_assets">',
'</a>'
); ?></p>
</div>
<?php
}
wp_nonce_field($data['nonce_action'], $data['nonce_name']);
?>
<div id="wpacu-update-button-area" class="no-left-margin">
<p class="submit"><input type="submit" name="submit" id="submit" <?php if ($wpacuNoLoadInTargetPage) { echo 'style="display: inline-block;"'; } ?> class="hidden button button-primary" value="<?php esc_attr_e('Update', 'wp-asset-clean-up'); ?>"></p>
<div id="wpacu-updating-settings" style="margin-left: 100px;">
<img src="<?php echo esc_url(admin_url('images/spinner.gif')); ?>" align="top" width="20" height="20" alt="" />
</div>
</div>
</form>

View File

@ -0,0 +1,28 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
$baseNamePageType = str_replace('.php', '', basename(__FILE__));
$baseNamePageType = trim($baseNamePageType, '_');
?>
<div style="margin: 25px 0 0;">
<p><?php echo wp_kses(
str_replace('[wpacu_chosen_page_type]', $baseNamePageType, $data['locked_for_pro']),
array('span' => array('class' => array()), 'a' => array('href' => array()))
); ?></p>
<hr />
<p>Default Taxonomy (they are found in "Posts" &#187; "Tags", accessing a tag link reveals all the posts associated with the tag) &#10230; <a target="_blank" href="https://wordpress.org/support/article/posts-tags-screen/"><?php _e('read more', 'wp-asset-clean-up'); ?></a></p>
<strong>How to retrieve the loaded styles &amp; scripts?</strong>
<p style="margin-bottom: 0;"><span class="dashicons dashicons-yes" style="color: green;"></span> If "Manage in the Dashboard?" is enabled:</p>
<p style="margin-top: 0;">Go to <a target="_blank" href="<?php echo esc_url(admin_url('edit-tags.php?taxonomy=post_tag')); ?>">"Posts" &#187; "Tags"</a> &#187; [Choose the tag you want to manage the assets for and click on its name] -&gt; Scroll to "<?php echo WPACU_PLUGIN_TITLE; ?>" area where you will see the loaded CSS &amp; JavaScript files.</p>
<hr />
<p style="margin-bottom: 0;"><span class="dashicons dashicons-yes" style="color: green;"></span> If "Manage in the Front-end?" is enabled and you're logged in:</p>
<p style="margin-top: 0;">Go to the category's page permalink ("View" link under its name in the Dashboard list) such as <code>//www.yoursite.com/blog/tag/the-tag-title-here/</code> where you want to manage the files and scroll to the bottom of the page where you will see the list.</p>
</div>

View File

@ -0,0 +1,23 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
// Is managing the assets within the Dashboard allowed globally or for the current admin?
if ( ! \WpAssetCleanUp\Main::instance()->currentUserCanViewAssetsList() ) {
?>
<div class="wpacu-error" style="padding: 10px;">
<?php echo sprintf(esc_html__('Only the administrators listed here can manage CSS/JS assets: %s"Settings" &#10141; "Plugin Usage Preferences" &#10141; "Allow managing assets to:"%s. If you believe you should have access to managing CSS/JS assets, you can add yourself to that list.', 'wp-asset-clean-up'), '<a target="_blank" href="'.esc_url(admin_url('admin.php?page=wpassetcleanup_settings&wpacu_selected_tab_area=wpacu-setting-plugin-usage-settings')).'">', '</a>'); ?></div>
<?php
$data['dashboard_edit_not_allowed'] = true;
}
if ($data['wpacu_settings']['dashboard_show'] != 1) {
?>
<div class="wpacu-error" style="padding: 10px; margin-left: 0;"><?php echo sprintf(esc_html__('As "Manage in the Dashboard?" is not enabled in %s"Settings" &#187; "Plugin Usage Preferences"%s, you can not manage the assets from the Dashboard.', 'wp-asset-clean-up'), '<a target="_blank" href="'.esc_url(admin_url('admin.php?page=wpassetcleanup_settings&wpacu_selected_tab_area=wpacu-setting-plugin-usage-settings')).'">', '</a>'); ?></div>
<?php
$data['dashboard_edit_not_allowed'] = true;
}

View File

@ -0,0 +1,190 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
use WpAssetCleanUp\Main;
use WpAssetCleanUp\Misc;
$wpacuTopAreaLinks = array(
'admin.php?page=wpassetcleanup_settings' => array(
'icon' => '<span class="dashicons dashicons-admin-generic"></span>',
'title' => esc_html__('Settings', 'wp-asset-clean-up'),
'page' => 'wpassetcleanup_settings'
),
'admin.php?page=wpassetcleanup_assets_manager' => array(
'icon' => '<span class="dashicons dashicons-media-code"></span>',
'title' => esc_html__('CSS &amp; JS Manager', 'wp-asset-clean-up'),
'page' => 'wpassetcleanup_assets_manager',
),
'admin.php?page=wpassetcleanup_plugins_manager' => array(
'icon' => '<span class="dashicons dashicons-admin-plugins"></span>',
'title' => esc_html__('Plugins Manager', 'wp-asset-clean-up'),
'page' => 'wpassetcleanup_plugins_manager',
),
'admin.php?page=wpassetcleanup_bulk_unloads' => array(
'icon' => '<span class="dashicons dashicons-networking"></span>',
'title' => esc_html__('Bulk Changes', 'wp-asset-clean-up'),
'page' => 'wpassetcleanup_bulk_unloads'
),
'admin.php?page=wpassetcleanup_overview' => array(
'icon' => '<span class="dashicons dashicons-media-text"></span>',
'title' => esc_html__('Overview', 'wp-asset-clean-up'),
'page' => 'wpassetcleanup_overview'
),
'admin.php?page=wpassetcleanup_tools' => array(
'icon' => '<span class="dashicons dashicons-admin-tools"></span>',
'title' => esc_html__('Tools', 'wp-asset-clean-up'),
'page' => 'wpassetcleanup_tools'
),
'admin.php?page=wpassetcleanup_license' => array(
'icon' => '<span class="dashicons dashicons-awards"></span>',
'title' => esc_html__('License', 'wp-asset-clean-up'),
'page' => 'wpassetcleanup_license'
),
'admin.php?page=wpassetcleanup_get_help' => array(
'icon' => '<span class="dashicons dashicons-sos"></span>',
'title' => esc_html__('Help', 'wp-asset-clean-up'),
'page' => 'wpassetcleanup_get_help'
),
// [wpacu_lite]
'admin.php?page=wpassetcleanup_go_pro' => array(
'icon' => '<span class="dashicons dashicons-star-filled" style="color: inherit;"></span>',
'title' => __('Go Pro', 'wp-asset-clean-up'),
'page' => 'wpassetcleanup_go_pro',
'target' => '_blank'
)
// [/wpacu_lite]
);
global $current_screen;
$wpacuCurrentPage = isset($data['page']) ? $data['page'] : false;
if (! $wpacuCurrentPage) {
$wpacuCurrentPage = str_replace(
array(str_replace(' ', '-', strtolower(WPACU_PLUGIN_TITLE)) . '_page_', 'toplevel_page_'),
'',
$current_screen->base
);
}
$wpacuDefaultPageUrl = esc_url(admin_url(Misc::arrayKeyFirst($wpacuTopAreaLinks)));
$goBackToCurrentUrl = '&_wp_http_referer=' . urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) );
$isSettingsCurrentPage = ($wpacuCurrentPage !== WPACU_PLUGIN_ID . '_settings');
?>
<div id="wpacu-top-area">
<div id="wpacu-logo-wrap">
<a href="<?php echo esc_url($wpacuDefaultPageUrl); ?>">
<img alt="" src="<?php echo WPACU_PLUGIN_URL; ?>/assets/images/asset-cleanup-logo.png" />
<div class="wpacu-version-sign wpacu-lite">
<div>
LITE<div class="wpacu-version-text">v<?php echo WPACU_PLUGIN_VERSION; ?></div>
</div>
</div>
</a>
</div>
<div id="wpacu-quick-actions">
<span class="wpacu-actions-title"><?php _e('QUICK ACTIONS', 'wp-asset-clean-up'); ?>:</span>
<a href="<?php echo esc_url(wp_nonce_url(admin_url('admin-post.php?action=assetcleanup_clear_assets_cache' . $goBackToCurrentUrl),
'assetcleanup_clear_assets_cache')); ?>">
<span class="dashicons dashicons-update"></span> <?php _e('Clear CSS/JS Files Cache', 'wp-asset-clean-up'); ?>
</a>
|
<?php
if ($isSettingsCurrentPage) {
?>
<a style="text-decoration: none; color: #74777b;" href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_settings&wpacu_selected_tab_area=wpacu-setting-test-mode')); ?>">
<?php
}
echo esc_html__('TEST MODE', 'wp-asset-clean-up').': ';
if (Main::instance()->settings['test_mode']) {
echo '<strong style="color: green;">ON</strong> ';
echo '<span style="font-weight: 300; font-style: italic;">* settings only apply to you (logged-in admin)</span>';
} else {
echo 'OFF ';
echo '<span style="font-weight: 300; font-style: italic;">* settings apply to any visitor</span>';
}
if ($isSettingsCurrentPage) {
?>
</a>
<?php
}
?>
</div>
<div class="wpacu_clearfix"></div>
</div>
<div class="wpacu-tabs wpacu-tabs-style-topline">
<nav>
<ul>
<?php
foreach ($wpacuTopAreaLinks as $wpacuLink => $wpacuInfo) {
$wpacuIsCurrentPage = ($wpacuCurrentPage === $wpacuInfo['page']);
$wpacuIsAssetsManagerPageLink = ($wpacuInfo['page'] === 'wpassetcleanup_assets_manager');
$wpacuIsPluginsManagerPageLink = ($wpacuInfo['page'] === 'wpassetcleanup_plugins_manager');
$wpacuIsBulkUnloadsPageLink = ($wpacuInfo['page'] === 'wpassetcleanup_bulk_unloads');
$wpacuIsLicensePageLink = ($wpacuInfo['page'] === 'wpassetcleanup_license');
?>
<li class="<?php if ($wpacuIsCurrentPage) { echo 'wpacu-tab-current'; } ?>">
<?php
if ($wpacuIsAssetsManagerPageLink) {
$totalUnloadedAssets = Misc::getTotalUnloadedAssets('per_page');
if ($totalUnloadedAssets === 0) {
?>
<span class="extra-info assets-unloaded-false"><span class="dashicons dashicons-warning"></span> No unloads per page</span>
<?php
} elseif ($totalUnloadedAssets > 0) {
?>
<span class="extra-info assets-unloaded-true"><strong><?php echo (int)$totalUnloadedAssets; ?></strong> page unloads</span>
<?php
}
}
// [wpacu_lite]
if ($wpacuIsPluginsManagerPageLink) {
?>
<span class="extra-info assets-unloaded-false"><span class="dashicons dashicons-lock"></span> Premium Feature</span>
<?php
}
// [/wpacu_lite]
if ($wpacuIsBulkUnloadsPageLink) {
$totalBulkUnloadRules = Misc::getTotalBulkUnloadsFor('all');
if ($totalBulkUnloadRules === 0) {
?>
<span class="extra-info no-bulk-unloads assets-unloaded-false"><span class="dashicons dashicons-warning"></span> No bulk unloads</span>
<?php
} elseif ($totalBulkUnloadRules > 0) {
?>
<span class="extra-info has-bulk-unloads assets-unloaded-true"><strong><?php echo $totalBulkUnloadRules; ?></strong> bulk unload<?php echo ($totalBulkUnloadRules > 1) ? 's' : ''; ?></span>
<?php
}
}
?>
<a <?php if (isset($wpacuInfo['target']) && $wpacuInfo['target'] === '_blank') { ?> target="_blank" <?php } ?>
href="<?php echo esc_url(admin_url($wpacuLink)); ?>">
<?php echo wp_kses($wpacuInfo['icon'], array('span' => array('class' => array()))); ?> <span><?php echo esc_html($wpacuInfo['title']); ?></span>
</a>
</li>
<?php } ?>
</ul>
</nav>
</div><!-- /tabs -->

View File

@ -0,0 +1,56 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
include_once '_top-area.php';
$data['locked_for_pro'] = '<span class="dashicons dashicons-info"></span> Managing CSS/JS on the selected page requires an <a href="'.WPACU_PLUGIN_GO_PRO_URL.'?utm_source=plugin_assets_manager&utm_medium=[wpacu_chosen_page_type]">upgrade to the Pro version</a> of Asset CleanUp.';
?>
<div class="wpacu-wrap">
<nav class="nav-tab-wrapper nav-assets-manager">
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_assets_manager&wpacu_for=homepage')); ?>" class="nav-tab <?php if ($data['for'] === 'homepage') { ?>nav-tab-active<?php } ?>"><?php esc_html_e('Homepage', 'wp-asset-clean-up'); ?></a>
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_assets_manager&wpacu_for=posts')); ?>" class="nav-tab <?php if ($data['for'] === 'posts') { ?>nav-tab-active<?php } ?>"><?php esc_html_e('Posts', 'wp-asset-clean-up'); ?></a>
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_assets_manager&wpacu_for=pages')); ?>" class="nav-tab <?php if ($data['for'] === 'pages') { ?>nav-tab-active<?php } ?>"><?php esc_html_e('Pages', 'wp-asset-clean-up'); ?></a>
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_assets_manager&wpacu_for=custom-post-types')); ?>" class="nav-tab <?php if ($data['for'] === 'custom-post-types') { ?>nav-tab-active<?php } ?>"><?php esc_html_e('Custom Post Types', 'wp-asset-clean-up'); ?></a>
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_assets_manager&wpacu_for=media-attachment')); ?>" class="nav-tab <?php if ($data['for'] === 'media-attachment') { ?>nav-tab-active<?php } ?>"><?php esc_html_e('Media', 'wp-asset-clean-up'); ?></a>
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_assets_manager&wpacu_for=category')); ?>" class="nav-tab for-pro <?php if ($data['for'] === 'category') { ?>nav-tab-active<?php } ?>"><img style="opacity: 0.4;" width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" valign="top" alt=""> <?php esc_html_e('Category', 'wp-asset-clean-up'); ?></a>
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_assets_manager&wpacu_for=tag')); ?>" class="nav-tab for-pro <?php if ($data['for'] === 'tag') { ?>nav-tab-active<?php } ?>"><img style="opacity: 0.4;" width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" valign="top" alt=""> <?php esc_html_e('Tag', 'wp-asset-clean-up'); ?></a>
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_assets_manager&wpacu_for=custom-taxonomy')); ?>" class="nav-tab for-pro <?php if ($data['for'] === 'custom-taxonomy') { ?>nav-tab-active<?php } ?>"><img style="opacity: 0.4;" width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" valign="top" alt=""> <?php esc_html_e('Custom Taxonomy', 'wp-asset-clean-up'); ?></a>
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_assets_manager&wpacu_for=search')); ?>" class="nav-tab for-pro <?php if ($data['for'] === 'search') { ?>nav-tab-active<?php } ?>"><img style="opacity: 0.4;" width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" valign="top" alt=""> <?php esc_html_e('Search', 'wp-asset-clean-up'); ?></a>
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_assets_manager&wpacu_for=author')); ?>" class="nav-tab for-pro <?php if ($data['for'] === 'author') { ?>nav-tab-active<?php } ?>"><img style="opacity: 0.4;" width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" valign="top" alt=""> <?php esc_html_e('Author', 'wp-asset-clean-up'); ?></a>
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_assets_manager&wpacu_for=date')); ?>" class="nav-tab for-pro <?php if ($data['for'] === 'date') { ?>nav-tab-active<?php } ?>"><img style="opacity: 0.4;" width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" valign="top" alt=""> <?php esc_html_e('Date', 'wp-asset-clean-up'); ?></a>
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_assets_manager&wpacu_for=404-not-found')); ?>" class="nav-tab for-pro <?php if ($data['for'] === '404-not-found') { ?>nav-tab-active<?php } ?>"><img style="opacity: 0.4;" width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" valign="top" alt=""> <?php esc_html_e('404 Not Found', 'wp-asset-clean-up'); ?></a>
</nav>
<div class="wpacu_clearfix"></div>
<?php
if ($data['for'] === 'homepage') {
include_once '_admin-pages-assets-manager/_homepage.php';
} elseif ($data['for'] === 'posts') {
include_once '_admin-pages-assets-manager/_posts.php';
} elseif ($data['for'] === 'custom-post-types') {
include_once '_admin-pages-assets-manager/_custom-post-types.php';
} elseif ($data['for'] === 'pages') {
include_once '_admin-pages-assets-manager/_pages.php';
} elseif ($data['for'] === 'media-attachment') {
include_once '_admin-pages-assets-manager/_media-attachment.php';
} elseif ($data['for'] === 'category') {
include_once '_admin-pages-assets-manager/_category.php';
} elseif ($data['for'] === 'tag') {
include_once '_admin-pages-assets-manager/_tag.php';
} elseif ($data['for'] === 'custom-taxonomy') {
include_once '_admin-pages-assets-manager/_custom-taxonomy.php';
} elseif ($data['for'] === 'search') {
include_once '_admin-pages-assets-manager/_search.php';
} elseif ($data['for'] === 'author') {
include_once '_admin-pages-assets-manager/_author.php';
} elseif ($data['for'] === 'date') {
include_once '_admin-pages-assets-manager/_date.php';
} elseif ($data['for'] === '404-not-found') {
include_once '_admin-pages-assets-manager/_not-found.php';
}
?>
</div>

View File

@ -0,0 +1,73 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
include_once '_top-area.php';
?>
<div class="wpacu-wrap wpacu-get-help-wrap">
<!-- [wpacu_lite] -->
<p>Go to: &nbsp; <span class="dashicons dashicons-welcome-learn-more"></span> <a href="<?php echo admin_url('admin.php?page=wpassetcleanup_getting_started'); ?>">Getting Started</a> &nbsp;&nbsp; <span class="dashicons dashicons-text-page"></span> <a target="_blank" href="https://assetcleanup.com/docs/?utm_source=plugin_help_page_pro">Documentation</a></p>
<!-- [/wpacu_lite] -->
<p>If you believe <?php echo WPACU_PLUGIN_TITLE; ?> has a bug (e.g. you're getting JavaScript or PHP errors generated by <?php echo WPACU_PLUGIN_TITLE; ?> or the selected scripts are not unloading etc.) that needs to be fixed, then <a target="_blank" href="https://wordpress.org/support/plugin/wp-asset-clean-up/?utm_source=wpacu_lite_plugin_help_page">please report it by opening a support ticket</a> on the forum which is dedicated for assistance related to the Lite version. Note that the support is only for reporting bugs &amp; any incompatibility with themes/plugins and not for custom work request.</p>
<hr />
<div class="help-content-wrap">
<div class="help-content upgrade-help">
<h2 class="content-title"><?php _e('I have purchased the Pro version. How to do the upgrade?', 'wp-asset-clean-up'); ?></h2>
<ul>
<li><strong>1)</strong> <?php
echo sprintf(
__('Go to %s"Plugins" -&gt; "Add New" -&gt; "Upload Plugin"%s / You will notice an upload form and an "Install Now" submit button. Download the ZIP file you received in your purchase email receipt (<em>example: wp-asset-clean-up-pro-v1.0.8.5.zip</em>), attach it to the form and install the new upgraded plugin.', 'wp-asset-clean-up'),
'<a style="text-decoration: none;" target="_blank" href="'.admin_url('plugin-install.php?tab=upload').'">', '</a>'
); ?>
<div class="wpacu-image-area">
<img src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/images/wpacu-upgrade-steps/wpacu-upgrade-step-1-choose-file.jpg" alt="" />
</div>
<hr />
</li>
<li><strong>2)</strong> <?php _e('Finally, <strong>activate</strong> Asset CleanUp Pro! That\'s it', 'wp-asset-clean-up'); ?> <span class="dashicons dashicons-smiley"></span>
<div class="wpacu-image-area activate-plugin">
<img src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/images/wpacu-upgrade-steps/wpacu-upgrade-step-2-activate-plugin.jpg" alt="" />
</div>
</li>
</ul>
<p><strong><?php _e('Reminder', 'wp-asset-clean-up'); ?>:</strong> <?php _e('Once the Pro version is active, make sure to get the license key from the purchase email receipt and activate it in "License" in order to be eligible for plugin updates from the Dashboard.', 'wp-asset-clean-up'); ?></p>
</div>
<div class="help-content tech-help second">
<h2 class="content-title"><?php _e('In case you are stuck, need assistance or just want to save time you would spend for your website optimization, we can help you!', 'wp-asset-clean-up'); ?></h2>
<p>If the following scenarios apply to you &amp; 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>
<ul class="hire-reasons">
<li><span class="dashicons dashicons-yes"></span> You have many CSS and JavaScript files loaded in a page and you're not sure which ones you could prevent from loading, worrying that something could be messed up. A Codeable expert could analyse your pages and give the advices needed.</li>
<li><span class="dashicons dashicons-yes"></span> You want to improve the speed of your website and you need help getting a faster loading page and a better Google PageSpeed score.</li>
<li><span class="dashicons dashicons-yes"></span> You need help with a WordPress task and you're looking for a professional to help you with whatever you need.</li>
<li><span class="dashicons dashicons-yes"></span> You are looking to fully optimize your website to get a page speed score as high as possible.</li>
</ul>
<p><strong>Getting started is easy:</strong></p>
<ol class="getting-started">
<li>Explain your website needs or problems</li>
<li>The experts reach out to you with questions &amp; estimates.</li>
<li>You choose the one you want to work with.</li>
</ol>
<div class="wpacu_clearfix"></div>
<hr /><br />
<div class="wpacu-btns">
<a class="btn btn-success" href="https://codeable.io/developers/speed-optimization/?ref=d3TOr"><?php _e('Hire a Speed Optimization Expert', 'wp-asset-clean-up'); ?></a>
&nbsp;&nbsp;
<a class="btn btn-secondary" href="https://codeable.io/?ref=d3TOr"><?php _e('Find out more', 'wp-asset-clean-up'); ?></a>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,48 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
?>
<div class="wpacu-wrap">
<div class="about-wrap wpacu-about-wrap">
<h1><?php echo sprintf(__('Welcome to %s %s', 'wp-asset-clean-up'), 'Asset CleanUp', WPACU_PLUGIN_VERSION); ?></h1>
<p class="about-text wpacu-about-text">
<?php _e('Thank you for installing this page speed booster plugin', 'wp-asset-clean-up'); ?>! <?php _e('Prepare to make your WordPress website faster &amp; lighter by removing the useless CSS &amp; JavaScript files from your pages.', 'wp-asset-clean-up'); ?>
<?php echo sprintf(
__('For maximum performance, %s works best when used with either a %scaching plugin%s, the in-built hosting caching (e.g. via %sWPEngine%s, Kinsta, etc.) or something like Varnish.', 'wp-asset-clean-up'),
'Asset CleanUp',
'<a style="text-decoration: none; color: #555d66;" href="https://wordpress.org/plugins/wp-fastest-cache/">', '</a>',
'<a style="text-decoration: none; color: #555d66;" href="https://www.gabelivan.com/visit/wp-engine">', '</a>'
);
?>
<img src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/images/wpacu-logo-transparent-bg-v1.png" alt="" />
</p>
<h2 class="nav-tab-wrapper wp-clearfix">
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_getting_started&wpacu_for=how-it-works')); ?>" class="nav-tab <?php if ($data['for'] === 'how-it-works') { ?>nav-tab-active<?php } ?>"><?php _e('How it works', 'wp-asset-clean-up'); ?></a>
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_getting_started&wpacu_for=benefits-fast-pages')); ?>" class="nav-tab <?php if ($data['for'] === 'benefits-fast-pages') { ?>nav-tab-active<?php } ?>"><?php _e('Benefits of a Fast Website', 'wp-asset-clean-up'); ?></a>
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_getting_started&wpacu_for=start-optimization')); ?>" class="nav-tab <?php if ($data['for'] === 'start-optimization') { ?>nav-tab-active<?php } ?>"><?php _e('Start Optimization', 'wp-asset-clean-up'); ?></a>
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_getting_started&wpacu_for=video-tutorials')); ?>" class="nav-tab <?php if ($data['for'] === 'video-tutorials') { ?>nav-tab-active<?php } ?>"><span class="dashicons dashicons-video-alt3" style="color: #ff0000;"></span> <?php _e('Video Tutorials', 'wp-asset-clean-up'); ?></a>
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_getting_started&wpacu_for=lite-vs-pro')); ?>" class="nav-tab <?php if ($data['for'] === 'lite-vs-pro') { ?>nav-tab-active<?php } ?>"><span class="dashicons dashicons-awards"></span> <?php _e('Lite vs Pro', 'wp-asset-clean-up'); ?></a>
</h2>
<div class="about-wrap-content">
<?php
if ($data['for'] === 'how-it-works') {
include_once '_admin-page-getting-started-areas/_how-it-works.php';
} elseif ($data['for'] === 'benefits-fast-pages') {
include_once '_admin-page-getting-started-areas/_benefits-fast-pages.php';
} elseif ($data['for'] === 'start-optimization') {
include_once '_admin-page-getting-started-areas/_start-optimization.php';
} elseif ($data['for'] === 'video-tutorials') {
include_once '_admin-page-getting-started-areas/_video-tutorials.php';
} elseif ($data['for'] === 'lite-vs-pro') {
include_once '_admin-page-getting-started-areas/_lite-vs-pro.php';
}
?>
</div>
</div>
</div>

View File

@ -0,0 +1,33 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
include_once '_top-area.php';
?>
<div class="wpacu-wrap">
<p><?php echo sprintf(
__('You\'re using the lite version of %s (v%s), so no license key is needed. You\'ll receive automatic notifications whenever a new version is available for download.', 'wp-asset-clean-up'),
WPACU_PLUGIN_TITLE,
WPACU_PLUGIN_VERSION
);
?></p>
<p><em><?php echo sprintf(
__('To unlock all features and get premium support, you can %supgrade to the Pro version%s.', 'wp-asset-clean-up'),
'<a href="'.apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=plugin_license').'">', '</a>'
);
?></em></p>
<div class="wrap-upgrade-info">
<p><span class="dashicons dashicons-info"></span> <?php echo sprintf(
__('If you already purchased the Pro version and you don\'t know how to activate it, %sfollow the steps from the "Help" section%s.', 'wp-asset-clean-up'),
'<a href="'.esc_url(admin_url('admin.php?page=wpassetcleanup_get_help')).'">', '</a>'
);
?></p>
<div class="wpacu_clearfix"></div>
</div>
</div>

View File

@ -0,0 +1,21 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
include_once '_top-area.php';
?>
<div class="wrap wpacu-overview-wrap">
<div style="padding: 0 0 10px; line-height: 22px;"><strong>Note:</strong> This overview contains all the changes of any kind (unload rules, load exceptions, preloads, notes, async/defer SCRIPT attributes, changed positions, etc.) made via Asset CleanUp to any of the loaded (enqueued) CSS/JS files. To make any changes to the values below, please use the "CSS &amp; JS Manager" or "Bulk Changes" tabs.</div>
<div style="padding: 0 10px 0 0;">
<?php
include_once '_admin-page-overview-areas/_styles.php';
include_once '_admin-page-overview-areas/_scripts.php';
include_once '_admin-page-overview-areas/_page-options.php';
include_once '_admin-page-overview-areas/_special-settings.php';
?>
</div>
</div>

View File

@ -0,0 +1,44 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
include_once '_top-area.php';
do_action('wpacu_admin_notices');
if ( ! \WpAssetCleanUp\Main::instance()->currentUserCanViewAssetsList() ) {
?>
<div class="wpacu-error" style="padding: 10px;">
<?php echo sprintf(esc_html__('Only the administrators listed here can manage plugins: %s"Settings" &#10141; "Plugin Usage Preferences" &#10141; "Allow managing assets to:"%s. If you believe you should have access to managing plugins, you can add yourself to that list.', 'wp-asset-clean-up'), '<a target="_blank" href="'.esc_url(admin_url('admin.php?page=wpassetcleanup_settings&wpacu_selected_tab_area=wpacu-setting-plugin-usage-settings')).'">', '</a>'); ?></div>
<?php
return;
}
?>
<div class="wpacu-sub-page-tabs-wrap"> <!-- Sub-tabs wrap -->
<!-- Sub-nav menu -->
<label class="wpacu-sub-page-nav-label <?php if ($data['wpacu_sub_page'] === 'manage_plugins_front') { ?>wpacu-selected<?php } ?>"><a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_plugins_manager&wpacu_sub_page=manage_plugins_front')); ?>"><span class="dashicons dashicons-admin-home"></span> IN FRONTEND VIEW (your visitors)</a></label>
<label class="wpacu-sub-page-nav-label <?php if ($data['wpacu_sub_page'] === 'manage_plugins_dash') { ?>wpacu-selected<?php } ?>"><a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_plugins_manager&wpacu_sub_page=manage_plugins_dash')); ?>"><span class="dashicons dashicons-dashboard"></span> IN THE DASHBOARD /wp-admin/</a></label>
<!-- /Sub-nav menu -->
</div> <!-- /Sub-tabs wrap -->
<?php if ($data['wpacu_sub_page'] === 'manage_plugins_front') { ?>
<div id="wpacu-plugins-manage-front-notice-top">
<p style="margin-top: 0;"><strong>Remember:</strong> Please be careful when using this feature as it would not only unload all the CSS/JS that is loading from a plugin, but everything else (e.g. its backend PHP code, HTML output printed via <code>wp_head()</code> or <code>wp_footer()</code> action hooks, any cookies that are set, .etc). It would be like the plugin is deactivated for the pages where it's chosen to be unloaded. Consider enabling "Test Mode" in plugin's "Settings" if you're unsure about anything. All the rules set below are applied in the front-end view only. They are not taking effect within the Dashboard (the function <code style="font-size: inherit;">is_admin()</code> is used to verify that) to make sure nothing will get broken while you're configuring any plugins' settings. <a style="text-decoration: none; color: #004567;" target="_blank" href="https://www.assetcleanup.com/docs/?p=372"><span class="dashicons dashicons-info"></span>&nbsp;Read more</a></p>
<p style="margin-bottom: 0;">If you wish to completely stop using a plugin in both admin/frontend pages, the most effective way would be to deactivate it from the "Plugins" -&gt; "Installed Plugins" area.</p>
</div>
<?php
include_once __DIR__.'/_admin-page-plugins-manager/_front.php';
} elseif ($data['wpacu_sub_page'] === 'manage_plugins_dash') {
?>
<div style="border-radius: 5px; line-height: 20px; background: white; padding: 8px; margin-bottom: 16px; width: 95%; border-left: 2px solid #004567; border-top: 1px solid #e7e7e7; border-right: 1px solid #e7e7e7; border-bottom: 1px solid #e7e7e7;">
<p style="margin-top: 0;"><strong>Remember:</strong> Using this feature is only recommended for advanced users (e.g. developers/admins that know very well their website and the consequences of having plugins unloaded for certain pages) &amp; who really need it. A set rule would not only unload all the CSS/JS that is loading from a plugin, but everything else (e.g. its backend PHP code, HTML output printed via <code>admin_head()</code> or <code>admin_footer()</code> action hooks, any cookies that are set, .etc).</p>
<p style="margin-top: 0;">Reasons for using this feature include: some admin pages are very slow, you want to avoid a conflict between two plugins, etc. It would be like the plugin is deactivated within the Dashboard for the pages where it's chosen to be unloaded. The function <code style="font-size: inherit;">is_admin()</code> is used to perform the verification to determine if the user is inside a Dashboard page. If you make a mistake and set a rule that doesn't allow you to access a page anymore, you can cancel it by appending the following query string to the URL: <code>&amp;wpacu_no_dash_plugin_unload</code>, thus allowing you to change/remove the rule in this management page. <a style="text-decoration: none; color: #004567;" target="_blank" href="https://www.assetcleanup.com/docs/?p=1128"><span class="dashicons dashicons-info"></span>&nbsp;Read more</a></p>
<p style="margin-bottom: 0;">If you wish to completely stop using a plugin in both admin/frontend pages, the most effective way would be to deactivate it from the "Plugins" -&gt; "Installed Plugins" area.</p>
</div>
<?php
include_once __DIR__.'/_admin-page-plugins-manager/_dash.php';
}

View File

@ -0,0 +1,128 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
include_once '_top-area.php';
$wpacuTabList = array(
'bulk_unloaded' => __('Bulk Unloaded (page types)', 'wp-asset-clean-up'),
'regex_unloads' => __('RegEx Unloads', 'wp-asset-clean-up'),
'regex_load_exceptions' => __('RegEx Load Exceptions', 'wp-asset-clean-up'),
'preloaded_assets' => __('Preloaded CSS/JS', 'wp-asset-clean-up'),
'script_attrs' => __('Defer &amp; Async (site-wide)', 'wp-asset-clean-up'),
'assets_positions' => __('Updated CSS/JS positions', 'wp-asset-clean-up')
);
$wpacuTabCurrent = isset($_REQUEST['wpacu_bulk_menu_tab']) && array_key_exists( $_REQUEST['wpacu_bulk_menu_tab'], $wpacuTabList ) ? sanitize_text_field($_REQUEST['wpacu_bulk_menu_tab']) : 'bulk_unloaded';
?>
<div class="wpacu-wrap <?php if ($data['plugin_settings']['input_style'] !== 'standard') { echo 'wpacu-switch-enhanced'; } ?>">
<ul class="wpacu-bulk-changes-tabs">
<?php
foreach ($wpacuTabList as $wpacuTabKey => $wpacuTabValue) {
?>
<li <?php if ($wpacuTabKey === $wpacuTabCurrent) { ?>class="current"<?php } ?>>
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_bulk_unloads&wpacu_bulk_menu_tab='.$wpacuTabKey)); ?>"><?php echo esc_html($wpacuTabValue); ?></a>
</li>
<?php
}
?>
</ul>
<?php
if ($wpacuTabCurrent === 'bulk_unloaded') {
include_once '_admin-page-settings-bulk-changes/_bulk-unloaded.php';
} elseif($wpacuTabCurrent === 'regex_unloads') {
include_once '_admin-page-settings-bulk-changes/_regex-unloads.php';
} elseif($wpacuTabCurrent === 'regex_load_exceptions') {
include_once '_admin-page-settings-bulk-changes/_regex-load-exceptions.php';
} elseif ($wpacuTabCurrent === 'preloaded_assets') {
include_once '_admin-page-settings-bulk-changes/_preloaded-assets.php';
} elseif ($wpacuTabCurrent === 'script_attrs') {
include_once '_admin-page-settings-bulk-changes/_script-attrs.php';
} elseif ($wpacuTabCurrent === 'assets_positions') {
include_once '_admin-page-settings-bulk-changes/_assets-positions.php';
}
/**
* @param $handle
* @param $assetType
* @param $data
* @param string $for ('default': bulk unloads, regex unloads)
*/
function wpacuRenderHandleTd($handle, $assetType, $data, $for = 'default')
{
global $wp_version;
$isCoreFile = false; // default
if ( $for === 'default' ) {
// Show the original "src" and "ver, not the altered one
// (in case filters such as "wpacu_{$handle}_(css|js)_handle_obj" were used to load alternative versions of the file, depending on the situation)
$srcKey = isset($data['assets_info'][ $assetType ][ $handle ]['src_origin']) ? 'src_origin' : 'src';
$verKey = isset($data['assets_info'][ $assetType ][ $handle ]['ver_origin']) ? 'ver_origin' : 'ver';
$src = (isset( $data['assets_info'][ $assetType ][ $handle ][$srcKey] ) && $data['assets_info'][ $assetType ][ $handle ][$srcKey]) ? $data['assets_info'][ $assetType ][ $handle ][$srcKey] : false;
$isExternalSrc = true;
if (\WpAssetCleanUp\Misc::getLocalSrc($src)
|| strpos($src, '/?') !== false // Dynamic Local URL
|| strpos(str_replace(site_url(), '', $src), '?') === 0 // Starts with ? right after the site url (it's a local URL)
) {
$isExternalSrc = false;
$isCoreFile = \WpAssetCleanUp\Misc::isCoreFile($data['assets_info'][$assetType][$handle]);
}
if (strpos($src, '/') === 0 && strpos($src, '//') !== 0) {
$src = site_url() . $src;
}
if (isset($data['assets_info'][ $assetType ][ $handle ][$verKey]) && $data['assets_info'][ $assetType ][ $handle ][$verKey]) {
$verToPrint = is_array($data['assets_info'][ $assetType ][ $handle ][$verKey])
? implode(',', $data['assets_info'][ $assetType ][ $handle ][$verKey])
: $data['assets_info'][ $assetType ][ $handle ][$verKey];
$verToAppend = is_array($data['assets_info'][ $assetType ][ $handle ][$verKey])
? http_build_query(array('ver' => $data['assets_info'][ $assetType ][ $handle ][$verKey]))
: 'ver='.$data['assets_info'][ $assetType ][ $handle ][$verKey];
} else {
$verToAppend = 'ver='.$wp_version;
$verToPrint = $wp_version;
}
?>
<strong><span style="color: green;"><?php echo esc_html($handle); ?></span></strong>
<small><em>v<?php echo esc_html($verToPrint); ?></em></small>
<?php
if ($isCoreFile) {
?>
<span title="WordPress Core File" style="font-size: 15px; vertical-align: middle;" class="dashicons dashicons-wordpress-alt wpacu-tooltip"></span>
<?php
}
?>
<?php
// [wpacu_pro]
$preloadedStatus = isset($data['assets_info'][ $assetType ][ $handle ]['preloaded_status']) ? $data['assets_info'][ $assetType ][ $handle ]['preloaded_status'] : false;
if ($preloadedStatus === 'async') { echo '&nbsp;(<strong><em>'.$preloadedStatus.'</em></strong>)'; }
// [/wpacu_pro]
if ( $src ) {
$appendAfterSrc = strpos($src, '?') === false ? '?'.$verToAppend : '&'.$verToAppend;
?>
<div><a <?php if ($isExternalSrc) { ?> data-wpacu-external-source="<?php echo esc_attr($src . $appendAfterSrc); ?>" <?php } ?> href="<?php echo esc_html($src . $appendAfterSrc); ?>" target="_blank"><small><?php echo str_replace( site_url(), '', $src ); ?></small></a> <?php if ($isExternalSrc) { ?><span data-wpacu-external-source-status></span><?php } ?></div>
<?php
$maybeInactiveAsset = \WpAssetCleanUp\Misc::maybeIsInactiveAsset($src);
if (is_array($maybeInactiveAsset) && ! empty($maybeInactiveAsset)) {
if ($maybeInactiveAsset['from'] === 'plugin') { ?>
<small><strong>Note:</strong> <span style="color: darkred;">The plugin `<strong><?php echo esc_html($maybeInactiveAsset['name']); ?></strong>` seems to be inactive, thus any rules set are also inactive &amp; irrelevant, unless you re-activate the plugin.</span></small>
<?php } elseif ($maybeInactiveAsset['from'] === 'theme') { ?>
<small><strong>Note:</strong> <span style="color: darkred;">The theme `<strong><?php echo esc_html($maybeInactiveAsset['name']); ?></strong>` seems to be inactive, thus any rules set are also inactive &amp; irrelevant, unless you re-activate the theme.</span></small>
<?php }
}
}
}
}
?>
</div>

View File

@ -0,0 +1,179 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
include_once '_top-area.php';
if (! defined('WPACU_USE_MODAL_BOX')) {
define('WPACU_USE_MODAL_BOX', true);
}
do_action('wpacu_admin_notices');
$wikiStatus = ($data['wiki_read'] == 1) ? '<small style="font-weight: 200; color: green;">* '.esc_html__('read', 'wp-asset-clean-up').'</small>'
: '<small style="font-weight: 200; color: #cc0000;"><span class="dashicons dashicons-warning" style="width: 15px; height: 15px; margin: 2px 0 0 0; font-size: 16px;"></span> '.esc_html__('unread', 'wp-asset-clean-up').'</small>';
$showSettingsType = isset($_GET['wpacu_show_all']) ? 'all' : 'tabs';
$selectedTabArea = $selectedSubTabArea = '';
if ($showSettingsType === 'tabs') {
$settingsTabs = array(
'wpacu-setting-strip-the-fat' => esc_html__( 'Stripping the "fat"', 'wp-asset-clean-up' ) . ' ' . $wikiStatus,
'wpacu-setting-plugin-usage-settings' => esc_html__( 'Plugin Usage Preferences', 'wp-asset-clean-up' ),
'wpacu-setting-test-mode' => esc_html__( 'Test Mode', 'wp-asset-clean-up' ),
'wpacu-setting-optimize-css' => esc_html__( 'Optimize CSS', 'wp-asset-clean-up' ),
'wpacu-setting-optimize-js' => esc_html__( 'Optimize JavaScript', 'wp-asset-clean-up' ),
'wpacu-setting-cdn-rewrite-urls' => esc_html__( 'CDN: Rewrite assets URLs', 'wp-asset-clean-up' ),
'wpacu-setting-common-files-unload' => esc_html__( 'Site-Wide Common Unloads', 'wp-asset-clean-up' ),
'wpacu-setting-html-source-cleanup' => esc_html__( 'HTML Source CleanUp', 'wp-asset-clean-up' ),
'wpacu-setting-local-fonts' => esc_html__( 'Local Fonts', 'wp-asset-clean-up' ),
'wpacu-setting-google-fonts' => esc_html__( 'Google Fonts', 'wp-asset-clean-up' ),
'wpacu-setting-disable-rss-feed' => esc_html__( 'Disable RSS Feed', 'wp-asset-clean-up' ),
'wpacu-setting-disable-xml-rpc' => esc_html__( 'Disable XML-RPC', 'wp-asset-clean-up' )
);
$settingsSubTabs = array(
'wpacu-google-fonts-optimize',
'wpacu-google-fonts-remove'
);
$settingsTabActive = 'wpacu-setting-plugin-usage-settings';
// Is 'Stripping the "fat"' marked as read? Mark the "General & Files Management" as the default tab
$defaultTabArea = ($data['wiki_read'] == 1) ? 'wpacu-setting-plugin-usage-settings' : 'wpacu-setting-strip-the-fat';
$selectedTabArea = isset($_REQUEST['wpacu_selected_tab_area']) && array_key_exists($_REQUEST['wpacu_selected_tab_area'],
$settingsTabs) // the tab id area has to be one within the list above
? $_REQUEST['wpacu_selected_tab_area'] // after update
: $defaultTabArea; // default
if ($selectedTabArea && array_key_exists($selectedTabArea, $settingsTabs)) {
$settingsTabActive = $selectedTabArea;
}
$selectedSubTabArea = isset($_REQUEST['wpacu_selected_sub_tab_area']) && in_array($_REQUEST['wpacu_selected_sub_tab_area'],
$settingsSubTabs) // the sub tab id area has to be one within the list above
? $_REQUEST['wpacu_selected_sub_tab_area']
: ''; // default
}
?>
<div class="wpacu-wrap wpacu-settings-area <?php if ($showSettingsType === 'all') { echo 'wpacu-settings-show-all'; } ?> <?php if ($data['input_style'] !== 'standard') { ?>wpacu-switch-enhanced<?php } else { ?>wpacu-switch-standard<?php } ?>">
<form method="post" action="" id="wpacu-settings-form">
<input type="hidden" name="wpacu_settings_page" value="1" />
<div id="wpacu-settings-vertical-tab-wrap">
<?php if ($showSettingsType === 'tabs') { ?>
<div class="wpacu-settings-tab">
<?php
$wpacuOptionOn = '<span class="wpacu-circle-status wpacu-on"></span>';
$wpacuOptionOff = '<span class="wpacu-circle-status wpacu-off"></span>';
foreach ($settingsTabs as $settingsTabKey => $settingsTabText) {
$wpacuActiveTab = ($settingsTabActive === $settingsTabKey) ? 'active' : '';
$wpacuNavTextSub = '';
if ($settingsTabKey === 'wpacu-setting-test-mode') {
$testModeStatus = ($data['test_mode'] == 1) ? $wpacuOptionOn : $wpacuOptionOff;
$wpacuNavTextSub = '<div class="wpacu-tab-extra-text" style="display: inline-block; margin-left: 8px;"><small><span class="wpacu-status-wrap" data-linked-to="wpacu_enable_test_mode">'.$testModeStatus.'</span></small></div>';
}
if ($settingsTabKey === 'wpacu-setting-optimize-css') {
$cssMinifyStatus = ($data['minify_loaded_css'] == 1 && empty($data['is_optimize_css_enabled_by_other_party'])) ? $wpacuOptionOn : $wpacuOptionOff;
$cssCombineStatus = ($data['combine_loaded_css'] == 1 && empty($data['is_optimize_css_enabled_by_other_party'])) ? $wpacuOptionOn : $wpacuOptionOff;
$wpacuNavTextSub = '<div class="wpacu-tab-extra-text"><small><span class="wpacu-status-wrap" data-linked-to="wpacu_minify_css_enable">' . $cssMinifyStatus . ' '.__('Minify', 'wp-asset-clean-up').'</span> &nbsp;&nbsp; <span class="wpacu-status-wrap" data-linked-to="wpacu_combine_loaded_css_enable">' . $cssCombineStatus . ' '.__('Combine', 'wp-asset-clean-up').'</span>&nbsp; <span style="color: gray;">+ Defer, Inline</span></small></small></div>';
if (! empty($data['is_optimize_css_enabled_by_other_party']) || (defined('WPACU_WP_ROCKET_REMOVE_UNUSED_CSS_ENABLED') && WPACU_WP_ROCKET_REMOVE_UNUSED_CSS_ENABLED)) {
$wpacuNavTextSub .= '<div style="margin-top: 3px;"><small style="font-weight: lighter; color: gray;"><strong>Status:</strong> Partially locked, already enabled in other plugin(s)</small></div>';
}
}
if ($settingsTabKey === 'wpacu-setting-optimize-js') {
$jsMinifyStatus = ($data['minify_loaded_js'] == 1 && empty($data['is_optimize_js_enabled_by_other_party'])) ? $wpacuOptionOn : $wpacuOptionOff;
$jsCombineStatus = ($data['combine_loaded_js'] == 1 && empty($data['is_optimize_js_enabled_by_other_party'])) ? $wpacuOptionOn : $wpacuOptionOff;
$wpacuNavTextSub = '<div class="wpacu-tab-extra-text"><small><span class="wpacu-status-wrap" data-linked-to="wpacu_minify_js_enable">' . $jsMinifyStatus . ' '.__('Minify', 'wp-asset-clean-up').'</span> &nbsp;&nbsp; <span class="wpacu-status-wrap" data-linked-to="wpacu_combine_loaded_js_enable">' . $jsCombineStatus . ' '.__('Combine', 'wp-asset-clean-up').'</span>&nbsp; <span style="color: gray;">+ Defer, Inline</span></small></small></div>';
if (! empty($data['is_optimize_js_enabled_by_other_party']) || (defined('WPACU_WP_ROCKET_DELAY_JS_ENABLED') && WPACU_WP_ROCKET_DELAY_JS_ENABLED)) {
$wpacuNavTextSub .= '<div style="margin-top: 3px;"><small style="font-weight: lighter; color: gray;"><strong>Status:</strong> Partially locked, already enabled in other plugin(s)</small></div>';
}
}
if ($settingsTabKey === 'wpacu-setting-cdn-rewrite-urls') {
$cdnRewriteStatus = ($data['cdn_rewrite_enable'] == 1) ? $wpacuOptionOn : $wpacuOptionOff;
$wpacuNavTextSub = '<div class="wpacu-tab-extra-text" style="display: inline-block; margin-left: 8px;"><small><span class="wpacu-status-wrap" data-linked-to="wpacu_cdn_rewrite_enable">'.$cdnRewriteStatus.'</span></small></div>';
}
if ($settingsTabKey === 'wpacu-setting-local-fonts') {
$wpacuNavTextSub .= '<div style="margin-top: 3px;"><small style="font-weight: lighter;">Font-Display, Preload</small></div>';
}
if ($settingsTabKey === 'wpacu-setting-google-fonts') {
$wpacuNavTextSub .= '<div style="margin-top: 3px;"><small style="font-weight: lighter;">Combine, Async Load, Font-Display, Preconnect, Preload, <span>Removal</span></small></div>';
}
?>
<a href="#<?php echo esc_attr($settingsTabKey); ?>"
class="wpacu-settings-tab-link <?php echo esc_attr($wpacuActiveTab); ?>"
data-wpacu-settings-tab-key="<?php echo esc_attr($settingsTabKey); ?>"><?php
echo \WpAssetCleanUp\Misc::stripIrrelevantHtmlTags($settingsTabText . $wpacuNavTextSub);
?></a>
<?php
}
?>
</div>
<?php } ?>
<?php
include_once '_admin-page-settings-plugin-areas/_strip-the-fat.php';
include_once '_admin-page-settings-plugin-areas/_plugin-usage-settings.php';
include_once '_admin-page-settings-plugin-areas/_test-mode.php';
include_once '_admin-page-settings-plugin-areas/_optimize-css.php';
include_once '_admin-page-settings-plugin-areas/_optimize-js.php';
include_once '_admin-page-settings-plugin-areas/_cdn-rewrite-urls.php';
include_once '_admin-page-settings-plugin-areas/_common-files-unload.php';
include_once '_admin-page-settings-plugin-areas/_html-source-cleanup.php';
include_once '_admin-page-settings-plugin-areas/_fonts-local.php';
include_once '_admin-page-settings-plugin-areas/_fonts-google.php';
include_once '_admin-page-settings-plugin-areas/_disable-rss-feed.php';
include_once '_admin-page-settings-plugin-areas/_disable-xml-rpc-protocol.php';
?>
<div class="clearfix"></div>
</div>
<div id="wpacu-update-button-area">
<?php
wp_nonce_field('wpacu_settings_update', 'wpacu_settings_nonce');
submit_button(__('Update All Settings', 'wp-asset-clean-up'));
?>
<div id="wpacu-updating-settings">
<img src="<?php echo esc_url(admin_url('images/spinner.gif')); ?>" align="top" width="20" height="20" alt="" />
</div>
</div>
<input type="hidden"
name="wpacu_selected_tab_area"
id="wpacu-selected-tab-area"
value="<?php echo esc_attr($selectedTabArea); ?>" />
<input type="hidden"
name="wpacu_selected_sub_tab_area"
id="wpacu-selected-sub-tab-area"
value="<?php echo esc_attr($selectedSubTabArea); ?>" />
</form>
</div>
<script type="text/javascript">
<?php
if (! empty($_POST)) {
?>
// Situations: After settings update (post mode), do not jump to URL's anchor
if (location.hash) {
setTimeout(function() {
window.scrollTo(0, 0);
}, 1);
}
<?php
}
?>
</script>

View File

@ -0,0 +1,276 @@
<?php
/*
* No direct access to this file
*/
if (! isset($data)) {
exit;
}
use WpAssetCleanUp\Misc;
include_once '_top-area.php';
do_action('wpacu_admin_notices');
?>
<div class="wpacu-wrap wpacu-tools-area">
<nav class="wpacu-tab-nav-wrapper nav-tab-wrapper">
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_tools&wpacu_for=reset')); ?>" class="nav-tab <?php if ($data['for'] === 'reset') { ?>nav-tab-active<?php } ?>"><?php _e('Reset', 'wp-asset-clean-up'); ?></a>
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_tools&wpacu_for=system_info')); ?>" class="nav-tab <?php if ($data['for'] === 'system_info') { ?>nav-tab-active<?php } ?>"><?php _e('System Info', 'wp-asset-clean-up'); ?></a>
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_tools&wpacu_for=storage')); ?>" class="nav-tab <?php if ($data['for'] === 'storage') { ?>nav-tab-active<?php } ?>"><?php _e('Storage Info', 'wp-asset-clean-up'); ?></a>
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_tools&wpacu_for=debug')); ?>" class="nav-tab <?php if ($data['for'] === 'debug') { ?>nav-tab-active<?php } ?>"><?php _e('Debugging', 'wp-asset-clean-up'); ?></a>
<?php
?>
<a href="<?php echo esc_url(admin_url('admin.php?page=wpassetcleanup_tools&wpacu_for=import_export')); ?>" class="nav-tab <?php if ($data['for'] === 'import_export') { ?>nav-tab-active<?php } ?>"><?php _e('Import &amp; Export', 'wp-asset-clean-up'); ?></a>
</nav>
<div class="wpacu-tools-container">
<form id="wpacu-tools-form" action="<?php echo esc_url(admin_url('admin.php?page='.WPACU_PLUGIN_ID.'_tools')); ?>" method="post">
<?php if ($data['for'] === 'reset') { ?>
<div><label for="wpacu-reset-drop-down"><?php _e('Do you need to reset the plugin to its initial settings or reset all changes?', 'wp-asset-clean-up'); ?></label></div>
<select name="wpacu-reset" id="wpacu-reset-drop-down">
<option value=""><?php _e('Select an option first', 'wp-asset-clean-up'); ?>...</option>
<option data-id="wpacu-warning-reset-settings" value="reset_settings"><?php _e('Reset "Settings"', 'wp-asset-clean-up'); ?></option>
<option data-id="wpacu-warning-reset-everything-except-settings" value="reset_everything_except_settings"><?php _e('Reset everything except "Settings"', 'wp-asset-clean-up'); ?></option>
<option data-id="wpacu-warning-reset-everything" value="reset_everything"><?php _e('Reset everything: "Settings", All Unloads (bulk &amp; per page) &amp; Load Exceptions', 'wp-asset-clean-up'); ?></option>
</select>
<div id="wpacu-license-data-remove-area">
<label for="wpacu-remove-license-data">
<input id="wpacu-remove-license-data" type="checkbox" name="wpacu-remove-license-data" value="1" /> <?php _e('Also remove any license data left from the Pro version if you ever used it (if you switched from Pro to Lite to make tests, but want to switch back to Pro, then do not choose this option)', 'wp-asset-clean-up'); ?>
</label>
</div>
<div id="wpacu-cache-assets-remove-area">
<label for="wpacu-remove-cache-assets">
<input id="wpacu-remove-cache-assets" type="checkbox" name="wpacu-remove-cache-assets" value="1" /> <?php echo sprintf(__('Also remove any cached CSS/JS files from %s', 'wp-asset-clean-up'), '<code>/'.basename(WP_CONTENT_DIR) . \WpAssetCleanUp\OptimiseAssets\OptimizeCommon::getRelPathPluginCacheDir().'</code>'); ?> (please be careful as there might be cached pages - e.g. people previewing your page via Google Cache - still making reference to the CSS/JS files, you can leave it unchecked if you are not about it)
</label>
</div>
<div id="wpacu-warning-read"><span class="dashicons dashicons-warning"></span> <strong><?php _e('Please read carefully below what the chosen action does as this process is NOT reversible.', 'wp-asset-clean-up'); ?></strong></div>
<div id="wpacu-warning-reset-settings" class="wpacu-warning">
<p><?php _e('This will reset every option from the "Settings" page/tab to the same state it was when you first activated the plugin.', 'wp-asset-clean-up'); ?></p>
</div>
<div id="wpacu-warning-reset-everything-except-settings" class="wpacu-warning">
<p><?php _e('This will reset everything (changes per page &amp; any load exceptions), except the values from "Settings".', 'wp-asset-clean-up'); ?></p>
<p><?php _e('This action is usually taken if you are happy with the "Settings" configuration, but want to clear everything else in terms of changes per page or group of pages.', 'wp-asset-clean-up'); ?></p>
</div>
<div id="wpacu-warning-reset-everything" class="wpacu-warning">
<p><?php _e('This will reset everything (settings, page loads &amp; any load exceptions) to the same point it was when you first activated the plugin. All the plugin\'s database records will be removed. It will technically have the same effect for your website as if the plugin would be deactivated.', 'wp-asset-clean-up'); ?></p>
<p><?php _e('This action is usually taken if:', 'wp-asset-clean-up'); ?></p>
<ul>
<li><?php echo sprintf(__('You believe you have applied some changes (such as unloading the wrong CSS / JavaScript file(s)) that broke the website and you need a quick fix to make it work the way it used to. Note that for this option, you can also enable "Test Mode" from the plugin\'s settings which will only apply the changes to you (logged-in administrator), while the regular visitors will view the website as if %s is deactivated.', 'wp-asset-clean-up'), WPACU_PLUGIN_TITLE); ?></li>
<li><?php echo sprintf(__('You want to uninstall Asset CleanUp and remove the traces left in the database (this is not the same thing as deactivating and activating the plugin again, as any changes applied would be preserved in this scenario)', 'wp-asset-clean-up'), WPACU_PLUGIN_TITLE); ?></li>
</ul>
</div>
<?php
wp_nonce_field('wpacu_tools_reset', 'wpacu_tools_reset_nonce');
?>
<input type="hidden" name="wpacu-tools-reset" value="1" />
<input type="hidden" name="wpacu-action-confirmed" id="wpacu-action-confirmed" value="" />
<div id="wpacu-reset-submit-area">
<button name="submit"
disabled="disabled"
id="wpacu-reset-submit-btn"
class="button button-secondary"><?php esc_attr_e('Submit', 'wp-asset-clean-up'); ?></button>
</div>
<?php } elseif ($data['for'] === 'system_info') {
wp_nonce_field('wpacu_get_system_info', 'wpacu_get_system_info_nonce');
?>
<input type="hidden" name="wpacu-get-system-info" value="1" />
<textarea disabled="disabled"
style="color: rgba(51,51,51,1); background: #eee; white-space: pre; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; width: 99%; max-width: 100%;"
rows="20"><?php echo esc_textarea($data['system_info']); ?></textarea>
<p><button name="submit"
id="wpacu-download-system-info-btn"
class="button button-primary"
style="font-size: 15px; line-height: 20px; padding: 3px 20px; height: 37px;">
<span style="padding-top: 1px;"
class="dashicons dashicons-download"></span>
<?php esc_attr_e('Download System Info For Support', 'wp-asset-clean-up'); ?>
</button>
</p>
<?php } ?>
</form>
<?php
if ($data['for'] === 'storage') {
$currentStorageDirRel = \WpAssetCleanUp\OptimiseAssets\OptimizeCommon::getRelPathPluginCacheDir();
$currentStorageDirFull = WP_CONTENT_DIR . $currentStorageDirRel;
$currentStorageDirIsWritable = is_writable($currentStorageDirFull);
if (! $currentStorageDirIsWritable) {
?>
<div class="wpacu-warning" style="width: 98%;">
<p style="margin: 0;">
<span style="color: #cc0000;" class="dashicons dashicons-warning"></span>
<?php echo sprintf(
__('The system detected the storage directory as non-writable, thus the minify &amp; combine CSS/JS files feature will not work. Please %smake it writable%s or raise a ticket with your hosting company about this matter.', 'wp-asset-clean-up'),
'<a href="https://wordpress.org/support/article/changing-file-permissions/">',
'</a>'
); ?>
</p>
</div>
<?php }
?>
<p>
<?php _e('Current storage directory', 'wp-asset-clean-up'); ?>: <code><?php echo WP_CONTENT_DIR; ?><strong><?php echo esc_html($currentStorageDirRel); ?></strong></code>
&nbsp; <?php if ($currentStorageDirIsWritable) {
echo '<span style="color: green;"><span class="dashicons dashicons-yes"></span> '.__('writable', 'wp-asset-clean-up').'</span>';
} ?>
</p>
<p><?php _e('Depending on the current settings, a storage caching directory of the optimized files is needed', 'wp-asset-clean-up'); ?>. Reason being that specific CSS/JS files had to be altered and they are retrieved faster from the caching directory, rather than altering then "on the fly" on every page load. <span style="color: #004567;" class="dashicons dashicons-info"></span> <a target="_blank" href="https://assetcleanup.com/docs/?p=526">Read more</a></p>
<?php
$storageStats = \WpAssetCleanUp\OptimiseAssets\OptimizeCommon::getStorageStats();
if (isset($storageStats['total_size'], $storageStats['total_files'])) {
?>
<p><?php _e('Total storage files', 'wp-asset-clean-up'); ?>: <strong><?php echo (int)$storageStats['total_files']; ?></strong>, <?php echo esc_html($storageStats['total_size']); ?> of which <strong><?php echo (int)$storageStats['total_files_assets']; ?></strong> are CSS/JS assets, <?php echo (int)$storageStats['total_size_assets']; ?></p>
<?php
}
$cssJsDirMarker = '<span class="dashicons dashicons-yes-alt" style="font-size: 19px; vertical-align: top; color: green;"></span>';
?>
<p>The following list prints each directory (local path) and its size. Only the ones marked with <?php echo wp_kses($cssJsDirMarker, array('span' => array('class' => array(), 'style' => array()))); ?> have CSS/JS files there. The other unmarked ones contain .json (for reference purposes), index.php or .htaccess file types.</p>
<div class="wpacu_clearfix"></div>
<?php
echo '<ul style="margin-top: 0;margin-left: 25px; list-style: disc;">';
foreach ($storageStats['dirs_files_sizes'] as $localDirPath => $localDirFileSizes) {
$localDirPath = trim($localDirPath);
$totalDirSize = array_sum($localDirFileSizes);
$cssJsDirMarkerOutput = '';
if (in_array($localDirPath, $storageStats['dirs_css_js'])) {
$cssJsDirMarkerOutput = wp_kses($cssJsDirMarker, array('span' => array('class' => array(), 'style' => array())));
}
$rowStyle = '';
if ($cssJsDirMarkerOutput) {
$rowStyle = 'background: rgba(0,0,0,.07); padding: 4px; display: inline;';
}
echo '<li><div style="'.esc_html($rowStyle).'">'.esc_html($localDirPath).': <strong>'.\WpAssetCleanUp\Misc::formatBytes($totalDirSize).'</strong> '.$cssJsDirMarkerOutput.'</div></li>';
}
echo '</ul>';
?>
<hr />
<p><?php echo sprintf(__('On certain hosting platforms such as Pantheon, the number of writable directories is limited, in this case you have to change it to %s', 'wp-asset-clean-up'), '<code><strong>/uploads/asset-cleanup/</strong></code>'); ?></p>
<p>
<?php echo sprintf(
__('To change the relative directory, you have to add the following code to %s file within the root of your WordPress installation, where other constants are defined, above the line %s', 'wp-asset-clean-up'),
'<em>wp-config.php</em>',
'<code><em>/* That\'s all, stop editing! Happy blogging. */</em></code>'
);
?>
</p>
<p><code>define('WPACU_CACHE_DIR', '/uploads/asset-cleanup/');</code></p>
<p><?php echo sprintf(
__('Note that the relative path is appended to %s', 'wp-asset-clean-up'),
'<em>'.WP_CONTENT_DIR.'/</em>'
); ?> which is the WordPress content directory.</p>
<?php
}
if ($data['for'] === 'debug') {
$logPHPErrorsLocationFileSize = false;
$isLogPHPErrors = $data['error_log']['log_status'];
$logPHPErrorsLocation = $data['error_log']['log_file'];
$logPHPErrorsLocationFileSizeFormatted = '';
if ($logPHPErrorsLocation !== 'none_set' && is_file($logPHPErrorsLocation)) {
$logPHPErrorsLocationFileSize = filesize($logPHPErrorsLocation);
$logPHPErrorsLocationFileSizeFormatted = \WpAssetCleanUp\Misc::formatBytes($logPHPErrorsLocationFileSize);
}
?>
<form method="post" action="">
<p>In case you experience timeout errors, blank screens, 500 internal server errors and so on, it's a good idea to check the PHP error logs (they are usually activated in your PHP.ini configuration) for more information about the reason behind any issues you might have. The error log file (if any set), it meant to record PHP errors (either from Asset CleanUp or any other active plugin/theme, etc.).</p>
<ul>
<li>Log PHP Errors Status: <strong><?php if ($isLogPHPErrors) { esc_html_e('On', 'wp-asset-clean-up'); } else { esc_html_e('Off', 'wp-asset-clean-up'); } ?></strong></li>
<li>Log PHP Errors Location: <code><?php echo esc_html($logPHPErrorsLocation); ?></code> <?php if ($logPHPErrorsLocationFileSize) { ?> / <?php esc_html_e('File Size', 'wp-asset-clean-up'); ?>: <?php echo wp_kses($logPHPErrorsLocationFileSizeFormatted, array('span' => array('style' => array(), 'class' => array()))); ?> &nbsp; <input style="vertical-align: middle;" type="submit" class="button button-primary" value="Download Error Log File" /><?php } ?></li>
</ul>
<input type="hidden" name="wpacu-get-error-log" value="1" />
</form>
<hr />
<div>There are situations when you might want to access a certain page as if <?php echo WPACU_PLUGIN_TITLE; ?> is deactivated or you wish to access the page with only a part of the plugin's settings (without going through the standard deactivation and re-activation process which takes time). To do that, you can use the following query strings:</div>
<style <?php echo Misc::getStyleTypeAttribute(); ?>>
ul.wpacu-debug-list-params li {
margin-bottom: 15px;
}
</style>
<ul class="wpacu-debug-list-params">
<li><a href="<?php echo site_url().'/?wpacu_debug'; ?>"><code><?php echo site_url(); ?><strong>/?wpacu_debug</strong></code></a> - If you are logged-in, it will print a form at the bottom of the requested page with options to view the page with certain options deactivated (e.g. do not apply any JavaScript unloading), as well as print information about all the unloaded assets.</li>
<li><a href="<?php echo site_url().'/?wpacu_no_load'; ?>"><code><?php echo site_url(); ?><strong>/?wpacu_no_load</strong></code></a> - On any page request if you apply this parameter, it will be like <?php echo WPACU_PLUGIN_TITLE; ?> is deactivated. The plugin's menu from the top admin bar (if shown), will also get hidden.</li>
<li><a href="<?php echo site_url().'/?wpacu_clean_load'; ?>"><code><?php echo site_url(); ?><strong>/?wpacu_clean_load</strong></code></a> - This parameter is useful if you are checking a website that has lots of CSS/JS unloaded and combined by <?php echo WPACU_PLUGIN_TITLE; ?> or other performance plugin, but you want to view the page as if no optimization was applied (e.g. 20 CSS files were combined into one, but you want to see each one in the HTML source code, for debugging purposes). The difference between this option and "wpacu_no_load" is that it also attempts to prevent any optimization made by other performance plugins, not just from <?php echo WPACU_PLUGIN_TITLE; ?></li>
</ul>
<?php
}
if ($data['for'] === 'import_export') {
?>
<div id="wpacu-import-area" class="wpacu-export-import-area">
<form id="wpacu-import-form"
action="<?php echo esc_url(admin_url('admin.php?page='.WPACU_PLUGIN_ID.'_tools&wpacu_for='.$data['for'])); ?>"
method="post"
enctype="multipart/form-data">
<p><label for="wpacu-import-file">Please choose the exported JSON file and upload it for import:</label></p>
<p><input required="required" type="file" id="wpacu-import-file" name="wpacu_import_file" accept="application/json" /></p>
<p><button type="submit"
class="button button-secondary"
style="font-size: 15px; line-height: 20px; padding: 3px 12px; height: 37px;">
<span style="padding-top: 1px;"
class="dashicons dashicons-upload"></span>
<?php esc_attr_e('Import', 'wp-asset-clean-up'); ?>
<img class="wpacu-spinner" src="<?php echo includes_url('images/wpspin-2x.gif'); ?>" alt="" />
</button> &nbsp;<small>* only .json extension allowed</small>
</p>
<?php wp_nonce_field('wpacu_do_import', 'wpacu_do_import_nonce'); ?>
</form>
<p><small><strong><span class="dashicons dashicons-warning"></span> Note:</strong> Make sure to properly test the pages of your website after you do the import to be sure the changes from the location you performed the export (e.g. staging) will work just as fine on the current server (e.g. live). The CSS/JS caching will be rebuilt after you're done with the import in case Minify/Combine CSS/JS is used.</small></p>
</div>
<hr />
<div id="wpacu-export-area" class="wpacu-export-import-area">
<form id="wpacu-export-form"
action="<?php echo esc_url(admin_url('admin.php?page='.WPACU_PLUGIN_ID.'_tools&wpacu_for='.$data['for'])); ?>"
method="post">
<p><label for="wpacu-export-selection">Please select what you would like to export:</label></p>
<p>
<select required="required" id="wpacu-export-selection" name="wpacu_export_for">
<option value="">Select an option first...</option>
<option value="settings">Settings</option>
<option value="everything">Everything</option>
</select>
</p>
<p><button type="submit"
class="button button-secondary"
style="font-size: 15px; line-height: 20px; padding: 3px 12px; height: 37px;">
<span style="padding-top: 1px;"
class="dashicons dashicons-download"></span>
<?php esc_attr_e('Export', 'wp-asset-clean-up'); ?>
</button>
</p>
<?php wp_nonce_field('wpacu_do_export', 'wpacu_do_export_nonce'); ?>
</form>
</div>
<?php
}
?>
</div>
</div>

View File

@ -0,0 +1,173 @@
<?php
if (! isset($data)) {
exit; // no direct access
}
$allAssets = $data['all']['scripts'];
$allAssetsFinal = $data['unloaded_js_handles'] = array();
foreach ($allAssets as $obj) {
$row = array();
$row['obj'] = $obj;
// e.g. Unload on this page, Unload on all 404 pages, etc.
$activePageLevel = isset( $data['current_unloaded_page_level']['scripts'] ) && in_array( $row['obj']->handle, $data['current_unloaded_page_level']['scripts'] );
$row['class'] = $activePageLevel ? 'wpacu_not_load' : '';
$row['checked'] = $activePageLevel ? 'checked="checked"' : '';
/*
* $row['is_group_unloaded'] is only used to apply a red background in the asset's area to point out that the style is unloaded
* 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)
*/
$row['global_unloaded'] = $row['is_post_type_unloaded'] = $row['is_load_exception_per_page'] = $row['is_group_unloaded'] = false;
// Mark it as unloaded - Everywhere
if ( in_array( $row['obj']->handle, $data['global_unload']['scripts'] ) && ! $row['class'] ) {
$row['global_unloaded'] = $row['is_group_unloaded'] = true;
}
// Mark it as unloaded - for the Current Post Type
if ( isset($data['bulk_unloaded_type']) &&
$data['bulk_unloaded_type'] &&
is_array($data['bulk_unloaded'][$data['bulk_unloaded_type']]['scripts']) &&
in_array($row['obj']->handle, $data['bulk_unloaded'][$data['bulk_unloaded_type']]['scripts']) ) {
$row['is_group_unloaded'] = true;
if ( $data['bulk_unloaded_type'] === 'post_type' ) {
$row['is_post_type_unloaded'] = true;
}
}
$isLoadExceptionPerPage = isset($data['load_exceptions_per_page']['scripts']) && in_array($row['obj']->handle, $data['load_exceptions_per_page']['scripts']);
$isLoadExceptionForCurrentPostType = isset($data['load_exceptions_post_type']['scripts'] ) && in_array($row['obj']->handle, $data['load_exceptions_post_type']['scripts']);
$row['is_load_exception_per_page'] = $isLoadExceptionPerPage;
$row['is_load_exception_post_type'] = $isLoadExceptionForCurrentPostType;
$isLoadException = $isLoadExceptionPerPage || $isLoadExceptionForCurrentPostType;
// No load exception to any kind and a bulk unload rule is applied? Append the CSS class for unloading
if ( ! $isLoadException && $row['is_group_unloaded']) {
$row['class'] .= ' wpacu_not_load';
}
// Probably most reliable to use in order to check the unloaded styles; it might be the only one used in future plugin versions
if (strpos($row['class'], 'wpacu_not_load') === false && isset($data['current_unloaded_all']['scripts']) && in_array($row['obj']->handle, $data['current_unloaded_all']['scripts'])) {
$row['class'] .= ' wpacu_not_load';
}
if (strpos($row['class'], 'wpacu_not_load') !== false) {
// Actually unloaded JS, not just marked for unload
$data['unloaded_js_handles'][] = $row['obj']->handle;
}
foreach ( array( 'data', 'before', 'after' ) as $extraKey ) {
// "data": CDATA added via wp_localize_script()
// "before" / "after" the tag inline content added via wp_add_inline_script()
$row[ 'extra_' . $extraKey . '_js' ] = ( is_object( $row['obj']->extra ) && isset( $row['obj']->extra->{$extraKey} ) ) ? $row['obj']->extra->{$extraKey} : false;
if ( ! $row[ 'extra_' . $extraKey . '_js' ] ) {
$row[ 'extra_' . $extraKey . '_js' ] = ( is_array( $row['obj']->extra ) && isset( $row['obj']->extra[ $extraKey ] ) ) ? $row['obj']->extra[ $extraKey ] : false;
}
}
$row['class'] .= ' script_' . $row['obj']->handle;
$row['asset_type'] = 'scripts';
$allAssetsFinal[$obj->handle] = $row;
}
foreach ($allAssetsFinal as $assetHandle => $row) {
$data['row'] = $row;
// Load Template
$parseTemplate = \WpAssetCleanUp\Main::instance()->parseTemplate(
'/meta-box-loaded-assets/_asset-script-single-row',
$data,
false,
true
);
$templateRowOutput = $parseTemplate['output'];
$data = $parseTemplate['data'];
if (isset($data['rows_build_array']) && $data['rows_build_array']) {
$uniqueHandle = $row['obj']->handle;
if (array_key_exists($uniqueHandle, $data['rows_assets'])) {
$uniqueHandle .= 1; // make sure each key is unique
}
if (isset($data['rows_by_location']) && $data['rows_by_location']) {
$data['rows_assets']
[$row['obj']->locationMain]
[$row['obj']->locationChild]
[$uniqueHandle]
['script'] = $templateRowOutput;
} elseif (isset($data['rows_by_position']) && $data['rows_by_position']) {
$handlePosition = $row['obj']->position;
$data['rows_assets']
[$handlePosition] // 'head', 'body'
[$uniqueHandle]
['script'] = $templateRowOutput;
} elseif (isset($data['rows_by_preload']) && $data['rows_by_preload']) {
$preloadStatus = $row['obj']->preload_status;
$data['rows_assets']
[$preloadStatus] // 'preloaded', 'not_preloaded'
[$uniqueHandle]
['script'] = $templateRowOutput;
} elseif (isset($data['rows_by_parents']) && $data['rows_by_parents']) {
$childHandles = isset($data['all_deps']['parent_to_child']['scripts'][$row['obj']->handle]) ? $data['all_deps']['parent_to_child']['scripts'][$row['obj']->handle] : array();
if (! empty($childHandles)) {
$handleStatus = 'parent';
} elseif (isset($row['obj']->deps) && ! empty($row['obj']->deps)) {
$handleStatus = 'child';
} else {
$handleStatus = 'independent';
}
$data['rows_assets']
[$handleStatus] // 'parent', 'child', 'independent'
[$uniqueHandle]
['scripts'] = $templateRowOutput;
} elseif (isset($data['rows_by_loaded_unloaded']) && $data['rows_by_loaded_unloaded']) {
if (isset($data['current_unloaded_all']['scripts']) && in_array($row['obj']->handle, $data['current_unloaded_all']['scripts'])) {
$handleStatus = 'unloaded';
} else {
$handleStatus = ( strpos( $row['class'], 'wpacu_not_load' ) !== false ) ? 'unloaded' : 'loaded';
}
$data['rows_assets']
[$handleStatus] // 'loaded', 'unloaded'
[$uniqueHandle]
['script'] = $templateRowOutput;
} elseif(isset($data['rows_by_size']) && $data['rows_by_size']) {
$sizeStatus = (isset($row['obj']->sizeRaw) && is_int($row['obj']->sizeRaw)) ? 'with_size' : 'external_na';
$data['rows_assets']
[$sizeStatus] // 'with_size', 'external_na'
[$uniqueHandle]
['script'] = $templateRowOutput;
if ($sizeStatus === 'with_size') {
// Associated the handle with the raw size of the file
$data['handles_sizes'][$uniqueHandle] = $row['obj']->sizeRaw;
}
} elseif (isset($data['rows_by_rules']) && $data['rows_by_rules']) {
$ruleStatus = (isset($data['row']['at_least_one_rule_set']) && $data['row']['at_least_one_rule_set']) ? 'with_rules' : 'with_no_rules';
$data['rows_assets']
[$ruleStatus] // 'with_rules', 'with_no_rules'
[$uniqueHandle]
['script'] = $templateRowOutput;
} else {
$data['rows_assets'][$uniqueHandle] = $templateRowOutput;
}
} else {
echo \WpAssetCleanUp\Misc::stripIrrelevantHtmlTags($templateRowOutput);
}
}

View File

@ -0,0 +1,142 @@
<?php
/*
* The file is included from _asset-script-rows.php
*/
if (! isset($data)) {
exit; // no direct access
}
$inlineCodeStatus = $data['plugin_settings']['assets_list_inline_code_status'];
$isCoreFile = isset($data['row']['obj']->wp) && $data['row']['obj']->wp;
$hideCoreFiles = $data['plugin_settings']['hide_core_files'];
$isGroupUnloaded = $data['row']['is_group_unloaded'];
// Does it have "children"? - other JS file(s) depending on it
$childHandles = isset($data['all_deps']['parent_to_child']['scripts'][$data['row']['obj']->handle]) ? $data['all_deps']['parent_to_child']['scripts'][$data['row']['obj']->handle] : array();
sort($childHandles);
$jqueryIconHtmlHandle = '<img src="'.WPACU_PLUGIN_URL.'/assets/icons/handles/icon-jquery.png" style="max-width: 22px; max-height: 22px;" width="18" height="18" title="" alt="" />';
$jqueryIconHtmlDepends = '<img src="'.WPACU_PLUGIN_URL.'/assets/icons/handles/icon-jquery.png" style="max-width: 22px; max-height: 22px; vertical-align: text-top;" width="16" height="16" alt="" />';
// Unloaded site-wide
if ($data['row']['global_unloaded']) {
$data['row']['class'] .= ' wpacu_is_global_unloaded';
}
// Unloaded site-wide OR on all posts, pages etc.
if ($isGroupUnloaded) {
$data['row']['class'] .= ' wpacu_is_bulk_unloaded';
}
$rowIsContracted = '';
$dashSign = 'minus';
$dataRowStatusAttr = 'expanded';
if (isset($data['handle_rows_contracted']['scripts'][$data['row']['obj']->handle]) && $data['handle_rows_contracted']['scripts'][$data['row']['obj']->handle]) {
$rowIsContracted = 1;
$dashSign = 'plus';
$dataRowStatusAttr = 'contracted';
}
?>
<tr data-script-handle-row="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
id="wpacu_script_row_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
class="wpacu_asset_row <?php echo esc_attr($data['row']['class']); ?>"
style="<?php if ($isCoreFile && $hideCoreFiles) { echo 'display: none;'; } ?>">
<td valign="top" style="position: relative;" data-wpacu-row-status="<?php echo esc_attr($dataRowStatusAttr); ?>">
<!-- [reference field] -->
<input type="hidden" name="<?php echo WPACU_FORM_ASSETS_POST_KEY; ?>[scripts][<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>]" value="" />
<!-- [/reference field] -->
<div class="wpacu_handle_row_expand_contract_area">
<a data-wpacu-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
data-wpacu-handle-for="script"
class="wpacu_handle_row_expand_contract"
href="#"><span class="dashicons dashicons-<?php echo esc_attr($dashSign); ?>"></span></a>
<!-- -->
</div>
<?php
include '_asset-script-single-row/_handle.php';
$ver = $data['wp_version']; // default
if (isset($data['row']['obj']->ver) && $data['row']['obj']->ver) {
$ver = is_array($data['row']['obj']->ver) ? implode(', ', $data['row']['obj']->ver) : $data['row']['obj']->ver;
}
$data['row']['obj']->preload_status = 'not_preloaded'; // default
$assetHandleHasSrc = false;
// Source, Preload area
include '_asset-script-single-row/_source.php';
// Any tips?
if (isset($data['tips']['js'][$data['row']['obj']->handle]) && ($assetTip = $data['tips']['js'][$data['row']['obj']->handle])) {
?>
<div class="tip"><strong>Tip:</strong> <?php echo esc_html($assetTip); ?></div>
<?php
}
?>
<div class="wpacu_handle_row_expanded_area <?php if ($rowIsContracted) { echo 'wpacu_hide'; } ?>">
<?php
$extraInfo = array();
include '_asset-script-single-row/_handle_deps.php';
$extraInfo[] = esc_html__('Version:', 'wp-asset-clean-up').' '.$ver;
include '_common/_asset-single-row-position.php';
if (isset($data['row']['obj']->src) && trim($data['row']['obj']->src)) {
$extraInfo[] = esc_html__('File Size:', 'wp-asset-clean-up') . ' <em>' . $data['row']['obj']->size . '</em>';
}
if (! empty($extraInfo)) {
$stylingDiv = 'margin: 10px 0';
if (isset($hasNoSrc) && $hasNoSrc) {
$stylingDiv = 'margin: 15px 0 10px;';
}
echo '<div style="'.$stylingDiv.'">'.implode(' &nbsp;/&nbsp; ', $extraInfo).'</div>';
}
?>
<div class="wrap_bulk_unload_options">
<?php
// Unload on this page
include '_common/_asset-single-row-unload-per-page.php';
// Unload site-wide (everywhere)
include '_common/_asset-single-row-unload-site-wide.php';
// Unload on all pages of [post] post type (if applicable)
include '_common/_asset-single-row-unload-post-type.php';
// Unload on all pages where this [post] post type has a certain taxonomy set for it (e.g. a Tag or a Category) (if applicable)
// There has to be at least a taxonomy created for this [post] post type in order to show this option
if (isset($data['post_type']) && $data['post_type'] !== 'attachment' && ! $data['row']['is_post_type_unloaded'] && ! empty($data['post_type_has_tax_assoc'])) {
include '_common/_asset-single-row-unload-post-type-taxonomy.php';
}
// Unload via RegEx (if site-wide is not already chosen)
include '_common/_asset-single-row-unload-via-regex.php';
// If any bulk unload rule is set, show the load exceptions
include '_common/_asset-single-row-load-exceptions.php';
?>
<div class="wpacu_clearfix"></div>
</div>
<?php
// Extra inline associated with the SCRIPT tag
include '_common/_asset-single-row-extra-inline.php';
// Async, Defer, Media Query Load (Pro features)
include '_asset-script-single-row/_loaded-rules.php';
// Handle Note
include '_common/_asset-single-row-notes.php';
?>
</div>
<img style="display: none;" class="wpacu_ajax_loader" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-ajax-loading-spinner.svg" alt="<?php echo esc_html__('Loading'); ?>..." />
</td>
</tr>

View File

@ -0,0 +1,102 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-script-single-row.php
*/
if ( ! isset($data, $isCoreFile, $hideCoreFiles, $jqueryIconHtmlHandle, $childHandles) ) {
exit; // no direct access
}
?>
<div class="wpacu_handle">
<label for="script_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"> <?php _e('Handle:', 'wp-asset-clean-up'); ?> <strong><span style="color: green;"><?php echo esc_attr($data['row']['obj']->handle); ?></span></strong> <?php if (in_array($data['row']['obj']->handle, array('jquery', 'jquery-core', 'jquery-migrate'))) { echo '&nbsp;'.$jqueryIconHtmlHandle; } ?></label>
&nbsp;<em>* JavaScript (.js)</em>
<?php
if ($data['row']['obj']->handle === 'swiper') {
?>
&#10230; <span style="color: #ccc;" class="dashicons dashicons-text-page"></span> <a href="https://assetcleanup.com/docs/?p=737" target="_blank" rel="noopener noreferrer">Read more</a>
<?php
}
if ($isCoreFile && ! $hideCoreFiles) { ?>
<span class="dashicons dashicons-wordpress-alt wordpress-core-file"><span class="wpacu-tooltip">WordPress Core File<br />Not sure if needed or not? In this case, it's better to leave it loaded to avoid breaking the website.</span></span>
<?php
}
if (isset($data['load_exceptions_debug']['scripts']) && in_array($data['row']['obj']->handle, $data['load_exceptions_debug']['scripts'])) {
// '/?wpacu_load_js=' was used and has the handle within its value
echo '&nbsp; <span style="color: green; font-style: italic;"><strong>Load Exception:</strong> This handle is loading for you on this page as requested via the "wpacu_load_js" value from the current page URL (for debugging purposes).</span>';
} elseif (isset($data['current_debug']['scripts']) && in_array($data['row']['obj']->handle, $data['current_debug']['scripts'])) {
// '/?wpacu_unload_js=' was used and has the handle within its value
echo '&nbsp; <span style="color: #cc0000; font-style: italic;"><strong>Unload Exception:</strong> This handle is unloaded for you on this page as requested via the "wpacu_unload_js" value from the current page URL (for debugging purposes).</span>';
}
// Any conditions set such as "IE" or "lt IE 8"?
$dataRowExtra = (array)$data['row']['obj']->extra;
// Notify the user the assets load only on Internet Explorer
if ( isset( $dataRowExtra['conditional'] ) && $dataRowExtra['conditional'] && strpos( $dataRowExtra['conditional'], 'IE' ) !== false ) {
echo '&nbsp;&nbsp;<span><img style="vertical-align: middle;" width="25" height="25" src="'.WPACU_PLUGIN_URL.'/assets/icons/icon-ie.svg" alt="" title="Microsoft / Public domain" />&nbsp;<span style="font-weight: 400; color: #1C87CF;">Loads only in Internet Explorer based on the following condition:</span> <em> if '.$dataRowExtra['conditional'].'</em></span>';
}
?>
</div>
<?php
$ignoreChild = (isset($data['ignore_child']['scripts'][$data['row']['obj']->handle]) && $data['ignore_child']['scripts'][$data['row']['obj']->handle]);
if ($ignoreChild) { $data['row']['at_least_one_rule_set'] = true; }
if (! empty($childHandles)) {
?>
<div class="wpacu_dependency_notice_area">
<?php
if ($data['row']['obj']->handle === 'jquery-migrate') {
?>
<em style="font-size: 85%;">Special Case: If jQuery Migrate is marked for unload (which often is good if you don't need it), its official "child" (as it's mentioned in the WordPress core), jQuery, will not be unloaded. However, if there are other JS scripts from the plugins or the theme that are linked to jQuery Migrate, then it's better to keep it loaded.</em>
<?php
}
// If not 'jquery-migrate' show it
// If it's 'jquery-migrate' and has more than one "child" (apart from jQuery) show it
$showDependencyNotice = ($data['row']['obj']->handle === 'jquery-migrate' && count($childHandles) > 1) || ($data['row']['obj']->handle !== 'jquery-migrate');
if ($showDependencyNotice) {
?>
<em style="font-size: 85%;">
<span style="color: #0073aa; width: 19px; height: 19px; vertical-align: middle;" class="dashicons dashicons-info"></span>
There are JS "children" files depending on this file. By unloading it, the following will also be unloaded:
<span style="color: green; font-weight: 400;">
<?php
$childHandlesOutput = '';
foreach ($childHandles as $childHandle) {
$childHandleText = $childHandle;
$title = '';
$color = 'green';
if (in_array($childHandle, $data['unloaded_js_handles'])) {
$color = '#cc0000';
$title = esc_html__('This JS handle is already unloaded.', 'wp-asset-clean-up');
}
$childHandlesOutput .= '<a title="'.$title.'" style="color:'.$color.';font-weight:300;" href="#wpacu_script_row_'.$childHandle.'">'.$childHandle.'</a>, ';
}
echo trim($childHandlesOutput, ', ');
?>
</span>
</em>
<div class="wpacu_hide_if_handle_row_contracted">
<label for="script_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>_ignore_children">
&#10230; <input id="script_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>_ignore_children"
type="checkbox"
<?php if ($ignoreChild) { ?>checked="checked"<?php } ?>
name="<?php echo WPACU_FORM_ASSETS_POST_KEY; ?>[scripts][<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>][ignore_child]"
value="1" /> <small><?php _e('Ignore dependency rule and keep the "children" loaded', 'wp-asset-clean-up'); ?>
<?php if (in_array($data['row']['obj']->handle, \WpAssetCleanUp\Main::instance()->keepChildrenLoadedForHandles['js'])) { echo '(recommended)'; } ?>
</small>
</label>
</div>
<?php
}
?>
</div>
<?php
} elseif ($ignoreChild) {
// Keep the option enabled in case ignoring other dependencies was already chosen in a different page (e.g. in some pages a handle can have a dependency, in others it might not have any)
?>
<input type="hidden" name="<?php echo WPACU_FORM_ASSETS_POST_KEY; ?>[scripts][<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>][ignore_child]" value="1" />
<?php
}

View File

@ -0,0 +1,39 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-script-single-row.php
*/
if (! isset($data)) {
exit; // no direct access
}
// [Start] Any dependencies
if (isset($data['row']['obj']->deps) && ! empty($data['row']['obj']->deps)) {
$depsOutput = '';
if (is_array($data['row']['obj']->deps)) {
$dependsOnText = (count($data['row']['obj']->deps) === 1)
? esc_html__('"Child" of one "parent" JS file:', 'wp-asset-clean-up')
: sprintf(esc_html__('"Child" of %s JS "parent" files:', 'wp-asset-clean-up'),
count($data['row']['obj']->deps));
} else {
$dependsOnText = esc_html__('"Child" of "parent" JS file(s):', 'wp-asset-clean-up');
}
$depsOutput .= $dependsOnText.' ';
foreach ($data['row']['obj']->deps as $depHandle) {
$depHandleText = $depHandle;
$color = in_array($depHandle, $data['unloaded_js_handles']) ? '#cc0000' : 'green';
if (isset($jqueryIconHtmlDepends) && ($depHandle === 'jquery' || strpos($depHandle, 'jquery-ui-') === 0)) {
$depHandleText .= '&nbsp;'.$jqueryIconHtmlDepends;
}
$depsOutput .= '<a style="color:'.$color.';font-weight:300;" href="#wpacu_script_row_'.$depHandle.'"><span>'.$depHandleText.'</span></a>, ';
}
$depsOutput = rtrim($depsOutput, ', ');
$extraInfo[] = $depsOutput;
}
// [End] Any dependencies

View File

@ -0,0 +1,104 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-script-single-row.php
*/
if (! isset($data)) {
exit; // no direct access
}
$isGroupUnloaded = $data['row']['is_group_unloaded'];
$anyUnloadRuleSet = ($isGroupUnloaded || $data['row']['checked']);
if ($anyUnloadRuleSet || $data['row']['is_load_exception_per_page']) {
$data['row']['at_least_one_rule_set'] = true;
}
?>
<div class="wpacu_exception_options_area_load_exception <?php if (! $anyUnloadRuleSet) { echo 'wpacu_hide'; } ?>">
<div data-script-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
class="wpacu_exception_options_area_wrap">
<fieldset>
<legend>Make an exception from any unload rule &amp; <strong>always load it</strong>:</legend>
<ul class="wpacu_area_two wpacu_asset_options wpacu_exception_options_area">
<li id="wpacu_load_it_option_script_<?php echo esc_attr($data['row']['obj']->handle); ?>">
<label><input data-handle="<?php echo esc_attr($data['row']['obj']->handle); ?>"
id="wpacu_load_it_option_script_<?php echo esc_attr($data['row']['obj']->handle); ?>"
class="wpacu_load_it_option_one wpacu_script wpacu_load_exception"
type="checkbox"
<?php if ($data['row']['is_load_exception_per_page']) { ?> checked="checked" <?php } ?>
name="wpacu_scripts_load_it[]"
value="<?php echo esc_attr($data['row']['obj']->handle); ?>" />
<span>On this page</span></label>
</li>
<?php
if ($data['bulk_unloaded_type'] === 'post_type') {
// Only show it on edit post/page/custom post type
switch ($data['post_type']) {
case 'product':
$loadBulkText = __('On all WooCommerce "Product" pages', 'wp-asset-clean-up');
break;
case 'download':
$loadBulkText = __('On all Easy Digital Downloads "Download" pages', 'wp-asset-clean-up');
break;
default:
$loadBulkText = sprintf(__('On All Pages of "<strong>%s</strong>" post type', 'wp-asset-clean-up'), $data['post_type']);
}
?>
<li id="wpacu_load_it_post_type_option_script_<?php echo esc_attr($data['row']['obj']->handle); ?>">
<input type="hidden"
name="wpacu_scripts_load_it_post_type[<?php echo esc_attr($data['post_type']); ?>][<?php echo esc_attr($data['row']['obj']->handle); ?>]"
value="" />
<label><input data-handle="<?php echo esc_attr($data['row']['obj']->handle); ?>"
id="wpacu_script_load_it_post_type_<?php echo esc_attr($data['row']['obj']->handle); ?>"
class="wpacu_load_it_option_post_type wpacu_script wpacu_load_exception"
type="checkbox"
<?php if ($data['row']['is_load_exception_post_type']) { ?> checked="checked" <?php } ?>
name="wpacu_scripts_load_it_post_type[<?php echo esc_attr($data['post_type']); ?>][<?php echo esc_attr($data['row']['obj']->handle); ?>]"
value="1"/>
<span><?php echo wp_kses($loadBulkText, array('strong' => array())); ?></span></label>
</li>
<?php
if (isset($data['post_type']) && $data['post_type'] !== 'attachment' && ! empty($data['post_type_has_tax_assoc'])) {
include dirname(__DIR__).'/_common/_asset-single-row-load-exceptions-taxonomy.php';
}
}
?>
<li>
<label for="wpacu_load_it_regex_option_script_<?php echo esc_attr($data['row']['obj']->handle); ?>">
<input data-handle="<?php echo esc_attr($data['row']['obj']->handle); ?>"
id="wpacu_load_it_regex_option_script_<?php echo esc_attr($data['row']['obj']->handle); ?>"
class="wpacu_load_it_option_two wpacu_script wpacu_load_exception wpacu_lite_locked"
type="checkbox"
disabled="disabled"
value="1"/>
Load it for URLs with request URI matching this RegEx(es): <a class="go-pro-link-no-style"
href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=manage_asset&utm_medium=load_via_regex_make_exception'); ?>"><span
class="wpacu-tooltip wpacu-larger"><?php echo str_replace('the premium', 'the<br />premium', wp_kses(__('This feature is available in the premium version of the plugin.',
'wp-asset-clean-up' ), array('br' => array()))); ?><br/> <?php _e( 'Click here to upgrade to Pro',
'wp-asset-clean-up' ); ?>!</span><img width="20" height="20"
src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg"
valign="top" alt=""/></a> <a
style="text-decoration: none; color: inherit;" target="_blank"
href="https://assetcleanup.com/docs/?p=21#wpacu-method-2"><span
class="dashicons dashicons-editor-help"></span></a></label>
</li>
<?php
$isLoadItLoggedIn = in_array($data['row']['obj']->handle, $data['handle_load_logged_in']['scripts']);
?>
<li id="wpacu_load_it_user_logged_in_option_script_<?php echo esc_attr($data['row']['obj']->handle); ?>">
<label><input data-handle="<?php echo esc_attr($data['row']['obj']->handle); ?>"
id="wpacu_load_it_user_logged_in_option_script_<?php echo esc_attr($data['row']['obj']->handle); ?>"
class="wpacu_load_it_option_three wpacu_script wpacu_load_exception"
type="checkbox"
<?php if ($isLoadItLoggedIn) { ?> checked="checked" <?php } ?>
name="wpacu_load_it_logged_in[scripts][<?php echo esc_attr($data['row']['obj']->handle); ?>]"
value="1"/>
<span>If the user is logged-in</span></label>
</li>
</ul>
<div class="wpacu_clearfix"></div>
</fieldset>
</div>
</div>

View File

@ -0,0 +1,85 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-script-single-row.php
*/
if (! isset($data)) {
exit; // no direct access
}
?>
<!-- [wpacu_lite] -->
<?php if (isset($data['row']['obj']->src) && $data['row']['obj']->src !== '') { ?>
<div class="wpacu-script-attributes-area wpacu-lite wpacu-only-when-kept-loaded">
<div>If kept loaded, set the following attributes: <em><a class="go-pro-link-no-style" href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL); ?>">* <?php _e('Pro version', 'wp-asset-clean-up'); ?></a></em></div>
<ul class="wpacu-script-attributes-settings wpacu-first">
<li><a class="go-pro-link-no-style" href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL); ?>"><span class="wpacu-tooltip wpacu-larger"><?php echo str_replace('the premium', 'the<br />premium', wp_kses(__('This feature is available in the premium version of the plugin.',
'wp-asset-clean-up' ), array('br' => array()))); ?><br /> <?php _e('Click here to upgrade to Pro', 'wp-asset-clean-up'); ?>!</span><img width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" valign="top" alt="" /></a>&nbsp; <strong>async</strong> &#10230;</li>
<li><label><input disabled="disabled" type="checkbox" value="on_this_page" /><?php _e('on this page', 'wp-asset-clean-up'); ?></label></li>
<li><label><input disabled="disabled" type="checkbox" value="everywhere" /><?php _e('everywhere', 'wp-asset-clean-up'); ?></label></li>
</ul>
<ul class="wpacu-script-attributes-settings">
<li><a class="go-pro-link-no-style" href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL); ?>"><span class="wpacu-tooltip wpacu-larger"><?php echo str_replace('the premium', 'the<br />premium', wp_kses(__('This feature is available in the premium version of the plugin.',
'wp-asset-clean-up' ), array('br' => array()))); ?><br /> <?php _e('Click here to upgrade to Pro', 'wp-asset-clean-up'); ?>!</span><img width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" valign="top" alt="" /></a>&nbsp; <strong>defer</strong> &#10230;</li>
<li><label><input disabled="disabled" type="checkbox" value="on_this_page" /><?php _e('on this page', 'wp-asset-clean-up'); ?></label></li>
<li><label><input disabled="disabled" type="checkbox" value="everywhere" /><?php _e('everywhere', 'wp-asset-clean-up'); ?></label></li>
</ul>
<div class="wpacu_clearfix"></div>
</div>
<?php
$childHandles = isset($data['all_deps']['parent_to_child']['scripts'][$data['row']['obj']->handle]) ? $data['all_deps']['parent_to_child']['scripts'][$data['row']['obj']->handle] : array();
$handleAllStatuses = array();
if (! empty($childHandles)) {
$handleAllStatuses[] = 'is_parent';
}
if (isset($data['row']['obj']->deps) && ! empty($data['row']['obj']->deps)) {
$handleAllStatuses[] = 'is_child';
}
if (empty($handleAllStatuses)) {
$handleAllStatuses[] = 'is_independent';
}
$showMatchMediaFeature = false;
// Is "independent" or has "parents" (is "child") with nothing under it (no "children")
if (in_array('is_independent', $handleAllStatuses) || (in_array('is_child', $handleAllStatuses) && (! in_array('is_parent', $handleAllStatuses)))) {
$showMatchMediaFeature = true;
}
// "extra" is fine, "after" and "before" are more tricky to accept (at least at this time)
$wpacuHasExtraInline = ($data['row']['extra_before_js'] || $data['row']['extra_after_js']);
if ($showMatchMediaFeature && ! $wpacuHasExtraInline) {
?>
<div class="wpacu-only-when-kept-loaded">
<div style="margin: 0 0 15px;">
<?php
$wpacuDataForId = 'wpacu_handle_media_query_load_script_'.$data['row']['obj']->handle;
?>
If kept loaded, make the browser download the file&nbsp;
<select data-handle="<?php echo esc_attr($data['row']['obj']->handle); ?>"
data-wpacu-input="media-query-select"
name="<?php echo WPACU_FORM_ASSETS_POST_KEY; ?>[scripts][<?php echo esc_attr($data['row']['obj']->handle); ?>][media_query_load][enable]"
class="wpacu-screen-size-load wpacu-for-script">
<option selected="selected" value="">on any screen size (default)</option>
<option disabled="disabled" value="1">if the media query is matched (Pro)</option>
</select>
<div style="display: inline-block; vertical-align: middle; margin-left: -2px;"><a class="go-pro-link-no-style wpacu-media-query-load-requires-pro-popup" href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=manage_asset&utm_medium=media_query_load_js'); ?>"><span
class="wpacu-tooltip wpacu-larger" style="left: -26px;"><?php echo str_replace('the premium', 'the<br />premium', wp_kses(__('This feature is available in the premium version of the plugin.',
'wp-asset-clean-up' ), array('br' => array()))); ?><br/> <?php _e( 'Click here to upgrade to Pro',
'wp-asset-clean-up' ); ?>!</span> <img width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" valign="top" alt="" /></a></div>
<div class="wpacu-helper-area" style="vertical-align: middle; margin-left: 2px;"><a style="text-decoration: none; color: inherit;" target="_blank" href="https://assetcleanup.com/docs/?p=1023"><span class="dashicons dashicons-editor-help"></span></a></div>
</div>
</div>
<?php
}
?>
<div class="wpacu_clearfix"></div>
<!-- [/wpacu_lite] -->
<?php
}

View File

@ -0,0 +1,12 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-script-single-row.php
*/
if ( ! isset($data) ) {
exit; // no direct access
}
if (isset($data['row']['obj']->position) && $data['row']['obj']->position !== '') {
$extraInfo[] = __('Position:', 'wp-asset-clean-up') . ' ' . (( $data['row']['obj']->position === 'head') ? 'HEAD' : 'BODY') . '<a class="go-pro-link-no-style" href="' . apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL . '?utm_source=manage_asset&utm_medium=change_js_position') .'"><span class="wpacu-tooltip" style="width: 322px; margin-left: -146px;">Upgrade to Pro and change the location of the JS file <br /> (e.g. to BODY to reduce render-blocking <br /> or to HEAD for very early triggering)</span><img width="20" height="20" src="' . WPACU_PLUGIN_URL . '/assets/icons/icon-lock.svg" valign="top" alt="" /> Change it?</a>';
}

View File

@ -0,0 +1,99 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-script-single-row.php
*/
if ( ! isset($data, $ver) ) {
exit; // no direct access
}
if (isset($data['row']['obj']->src, $data['row']['obj']->srcHref) && trim($data['row']['obj']->src) !== '' && $data['row']['obj']->srcHref) {
$assetHandleHasSrc = $isExternalSrc = true;
if (\WpAssetCleanUp\Misc::getLocalSrc($data['row']['obj']->src)
|| strpos($data['row']['obj']->src, '/?') !== false // Dynamic Local URL
|| strpos(str_replace(site_url(), '', $data['row']['obj']->src), '?') === 0 // Starts with ? right after the site url (it's a local URL)
) {
$isExternalSrc = false;
}
$srcHref = $data['row']['obj']->srcHref;
// If the source starts with ../ mark it as external to be checked via the AJAX call (special case)
if (strpos($srcHref, '../') === 0) {
$currentPageUrl = \WpAssetCleanUp\Misc::getCurrentPageUrl();
$srcHref = trim($currentPageUrl, '/') . '/'. $data['row']['obj']->srcHref;
$isExternalSrc = true; // simulation
}
$relSrc = str_replace(site_url(), '', $data['row']['obj']->src);
if (isset($data['row']['obj']->baseUrl)) {
$relSrc = str_replace($data['row']['obj']->baseUrl, '/', $relSrc);
}
if ($isExternalSrc) {
$verToAppend = ''; // no need for any "ver"
} else {
$appendAfterSrcHref = ( strpos( $srcHref, '?' ) === false ) ? '?' : '&';
if ( isset( $data['row']['obj']->ver ) && $data['row']['obj']->ver ) {
$verToAppend = $appendAfterSrcHref .
(is_array( $data['row']['obj']->ver )
? http_build_query( array( 'ver' => $data['row']['obj']->ver ) )
: 'ver=' . $ver);
} else {
global $wp_version;
$verToAppend = $appendAfterSrcHref . 'ver=' . $wp_version;
}
}
$isJsPreload = (isset($data['preloads']['scripts'][$data['row']['obj']->handle]) && $data['preloads']['scripts'][$data['row']['obj']->handle])
? $data['preloads']['scripts'][$data['row']['obj']->handle]
: false;
if ($isJsPreload) {
$data['row']['obj']->preload_status = 'preloaded';
$data['row']['at_least_one_rule_set'] = true;
}
?>
<div class="wpacu-source-row">
<?php
if (isset($data['row']['obj']->src_origin, $data['row']['obj']->ver_origin) && $data['row']['obj']->src_origin) {
$sourceText = esc_html__('Source (updated):', 'wp-asset-clean-up');
$messageToAlert = sprintf(
esc_html__('On this page, the `%s` JavaScript handle had its source updated via `%s` filter tag.' ."\n\n". 'Original Source: %s (version: %s)'),
$data['row']['obj']->handle,
'wpacu_'.$data['row']['obj']->handle.'_js_handle_data',
$data['row']['obj']->src_origin,
($data['row']['obj']->ver_origin ?: esc_html__('null', 'wp-asset-clean-up'))
);
?>
<a style="text-decoration: none; display: inline-block;"
href="#"
class="wpacu-filter-handle"
data-wpacu-filter-handle-message="<?php echo esc_attr($messageToAlert); ?>"
><span class="dashicons dashicons-filter"></span></a>
<?php } else {
$sourceText = esc_html__('Source:', 'wp-asset-clean-up'); // as it is, no replacement
}
echo esc_html($sourceText); ?>
<a target="_blank" style="color: green;" <?php if ($isExternalSrc) { ?> data-wpacu-external-source="<?php echo esc_attr($srcHref . $verToAppend); ?>" <?php } ?> href="<?php echo esc_attr($srcHref . $verToAppend); ?>"><?php echo wp_kses($relSrc, array('u' => array('style' => array()))); ?></a> <?php if ($isExternalSrc) { ?><span data-wpacu-external-source-status></span><?php } ?>
<div class="wpacu_hide_if_handle_row_contracted">
&nbsp;&#10230;&nbsp;
Preload (if kept loaded)?
&nbsp;<select style="display: inline-block; width: auto; <?php if ($isJsPreload) {
echo 'background: #f2faf2 url(\'data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%206l5%205%205-5%202%201-7%207-7-7%202-1z%22%20fill%3D%22%23555%22%2F%3E%3C%2Fsvg%3E\') no-repeat right 5px top 55%; padding-right: 30px; color: black;';
} ?>"
data-wpacu-input="preload"
name="<?php echo WPACU_FORM_ASSETS_POST_KEY; ?>[scripts][<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>][preload]">
<option value="">No (default)</option>
<option <?php if ($isJsPreload) { ?>selected="selected"<?php } ?> value="basic">Yes, basic</option>
</select>
<small>* applies site-wide</small> <small><a style="text-decoration: none; color: inherit;" target="_blank" href="https://assetcleanup.com/docs/?p=202"><span class="dashicons dashicons-editor-help"></span></a></small>
</div>
</div>
<?php
} else {
$hasNoSrc = true;
}

View File

@ -0,0 +1,168 @@
<?php
if (! isset($data)) {
exit; // no direct access
}
$allAssets = $data['all']['styles'];
$allAssetsFinal = $data['unloaded_css_handles'] = array();
foreach ($allAssets as $obj) {
$row = array();
$row['obj'] = $obj;
// e.g. Unload on this page, Unload on all 404 pages, etc.
$activePageLevel = isset( $data['current_unloaded_page_level']['styles'] ) && in_array( $row['obj']->handle, $data['current_unloaded_page_level']['styles'] );
$row['class'] = $activePageLevel ? 'wpacu_not_load' : '';
$row['checked'] = $activePageLevel ? 'checked="checked"' : '';
/*
* $row['is_group_unloaded'] is only used to apply a red background in the asset's area to point out that the style is unloaded
* 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)
*/
$row['global_unloaded'] = $row['is_post_type_unloaded'] = $row['is_load_exception_per_page'] = $row['is_group_unloaded'] = false;
// Mark it as unloaded - Everywhere
if ( in_array( $row['obj']->handle, $data['global_unload']['styles'] ) ) {
$row['global_unloaded'] = $row['is_group_unloaded'] = true;
}
// Mark it as unloaded - for the Current Post Type
if ( isset($data['bulk_unloaded_type']) &&
$data['bulk_unloaded_type'] &&
is_array($data['bulk_unloaded'][$data['bulk_unloaded_type']]['styles']) &&
in_array($row['obj']->handle, $data['bulk_unloaded'][$data['bulk_unloaded_type']]['styles']) ) {
$row['is_group_unloaded'] = true;
if ( $data['bulk_unloaded_type'] === 'post_type' ) {
$row['is_post_type_unloaded'] = true;
}
}
$isLoadExceptionPerPage = isset($data['load_exceptions_per_page']['styles']) && in_array($row['obj']->handle, $data['load_exceptions_per_page']['styles']);
$isLoadExceptionForCurrentPostType = isset($data['load_exceptions_post_type']['styles']) && in_array($row['obj']->handle, $data['load_exceptions_post_type']['styles']);
$row['is_load_exception_per_page'] = $isLoadExceptionPerPage;
$row['is_load_exception_post_type'] = $isLoadExceptionForCurrentPostType;
$isLoadException = $isLoadExceptionPerPage || $isLoadExceptionForCurrentPostType;
// No load exception to any kind and a bulk unload rule is applied? Append the CSS class for unloading
if ( ! $isLoadException && $row['is_group_unloaded'] ) {
$row['class'] .= ' wpacu_not_load';
}
// Probably most reliable to use in order to check the unloaded styles; it might be the only one used in future plugin versions
if (strpos($row['class'], 'wpacu_not_load') === false && isset($data['current_unloaded_all']['styles']) && in_array($row['obj']->handle, $data['current_unloaded_all']['styles'])) {
$row['class'] .= ' wpacu_not_load';
}
if (strpos($row['class'], 'wpacu_not_load') !== false) {
// Actually unloaded CSS, not just marked for unload
$data['unloaded_css_handles'][] = $row['obj']->handle;
}
$row['extra_data_css_list'] = ( is_object( $row['obj']->extra ) && isset( $row['obj']->extra->after ) ) ? $row['obj']->extra->after : array();
if ( ! $row['extra_data_css_list'] ) {
$row['extra_data_css_list'] = ( is_array( $row['obj']->extra ) && isset( $row['obj']->extra['after'] ) ) ? $row['obj']->extra['after'] : array();
}
$row['class'] .= ' style_' . $row['obj']->handle;
$row['asset_type'] = 'styles';
$allAssetsFinal[$obj->handle] = $row;
}
foreach ($allAssetsFinal as $assetHandle => $row) {
$data['row'] = $row;
// Load Template
$parseTemplate = \WpAssetCleanUp\Main::instance()->parseTemplate(
'/meta-box-loaded-assets/_asset-style-single-row',
$data,
false,
true
);
$templateRowOutput = $parseTemplate['output'];
$data = $parseTemplate['data'];
if (isset($data['rows_build_array']) && $data['rows_build_array']) {
$uniqueHandle = $uniqueHandleOriginal = $row['obj']->handle;
if (array_key_exists($uniqueHandle, $data['rows_assets'])) {
$uniqueHandle .= 1; // make sure each key is unique
}
if (isset($data['rows_by_location']) && $data['rows_by_location']) {
$data['rows_assets']
[$row['obj']->locationMain] // 'plugins', 'themes' etc.
[$row['obj']->locationChild] // Theme/Plugin Title
[$uniqueHandle]
['style'] = $templateRowOutput;
} elseif (isset($data['rows_by_position']) && $data['rows_by_position']) {
$handlePosition = $row['obj']->position;
$data['rows_assets']
[$handlePosition] // 'head', 'body'
[$uniqueHandle]
['style'] = $templateRowOutput;
} elseif (isset($data['rows_by_preload']) && $data['rows_by_preload']) {
$preloadStatus = $row['obj']->preload_status;
$data['rows_assets']
[$preloadStatus] // 'preloaded', 'not_preloaded'
[$uniqueHandle]
['style'] = $templateRowOutput;
} elseif (isset($data['rows_by_parents']) && $data['rows_by_parents']) {
$childHandles = isset($data['all_deps']['parent_to_child']['styles'][$row['obj']->handle]) ? $data['all_deps']['parent_to_child']['styles'][$row['obj']->handle] : array();
if (! empty($childHandles)) {
$handleStatus = 'parent';
} elseif (isset($row['obj']->deps) && ! empty($row['obj']->deps)) {
$handleStatus = 'child';
} else {
$handleStatus = 'independent';
}
$data['rows_assets']
[$handleStatus] // 'parent', 'child', 'independent'
[$uniqueHandle]
['style'] = $templateRowOutput;
} elseif (isset($data['rows_by_loaded_unloaded']) && $data['rows_by_loaded_unloaded']) {
if (isset($data['current_unloaded_all']['styles']) && in_array($row['obj']->handle, $data['current_unloaded_all']['styles'])) {
$handleStatus = 'unloaded';
} else {
$handleStatus = ( strpos( $row['class'], 'wpacu_not_load' ) !== false ) ? 'unloaded' : 'loaded';
}
$data['rows_assets']
[$handleStatus] // 'loaded', 'unloaded'
[$uniqueHandle]
['style'] = $templateRowOutput;
} elseif (isset($data['rows_by_size']) && $data['rows_by_size']) {
$sizeStatus = (isset($row['obj']->sizeRaw) && is_int($row['obj']->sizeRaw)) ? 'with_size' : 'external_na';
$data['rows_assets']
[$sizeStatus] // 'with_size', 'external_na'
[$uniqueHandle]
['style'] = $templateRowOutput;
if ($sizeStatus === 'with_size') {
// Associated the handle with the raw size of the file
$data['handles_sizes'][$uniqueHandle] = $row['obj']->sizeRaw;
}
} elseif (isset($data['rows_by_rules']) && $data['rows_by_rules']) {
$ruleStatus = (isset($data['row']['at_least_one_rule_set']) && $data['row']['at_least_one_rule_set']) ? 'with_rules' : 'with_no_rules';
$data['rows_assets']
[$ruleStatus] // 'with_rules', 'with_no_rules'
[$uniqueHandle]
['style'] = $templateRowOutput;
} else {
$data['rows_assets'][$uniqueHandle] = $templateRowOutput;
}
} else {
echo \WpAssetCleanUp\Misc::stripIrrelevantHtmlTags($templateRowOutput);
}
}

View File

@ -0,0 +1,132 @@
<?php
/*
* The file is included from _asset-style-rows.php
*/
if (! isset($data)) {
exit; // no direct access
}
$inlineCodeStatus = $data['plugin_settings']['assets_list_inline_code_status'];
$isCoreFile = isset($data['row']['obj']->wp) && $data['row']['obj']->wp;
$hideCoreFiles = $data['plugin_settings']['hide_core_files'];
$isGroupUnloaded = $data['row']['is_group_unloaded'];
// Does it have "children"? - other CSS file(s) depending on it
$childHandles = isset($data['all_deps']['parent_to_child']['styles'][$data['row']['obj']->handle]) ? $data['all_deps']['parent_to_child']['styles'][$data['row']['obj']->handle] : array();
sort($childHandles);
// Unloaded site-wide
if ($data['row']['global_unloaded']) {
$data['row']['class'] .= ' wpacu_is_global_unloaded';
}
// Unloaded site-wide OR on all posts, pages etc.
if ($isGroupUnloaded) {
$data['row']['class'] .= ' wpacu_is_bulk_unloaded';
}
$rowIsContracted = '';
$dashSign = 'minus';
$dataRowStatusAttr = 'expanded';
if (isset($data['handle_rows_contracted']['styles'][$data['row']['obj']->handle]) && $data['handle_rows_contracted']['styles'][$data['row']['obj']->handle]) {
$rowIsContracted = 1;
$dashSign = 'plus';
$dataRowStatusAttr = 'contracted';
}
?>
<tr data-style-handle-row="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
id="wpacu_style_row_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
class="wpacu_asset_row <?php echo esc_attr($data['row']['class']); ?>"
style="<?php if ($isCoreFile && $hideCoreFiles) { echo 'display: none;'; } ?>">
<td valign="top" style="position: relative;" data-wpacu-row-status="<?php echo esc_attr($dataRowStatusAttr); ?>">
<!-- [reference field] -->
<input type="hidden" name="<?php echo WPACU_FORM_ASSETS_POST_KEY; ?>[styles][<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>]" value="" />
<!-- [/reference field] -->
<div class="wpacu_handle_row_expand_contract_area">
<a data-wpacu-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
data-wpacu-handle-for="style"
class="wpacu_handle_row_expand_contract"
href="#"><span class="dashicons dashicons-<?php echo esc_attr($dashSign); ?>"></span></a>
<!-- -->
</div>
<?php
include '_asset-style-single-row/_handle.php';
$ver = $data['wp_version']; // default
if (isset($data['row']['obj']->ver) && $data['row']['obj']->ver) {
$ver = is_array($data['row']['obj']->ver) ? implode(', ', $data['row']['obj']->ver) : $data['row']['obj']->ver;
}
$data['row']['obj']->preload_status = 'not_preloaded'; // default
$assetHandleHasSrc = $showGoogleFontRemoveNotice = false;
include '_asset-style-single-row/_source.php';
// Any tips?
if (isset($data['tips']['css'][$data['row']['obj']->handle]) && ($assetTip = $data['tips']['css'][$data['row']['obj']->handle])) {
?>
<div class="tip"><strong>Tip:</strong> <?php echo esc_html($assetTip); ?></div>
<?php
}
?>
<div class="wpacu_handle_row_expanded_area <?php if ($rowIsContracted) { echo 'wpacu_hide'; } ?>">
<?php
$extraInfo = array();
include '_asset-style-single-row/_handle_deps.php';
$extraInfo[] = __('Version:', 'wp-asset-clean-up').' '.$ver;
include '_common/_asset-single-row-position.php';
if (isset($data['row']['obj']->src) && trim($data['row']['obj']->src)) {
$extraInfo[] = __('File Size:', 'wp-asset-clean-up') . ' <em>' . $data['row']['obj']->size . '</em>';
}
if (! empty($extraInfo)) {
$spacingAdj = (isset($noSrcLoadedIn) && $noSrcLoadedIn) ? '18px 0 10px' : '2px 0 10px';
echo '<div style="margin: '.$spacingAdj.'; display: inline-block;">'.implode(' &nbsp;/&nbsp; ', $extraInfo).'</div>';
}
?>
<div class="wrap_bulk_unload_options">
<?php
// Unload on this page
include '_common/_asset-single-row-unload-per-page.php';
// Unload site-wide (everywhere)
include '_common/_asset-single-row-unload-site-wide.php';
// Unload on all pages of [post] post type (if applicable)
include '_common/_asset-single-row-unload-post-type.php';
// Unload on all pages where this [post] post type has a certain taxonomy set for it (e.g. a Tag or a Category) (if applicable)
// There has to be at least a taxonomy created for this [post] post type in order to show this option
if (isset($data['post_type']) && $data['post_type'] !== 'attachment' && ! $data['row']['is_post_type_unloaded'] && ! empty($data['post_type_has_tax_assoc'])) {
include '_common/_asset-single-row-unload-post-type-taxonomy.php';
}
// Unload via RegEx (if site-wide is not already chosen)
include '_common/_asset-single-row-unload-via-regex.php';
// If any bulk unload rule is set, show the load exceptions
include '_common/_asset-single-row-load-exceptions.php';
?>
<div class="wpacu_clearfix"></div>
</div>
<?php
// Extra inline associated with the LINK tag
include '_common/_asset-single-row-extra-inline.php';
// Media Query Load (Pro feature)
include '_asset-style-single-row/_loaded-rules.php';
// Handle Note
include '_common/_asset-single-row-notes.php';
?>
</div>
<img style="display: none;" class="wpacu_ajax_loader" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-ajax-loading-spinner.svg" alt="<?php esc_html_e('Loading', 'wp-asset-clean-up'); ?>..." />
</td>
</tr>

View File

@ -0,0 +1,81 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-style-single-row.php
*/
if ( ! isset($data, $isCoreFile, $hideCoreFiles, $childHandles) ) {
exit; // no direct access
}
?>
<div class="wpacu_handle">
<label for="style_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"><?php _e('Handle:', 'wp-asset-clean-up'); ?> <strong><span style="color: green;"><?php echo esc_attr($data['row']['obj']->handle); ?></span></strong></label>
&nbsp;<em>* Stylesheet (.css)</em>
<?php
if ($data['row']['obj']->handle === 'wp-block-library') {
?>
&#10230; <span style="color: #ccc;" class="dashicons dashicons-text-page"></span> <a href="https://assetcleanup.com/docs/?p=713" target="_blank" rel="noopener noreferrer">Read more</a>
<?php
}
if ($isCoreFile && ! $hideCoreFiles) { ?>
<span class="dashicons dashicons-wordpress-alt wordpress-core-file"><span class="wpacu-tooltip">WordPress Core File<br /><?php _e('Not sure if needed or not? In this case, it\'s better to leave it loaded to avoid breaking the website.', 'wp-asset-clean-up'); ?></span></span>
<?php
}
if (isset($data['load_exceptions_debug']['styles']) && in_array($data['row']['obj']->handle, $data['load_exceptions_debug']['styles'])) {
// '/?wpacu_load_css=' was used and has the handle within its value
echo '&nbsp; <span style="color: green; font-style: italic;"><strong>Load Exception:</strong> This handle is loading for you on this page as requested via the "wpacu_load_css" value from the current page URL (for debugging purposes).</span>';
} elseif (isset($data['current_debug']['styles']) && in_array($data['row']['obj']->handle, $data['current_debug']['styles'])) {
// '/?wpacu_unload_css=' was used and has the handle within its value
echo '&nbsp; <span style="color: #cc0000; font-style: italic;"><strong>Unload Exception:</strong> This handle is unloaded for you on this page as requested via the "wpacu_unload_css" value from the current page URL (for debugging purposes).</span>';
}
// Any conditions set such as "IE" or "lt IE 8"?
$dataRowExtra = (array)$data['row']['obj']->extra;
// Notify the user the assets load only on Internet Explorer
if ( isset( $dataRowExtra['conditional'] ) && $dataRowExtra['conditional'] && strpos( $dataRowExtra['conditional'], 'IE' ) !== false ) {
echo '&nbsp;&nbsp;<span><img style="vertical-align: middle;" width="25" height="25" src="'.WPACU_PLUGIN_URL.'/assets/icons/icon-ie.svg" alt="" title="Microsoft / Public domain" />&nbsp;<span style="font-weight: 400; color: #1C87CF;">Loads only in Internet Explorer based on the following condition:</span> <em> if '.$dataRowExtra['conditional'].'</em></span>';
}
?>
</div>
<?php
$ignoreChild = (isset($data['ignore_child']['styles'][$data['row']['obj']->handle]) && $data['ignore_child']['styles'][$data['row']['obj']->handle]);
if ($ignoreChild) { $data['row']['at_least_one_rule_set'] = true; }
if (! empty($childHandles)) {
?>
<div class="wpacu_dependency_notice_area">
<em style="font-size: 85%;">
<span style="color: #0073aa; width: 19px; height: 19px; vertical-align: middle;" class="dashicons dashicons-info"></span>
There are CSS "children" files depending on this file. By unloading it, the following will also be unloaded:
<?php
$childHandlesOutput = '';
foreach ($childHandles as $childHandle) {
$childHandleText = $childHandle;
$title = '';
$color = 'green';
if (in_array($childHandle, $data['unloaded_css_handles'])) {
$color = '#cc0000';
$title = __('This CSS handle is already unloaded.', 'wp-asset-clean-up');
}
$childHandlesOutput .= '<a title="'.$title.'" style="color:'.$color.';font-weight:300;" href="#wpacu_style_row_'.$childHandle.'"><span>'.$childHandleText.'</span></a>, ';
}
echo trim($childHandlesOutput, ', ');
?>
</em>
<label for="style_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>_ignore_children">
&#10230; <input id="style_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>_ignore_children"
type="checkbox"
<?php if ($ignoreChild) { ?>checked="checked"<?php } ?>
name="<?php echo WPACU_FORM_ASSETS_POST_KEY; ?>[styles][<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>][ignore_child]"
value="1" /> <small><?php _e('Ignore dependency rule and keep the "children" loaded', 'wp-asset-clean-up'); ?>
<?php if (in_array($data['row']['obj']->handle, \WpAssetCleanUp\Main::instance()->keepChildrenLoadedForHandles['css'])) { echo '(recommended)'; } ?>
</small>
</label>
</div>
<?php
} elseif ($ignoreChild) {
// Keep the option enabled in case ignoring other dependencies was already chosen in a different page (e.g. in some pages a handle can have a dependency, in others it might not have any)
?>
<input type="hidden" name="<?php echo WPACU_FORM_ASSETS_POST_KEY; ?>[styles][<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>][ignore_child]" value="1" />
<?php
}

View File

@ -0,0 +1,34 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-style-single-row.php
*/
if (! isset($data)) {
exit; // no direct access
}
// [Start] Any dependencies
if (isset($data['row']['obj']->deps) && ! empty($data['row']['obj']->deps)) {
$depsOutput = '';
if (is_array($data['row']['obj']->deps)) {
$dependsOnText = (count($data['row']['obj']->deps) === 1)
? __('"Child" of one "parent" CSS file:')
: sprintf(__('"Child" of %s CSS "parent" files:', 'wp-asset-clean-up'),
count($data['row']['obj']->deps));
} else {
$dependsOnText = __('"Child" of "parent" CSS file(s):', 'wp-asset-clean-up');
}
$depsOutput .= $dependsOnText.' ';
foreach ($data['row']['obj']->deps as $depHandle) {
$depHandleText = $depHandle;
$color = in_array($depHandle, $data['unloaded_css_handles']) ? '#cc0000' : 'green';
$depsOutput .= '<a style="color:'.$color.';font-weight:300;" href="#wpacu_style_row_'.$depHandle.'"><span>'.$depHandleText.'</span></a>, ';
}
$depsOutput = rtrim($depsOutput, ', ');
$extraInfo[] = $depsOutput;
}
// [End] Any dependencies

View File

@ -0,0 +1,104 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-script-single-row.php
*/
if (! isset($data)) {
exit; // no direct access
}
$isGroupUnloaded = $data['row']['is_group_unloaded'];
$anyUnloadRuleSet = ($isGroupUnloaded || $data['row']['checked']);
if ($anyUnloadRuleSet) {
$data['row']['at_least_one_rule_set'] = true;
}
?>
<div class="wpacu_exception_options_area_load_exception <?php if (! $anyUnloadRuleSet) { echo 'wpacu_hide'; } ?>">
<div data-style-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
class="wpacu_exception_options_area_wrap">
<fieldset>
<legend>Make an exception from any unload rule &amp; <strong>always load it</strong>:</legend>
<ul class="wpacu_area_two wpacu_asset_options wpacu_exception_options_area">
<li id="wpacu_load_it_option_style_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>">
<label><input data-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
id="wpacu_style_load_it_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
class="wpacu_load_it_option_one wpacu_style wpacu_load_exception"
type="checkbox"
<?php if ($data['row']['is_load_exception_per_page']) { ?> checked="checked" <?php } ?>
name="wpacu_styles_load_it[]"
value="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"/>
<span>On this page</span></label>
</li>
<?php
if ($data['bulk_unloaded_type'] === 'post_type') {
// Only show it on edit post/page/custom post type
switch ($data['post_type']) {
case 'product':
$loadBulkText = __('On all WooCommerce "Product" pages', 'wp-asset-clean-up');
break;
case 'download':
$loadBulkText = __('On all Easy Digital Downloads "Download" pages', 'wp-asset-clean-up');
break;
default:
$loadBulkText = sprintf(__('On All Pages of "<strong>%s</strong>" post type', 'wp-asset-clean-up'), $data['post_type']);
}
?>
<li id="wpacu_load_it_post_type_option_style_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>">
<label><input data-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
id="wpacu_style_load_it_post_type_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
class="wpacu_load_it_option_post_type wpacu_style wpacu_load_exception"
type="checkbox"
<?php if ($data['row']['is_load_exception_post_type']) { ?> checked="checked" <?php } ?>
name="<?php echo WPACU_FORM_ASSETS_POST_KEY; ?>[styles][<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>][load_it_post_type]"
value="1"/>
<span><?php echo wp_kses($loadBulkText, array('strong' => array())); ?></span></label>
</li>
<?php
if (isset($data['post_type']) && $data['post_type'] !== 'attachment' && ! empty($data['post_type_has_tax_assoc'])) {
include dirname(__DIR__).'/_common/_asset-single-row-load-exceptions-taxonomy.php';
}
}
?>
<li>
<label for="wpacu_load_it_regex_option_style_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>">
<input data-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
id="wpacu_load_it_regex_option_style_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
class="wpacu_load_it_option_two wpacu_style wpacu_load_exception wpacu_lite_locked"
type="checkbox"
disabled="disabled"
value="1"/>
Load it for URLs with request URI matching this RegEx(es): <a class="go-pro-link-no-style"
href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=manage_asset&utm_medium=load_via_regex_make_exception'); ?>"><span
class="wpacu-tooltip wpacu-larger"><?php echo str_replace('the premium', 'the<br />premium', wp_kses(__('This feature is available in the premium version of the plugin.',
'wp-asset-clean-up' ), array('br' => array()))); ?><br/> <?php _e( 'Click here to upgrade to Pro',
'wp-asset-clean-up' ); ?>!</span><img width="20" height="20"
src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg"
valign="top" alt=""/></a> <a
style="text-decoration: none; color: inherit;" target="_blank"
href="https://assetcleanup.com/docs/?p=21#wpacu-method-2"><span
class="dashicons dashicons-editor-help"></span></a></label>
</li>
<?php
$isLoadItLoggedIn = in_array($data['row']['obj']->handle, $data['handle_load_logged_in']['styles']);
if ($isLoadItLoggedIn) { $data['row']['at_least_one_rule_set'] = true; }
?>
<li id="wpacu_load_it_user_logged_in_option_style_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>">
<label>
<input data-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
id="wpacu_load_it_user_logged_in_option_style_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
class="wpacu_load_it_option_three wpacu_style wpacu_load_exception"
type="checkbox"
<?php if ($isLoadItLoggedIn) { ?> checked="checked" <?php } ?>
name="wpacu_load_it_logged_in[styles][<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>]"
value="1"/>
<span>If the user is logged-in</span></label>
</li>
</ul>
<div class="wpacu_clearfix"></div>
</fieldset>
</div>
</div>

View File

@ -0,0 +1,59 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-style-single-row.php
*/
if (! isset($data)) {
exit; // no direct access
}
$childHandles = isset($data['all_deps']['parent_to_child']['styles'][$data['row']['obj']->handle]) ? $data['all_deps']['parent_to_child']['styles'][$data['row']['obj']->handle] : array();
$handleAllStatuses = array();
if (! empty($childHandles)) {
$handleAllStatuses[] = 'is_parent';
}
if (isset($data['row']['obj']->deps) && ! empty($data['row']['obj']->deps)) {
$handleAllStatuses[] = 'is_child';
}
if (empty($handleAllStatuses)) {
$handleAllStatuses[] = 'is_independent';
}
// No media attribute different from "all"
$linkHasDistinctiveMediaAttr = (isset($data['row']['obj']->args) && $data['row']['obj']->args && $data['row']['obj']->args !== 'all');
if ( ! $linkHasDistinctiveMediaAttr ) {
?>
<!-- [wpacu_lite] -->
<?php
if (isset($data['row']['obj']->src) && $data['row']['obj']->src !== '') {
?>
<div style="margin: 0 0 15px;">
<?php
$wpacuDataForId = 'wpacu_handle_media_query_load_style_'.$data['row']['obj']->handle;
?>
If kept loaded, make the browser download the file&nbsp;
<select data-handle="<?php echo esc_attr($data['row']['obj']->handle); ?>"
data-wpacu-input="media-query-select"
name="<?php echo WPACU_FORM_ASSETS_POST_KEY; ?>[styles][<?php echo esc_attr($data['row']['obj']->handle); ?>][media_query_load][enable]"
class="wpacu-screen-size-load wpacu-for-style">
<option selected="selected" value="">on any screen size (default)</option>
<option disabled="disabled" value="1">if the media query is matched (Pro)</option>
</select>
<div style="display: inline-block; vertical-align: middle; margin-left: -2px;"><a class="go-pro-link-no-style wpacu-media-query-load-requires-pro-popup" href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=manage_asset&utm_medium=media_query_load_css'); ?>"><span
class="wpacu-tooltip wpacu-larger" style="left: -26px;"><?php echo str_replace('the premium', 'the<br />premium', wp_kses(__('This feature is available in the premium version of the plugin.',
'wp-asset-clean-up' ), array('br' => array()))); ?><br/> <?php _e( 'Click here to upgrade to Pro',
'wp-asset-clean-up' ); ?>!</span> <img width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" valign="top" alt="" /></a></div>
<div class="wpacu-helper-area" style="vertical-align: middle; margin-left: 2px;"><a style="text-decoration: none; color: inherit;" target="_blank" href="https://assetcleanup.com/docs/?p=1023"><span class="dashicons dashicons-editor-help"></span></a></div>
</div>
<?php
}
?>
<div class="wpacu_clearfix"></div>
<!-- [/wpacu_lite] -->
<?php
}

View File

@ -0,0 +1,20 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-style-single-row.php
*/
if ( ! isset($data, $styleHandleHasSrc) ) {
exit; // no direct access
}
if ($styleHandleHasSrc && isset($data['row']['obj']->position) && $data['row']['obj']->position !== '') {
$extraInfo[] = __('Position:', 'wp-asset-clean-up') . ' ' . (( $data['row']['obj']->position === 'head') ? 'HEAD' : 'BODY') . '<a class="go-pro-link-no-style" href="' . apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL . '?utm_source=manage_asset&utm_medium=change_css_position').'"><span class="wpacu-tooltip" style="width: 322px; margin-left: -146px;">Upgrade to Pro and change the location of the CSS file <br /> (e.g. to BODY to reduce render-blocking <br /> or to HEAD for very early triggering)</span><img width="20" height="20" src="' . WPACU_PLUGIN_URL . '/assets/icons/icon-lock.svg" valign="top" alt="" /> Change it?</a>';
} elseif (! $styleHandleHasSrc) {
if ($data['row']['obj']->handle === 'woocommerce-inline') {
$noSrcLoadedIn = __('Inline CSS Loaded In:', 'wp-asset-clean-up');
} else {
$noSrcLoadedIn = __('This handle is not for external stylesheet (most likely inline CSS) and it is loaded in:', 'wp-asset-clean-up');
}
$extraInfo[] = $noSrcLoadedIn . ' '. (($data['row']['obj']->position === 'head') ? 'HEAD' : 'BODY');
}

View File

@ -0,0 +1,143 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-style-single-row.php
*/
if ( ! isset($data, $ver, $assetHandleHasSrc, $showGoogleFontRemoveNotice) ) {
exit; // no direct access
}
// If there is a source (in rare cases there are handles such as "woocommerce-inline" that do not have a source)
if (isset($data['row']['obj']->src, $data['row']['obj']->srcHref) && $data['row']['obj']->src && $data['row']['obj']->srcHref) {
$assetHandleHasSrc = $isExternalSrc = true; // default
if (\WpAssetCleanUp\Misc::getLocalSrc($data['row']['obj']->src)
|| strpos($data['row']['obj']->src, '/?') !== false // Dynamic Local URL
|| strpos(str_replace(site_url(), '', $data['row']['obj']->src), '?') === 0 // Starts with ? right after the site url (it's a local URL)
) {
$isExternalSrc = false;
}
$isGoogleFontLink = stripos($data['row']['obj']->srcHref, '//fonts.googleapis.com/') !== false;
// Formatting for Google Fonts
if ($isGoogleFontLink) {
$data['row']['obj']->src = urldecode(\WpAssetCleanUp\OptimiseAssets\FontsGoogle::alterGoogleFontLink($data['row']['obj']->src));
$data['row']['obj']->srcHref = urldecode(\WpAssetCleanUp\OptimiseAssets\FontsGoogle::alterGoogleFontLink($data['row']['obj']->srcHref));
}
$data['row']['obj']->src = str_replace(' ', '+', $data['row']['obj']->src);
$data['row']['obj']->srcHref = str_replace(' ', '+', $data['row']['obj']->srcHref);
$srcHref = $data['row']['obj']->srcHref;
// If the source starts with ../ mark it as external to be checked via the AJAX call (special case)
if (strpos($srcHref, '../') === 0) {
$currentPageUrl = \WpAssetCleanUp\Misc::getCurrentPageUrl();
$srcHref = trim($currentPageUrl, '/') . '/'. $data['row']['obj']->srcHref;
$isExternalSrc = true; // simulation
}
$relSrc = str_replace(site_url(), '', $data['row']['obj']->src);
if (isset($data['row']['obj']->baseUrl)) {
$relSrc = str_replace($data['row']['obj']->baseUrl, '/', $data['row']['obj']->src);
}
// "font-display" CSS Property for Google Fonts - underline the URL parameter
$toUnderline = 'display='.$data['plugin_settings']['google_fonts_display'];
$relSrc = str_replace($toUnderline, '<u style="background: #f2faf2;">'.$toUnderline.'</u>', $relSrc);
if ($isExternalSrc) {
$verToAppend = ''; // no need for any "ver"
} else {
$appendAfterSrcHref = ( strpos( $srcHref, '?' ) === false ) ? '?' : '&';
if ( isset( $data['row']['obj']->ver ) && $data['row']['obj']->ver ) {
$verToAppend = $appendAfterSrcHref .
(is_array( $data['row']['obj']->ver )
? http_build_query( array( 'ver' => $data['row']['obj']->ver ) )
: 'ver=' . $ver);
} else {
global $wp_version;
$verToAppend = $appendAfterSrcHref . 'ver=' . $wp_version;
}
}
if ( $isGoogleFontLink && $data['plugin_settings']['google_fonts_remove'] ) {
$showGoogleFontRemoveNotice = '<span style="color:#c00;">This resource is not loaded as "Remove Google Fonts" is enabled in "Settings" -&gt; "Google Fonts".</span>';
}
$isCssPreload = (isset($data['preloads']['styles'][$data['row']['obj']->handle]) && $data['preloads']['styles'][$data['row']['obj']->handle])
? $data['preloads']['styles'][$data['row']['obj']->handle]
: false;
if ($isCssPreload) {
$data['row']['obj']->preload_status = 'preloaded';
}
if ($showGoogleFontRemoveNotice) {
echo '<p>'.$showGoogleFontRemoveNotice.'</p>';
}
?>
<div class="wpacu-source-row">
<?php
if (isset($data['row']['obj']->src_origin, $data['row']['obj']->ver_origin) && $data['row']['obj']->src_origin) {
$sourceText = esc_html__('Source (updated):', 'wp-asset-clean-up');
$messageToAlert = sprintf(
esc_html__('On this page, the `%s` CSS handle had its source updated via `%s` filter tag.' ."\n\n". 'Original Source: %s (version: %s)'),
$data['row']['obj']->handle,
'wpacu_'.$data['row']['obj']->handle.'_css_handle_data',
$data['row']['obj']->src_origin,
($data['row']['obj']->ver_origin ?: esc_html__('null', 'wp-asset-clean-up'))
);
?>
<a style="text-decoration: none; display: inline-block;"
href="#"
class="wpacu-filter-handle"
data-wpacu-filter-handle-message="<?php echo esc_attr($messageToAlert); ?>"
><span class="dashicons dashicons-filter"></span></a>
<?php
} else {
$sourceText = esc_html__('Source:', 'wp-asset-clean-up'); // as it is, no replacement
}
echo esc_html($sourceText);
?>
<a <?php if ($isExternalSrc) { ?>data-wpacu-external-source="<?php echo esc_attr($srcHref . $verToAppend); ?>" <?php } ?> target="_blank" style="color: green;" href="<?php echo esc_attr($srcHref . $verToAppend); ?>"><?php echo wp_kses($relSrc, array('u' => array('style' => array()))); ?></a>
<?php
if (isset($data['row']['obj']->args) && $data['row']['obj']->args && $data['row']['obj']->args !== 'all') {
$wpacuMediaSpanStyle = 'color: #004f74; font-style: italic;';
$wpacuMediaSvgIcon = <<<SVG
<!-- Generated by IcoMoon.io -->
<svg style="vertical-align: middle; width: 22px; height: 22px; margin-left: 1px; margin-right: 1px;" version="1.1" xmlns="http://www.w3.org/2000/svg" width="18" height="28" viewBox="0 0 18 28">
<title>The media attribute specifies what media/device the target resource is optimized for.</title>
<path style="fill: #004f74;" d="M10 22c0-0.547-0.453-1-1-1s-1 0.453-1 1 0.453 1 1 1 1-0.453 1-1zM16 19.5v-15c0-0.266-0.234-0.5-0.5-0.5h-13c-0.266 0-0.5 0.234-0.5 0.5v15c0 0.266 0.234 0.5 0.5 0.5h13c0.266 0 0.5-0.234 0.5-0.5zM18 4.5v17c0 1.375-1.125 2.5-2.5 2.5h-13c-1.375 0-2.5-1.125-2.5-2.5v-17c0-1.375 1.125-2.5 2.5-2.5h13c1.375 0 2.5 1.125 2.5 2.5z"></path>
</svg>
SVG;
$wpacuLinkToMediaDoc = 'https://www.w3schools.com/css/css_rwd_mediaqueries.asp';
echo ' <span title="media" style="'.esc_attr($wpacuMediaSpanStyle).'"><a target="_blank" href="'.esc_url($wpacuLinkToMediaDoc).'">'.$wpacuMediaSvgIcon.'</a>'.$data['row']['obj']->args.'</span> ';
}
?>
<?php if ($isExternalSrc) { ?><span data-wpacu-external-source-status></span><?php } ?>
<div class="wpacu_hide_if_handle_row_contracted">
&nbsp;&#10230;&nbsp;
Preload (if kept loaded)?
&nbsp;<select style="display: inline-block; width: auto; <?php if ($isCssPreload) {
echo 'background: #f2faf2 url(\'data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%206l5%205%205-5%202%201-7%207-7-7%202-1z%22%20fill%3D%22%23555%22%2F%3E%3C%2Fsvg%3E\') no-repeat right 5px top 55%; padding-right: 30px; color: black;';
} ?>"
data-wpacu-input="preload"
name="<?php echo WPACU_FORM_ASSETS_POST_KEY; ?>[styles][<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>][preload]">
<option value="">No (default)</option>
<option <?php if ($isCssPreload === 'basic') { ?>selected="selected"<?php } ?> value="basic">Yes, basic</option>
<!-- [wpacu_pro] -->
<option disabled="disabled" value="async">Yes, async (Pro)</option>
<!-- [/wpacu_pro] -->
</select>
<small>* applies site-wide</small> <small><a style="text-decoration: none; color: inherit;" target="_blank" href="https://assetcleanup.com/docs/?p=202"><span class="dashicons dashicons-editor-help"></span></a></small>
</div>
</div>
<?php
}

View File

@ -0,0 +1,231 @@
<?php
if (! isset($data)) {
exit; // no direct access
}
$totalFoundHardcodedTags = $totalHardcodedTags = 0;
$hardcodedTags = $data['all']['hardcoded'];
$contentWithinConditionalComments = \WpAssetCleanUp\ObjectCache::wpacu_cache_get('wpacu_hardcoded_content_within_conditional_comments');
$totalFoundHardcodedTags = isset($hardcodedTags['link_and_style_tags']) ? count($hardcodedTags['link_and_style_tags']) : 0;
$totalFoundHardcodedTags += isset($hardcodedTags['script_src_or_inline_and_noscript_inline_tags'])
? count($hardcodedTags['script_src_or_inline_and_noscript_inline_tags']) : 0;
if ($totalFoundHardcodedTags === 0) {
return; // Don't print anything if there are no hardcoded tags available
}
?>
<?php if (isset($data['print_outer_html']) && $data['print_outer_html']) { ?>
<div class="wpacu-assets-collapsible-wrap wpacu-wrap-area wpacu-hardcoded">
<a class="wpacu-assets-collapsible wpacu-assets-collapsible-active" href="#" style="padding: 15px 15px 15px 44px;">
<span class="dashicons dashicons-code-standards"></span> Hardcoded (non-enqueued) Styles &amp; Scripts &#10141; Total: <?php echo $totalFoundHardcodedTags; ?>
</a>
<div class="wpacu-assets-collapsible-content" style="max-height: inherit;">
<?php } ?>
<div style="padding: 0;">
<div style="margin: 15px 0 0;">
<p><span style="color: #0073aa;" class="dashicons dashicons-info"></span> The following tags are NOT LOADED via the recommended <a target="_blank"
href="https://developer.wordpress.org/reference/hooks/wp_enqueue_scripts/">wp_enqueue_scripts()</a>
action hook (despite the name, it is used for enqueuing both scripts and styles) which is the proper one to use when enqueuing scripts and styles that are meant to appear on
the front end. The standard functions that are used inside the hook to do an enqueuing are: <a target="_blank"
href="https://developer.wordpress.org/reference/functions/wp_enqueue_style/">wp_enqueue_style()</a>,
<a target="_blank" href="https://codex.wordpress.org/Function_Reference/wp_add_inline_style">wp_add_inline_style()</a>,
<a target="_blank" href="https://developer.wordpress.org/reference/functions/wp_enqueue_script/">wp_enqueue_script()</a>
&amp; <a target="_blank"
href="https://developer.wordpress.org/reference/functions/wp_add_inline_script/">wp_add_inline_script()</a>. The tags could have been added via editing the PHP code (not using the right standard functions), directly inside posts content, widgets or via plugins such as "Insert Headers and Footers", "Head, Footer and Post Injections", etc. Be careful when unloading any of these tags as they might be related to Google Analytics/Google Ads, StatCounter, Facebook Pixel, etc.
</p>
<!-- [wpacu_lite] -->
<div style="margin: 20px 0; border-left: solid 4px green; background: #f2faf2; padding: 10px;"><img width="20" height="20" src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg" valign="top" alt="" /> &nbsp;Managing hardcoded LINK/STYLE/SCRIPT tags is an option <a target="_blank" href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=manage_hardcoded_assets&utm_medium=top_notice'); ?>">available in the Pro version</a>.</div>
<!-- [/wpacu_lite] -->
</div>
<?php
$handlesInfo = \WpAssetCleanUp\Main::getHandlesInfo();
foreach (array('link_and_style_tags', 'script_src_or_inline_and_noscript_inline_tags') as $targetKey) {
if ( ! (isset($hardcodedTags[$targetKey]) && ! empty($hardcodedTags[$targetKey])) ) {
continue; // None found in the list? do not trigger the code below!
}
$hardcodedTags[ $targetKey ] = array_unique( $hardcodedTags[ $targetKey ] );
if ( ! empty( $hardcodedTags[ $targetKey ] ) ) {
$totalTagsForTarget = count( $hardcodedTags[ $targetKey ] );
?>
<div>
<div class="wpacu-content-title wpacu-has-toggle-all-assets">
<h3>
<?php if ($targetKey === 'link_and_style_tags') { ?>Hardcoded LINK (stylesheet) &amp; STYLE tags<?php } ?>
<?php if ($targetKey === 'script_src_or_inline_and_noscript_inline_tags') { ?>Hardcoded SCRIPT (with "src" attribute &amp; inline) and NOSCRIPT inline tags<?php } ?>
</h3>
<div class="wpacu-area-toggle-all-assets wpacu-right">
<a class="wpacu-area-contract-all-assets wpacu_area_handles_row_expand_contract"
data-wpacu-area="hardcoded_<?php echo $targetKey; ?>" href="#">Contract</a>
|
<a class="wpacu-area-expand-all-assets wpacu_area_handles_row_expand_contract"
data-wpacu-area="hardcoded_<?php echo $targetKey; ?>" href="#">Expand</a>
All Assets
</div>
</div>
<table class="wpacu_list_table wpacu_striped" data-wpacu-area="hardcoded_<?php echo $targetKey; ?>">
<tbody>
<?php
$hardcodedTagsOutput = '';
foreach ( $hardcodedTags[ $targetKey ] as $indexNo => $tagOutput ) {
$contentUniqueStr = \WpAssetCleanUp\HardcodedAssets::determineHardcodedAssetSha1($tagOutput);
/*
* 1) Hardcoded LINK (stylesheet) &amp; STYLE tags
*/
if ($targetKey === 'link_and_style_tags') {
// For LINK ("stylesheet")
if ( stripos( $tagOutput, '<link ' ) === 0 ) {
$generatedHandle = 'wpacu_hardcoded_link_' . $contentUniqueStr;
// could be href="value_here" or href = "value_here" (with extra spaces) / make sure it matches
if ( preg_match('#href(\s+|)=(\s+|)#Umi', $tagOutput) ) {
$linkHrefOriginal = \WpAssetCleanUp\Misc::getValueFromTag($tagOutput);
}
// No room for any mistakes, do not print the cached files
if (strpos($linkHrefOriginal, \WpAssetCleanUp\OptimiseAssets\OptimizeCommon::getRelPathPluginCacheDir()) !== false) {
continue;
}
$dataRowObj = (object) array(
'handle' => $generatedHandle,
'src' => $linkHrefOriginal,
'tag_output' => $tagOutput
);
$dataRowObj->inside_conditional_comment = \WpAssetCleanUp\HardcodedAssets::isWithinConditionalComment($tagOutput, $contentWithinConditionalComments);
// Determine source href (starting with '/' but not starting with '//')
if (strpos($linkHrefOriginal, '/') === 0 && strpos($linkHrefOriginal, '//') !== 0) {
$dataRowObj->srcHref = get_site_url() . $linkHrefOriginal;
} else {
$dataRowObj->srcHref = $linkHrefOriginal;
}
$dataHH = $data;
$dataHH['row'] = array();
$dataHH['row']['asset_type'] = 'styles';
$dataHH['row']['obj'] = $dataRowObj;
$templateRowOutput = \WpAssetCleanUp\Main::instance()->parseTemplate(
'/meta-box-loaded-assets/_hardcoded/_asset-style-single-row-hardcoded',
$dataHH
);
$hardcodedTagsOutput .= $templateRowOutput;
}
// For STYLE (inline)
if ( stripos( $tagOutput, '<style' ) === 0 ) {
$generatedHandle = 'wpacu_hardcoded_style_' . $contentUniqueStr;
$dataRowObj = (object) array(
'handle' => $generatedHandle,
'src' => false,
'tag_output' => $tagOutput
);
$dataRowObj->inside_conditional_comment = \WpAssetCleanUp\HardcodedAssets::isWithinConditionalComment($tagOutput, $contentWithinConditionalComments);
$dataHH = $data;
$dataHH['row'] = array();
$dataHH['row']['asset_type'] = 'styles';
$dataHH['row']['obj'] = $dataRowObj;
$templateRowOutput = \WpAssetCleanUp\Main::instance()->parseTemplate(
'/meta-box-loaded-assets/_hardcoded/_asset-style-single-row-hardcoded',
$dataHH
);
$hardcodedTagsOutput .= $templateRowOutput;
}
$totalHardcodedTags++;
} elseif ($targetKey === 'script_src_or_inline_and_noscript_inline_tags') {
/*
* 2) Hardcoded SCRIPT (with "src" attribute & inline) or Hardcoded NOSCRIPT inline tags
*/
$generatedHandle = $srcHrefOriginal = false;
if ( stripos( $tagOutput, '<script' ) === 0 ) {
if ( preg_match( '#src(\s+|)=(\s+|)#Umi', $tagOutput ) ) {
$srcHrefOriginal = \WpAssetCleanUp\Misc::getValueFromTag( $tagOutput );
}
if ( $srcHrefOriginal ) {
// No room for any mistakes, do not print the cached files
if ( strpos( $srcHrefOriginal,
\WpAssetCleanUp\OptimiseAssets\OptimizeCommon::getRelPathPluginCacheDir() ) !== false ) {
continue;
}
$handlePrefix = 'wpacu_hardcoded_script_src_';
$generatedHandle = $handlePrefix . $contentUniqueStr;
}
// Is it a SCRIPT without "src" attribute? Then it's an inline one
if ( ! $generatedHandle ) {
$handlePrefix = 'wpacu_hardcoded_script_inline_';
$generatedHandle = $handlePrefix . $contentUniqueStr;
}
} elseif ( stripos( $tagOutput, '<noscript' ) === 0 ) {
$handlePrefix = 'wpacu_hardcoded_noscript_inline_';
$generatedHandle = $handlePrefix . $contentUniqueStr;
}
$dataRowObj = (object)array(
'handle' => $generatedHandle,
'tag_output' => $tagOutput
);
if ($srcHrefOriginal) {
$dataRowObj->src = $srcHrefOriginal;
}
$dataRowObj->inside_conditional_comment = \WpAssetCleanUp\HardcodedAssets::isWithinConditionalComment($tagOutput, $contentWithinConditionalComments);
// Determine source href (starting with '/' but not starting with '//')
if ($srcHrefOriginal) {
if ( strpos( $srcHrefOriginal, '/' ) === 0 && strpos( $srcHrefOriginal, '//' ) !== 0 ) {
$dataRowObj->srcHref = get_site_url() . $srcHrefOriginal;
} else {
$dataRowObj->srcHref = $srcHrefOriginal;
}
}
$dataHH = $data;
$dataHH['row'] = array();
$dataHH['row']['asset_type'] = 'scripts';
$dataHH['row']['obj'] = $dataRowObj;
$templateRowOutput = \WpAssetCleanUp\Main::instance()->parseTemplate(
'/meta-box-loaded-assets/_hardcoded/_asset-script-single-row-hardcoded',
$dataHH
);
$totalHardcodedTags++;
$hardcodedTagsOutput .= $templateRowOutput;
}
}
echo \WpAssetCleanUp\Misc::stripIrrelevantHtmlTags($hardcodedTagsOutput);
?>
</tbody>
</table>
</div>
<?php
}
}
?>
</div>
<?php if (isset($data['print_outer_html']) && $data['print_outer_html']) { ?>
</div>
</div>
<?php }

View File

@ -0,0 +1,50 @@
<?php
// no direct access
if (! isset($data)) {
exit;
}
?>
<p><?php echo sprintf(
esc_html__('Please select the styles &amp; scripts that are %sNOT NEEDED%s from the list below. Not sure which ones to unload? %s Use "Test Mode" (to make the changes apply only to you), while you are going through the trial &amp; error process.', 'wp-asset-clean-up'),
'<span style="color: #CC0000;"><strong>',
'</strong></span>',
'<img draggable="false" class="wpacu-emoji" style="max-width: 26px; max-height: 26px;" alt="" src="https://s.w.org/images/core/emoji/11.2.0/svg/1f914.svg">'
); ?></p>
<?php
if ($data['plugin_settings']['hide_core_files']) {
?>
<div class="wpacu_note"><span class="dashicons dashicons-info"></span> WordPress CSS &amp; JavaScript core files are hidden as requested in the plugin's settings. They are meant to be managed by experienced developers in special situations.</div>
<div class="wpacu_clearfix" style="margin-top: 10px;"></div>
<?php
}
if ( ( (isset($data['core_styles_loaded']) && $data['core_styles_loaded']) || (isset($data['core_scripts_loaded']) && $data['core_scripts_loaded']) ) && ! $data['plugin_settings']['hide_core_files']) {
?>
<div class="wpacu_note wpacu_warning">
<em><?php echo sprintf(
esc_html__('Assets that are marked with %s are part of WordPress core files. Be careful if you decide to unload them! If you are not sure what to do, just leave them loaded by default and consult with a developer.', 'wp-asset-clean-up'),
'<span class="dashicons dashicons-wordpress-alt wordpress-core-file"></span>' );
?>
</em>
</div>
<?php
}
?>
<div style="margin: 10px 0;">
<label for="wpacu_assets_list_layout"><strong>Assets List Layout:</strong></label> <small>* any new change will take effect after you use the "Update" button</small>
<p style="margin: 8px 0;"><?php echo \WpAssetCleanUp\Settings::generateAssetsListLayoutDropDown($data['plugin_settings']['assets_list_layout'], 'wpacu_assets_list_layout'); ?></p>
</div>
<div style="margin-bottom: 20px;" class="wpacu-contract-expand-area">
<div class="col-left">
<strong>&#10141; Total enqueued files (including core files): <?php echo (int)$data['total_styles'] + (int)$data['total_scripts']; ?></strong>
</div>
<div id="wpacu-assets-groups-change-state-area" data-wpacu-groups-current-state="<?php echo esc_attr($data['plugin_settings']['assets_list_layout_areas_status']); ?>" class="col-right">
<button id="wpacu-assets-contract-all" class="wpacu_wp_button wpacu_wp_button_secondary"><img class="wpacu_ajax_loader" align="top" src="<?php echo esc_url(admin_url('images/spinner.gif')); ?>" alt="" /> <span>Contract All Groups</span></button>&nbsp;
<button id="wpacu-assets-expand-all" class="wpacu_wp_button wpacu_wp_button_secondary"><img class="wpacu_ajax_loader" align="top" src="<?php echo esc_url(admin_url('images/spinner.gif')); ?>" alt="" /> <span>Expand All Groups</span></button>
</div>
<div class="wpacu_clearfix"></div>
</div>

View File

@ -0,0 +1,113 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-script-single-row.php
*/
if (! isset($data, $inlineCodeStatus)) {
exit; // no direct access
}
$assetType = $data['row']['asset_type'];
$assetTypeS = substr($data['row']['asset_type'], 0, -1); // "styles" to "style" & "scripts" to "script"
if ($assetTypeS === 'style' && ! empty($data['row']['extra_data_css_list'])) {
$codeToPrint = '';
$totalInlineCodeSize = 0;
foreach ($data['row']['extra_data_css_list'] as $extraDataCSS) {
$outerHtmlCode = \WpAssetCleanUp\OptimiseAssets\OptimizeCss::generateInlineAssocHtmlForHandle(
$data['row']['obj']->handle,
$extraDataCSS
);
$htmlInline = trim($outerHtmlCode);
$codeToPrint .= '<small><code>'.nl2br(htmlspecialchars($htmlInline)).'</code></small><br />';
$totalInlineCodeSize += strlen($outerHtmlCode);
}
?>
<div class="wpacu-assets-inline-code-wrap">
<?php _e('Inline styling associated with the handle:', 'wp-asset-clean-up'); ?>
<a class="wpacu-assets-inline-code-collapsible"
<?php if ($inlineCodeStatus !== 'contracted') { echo 'wpacu-assets-inline-code-collapsible-active'; } ?>
href="#"><?php _e('Show / Hide', 'wp-asset-clean-up'); ?></a>
&nbsp; / &nbsp;Size: <em><?php echo \WpAssetCleanUp\Misc::formatBytes($totalInlineCodeSize, 2, ''); ?></em>
<div class="wpacu-assets-inline-code-collapsible-content <?php if ($inlineCodeStatus !== 'contracted') { echo 'wpacu-open'; } ?>">
<div>
<p style="margin-bottom: 15px; line-height: normal !important;">
<?php echo $codeToPrint; ?>
</p>
</div>
</div>
</div>
<?php
} elseif ($assetTypeS === 'script' && ($data['row']['extra_data_js'] || $data['row']['extra_before_js'] || $data['row']['extra_after_js'])) {
$extraInlineKeys = array(
'data' => 'CDATA added via wp_localize_script()',
'before' => 'Before the tag:',
'after' => 'After the tag:'
);
ob_start();
$totalInlineCodeSize = 0;
foreach ($extraInlineKeys as $extraKeyValue => $extraKeyText) {
$keyToMatch = 'extra_'.$extraKeyValue.'_js';
if ( ! isset($data['row'][$keyToMatch]) ) {
continue;
}
$inlineScriptContent = $data['row'][$keyToMatch];
if (is_array($inlineScriptContent) && in_array($extraKeyValue, array('before', 'after'))) {
$inlineScriptContent = (string)ltrim(implode("\n", $inlineScriptContent));
}
$inlineScriptContent = trim($inlineScriptContent);
if ($inlineScriptContent) {
?>
<div style="margin-bottom: 8px;">
<div style="margin-bottom: 10px;"><strong><?php echo esc_html($extraKeyText); ?></strong></div>
<div style="margin-top: -7px !important; line-height: normal !important;">
<?php
$outerHtmlCode = \WpAssetCleanUp\OptimiseAssets\OptimizeJs::generateInlineAssocHtmlForHandle(
$data['row']['obj']->handle,
$extraKeyValue,
$inlineScriptContent
);
$htmlInline = trim($outerHtmlCode);
echo '<small><code>' . nl2br( htmlspecialchars( $htmlInline ) ) . '</code></small>';
$totalInlineCodeSize += strlen($outerHtmlCode);
?>
</div>
</div>
<?php
}
}
$codeToPrint = ob_get_clean();
if ($totalInlineCodeSize > 0) {
?>
<div class="wpacu-assets-inline-code-wrap">
<?php _e('Inline JavaScript code associated with the handle:', 'wp-asset-clean-up'); ?>
<a class="wpacu-assets-inline-code-collapsible"
<?php if ($inlineCodeStatus !== 'contracted') { echo 'wpacu-assets-inline-code-collapsible-active'; } ?>
href="#"><?php _e('Show', 'wp-asset-clean-up'); ?> / <?php _e('Hide', 'wp-asset-clean-up'); ?></a>
&nbsp; / &nbsp;Size: <em><?php echo \WpAssetCleanUp\Misc::formatBytes($totalInlineCodeSize, 2, ''); ?></em>
<div class="wpacu-assets-inline-code-collapsible-content <?php if ($inlineCodeStatus !== 'contracted') { echo 'wpacu-open'; } ?>">
<?php
echo $codeToPrint;
?>
</div>
</div>
<?php
}
}

View File

@ -0,0 +1,42 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_hardcoded/_asset-(script|style)-single-row-hardcoded.php
*/
if ( ! isset($data) ) {
exit; // no direct access
}
if (isset($data['row']['obj']->src, $data['row']['obj']->srcHref) && trim($data['row']['obj']->src) !== '' && $data['row']['obj']->srcHref) {
$isExternalSrc = true;
if (\WpAssetCleanUp\Misc::getLocalSrc($data['row']['obj']->src)
|| strpos($data['row']['obj']->src, '/?') !== false // Dynamic Local URL
|| strpos(str_replace(site_url(), '', $data['row']['obj']->src), '?') === 0 // Starts with ? right after the site url (it's a local URL)
) {
$isExternalSrc = false;
}
$srcHref = $data['row']['obj']->srcHref;
// If the source starts with ../ mark it as external to be checked via the AJAX call (special case)
if (strpos($srcHref, '../') === 0) {
$currentPageUrl = \WpAssetCleanUp\Misc::getCurrentPageUrl();
$srcHref = trim( $currentPageUrl, '/' ) . '/' . $data['row']['obj']->srcHref;
$isExternalSrc = true; // simulation
}
$relSrc = str_replace(site_url(), '', $data['row']['obj']->src);
if (isset($data['row']['obj']->baseUrl)) {
$relSrc = str_replace($data['row']['obj']->baseUrl, '/', $relSrc);
}
?>
<div class="wpacu-source-row">
<?php _e( 'Source:', 'wp-asset-clean-up' ); ?>
<a target="_blank"
style="color: green;" <?php if ( $isExternalSrc ) { ?> data-wpacu-external-source="<?php echo esc_attr($srcHref); ?>" <?php } ?>
href="<?php echo esc_attr($data['row']['obj']->src); ?>"><?php echo esc_html($relSrc); ?></a>
<?php if ( $isExternalSrc ) { ?><span data-wpacu-external-source-status></span><?php } ?>
</div>
<?php
}

View File

@ -0,0 +1,45 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_common/_asset-single-row-load-exceptions.php
*/
if (! isset($data)) {
exit; // no direct access
}
$assetType = $data['row']['asset_type'];
$assetTypeS = substr($data['row']['asset_type'], 0, -1); // "styles" to "style" & "scripts" to "script"
switch ($data['post_type']) {
case 'product':
$loadBulkTextViaTax = __('On all WooCommerce "Product" pages if these taxonomies (e.g. Category, Tag) are set', 'wp-asset-clean-up');
break;
case 'download':
$loadBulkTextViaTax = __('On all Easy Digital Downloads "Download" pages if these taxonomies (e.g. Category, Tag) are set', 'wp-asset-clean-up');
break;
default:
$loadBulkTextViaTax = sprintf(__('On all pages of "<strong>%s</strong>" post type if these taxonomies (e.g. Category, Tag) are set', 'wp-asset-clean-up'), $data['post_type']);
}
?>
<li>
<label for="wpacu_load_it_via_tax_option_<?php echo $assetTypeS; ?>_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>">
<input data-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
data-handle-for="<?php echo $assetTypeS; ?>"
id="wpacu_load_it_via_tax_option_<?php echo $assetTypeS; ?>_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
class="wpacu_load_it_via_tax_checkbox wpacu_load_exception wpacu_load_rule_input wpacu_bulk_load wpacu_lite_locked"
type="checkbox"
name="<?php echo WPACU_FORM_ASSETS_POST_KEY; ?>[<?php echo $assetType; ?>][load_it_post_type_via_tax][<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>][enable]"
disabled="disabled"
value="1"/>&nbsp;<span><?php echo $loadBulkTextViaTax; ?>:</span></label>
<a class="go-pro-link-no-style"
href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=manage_asset&utm_medium=load_exception_'.$assetTypeS.'_post_type_via_tax'); ?>"><span
class="wpacu-tooltip wpacu-larger" style="left: -26px;"><?php echo str_replace('the premium', 'the<br />premium', wp_kses(__('This feature is available in the premium version of the plugin.',
'wp-asset-clean-up' ), array('br' => array()))); ?><br/> <?php _e( 'Click here to upgrade to Pro',
'wp-asset-clean-up' ); ?>!</span><img width="20" height="20"
src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg"
valign="top" alt=""/></a>
<a style="text-decoration: none; color: inherit; vertical-align: middle;" target="_blank"
href="https://www.assetcleanup.com/docs/?p=1415#load_exception"><span
class="dashicons dashicons-editor-help"></span></a>
</li>

View File

@ -0,0 +1,115 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-(script|style)-single-row.php
*/
if (! isset($data)) {
exit; // no direct access
}
$assetType = $data['row']['asset_type'];
$assetTypeS = substr($data['row']['asset_type'], 0, -1); // "styles" to "style" & "scripts" to "script"
$isGroupUnloaded = $data['row']['is_group_unloaded'];
// [wpacu_pro]
$isMarkedForPostTypeViaTaxUnload = isset($data['handle_unload_via_tax'][$assetType][$data['row']['obj']->handle ]['enable'], $data['handle_unload_via_tax'][$assetType][$data['row']['obj']->handle]['values'])
&& $data['handle_unload_via_tax'][$assetType][$data['row']['obj']->handle ]['enable'] && ! empty($data['handle_unload_via_tax'][$assetType][$data['row']['obj']->handle]['values']);
$isMarkedForRegExUnload = isset($data['handle_unload_regex'][$assetType][ $data['row']['obj']->handle ]['enable']) ? $data['handle_unload_regex'][$assetType][ $data['row']['obj']->handle ]['enable'] : false;
// [/wpacu_pro]
$anyUnloadRuleSet = ($isGroupUnloaded || $isMarkedForRegExUnload || $isMarkedForPostTypeViaTaxUnload || $data['row']['checked']);
if ($anyUnloadRuleSet || $data['row']['is_load_exception_per_page']) {
$data['row']['at_least_one_rule_set'] = true;
}
$loadExceptionOptionsAreaCss = '';
if ($data['row']['global_unloaded']) {
// Move it to the right side or extend it to avoid so much empty space and a higher DIV
$loadExceptionOptionsAreaCss = 'display: contents;';
}
?>
<div class="wpacu_exception_options_area_load_exception <?php if (! $anyUnloadRuleSet) { echo 'wpacu_hide'; } ?>" style="<?php echo $loadExceptionOptionsAreaCss; ?>">
<div data-<?php echo $assetTypeS; ?>-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
class="wpacu_exception_options_area_wrap">
<fieldset>
<legend>Make an exception from any unload rule &amp; <strong>always load it</strong>:</legend>
<ul class="wpacu_area_two wpacu_asset_options wpacu_exception_options_area">
<li id="wpacu_load_it_option_<?php echo $assetTypeS; ?>_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>">
<label><input data-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
id="wpacu_load_it_option_<?php echo $assetTypeS; ?>_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
class="wpacu_load_it_option_one wpacu_<?php echo $assetTypeS; ?> wpacu_load_exception"
type="checkbox"
<?php if ($data['row']['is_load_exception_per_page']) { ?> checked="checked" <?php } ?>
name="wpacu_<?php echo $assetType; ?>_load_it[]"
value="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>" />
<span>On this page</span></label>
</li>
<?php
if ($data['bulk_unloaded_type'] === 'post_type') {
// Only show it on edit post/page/custom post type
switch ($data['post_type']) {
case 'product':
$loadBulkText = __('On all WooCommerce "Product" pages', 'wp-asset-clean-up');
break;
case 'download':
$loadBulkText = __('On all Easy Digital Downloads "Download" pages', 'wp-asset-clean-up');
break;
default:
$loadBulkText = sprintf(__('On all pages of "<strong>%s</strong>" post type', 'wp-asset-clean-up'), $data['post_type']);
}
?>
<li id="wpacu_load_it_post_type_option_<?php echo $assetTypeS; ?>_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>">
<label><input data-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
id="wpacu_<?php echo $assetTypeS; ?>_load_it_post_type_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
class="wpacu_load_it_option_post_type wpacu_<?php echo $assetTypeS; ?> wpacu_load_exception"
type="checkbox"
<?php if ($data['row']['is_load_exception_post_type']) { ?> checked="checked" <?php } ?>
name="<?php echo WPACU_FORM_ASSETS_POST_KEY; ?>[<?php echo $assetType; ?>][<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>][load_it_post_type]"
value="1"/>
<span><?php echo wp_kses($loadBulkText, array('strong' => array())); ?></span></label>
</li>
<?php
if (isset($data['post_type']) && $data['post_type'] !== 'attachment' && ! empty($data['post_type_has_tax_assoc'])) {
include '_asset-single-row-load-exceptions-taxonomy.php';
}
}
?>
<li>
<label for="wpacu_load_it_regex_option_<?php echo $assetTypeS; ?>_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>">
<input data-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
id="wpacu_load_it_regex_option_<?php echo $assetTypeS; ?>_<?php echo $data['row']['obj']->handle; ?>"
class="wpacu_load_it_option_two wpacu_<?php echo $assetTypeS; ?> wpacu_load_exception wpacu_lite_locked"
type="checkbox"
disabled="disabled"
value="1"/>
Load it for URLs with request URI matching this RegEx(es): <a class="go-pro-link-no-style"
href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=manage_asset&utm_medium=load_exception_'.$assetTypeS.'_post_type_via_tax'); ?>"><span
class="wpacu-tooltip wpacu-larger" style="left: -26px;"><?php echo str_replace('the premium', 'the<br />premium', wp_kses(__('This feature is available in the premium version of the plugin.',
'wp-asset-clean-up' ), array('br' => array()))); ?><br/> <?php _e( 'Click here to upgrade to Pro',
'wp-asset-clean-up' ); ?>!</span><img width="20" height="20"
src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg"
valign="top" alt=""/></a> <a
style="text-decoration: none; color: inherit;" target="_blank"
href="https://assetcleanup.com/docs/?p=21#wpacu-method-2"><span
class="dashicons dashicons-editor-help"></span></a></label>
</li>
<?php
$isLoadItLoggedIn = in_array($data['row']['obj']->handle, $data['handle_load_logged_in'][$assetType]);
if ($isLoadItLoggedIn) { $data['row']['at_least_one_rule_set'] = true; }
?>
<li id="wpacu_load_it_user_logged_in_option_<?php echo $assetTypeS; ?>_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>">
<label><input data-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
id="wpacu_load_it_user_logged_in_option_<?php echo $assetTypeS; ?>_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
class="wpacu_load_it_option_three wpacu_<?php echo $assetTypeS; ?> wpacu_load_exception"
type="checkbox"
<?php if ($isLoadItLoggedIn) { ?> checked="checked" <?php } ?>
name="wpacu_load_it_logged_in[<?php echo $assetType; ?>][<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>]"
value="1"/>
<span><?php esc_html_e('If the user is logged-in', 'wp-asset-clean-up'); ?></span></label>
</li>
</ul>
<div class="wpacu_clearfix"></div>
</fieldset>
</div>
</div>

View File

@ -0,0 +1,42 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-(script|style)-single-row.php
*/
if (! isset($data)) {
exit; // no direct access
}
$assetType = $data['row']['asset_type'];
$assetTypeS = substr($data['row']['asset_type'], 0, -1); // "styles" to "style" & "scripts" to "script"
$handleNote = (isset($data['handle_notes'][$assetType][$data['row']['obj']->handle]) && $data['handle_notes'][$assetType][$data['row']['obj']->handle])
? $data['handle_notes'][$assetType][$data['row']['obj']->handle]
: false;
?>
<div class="wpacu-handle-notes">
<?php if ($assetType === 'scripts') { ?>
<?php if (! $handleNote) { ?>
<p><small>No notes have been added about this JavaScript file (e.g. why you unloaded it or decided to keep it loaded) &#10230; <a data-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>" href="#" class="wpacu-add-handle-note wpacu-for-<?php echo $assetTypeS; ?>"><span class="dashicons dashicons-welcome-write-blog"></span> <label for="wpacu_handle_note_<?php echo $assetTypeS; ?>_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>">Add Note</label></a></small></p>
<?php } else { ?>
<p><small>The following note has been added for this JavaScript file (<em>to have it removed on update, just leave the text area empty</em>):</small></p>
<?php }
} else { ?>
<?php if (! $handleNote) { ?>
<p><small>No notes have been added about this stylesheet file (e.g. why you unloaded it or decided to keep it loaded) &#10230; <a data-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>" href="#" class="wpacu-add-handle-note wpacu-for-<?php echo $assetTypeS; ?>"><span class="dashicons dashicons-welcome-write-blog"></span> <label for="wpacu_handle_note_<?php echo $assetTypeS; ?>_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>">Add Note</label></a></small></p>
<?php } else { ?>
<p><small>The following note has been added for this stylesheet file (<em>to have it removed on update, just leave the text area empty</em>):</small></p>
<?php }
} ?>
<div <?php if ($handleNote) { echo 'style="display: block;"'; } ?>
data-<?php echo $assetTypeS; ?>-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
class="wpacu-handle-notes-field">
<textarea id="wpacu_handle_note_<?php echo $assetTypeS; ?>_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
style="min-height: 45px;"
data-wpacu-adapt-height="1"
data-wpacu-is-empty-on-page-load="<?php echo (! $handleNote) ? 'true' : 'false'; ?>"
<?php if (! $handleNote) { echo 'disabled="disabled"'; } ?>
placeholder="<?php echo ($assetType === 'scripts') ? esc_attr__('Add your note here about this JavaScript file', 'wp-asset-clean-up') : esc_attr__('Add your note here about this stylesheet file', 'wp-asset-clean-up'); ?>"
name="wpacu_handle_notes[<?php echo $assetType; ?>][<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>]"><?php echo esc_textarea($handleNote); ?></textarea>
</div>
</div>

View File

@ -0,0 +1,30 @@
<?php
if ( ! isset($data, $assetHandleHasSrc) ) {
exit; // no direct access
}
$assetType = $data['row']['asset_type'];
$assetTypeS = substr($data['row']['asset_type'], 0, -1); // "styles" to "style" & "scripts" to "script"
if ($assetTypeS === 'style') {
if ($assetHandleHasSrc && isset($data['row']['obj']->position) && $data['row']['obj']->position !== '') {
$extraInfo[] = __('Position:', 'wp-asset-clean-up') . ' ' . (( $data['row']['obj']->position === 'head') ? 'HEAD' : 'BODY') . '<a class="go-pro-link-no-style" href="' . apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL . '?utm_source=manage_asset&utm_medium=change_css_position').'"><span class="wpacu-tooltip" style="width: 322px; margin-left: -146px;">Upgrade to Pro and change the location of the CSS file <br /> (e.g. to BODY to reduce render-blocking <br /> or to HEAD for very early triggering)</span><img width="20" height="20" src="' . WPACU_PLUGIN_URL . '/assets/icons/icon-lock.svg" valign="top" alt="" /> Change it?</a>';
} elseif (! $assetHandleHasSrc) {
if (isset($data['row']['obj']->extra->after) && ! empty($data['row']['obj']->extra->after)) {
$noSrcLoadedIn = __('This inline CSS can be viewed using the "Show/Hide" button below and it is loaded in:', 'wp-asset-clean-up');
} else {
$noSrcLoadedIn = __( 'This handle is not for external stylesheet (most likely inline CSS) and it is loaded in:', 'wp-asset-clean-up' );
}
$extraInfo[] = $noSrcLoadedIn . ' '. (($data['row']['obj']->position === 'head') ? 'HEAD' : 'BODY');
}
} elseif ($assetTypeS === 'script') {
if ($assetHandleHasSrc && isset($data['row']['obj']->position) && $data['row']['obj']->position !== '') {
$extraInfo[] = __( 'Position:', 'wp-asset-clean-up' ) . ' ' . ( ( $data['row']['obj']->position === 'head' ) ? 'HEAD' : 'BODY' ) . '<a class="go-pro-link-no-style" href="' . apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL . '?utm_source=manage_asset&utm_medium=change_js_position').'"><span class="wpacu-tooltip" style="width: 322px; margin-left: -146px;">Upgrade to Pro and change the location of the JS file <br /> (e.g. to BODY to reduce render-blocking <br /> or to HEAD for very early triggering)</span><img width="20" height="20" src="' . WPACU_PLUGIN_URL . '/assets/icons/icon-lock.svg" valign="top" alt="" /> Change it?</a>';
} elseif (! $assetHandleHasSrc) {
$noSrcLoadedIn = __('This handle is not for external JS (most likely inline JS) and it is loaded in:', 'wp-asset-clean-up');
$extraInfo[] = $noSrcLoadedIn . ' '. (($data['row']['obj']->position === 'head') ? 'HEAD' : 'BODY');
}
}

View File

@ -0,0 +1,58 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-(script|style)-single-row.php
*/
if (! isset($data, $isGroupUnloaded)) {
exit; // no direct access
}
$assetType = $data['row']['asset_type'];
$assetTypeS = substr($data['row']['asset_type'], 0, -1); // "styles" to "style" & "scripts" to "script"
// Bulk Unloaded Notice (e.g. for all 'post' pages, but not site-wide)
$isBulkUnloadedExceptSiteWide = ! $data['row']['global_unloaded'] && $isGroupUnloaded;
if (! $isBulkUnloadedExceptSiteWide) {
?>
<div class="wpacu_asset_options_wrap"
style="<?php
// If site-wide unloaded
if ($data['row']['global_unloaded']) {
echo 'display: none;';
}
?> padding: 8px 10px 6px !important;">
<ul class="wpacu_asset_options" <?php if ($isGroupUnloaded) { echo 'style="display: none;"'; } ?>>
<li class="wpacu_unload_this_page">
<label class="wpacu_switch">
<input data-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
data-handle-for="<?php echo $assetTypeS; ?>"
class="input-unload-on-this-page <?php if (! $isGroupUnloaded) { echo 'wpacu-not-locked'; } ?> wpacu_unload_rule_input wpacu_unload_rule_for_<?php echo $assetTypeS; ?>"
id="<?php echo $assetTypeS; ?>_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
<?php
if ($isGroupUnloaded) { echo ' disabled="disabled" '; }
echo ' '.wp_kses($data['row']['checked'], array('checked' => array())).' ';
?>
name="<?php echo WPACU_PLUGIN_ID; ?>[<?php echo $assetType; ?>][]"
type="checkbox"
value="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>" />
<span class="wpacu_slider wpacu_round"></span>
</label>
<label class="wpacu_slider_text" for="<?php echo $assetTypeS; ?>_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>">
<?php echo esc_html($data['page_unload_text']); ?>
</label>
</li>
</ul>
</div>
<?php
} else {
?>
<div style="display: block; background: inherit; border: inherit; float: none; padding: 8px 10px 6px !important;" class="wpacu_asset_options_wrap">
<p style="margin: 0 !important;">
<em><?php esc_html_e('Some unload rules are not showing up due to other bulk unload rules that are taking effect', 'wp-asset-clean-up'); ?>.</em>
<a style="text-decoration: none; color: inherit; vertical-align: middle;" target="_blank" href="https://www.assetcleanup.com/docs/?p=1421"><span class="dashicons dashicons-editor-help"></span></a>
</p>
<div class="wpacu_clearfix" style="margin-top: -5px; height: 0;"></div>
</div>
<?php
}

View File

@ -0,0 +1,69 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-(script|style)-single-row.php
*/
if (! isset($data)) {
exit; // no direct access
}
$assetType = $data['row']['asset_type'];
$assetTypeS = substr($data['row']['asset_type'], 0, -1); // "styles" to "style" & "scripts" to "script"
// Unload it if the post has a certain "Category", "Tag" or other taxonomy associated with it.
// Only show it if "Unload site-wide" is NOT enabled
// Otherwise, there's no point to use this unload rule based on the chosen taxonomy's value if the asset is unloaded site-wide
if (! $data['row']['global_unloaded']) {
?>
<div class="wpacu_asset_options_wrap wpacu_manage_via_tax_area_wrap">
<ul class="wpacu_asset_options">
<?php
if ($assetType === 'scripts') {
switch ( $data['post_type'] ) {
case 'product':
$unloadViaTaxText = __( 'Unload JS on all WooCommerce "Product" pages if these taxonomies (e.g. Category, Tag) are set', 'wp-asset-clean-up' );
break;
case 'download':
$unloadViaTaxText = __( 'Unload JS on all Easy Digital Downloads "Download" pages if these taxonomies (e.g. Category, Tag) are set', 'wp-asset-clean-up' );
break;
default:
$unloadViaTaxText = sprintf( __( 'Unload JS on all pages of "<strong>%s</strong>" post type if these taxonomies (category, tag, etc.) are set', 'wp-asset-clean-up' ), $data['post_type'] );
}
} else {
switch ( $data['post_type'] ) {
case 'product':
$unloadViaTaxText = __( 'Unload CSS on all WooCommerce "Product" pages if these taxonomies (e.g. Category, Tag) are set', 'wp-asset-clean-up' );
break;
case 'download':
$unloadViaTaxText = __( 'Unload CSS on all Easy Digital Downloads "Download" pages if these taxonomies (e.g. Category, Tag) are set', 'wp-asset-clean-up' );
break;
default:
$unloadViaTaxText = sprintf( __( 'Unload CSS on all pages of "<strong>%s</strong>" post type if these taxonomies (category, tag, etc.) are set', 'wp-asset-clean-up' ), $data['post_type'] );
}
}
?>
<li>
<label for="wpacu_unload_it_via_tax_option_<?php echo $assetTypeS; ?>_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>">
<input data-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
data-handle-for="<?php echo $assetTypeS; ?>"
id="wpacu_unload_it_via_tax_option_<?php echo $assetTypeS; ?>_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
class="wpacu_unload_it_via_tax_checkbox wpacu_unload_rule_input wpacu_bulk_unload wpacu_lite_locked"
type="checkbox"
disabled="disabled"
name="<?php echo WPACU_FORM_ASSETS_POST_KEY; ?>[styles][unload_post_type_via_tax][<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>][enable]"
value="1"/>&nbsp;<span><?php echo $unloadViaTaxText; ?>:</span></label>
<a class="go-pro-link-no-style"
href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=manage_asset&utm_medium=unload_style_post_type_via_tax'); ?>"><span
class="wpacu-tooltip wpacu-larger" style="left: -26px;"><?php echo str_replace('the premium', 'the<br />premium', wp_kses(__('This feature is available in the premium version of the plugin.',
'wp-asset-clean-up' ), array('br' => array()))); ?><br/> <?php _e( 'Click here to upgrade to Pro',
'wp-asset-clean-up' ); ?>!</span><img width="20" height="20"
src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg"
valign="top" alt=""/></a>
<a style="text-decoration: none; color: inherit; vertical-align: middle;" target="_blank"
href="https://www.assetcleanup.com/docs/?p=1415#unload"><span class="dashicons dashicons-editor-help"></span></a>
</li>
</ul>
</div>
<?php
}

View File

@ -0,0 +1,111 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-(script|style)-single-row.php
*/
if (! isset($data)) {
exit; // no direct access
}
$assetType = $data['row']['asset_type'];
$assetTypeS = substr($data['row']['asset_type'], 0, -1); // "styles" to "style" & "scripts" to "script"
if ($data['bulk_unloaded_type'] === 'post_type') {
?>
<div class="wpacu_asset_options_wrap" <?php if ($data['row']['global_unloaded']) { echo 'style="display: none;"'; } ?>>
<?php
// Unloaded On All Pages Belonging to the page's Post Type
if ($data['row']['is_post_type_unloaded']) {
if ($assetType === 'scripts') {
switch ( $data['post_type'] ) {
case 'product':
$alreadyUnloadedBulkText = __( 'This JS is unloaded on all WooCommerce "Product" pages', 'wp-asset-clean-up' );
break;
case 'download':
$alreadyUnloadedBulkText = __( 'This JS is unloaded on all Easy Digital Downloads "Download" pages', 'wp-asset-clean-up' );
break;
default:
$alreadyUnloadedBulkText = sprintf( __( 'This JS is unloaded on all <u>%s</u> post types', 'wp-asset-clean-up' ), $data['post_type'] );
}
} else {
switch ($data['post_type']) {
case 'product':
$alreadyUnloadedBulkText = __('This CSS is unloaded on all WooCommerce "Product" pages', 'wp-asset-clean-up');
break;
case 'download':
$alreadyUnloadedBulkText = __('This CSS is unloaded on all Easy Digital Downloads "Download" pages', 'wp-asset-clean-up');
break;
default:
$alreadyUnloadedBulkText = sprintf(__('This CSS is unloaded on all <u>%s</u> post types', 'wp-asset-clean-up'), $data['post_type']);
}
}
?>
<div style="margin: 0 0 4px !important;"><strong style="color: #d54e21;"><?php echo wp_kses($alreadyUnloadedBulkText, array('u' => array(), 'em' => array())); ?>.</strong></div>
<?php
}
?>
<ul class="wpacu_asset_options">
<?php
if ($data['row']['is_post_type_unloaded']) {
?>
<li>
<label><input data-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
class="wpacu_post_type_option wpacu_post_type_<?php echo $assetTypeS; ?> wpacu_keep_bulk_rule"
type="radio"
name="wpacu_options_post_type_<?php echo $assetType; ?>[<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>]"
checked="checked"
value="default"/>
<?php _e('Keep bulk rule', 'wp-asset-clean-up'); ?></label>
</li>
<li>
<label><input data-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
class="wpacu_post_type_option wpacu_post_type_<?php echo $assetTypeS; ?> wpacu_remove_bulk_rule"
type="radio"
name="wpacu_options_post_type_<?php echo $assetType; ?>[<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>]"
value="remove"/>
<?php esc_html_e('Remove bulk rule', 'wp-asset-clean-up'); ?></label>
</li>
<?php
} else {
if ($assetType === 'scripts') {
switch ( $data['post_type'] ) {
case 'product':
$unloadBulkText = esc_html__( 'Unload JS on all WooCommerce "Product" pages', 'wp-asset-clean-up' );
break;
case 'download':
$unloadBulkText = esc_html__( 'Unload JS on all Easy Digital Downloads "Download" pages', 'wp-asset-clean-up' );
break;
default:
$unloadBulkText = sprintf( __( 'Unload JS on all pages of "<strong>%s</strong>" post type', 'wp-asset-clean-up' ), $data['post_type'] );
}
} else {
switch ( $data['post_type'] ) {
case 'product':
$unloadBulkText = esc_html__( 'Unload CSS on all WooCommerce "Product" pages', 'wp-asset-clean-up' );
break;
case 'download':
$unloadBulkText = esc_html__( 'Unload CSS on all Easy Digital Downloads "Download" pages', 'wp-asset-clean-up' );
break;
default:
$unloadBulkText = sprintf( __( 'Unload CSS on all pages of "<strong>%s</strong>" post type', 'wp-asset-clean-up' ), $data['post_type'] );
}
}
?>
<li>
<label><input data-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
data-handle-for="<?php echo $assetTypeS; ?>"
class="wpacu_bulk_unload wpacu_post_type_unload wpacu_post_type_<?php echo $assetTypeS; ?> wpacu_unload_rule_input wpacu_unload_rule_for_<?php echo $assetTypeS; ?>"
id="wpacu_global_unload_post_type_<?php echo $assetTypeS; ?>_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
type="checkbox"
name="wpacu_bulk_unload_<?php echo $assetType; ?>[post_type][<?php echo esc_attr($data['post_type']); ?>][]"
value="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"/>
<?php echo wp_kses($unloadBulkText, array('strong' => array(), 'u' => array(), 'em' => array())); ?> <small>* <?php _e('bulk unload', 'wp-asset-clean-up'); ?></small></label>
</li>
<?php
}
?>
</ul>
</div>
<?php
}

View File

@ -0,0 +1,76 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-(script|style)-single-row.php
*/
if (! isset($data)) {
exit; // no direct access
}
$assetType = $data['row']['asset_type'];
$assetTypeS = substr($data['row']['asset_type'], 0, -1); // "styles" to "style" & "scripts" to "script"
?>
<div class="wpacu_asset_options_wrap">
<?php
// Unloaded Everywhere
if ($data['row']['global_unloaded']) {
if ($assetType === 'scripts') {
?>
<div style="display: inline-block; margin-right: 15px;"><strong style="color: #d54e21;"><?php _e('This JS is unloaded site-wide (everywhere)', 'wp-asset-clean-up'); ?>.</strong></div>
<?php
} else {
?>
<div style="display: inline-block; margin-right: 15px;"><strong style="color: #d54e21;"><?php _e('This CSS is unloaded site-wide (everywhere)', 'wp-asset-clean-up'); ?>.</strong></div>
<?php
}
}
?>
<ul class="wpacu_asset_options" <?php if ($data['row']['global_unloaded']) { echo 'style="display: block; margin: 10px 0;"'; } ?>>
<?php
if ($data['row']['global_unloaded']) {
?>
<li>
<label>
<input data-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
class="wpacu_bulk_option wpacu_<?php echo $assetTypeS; ?> wpacu_keep_site_wide_rule"
type="radio"
name="wpacu_options_<?php echo $assetType; ?>[<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>]"
checked="checked"
value="default" />
<?php _e('Keep site-wide rule', 'wp-asset-clean-up'); ?></label>
</li>
<li style="margin-right: 0;">
<label>
<input data-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
class="wpacu_bulk_option wpacu_<?php echo $assetTypeS; ?> wpacu_remove_site_wide_rule"
type="radio"
name="wpacu_options_<?php echo $assetType; ?>[<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>]"
value="remove" />
<?php _e('Remove site-wide rule', 'wp-asset-clean-up'); ?></label>
</li>
<?php
} else {
?>
<li>
<label><input data-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
data-handle-for="<?php echo $assetTypeS; ?>"
class="wpacu_global_unload wpacu_bulk_unload wpacu_global_<?php echo $assetTypeS; ?> wpacu_unload_rule_input wpacu_unload_rule_for_<?php echo $assetTypeS; ?>"
id="wpacu_global_unload_<?php echo $assetTypeS; ?>_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
type="checkbox"
name="wpacu_global_unload_<?php echo $assetType; ?>[]"
value="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"/>
<?php _e('Unload site-wide', 'wp-asset-clean-up'); ?> <small>* <?php _e('everywhere', 'wp-asset-clean-up'); ?></small></label>
</li>
<?php
}
?>
</ul>
<?php if ($data['row']['global_unloaded']) { ?>
<div style="margin: 7px 0 -2px 0; font-weight: 500;">
<small><span class="dashicons dashicons-warning"
style="color: inherit !important; opacity: 0.6; vertical-align: middle;"></span> <?php esc_html_e('All other unload rules (e.g. per page, RegEx) are overwritten by this site-wide rule.'); ?></small> <a style="text-decoration: none; color: inherit; vertical-align: middle;" target="_blank" href="https://www.assetcleanup.com/docs/?p=1421"><span class="dashicons dashicons-editor-help"></span></a>
</div>
<?php } ?>
</div>

View File

@ -0,0 +1,44 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-(script|style)-single-row.php
*/
if (! isset($data)) {
exit; // no direct access
}
$assetType = $data['row']['asset_type'];
$assetTypeS = substr($data['row']['asset_type'], 0, -1); // "styles" to "style" & "scripts" to "script"
// Only show it if "Unload site-wide" is NOT enabled
// Otherwise, there's no point to use an unload regex if the asset is unloaded site-wide
if (! $data['row']['global_unloaded']) {
?>
<div data-<?php echo $assetTypeS; ?>-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>" class="wpacu_asset_options_wrap wpacu_unload_regex_area_wrap">
<ul class="wpacu_asset_options">
<li>
<label for="wpacu_unload_it_regex_option_<?php echo $assetTypeS; ?>_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>">
<input data-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
data-handle-for="<?php echo $assetTypeS; ?>"
id="wpacu_unload_it_regex_option_<?php echo $assetTypeS; ?>_<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
class="wpacu_unload_it_regex_checkbox wpacu_unload_rule_input wpacu_bulk_unload"
type="checkbox"
name="wpacu_handle_unload_regex[<?php echo $assetType; ?>][<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>][enable]"
disabled="disabled"
value="1"/>&nbsp;<span>Unload it for URLs with request URI matching this RegEx(es):</span></label>
<a class="go-pro-link-no-style"
href="<?php echo apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=manage_asset&utm_medium=unload_'.$assetTypeS.'_by_regex'); ?>"><span
class="wpacu-tooltip wpacu-larger" style="left: -26px;"><?php echo str_replace('the premium', 'the<br />premium', wp_kses(__('This feature is available in the premium version of the plugin.',
'wp-asset-clean-up' ), array('br' => array()))); ?><br/> <?php _e( 'Click here to upgrade to Pro',
'wp-asset-clean-up' ); ?>!</span><img width="20" height="20"
src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-lock.svg"
valign="top" alt=""/></a>
<a style="text-decoration: none; color: inherit; vertical-align: middle;" target="_blank"
href="https://assetcleanup.com/docs/?p=313#wpacu-unload-by-regex"><span
class="dashicons dashicons-editor-help"></span></a>
</li>
</ul>
</div>
<?php
}

View File

@ -0,0 +1,33 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-(style|script)-single-row-hardcoded.php
*/
if (! isset($data)) {
exit; // no direct access
}
$assetType = $data['row']['asset_type'];
$assetTypeS = substr($data['row']['asset_type'], 0, -1); // "styles" to "style" & "scripts" to "script"
?>
<div class="wpacu_asset_options_wrap"
style="padding: 8px 10px 6px !important;">
<ul class="wpacu_asset_options">
<li class="wpacu_unload_this_page">
<label class="wpacu_switch wpacu_disabled wpacu-manage-hardcoded-assets-requires-pro-popup">
<input data-handle="<?php echo esc_attr($data['row']['obj']->handle); ?>"
data-handle-for="<?php echo $assetTypeS; ?>"
class="input-unload-on-this-page wpacu-not-locked wpacu_unload_rule_input wpacu_unload_rule_for_<?php echo $assetTypeS; ?>"
id="script_<?php echo esc_attr($data['row']['obj']->handle); ?>"
disabled="disabled"
name="<?php echo WPACU_PLUGIN_ID; ?>[<?php echo $assetType; ?>][]"
type="checkbox"
value="<?php echo esc_attr($data['row']['obj']->handle); ?>" />
<span class="wpacu_slider wpacu_round"></span>
</label>
<label class="wpacu_slider_text wpacu-manage-hardcoded-assets-requires-pro-popup" for="<?php echo $assetTypeS; ?>_<?php echo esc_attr($data['row']['obj']->handle); ?>">
<?php echo esc_html($data['page_unload_text']); ?>
</label>
</li>
</ul>
</div>

View File

@ -0,0 +1,54 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-(script|style)-single-row.php
*/
if (! isset($data)) {
exit; // no direct access
}
$assetType = $data['row']['asset_type'];
$assetTypeS = substr($data['row']['asset_type'], 0, -1); // "styles" to "style" & "scripts" to "script"
// Unload it if the post has a certain "Category", "Tag" or other taxonomy associated with it.
// Only show it if "Unload site-wide" is NOT enabled
// Otherwise, there's no point to use this unload rule based on the chosen taxonomy's value if the asset is unloaded site-wide
?>
<div class="wpacu_asset_options_wrap wpacu_manage_via_tax_area_wrap">
<ul class="wpacu_asset_options">
<?php
if ($assetType === 'scripts') {
switch ( $data['post_type'] ) {
case 'product':
$unloadViaTaxText = __( 'Unload JS on all WooCommerce "Product" pages if these taxonomies (e.g. Category, Tag) are set', 'wp-asset-clean-up' );
break;
case 'download':
$unloadViaTaxText = __( 'Unload JS on all Easy Digital Downloads "Download" pages if these taxonomies (e.g. Category, Tag) are set', 'wp-asset-clean-up' );
break;
default:
$unloadViaTaxText = sprintf( __( 'Unload JS on all pages of "<strong>%s</strong>" post type if these taxonomies (category, tag, etc.) are set', 'wp-asset-clean-up' ), $data['post_type'] );
}
} else {
switch ( $data['post_type'] ) {
case 'product':
$unloadViaTaxText = __( 'Unload CSS on all WooCommerce "Product" pages if these taxonomies (e.g. Category, Tag) are set', 'wp-asset-clean-up' );
break;
case 'download':
$unloadViaTaxText = __( 'Unload CSS on all Easy Digital Downloads "Download" pages if these taxonomies (e.g. Category, Tag) are set', 'wp-asset-clean-up' );
break;
default:
$unloadViaTaxText = sprintf( __( 'Unload CSS on all pages of "<strong>%s</strong>" post type if these taxonomies (category, tag, etc.) are set', 'wp-asset-clean-up' ), $data['post_type'] );
}
}
?>
<li>
<label class="wpacu-manage-hardcoded-assets-requires-pro-popup">
<span style="color: #ccc;" class="wpacu-manage-hardcoded-assets-requires-pro-popup dashicons dashicons-lock"></span>
<?php echo wp_kses($unloadViaTaxText, array('strong' => array())); ?></label>
<a style="text-decoration: none; color: inherit; vertical-align: middle;" target="_blank"
href="https://www.assetcleanup.com/docs/?p=1415#unload"><span
class="dashicons dashicons-editor-help"></span></a>
</li>
</ul>
</div>

View File

@ -0,0 +1,61 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-(style|script)-single-row-hardcoded.php
*/
if (! isset($data)) {
exit; // no direct access
}
$assetType = $data['row']['asset_type'];
if (isset($data['bulk_unloaded_type']) && $data['bulk_unloaded_type'] === 'post_type') {
if ($assetType === 'styles') {
?>
<div class="wpacu_asset_options_wrap">
<ul class="wpacu_asset_options">
<?php
switch ($data['post_type']) {
case 'product':
$unloadBulkText = __('Unload CSS on all WooCommerce "Product" pages', 'wp-asset-clean-up');
break;
case 'download':
$unloadBulkText = __('Unload CSS on all Easy Digital Downloads "Download" pages', 'wp-asset-clean-up');
break;
default:
$unloadBulkText = sprintf(__('Unload CSS on all pages of "<strong>%s</strong>" post type', 'wp-asset-clean-up'), $data['post_type']);
}
?>
<li>
<label class="wpacu-manage-hardcoded-assets-requires-pro-popup">
<span style="color: #ccc;" class="wpacu-manage-hardcoded-assets-requires-pro-popup dashicons dashicons-lock"></span>
<?php echo wp_kses($unloadBulkText, array('strong' => array(), 'em' => array(), 'u' => array())); ?></label>
</li>
</ul>
</div>
<?php
} elseif ($assetType === 'scripts') {
?>
<div class="wpacu_asset_options_wrap">
<ul class="wpacu_asset_options">
<?php
switch ($data['post_type']) {
case 'product':
$unloadBulkText = __('Unload JS on all WooCommerce "Product" pages', 'wp-asset-clean-up');
break;
case 'download':
$unloadBulkText = __('Unload JS on all Easy Digital Downloads "Download" pages', 'wp-asset-clean-up');
break;
default:
$unloadBulkText = sprintf(__('Unload JS on all pages of "<strong>%s</strong>" post type', 'wp-asset-clean-up'), $data['post_type']);
}
?>
<li>
<label class="wpacu-manage-hardcoded-assets-requires-pro-popup">
<span style="color: #ccc;" class="wpacu-manage-hardcoded-assets-requires-pro-popup dashicons dashicons-lock"></span>
<?php echo wp_kses($unloadBulkText, array('strong' => array())); ?></label>
</li>
</ul>
</div>
<?php
}
}

View File

@ -0,0 +1,18 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-(style|script)-single-row-hardcoded.php
*/
if (! isset($data)) {
exit; // no direct access
}
?>
<div class="wpacu_asset_options_wrap">
<ul class="wpacu_asset_options">
<li>
<label class="wpacu-manage-hardcoded-assets-requires-pro-popup">
<span style="color: #ccc;" class="wpacu-manage-hardcoded-assets-requires-pro-popup dashicons dashicons-lock"></span>
<?php _e('Unload site-wide', 'wp-asset-clean-up'); ?> <small>* <?php _e('everywhere', 'wp-asset-clean-up'); ?></small>
</label>
</li>
</ul>
</div>

View File

@ -0,0 +1,28 @@
<?php
/*
* The file is included from /templates/meta-box-loaded-assets/_asset-(style|script)-single-row-hardcoded.php
*/
if (! isset($data)) {
exit; // no direct access
}
$assetType = $data['row']['asset_type'];
$assetTypeS = substr($data['row']['asset_type'], 0, -1); // "styles" to "style" & "scripts" to "script"
?>
<div class="wpacu_asset_options_wrap wpacu_unload_regex_area_wrap">
<ul class="wpacu_asset_options">
<li>
<label class="wpacu-manage-hardcoded-assets-requires-pro-popup"
for="wpacu_unload_it_regex_option_<?php echo $assetTypeS; ?>_<?php echo esc_attr($data['row']['obj']->handle); ?>">
<span style="color: #ccc;" class="wpacu-manage-hardcoded-assets-requires-pro-popup dashicons dashicons-lock"></span>
<?php
$assetTypeText = ($assetType === 'styles') ? 'CSS' : 'JS';
echo sprintf(__('Unload %s for URLs with request URI matching the following RegEx(es)', 'wp-asset-clean-up'), $assetTypeText);
?>:
</label>
<a style="text-decoration: none; color: inherit; vertical-align: middle;" target="_blank"
href="https://assetcleanup.com/docs/?p=313#wpacu-unload-by-regex"><span
class="dashicons dashicons-editor-help"></span></a>
</li>
</ul>
</div>

View File

@ -0,0 +1,142 @@
<?php
/*
* The file is included from _assets-hardcoded-list.php, and it's relevant only for the hardcoded scripts (non-enqueued)
*/
if (! isset($data)) {
exit; // no direct access
}
$rowIsContracted = '';
$dashSign = 'minus';
$dataRowStatusAttr = 'expanded';
if (isset($data['handle_rows_contracted']['scripts'][$data['row']['obj']->handle]) && $data['handle_rows_contracted']['scripts'][$data['row']['obj']->handle]) {
$rowIsContracted = 1;
$dashSign = 'plus';
$dataRowStatusAttr = 'contracted';
}
?>
<tr data-script-handle-row="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
data-is-hardcoded-asset="true"
class="wpacu_asset_row">
<td style="position: relative;" data-wpacu-row-status="<?php echo esc_attr($dataRowStatusAttr); ?>">
<div class="wpacu_handle_row_expand_contract_area">
<a data-wpacu-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
data-wpacu-handle-for="script"
class="wpacu_handle_row_expand_contract"
href="#"><span class="dashicons dashicons-<?php echo esc_attr($dashSign); ?>"></span></a>
<!-- -->
</div>
<?php
$insideIeCommentHtml = '<span class="wpacu_inside_cond_comm"><img style="vertical-align: middle;" width="25" height="25" src="'.WPACU_PLUGIN_URL.'/assets/icons/icon-ie.svg" alt="" title="Microsoft / Public domain" />&nbsp;<span style="font-weight: 400; color: #1C87CF;">Loads only in Internet Explorer based on the following condition:</span> <em>if '.esc_html($data['row']['obj']->inside_conditional_comment).'</em></span>';
if (isset($data['row']['obj']->src) && trim($data['row']['obj']->src)) {
// Source
include dirname(__DIR__).'/_common/_asset-single-row-hardcoded-source.php';
?>
<div class="wpacu_file_size_area">File Size: <?php echo apply_filters('wpacu_get_asset_file_size', $data['row']['obj'], 'for_print'); ?></div>
<?php
if ($data['row']['obj']->inside_conditional_comment) {
echo \WpAssetCleanUp\Misc::stripIrrelevantHtmlTags($insideIeCommentHtml);
}
?>
<div class="wpacu_hardcoded_part_if_expanded">
<div class="wpacu-hardcoded-code-area">
HTML Output: <code><?php echo htmlentities( $data['row']['obj']->tag_output ); ?></code>
</div>
</div>
<?php
} else {
// SCRIPT inline tag
$tagOutput = trim($data['row']['obj']->tag_output);
// default values (could be changed below)
$totalCodeLines = 1;
$enableViewMore = false;
if (strpos($tagOutput, "\n") !== false) {
$totalCodeLines = count(explode("\n", $tagOutput));
if ($totalCodeLines > 18) {
$enableViewMore = true;
}
}
if (strlen($tagOutput) > 600) {
$enableViewMore = true;
}
?>
<div class="wpacu-hardcoded-code-area">
<?php
if ($tagBelongsTo = \WpAssetCleanUp\HardcodedAssets::belongsTo($data['row']['obj']->tag_output)) {
echo '<div style="margin-bottom: 10px;">'.__('Belongs to', 'wp-asset-clean-up').': <strong>'.$tagBelongsTo . '</strong></div>';
}
if ($data['row']['obj']->inside_conditional_comment) {
echo \WpAssetCleanUp\Misc::stripIrrelevantHtmlTags($insideIeCommentHtml);
}
?>
<div class="wpacu_hardcoded_part_if_expanded <?php if ($enableViewMore) { ?>wpacu-has-view-more<?php } ?>">
<div>
<pre><code><?php echo htmlentities( $data['row']['obj']->tag_output ); ?></code></pre>
</div>
<?php if ($enableViewMore) {
$wpacuViewMoreCodeBtnClass = ! is_admin() ? 'wpacu-view-more-code' : 'button';
?>
<p class="wpacu-view-more-link-area" style="margin: 0 !important; padding: 15px !important;"><a href="#" class="<?php echo esc_attr($wpacuViewMoreCodeBtnClass); ?>"><?php _e('View more', 'wp-asset-clean-up'); ?></a></p>
<?php } ?>
</div>
<div class="wpacu_hardcoded_part_if_contracted">
<code>
<?php
if (strlen($data['row']['obj']->tag_output) > 100) {
$tagOutputPart = substr( $data['row']['obj']->tag_output, 0, 100 ). '...';
} else {
$tagOutputPart = $data['row']['obj']->tag_output;
}
echo htmlentities($tagOutputPart);
?>
</code>
</div>
</div>
<?php
}
?>
<div class="wpacu_handle_row_expanded_area <?php if ($rowIsContracted) { echo 'wpacu_hide'; } ?>">
<div class="wrap_bulk_unload_options">
<?php
// Unload on this page
include dirname(__DIR__).'/_common_lite_locked/_asset-single-row-hardcoded-unload-per-page.php';
// Unload site-wide (everywhere)
include dirname(__DIR__).'/_common_lite_locked/_asset-single-row-hardcoded-unload-site-wide.php';
// Unload on all pages of [post] post type (if applicable)
include dirname(__DIR__).'/_common_lite_locked/_asset-single-row-hardcoded-unload-post-type.php';
// Unload on all pages where this [post] post type has a certain taxonomy set for it (e.g. a Tag or a Category) (if applicable)
// There has to be at least a taxonomy created for this [post] post type in order to show this option
if (isset($data['post_type']) && $data['post_type'] !== 'attachment' && ! empty($data['post_type_has_tax_assoc'])) {
include dirname( __DIR__ ) . '/_common_lite_locked/_asset-single-row-hardcoded-unload-post-type-taxonomy.php';
}
// Unload via RegEx (if site-wide is not already chosen)
include dirname(__DIR__).'/_common_lite_locked/_asset-single-row-hardcoded-unload-via-regex.php';
do_action('wpacu_pro_bulk_unload_output', $data, $data['row']['obj'], 'js');
?>
<div class="wpacu_clearfix"></div>
</div>
<?php
// Handle Note
include dirname(__DIR__).'/_common/_asset-single-row-notes.php';
?>
</div>
<img style="display: none;"
class="wpacu_ajax_loader"
src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-ajax-loading-spinner.svg" alt="<?php echo esc_html_e('Loading'); ?>..." />
</td>
</tr>

View File

@ -0,0 +1,150 @@
<?php
/*
* The file is included from _assets-hardcoded-list.php and it's relevant only for the hardcoded styles (non-enqueued)
*/
if (! isset($data)) {
exit; // no direct access
}
$rowIsContracted = '';
$dashSign = 'minus';
$dataRowStatusAttr = 'expanded';
if (isset($data['handle_rows_contracted']['styles'][$data['row']['obj']->handle]) && $data['handle_rows_contracted']['styles'][$data['row']['obj']->handle]) {
$rowIsContracted = 1;
$dashSign = 'plus';
$dataRowStatusAttr = 'contracted';
}
?>
<tr data-style-handle-row="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
data-is-hardcoded-asset="true"
class="wpacu_asset_row">
<td style="position: relative;" data-wpacu-row-status="<?php echo esc_attr($dataRowStatusAttr); ?>">
<div class="wpacu_handle_row_expand_contract_area">
<a data-wpacu-handle="<?php echo htmlentities(esc_attr($data['row']['obj']->handle), ENT_QUOTES); ?>"
data-wpacu-handle-for="style"
class="wpacu_handle_row_expand_contract"
href="#"><span class="dashicons dashicons-<?php echo esc_attr($dashSign); ?>"></span></a>
<!-- -->
</div>
<?php
$insideIeCommentHtml = '<span class="wpacu_inside_cond_comm"><img style="vertical-align: middle;" width="25" height="25" src="'.WPACU_PLUGIN_URL.'/assets/icons/icon-ie.svg" alt="" title="Microsoft / Public domain" />&nbsp;<span style="font-weight: 400; color: #1C87CF;">Loads only in Internet Explorer based on the following condition:</span> <em>if '.$data['row']['obj']->inside_conditional_comment.'</em></span>';
if (isset($data['row']['obj']->src) && trim($data['row']['obj']->src)) {
// Source
include dirname(__DIR__).'/_common/_asset-single-row-hardcoded-source.php';
?>
<div class="wpacu_file_size_area">File Size: <?php echo apply_filters('wpacu_get_asset_file_size', $data['row']['obj'], 'for_print'); ?></div>
<?php
if ($data['row']['obj']->inside_conditional_comment) {
echo \WpAssetCleanUp\Misc::stripIrrelevantHtmlTags($insideIeCommentHtml);
}
?>
<div class="wpacu_hardcoded_part_if_expanded">
<div style="margin: 10px 0;" class="wpacu-hardcoded-code-area">
HTML Output: <code><?php echo htmlentities( $data['row']['obj']->tag_output ); ?></code>
</div>
</div>
<?php
} else {
// STYLE inline tag
$tagOutput = trim($data['row']['obj']->tag_output);
// default values (could be changed below)
$totalCodeLines = 1;
$enableViewMore = false;
if (strpos($tagOutput, "\n") !== false) {
$totalCodeLines = count(explode("\n", $tagOutput));
if ($totalCodeLines > 18) {
$enableViewMore = true;
}
}
if (strlen($tagOutput) > 600) {
$enableViewMore = true;
}
?>
<div class="wpacu-hardcoded-code-area">
<?php
if ($tagBelongsTo = \WpAssetCleanUp\HardcodedAssets::belongsTo($data['row']['obj']->tag_output)) {
echo '<div style="margin-bottom: 10px;">'.esc_html__('Belongs to', 'wp-asset-clean-up').': <strong>'.$tagBelongsTo . '</strong></div>';
}
if ($data['row']['obj']->inside_conditional_comment) {
echo \WpAssetCleanUp\Misc::stripIrrelevantHtmlTags($insideIeCommentHtml);
}
?>
<div class="wpacu_hardcoded_part_if_expanded <?php if ($enableViewMore) { ?>wpacu-has-view-more<?php } ?>">
<div>
<pre><code><?php echo htmlentities( $data['row']['obj']->tag_output ); ?></code></pre>
</div>
<?php if ($enableViewMore) {
$wpacuViewMoreCodeBtnClass = ! is_admin() ? 'wpacu-view-more-code' : 'button';
?>
<p class="wpacu-view-more-link-area" style="margin: 0 !important; padding: 15px !important;"><a href="#" class="<?php echo esc_attr($wpacuViewMoreCodeBtnClass); ?>"><?php esc_html_e('View more', 'wp-asset-clean-up'); ?></a></p>
<?php } ?>
</div>
<div class="wpacu_hardcoded_part_if_contracted">
<code>
<?php
if (strlen($data['row']['obj']->tag_output) > 100) {
$tagOutputPart = substr( $data['row']['obj']->tag_output, 0, 100 ). '...';
} else {
$tagOutputPart = $data['row']['obj']->tag_output;
}
echo htmlentities($tagOutputPart);
?>
</code>
</div>
</div>
<?php
}
?>
<div class="wpacu_handle_row_expanded_area <?php if ($rowIsContracted) { echo 'wpacu_hide'; } ?>">
<div class="wrap_bulk_unload_options">
<?php
$tagType = '';
if (isset($data['row']['obj']->tag_output)) {
$tagType = ( strpos( $data['row']['obj']->tag_output, '<link' ) !== false ) ? 'LINK' : 'STYLE';
}
// Unload on this page
include dirname(__DIR__).'/_common_lite_locked/_asset-single-row-hardcoded-unload-per-page.php';
// Unload site-wide (everywhere)
include dirname(__DIR__).'/_common_lite_locked/_asset-single-row-hardcoded-unload-site-wide.php';
// Unload on all pages of [post] post type (if applicable)
include dirname(__DIR__).'/_common_lite_locked/_asset-single-row-hardcoded-unload-post-type.php';
// Unload on all pages where this [post] post type has a certain taxonomy set for it (e.g. a Tag or a Category) (if applicable)
// There has to be at least a taxonomy created for this [post] post type in order to show this option
if (isset($data['post_type']) && $data['post_type'] !== 'attachment' && ! empty($data['post_type_has_tax_assoc'])) {
// Unload on all pages where this [post] post type has a certain taxonomy set for it (e.g. a Tag or a Category) (if applicable)
include dirname( __DIR__ ) . '/_common_lite_locked/_asset-single-row-hardcoded-unload-post-type-taxonomy.php';
}
// Unload via RegEx (if site-wide is not already chosen)
include dirname(__DIR__).'/_common_lite_locked/_asset-single-row-hardcoded-unload-via-regex.php';
do_action('wpacu_pro_bulk_unload_output', $data, $data['row']['obj'], 'css');
?>
<div class="wpacu_clearfix"></div>
</div>
<?php
// Handle Note
include dirname(__DIR__).'/_common/_asset-single-row-notes.php';
?>
</div>
<img style="display: none;"
class="wpacu_ajax_loader"
src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-ajax-loading-spinner.svg" alt="<?php echo esc_html__('Loading'); ?>..." />
</td>
</tr>

View File

@ -0,0 +1,250 @@
<?php
// no direct access
if (! isset($data)) {
exit;
}
?>
<script type="text/javascript" data-wpacu-own-inline-script="true">
var wpacuContentLinks = document.getElementsByClassName('wpacu-assets-collapsible'),
wpacuInlineCodeContentLinks = document.getElementsByClassName('wpacu-assets-inline-code-collapsible'),
wpacuPluginToggleWrapLinks = document.getElementsByClassName('wpacu-plugin-contracted-wrap-link'),
wpacuI, wpacuITwo, wpacuIThree;
// "Styles" & "Scripts" main areas
for (wpacuI = 0; wpacuI < wpacuContentLinks.length; wpacuI++) {
wpacuContentLinks[wpacuI].addEventListener('click', function (e) {
e.preventDefault();
this.classList.toggle('wpacu-assets-collapsible-active');
var assetsListContent = this.nextElementSibling;
if (assetsListContent.style.maxHeight) {
assetsListContent.style.maxHeight = null;
} else {
//assetsListContent.style.maxHeight = assetsListContent.scrollHeight + "px";
assetsListContent.style.maxHeight = 'inherit';
}
});
}
// Inline code associated with the handle (expand)
for (wpacuITwo = 0; wpacuITwo < wpacuInlineCodeContentLinks.length; wpacuITwo++) {
wpacuInlineCodeContentLinks[wpacuITwo].addEventListener('click', function (e) {
e.preventDefault();
this.classList.toggle('wpacu-assets-inline-code-collapsible-active');
var assetInlineCodeContent = this.nextElementSibling;
assetInlineCodeContent = assetInlineCodeContent.nextElementSibling;
if (assetInlineCodeContent.style.maxHeight) {
assetInlineCodeContent.style.maxHeight = null;
} else {
assetInlineCodeContent.style.maxHeight = assetInlineCodeContent.scrollHeight + 'px';
}
});
}
for (wpacuIThree = 0; wpacuIThree < wpacuPluginToggleWrapLinks.length; wpacuIThree++) {
wpacuPluginToggleWrapLinks[wpacuIThree].addEventListener('click', function (e) {
e.preventDefault();
var wpacuNext = this.nextElementSibling;
if (this.classList.contains('wpacu-link-closed')) {
// Change Link Class
this.classList.remove('wpacu-link-closed');
this.classList.add('wpacu-link-open');
// Change Target Content Class
wpacuNext.classList.remove('wpacu-area-closed');
wpacuNext.classList.add('wpacu-area-open');
} else {
// Change Link Class
this.classList.remove('wpacu-link-open');
this.classList.add('wpacu-link-closed');
// Change Target Content Class
wpacuNext.classList.remove('wpacu-area-open');
wpacuNext.classList.add('wpacu-area-closed');
}
});
}
// Check if the contract / expand buttons exist (e.g. in view-default.php)
var $wpacuContractAllBtn = document.getElementById('wpacu-assets-contract-all'),
$wpacuExpandAllBtn = document.getElementById('wpacu-assets-expand-all');
if (typeof($wpacuContractAllBtn) != 'undefined' && $wpacuContractAllBtn != null) {
$wpacuContractAllBtn.addEventListener('click', function (e) {
e.preventDefault();
wpacuContractAllMainAreas();
});
}
if (typeof($wpacuExpandAllBtn) != 'undefined' && $wpacuExpandAllBtn != null) {
$wpacuExpandAllBtn.addEventListener('click', function (e) {
e.preventDefault();
wpacuExpandAllMainAreas();
});
}
function wpacuExpandAllMainAreas() {
var wpacuI, assetsListContent, wpacuContentLinks = document.getElementsByClassName('wpacu-assets-collapsible');
for (wpacuI = 0; wpacuI < wpacuContentLinks.length; wpacuI++) {
wpacuContentLinks[wpacuI].classList.add('wpacu-assets-collapsible-active');
assetsListContent = wpacuContentLinks[wpacuI].nextElementSibling;
//assetsListContent.style.maxHeight = assetsListContent.scrollHeight + 'px';
assetsListContent.style.maxHeight = 'inherit';
assetsListContent.classList.remove('wpacu-open');
}
}
function wpacuContractAllMainAreas() {
var wpacuI, assetsListContent, wpacuContentLinks = document.getElementsByClassName('wpacu-assets-collapsible');
for (wpacuI = 0; wpacuI < wpacuContentLinks.length; wpacuI++) {
wpacuContentLinks[wpacuI].classList.remove('wpacu-assets-collapsible-active');
assetsListContent = wpacuContentLinks[wpacuI].nextElementSibling;
assetsListContent.style.maxHeight = null;
}
}
function wpacuExpandAllInlineCodeAreas()
{
var wpacuIE,
assetInlineCodeContent,
wpacuInlineCodeContentLinks = document.getElementsByClassName('wpacu-assets-inline-code-collapsible');
for (wpacuIE = 0; wpacuIE < wpacuInlineCodeContentLinks.length; wpacuIE++) {
wpacuInlineCodeContentLinks[wpacuIE].classList.add('wpacu-assets-inline-code-collapsible-active');
assetInlineCodeContent = wpacuInlineCodeContentLinks[wpacuIE].nextElementSibling;
assetInlineCodeContent.style.maxHeight = assetInlineCodeContent.scrollHeight + 'px';
assetInlineCodeContent.classList.remove('wpacu-open');
}
}
<?php
// "Styles" and "Scripts"
if ($data['plugin_settings']['assets_list_layout_areas_status'] === 'contracted') {
?>
wpacuContractAllMainAreas();
<?php
} else {
?>
// Remove 'wpacu-open' and set the right max-height to ensure the click action below will work smoothly
wpacuExpandAllMainAreas();
<?php
}
// "Inline code associated with the handle" - Expand all
if ($data['plugin_settings']['assets_list_inline_code_status'] !== 'contracted') {
?>
wpacuExpandAllInlineCodeAreas();
<?php
}
?>
/* Source: http://bdadam.com/blog/automatically-adapting-the-height-textarea.html */
(function() {
function wpacuAdjustTextareaHeight(el, minHeight) {
// compute the height difference which is caused by border and outline
var outerHeight = parseInt(window.getComputedStyle(el).height, 10);
var diff = outerHeight - el.clientHeight;
// set the height to 0 in case of it has to be shrinked
el.style.height = 0;
// set the correct height
// el.scrollHeight is the full height of the content, not just the visible part
el.style.height = Math.max(minHeight, el.scrollHeight + diff) + 'px';
}
// We use the "data-wpacu-adapt-height" attribute as a marker
var wpacuTextAreas = [].slice.call(document.querySelectorAll('textarea[data-wpacu-adapt-height="1"]'));
// Iterate through all the textareas on the page
wpacuTextAreas.forEach(function(el) {
// we need box-sizing: border-box, if the textarea has padding
el.style.boxSizing = el.style.mozBoxSizing = 'border-box';
// we don't need any scrollbars, do we? :)
el.style.overflowY = 'hidden';
// the minimum height initiated through the "rows" attribute
var minHeight = el.scrollHeight;
el.addEventListener('input', function() {
wpacuAdjustTextareaHeight(el, minHeight);
});
// we have to readjust when window size changes (e.g. orientation change)
window.addEventListener('resize', function() {
wpacuAdjustTextareaHeight(el, minHeight);
});
// we adjust height to the initial content
wpacuAdjustTextareaHeight(el, minHeight);
});
}());
/* For Hardcoded Assets List */
jQuery(document).ready(function($) {
var $wpacuEl, $wpacuP, $wpacuUp, $wpacuPs, wpacuTotalHeight;
$(document).on('click', '.wpacu-has-view-more > p.wpacu-view-more-link-area > a', function (e) {
e.preventDefault();
//console.log('View more click...');
wpacuTotalHeight = 0;
$wpacuEl = $(this);
$wpacuP = $wpacuEl.parent();
$wpacuUp = $wpacuP.parent();
$wpacuPs = $wpacuUp.find('div');
// Measure how tall inside should be by adding together heights of all inside elements (except read-more)
$wpacuPs.each(function () {
wpacuTotalHeight += jQuery(this).outerHeight();
});
$wpacuUp.css({
// Set height to prevent instant jumpdown when max height is removed
'height': $wpacuUp.height(),
'max-height': 9999
}).animate({
'height': wpacuTotalHeight
}, function () {
$wpacuUp.css({'height': 'auto'});
});
// Fade out read-more
$wpacuP.fadeOut();
// Prevent jump-down
return false;
});
});
<?php
// [wpacu_lite]
if (! is_admin()) {
// Admin manages the list in the front-end view
$upgradeToProLink = apply_filters('wpacu_go_pro_affiliate_link', WPACU_PLUGIN_GO_PRO_URL.'?utm_source=manage_hardcoded_assets&utm_medium=go_pro_frontend');
?>
var wpacuElGoPro = document.getElementsByClassName('wpacu-manage-hardcoded-assets-requires-pro-popup');
for (var wpacuII = 0; wpacuII < wpacuElGoPro.length; wpacuII++) {
// Here we have the same onclick
wpacuElGoPro.item(wpacuII).onclick = function() {
window.location.replace('<?php echo esc_js($upgradeToProLink); ?>');
};
}
<?php
}
// [/wpacu_lite]
?>
</script>

View File

@ -0,0 +1,73 @@
<?php
if (! isset($data)) {
exit; // no direct access
}
$cssUlStyle = (isset($data['is_frontend_view']) && $data['is_frontend_view']) ? 'style="list-style: none; margin-left: 10px;"' : '';
?>
<p>If you have reasons to prevent certain functionality of the plugin on this page, you can use the options below. For instance, you found out that combining CSS files on this page is not working well and you want to disable it. Moreover, if <?php echo WPACU_PLUGIN_TITLE; ?> is not working well for this page (e.g. it's in conflict with another plugin) and you want to avoid loading it, you can choose to do that as well.</p>
<ul id="wpacu-page-options-ul" <?php echo wp_kses($cssUlStyle, array('style' => array())); ?>>
<li>
<label for="wpacu_page_options_no_css_minify">
<input type="checkbox"
<?php if (isset($data['page_options']['no_css_minify']) && $data['page_options']['no_css_minify']) { echo 'checked="checked"'; } ?>
id="wpacu_page_options_no_css_minify"
name="<?php echo WPACU_PLUGIN_ID; ?>_page_options[no_css_minify]"
value="1" />&nbsp;<span><?php _e('Do not minify CSS files on this page', 'wp-asset-clean-up'); ?></span>
</label>
</li>
<li>
<label for="wpacu_page_options_no_css_optimize">
<input type="checkbox"
<?php if (isset($data['page_options']['no_css_optimize']) && $data['page_options']['no_css_optimize']) { echo 'checked="checked"'; } ?>
id="wpacu_page_options_no_css_optimize"
name="<?php echo WPACU_PLUGIN_ID; ?>_page_options[no_css_optimize]"
value="1" />&nbsp;<span><?php _e('Do not combine CSS files on this page', 'wp-asset-clean-up'); ?></span>
</label>
</li>
<li>
<label for="wpacu_page_options_no_js_minify">
<input type="checkbox"
<?php if (isset($data['page_options']['no_js_minify']) && $data['page_options']['no_js_minify']) { echo 'checked="checked"'; } ?>
id="wpacu_page_options_no_js_minify"
name="<?php echo WPACU_PLUGIN_ID; ?>_page_options[no_js_minify]"
value="1" />&nbsp;<span><?php _e('Do not minify JS files on this page', 'wp-asset-clean-up'); ?></span>
</label>
</li>
<li>
<label for="wpacu_page_options_no_js_optimize">
<input type="checkbox"
<?php if (isset($data['page_options']['no_js_optimize']) && $data['page_options']['no_js_optimize']) { echo 'checked="checked"'; } ?>
id="wpacu_page_options_no_js_optimize"
name="<?php echo WPACU_PLUGIN_ID; ?>_page_options[no_js_optimize]"
value="1" />&nbsp;<span><?php _e('Do not combine JS files on this page', 'wp-asset-clean-up'); ?></span>
</label>
</li>
<li>
<label for="wpacu_page_options_no_assets_settings">
<input type="checkbox"
<?php if (isset($data['page_options']['no_assets_settings']) && $data['page_options']['no_assets_settings']) { echo 'checked="checked"'; } ?>
id="wpacu_page_options_no_assets_settings"
name="<?php echo WPACU_PLUGIN_ID; ?>_page_options[no_assets_settings]"
value="1" />&nbsp;<span><?php _e('Do not apply any front-end optimization on this page (this includes any changes related to CSS/JS files)', 'wp-asset-clean-up'); ?></span>
</label>
</li>
<li>
<label for="wpacu_page_options_no_wpacu_load">
<input type="checkbox"
<?php if (isset($data['page_options']['no_wpacu_load']) && $data['page_options']['no_wpacu_load']) { echo 'checked="checked"'; } ?>
id="wpacu_page_options_no_wpacu_load"
name="<?php echo WPACU_PLUGIN_ID; ?>_page_options[no_wpacu_load]"
value="1" />&nbsp;<span><?php echo sprintf(esc_html__('Do not load %s on this page (this will disable any functionality of the plugin)', 'wp-asset-clean-up'), WPACU_PLUGIN_TITLE); ?></span>
</label>
</li>
</ul>
<hr/>
<p style="margin-top: 10px;">
<strong><span style="color: #82878c;" class="dashicons dashicons-lightbulb"></span></strong>
<?php echo sprintf(esc_html__('If you are not sure how these options work, you can %sread more about them%s in the documentation.', 'wp-asset-clean-up'), '<a target="_blank" href="https://www.assetcleanup.com/docs/?p=1318">', '</a>'); ?>
</p>
<input type="hidden" name="wpacu_page_options_area_loaded" value="1" />

View File

@ -0,0 +1,53 @@
<?php
if (! isset($data)) {
exit; // no direct access
}
if ( ! (isset($data['show_page_options']) && $data['show_page_options']) ) {
return;
}
// This one shows when there are matches for the targeted page in "Settings" -> "Plugin Usage Preferences" -> "Do not load the plugin on certain pages"
// or via "Do not load Asset CleanUp Pro on this page (this will disable any functionality of the plugin)"
if (isset($data['page_options_with_assets_manager_no_load']) && $data['page_options_with_assets_manager_no_load']) {
?>
<style>
.wpacu-page-options a.wpacu-assets-collapsible {
cursor: default;
}
.wpacu-page-options a.wpacu-assets-collapsible.wpacu-assets-collapsible-active:after {
content: '';
}
</style>
<div class="wpacu-assets-collapsible-wrap wpacu-wrap-area wpacu-page-options">
<a class="wpacu-assets-collapsible wpacu-assets-collapsible-active" href="#wpacu-assets-collapsible-content-page-options">
<span class="dashicons dashicons-admin-generic"></span>&nbsp; Page Options
</a>
<div style="max-height: inherit;" class="wpacu-assets-collapsible-content wpacu-open">
<?php
include_once __DIR__.'/_page-options-inner.php';
?>
<img style="display: none;"
class="wpacu_ajax_loader"
src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-ajax-loading-spinner.svg" alt="<?php _e('Loading'); ?>..." />
</div>
</div>
<?php
// This shows along with the CSS & JS manager, and it's expandable
} elseif (isset($listAreaStatus)) {
?>
<div class="wpacu-assets-collapsible-wrap wpacu-wrap-area wpacu-page-options">
<a class="wpacu-assets-collapsible <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-assets-collapsible-active<?php } ?>" href="#wpacu-assets-collapsible-content-page-options">
<span class="dashicons dashicons-admin-generic"></span>&nbsp; Page Options
</a>
<div style="max-height: inherit;" class="wpacu-assets-collapsible-content <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-open<?php } ?>">
<?php
include_once __DIR__.'/_page-options-inner.php';
?>
<img style="display: none;"
class="wpacu_ajax_loader"
src="<?php echo esc_url(WPACU_PLUGIN_URL); ?>/assets/icons/icon-ajax-loading-spinner.svg" alt="<?php _e('Loading'); ?>..." />
</div>
</div>
<?php
}

View File

@ -0,0 +1,87 @@
<?php
if (! isset($showUnloadOnThisPageCheckUncheckAll, $showLoadItOnThisPageCheckUncheckAll, $locationMain, $locationChild)) {
exit;
}
?>
<div class="wpacu-area-toggle-all-wrap">
<div class="wpacu-area-toggle-all">
<?php
// Only show if there is at least one "Unload on this page" checkbox available
// It won't be if there are only bulk unloads
if ( $showUnloadOnThisPageCheckUncheckAll ) {
?>
<div class="wpacu-left">
&#10230; "Unload on this page" -
<a class="wpacu-area-check-all"
<?php if ($locationMain === 'plugins') { ?>
data-wpacu-plugin="<?php echo esc_html($locationChild); ?>"
<?php } ?>
data-wpacu-area="<?php echo esc_html($locationChild); ?>_plugin"
href="#">Check All</a>
|
<a class="wpacu-area-uncheck-all"
<?php if ($locationMain === 'plugins') { ?>
data-wpacu-plugin="<?php echo esc_html($locationChild); ?>"
<?php } ?>
data-wpacu-area="<?php echo esc_html($locationChild); ?>_plugin"
href="#">Uncheck All</a>
</div>
<?php
}
?>
<?php
// Only show if there is at least one bulk unloaded asset
// Otherwise, there is no load exception to make
if ( $showLoadItOnThisPageCheckUncheckAll ) {
?>
<div class="wpacu-left">
&#10230; Make an exception from bulk unload, "Load it on this page" -
<a class="wpacu-area-check-load-all"
<?php if ($locationMain === 'plugins') { ?>
data-wpacu-plugin="<?php echo esc_html($locationChild); ?>"
<?php } ?>
data-wpacu-area="<?php echo esc_html($locationChild); ?>_plugin"
href="#">Check All</a>
|
<a class="wpacu-area-uncheck-load-all"
<?php if ($locationMain === 'plugins') { ?>
data-wpacu-plugin="<?php echo esc_html($locationChild); ?>"
<?php } ?>
data-wpacu-area="<?php echo esc_html($locationChild); ?>_plugin"
href="#">Uncheck All</a> * <small>relevant if bulk unload rules (e.g. site-wide) are already applied</small>
</div>
<?php
}
?>
<div class="wpacu-right">
<a class="wpacu-area-contract-all-assets wpacu_area_handles_row_expand_contract"
<?php if ($locationMain === 'plugins') { ?>
data-wpacu-plugin="<?php echo esc_html($locationChild); ?>"
<?php } ?>
data-wpacu-area="<?php echo esc_html($locationChild); ?>_plugin"
href="#">Contract</a>
|
<a class="wpacu-area-expand-all-assets wpacu_area_handles_row_expand_contract"
<?php if ($locationMain === 'plugins') { ?>
data-wpacu-plugin="<?php echo esc_html($locationChild); ?>"
<?php } ?>
data-wpacu-area="<?php echo esc_html($locationChild); ?>_plugin"
href="#">Expand</a>
All Assets
</div>
<div class="wpacu_clearfix"></div>
</div>
</div>

View File

@ -0,0 +1,67 @@
<?php
if (! isset($showUnloadOnThisPageCheckUncheckAll, $showLoadItOnThisPageCheckUncheckAll, $locationMain, $locationChild)) {
exit;
}
?>
<div class="wpacu-area-toggle-all-wrap">
<?php
// Only show if there is at least one "Unload on this page" checkbox available
// It won't be if there are only bulk unloads
if ( $showUnloadOnThisPageCheckUncheckAll ) { ?>
<div class="wpacu-area-toggle-all">
<ul>
<li>"Unload on this page"</li>
<li>
<a class="wpacu-area-check-all"
<?php if ($locationMain === 'plugins') { ?>
data-wpacu-plugin="<?php echo esc_html($locationChild); ?>"
<?php } ?>
data-wpacu-area="<?php echo esc_html($locationChild); ?>_plugin"
href="#">Check All</a>
|
<a class="wpacu-area-uncheck-all"
<?php if ($locationMain === 'plugins') { ?>
data-wpacu-plugin="<?php echo esc_html($locationChild); ?>"
<?php } ?>
data-wpacu-area="<?php echo esc_html($locationChild); ?>_plugin"
href="#">Uncheck All</a>
</li>
</ul>
</div>
<?php } ?>
<?php
// Only show if there is at least one bulk unloaded asset
// Otherwise, there is no load exception to make
if ( $showLoadItOnThisPageCheckUncheckAll ) {
?>
<div class="wpacu-area-toggle-all" style="min-width: 390px;">
<ul>
<li>Make an exception from bulk unload, "Load it on this page"</li>
<li>
<a class="wpacu-area-check-load-all"
<?php if ($locationMain === 'plugins') { ?>
data-wpacu-plugin="<?php echo esc_html($locationChild); ?>"
<?php } ?>
data-wpacu-area="<?php echo esc_html($locationChild); ?>_plugin"
href="#">Check All</a>
|
<a class="wpacu-area-uncheck-load-all"
<?php if ($locationMain === 'plugins') { ?>
data-wpacu-plugin="<?php echo esc_html($locationChild); ?>"
<?php } ?>
data-wpacu-area="<?php echo esc_html($locationChild); ?>_plugin"
href="#">Uncheck All</a>
</li>
</div>
<?php
}
?>
</div>

View File

@ -0,0 +1,80 @@
<?php
// no direct access
if (! isset($data)) {
exit;
}
$listAreaStatus = $data['plugin_settings']['assets_list_layout_areas_status'];
/*
* ------------------------------
* [START] STYLES & SCRIPTS LIST
* ------------------------------
*/
require_once __DIR__.'/_assets-top-area.php';
?>
<div class="wpacu-assets-collapsible-wrap wpacu-wrap-all">
<a style="padding: 15px;" class="wpacu-assets-collapsible <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-assets-collapsible-active<?php } ?>" href="#wpacu-assets-collapsible-content">
<?php esc_html_e('Styles (.css files) &amp; Scripts (.js files)', 'wp-asset-clean-up'); ?> &#10141; <?php esc_html_e('Total enqueued (+ core files)', 'wp-asset-clean-up'); ?>: <?php echo (int)$data['total_styles'] + (int)$data['total_scripts']; ?> (Styles: <?php echo (int)$data['total_styles']; ?>, Scripts: <?php echo (int)$data['total_scripts']; ?>)
</a>
<div id="wpacu-assets-collapsible-content"
class="wpacu-assets-collapsible-content <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-open<?php } ?>">
<?php if (! empty($data['all']['styles']) || ! empty($data['all']['scripts'])) { ?>
<div class="wpacu-area-toggle-all-assets wpacu-right">
<a class="wpacu-area-contract-all-assets wpacu_area_handles_row_expand_contract"
data-wpacu-area="all_assets" href="#">Contract</a>
|
<a class="wpacu-area-expand-all-assets wpacu_area_handles_row_expand_contract"
data-wpacu-area="all_assets" href="#">Expand</a>
All Assets
</div>
<?php } ?>
<div>
<?php
if (! empty($data['all']['styles']) || ! empty($data['all']['scripts'])) {
?>
<table class="wpacu_list_table wpacu_widefat wpacu_striped"
data-wpacu-area="all_assets">
<tbody>
<?php
$data['view_all'] = true;
$data['rows_build_array'] = true;
$data['rows_assets'] = array();
require_once __DIR__.'/_asset-style-rows.php';
require_once __DIR__.'/_asset-script-rows.php';
if (! empty($data['rows_assets'])) {
ksort($data['rows_assets']);
foreach ($data['rows_assets'] as $assetRow) {
echo \WpAssetCleanUp\Misc::stripIrrelevantHtmlTags($assetRow)."\n";
}
}
?>
</tbody>
</table>
<?php
}
?>
</div>
</div>
</div>
<?php
if ( isset( $data['all']['hardcoded'] ) && ! empty( $data['all']['hardcoded'] ) ) {
$data['print_outer_html'] = true; // AJAX call from the Dashboard
include_once __DIR__ . '/_assets-hardcoded-list.php';
} elseif (isset($data['is_frontend_view']) && $data['is_frontend_view']) {
echo \WpAssetCleanUp\HardcodedAssets::getHardCodedManageAreaForFrontEndView($data); // AJAX call from the front-end view
}
/*
* -----------------------------
* [END] STYLES & SCRIPTS LIST
* -----------------------------
*/
include_once __DIR__ . '/_page-options.php';
include '_inline_js.php';

Some files were not shown because too many files have changed in this diff Show More