| 1 |
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?> |
| 2 |
<div id="wp-optimize-minify-status" class="wpo_section wpo_group<?php echo (!$wpo_minify_options['enabled']) ? ' wpo-feature-is-disabled' : ''; ?>"> |
| 3 |
<form> |
| 4 |
<div class="wpo-info wpo-show"> |
| 5 |
<a class="wpo-info__trigger" href="#"><span class="dashicons dashicons-sos"></span> <?php esc_html_e('How to use the minify feature', 'wp-optimize'); ?> <span class="wpo-info__close"><?php esc_html_e('Close', 'wp-optimize'); ?></span></a> |
| 6 |
<div class="wpo-info__content"> |
| 7 |
<p><strong><?php esc_html_e('Not sure how to use the Minify feature?', 'wp-optimize'); ?></strong> <br><?php esc_html_e('Watch our how-to video below.', 'wp-optimize'); ?></p> |
| 8 |
<div class="wpo-video-preview"> |
| 9 |
<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 esc_url(trailingslashit(WPO_PLUGIN_URL) . 'images/notices/minify-video-preview.png'); ?>" alt="<?php esc_attr_e('Minify video preview', 'wp-optimize');?>"></a> |
| 10 |
</div> |
| 11 |
<small>(<?php esc_html_e('Loads a video hosted on vimeo.com', 'wp-optimize'); ?>) - <?php $wp_optimize->wp_optimize_url('https://vimeo.com/402556749', __('Open the video in a new window', 'wp-optimize')); ?></small> |
| 12 |
<p><a href="<?php echo esc_url(WP_Optimize()->maybe_add_affiliate_params('https://getwpo.com/faqs/category/minification/')); ?>"><?php esc_html_e('Read the documentation', 'wp-optimize'); ?></a></p> |
| 13 |
</div> |
| 14 |
</div> |
| 15 |
<div id="wpo_settings_warnings"></div> |
| 16 |
<?php if ($show_information_notice) : ?> |
| 17 |
<div class="notice notice-warning wpo-warning is-dismissible below-h2 wp-optimize-minify-status-information-notice wpo-show"> |
| 18 |
<p> |
| 19 |
<span class="dashicons dashicons-shield"></span> |
| 20 |
<strong><?php esc_html_e('CSS, JavaScript and HTML minification is an advanced feature.', 'wp-optimize'); ?></strong><br> |
| 21 |
<?php echo esc_html_x('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> |
| 22 |
<?php echo esc_html_x('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'); ?> |
| 23 |
<?php echo esc_html_x('We will do our best to help you configure it.', '"it" refers to the Minify feature.', 'wp-optimize'); ?> |
| 24 |
<a href="<?php echo esc_url(WP_Optimize()->maybe_add_affiliate_params('https://getwpo.com/faqs/category/minification/')); ?>"><?php esc_html_e('Read the documentation', 'wp-optimize'); ?></a> |
| 25 |
</p> |
| 26 |
</div> |
| 27 |
<?php endif; ?> |
| 28 |
<div class="wpo-fieldgroup wpo-show"> |
| 29 |
<div class="switch-container"> |
| 30 |
<label class="switch"> |
| 31 |
<input |
| 32 |
name="enabled" |
| 33 |
id="wpo_min_enable_minify" |
| 34 |
class="wpo-save-setting" |
| 35 |
type="checkbox" |
| 36 |
value="true" |
| 37 |
<?php echo WPO_MINIFY_PHP_VERSION_MET ? '' : 'disabled'; ?> |
| 38 |
<?php checked($wpo_minify_options['enabled']); ?> |
| 39 |
> |
| 40 |
<span class="slider round"></span> |
| 41 |
</label> |
| 42 |
<label for="wpo_min_enable_minify"> |
| 43 |
<?php if (WPO_MINIFY_PHP_VERSION_MET) { |
| 44 |
esc_html_e('Enable Minify', 'wp-optimize'); |
| 45 |
} else { |
| 46 |
echo esc_html__('The PHP version on your server is too old.', 'wp-optimize').' '.esc_html__('Update PHP to enable minification of JS, CSS and HTML on this website', 'wp-optimize'); |
| 47 |
?> |
| 48 |
<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> |
| 49 |
<?php |
| 50 |
} |
| 51 |
?> |
| 52 |
</label> |
| 53 |
</div> |
| 54 |
|
| 55 |
<p><?php esc_html_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 esc_html_e('You can adjust the settings in the tabs above to control this to meet your requirements.', 'wp-optimize'); ?></p> |
| 56 |
|
| 57 |
<?php if (!empty($active_minify_plugins)) : ?> |
| 58 |
<div class="notice notice-error"> |
| 59 |
<p> |
| 60 |
<?php |
| 61 |
$message = sprintf(esc_html__('It looks like you already have an active minify plugin (%s) installed.', 'wp-optimize'), implode(', ', $active_minify_plugins)); |
| 62 |
$message .= ' '; |
| 63 |
$message .= esc_html__('Having more than one active plugin to minify front end assets might cause unexpected results and waste of resources.', 'wp-optimize'); |
| 64 |
echo $message; |
| 65 |
?> |
| 66 |
</p> |
| 67 |
</div> |
| 68 |
<?php endif; ?> |
| 69 |
|
| 70 |
<?php if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) : ?> |
| 71 |
<div class="notice notice-warning"> |
| 72 |
<p><span class="dashicons dashicons-info"></span> <?php printf(esc_html__('The constant %s is set to true, so no JavaScript or CSS file will be minified.', 'wp-optimize'), '<code>SCRIPT_DEBUG</code>'); ?></p> |
| 73 |
</div> |
| 74 |
<?php endif; ?> |
| 75 |
|
| 76 |
<div class="wpo-minify-features"> |
| 77 |
|
| 78 |
<div class="wpo-fieldgroup__subgroup"> |
| 79 |
<div class="switch-container"> |
| 80 |
<label class="switch"> |
| 81 |
<input |
| 82 |
name="html_minification" |
| 83 |
id="wpo_min_enable_minify_html" |
| 84 |
class="wpo-save-setting" |
| 85 |
type="checkbox" |
| 86 |
value="true" |
| 87 |
<?php checked($wpo_minify_options['html_minification']);?> |
| 88 |
> |
| 89 |
<span class="slider round"></span> |
| 90 |
</label> |
| 91 |
<label for="wpo_min_enable_minify_html"> |
| 92 |
<?php esc_html_e('Process HTML (works only when cache pre-loading)', 'wp-optimize'); ?> |
| 93 |
<?php // Note: the comment added by WPO regarding caching will not be removed (it's added later in the process) ?> |
| 94 |
<?php |
| 95 |
$message = __('All HTML will be minified.', 'wp-optimize'); |
| 96 |
$message .= ' '; |
| 97 |
$message .= __('It takes effect only when cache pre-loading because it takes time.', 'wp-optimize'); |
| 98 |
?> |
| 99 |
<span tabindex="0" data-tooltip="<?php echo esc_attr($message);?>"><span class="dashicons dashicons-editor-help"></span> </span> |
| 100 |
</label> |
| 101 |
</div> |
| 102 |
</div> |
| 103 |
|
| 104 |
<div class="wpo-fieldgroup__subgroup"> |
| 105 |
<div class="switch-container"> |
| 106 |
<label class="switch"> |
| 107 |
<input |
| 108 |
name="enable_js" |
| 109 |
id="wpo_min_enable_minify_js" |
| 110 |
class="wpo-save-setting" |
| 111 |
type="checkbox" |
| 112 |
value="true" |
| 113 |
data-tabname="js" |
| 114 |
<?php checked($wpo_minify_options['enable_js']);?> |
| 115 |
> |
| 116 |
<span class="slider round"></span> |
| 117 |
</label> |
| 118 |
<label for="wpo_min_enable_minify_js"> |
| 119 |
<?php esc_html_e('Process JavaScript files', 'wp-optimize'); ?> |
| 120 |
<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> |
| 121 |
<a href="#" class="js--wpo-goto" data-tab="js"><?php esc_html_e('Settings', 'wp-optimize'); ?></a> |
| 122 |
</label> |
| 123 |
</div> |
| 124 |
</div> |
| 125 |
|
| 126 |
<div class="wpo-fieldgroup__subgroup"> |
| 127 |
<div class="switch-container"> |
| 128 |
<label class="switch"> |
| 129 |
<input |
| 130 |
name="enable_css" |
| 131 |
id="wpo_min_enable_minify_css" |
| 132 |
class="wpo-save-setting" |
| 133 |
type="checkbox" |
| 134 |
value="true" |
| 135 |
data-tabname="css" |
| 136 |
<?php checked($wpo_minify_options['enable_css']);?> |
| 137 |
> |
| 138 |
<span class="slider round"></span> |
| 139 |
</label> |
| 140 |
<label for="wpo_min_enable_minify_css"> |
| 141 |
<?php esc_html_e('Process CSS files', 'wp-optimize'); ?> |
| 142 |
<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> |
| 143 |
<a href="#" class="js--wpo-goto" data-tab="css"><?php esc_html_e('Settings', 'wp-optimize'); ?></a> |
| 144 |
</label> |
| 145 |
</div> |
| 146 |
</div> |
| 147 |
</div> |
| 148 |
</div> |
| 149 |
|
| 150 |
<div class="wpo-fieldgroup"> |
| 151 |
<p class="actions"> |
| 152 |
<input |
| 153 |
class="button button-primary purge_minify_cache <?php echo $can_purge_the_cache ? '' : 'disabled'; ?>" |
| 154 |
type="submit" |
| 155 |
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'); ?>" |
| 156 |
<?php echo WPO_MINIFY_PHP_VERSION_MET && $can_purge_the_cache ? '' : 'disabled'; ?> |
| 157 |
> |
| 158 |
<img class="wpo_spinner" src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); ?>" alt="..."> |
| 159 |
<span class="save-done dashicons dashicons-yes display-none"></span> |
| 160 |
</p> |
| 161 |
<p> |
| 162 |
<span><?php esc_html_e("The new minified files will be regenerated when visiting your website's pages.", "wp-optimize"); ?> <?php $wp_optimize->wp_optimize_url('https://getwpo.com/faqs/what-does-reset-the-minified-files-actually-do/', __('Read more about what this does in our FAQs.', 'wp-optimize')); ?> (<?php esc_html_e('This will also purge the page cache', 'wp-optimize'); ?>)</span> |
| 163 |
</p> |
| 164 |
<?php if (WPO_MINIFY_PHP_VERSION_MET) : ?> |
| 165 |
<?php esc_html_e('Minify cache size:', 'wp-optimize'); ?> |
| 166 |
<ul class="ul-disc"> |
| 167 |
<li><?php esc_html_e('Current cache:', 'wp-optimize'); ?> |
| 168 |
<strong id="wpo_min_cache_size"> |
| 169 |
<?php |
| 170 |
if ($wpo_minify_options['enabled']) { |
| 171 |
echo esc_html(WP_Optimize_Minify_Cache_Functions::get_cachestats($cache_dir)); |
| 172 |
} else { |
| 173 |
esc_html_e('No minified files are present', 'wp-optimize'); |
| 174 |
} |
| 175 |
?> |
| 176 |
</strong> |
| 177 |
<a href="#" class="js--wpo-goto" data-tab="advanced"><?php esc_html_e('View the files', 'wp-optimize'); ?></a> |
| 178 |
</li> |
| 179 |
<li> |
| 180 |
<?php esc_html_e('Total cache:', 'wp-optimize'); ?> |
| 181 |
<strong id="wpo_min_cache_total_size"> |
| 182 |
<?php |
| 183 |
if ($wpo_minify_options['enabled']) { |
| 184 |
echo esc_html(WP_Optimize_Minify_Cache_Functions::get_cachestats(WPO_CACHE_MIN_FILES_DIR)); |
| 185 |
} else { |
| 186 |
esc_html_e('No minified files are present', 'wp-optimize'); |
| 187 |
} |
| 188 |
?> |
| 189 |
</strong> |
| 190 |
<strong tabindex="0" data-tooltip="<?php esc_attr_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> |
| 191 |
</li> |
| 192 |
</ul> |
| 193 |
<?php endif; ?> |
| 194 |
<p> |
| 195 |
<?php esc_html_e('Last Minify cache update:', 'wp-optimize'); ?> |
| 196 |
<strong id="wpo_min_cache_time"> |
| 197 |
<?php |
| 198 |
if (empty($wpo_minify_options['last-cache-update'])) { |
| 199 |
esc_html_e('Never.', 'wp-optimize'); |
| 200 |
} elseif (!$wpo_minify_options['enabled']) { |
| 201 |
echo '-'; |
| 202 |
} else { |
| 203 |
echo esc_html(WP_Optimize_Minify_Cache_Functions::format_date_time($wpo_minify_options['last-cache-update'])); |
| 204 |
} |
| 205 |
?> |
| 206 |
</strong> |
| 207 |
</p> |
| 208 |
<?php if ($wpo_minify_options['debug']) : ?> |
| 209 |
<p class="actions"> |
| 210 |
<input |
| 211 |
class="button minify_increment_cache" |
| 212 |
type="button" |
| 213 |
value="<?php esc_attr_e('Increment cache', 'wp-optimize'); ?>" |
| 214 |
<?php echo WPO_MINIFY_PHP_VERSION_MET ? '' : 'disabled'; ?> |
| 215 |
> |
| 216 |
<img class="wpo_spinner" src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); ?>" alt="..."> |
| 217 |
<span class="save-done dashicons dashicons-yes display-none"></span> |
| 218 |
<strong tabindex="0" data-tooltip="<?php esc_attr_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> |
| 219 |
</p> |
| 220 |
<?php |
| 221 |
// This is only necessary if the everything isn't purged |
| 222 |
if (!wp_optimize_minify_config()->always_purge_everything()) : |
| 223 |
?> |
| 224 |
<p class="actions"> |
| 225 |
<input |
| 226 |
class="button purge_all_minify_cache" |
| 227 |
type="button" |
| 228 |
value="<?php esc_attr_e('Delete all the files generated by minifcation', 'wp-optimize'); ?>" |
| 229 |
<?php echo WPO_MINIFY_PHP_VERSION_MET ? '' : 'disabled'; ?> |
| 230 |
> |
| 231 |
<img class="wpo_spinner" src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); ?>" alt="..."> |
| 232 |
<span class="save-done dashicons dashicons-yes display-none"></span> |
| 233 |
<strong tabindex="0" data-tooltip="<?php esc_attr_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> |
| 234 |
</p> |
| 235 |
<?php |
| 236 |
endif; |
| 237 |
?> |
| 238 |
<?php endif; ?> |
| 239 |
</div> |
| 240 |
</form> |
| 241 |
</div><!-- end #wp-optimize-minify-status --> |
| 242 |
|