first commit

This commit is contained in:
2024-11-10 21:08:49 +01:00
commit 0d932ce5ee
14455 changed files with 2567501 additions and 0 deletions

View File

@@ -0,0 +1,331 @@
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
<div id="wp-optimize-minify-advanced" class="wpo_section wpo_group">
<h3><?php _e('Minify cache information', 'wp-optimize'); ?></h3>
<div class="wpo-fieldgroup">
<p>
<?php _e('Current cache path:', 'wp-optimize'); ?>
<strong class="wpo_min_cache_path">
<?php
$cache_path = WPO_MINIFY_PHP_VERSION_MET ? WP_Optimize_Minify_Cache_Functions::cache_path() : array("cachedir" => __('none', 'wp-optimize'));
echo htmlspecialchars($cache_path['cachedir']);
?>
</strong>
</p>
<h3><?php _e('List of processed files', 'wp-optimize'); ?></h3>
<h4><?php _e('JavaScript files', 'wp-optimize'); ?></h4>
<div id="wpo_min_jsprocessed">
<ul class="processed">
<?php
$processed_js = 0;
// Some files exist
if ($files && isset($files['js']) && is_array($files['js']) && $files['js']) {
$processed_js = count($files['js']);
foreach ($files['js'] as $js_file) {
WP_Optimize()->include_template(
'minify/cached-file.php',
false,
array(
'file' => $js_file,
'minify_config' => wp_optimize_minify_config()->get(),
)
);
}
}
?>
<li class="no-files-yet<?php echo $processed_js ? ' hidden' : ''; ?>">
<span class="filename"><?php _e('There are no processed files yet.', 'wp-optimize'); ?></span>
</li>
</ul>
</div>
<h4><?php _e('CSS files', 'wp-optimize'); ?></h4>
<div id="wpo_min_cssprocessed">
<?php if ($wpo_minify_options['inline_css']) : ?>
<p><?php _e('There are no merged CSS files listed here, because you are inlining all CSS directly', 'wp-optimize'); ?></p>
<?php else : ?>
<ul class="processed">
<?php
$processed_css = 0;
if ($files && isset($files['css']) && is_array($files['css']) && $files['css']) {
$processed_css = count($files['css']);
foreach ($files['css'] as $css_file) {
WP_Optimize()->include_template(
'minify/cached-file.php',
false,
array(
'file' => $css_file,
'minify_config' => wp_optimize_minify_config()->get(),
)
);
}
}
// No files were found
?>
<li class="no-files-yet<?php echo $processed_css ? ' hidden' : ''; ?>">
<span class="filename"><?php _e('There are no processed files yet.', 'wp-optimize'); ?></span>
</li>
</ul>
<?php endif; ?>
</div>
</div>
<form method="post" action="#">
<h3><?php _e('Advanced options', 'wp-optimize'); ?></h3>
<div class="wpo-fieldgroup">
<div class="wpo-fieldgroup__subgroup">
<label for="wpo_min_cache_lifespan">
<?php _e('Cache lifespan', 'wp-optimize'); ?>
</label>
<p>
<input
name="cache_lifespan"
id="wpo_min_cache_lifespan"
class="cache_lifespan wpo-save-setting"
type="number"
min="0"
value="<?php echo intval($wpo_minify_options['cache_lifespan']);?>"
> <?php _e('days', 'wp-optimize'); ?>
</p>
<p>
<?php _e('In order to prevent broken pages when using a third party page caching, WP-Optimize keeps the stale minified cache for 30 days.', 'wp-optimize'); ?>
<br><?php _e('Enter 0 to never keep stale cache.', 'wp-optimize'); ?>
</p>
</div>
<div class="switch-container">
<label class="switch">
<input
name="debug"
id="wpo_min_enable_minify_debug"
class="debug wpo-save-setting"
type="checkbox"
value="true"
<?php checked($wpo_minify_options['debug']);?>
>
<span class="slider round"></span>
</label>
<label for="wpo_min_enable_minify_debug">
<?php _e('Enable debug mode', 'wp-optimize'); ?>
</label>
</div>
<p><?php _e('Enabling the debug mode will add various comments and show more information in the files list.', 'wp-optimize'); ?> <?php _e('It also adds extra actions in the status tab.', 'wp-optimize'); ?></p>
</div>
<h3><?php _e('Default exclusions', 'wp-optimize'); ?></h3>
<div class="wpo-fieldgroup">
<div class="switch-container">
<label class="switch">
<input
name="edit_default_exclutions"
id="wpo_min_edit_default_exclutions"
class="debug wpo-save-setting"
type="checkbox"
value="true"
<?php checked($wpo_minify_options['edit_default_exclutions']);?>
>
<span class="slider round"></span>
</label>
<label for="wpo_min_edit_default_exclutions">
<?php _e('Edit default exclusions', 'wp-optimize'); ?>
</label>
</div>
<p><?php _e('By default, WP-Optimize excludes a list of files that are known to cause problems when minified or combined.'); ?>
<?php _e('Enable this option to see or edit those files.'); ?></p>
<div class="wpo-minify-default-exclusions<?php echo $wpo_minify_options['edit_default_exclutions'] ? '' : ' hidden'; ?>">
<h3><?php _e('Known incompatible files', 'wp-optimize'); ?></h3>
<fieldset>
<label for="ignore_list">
<?php _e('List of files that can\'t or shouldn\'t be minified or merged.', 'wp-optimize'); ?>
<?php _e('Do not edit this if you are not sure what it is.', 'wp-optimize'); ?>
<br><?php _e('Tick the checkbox to merge / minify the corresponding file anyways.', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('Files that have been consistently reported by other users to cause trouble when merged', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span> </span>
</label>
<?php
$user_excluded_ignorelist_items = is_array($wpo_minify_options['ignore_list']) ? $wpo_minify_options['ignore_list'] : array();
if (empty($default_ignore)) {
echo '<p>'.__('Refresh the page to see the list', 'wp-optimize').'</p>';
} else {
foreach ($default_ignore as $ignore_item) {
?>
<label class="ignore-list-item"><input type="checkbox" name="ignore_list[]" value="<?php echo esc_attr($ignore_item); ?>"<?php checked(in_array($ignore_item, $user_excluded_ignorelist_items)); ?>><span class="ignore-item"><?php echo $ignore_item; ?></span></label>
<?php
}
}
?>
</fieldset>
<h3><?php _e('IE incompatible files', 'wp-optimize'); ?></h3>
<fieldset>
<label for="blacklist">
<?php _e('List of excluded files used for IE compatibility.', 'wp-optimize'); ?>
<?php _e('Do not edit this if you are not sure what it is.', 'wp-optimize'); ?>
<br><?php _e('Tick the checkbox to merge / minify the corresponding file anyways.', 'wp-optimize'); ?>
</label>
<?php
$user_excluded_blacklist_items = is_array($wpo_minify_options['blacklist']) ? $wpo_minify_options['blacklist'] : array();
if (empty($default_ie_blacklist)) {
echo '<p>'.__('Refresh the page to see the list', 'wp-optimize').'</p>';
} else {
foreach ($default_ie_blacklist as $blacklist_item) {
?>
<label class="black-list-item"><input type="checkbox" name="blacklist[]" value="<?php echo esc_attr($blacklist_item); ?>"<?php checked(in_array($blacklist_item, $user_excluded_blacklist_items)); ?>><span class="ignore-item"><?php echo $blacklist_item; ?></span></label>
<?php
}
}
?>
</fieldset>
</div>
</div>
<?php if (WP_OPTIMIZE_SHOW_MINIFY_ADVANCED) : ?>
<div class="wpo-fieldgroup">
<fieldset>
<br />
<label for="enabled_css_preload">
<input
name="enabled_css_preload"
type="checkbox"
id="enabled_css_preload"
value="1"
<?php echo checked($wpo_minify_options['enabled_css_preload']); ?>
>
<?php _e('Enable WP-O Minify CSS files preloading', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('Automatically create HTTP headers for WP-O Minify-generated CSS files (when not inlined)', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span> </span>
</label>
<br />
<label for="enabled_js_preload">
<input
name="enabled_js_preload"
type="checkbox"
id="enabled_js_preload"
value="1"
<?php echo checked($wpo_minify_options['enabled_js_preload']); ?>
>
<?php _e('Enable WP-O Minify JavaScript files Preload', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('Automatically create HTTP headers for WP-O Minify-generated JS files', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span> </span>
</label>
</fieldset>
</div>
<h3 class="title">
<?php _e('HTTP Headers', 'wp-optimize'); ?>
</h3>
<p class="wpo_min-bold-green">
<?php _e('Preconnect Headers: This will add link headers to your HTTP response to instruct the browser to preconnect to other domains (e.g.: fonts, images, videos, etc)', 'wp-optimize'); ?>
</p>
<p class="wpo_min-bold-green">
<?php _e('Preload Headers: Use this for preloading specific, high priority resources that exist across all of your pages.', 'wp-optimize'); ?>
</p>
<p class="wpo_min-bold-green">
<?php _e('Note: Some servers do not support http push or headers. If you get a server error: a) rename the plugin directory via (S)FTP or your hosting control panel, b) go to your plugins page (plugin will be disabled on access), c) rename it back and d) activate it back (reset to default settings).', 'wp-optimize'); ?>
</p>
<h3><?php _e('Preconnect Headers', 'wp-optimize'); ?></h3>
<div class="wpo-fieldgroup">
<fieldset>
<legend class="screen-reader-text">
<?php _e('Preconnect', 'wp-optimize'); ?>
</legend>
<label for="hpreconnect">
<span class="wpo_min-label-pad">
<?php _e('Use only the strictly minimum necessary domain names, (CDN or frequent embeds):', 'wp-optimize'); ?>
</span>
</label>
<textarea
name="hpreconnect"
rows="7"
cols="50"
id="hpreconnect"
class="large-text code"
placeholder="https://cdn.example.com"
disabled
><?php echo esc_textarea($wpo_minify_options['hpreconnect']); ?></textarea>
<p>
<?php _e('Use the complete scheme (http:// or https://) followed by the domain name only (no file paths).', 'wp-optimize'); ?>
</p>
<p>
<?php _e('Examples: https://fonts.googleapis.com, https://fonts.gstatic.com', 'wp-optimize'); ?>
</p>
</fieldset>
</div>
<h3><?php _e('External URLs to merge', 'wp-optimize'); ?></h3>
<div class="wpo-fieldgroup">
<fieldset>
<label for="merge_allowed_urls">
<?php _e('List of external domains that can be fetched and merged:', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('Add any external "domain" for JavaScript or CSS files that can be fetched and merged by WP-Optimize, e.g.: cdnjs.cloudflare.com', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span> </span>
</label>
<textarea
name="merge_allowed_urls"
rows="7"
cols="50"
id="merge_allowed_urls"
class="large-text code"
placeholder="<?php esc_attr_e('e.g.: example.com', 'wp-optimize'); ?>"
><?php echo esc_textarea($wpo_minify_options['merge_allowed_urls']); ?></textarea>
</fieldset>
</div>
<h1><?php _e('CDN Options', 'wp-optimize'); ?></h1>
<p class="wpo_min-bold-green">
<?php printf(__('When the "Enable defer on processed JavaScript files" option is enabled, JavaScript and CSS files will not be loaded from the CDN due to %scompatibility%s reasons.', 'wp-optimize'), '<a target="_blank" href="https://www.chromestatus.com/feature/5718547946799104">', '</a>'); ?>
<?php _e('However, you can define a CDN Domain below, in order to use it for all of the static assets "inside" your CSS and JS files.', 'wp-optimize'); ?>
</p>
<h3><?php _e('Your CDN domain', 'wp-optimize'); ?></h3>
<div class="wpo-fieldgroup">
<fieldset>
<label for="cdn_url">
<p>
<input
type="text"
name="cdn_url"
id="cdn_url"
value="<?php echo isset($wpo_minify_options['cdn_url']) ? esc_attr($wpo_minify_options['cdn_url']) : ''; ?>"
size="80"
/>
</p>
<p>
<?php _e('Will rewrite the static assets urls inside WP-O Minify-merged files to your CDN domain. Usage: cdn.example.com', 'wp-optimize'); ?>
</p>
</label>
</fieldset>
</div>
<h3><?php _e('Force the CDN Usage', 'wp-optimize'); ?></h3>
<div class="wpo-fieldgroup">
<p class="wpo_min-bold-green wpo_min-rowintro">
<?php _e('If you force this, your JS files may not load for certain slow internet users on Google Chrome.', 'wp-optimize'); ?>
</p>
<fieldset>
<label for="cdn_force">
<input
name="cdn_force"
type="checkbox"
id="cdn_force"
value="1"
<?php echo checked($wpo_minify_options['cdn_force']); ?>
>
<?php _e('I know what I\'m doing...', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('Load my JS files from the CDN, even when "defer for Pagespeed Insights" is enabled', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span> </span>
</label>
</fieldset>
</div>
<?php endif; ?>
<p class="submit">
<input
class="wp-optimize-save-minify-settings button button-primary"
type="submit"
value="<?php esc_attr_e('Save settings', 'wp-optimize'); ?>"
>
<img class="wpo_spinner" src="<?php echo esc_attr(admin_url('images/spinner-2x.gif')); ?>" alt="...">
<span class="save-done dashicons dashicons-yes display-none"></span>
</p>
<input type="hidden" name="minify_advanced_tab" value="1">
</form>
</div>

View File

@@ -0,0 +1,14 @@
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
<h3><?php _e('Preload key requests / assets', 'wp-optimize'); ?></h3>
<div class="wpo-fieldgroup">
<p class="wpo_min-bold-green wpo_min-rowintro">
<?php _e('Preload critical assets to improve loading speed.', 'wp-optimize'); ?>
<a href="https://getwpo.com/faqs/preload-critical-assets/"><?php _e('Learn more about preloading key requests.', 'wp-optimize'); ?></a>
</p>
<fieldset>
<legend class="screen-reader-text">
<?php _e('Preload key requests', 'wp-optimize'); ?>
</legend>
<p><strong><?php _e('Preload key requests is a premium feature.', 'wp-optimize'); ?></strong> <a href="<?php echo esc_url(WP_Optimize()->premium_version_link); ?>"><?php _e('Find out more here.', 'wp-optimize'); ?></a></p>
</fieldset>
</div>

View File

@@ -0,0 +1,33 @@
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
<?php
if (isset($log->error)) {
?>
<div class="wpo_min_file_error"><?php echo wp_kses_post($log->error); ?></div>
<?php
return;
}
?>
<h5><?php echo esc_html($log->header); ?></h5>
<ul><?php
foreach ((array) $log->files as $handle => $file) {
$file_path = untrailingslashit(get_home_path()) . $file->url;
$file_size = file_exists($file_path) ? ' (' . WP_Optimize()->format_size(@filesize($file_path)) . ')' : ''; // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
echo '<li'.($file->success ? '' : ' class="failed"').'><span class="wpo_min_file_url"><a href="'.esc_url(get_home_url().$file->url).'" target="_blank">'.htmlspecialchars($file->url).'</a>'.$file_size.'</span>';
if (property_exists($file, 'debug')) echo '<span class="wpo_min_file_debug">'.htmlspecialchars($file->debug).'</span>';
echo ' <span class="wrapper">';
printf(' <a href="#" data-url="%1$s" class="exclude">%2$s</a>', htmlspecialchars($file->url), __('Exclude', 'wp-optimize'));
if (preg_match('/\.js$/i', $file->url, $matches)) {
if ('individual' === $minify_config['enable_defer_js']) {
printf(' | <a href="#" data-url="%1$s" class="defer">%2$s</a>', htmlspecialchars($file->url), __('Defer loading', 'wp-optimize'));
}
} elseif (preg_match('/\.css$/i', $file->url, $matches)) {
printf(' | <a href="#" data-url="%1$s" class="async">%2$s</a>', htmlspecialchars($file->url), __('Load asynchronously', 'wp-optimize'));
}
echo '</span></li>';
}
?>
</ul>

View File

@@ -0,0 +1,22 @@
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
<li id="<?php echo $file['uid']; ?>">
<span class="filename"><a href="<?php echo esc_url($file['file_url']); ?>" target="_blank"><?php echo htmlspecialchars($file['filename']); ?></a> (<?php echo $file['fsize']; ?>)</span>
<a href="#" class="log"><?php _e('Show information', 'wp-optimize'); ?></a>
<a href="#" class="delete-file" data-filename='<?php echo esc_attr($file['filename']); ?>'><?php _e('Delete', 'wp-optimize'); ?></a>
<div class="hidden save_notice">
<p><?php _e('The file was added to the list', 'wp-optimize'); ?></p>
<p><button class="button button-primary save-exclusions"><?php _e('Save the changes', 'wp-optimize'); ?></button></p>
</div>
<div class="hidden wpo_min_log"><?php
if ($file['log']) {
WP_Optimize()->include_template(
'minify/cached-file-log.php',
false,
array(
'log' => $file['log'],
'minify_config' => $minify_config,
)
);
}
?></div>
</li>

View File

@@ -0,0 +1,179 @@
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
<div class="wpo_section wpo_group">
<div id="wpo_settings_warnings"></div>
<form>
<h3><?php _e('CSS options', 'wp-optimize'); ?></h3>
<div class="wpo-fieldgroup">
<fieldset>
<label for="enable_css_minification">
<input
name="enable_css_minification"
type="checkbox"
id="enable_css_minification"
value="1"
<?php echo checked($wpo_minify_options['enable_css_minification']); ?>
>
<?php _e('Enable minification of CSS files', 'wp-optimize'); ?>
</label>
<label for="enable_merging_of_css">
<input
name="enable_merging_of_css"
type="checkbox"
id="enable_merging_of_css"
value="1"
<?php echo checked($wpo_minify_options['enable_merging_of_css']); ?>
>
<?php _e('Enable merging of CSS files', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php _e('If some of the design is breaking on the frontend, disabling merging of CSS might fix the issues.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span> </span>
</label>
<label for="inline_css">
<input
name="inline_css"
type="checkbox"
id="inline_css"
value="1"
<?php echo checked($wpo_minify_options['inline_css']); ?>
>
<?php _e('Inline CSS', 'wp-optimize'); ?> - <?php _e('Recommended if the CSS files are small enough.', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php _e('When enabled, small CSS files will be inlined.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span> </span>
</label>
<label for="remove_print_mediatypes">
<input
name="remove_print_mediatypes"
type="checkbox"
id="remove_print_mediatypes"
value="1"
<?php echo checked($wpo_minify_options['remove_print_mediatypes']); ?>
>
<?php _e('Strip the "print" related stylesheets', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip='<?php _e('When selected, any CSS files with the media type "print" will be removed.', 'wp-optimize');?> <?php _e('Enable if your site does not need specific print styles.', 'wp-optimize');?>'><span class="dashicons dashicons-editor-help"></span> </span>
</label>
<?php if (WP_OPTIMIZE_SHOW_MINIFY_ADVANCED) : ?>
<label for="remove_css">
<input
name="remove_css"
type="checkbox"
id="remove_css"
value="1"
<?php echo checked($wpo_minify_options['remove_css']); ?>
>
<?php _e('Dequeue all CSS files', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php _e('This is useful if you want to test your critical path CSS', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span> </span>
</label>
<?php endif; ?>
</fieldset>
</div>
<h3><?php _e('Exclude the following CSS files from processing', 'wp-optimize'); ?></h3>
<div class="wpo-fieldgroup">
<fieldset>
<label class="wpo-label__bold" for="exclude_css">
<?php _e('Any CSS files that match the paths below will be completely ignored.', 'wp-optimize'); ?>
<br/><?php _e('Use this if you are having issues with a specific CSS file', 'wp-optmize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('Any file present here will be loaded normally by WordPress', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
<textarea
name="exclude_css"
rows="7" cols="50"
id="exclude_css"
class="large-text code"
placeholder="<?php esc_attr_e('e.g.: /bootstrap.css', 'wp-optimize'); ?>"
><?php echo esc_textarea($wpo_minify_options['exclude_css']);?></textarea>
<br>
<?php _e('Some files known for causing issues when combined / minified are excluded by default.', 'wp-optimize'); ?> <?php _e('You can see / edit them in the Advanced tab.', 'wp-optimize'); ?>
</fieldset>
</div>
<h3><?php _e('Load the following CSS files asynchronously', 'wp-optimize'); ?></h3>
<div class="wpo-fieldgroup">
<fieldset>
<label class="wpo-label__bold" for="async_css">
<?php _e('Any CSS files that match the paths below will be loaded asynchronously.', 'wp-optimize'); ?><br>
<?php _e('Use this if you have a completely independent stylesheet', 'wp-optmize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e("e.g. You may want to exclude 'fontawesome' or other libraries from the initial load", 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
<textarea
name="async_css"
rows="7"
cols="50"
id="async_css"
class="large-text code"
placeholder="<?php esc_attr_e('e.g.: /wp-content/themes/my-theme/css/custom-font.css', 'wp-optimize'); ?>"
><?php echo esc_textarea($wpo_minify_options['async_css']); ?></textarea>
<label for="exclude_css_from_page_speed_tools">
<input
name="exclude_css_from_page_speed_tools"
type="checkbox"
id="exclude_css_from_page_speed_tools"
value="1"
<?php echo checked($wpo_minify_options['exclude_css_from_page_speed_tools']); ?>
>
<?php _e('Exclude stylesheets from page speed tests (PageSpeed Insights, GTMetrix...)', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('Use this only for testing purpose to find out which stylesheets are slowing down your site.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
</fieldset>
</div>
<?php if (WP_OPTIMIZE_SHOW_MINIFY_ADVANCED) : ?>
<h3><?php _e('Enable asynchronous CSS', 'wp-optimize'); ?></h3>
<div class="wpo-fieldgroup">
<fieldset>
<label for="loadcss">
<input
name="loadcss"
type="checkbox"
id="loadcss"
value="1"
<?php echo checked($wpo_minify_options['loadcss']); ?>
>
<?php _e('Load all CSS files asynchronously', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php _e('Note that inline CSS won\'t work if this is active', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span> </span>
</label>
<p>
<?php _e('If you have multiple css files per media type, they may load out of order and break your design when loaded asynchronously.', 'wp-optimize'); ?>
</p>
</fieldset>
</div>
<?php endif; ?>
<?php if (WP_OPTIMIZE_SHOW_MINIFY_ADVANCED) : ?>
<h3>
<?php _e('Critical path CSS', 'wp-optimize'); ?>
</h3>
<div class="wpo-fieldgroup">
<fieldset>
<label class="wpo-label__bold" for="critical_path_css"><?php _e('Fallback CSS', 'wp-optimize'); ?></label>
<textarea
name="critical_path_css"
rows="7"
cols="50"
id="critical_path_css" class="large-text code"
placeholder=".css-code { display: block; }"
><?php echo esc_textarea($wpo_minify_options['critical_path_css']); ?></textarea>
</fieldset>
<fieldset>
<label class="wpo-label__bold" for="critical_path_css_is_front_page"><?php _e('is_front_page (conditional)', 'wp-optimize'); ?> <span tabindex="0" data-tooltip="<?php esc_attr_e('This will be inlined after the above if your page matches the WP conditional is_front_page()', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span></label>
<textarea
name="critical_path_css_is_front_page"
rows="7"
cols="50"
id="critical_path_css_is_front_page"
class="large-text code"
placeholder=".css-code { display: block; }"
><?php echo esc_textarea($wpo_minify_options['critical_path_css_is_front_page']); ?></textarea>
</fieldset>
</div>
<?php endif; ?>
<p class="submit">
<input
class="wp-optimize-save-minify-settings button button-primary"
type="submit"
value="<?php esc_attr_e('Save settings', 'wp-optimize'); ?>"
>
<img class="wpo_spinner" src="<?php echo esc_attr(admin_url('images/spinner-2x.gif')); ?>" alt="...">
<span class="save-done dashicons dashicons-yes display-none"></span>
</p>
</form>
</div>

View File

@@ -0,0 +1,146 @@
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
<div class="wpo_section wpo_group">
<form>
<div id="wpo_settings_warnings"></div>
<h3><?php _e('Google Fonts', 'wp-optimize'); ?></h3>
<div class="wpo-fieldgroup">
<fieldset>
<?php if (WP_OPTIMIZE_SHOW_MINIFY_ADVANCED) : ?>
<label for="merge_google_fonts">
<input
name="merge_google_fonts"
type="checkbox"
id="merge_google_fonts"
value="1"
<?php echo checked($wpo_minify_options['merge_google_fonts']); ?>
>
<?php _e('Merge fonts from Google Fonts into one request', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php _e('This improves speed when loading multiple fonts from Google Fonts.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
<?php endif; ?>
<label for="remove_googlefonts">
<input
name="remove_googlefonts"
type="checkbox"
id="remove_googlefonts"
value="1"
<?php echo checked($wpo_minify_options['remove_googlefonts']); ?>
>
<?php _e('Do not load Google Fonts', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php _e('If enabled, stylesheets from Google Fonts will not be loaded on the site and system fallback fonts will be used instead.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
<label for="enable_display_swap">
<input
name="enable_display_swap"
type="checkbox"
id="enable_display_swap"
value="1"
<?php echo checked($wpo_minify_options['enable_display_swap']); ?>
>
<?php _e('Add "display=swap" to Google Fonts requests', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('This feature of Google Fonts is encouraged for better accessibility, but may result in a visible font change.', 'wp-optimize'); ?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
</fieldset>
<p class="wpo_min-bold-green wpo_min-rowintro">
<?php _e('Choose how to include fonts from Google Fonts on your pages, when available:', 'wp-optimize'); ?>
</p>
<fieldset>
<label>
<input
type="radio"
name="gfonts_method"
value="inherit"
<?php echo checked('inherit' === $wpo_minify_options['gfonts_method']); ?>
>
<?php _e('Inherit from the CSS settings', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('The stylesheets will be merged or inlined.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
<label>
<input
type="radio"
name="gfonts_method"
value="inline"
<?php echo checked('inline' === $wpo_minify_options['gfonts_method']); ?>
>
<?php _e('Inline google font CSS files', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('The stylesheets will be inlined.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
<label>
<input
type="radio"
name="gfonts_method"
value="async"
<?php echo checked('async' === $wpo_minify_options['gfonts_method']); ?>
>
<?php _e('Asynchronously load CSS files from Google Fonts', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('Will use \'preload\' with LoadCSS polyfill', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
<label>
<input
type="radio"
name="gfonts_method"
value="exclude"
<?php echo checked('exclude' === $wpo_minify_options['gfonts_method']); ?>
>
<?php _e('Asynchronously load fonts from Google Fonts using JavaScript', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php _e('Use if you want to exclude the CSS from Google Fonts from performance tests.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
</fieldset>
</div>
<h3><?php _e('Font Awesome', 'wp-optimize'); ?></h3>
<div class="wpo-fieldgroup">
<p class="wpo_min-bold-green wpo_min-rowintro">
<?php _e('Choose how to include Font Awesome (only available if it has \'font-awesome\' in the url):', 'wp-optimize'); ?>
</p>
<fieldset>
<label><input
type="radio"
name="fawesome_method"
value="inherit"
<?php echo checked('inherit' === $wpo_minify_options['fawesome_method']); ?>
>
<?php _e('Inherit from the CSS settings', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('The stylesheets will be merged or inlined.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
<label><input
type="radio"
name="fawesome_method"
value="inline"
<?php echo checked('inline' === $wpo_minify_options['fawesome_method']); ?>
>
<?php _e('Inline the Font Awesome CSS file', 'wp-optimize'); ?>
</label>
<label>
<input
type="radio"
name="fawesome_method"
value="async"
<?php echo checked('async' === $wpo_minify_options['fawesome_method']); ?>
>
<?php _e('Asynchronously load the Font Awesome CSS file', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php _e('Will use \'preload\' with LoadCSS polyfill', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
<label><input
type="radio"
name="fawesome_method"
value="exclude"
<?php echo checked('exclude' === $wpo_minify_options['fawesome_method']); ?>
>
<?php _e('Asynchronously load the Font Awesome stylesheet using JavaScript', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php _e('Use if you want to exclude Font Awesome from page speed tests (PageSpeed Insights, GTMetrix...)', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
</fieldset>
</div>
<p class="submit">
<input
class="wp-optimize-save-minify-settings button button-primary"
type="submit"
value="<?php esc_attr_e('Save settings', 'wp-optimize'); ?>"
>
<img class="wpo_spinner" src="<?php echo esc_attr(admin_url('images/spinner-2x.gif')); ?>" alt="...">
<span class="save-done dashicons dashicons-yes display-none"></span>
</p>
</form>
</div>

View File

@@ -0,0 +1,7 @@
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
<div class="wpo_section wpo_group<?php echo (!$wpo_minify_options['html_minification']) ? ' wpo-feature-is-disabled' : ''; ?>">
<div id="wpo_settings_warnings"></div>
<div class="wpo-fieldgroup wpo-show">
</div>
</div>

View File

@@ -0,0 +1,170 @@
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
<div class="wpo_section wpo_group">
<div id="wpo_settings_warnings"></div>
<form>
<h3><?php _e('JavaScript options', 'wp-optimize'); ?></h3>
<div class="wpo-fieldgroup">
<fieldset>
<label for="enable_js_minification">
<input
name="enable_js_minification"
type="checkbox"
id="enable_js_minification"
value="1"
<?php echo checked($wpo_minify_options['enable_js_minification']); ?>
>
<?php _e('Enable minification of JavaScript files', 'wp-optimize'); ?>
</label>
<label for="enable_merging_of_js">
<input
name="enable_merging_of_js"
type="checkbox"
id="enable_merging_of_js"
value="1"
<?php echo checked($wpo_minify_options['enable_merging_of_js']); ?>
>
<?php _e('Enable merging of JavaScript files', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php _e('If some functionality is breaking on the frontend, disabling merging of JavaScript might fix the issues.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span> </span>
</label>
<label for="enable_js_trycatch">
<input
name="enable_js_trycatch"
type="checkbox"
id="enable_js_trycatch"
value="1"
<?php echo checked($wpo_minify_options['enable_js_trycatch']); ?>
>
<?php _e('Contain each included file in its own block', 'wp-optimize'); ?>
<em><?php _e('(enable if trying to isolate a JavaScript error introduced by minifying or merging)', 'wp-optimize'); ?></em>
<span tabindex="0" data-tooltip="<?php esc_attr_e('When enabled, the content of each JavaScript file that is combined will be wrapped in its own "try / catch" statement. This means that if one file has an error, it should not impede execution of other, independent files.', 'wp-optimize'); ?>"><span class="dashicons dashicons-editor-help"></span> </span>
</label>
</fieldset>
</div>
<h3><?php _e('Exclude JavaScript from processing', 'wp-optimize'); ?></h3>
<div class="wpo-fieldgroup">
<fieldset>
<label for="exclude_js">
<?php _e('Any JavaScript files that match the paths below will be completely ignored', 'wp-optmize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('Use this if you are having issues with a certain JavaScript file.', 'wp-optmize'); ?> <?php esc_attr_e('Any file present here will be loaded normally by WordPress', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
<textarea
name="exclude_js"
rows="7" cols="50"
id="exclude_js"
class="large-text code"
placeholder="<?php esc_attr_e('e.g.: /wp-includes/js/jquery/jquery.js', 'wp-optimize'); ?>"
><?php echo esc_textarea($wpo_minify_options['exclude_js']);?></textarea>
<br>
<?php _e('Some files known for causing issues when combined / minified are excluded by default.', 'wp-optimize'); ?> <?php _e('You can see / edit them in the Advanced tab.', 'wp-optimize'); ?>
</fieldset>
</div>
<h3><?php _e('Defer JavaScript', 'wp-optimize'); ?></h3>
<div class="wpo-fieldgroup">
<fieldset class="async-js-manual-list">
<h4><label>
<input
name="enable_defer_js"
type="radio"
value="individual"
<?php echo checked($wpo_minify_options['enable_defer_js'], 'individual'); ?>
>
<?php _e('Asynchronously load selected JavaScript files', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('The files in the list will be loaded asynchronously, and will not be minified or merged.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
</h4>
<div class="defer-js-settings">
<label for="async_js">
<?php _e('Any JavaScript files that match the paths below will be loaded asynchronously.', 'wp-optmize'); ?>
<br/>
<?php _e('Use this if you have a completely independent script', 'wp-optmize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('Independent scripts are for example \'analytics\' or \'pixel\' scripts. They are not required for the website to work', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
<textarea
name="async_js"
rows="7"
cols="50"
id="async_js"
class="large-text code"
placeholder="<?php esc_attr_e('e.g.: /js/main.js', 'wp-optimize'); ?>"
><?php echo esc_textarea($wpo_minify_options['async_js']); ?></textarea>
<label for="exclude_js_from_page_speed_tools">
<input
name="exclude_js_from_page_speed_tools"
type="checkbox"
id="exclude_js_from_page_speed_tools"
value="1"
<?php echo checked($wpo_minify_options['exclude_js_from_page_speed_tools']); ?>
>
<?php _e('Exclude scripts from page speed tests (PageSpeed Insights, GTMetrix...)', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('Use this only for testing purpose to find out which scripts are slowing down your site.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
</div>
</fieldset>
<fieldset>
<h4>
<label>
<input
name="enable_defer_js"
type="radio"
value="all"
<?php echo checked($wpo_minify_options['enable_defer_js'], 'all'); ?>
>
<?php _e('Defer all the JavaScript files', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('All files - including the ones processed by WP-Optimize - will be deferred, except the ones in the exclusion list above.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
</h4>
<div class="defer-js-settings">
<div class="notice notice-warning below-h2">
<p class="wpo_min-bold-green wpo_min-rowintro">
<?php _e('Some themes and plugins need render blocking scripts to work.', 'wp-optimize'); ?> <?php _e('Please check the browser console for any eventual JavaScript errors caused by deferring the scripts.', 'wp-optimize'); ?>
</p>
</div>
<h4><?php _e('Defer method:', 'wp-optimize'); ?></h4>
<label>
<input
name="defer_js_type"
type="radio"
value="defer"
<?php echo checked($wpo_minify_options['defer_js_type'], 'defer'); ?>
>
<?php _e('Use the "defer" html attribute', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('Supported by all modern browsers.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
<label>
<input
name="defer_js_type"
type="radio"
value="async_using_js"
<?php echo checked($wpo_minify_options['defer_js_type'], 'async_using_js'); ?>
>
<?php _e('Defer using JavaScript', 'wp-optimize'); ?>
<em><?php printf(__('(Asynchronous loading. Use this method if you require support for %solder browsers%s).', 'wp-optimize'), '<a href="https://www.w3schools.com/tags/att_script_defer.asp" target="_blank">', '</a>');?></em>
</label>
<label for="defer_jquery">
<input
name="defer_jquery"
type="checkbox"
id="defer_jquery"
value="1"
<?php echo checked($wpo_minify_options['defer_jquery']); ?>
>
<?php _e('Defer jQuery', 'wp-optimize'); ?> <em><?php _e('(Note that as jQuery is a common dependency, it probably needs to be loaded synchronously).', 'wp-optimize'); ?></em>
<span tabindex="0" data-tooltip="<?php esc_attr_e('Disable this setting if you have an error \'jQuery undefined\'.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
</div>
</fieldset>
</div>
<p class="submit">
<input
class="wp-optimize-save-minify-settings button button-primary"
type="submit"
value="<?php esc_attr_e('Save settings', 'wp-optimize'); ?>"
>
<img class="wpo_spinner" src="<?php echo esc_attr(admin_url('images/spinner-2x.gif')); ?>" alt="...">
<span class="save-done dashicons dashicons-yes display-none"></span>
</p>
</form>
</div>

View File

@@ -0,0 +1,32 @@
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
<div class="wpo_section wpo_group">
<form>
<?php if ($is_cache_enabled) : ?>
<div id="minify-preload" class="notice notice-warning wpo-warning below-h2 wp-optimize-minify-status-information-notice wpo-show">
<p>
<span class="dashicons dashicons-info"></span>
<?php printf(__('You are using WP-Optimize for page caching. Because of that, the pre-load settings used for page-caching are used. i.e. To configure pre-loading, go to the <a href="%s">settings in the caching section</a> instead.', 'wp-optimize'), admin_url('admin.php?page=wpo_cache&tab=wp_optimize_preload'), __('Cache Preload', 'wp-optimize')); ?><br>
</p>
</div>
<?php endif; ?>
<h3 class="wpo-first-child"><?php _e('Preload now', 'wp-optimize'); ?></h3>
<div class="wpo-fieldgroup">
<p>
<input id="wp_optimize_run_minify_preload"
class="button button-primary" type="submit"
name="wp_optimize_run_minify_preload"
value="<?php echo $is_running ? esc_attr__('Cancel', 'wp-optimize') : esc_attr__('Run now', 'wp-optimize'); ?>"
<?php echo $is_running ? 'data-running="1"' : ''; ?>
<?php echo $is_cache_enabled ? "disabled" : ""; ?>
>
<span id="wp_optimize_preload_minify_status"><?php
echo htmlspecialchars($status_message);
?></span>
</p>
<span>
<?php _e('This action will trigger WP-Optimize to generate minify assets by visiting pages to preload them (so that they are ready the first time a human visitor wants them).', 'wp-optimize'); ?>
<?php _e('If a sitemap is available, then it will be used to determine which assets get minified.', 'wp-optimize'); ?>
</span>
</div>
</form>
</div>

View File

@@ -0,0 +1,114 @@
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
<div class="wpo_section wpo_group">
<form id="wpo_minify_settings_form">
<div id="wpo_settings_warnings"></div>
<h3><?php _e('Miscellaneous', 'wp-optimize'); ?></h3>
<div class="wpo-fieldgroup">
<fieldset>
<label for="merge_inline_extra_css_js">
<input
name="merge_inline_extra_css_js"
type="checkbox"
id="merge_inline_extra_css_js"
value="1"
<?php echo checked($wpo_minify_options['merge_inline_extra_css_js']);?>
>
<?php _e('Merge inline extra css and javascript', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('Inline JavaScript and CSS that should come before or after other enqueued files will be merged.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
<label for="disable_when_logged_in">
<input
name="disable_when_logged_in"
type="checkbox"
id="disable_when_logged_in"
value="1"
<?php echo checked($wpo_minify_options['disable_when_logged_in']);?>
>
<?php _e('Disable Minify for logged-in users', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('HTML, JavaScript and CSS will be loaded normally by WordPress.', 'wp-optimize');?> <?php esc_attr_e('Useful for debugging or to improve compatibility with some visual editors.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
<label for="clean_header_one">
<input
name="clean_header_one"
type="checkbox"
id="clean_header_one"
value="1"
<?php echo checked($wpo_minify_options['clean_header_one']); ?>
>
<?php _e('Remove meta information from page header', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('Remove resource hints, generator tag, shortlinks, manifest link, etc.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
<label for="emoji_removal">
<input
name="emoji_removal"
type="checkbox"
id="emoji_removal"
class="jsprocessor"
value="1"
<?php echo checked($wpo_minify_options['emoji_removal']); ?>
>
<?php _e('Remove default WordPress and TinyMCE icons', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('When selected, the site will use the device\'s built in Emoji', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
</fieldset>
</div>
<h3><?php _e('SSL options', 'wp-optimize'); ?></h3>
<div class="wpo-fieldgroup">
<p class="wpo_min-bold-green wpo_min-rowintro">
<?php _e('Force HTTP or HTTPS on the assets generated by WP-Optimize Minify.', 'wp-optimize'); ?>
<?php _e('You may need it for some CDN plugins to work:', 'wp-optimize'); ?>
</p>
<fieldset>
<label>
<input
type="radio"
name="default_protocol"
value="dynamic"
<?php checked('dynamic' === $wpo_minify_options['default_protocol']); ?>
>
<?php _e('Same as home URL', 'wp-optimize'); ?> (<?php printf(__('Currently: %s', 'wp-optimize'), $default_protocol);?>)
<span tabindex="0" data-tooltip="<?php esc_attr_e('Uses your site\'s default protocol.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
<label>
<input
type="radio"
name="default_protocol"
value="http"
<?php checked('http' === $wpo_minify_options['default_protocol']); ?>
>
<?php _e('Force HTTP', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('If you do not have SSL', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
<label>
<input
type="radio"
name="default_protocol"
value="https"
<?php checked('https' === $wpo_minify_options['default_protocol']); ?>
>
<?php _e('Force HTTPS', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('Recommended if you have SSL', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
</label>
</fieldset>
</div>
<?php
/**
* Called before outputing the submit button in the setting fields in Minify > Advanced
*/
do_action('wpo_minify_settings_tabs', $wpo_minify_options);
?>
<p class="submit">
<input
class="wp-optimize-save-minify-settings button button-primary"
type="submit"
value="<?php esc_attr_e('Save settings', 'wp-optimize'); ?>"
>
<img class="wpo_spinner" src="<?php echo esc_attr(admin_url('images/spinner-2x.gif')); ?>" alt="...">
<span class="save-done dashicons dashicons-yes display-none"></span>
</p>
</form>
</div>

View File

@@ -0,0 +1,231 @@
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
<div id="wp-optimize-minify-status" class="wpo_section wpo_group<?php echo (!$wpo_minify_options['enabled']) ? ' wpo-feature-is-disabled' : ''; ?>">
<form>
<div class="wpo-info wpo-show">
<a class="wpo-info__trigger" href="#"><span class="dashicons dashicons-sos"></span> <?php _e('How to use the minify feature', 'wp-optimize'); ?> <span class="wpo-info__close"><?php _e('Close', 'wp-optimize'); ?></span></a>
<div class="wpo-info__content">
<p><strong><?php _e('Not sure how to use the Minify feature?', 'wp-optimize'); ?></strong> <br><?php _e('Watch our how-to video below.', 'wp-optimize'); ?></p>
<div class="wpo-video-preview">
<a href="https://vimeo.com/402556749" data-embed="https://player.vimeo.com/video/402556749?color=df6926&title=0&byline=0&portrait=0" target="_blank"><img src="<?php echo trailingslashit(WPO_PLUGIN_URL); ?>images/notices/minify-video-preview.png" alt="<?php _e('Minify video preview', 'wp-optimize');?>" /></a>
</div>
<small>(<?php _e('Loads a video hosted on vimeo.com', 'wp-optimize'); ?>) - <a href="https://vimeo.com/402556749" target="_blank"><?php _e('Open the video in a new window', 'wp-optimize'); ?></a></small>
<p><a href="<?php echo WP_Optimize()->maybe_add_affiliate_params('https://getwpo.com/faqs/category/minification/'); ?>"><?php _e('Read the documentation', 'wp-optimize'); ?></a></p>
</div>
</div>
<div id="wpo_settings_warnings"></div>
<?php if ($show_information_notice) : ?>
<div class="notice notice-warning wpo-warning is-dismissible below-h2 wp-optimize-minify-status-information-notice wpo-show">
<p>
<span class="dashicons dashicons-shield"></span>
<strong><?php _e('CSS, JavaScript and HTML minification is an advanced feature.', 'wp-optimize'); ?></strong><br>
<?php _ex('While enabling it will work just fine for most sites, it might need specific configuration to work properly on your website.', '"it" refers to the Minify feature.', 'wp-optimize'); ?><br>
<?php _ex('If you encounter an issue and are not sure what to do, disable the feature and ask for help on the support forum.', '"it" refers to the Minify feature.', 'wp-optimize'); ?>
<?php _ex('We will do our best to help you configure it.', '"it" refers to the Minify feature.', 'wp-optimize'); ?>
<a href="<?php echo WP_Optimize()->maybe_add_affiliate_params('https://getwpo.com/faqs/category/minification/'); ?>"><?php _e('Read the documentation', 'wp-optimize'); ?></a>
</p>
</div>
<?php endif; ?>
<div class="wpo-fieldgroup wpo-show">
<div class="switch-container">
<label class="switch">
<input
name="enabled"
id="wpo_min_enable_minify"
class="wpo-save-setting"
type="checkbox"
value="true"
<?php echo WPO_MINIFY_PHP_VERSION_MET ? '' : 'disabled'; ?>
<?php checked($wpo_minify_options['enabled']); ?>
>
<span class="slider round"></span>
</label>
<label for="wpo_min_enable_minify">
<?php if (WPO_MINIFY_PHP_VERSION_MET) {
_e('Enable Minify', 'wp-optimize');
} else {
echo __('The PHP version on your server is too old.', 'wp-optimize').' '.__('Update PHP to enable minification of JS, CSS and HTML on this website', 'wp-optimize');
?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('PHP version requirement (5.4 minimum) not met', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span>
<?php
}
?>
</label>
</div>
<p><?php _e('If this is turned on, then the default settings are that JavaScript and CSS on this website will be concatenated and minified and HTML will be minified.', 'wp-optimize'); ?> <?php _e('You can adjust the settings in the tabs above to control this to meet your requirements.', 'wp-optimize'); ?></p>
<?php if (!empty($active_minify_plugins)) : ?>
<div class="notice notice-error">
<p>
<?php printf(__('It looks like you already have an active minify plugin (%s) installed. Having more than one active plugin to minify front end assets might cause unexpected results and waste of resources.', 'wp-optimize'), implode(', ', $active_minify_plugins)); ?>
</p>
</div>
<?php endif; ?>
<?php if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) : ?>
<div class="notice notice-warning">
<p><span class="dashicons dashicons-info"></span> <?php printf(__('The constant %s is set to true, so no JavaScript or CSS file will be minified.', 'wp-optimize'), '<code>SCRIPT_DEBUG</code>'); ?></p>
</div>
<?php endif; ?>
<div class="wpo-minify-features">
<div class="wpo-fieldgroup__subgroup">
<div class="switch-container">
<label class="switch">
<input
name="html_minification"
id="wpo_min_enable_minify_html"
class="wpo-save-setting"
type="checkbox"
value="true"
<?php checked($wpo_minify_options['html_minification']);?>
>
<span class="slider round"></span>
</label>
<label for="wpo_min_enable_minify_html">
<?php _e('Process HTML (works only when cache pre-loading)', 'wp-optimize'); ?>
<?php // Note: the comment added by WPO regarding cacheing will not be removed (it's added later in the process) ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('All HTML will be minified. It takes effect only when cache pre-loading because it takes time.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span> </span>
</label>
</div>
</div>
<div class="wpo-fieldgroup__subgroup">
<div class="switch-container">
<label class="switch">
<input
name="enable_js"
id="wpo_min_enable_minify_js"
class="wpo-save-setting"
type="checkbox"
value="true"
data-tabname="js"
<?php checked($wpo_minify_options['enable_js']);?>
>
<span class="slider round"></span>
</label>
<label for="wpo_min_enable_minify_js">
<?php _e('Process JavaScript files', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('The JavaScript files will be combined and minified to lower the number and size of requests.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span> </span>
<a href="#" class="js--wpo-goto" data-tab="js"><?php _e('Settings', 'wp-optimize'); ?></a>
</label>
</div>
</div>
<div class="wpo-fieldgroup__subgroup">
<div class="switch-container">
<label class="switch">
<input
name="enable_css"
id="wpo_min_enable_minify_css"
class="wpo-save-setting"
type="checkbox"
value="true"
data-tabname="css"
<?php checked($wpo_minify_options['enable_css']);?>
>
<span class="slider round"></span>
</label>
<label for="wpo_min_enable_minify_css">
<?php _e('Process CSS files', 'wp-optimize'); ?>
<span tabindex="0" data-tooltip="<?php esc_attr_e('The stylesheets will be combined and minified to lower the number and size of requests.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span> </span>
<a href="#" class="js--wpo-goto" data-tab="css"><?php _e('Settings', 'wp-optimize'); ?></a>
</label>
</div>
</div>
</div>
</div>
<div class="wpo-fieldgroup">
<p class="actions">
<input
class="button button-primary purge_minify_cache <?php echo $can_purge_the_cache ? '' : 'disabled'; ?>"
type="submit"
value="<?php wp_optimize_minify_config()->always_purge_everything() ? esc_attr_e('Purge the minified files', 'wp-optimize') : esc_attr_e('Reset the minified files', 'wp-optimize'); ?>"
<?php echo WPO_MINIFY_PHP_VERSION_MET && $can_purge_the_cache ? '' : 'disabled'; ?>
/>
<img class="wpo_spinner" src="<?php echo esc_attr(admin_url('images/spinner-2x.gif')); ?>" alt="...">
<span class="save-done dashicons dashicons-yes display-none"></span>
</p>
<p>
<span><?php _e("The new minified files will be regenerated when visiting your website's pages.", 'wp-optimize'); ?> <a href="https://getwpo.com/faqs/what-does-reset-the-minified-files-actually-do/"><?php _e('Read more about what this does in our FAQs.', 'wp-optimize'); ?></a> (<?php _e('This will also purge the page cache', 'wp-optimize'); ?>)</span>
</p>
<?php if (WPO_MINIFY_PHP_VERSION_MET) : ?>
<?php _e('Minify cache size:', 'wp-optimize'); ?>
<ul class="ul-disc">
<li><?php _e('Current cache:', 'wp-optimize'); ?>
<strong id="wpo_min_cache_size">
<?php
if ($wpo_minify_options['enabled']) {
echo esc_html(WP_Optimize_Minify_Cache_Functions::get_cachestats($cache_dir));
} else {
_e('No minified files are present', 'wp-optimize');
}
?>
</strong>
<a href="#" class="js--wpo-goto" data-tab="advanced"><?php _e('View the files', 'wp-optimize'); ?></a>
</li>
<li>
<?php _e('Total cache:', 'wp-optimize'); ?>
<strong id="wpo_min_cache_total_size">
<?php
if ($wpo_minify_options['enabled']) {
echo esc_html(WP_Optimize_Minify_Cache_Functions::get_cachestats(WPO_CACHE_MIN_FILES_DIR));
} else {
_e('No minified files are present', 'wp-optimize');
}
?>
</strong>
<strong tabindex="0" data-tooltip="<?php _e('This includes the older, non-expired cache, as well as the temporary files used to generate the minified files.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></strong>
</li>
</ul>
<?php endif; ?>
<p>
<?php _e('Last Minify cache update:', 'wp-optimize'); ?>
<strong id="wpo_min_cache_time">
<?php
if (empty($wpo_minify_options['last-cache-update'])) {
_e('Never.', 'wp-optimize');
} elseif (!$wpo_minify_options['enabled']) {
echo '-';
} else {
echo WP_Optimize_Minify_Cache_Functions::format_date_time($wpo_minify_options['last-cache-update']);
}
?>
</strong>
</p>
<?php if ($wpo_minify_options['debug']) : ?>
<p class="actions">
<input
class="button minify_increment_cache"
type="button"
value="<?php esc_attr_e('Increment cache', 'wp-optimize'); ?>"
<?php echo WPO_MINIFY_PHP_VERSION_MET ? '' : 'disabled'; ?>
/>
<img class="wpo_spinner" src="<?php echo esc_attr(admin_url('images/spinner-2x.gif')); ?>" alt="...">
<span class="save-done dashicons dashicons-yes display-none"></span>
<strong tabindex="0" data-tooltip="<?php _e('This will reset the files generated by minify, but use the existing minify temporary files.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></strong>
</p>
<?php
// This is only necessary if the everything isn't purged
if (!wp_optimize_minify_config()->always_purge_everything()) :
?>
<p class="actions">
<input
class="button purge_all_minify_cache"
type="button"
value="<?php esc_attr_e('Delete all the files generated by minifcation', 'wp-optimize'); ?>"
<?php echo WPO_MINIFY_PHP_VERSION_MET ? '' : 'disabled'; ?>
/>
<img class="wpo_spinner" src="<?php echo esc_attr(admin_url('images/spinner-2x.gif')); ?>" alt="...">
<span class="save-done dashicons dashicons-yes display-none"></span>
<strong tabindex="0" data-tooltip="<?php _e('If you are using an unsupported cache plugin, then you will also need to purge your page cache when doing this.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></strong>
</p>
<?php
endif;
?>
<?php endif; ?>
</div>
</form>
</div><!-- end #wp-optimize-minify-status -->