first
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
@ -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(' / ', $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>
|
@ -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 ' '.$jqueryIconHtmlHandle; } ?></label>
|
||||
<em>* JavaScript (.js)</em>
|
||||
<?php
|
||||
if ($data['row']['obj']->handle === 'swiper') {
|
||||
?>
|
||||
⟶ <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 ' <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 ' <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 ' <span><img style="vertical-align: middle;" width="25" height="25" src="'.WPACU_PLUGIN_URL.'/assets/icons/icon-ie.svg" alt="" title="Microsoft / Public domain" /> <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">
|
||||
⟶ <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
|
||||
}
|
@ -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 .= ' '.$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
|
@ -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 & <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>
|
@ -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> <strong>async</strong> ⟶</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> <strong>defer</strong> ⟶</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
|
||||
<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
|
||||
}
|
@ -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>';
|
||||
}
|
@ -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">
|
||||
⟶
|
||||
Preload (if kept loaded)?
|
||||
<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;
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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(' / ', $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>
|
@ -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>
|
||||
<em>* Stylesheet (.css)</em>
|
||||
<?php
|
||||
if ($data['row']['obj']->handle === 'wp-block-library') {
|
||||
?>
|
||||
⟶ <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 ' <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 ' <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 ' <span><img style="vertical-align: middle;" width="25" height="25" src="'.WPACU_PLUGIN_URL.'/assets/icons/icon-ie.svg" alt="" title="Microsoft / Public domain" /> <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">
|
||||
⟶ <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
|
||||
}
|
@ -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
|
@ -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 & <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>
|
@ -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
|
||||
<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
|
||||
}
|
@ -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');
|
||||
}
|
@ -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" -> "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">
|
||||
⟶
|
||||
Preload (if kept loaded)?
|
||||
<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
|
||||
}
|
@ -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 & Scripts ➝ 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>
|
||||
& <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="" /> 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) & STYLE tags<?php } ?>
|
||||
<?php if ($targetKey === 'script_src_or_inline_and_noscript_inline_tags') { ?>Hardcoded SCRIPT (with "src" attribute & 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) & 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 }
|
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
// no direct access
|
||||
if (! isset($data)) {
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
<p><?php echo sprintf(
|
||||
esc_html__('Please select the styles & 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 & 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 & 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>➝ 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>
|
||||
<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>
|
@ -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>
|
||||
/ 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>
|
||||
/ 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
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
@ -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"/> <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>
|
||||
|
@ -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 & <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>
|
@ -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) ⟶ <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) ⟶ <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>
|
@ -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');
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
@ -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"/> <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
|
||||
}
|
@ -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
|
||||
}
|
@ -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>
|
@ -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"/> <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
|
||||
}
|
@ -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>
|
@ -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>
|
@ -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
|
||||
}
|
||||
}
|
@ -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>
|
@ -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>
|
@ -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" /> <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>
|
@ -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" /> <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>
|
@ -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>
|
@ -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" /> <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" /> <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" /> <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" /> <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" /> <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" /> <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" />
|
@ -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> 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> 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
|
||||
}
|
@ -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">
|
||||
⟶ "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">
|
||||
⟶ 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>
|
@ -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>
|
@ -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) & Scripts (.js files)', 'wp-asset-clean-up'); ?> ➝ <?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';
|
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
// no direct access
|
||||
if (! isset($data)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$listAreaStatus = $data['plugin_settings']['assets_list_layout_areas_status'];
|
||||
|
||||
/*
|
||||
* -------------------------------
|
||||
* [START] BY Loaded or Unloaded
|
||||
* -------------------------------
|
||||
*/
|
||||
if (! empty($data['all']['styles']) || ! empty($data['all']['scripts'])) {
|
||||
require_once __DIR__.'/_assets-top-area.php';
|
||||
|
||||
$data['view_by_loaded_unloaded'] =
|
||||
$data['rows_build_array'] =
|
||||
$data['rows_by_loaded_unloaded'] = true;
|
||||
|
||||
$data['rows_assets'] = array();
|
||||
|
||||
require_once __DIR__.'/_asset-style-rows.php';
|
||||
require_once __DIR__.'/_asset-script-rows.php';
|
||||
|
||||
if (! empty($data['rows_assets'])) {
|
||||
$handleStatusesText = array(
|
||||
'loaded' => '<span style="color: green;" class="dashicons dashicons-yes"></span> '.esc_html__('All loaded (.css & .js)', 'wp-asset-clean-up'),
|
||||
'unloaded' => '<span style="color: #cc0000;" class="dashicons dashicons-no-alt"></span> '.esc_html__('All unloaded (.css & .js)', 'wp-asset-clean-up'),
|
||||
);
|
||||
|
||||
// Sorting: loaded & unloaded
|
||||
$rowsAssets = array('loaded' => array(), 'unloaded' => array());
|
||||
|
||||
foreach ($data['rows_assets'] as $handleStatus => $values) {
|
||||
$rowsAssets[$handleStatus] = $values;
|
||||
}
|
||||
|
||||
foreach ($rowsAssets as $handleStatus => $values) {
|
||||
ksort($values);
|
||||
|
||||
$assetRowsOutput = '';
|
||||
|
||||
$totalFiles = 0;
|
||||
$assetRowIndex = 1;
|
||||
|
||||
foreach ($values as $assetType => $assetRows) {
|
||||
foreach ($assetRows as $assetRow) {
|
||||
$assetRowsOutput .= $assetRow . "\n";
|
||||
$totalFiles++;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="wpacu-assets-collapsible-wrap wpacu-by-parents wpacu-wrap-area wpacu-<?php echo esc_attr($handleStatus); ?>">
|
||||
<a class="wpacu-assets-collapsible <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-assets-collapsible-active<?php } ?>" href="#wpacu-assets-collapsible-content-<?php echo esc_attr($handleStatus); ?>">
|
||||
<?php echo wp_kses($handleStatusesText[$handleStatus], array('span' => array('class' => array()))); ?> ➝ Total files: <?php echo (int)$totalFiles; ?>
|
||||
</a>
|
||||
|
||||
<div class="wpacu-assets-collapsible-content <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-open<?php } ?>">
|
||||
<?php if (count($values) > 0) { ?>
|
||||
<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="<?php echo esc_html($handleStatus); ?>_assets" href="#">Contract</a>
|
||||
|
|
||||
<a class="wpacu-area-expand-all-assets wpacu_area_handles_row_expand_contract"
|
||||
data-wpacu-area="<?php echo esc_html($handleStatus); ?>_assets" href="#">Expand</a>
|
||||
All Assets
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($handleStatus === 'loaded') {
|
||||
if (count($values) > 0) {
|
||||
$loadedFilesNote = esc_html__('The following files were not selected for unload in any way (e.g. per page, site-wide) on this page. The list also includes any load exceptions (e.g. a file can be unloaded site-wide, but loaded on this page).', 'wp-asset-clean-up');
|
||||
} else {
|
||||
$loadedFilesNote = esc_html__('All the CSS/JS files were chosen to be unloaded on this page', 'wp-asset-clean-up');
|
||||
}
|
||||
?>
|
||||
<p class="wpacu-assets-note"><?php echo esc_html($loadedFilesNote); ?></p>
|
||||
<?php } elseif ($handleStatus === 'unloaded') {
|
||||
if (count($values) > 0) {
|
||||
$unloadedFilesNote = esc_html__('The following CSS/JS files are unloaded on this page due to the rules that took effect.', 'wp-asset-clean-up');
|
||||
} else {
|
||||
$unloadedFilesNote = esc_html__('There are no unloaded CSS/JS files on this page.', 'wp-asset-clean-up');
|
||||
}
|
||||
?>
|
||||
<p class="wpacu-assets-note"><?php echo esc_html($unloadedFilesNote); ?>.</p>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (count($values) > 0) { ?>
|
||||
<table class="wpacu_list_table wpacu_list_by_parents wpacu_widefat wpacu_striped"
|
||||
data-wpacu-area="<?php echo esc_html($handleStatus); ?>_assets">
|
||||
<tbody>
|
||||
<?php
|
||||
echo \WpAssetCleanUp\Misc::stripIrrelevantHtmlTags($assetRowsOutput);
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } ?>
|
||||
</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] BY Loaded or Unloaded
|
||||
* ----------------------------
|
||||
*/
|
||||
|
||||
include_once __DIR__ . '/_page-options.php';
|
||||
|
||||
include '_inline_js.php';
|
@ -0,0 +1,322 @@
|
||||
<?php
|
||||
// no direct access
|
||||
if (! isset($data)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Show areas by:
|
||||
// "Plugins", "Themes" (parent theme and child theme), "WordPress Core"
|
||||
// External locations (outside plugins and themes)
|
||||
// 3rd party external locations (e.g. Google API Fonts, CND urls such as the ones for Bootstrap etc.)
|
||||
$listAreaStatus = $data['plugin_settings']['assets_list_layout_areas_status'];
|
||||
$pluginsAreaStatus = $data['plugin_settings']['assets_list_layout_plugin_area_status'] ?: 'expanded';
|
||||
/*
|
||||
* -------------------------
|
||||
* [START] BY EACH LOCATION
|
||||
* -------------------------
|
||||
*/
|
||||
if (! empty($data['all']['styles']) || ! empty($data['all']['scripts'])) {
|
||||
require_once __DIR__.'/_assets-top-area.php';
|
||||
|
||||
if (! function_exists('get_plugins') && ! is_admin()) {
|
||||
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||
}
|
||||
|
||||
$allPlugins = get_plugins();
|
||||
$allThemes = wp_get_themes();
|
||||
$allActivePluginsIcons = \WpAssetCleanUp\Misc::getAllActivePluginsIcons();
|
||||
|
||||
$data['view_by_location'] =
|
||||
$data['rows_build_array'] =
|
||||
$data['rows_by_location'] = true;
|
||||
|
||||
$data['rows_assets'] = array();
|
||||
|
||||
require_once __DIR__.'/_asset-style-rows.php';
|
||||
require_once __DIR__.'/_asset-script-rows.php';
|
||||
|
||||
$locationsText = array(
|
||||
'plugins' => '<span class="dashicons dashicons-admin-plugins"></span> '.esc_html__('From Plugins', 'wp-asset-clean-up').' (.css & .js)',
|
||||
'themes' => '<span class="dashicons dashicons-admin-appearance"></span> '.esc_html__('From Themes', 'wp-asset-clean-up').' (.css & .js)',
|
||||
'uploads' => '<span class="dashicons dashicons-wordpress"></span> '.esc_html__('WordPress Uploads Directory', 'wp-asset-clean-up').' (.css & .js)',
|
||||
'wp_core' => '<span class="dashicons dashicons-wordpress"></span> '.esc_html__('WordPress Core', 'wp-asset-clean-up').' (.css & .js)',
|
||||
'external' => '<span class="dashicons dashicons-cloud"></span> '.esc_html__('External 3rd Party', 'wp-asset-clean-up').' (.css & .js)'
|
||||
);
|
||||
|
||||
if (! empty($data['rows_assets'])) {
|
||||
// Sorting: Plugins, Themes, Uploads Directory and External Assets
|
||||
$rowsAssets = array('plugins' => array(), 'themes' => array(), 'uploads' => array(), 'wp_core' => array(), 'external' => array());
|
||||
|
||||
foreach ($data['rows_assets'] as $locationMain => $values) {
|
||||
$rowsAssets[$locationMain] = $values;
|
||||
}
|
||||
|
||||
foreach ($rowsAssets as $locationMain => $values) {
|
||||
ksort($values);
|
||||
$totalLocationAssets = count($values);
|
||||
$hideLocationMainArea = ($locationMain === 'uploads' && $totalLocationAssets === 0);
|
||||
$hideListOfAssetsOnly = ($locationMain === 'wp_core' && $data['plugin_settings']['hide_core_files']);
|
||||
|
||||
$contractExpandAllAssetsHtml = <<<HTML
|
||||
<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="{$locationMain}" href="#">Contract</a>
|
||||
|
|
||||
<a class="wpacu-area-expand-all-assets wpacu_area_handles_row_expand_contract"
|
||||
data-wpacu-area="{$locationMain}" href="#">Expand</a>
|
||||
All Assets
|
||||
</div>
|
||||
HTML;
|
||||
ob_start();
|
||||
?>
|
||||
<div <?php if ($hideLocationMainArea) {
|
||||
echo 'style="display: none;"';
|
||||
} ?> class="wpacu-assets-collapsible-wrap wpacu-by-location wpacu-<?php echo esc_attr($locationMain); ?>">
|
||||
<a class="wpacu-assets-collapsible <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-assets-collapsible-active<?php } ?>"
|
||||
href="#wpacu-assets-collapsible-content-<?php echo esc_attr($locationMain); ?>">
|
||||
<?php echo wp_kses($locationsText[$locationMain], array('span' => array('class' => array()))); ?> ➝ Total files: {total_files_<?php echo esc_html($locationMain); ?>}
|
||||
</a>
|
||||
|
||||
<div class="wpacu-assets-collapsible-content <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-open<?php } ?>">
|
||||
<?php if ($locationMain === 'external') { ?>
|
||||
<div class="wpacu-assets-note wpacu-with-toggle-all-assets"><strong>Note:</strong> External .css and .js assets are considered
|
||||
those who are hosted on a different domain (e.g. Google Font API, assets loaded from external
|
||||
CDNs) and the ones outside the WordPress "plugins" (usually /wp-content/plugins/), "themes"
|
||||
(usually /wp-content/themes/) and "uploads" (usually /wp-content/uploads/) directories.</div>
|
||||
<?php if (count($values) > 0) { echo $contractExpandAllAssetsHtml; } ?>
|
||||
<?php
|
||||
// WP Core CSS/JS list is visible
|
||||
} elseif ($locationMain === 'wp_core' && ! $data['plugin_settings']['hide_core_files']) { ?>
|
||||
<div class="wpacu-assets-note wpacu-with-toggle-all-assets"><span style="color: red;" class="dashicons dashicons-warning"></span> <strong>Warning:</strong> Please be careful when doing any changes to the
|
||||
following core assets as they can break the functionality of the front-end website. If you're
|
||||
not sure about unloading any asset, just leave it loaded.</div>
|
||||
<?php if (count($values) > 0) { echo $contractExpandAllAssetsHtml; } ?>
|
||||
<?php
|
||||
// WP Core CSS/JS list is hidden
|
||||
} elseif ($locationMain === 'wp_core' && $data['plugin_settings']['hide_core_files']) {
|
||||
?>
|
||||
<div class="wpacu-assets-note"><strong>Note:</strong> By default, <?php echo WPACU_PLUGIN_TITLE; ?> does not show the list of CSS/JS loaded from the WordPress core. Usually, WordPress core files are loaded for a reason and this setting was applied to prevent accidental unload of files that could be needed (e.g. jQuery library, Underscore library etc.).</div>
|
||||
<div class="wpacu-assets-note"><span class="dashicons dashicons-info"></span> If you believe that you do not need some loaded core files (e.g. WordPress Gutenberg styling - Handle: 'wp-block-library') and you want to manage the files loaded from <em>/wp-includes/</em>, you can go to the plugin's <strong>"Settings"</strong>, click on the <strong>"Plugin Usage Preferences"</strong> tab, scroll to <strong>"Hide WordPress Core Files From The Assets List?"</strong> and make sure the option <strong>is turned off</strong>.</div>
|
||||
<?php
|
||||
} elseif ($locationMain === 'uploads') { ?>
|
||||
<div class="wpacu-assets-note" style="padding: 15px 15px 0 0;"><strong>Note:</strong> These are the
|
||||
CSS/JS files load from the /wp-content/uploads/ WordPress directory. They were copied there by
|
||||
other plugins or developers working on the website. In case the file was detected to be
|
||||
generated by a specific plugin through various verification patterns (e.g. for plugins such as
|
||||
Elementor, Oxygen Builder etc.), then it will be not listed here, but in the "From Plugins (.css
|
||||
& .js)" area for the detected plugin. This is to have all the files related to a plugin
|
||||
organised in one place.</div>
|
||||
<?php if (count($values) > 0) { echo $contractExpandAllAssetsHtml; } ?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
$locationRowCount = 0;
|
||||
$totalLocationAssets = count($values);
|
||||
|
||||
// Total files from all the plugins
|
||||
$totalFilesArray[$locationMain] = 0;
|
||||
|
||||
// Default value (not contracted)
|
||||
$pluginListContracted = false;
|
||||
|
||||
if ($totalLocationAssets > 0) {
|
||||
$locI = 1;
|
||||
|
||||
// Going through each plugin/theme etc.
|
||||
foreach ( $values as $locationChild => $values2 ) {
|
||||
if ($locationMain === 'plugins') {
|
||||
$totalPluginAssets = $totalBulkUnloadedAssetsPerPlugin = 0;
|
||||
}
|
||||
|
||||
ksort( $values2 );
|
||||
|
||||
$assetRowsOutput = '';
|
||||
|
||||
// Going through each asset from the plugin/theme
|
||||
foreach ( $values2 as $assetType => $assetRows ) {
|
||||
foreach ( $assetRows as $assetRow ) {
|
||||
$assetRowsOutput .= $assetRow . "\n";
|
||||
|
||||
if ( $locationMain === 'plugins' ) {
|
||||
if (strpos( $assetRow, 'wpacu_is_bulk_unloaded' ) !== false ) {
|
||||
$totalBulkUnloadedAssetsPerPlugin ++;
|
||||
}
|
||||
|
||||
$totalPluginAssets ++;
|
||||
}
|
||||
|
||||
$totalFilesArray[$locationMain] ++;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $locationChild !== 'none' ) {
|
||||
if ( $locationMain === 'plugins' ) {
|
||||
$locationChildText = \WpAssetCleanUp\Info::getPluginInfo( $locationChild, $allPlugins, $allActivePluginsIcons );
|
||||
|
||||
$isLastPluginAsset = ( count( $values ) - 1 ) === $locationRowCount;
|
||||
$pluginListContracted = ( $locationMain === 'plugins' && $pluginsAreaStatus === 'contracted' );
|
||||
|
||||
// Show it if there is at least one available "Unload on this page"
|
||||
$showUnloadOnThisPageCheckUncheckAll = $totalPluginAssets !== $totalBulkUnloadedAssetsPerPlugin;
|
||||
|
||||
// Show it if all the assets from the plugin are bulk unloaded
|
||||
$showLoadItOnThisPageCheckUncheckAll = $totalBulkUnloadedAssetsPerPlugin === $totalPluginAssets;
|
||||
} elseif ( $locationMain === 'themes' ) {
|
||||
$locationChildThemeArray = \WpAssetCleanUp\Info::getThemeInfo( $locationChild, $allThemes );
|
||||
$locationChildText = $locationChildThemeArray['output'];
|
||||
} else {
|
||||
$locationChildText = $locationChild;
|
||||
}
|
||||
|
||||
$extraClassesToAppend = '';
|
||||
|
||||
if ( $locationMain === 'plugins' && $isLastPluginAsset ) {
|
||||
$extraClassesToAppend .= ' wpacu-area-last ';
|
||||
}
|
||||
|
||||
if ($locI === 1) {
|
||||
$extraClassesToAppend .= ' wpacu-location-child-area-first ';
|
||||
}
|
||||
|
||||
// PLUGIN LIST: VIEW THEIR ASSETS
|
||||
// EXPANDED (DEFAULT)
|
||||
if ( $locationMain === 'plugins' ) {
|
||||
if ( $pluginListContracted ) {
|
||||
// CONTRACTED (+ -)
|
||||
?>
|
||||
<a href="#"
|
||||
class="wpacu-plugin-contracted-wrap-link wpacu-pro wpacu-link-closed <?php if ( ( count( $values ) - 1 ) === $locationRowCount ) { echo 'wpacu-last-wrap-link'; } ?>">
|
||||
<div class="wpacu-plugin-title-contracted wpacu-area-contracted">
|
||||
<?php echo wp_kses($locationChildText, array('div' => array('class' => array(), 'style' => array()), 'span' => array('class' => array()))); ?> <span style="font-weight: 200;">/</span> <span style="font-weight: 400;"><?php echo (int)$totalPluginAssets; ?></span> files
|
||||
</div>
|
||||
</a>
|
||||
<?php
|
||||
} else { ?>
|
||||
<div data-wpacu-plugin="<?php echo esc_attr($locationChild); ?>"
|
||||
data-wpacu-area="<?php echo esc_attr($locationChild); ?>_plugin"
|
||||
class="wpacu-location-child-area wpacu-area-expanded <?php echo esc_attr($extraClassesToAppend); ?>">
|
||||
<div class="wpacu-area-title">
|
||||
<?php echo wp_kses($locationChildText, array('div' => array('class' => array(), 'style' => array()), 'span' => array('class' => array()))); ?> <span style="font-weight: 200;">/</span> <span style="font-weight: 400;"><?php echo (int)$totalPluginAssets; ?></span> files
|
||||
<?php
|
||||
include '_view-by-location/_plugin-list-expanded-actions.php';
|
||||
?>
|
||||
</div>
|
||||
<div class="wpacu-area-toggle-all-assets">
|
||||
<a class="wpacu-area-contract-all-assets wpacu_area_handles_row_expand_contract"
|
||||
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"
|
||||
data-wpacu-area="<?php echo esc_html($locationChild); ?>_plugin" href="#">Expand</a>
|
||||
All Assets
|
||||
</div>
|
||||
</div>
|
||||
<?php }
|
||||
} elseif ( $locationMain === 'themes' ) {
|
||||
?>
|
||||
<div data-wpacu-area="<?php echo esc_attr($locationChild); ?>_theme"
|
||||
class="wpacu-location-child-area wpacu-area-expanded <?php echo esc_attr($extraClassesToAppend); ?>">
|
||||
<div class="wpacu-area-title <?php if ($locationChildThemeArray['has_icon'] === true) { echo 'wpacu-theme-has-icon'; } ?>"><?php echo \WpAssetCleanUp\Misc::stripIrrelevantHtmlTags($locationChildText); ?></div>
|
||||
<div class="wpacu-area-toggle-all-assets">
|
||||
<a class="wpacu-area-contract-all-assets wpacu_area_handles_row_expand_contract"
|
||||
data-wpacu-area="<?php echo esc_html($locationChild); ?>_theme" href="#">Contract</a>
|
||||
|
|
||||
<a class="wpacu-area-expand-all-assets wpacu_area_handles_row_expand_contract"
|
||||
data-wpacu-area="<?php echo esc_html($locationChild); ?>_theme" href="#">Expand</a>
|
||||
All Assets
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
} else { // WordPress Core, Uploads, 3rd Party etc.
|
||||
?>
|
||||
<div data-wpacu-area="<?php echo esc_attr($locationChild); ?>"
|
||||
class="wpacu-location-child-area wpacu-area-expanded <?php echo esc_attr($extraClassesToAppend); ?>">
|
||||
<div class="wpacu-area-title"><?php echo wp_kses($locationChildText, array('div' => array('class' => array(), 'style' => array()), 'span' => array('class' => array()))); ?></div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="wpacu-assets-table-list-wrap <?php if ( $locationMain === 'plugins' ) { echo ' wpacu-area-assets-wrap '; }
|
||||
if ( $pluginListContracted ) {
|
||||
echo ' wpacu-area-closed ';
|
||||
|
||||
if (isset($isLastPluginAsset) && $isLastPluginAsset) {
|
||||
echo ' wpacu-area-assets-last ';
|
||||
}
|
||||
} ?>">
|
||||
<?php
|
||||
// CONTRACTED (+ -)
|
||||
if ( $locationMain === 'plugins' && $pluginListContracted ) {
|
||||
include '_view-by-location/_plugin-list-contracted-actions.php';
|
||||
}
|
||||
?>
|
||||
|
||||
<table <?php
|
||||
if ( $locationMain === 'plugins' ) { echo ' data-wpacu-plugin="' . esc_attr($locationChild) . '" data-wpacu-area="' . esc_attr($locationChild) . '_plugin" '; }
|
||||
if ( $locationMain === 'themes' ) { echo ' data-wpacu-area="' . esc_attr($locationChild) . '_theme" '; }
|
||||
if ( in_array($locationMain, array('uploads', 'wp_core', 'external') ) ) { echo ' data-wpacu-area="' . esc_attr($locationMain) . '" '; }
|
||||
?>
|
||||
class="wpacu_list_table wpacu_list_by_location wpacu_widefat wpacu_striped">
|
||||
<tbody>
|
||||
<?php
|
||||
if ( $locationMain === 'plugins' ) {
|
||||
do_action('wpacu_assets_plugin_notice_table_row', $locationChild);
|
||||
}
|
||||
|
||||
echo \WpAssetCleanUp\Misc::stripIrrelevantHtmlTags($assetRowsOutput);
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
$locationRowCount ++;
|
||||
}
|
||||
} else {
|
||||
// There are no loaded CSS/JS
|
||||
$showOxygenMsg = $locationMain === 'themes' && in_array('oxygen/functions.php', \WpAssetCleanUp\Misc::getActivePlugins());
|
||||
|
||||
if ($showOxygenMsg) {
|
||||
?>
|
||||
<div style="padding: 12px 0;">
|
||||
<img style="height: 30px; vertical-align: bottom;" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHdpZHRoPSIzODFweCIgaGVpZ2h0PSIzODVweCIgdmlld0JveD0iMCAwIDM4MSAzODUiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+ICAgICAgICA8dGl0bGU+VW50aXRsZWQgMzwvdGl0bGU+ICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPiAgICA8ZGVmcz4gICAgICAgIDxwb2x5Z29uIGlkPSJwYXRoLTEiIHBvaW50cz0iMC4wNiAzODQuOTQgMzgwLjgwNSAzODQuOTQgMzgwLjgwNSAwLjYyOCAwLjA2IDAuNjI4Ij48L3BvbHlnb24+ICAgIDwvZGVmcz4gICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9IiNhMGE1YWEiIGZpbGwtcnVsZT0iZXZlbm9kZCI+ICAgICAgICA8ZyBpZD0iT3h5Z2VuLUljb24tQ01ZSyI+ICAgICAgICAgICAgPG1hc2sgaWQ9Im1hc2stMiIgZmlsbD0iI2EwYTVhYSI+ICAgICAgICAgICAgICAgIDx1c2UgeGxpbms6aHJlZj0iI3BhdGgtMSI+PC91c2U+ICAgICAgICAgICAgPC9tYXNrPiAgICAgICAgICAgIDxnIGlkPSJDbGlwLTIiPjwvZz4gICAgICAgICAgICA8cGF0aCBkPSJNMjk3LjUwOCwzNDkuNzQ4IEMyNzUuNDQzLDM0OS43NDggMjU3LjU1NiwzMzEuODYgMjU3LjU1NiwzMDkuNzk2IEMyNTcuNTU2LDI4Ny43MzEgMjc1LjQ0MywyNjkuODQ0IDI5Ny41MDgsMjY5Ljg0NCBDMzE5LjU3MywyNjkuODQ0IDMzNy40NiwyODcuNzMxIDMzNy40NiwzMDkuNzk2IEMzMzcuNDYsMzMxLjg2IDMxOS41NzMsMzQ5Ljc0OCAyOTcuNTA4LDM0OS43NDggTDI5Ny41MDgsMzQ5Ljc0OCBaIE0yMjIuMzA0LDMwOS43OTYgQzIyMi4zMDQsMzEyLjAzOSAyMjIuNDQ3LDMxNC4yNDcgMjIyLjYzOSwzMTYuNDQxIEMyMTIuMzMsMzE5LjA5MiAyMDEuNTI4LDMyMC41MDUgMTkwLjQwMywzMjAuNTA1IEMxMTkuMDEsMzIwLjUwNSA2MC45MjksMjYyLjQyMyA2MC45MjksMTkxLjAzMSBDNjAuOTI5LDExOS42MzggMTE5LjAxLDYxLjU1NyAxOTAuNDAzLDYxLjU1NyBDMjYxLjc5NCw2MS41NTcgMzE5Ljg3NywxMTkuNjM4IDMxOS44NzcsMTkxLjAzMSBDMzE5Ljg3NywyMDYuODMzIDMxNy4wMiwyMjEuOTc4IDMxMS44MTUsMjM1Ljk5IEMzMDcuMTc5LDIzNS4wOTcgMzAyLjQwNCwyMzQuNTkyIDI5Ny41MDgsMjM0LjU5MiBDMjU1Ljk3NCwyMzQuNTkyIDIyMi4zMDQsMjY4LjI2MiAyMjIuMzA0LDMwOS43OTYgTDIyMi4zMDQsMzA5Ljc5NiBaIE0zODAuODA1LDE5MS4wMzEgQzM4MC44MDUsODYuMDQyIDI5NS4zOTIsMC42MjggMTkwLjQwMywwLjYyOCBDODUuNDE0LDAuNjI4IDAsODYuMDQyIDAsMTkxLjAzMSBDMCwyOTYuMDIgODUuNDE0LDM4MS40MzMgMTkwLjQwMywzODEuNDMzIEMyMTIuNDk4LDM4MS40MzMgMjMzLjcwOCwzNzcuNjA5IDI1My40NTYsMzcwLjY1NyBDMjY1Ljg0NSwzNzkuNjQxIDI4MS4wMzQsMzg1IDI5Ny41MDgsMzg1IEMzMzkuMDQyLDM4NSAzNzIuNzEyLDM1MS4zMyAzNzIuNzEyLDMwOS43OTYgQzM3Mi43MTIsMjk2LjA5MiAzNjguOTg4LDI4My4yODMgMzYyLjU4NCwyNzIuMjE5IEMzNzQuMjUxLDI0Ny41NzUgMzgwLjgwNSwyMjAuMDU4IDM4MC44MDUsMTkxLjAzMSBMMzgwLjgwNSwxOTEuMDMxIFoiIGlkPSJGaWxsLTEiIGZpbGw9IiNhMGE1YWEiIG1hc2s9InVybCgjbWFzay0yKSI+PC9wYXRoPiAgICAgICAgPC9nPiAgICA8L2c+PC9zdmc+" alt="" />
|
||||
You're using <a href="<?php echo esc_url(admin_url('admin.php?page=ct_dashboard_page')); ?>" target="_blank"><span style="font-weight: 600; color: #6036ca;">Oxygen</span></a> to design your site, which disables the WordPress theme system. Thus, no assets related to the theme are loaded.
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<div style="padding: 0 0 16px 16px;"><?php _e('There are no CSS/JS loaded from this location.', 'wp-asset-clean-up'); ?></div>
|
||||
<?php } ?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$locationMainOutput = ob_get_clean();
|
||||
$locationMainOutput = str_replace(
|
||||
'{total_files_'.$locationMain.'}',
|
||||
$totalFilesArray[$locationMain],
|
||||
$locationMainOutput
|
||||
);
|
||||
|
||||
echo \WpAssetCleanUp\Misc::stripIrrelevantHtmlTags($locationMainOutput);
|
||||
}
|
||||
}
|
||||
|
||||
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] BY EACH LOCATION
|
||||
* -----------------------
|
||||
*/
|
||||
|
||||
include_once __DIR__ . '/_page-options.php';
|
||||
|
||||
include '_inline_js.php';
|
@ -0,0 +1,113 @@
|
||||
<?php
|
||||
// no direct access
|
||||
if (! isset($data)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$listAreaStatus = $data['plugin_settings']['assets_list_layout_areas_status'];
|
||||
|
||||
/*
|
||||
* ----------------------------------------------
|
||||
* [START] BY EACH HANDLE STATUS (Parent or Not)
|
||||
* ----------------------------------------------
|
||||
*/
|
||||
if (! empty($data['all']['styles']) || ! empty($data['all']['scripts'])) {
|
||||
require_once __DIR__.'/_assets-top-area.php';
|
||||
|
||||
$data['view_by_parents'] =
|
||||
$data['rows_build_array'] =
|
||||
$data['rows_by_parents'] = true;
|
||||
|
||||
$data['rows_assets'] = array();
|
||||
|
||||
require_once __DIR__.'/_asset-style-rows.php';
|
||||
require_once __DIR__.'/_asset-script-rows.php';
|
||||
|
||||
$handleStatusesText = array(
|
||||
'parent' => '<span class="dashicons dashicons-groups"></span> \'Parents\' with \'children\' (.css & .js)',
|
||||
'child' => '<span class="dashicons dashicons-admin-users"></span> \'Children\' of \'parents\' (.css & .js)',
|
||||
'independent' => '<span class="dashicons dashicons-admin-users"></span> Independent (.css & .js)'
|
||||
);
|
||||
|
||||
if (! empty($data['rows_assets'])) {
|
||||
// Sorting: parent & non_parent
|
||||
$rowsAssets = array('parent' => array(), 'child' => array(), 'independent' => array());
|
||||
|
||||
foreach ($data['rows_assets'] as $handleStatus => $values) {
|
||||
$rowsAssets[$handleStatus] = $values;
|
||||
}
|
||||
|
||||
foreach ($rowsAssets as $handleStatus => $values) {
|
||||
ksort($values);
|
||||
|
||||
$assetRowIndex = 1;
|
||||
|
||||
$assetRowsOutput = '';
|
||||
|
||||
$totalFiles = 0;
|
||||
|
||||
foreach ($values as $assetType => $assetRows) {
|
||||
foreach ($assetRows as $assetRow) {
|
||||
$assetRowsOutput .= $assetRow . "\n";
|
||||
$totalFiles++;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="wpacu-assets-collapsible-wrap wpacu-by-parents wpacu-wrap-area wpacu-<?php echo esc_attr($handleStatus); ?>">
|
||||
<a class="wpacu-assets-collapsible <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-assets-collapsible-active<?php } ?>" href="#wpacu-assets-collapsible-content-<?php echo esc_attr($handleStatus); ?>">
|
||||
<?php echo wp_kses($handleStatusesText[$handleStatus], array('span' => array('class' => array()))); ?> ➝ <?php esc_html_e('Total files', 'wp-asset-clean-up'); ?>: <?php echo (int)$totalFiles; ?>
|
||||
</a>
|
||||
|
||||
<div class="wpacu-assets-collapsible-content <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-open<?php } ?>">
|
||||
<?php if (count($values) > 0) { ?>
|
||||
<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="<?php echo esc_html($handleStatus); ?>_assets" href="#">Contract</a>
|
||||
|
|
||||
<a class="wpacu-area-expand-all-assets wpacu_area_handles_row_expand_contract"
|
||||
data-wpacu-area="<?php echo esc_html($handleStatus); ?>_assets" href="#">Expand</a>
|
||||
All Assets
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($handleStatus === 'parent') { ?>
|
||||
<p class="wpacu-assets-note">If you unload any of the files below (if any listed), their 'children' (as listed in green bold font below the handle) will also be unloaded.</p>
|
||||
<?php } elseif ($handleStatus === 'child') { ?>
|
||||
<p class="wpacu-assets-note">The following files (if any listed) are 'children' linked to the 'parent' files.</p>
|
||||
<?php } elseif ($handleStatus === 'independent') { ?>
|
||||
<p class="wpacu-assets-note">The following files (if any listed) are independent as they are not 'children' or 'parents'.</p>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (count($values) > 0) { ?>
|
||||
<table class="wpacu_list_table wpacu_list_by_parents wpacu_widefat wpacu_striped"
|
||||
data-wpacu-area="<?php echo esc_html($handleStatus); ?>_assets">
|
||||
<tbody>
|
||||
<?php
|
||||
echo \WpAssetCleanUp\Misc::stripIrrelevantHtmlTags($assetRowsOutput);
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } ?>
|
||||
</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] BY EACH HANDLE STATUS (Parent or Not)
|
||||
* --------------------------------------------
|
||||
*/
|
||||
|
||||
include_once __DIR__ . '/_page-options.php';
|
||||
|
||||
include '_inline_js.php';
|
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
// no direct access
|
||||
if (! isset($data)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$listAreaStatus = $data['plugin_settings']['assets_list_layout_areas_status'];
|
||||
|
||||
/*
|
||||
* -------------------------
|
||||
* [START] BY EACH POSITION
|
||||
* -------------------------
|
||||
*/
|
||||
if (! empty($data['all']['styles']) || ! empty($data['all']['scripts'])) {
|
||||
require_once __DIR__.'/_assets-top-area.php';
|
||||
|
||||
$data['view_by_position'] =
|
||||
$data['rows_build_array'] =
|
||||
$data['rows_by_position'] = true;
|
||||
|
||||
$data['rows_assets'] = array();
|
||||
|
||||
require_once __DIR__.'/_asset-style-rows.php';
|
||||
require_once __DIR__.'/_asset-script-rows.php';
|
||||
|
||||
$positionsText = array(
|
||||
'head' => '<span class="dashicons dashicons-editor-code"></span> HEAD tag (.css & .js)',
|
||||
'body' => '<span class="dashicons dashicons-editor-code"></span> BODY tag (.css & .js)'
|
||||
);
|
||||
|
||||
if (! empty($data['rows_assets'])) {
|
||||
// Sorting: head and body
|
||||
$rowsAssets = array('head' => array(), 'body' => array());
|
||||
|
||||
foreach ($data['rows_assets'] as $positionMain => $values) {
|
||||
$rowsAssets[$positionMain] = $values;
|
||||
}
|
||||
|
||||
foreach ($rowsAssets as $positionMain => $values) {
|
||||
ksort($values);
|
||||
|
||||
$assetRowsOutput = '';
|
||||
|
||||
$totalFiles = 0;
|
||||
$assetRowIndex = 1;
|
||||
|
||||
foreach ($values as $assetType => $assetRows) {
|
||||
foreach ($assetRows as $assetRow) {
|
||||
$assetRowsOutput .= $assetRow . "\n";
|
||||
$totalFiles++;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="wpacu-assets-collapsible-wrap wpacu-by-position wpacu-wrap-area wpacu-<?php echo esc_attr($positionMain); ?>">
|
||||
<a class="wpacu-assets-collapsible <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-assets-collapsible-active<?php } ?>" href="#wpacu-assets-collapsible-content-<?php echo esc_attr($positionMain); ?>">
|
||||
<?php echo wp_kses($positionsText[$positionMain], array('span' => array('class' => array()))); ?> ➝ Total files: <?php echo (int)$totalFiles; ?>
|
||||
</a>
|
||||
|
||||
<div class="wpacu-assets-collapsible-content <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-open<?php } ?>">
|
||||
<?php if (count($values) > 0) { ?>
|
||||
<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="<?php echo esc_html($positionMain); ?>_assets" href="#">Contract</a>
|
||||
|
|
||||
<a class="wpacu-area-expand-all-assets wpacu_area_handles_row_expand_contract"
|
||||
data-wpacu-area="<?php echo esc_html($positionMain); ?>_assets" href="#">Expand</a>
|
||||
All Assets
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($positionMain === 'head') { ?>
|
||||
<p class="wpacu-assets-note">The files below (if any) are loaded within <em><head></em> and <em></head></em> tags. The output is done through <em>wp_head()</em> WordPress function which should be located before the closing <em></head></em> tag of your theme.</p>
|
||||
<?php } elseif ($positionMain === 'body') { ?>
|
||||
<p class="wpacu-assets-note">The files below (if any) are loaded within <em><body></em> and <em></body></em> tags. The output is done through <em>wp_footer()</em> WordPress function which should be located before the closing <em></body></em> tag of your theme.</p>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (count($values) > 0) { ?>
|
||||
<table class="wpacu_list_table wpacu_list_by_position wpacu_widefat wpacu_striped"
|
||||
data-wpacu-area="<?php echo esc_html($positionMain); ?>_assets">
|
||||
<tbody>
|
||||
<?php
|
||||
echo \WpAssetCleanUp\Misc::stripIrrelevantHtmlTags($assetRowsOutput);
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } ?>
|
||||
</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] BY EACH POSITION
|
||||
* -----------------------
|
||||
*/
|
||||
|
||||
include_once __DIR__ . '/_page-options.php';
|
||||
|
||||
include '_inline_js.php';
|
@ -0,0 +1,115 @@
|
||||
<?php
|
||||
// no direct access
|
||||
if (! isset($data)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$listAreaStatus = $data['plugin_settings']['assets_list_layout_areas_status'];
|
||||
|
||||
/*
|
||||
* --------------------------------------
|
||||
* [START] BY PRELOAD STATUS (yes or no)
|
||||
* --------------------------------------
|
||||
*/
|
||||
if (! empty($data['all']['styles']) || ! empty($data['all']['scripts'])) {
|
||||
require_once __DIR__.'/_assets-top-area.php';
|
||||
|
||||
$data['view_by_preload'] =
|
||||
$data['rows_build_array'] =
|
||||
$data['rows_by_preload'] = true;
|
||||
|
||||
$data['rows_assets'] = array();
|
||||
|
||||
require_once __DIR__.'/_asset-style-rows.php';
|
||||
require_once __DIR__.'/_asset-script-rows.php';
|
||||
|
||||
$preloadsText = array(
|
||||
'preloaded' => '<span class="dashicons dashicons-upload"></span> '.esc_html__('Preloaded assets (.css & .js)', 'wp-asset-clean-up'),
|
||||
'not_preloaded' => '<span class="dashicons dashicons-download"></span> '.esc_html__('Not-preloaded (default status) assets (.css & .js)', 'wp-asset-clean-up')
|
||||
);
|
||||
|
||||
if (! empty($data['rows_assets'])) {
|
||||
// Sorting: Preloaded and Not Preloaded (standard loading)
|
||||
$rowsAssets = array('preloaded' => array(), 'not_preloaded' => array());
|
||||
|
||||
foreach ($data['rows_assets'] as $preloadStatus => $values) {
|
||||
$rowsAssets[$preloadStatus] = $values;
|
||||
}
|
||||
|
||||
foreach ($rowsAssets as $preloadStatus => $values) {
|
||||
ksort($values);
|
||||
|
||||
$assetRowsOutput = '';
|
||||
|
||||
$totalFiles = 0;
|
||||
$assetRowIndex = 1;
|
||||
|
||||
foreach ($values as $assetType => $assetRows) {
|
||||
foreach ($assetRows as $assetRow) {
|
||||
$assetRowsOutput .= $assetRow . "\n";
|
||||
$totalFiles++;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="wpacu-assets-collapsible-wrap wpacu-by-preloads wpacu-wrap-area wpacu-<?php echo esc_attr($preloadStatus); ?>">
|
||||
<a class="wpacu-assets-collapsible <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-assets-collapsible-active<?php } ?>" href="#wpacu-assets-collapsible-content-<?php echo esc_attr($preloadStatus); ?>">
|
||||
<?php echo wp_kses($preloadsText[$preloadStatus], array('span' => array('class' => array()))); ?> ➝ Total files: <?php echo (int)$totalFiles; ?>
|
||||
</a>
|
||||
|
||||
<div class="wpacu-assets-collapsible-content <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-open<?php } ?>">
|
||||
<?php if (count($values) > 0) { ?>
|
||||
<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="<?php echo esc_html($preloadStatus); ?>_assets" href="#">Contract</a>
|
||||
|
|
||||
<a class="wpacu-area-expand-all-assets wpacu_area_handles_row_expand_contract"
|
||||
data-wpacu-area="<?php echo esc_html($preloadStatus); ?>_assets" href="#">Expand</a>
|
||||
All Assets
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($preloadStatus === 'preloaded') { ?>
|
||||
<p class="wpacu-assets-note">This is the list of assets (if any) that were chosen to be preloaded through the <span style="background: #e8e8e8; padding: 2px;"><link rel="preload"></span> tag (any valid option from "Preload (if kept loaded)?" drop-down). Note that the preload option is obviously irrelevant if the asset was chosen to be unloaded. The preload option is ONLY relevant for the assets that are loading in the page.</p>
|
||||
<?php
|
||||
if (count($values) < 1) {
|
||||
?>
|
||||
<p style="padding: 0 15px 15px;"><strong>There are no assets chosen to be preloaded.</strong></p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php } elseif ($preloadStatus === 'not_preloaded') { ?>
|
||||
<p class="wpacu-assets-note">This is the list of assets that do not have any preload option added to them which is the default way of showing up on the page.</p>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (count($values) > 0) { ?>
|
||||
<table class="wpacu_list_table wpacu_list_by_preload wpacu_widefat wpacu_striped"
|
||||
data-wpacu-area="<?php echo esc_html($preloadStatus); ?>_assets">
|
||||
<tbody>
|
||||
<?php
|
||||
echo \WpAssetCleanUp\Misc::stripIrrelevantHtmlTags($assetRowsOutput);
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } ?>
|
||||
</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] BY PRELOAD STATUS (yes or no)
|
||||
* ------------------------------------
|
||||
*/
|
||||
|
||||
include_once __DIR__ . '/_page-options.php';
|
||||
|
||||
include '_inline_js.php';
|
@ -0,0 +1,115 @@
|
||||
<?php
|
||||
// no direct access
|
||||
if (! isset($data)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$listAreaStatus = $data['plugin_settings']['assets_list_layout_areas_status'];
|
||||
|
||||
/*
|
||||
* --------------------------------------
|
||||
* [START] BY (ANY) RULES SET (yes or no)
|
||||
* --------------------------------------
|
||||
*/
|
||||
|
||||
if (! empty($data['all']['styles']) || ! empty($data['all']['scripts'])) {
|
||||
require_once __DIR__.'/_assets-top-area.php';
|
||||
|
||||
$data['view_by_rules'] =
|
||||
$data['rows_build_array'] =
|
||||
$data['rows_by_rules'] = true;
|
||||
|
||||
$data['rows_assets'] = array();
|
||||
|
||||
require_once __DIR__.'/_asset-style-rows.php';
|
||||
require_once __DIR__.'/_asset-script-rows.php';
|
||||
|
||||
$rulesText = array(
|
||||
'with_rules' => '<span class="dashicons dashicons-star-filled"></span> '.esc_html__('Styles & Scripts with at least one rule', 'wp-asset-clean-up'),
|
||||
'with_no_rules' => '<span class="dashicons dashicons-star-empty"></span> '.esc_html__('Styles & Scripts without any rules', 'wp-asset-clean-up')
|
||||
);
|
||||
|
||||
if (! empty($data['rows_assets'])) {
|
||||
// Sorting: With (any) rules and without rules (loaded and without alterations to the tags such as async/defer attributes)
|
||||
$rowsAssets = array('with_rules' => array(), 'with_no_rules' => array());
|
||||
|
||||
foreach ($data['rows_assets'] as $rulesStatus => $values) {
|
||||
$rowsAssets[$rulesStatus] = $values;
|
||||
}
|
||||
|
||||
foreach ($rowsAssets as $rulesStatus => $values) {
|
||||
ksort($values);
|
||||
|
||||
$assetRowsOutput = '';
|
||||
|
||||
$totalFiles = 0;
|
||||
$assetRowIndex = 1;
|
||||
|
||||
foreach ($values as $assetType => $assetRows) {
|
||||
foreach ($assetRows as $assetRow) {
|
||||
$assetRowsOutput .= $assetRow . "\n";
|
||||
$totalFiles++;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="wpacu-assets-collapsible-wrap wpacu-by-rules wpacu-wrap-area wpacu-<?php echo esc_attr($rulesStatus); ?>">
|
||||
<a class="wpacu-assets-collapsible <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-assets-collapsible-active<?php } ?>" href="#wpacu-assets-collapsible-content-<?php echo esc_attr($rulesStatus); ?>">
|
||||
<?php echo wp_kses($rulesText[$rulesStatus], array('span' => array('class' => array()))); ?> ➝ <?php esc_html_e('Total enqueued files', 'wp-asset-clean-up'); ?>: <?php echo (int)$totalFiles; ?>
|
||||
</a>
|
||||
|
||||
<div class="wpacu-assets-collapsible-content <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-open<?php } ?>">
|
||||
<?php if (count($values) > 0) { ?>
|
||||
<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="<?php echo esc_html($rulesStatus); ?>_assets" href="#">Contract</a>
|
||||
|
|
||||
<a class="wpacu-area-expand-all-assets wpacu_area_handles_row_expand_contract"
|
||||
data-wpacu-area="<?php echo esc_html($rulesStatus); ?>_assets" href="#">Expand</a>
|
||||
All Assets
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($rulesStatus === 'with_rules') { ?>
|
||||
<p class="wpacu-assets-note">This is the list of enqueued CSS & JavaScript files that have AT LEAST ONE RULE applied to them on this page. The rule could be one of the following: unloaded, preloaded, async/defer attributes applied & changed location (e.g. from HEAD to BODY or vice-versa).</p>
|
||||
<?php
|
||||
if (count($values) < 1) {
|
||||
?>
|
||||
<p style="padding: 0 15px 15px;"><strong>No rules were applied to any of the enqueued CSS/JS files from this page.</strong></p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php } elseif ($rulesStatus === 'with_no_rules') { ?>
|
||||
<p class="wpacu-assets-note">This is the list of enqueued CSS & JavaScript files that have NO RULES applied to them on this page. They are loaded by default in their original location (e.g. HEAD or BODY) without any attributes applied to them (e.g. async/defer).</p>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (count($values) > 0) { ?>
|
||||
<table class="wpacu_list_table wpacu_list_by_rules wpacu_widefat wpacu_striped"
|
||||
data-wpacu-area="<?php echo esc_html($rulesStatus); ?>_assets">
|
||||
<tbody>
|
||||
<?php
|
||||
echo \WpAssetCleanUp\Misc::stripIrrelevantHtmlTags($assetRowsOutput);
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } ?>
|
||||
</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] BY (ANY) RULES SET (yes or no)
|
||||
* -------------------------------------
|
||||
*/
|
||||
include_once __DIR__ . '/_page-options.php';
|
||||
|
||||
include '_inline_js.php';
|
@ -0,0 +1,125 @@
|
||||
<?php
|
||||
// no direct access
|
||||
if (! isset($data)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$listAreaStatus = $data['plugin_settings']['assets_list_layout_areas_status'];
|
||||
|
||||
/*
|
||||
* --------------------------------------
|
||||
* [START] BY PRELOAD STATUS (yes or no)
|
||||
* --------------------------------------
|
||||
*/
|
||||
if (! empty($data['all']['styles']) || ! empty($data['all']['scripts'])) {
|
||||
require_once __DIR__.'/_assets-top-area.php';
|
||||
|
||||
$data['view_by_size'] =
|
||||
$data['rows_build_array'] =
|
||||
$data['rows_by_size'] = true;
|
||||
|
||||
$data['rows_assets'] = $data['handles_sizes'] = array();
|
||||
|
||||
require_once __DIR__.'/_asset-style-rows.php';
|
||||
require_once __DIR__.'/_asset-script-rows.php';
|
||||
|
||||
$sizesText = array(
|
||||
'with_size' => '<span class="dashicons dashicons-yes"></span> '.esc_html__('Local enqueued files ordered by their size (.css & .js)', 'wp-asset-clean-up'),
|
||||
'external_na' => '<span class="dashicons dashicons-flag"></span> '.esc_html__('External enqueued files or non-existent (.css & .js)', 'wp-asset-clean-up')
|
||||
);
|
||||
|
||||
if (! empty($data['rows_assets'])) {
|
||||
// Sorting: With Size and External / No Size Detected
|
||||
$rowsAssets = array('with_size' => array(), 'external_na' => array());
|
||||
|
||||
if (isset($data['rows_assets']['with_size'], $data['handles_sizes']) && ! empty($data['handles_sizes'])) {
|
||||
$dataRowsAssetsWithSize = $data['rows_assets']['with_size'];
|
||||
unset($data['rows_assets']['with_size']); // re-built
|
||||
$data['rows_assets']['with_size'] = array();
|
||||
|
||||
arsort($data['handles_sizes']);
|
||||
|
||||
foreach ($data['handles_sizes'] as $uniqueHandle => $sizeInBytes) {
|
||||
$data['rows_assets']['with_size'][$uniqueHandle] = $dataRowsAssetsWithSize[$uniqueHandle];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($data['rows_assets'] as $sizeStatus => $values) {
|
||||
$rowsAssets[$sizeStatus] = $values;
|
||||
}
|
||||
|
||||
foreach ($rowsAssets as $sizeStatus => $values) {
|
||||
$assetRowsOutput = '';
|
||||
|
||||
$totalFiles = 0;
|
||||
$assetRowIndex = 1;
|
||||
|
||||
foreach ($values as $assetType => $assetRows) {
|
||||
foreach ($assetRows as $assetRow) {
|
||||
$assetRowsOutput .= $assetRow . "\n";
|
||||
$totalFiles++;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div class="wpacu-assets-collapsible-wrap wpacu-by-preloads wpacu-wrap-area wpacu-<?php echo esc_attr($sizeStatus); ?>">
|
||||
<a class="wpacu-assets-collapsible <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-assets-collapsible-active<?php } ?>" href="#wpacu-assets-collapsible-content-<?php echo esc_attr($sizeStatus); ?>">
|
||||
<?php echo wp_kses($sizesText[$sizeStatus], array('span' => array('class' => array()))); ?> ➝ Total files: <?php echo (int)$totalFiles; ?>
|
||||
</a>
|
||||
|
||||
<div class="wpacu-assets-collapsible-content <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-open<?php } ?>">
|
||||
<?php if (count($values) > 0) { ?>
|
||||
<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="<?php echo esc_html($sizeStatus); ?>_assets" href="#">Contract</a>
|
||||
|
|
||||
<a class="wpacu-area-expand-all-assets wpacu_area_handles_row_expand_contract"
|
||||
data-wpacu-area="<?php echo esc_html($sizeStatus); ?>_assets" href="#">Expand</a>
|
||||
All Assets
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($sizeStatus === 'with_size') { ?>
|
||||
<p class="wpacu-assets-note">This is the list of local files (if any) that had their size calculated and shown in descendent order, <strong>from the largest to the smallest</strong>.</p>
|
||||
<?php
|
||||
if (count($values) < 1) {
|
||||
?>
|
||||
<p style="padding: 0 15px 15px;"><strong>There are no local files that could have their size calculated.</strong></p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php } elseif ($sizeStatus === 'external_na') { ?>
|
||||
<p class="wpacu-assets-note">This is the list of assets that are external and you can manually check their size via "Get File Size" link. This list also includes local files (most likely that do not exist and are loaded in your page) that couldn't have their size calculated.</p>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (count($values) > 0) { ?>
|
||||
<table class="wpacu_list_table wpacu_list_by_size wpacu_widefat wpacu_striped"
|
||||
data-wpacu-area="<?php echo esc_html($sizeStatus); ?>_assets">
|
||||
<tbody>
|
||||
<?php
|
||||
echo \WpAssetCleanUp\Misc::stripIrrelevantHtmlTags($assetRowsOutput);
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } ?>
|
||||
</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] BY PRELOAD STATUS (yes or no)
|
||||
* ------------------------------------
|
||||
*/
|
||||
|
||||
include_once __DIR__ . '/_page-options.php';
|
||||
|
||||
include '_inline_js.php';
|
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
// no direct access
|
||||
if (! isset($data)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$listAreaStatus = $data['plugin_settings']['assets_list_layout_areas_status'];
|
||||
|
||||
require_once __DIR__.'/_assets-top-area.php';
|
||||
|
||||
/*
|
||||
* ---------------------
|
||||
* [START] STYLES LIST
|
||||
* ---------------------
|
||||
*/
|
||||
?>
|
||||
<div class="wpacu-assets-collapsible-wrap wpacu-wrap-area">
|
||||
<a class="wpacu-assets-collapsible <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-assets-collapsible-active<?php } ?>" href="#wpacu-assets-styles-collapsible-content">
|
||||
<span class="dashicons dashicons-admin-appearance"></span> <?php esc_html_e('Styles (.css files)', 'wp-asset-clean-up'); ?> ➝ <?php esc_html_e('Total enqueued (+ core files)', 'wp-asset-clean-up'); ?>: <?php echo (int)$data['total_styles']; ?>
|
||||
</a>
|
||||
|
||||
<div id="wpacu-assets-styles-collapsible-content"
|
||||
class="wpacu-assets-collapsible-content <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-open<?php } ?>">
|
||||
<?php if (! empty($data['all']['styles'])) { ?>
|
||||
<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_styles_assets" href="#">Contract</a>
|
||||
|
|
||||
<a class="wpacu-area-expand-all-assets wpacu_area_handles_row_expand_contract"
|
||||
data-wpacu-area="all_styles_assets" href="#">Expand</a>
|
||||
All Assets
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div>
|
||||
<?php
|
||||
if (! empty($data['all']['styles'])) {
|
||||
?>
|
||||
<table class="wpacu_list_table wpacu_widefat wpacu_striped"
|
||||
data-wpacu-area="all_styles_assets">
|
||||
<tbody>
|
||||
<?php
|
||||
require_once __DIR__.'/_asset-style-rows.php';
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
} else {
|
||||
echo __('It looks like there are no public .css files loaded or the ones visible do not follow <a href="https://codex.wordpress.org/Function_Reference/wp_enqueue_style">the WordPress way of enqueuing styles</a>.', 'wp-asset-clean-up');
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
/*
|
||||
* -------------------
|
||||
* [END] STYLES LIST
|
||||
* -------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* ---------------------
|
||||
* [START] SCRIPTS LIST
|
||||
* ---------------------
|
||||
*/
|
||||
?>
|
||||
<div class="wpacu-assets-collapsible-wrap wpacu-wrap-area">
|
||||
<a class="wpacu-assets-collapsible <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-assets-collapsible-active<?php } ?>" href="#wpacu-assets-scripts-collapsible-content">
|
||||
<span class="dashicons dashicons-media-code"></span> <?php _e('Scripts (.js files)', 'wp-asset-clean-up'); ?> ➝ <?php esc_html_e('Total enqueued (+ core files)', 'wp-asset-clean-up'); ?>: <?php echo (int)$data['total_scripts']; ?>
|
||||
</a>
|
||||
|
||||
<div id="wpacu-assets-scripts-collapsible-content"
|
||||
class="wpacu-assets-collapsible-content <?php if ($listAreaStatus !== 'contracted') { ?>wpacu-open<?php } ?>">
|
||||
<?php if (! 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_scripts_assets" href="#">Contract</a>
|
||||
|
|
||||
<a class="wpacu-area-expand-all-assets wpacu_area_handles_row_expand_contract"
|
||||
data-wpacu-area="all_scripts_assets" href="#">Expand</a>
|
||||
All Assets
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div>
|
||||
<?php
|
||||
if (! empty($data['all']['scripts'])) {
|
||||
?>
|
||||
<table class="wpacu_list_table wpacu_widefat wpacu_striped"
|
||||
data-wpacu-area="all_scripts_assets">
|
||||
<tbody>
|
||||
<?php
|
||||
require_once __DIR__.'/_asset-script-rows.php';
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
} else {
|
||||
echo __('It looks like there are no public .js files loaded or the ones visible do not follow <a href="https://codex.wordpress.org/Function_Reference/wp_enqueue_script">the WordPress way of enqueuing scripts</a>.', 'wp-asset-clean-up');
|
||||
}
|
||||
?>
|
||||
</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
|
||||
}
|
||||
|
||||
include_once __DIR__ . '/_page-options.php';
|
||||
|
||||
include '_inline_js.php';
|
||||
/*
|
||||
* -------------------
|
||||
* [END] SCRIPTS LIST
|
||||
* -------------------
|
||||
*/
|
Reference in New Issue
Block a user