| @@ -1,21 +1,21 @@ | ||
| 1 | -<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?> | |
| 1 | +<?php if (!defined('ABSPATH')) die('No direct access allowed'); ?> | |
| 2 | 2 | <div id="wp-optimize-minify-status" class="wpo_section wpo_group<?php echo (!$wpo_minify_options['enabled']) ? ' wpo-feature-is-disabled' : ''; ?>"> |
| 3 | 3 | <form> |
| 4 | 4 | <div class="wpo-info wpo-show"> |
| 5 | 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 | 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> | |
| 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 | 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> | |
| 9 | + <a href="https://vimeo.com/1015123805" data-embed="https://player.vimeo.com/video/1015123805?color=df6926&title=0&byline=0&portrait=0" target="_blank"><img src="<?php echo esc_url(trailingslashit(WPO_PLUGIN_URL) . 'images/notices/video-thumb.jpg'); ?>" alt="<?php esc_attr_e('Minify video preview', 'wp-optimize');?>"></a> | |
| 10 | 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> | |
| 11 | + <small>(<?php esc_html_e('Loads a video hosted on vimeo.com', 'wp-optimize'); ?>) - <?php $wp_optimize->wp_optimize_url('https://vimeo.com/1015123805', __('Open the video in a new window', 'wp-optimize')); ?></small> | |
| 12 | + <p><a target="_blank" href="<?php echo esc_url(WP_Optimize()->maybe_add_affiliate_params('https://teamupdraft.com/documentation/wp-optimize/topics/minification/faqs/?utm_source=wpo-plugin&utm_medium=referral&utm_campaign=paac&utm_content=read-the-documentation-minification&utm_creative_format=text')); ?>"><?php esc_html_e('Read the documentation', 'wp-optimize'); ?></a></p> | |
| 13 | 13 | </div> |
| 14 | 14 | </div> |
| 15 | 15 | <div id="wpo_settings_warnings"></div> |
| 16 | 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"> | |
| 17 | + <div class="notice notice-warning wpo-warning is-dismissible below-h2 wpo_section_notice_minify wpo-show"> | |
| 18 | 18 | <p> |
| 19 | 19 | <span class="dashicons dashicons-shield"></span> |
| 20 | 20 | <strong><?php esc_html_e('CSS, JavaScript and HTML minification is an advanced feature.', 'wp-optimize'); ?></strong><br> |
| 21 | 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> |
| @@ -20,9 +20,9 @@ | ||
| 20 | 20 | <strong><?php esc_html_e('CSS, JavaScript and HTML minification is an advanced feature.', 'wp-optimize'); ?></strong><br> |
| 21 | 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 | 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 | 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> | |
| 24 | + <a target="_blank" href="<?php echo esc_url(WP_Optimize()->maybe_add_affiliate_params('https://teamupdraft.com/documentation/wp-optimize/topics/minification/faqs/?utm_source=wpo-plugin&utm_medium=referral&utm_campaign=paac&utm_content=read-the-documentation-minification&utm_creative_format=notice')); ?>"><?php esc_html_e('Read the documentation', 'wp-optimize'); ?></a> | |
| 25 | 25 | </p> |
| 26 | 26 | </div> |
| 27 | 27 | <?php endif; ?> |
| 28 | 28 | <div class="wpo-fieldgroup wpo-show"> |
| @@ -33,22 +33,15 @@ | ||
| 33 | 33 | id="wpo_min_enable_minify" |
| 34 | 34 | class="wpo-save-setting" |
| 35 | 35 | type="checkbox" |
| 36 | 36 | value="true" |
| 37 | - <?php echo WPO_MINIFY_PHP_VERSION_MET ? '' : 'disabled'; ?> | |
| 38 | 37 | <?php checked($wpo_minify_options['enabled']); ?> |
| 39 | 38 | > |
| 40 | 39 | <span class="slider round"></span> |
| 41 | 40 | </label> |
| 42 | 41 | <label for="wpo_min_enable_minify"> |
| 43 | - <?php if (WPO_MINIFY_PHP_VERSION_MET) { | |
| 42 | + <?php | |
| 44 | 43 | 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 | 44 | ?> |
| 52 | 45 | </label> |
| 53 | 46 | </div> |
| 54 | 47 | |
| @@ -57,12 +50,13 @@ | ||
| 57 | 50 | <?php if (!empty($active_minify_plugins)) : ?> |
| 58 | 51 | <div class="notice notice-error"> |
| 59 | 52 | <p> |
| 60 | 53 | <?php |
| 54 | + // translators: %s - list of active minify plugins | |
| 61 | 55 | $message = sprintf(esc_html__('It looks like you already have an active minify plugin (%s) installed.', 'wp-optimize'), implode(', ', $active_minify_plugins)); |
| 62 | 56 | $message .= ' '; |
| 63 | 57 | $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; | |
| 58 | + echo $message; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output already escaped | |
| 65 | 59 | ?> |
| 66 | 60 | </p> |
| 67 | 61 | </div> |
| 68 | 62 | <?php endif; ?> |
| @@ -68,9 +62,16 @@ | ||
| 68 | 62 | <?php endif; ?> |
| 69 | 63 | |
| 70 | 64 | <?php if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) : ?> |
| 71 | 65 | <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> | |
| 66 | + <p> | |
| 67 | + <span class="dashicons dashicons-info"></span> | |
| 68 | + <?php | |
| 69 | + echo ' '; | |
| 70 | + // translators: %s is the constant name SCRIPT_DEBUG | |
| 71 | + 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>'); | |
| 72 | + ?> | |
| 73 | + </p> | |
| 73 | 74 | </div> |
| 74 | 75 | <?php endif; ?> |
| 75 | 76 | |
| 76 | 77 | <div class="wpo-minify-features"> |
| @@ -95,10 +96,10 @@ | ||
| 95 | 96 | $message = __('All HTML will be minified.', 'wp-optimize'); |
| 96 | 97 | $message .= ' '; |
| 97 | 98 | $message .= __('It takes effect only when cache pre-loading because it takes time.', 'wp-optimize'); |
| 98 | 99 | ?> |
| 99 | - <span tabindex="0" data-tooltip="<?php echo esc_attr($message);?>"><span class="dashicons dashicons-editor-help"></span> </span> | |
| 100 | 100 | </label> |
| 101 | + <span tabindex="0" class="wpo-tooltip" data-tooltip="<?php echo esc_attr($message);?>"><span class="dashicons dashicons-editor-help"></span> </span> | |
| 101 | 102 | </div> |
| 102 | 103 | </div> |
| 103 | 104 | |
| 104 | 105 | <div class="wpo-fieldgroup__subgroup"> |
| @@ -116,11 +117,11 @@ | ||
| 116 | 117 | <span class="slider round"></span> |
| 117 | 118 | </label> |
| 118 | 119 | <label for="wpo_min_enable_minify_js"> |
| 119 | 120 | <?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 | 121 | </label> |
| 122 | + <span tabindex="0" class="wpo-tooltip" 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> | |
| 123 | + <a href="#" class="js--wpo-goto" data-tab="js"><?php esc_html_e('Settings', 'wp-optimize'); ?></a> | |
| 123 | 124 | </div> |
| 124 | 125 | </div> |
| 125 | 126 | |
| 126 | 127 | <div class="wpo-fieldgroup__subgroup"> |
| @@ -138,11 +139,11 @@ | ||
| 138 | 139 | <span class="slider round"></span> |
| 139 | 140 | </label> |
| 140 | 141 | <label for="wpo_min_enable_minify_css"> |
| 141 | 142 | <?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 | 143 | </label> |
| 144 | + <span tabindex="0" class="wpo-tooltip" 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> | |
| 145 | + <a href="#" class="js--wpo-goto" data-tab="css"><?php esc_html_e('Settings', 'wp-optimize'); ?></a> | |
| 145 | 146 | </div> |
| 146 | 147 | </div> |
| 147 | 148 | </div> |
| 148 | 149 | </div> |
| @@ -147,51 +148,51 @@ | ||
| 147 | 148 | </div> |
| 148 | 149 | </div> |
| 149 | 150 | |
| 150 | 151 | <div class="wpo-fieldgroup"> |
| 151 | - <p class="actions"> | |
| 152 | + <div class="wpo-save-btn-container actions"> | |
| 152 | 153 | <input |
| 153 | 154 | class="button button-primary purge_minify_cache <?php echo $can_purge_the_cache ? '' : 'disabled'; ?>" |
| 154 | 155 | type="submit" |
| 155 | 156 | 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 | + <?php echo $can_purge_the_cache ? '' : 'disabled'; ?> | |
| 157 | 158 | > |
| 158 | - <img class="wpo_spinner" src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); ?>" alt="..."> | |
| 159 | + <img class="wpo_spinner" src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage -- N/A ?>" alt="..."> | |
| 159 | 160 | <span class="save-done dashicons dashicons-yes display-none"></span> |
| 160 | - </p> | |
| 161 | + </div> | |
| 161 | 162 | <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 | + <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://teamupdraft.com/documentation/wp-optimize/topics/minification/faqs/what-does-reset-the-minified-files-do/?utm_source=wpo-plugin&utm_medium=referral&utm_campaign=paac&utm_content=what-does-purge-the-minified-files-do&utm_creative_format=text', __('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 | 164 | </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; ?> | |
| 165 | + | |
| 166 | + <?php esc_html_e('Minify cache size:', 'wp-optimize'); ?> | |
| 167 | + <ul class="ul-disc wpo-minify-cache-size"> | |
| 168 | + <li><?php esc_html_e('Current cache:', 'wp-optimize'); ?> | |
| 169 | + <strong id="wpo_min_cache_size"> | |
| 170 | + <?php | |
| 171 | + if ($wpo_minify_options['enabled']) { | |
| 172 | + echo esc_html(WP_Optimize_Minify_Cache_Functions::get_cachestats($cache_dir)); | |
| 173 | + } else { | |
| 174 | + esc_html_e('No minified files are present', 'wp-optimize'); | |
| 175 | + } | |
| 176 | + ?> | |
| 177 | + </strong> | |
| 178 | + <a href="#" class="js--wpo-goto" data-tab="advanced"><?php esc_html_e('View the files', 'wp-optimize'); ?></a> | |
| 179 | + </li> | |
| 180 | + <li> | |
| 181 | + <?php esc_html_e('Total cache:', 'wp-optimize'); ?> | |
| 182 | + <strong id="wpo_min_cache_total_size"> | |
| 183 | + <?php | |
| 184 | + if ($wpo_minify_options['enabled']) { | |
| 185 | + echo esc_html(WP_Optimize_Minify_Cache_Functions::get_cachestats(WPO_CACHE_MIN_FILES_DIR)); | |
| 186 | + } else { | |
| 187 | + esc_html_e('No minified files are present', 'wp-optimize'); | |
| 188 | + } | |
| 189 | + ?> | |
| 190 | + </strong> | |
| 191 | + <strong tabindex="0" class="wpo-tooltip" 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> | |
| 192 | + <a href="#" class="wpo-minify-download-metas-button"><?php esc_html_e('Download debug log', 'wp-optimize'); ?></a> | |
| 193 | + </li> | |
| 194 | + </ul> | |
| 194 | 195 | <p> |
| 195 | 196 | <?php esc_html_e('Last Minify cache update:', 'wp-optimize'); ?> |
| 196 | 197 | <strong id="wpo_min_cache_time"> |
| 197 | 198 | <?php |
| @@ -205,34 +206,32 @@ | ||
| 205 | 206 | ?> |
| 206 | 207 | </strong> |
| 207 | 208 | </p> |
| 208 | 209 | <?php if ($wpo_minify_options['debug']) : ?> |
| 209 | - <p class="actions"> | |
| 210 | + <div class="wpo-save-btn-container actions"> | |
| 210 | 211 | <input |
| 211 | 212 | class="button minify_increment_cache" |
| 212 | 213 | type="button" |
| 213 | 214 | value="<?php esc_attr_e('Increment cache', 'wp-optimize'); ?>" |
| 214 | - <?php echo WPO_MINIFY_PHP_VERSION_MET ? '' : 'disabled'; ?> | |
| 215 | 215 | > |
| 216 | - <img class="wpo_spinner" src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); ?>" alt="..."> | |
| 216 | + <img class="wpo_spinner" src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage -- N/A ?>" alt="..."> | |
| 217 | 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> | |
| 218 | + <span tabindex="0" class="wpo-tooltip" data-tooltip="<?php esc_attr_e('This will reset the files generated by minify, but use the existing minify temporary files.', 'wp-optimize');?>" style="display: inline-block;"><span class="dashicons dashicons-editor-help"></span></span> | |
| 219 | + </div> | |
| 220 | 220 | <?php |
| 221 | 221 | // This is only necessary if the everything isn't purged |
| 222 | 222 | if (!wp_optimize_minify_config()->always_purge_everything()) : |
| 223 | 223 | ?> |
| 224 | - <p class="actions"> | |
| 224 | + <div class="wpo-save-btn-container actions"> | |
| 225 | 225 | <input |
| 226 | 226 | class="button purge_all_minify_cache" |
| 227 | 227 | type="button" |
| 228 | 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 | 229 | > |
| 231 | - <img class="wpo_spinner" src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); ?>" alt="..."> | |
| 230 | + <img class="wpo_spinner" src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage -- N/A ?>" alt="..."> | |
| 232 | 231 | <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> | |
| 232 | + <span tabindex="0" class="wpo-tooltip" 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');?>" style="display: inline-block;"><span class="dashicons dashicons-editor-help"></span></span> | |
| 233 | + </div> | |
| 235 | 234 | <?php |
| 236 | 235 | endif; |
| 237 | 236 | ?> |
| 238 | 237 | <?php endif; ?> |