| @@ -1,5 +1,5 @@ | ||
| 1 | -<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?> | |
| 1 | +<?php if (!defined('ABSPATH')) die('No direct access allowed'); ?> | |
| 2 | 2 | <div class="wpo_section wpo_group"> |
| 3 | 3 | <form> |
| 4 | 4 | <div id="wpo_settings_warnings"></div> |
| 5 | 5 | <h3><?php esc_html_e('Google Fonts', 'wp-optimize'); ?></h3> |
| @@ -4,143 +4,198 @@ | ||
| 4 | 4 | <div id="wpo_settings_warnings"></div> |
| 5 | 5 | <h3><?php esc_html_e('Google Fonts', 'wp-optimize'); ?></h3> |
| 6 | 6 | <div class="wpo-fieldgroup"> |
| 7 | 7 | <fieldset> |
| 8 | + <div class="wpo-fieldgroup__subgroup show-if-enabled"> | |
| 9 | + <label for="disable_google_fonts_processing"> | |
| 10 | + <input | |
| 11 | + name="disable_google_fonts_processing" | |
| 12 | + type="checkbox" | |
| 13 | + id="disable_google_fonts_processing" | |
| 14 | + value="1" | |
| 15 | + <?php checked($wpo_minify_options['disable_google_fonts_processing']); ?> | |
| 16 | + > | |
| 17 | + <?php esc_html_e('Disable Google Fonts processing', 'wp-optimize'); ?> | |
| 18 | + </label> | |
| 19 | + <span tabindex="0" class="wpo-tooltip" data-tooltip="<?php esc_attr_e('If enabled, stylesheets from Google Fonts will bypass WP-Optimize processing, allowing standard WordPress processing to be used instead.', 'wp-optimize');?> <?php esc_attr_e('This can be helpful if you are using other plugins that work with Google Fonts and experience conflicts with WP-Optimize.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span><br> | |
| 20 | + </div> | |
| 8 | 21 | <?php if (WP_OPTIMIZE_SHOW_MINIFY_ADVANCED) : ?> |
| 9 | - <label for="merge_google_fonts"> | |
| 22 | + <div class="wpo-fieldgroup__subgroup show-if-enabled"> | |
| 23 | + <label for="merge_google_fonts"> | |
| 24 | + <input | |
| 25 | + name="merge_google_fonts" | |
| 26 | + type="checkbox" | |
| 27 | + id="merge_google_fonts" | |
| 28 | + class="google_fonts_option" | |
| 29 | + value="1" | |
| 30 | + <?php checked($wpo_minify_options['merge_google_fonts']); ?> | |
| 31 | + > | |
| 32 | + <?php esc_html_e('Merge fonts from Google Fonts into one request', 'wp-optimize'); ?> | |
| 33 | + </label> | |
| 34 | + <span tabindex="0" class="wpo-tooltip" data-tooltip="<?php esc_attr_e('This improves speed when loading multiple fonts from Google Fonts.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span><br> | |
| 35 | + </div> | |
| 36 | + <?php endif; ?> | |
| 37 | + <div class="wpo-fieldgroup__subgroup show-if-enabled"> | |
| 38 | + <label for="remove_googlefonts"> | |
| 10 | 39 | <input |
| 11 | - name="merge_google_fonts" | |
| 40 | + name="remove_googlefonts" | |
| 12 | 41 | type="checkbox" |
| 13 | - id="merge_google_fonts" | |
| 42 | + id="remove_googlefonts" | |
| 43 | + class="google_fonts_option" | |
| 14 | 44 | value="1" |
| 15 | - <?php echo checked($wpo_minify_options['merge_google_fonts']); ?> | |
| 45 | + <?php checked($wpo_minify_options['remove_googlefonts']); ?> | |
| 16 | 46 | > |
| 17 | - <?php esc_html_e('Merge fonts from Google Fonts into one request', 'wp-optimize'); ?> | |
| 18 | - <span tabindex="0" data-tooltip="<?php esc_attr_e('This improves speed when loading multiple fonts from Google Fonts.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span> | |
| 47 | + <?php esc_html_e('Do not load Google Fonts', 'wp-optimize'); ?> | |
| 19 | 48 | </label> |
| 20 | - <?php endif; ?> | |
| 21 | - <label for="remove_googlefonts"> | |
| 22 | - <input | |
| 23 | - name="remove_googlefonts" | |
| 24 | - type="checkbox" | |
| 25 | - id="remove_googlefonts" | |
| 26 | - value="1" | |
| 27 | - <?php echo checked($wpo_minify_options['remove_googlefonts']); ?> | |
| 28 | - > | |
| 29 | - <?php esc_html_e('Do not load Google Fonts', 'wp-optimize'); ?> | |
| 30 | - <span tabindex="0" data-tooltip="<?php esc_attr_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> | |
| 31 | - </label> | |
| 32 | - <label for="enable_display_swap"> | |
| 33 | - <input | |
| 34 | - name="enable_display_swap" | |
| 35 | - type="checkbox" | |
| 36 | - id="enable_display_swap" | |
| 37 | - value="1" | |
| 38 | - <?php echo checked($wpo_minify_options['enable_display_swap']); ?> | |
| 39 | - > | |
| 40 | - <?php esc_html_e('Add "display=swap" to Google Fonts requests', 'wp-optimize'); ?> | |
| 41 | - <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> | |
| 42 | - </label> | |
| 49 | + <span tabindex="0" class="wpo-tooltip" data-tooltip="<?php esc_attr_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><br> | |
| 50 | + </div> | |
| 51 | + <div class="wpo-fieldgroup__subgroup show-if-enabled"> | |
| 52 | + <label for="enable_display_swap"> | |
| 53 | + <input | |
| 54 | + name="enable_display_swap" | |
| 55 | + type="checkbox" | |
| 56 | + id="enable_display_swap" | |
| 57 | + class="google_fonts_option" | |
| 58 | + value="1" | |
| 59 | + <?php checked($wpo_minify_options['enable_display_swap']); ?> | |
| 60 | + > | |
| 61 | + <?php esc_html_e('Add "display=swap" to Google Fonts requests', 'wp-optimize'); ?> | |
| 62 | + </label> | |
| 63 | + <span tabindex="0" class="wpo-tooltip" 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><br> | |
| 64 | + </div> | |
| 65 | + <div class="wpo-fieldgroup__subgroup"> | |
| 66 | + <label for="host_local_google_fonts"> | |
| 67 | + <input | |
| 68 | + name="host_local_google_fonts" | |
| 69 | + type="checkbox" | |
| 70 | + id="host_local_google_fonts" | |
| 71 | + class="google_fonts_option skip-disable-processing" | |
| 72 | + value="1" | |
| 73 | + disabled | |
| 74 | + > | |
| 75 | + <?php esc_html_e('Host Google Fonts locally', 'wp-optimize'); ?> | |
| 76 | + </label> | |
| 77 | + <span tabindex="0" class="wpo-tooltip" data-tooltip="<?php esc_attr_e('If enabled, stylesheet and font files from Google Fonts will be hosted locally.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span> | |
| 78 | + <div class="wpo-inline-advertise"> | |
| 79 | + <a class="" href="https://teamupdraft.com/wp-optimize/pricing/?utm_source=wpo-plugin&utm_medium=referral&utm_campaign=paac&utm_creative_format=overlay&utm_content=host-local-google-fonts" target="_blank"><?php esc_html_e('Upgrade to WP-Optimize Premium to unlock Host Google Fonts feature.', 'wp-optimize'); ?></a> | |
| 80 | + </div> | |
| 81 | + </div> | |
| 43 | 82 | </fieldset> |
| 44 | - <p class="wpo_min-bold-green wpo_min-rowintro"> | |
| 83 | + <p class="wpo_min-bold-green wpo_min-rowintro show-if-enabled"> | |
| 45 | 84 | <?php esc_html_e('Choose how to include fonts from Google Fonts on your pages, when available:', 'wp-optimize'); ?> |
| 46 | 85 | </p> |
| 47 | - <fieldset> | |
| 48 | - <label> | |
| 49 | - <input | |
| 50 | - type="radio" | |
| 51 | - name="gfonts_method" | |
| 52 | - value="inherit" | |
| 53 | - <?php echo checked('inherit' === $wpo_minify_options['gfonts_method']); ?> | |
| 54 | - > | |
| 55 | - <?php esc_html_e('Inherit from the CSS settings', 'wp-optimize'); ?> | |
| 56 | - <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> | |
| 57 | - </label> | |
| 58 | - <label> | |
| 59 | - <input | |
| 60 | - type="radio" | |
| 61 | - name="gfonts_method" | |
| 62 | - value="inline" | |
| 63 | - <?php echo checked('inline' === $wpo_minify_options['gfonts_method']); ?> | |
| 64 | - > | |
| 65 | - <?php esc_html_e('Inline google font CSS files', 'wp-optimize'); ?> | |
| 66 | - <span tabindex="0" data-tooltip="<?php esc_attr_e('The stylesheets will be inlined.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span> | |
| 67 | - </label> | |
| 68 | - <label> | |
| 69 | - <input | |
| 70 | - type="radio" | |
| 71 | - name="gfonts_method" | |
| 72 | - value="async" | |
| 73 | - <?php echo checked('async' === $wpo_minify_options['gfonts_method']); ?> | |
| 74 | - > | |
| 75 | - <?php esc_html_e('Asynchronously load CSS files from Google Fonts', 'wp-optimize'); ?> | |
| 76 | - <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> | |
| 77 | - </label> | |
| 78 | - <label> | |
| 79 | - <input | |
| 80 | - type="radio" | |
| 81 | - name="gfonts_method" | |
| 82 | - value="exclude" | |
| 83 | - <?php echo checked('exclude' === $wpo_minify_options['gfonts_method']); ?> | |
| 84 | - > | |
| 85 | - <?php esc_html_e('Asynchronously load fonts from Google Fonts using JavaScript', 'wp-optimize'); ?> | |
| 86 | - <span tabindex="0" data-tooltip="<?php esc_attr_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> | |
| 87 | - </label> | |
| 86 | + <fieldset class="show-if-enabled"> | |
| 87 | + <div class="wpo-fieldgroup__subgroup"> | |
| 88 | + <label> | |
| 89 | + <input | |
| 90 | + type="radio" | |
| 91 | + class="google_fonts_option" | |
| 92 | + name="gfonts_method" | |
| 93 | + value="inherit" | |
| 94 | + <?php checked('inherit' === $wpo_minify_options['gfonts_method']); ?> | |
| 95 | + > | |
| 96 | + <?php esc_html_e('Inherit from the CSS settings', 'wp-optimize'); ?> | |
| 97 | + </label> | |
| 98 | + <span tabindex="0" class="wpo-tooltip" data-tooltip="<?php esc_attr_e('The stylesheets will be merged or inlined.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span><br> | |
| 99 | + </div> | |
| 100 | + <div class="wpo-fieldgroup__subgroup"> | |
| 101 | + <label> | |
| 102 | + <input | |
| 103 | + type="radio" | |
| 104 | + class="google_fonts_option" | |
| 105 | + name="gfonts_method" | |
| 106 | + value="inline" | |
| 107 | + <?php checked('inline' === $wpo_minify_options['gfonts_method']); ?> | |
| 108 | + > | |
| 109 | + <?php esc_html_e('Inline google font CSS files', 'wp-optimize'); ?> | |
| 110 | + </label> | |
| 111 | + <span tabindex="0" class="wpo-tooltip" data-tooltip="<?php esc_attr_e('The stylesheets will be inlined.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span><br> | |
| 112 | + </div> | |
| 113 | + <div class="wpo-fieldgroup__subgroup"> | |
| 114 | + <label> | |
| 115 | + <input | |
| 116 | + type="radio" | |
| 117 | + class="google_fonts_option" | |
| 118 | + name="gfonts_method" | |
| 119 | + value="async" | |
| 120 | + <?php checked('async' === $wpo_minify_options['gfonts_method']); ?> | |
| 121 | + > | |
| 122 | + <?php esc_html_e('Asynchronously load CSS files from Google Fonts', 'wp-optimize'); ?> | |
| 123 | + </label> | |
| 124 | + <span tabindex="0" class="wpo-tooltip" data-tooltip="<?php esc_attr_e('Will use \'preload\' with LoadCSS polyfill', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span><br> | |
| 125 | + </div> | |
| 126 | + <div class="wpo-fieldgroup__subgroup"> | |
| 127 | + <label> | |
| 128 | + <input | |
| 129 | + type="radio" | |
| 130 | + class="google_fonts_option" | |
| 131 | + name="gfonts_method" | |
| 132 | + value="exclude" | |
| 133 | + <?php checked('exclude' === $wpo_minify_options['gfonts_method']); ?> | |
| 134 | + > | |
| 135 | + <?php esc_html_e('Asynchronously load fonts from Google Fonts using JavaScript', 'wp-optimize'); ?> | |
| 136 | + </label> | |
| 137 | + <span tabindex="0" class="wpo-tooltip" data-tooltip="<?php esc_attr_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><br> | |
| 138 | + </div> | |
| 88 | 139 | </fieldset> |
| 89 | 140 | </div> |
| 90 | 141 | |
| 91 | - <h3><?php esc_html_e('Font Awesome', 'wp-optimize'); ?></h3> | |
| 92 | - <div class="wpo-fieldgroup"> | |
| 142 | + <h3 class="show-if-enabled"><?php esc_html_e('Font Awesome', 'wp-optimize'); ?></h3> | |
| 143 | + <div class="wpo-fieldgroup show-if-enabled"> | |
| 93 | 144 | <p class="wpo_min-bold-green wpo_min-rowintro"> |
| 94 | 145 | <?php esc_html_e('Choose how to include Font Awesome (only available if it has \'font-awesome\' in the url):', 'wp-optimize'); ?> |
| 95 | 146 | </p> |
| 96 | 147 | <fieldset> |
| 97 | - <label><input | |
| 98 | - type="radio" | |
| 99 | - name="fawesome_method" | |
| 100 | - value="inherit" | |
| 101 | - <?php echo checked('inherit' === $wpo_minify_options['fawesome_method']); ?> | |
| 102 | - > | |
| 103 | - <?php esc_html_e('Inherit from the CSS settings', 'wp-optimize'); ?> | |
| 104 | - <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> | |
| 105 | - </label> | |
| 106 | - <label><input | |
| 107 | - type="radio" | |
| 108 | - name="fawesome_method" | |
| 109 | - value="inline" | |
| 110 | - <?php echo checked('inline' === $wpo_minify_options['fawesome_method']); ?> | |
| 111 | - > | |
| 112 | - <?php esc_html_e('Inline the Font Awesome CSS file', 'wp-optimize'); ?> | |
| 113 | - </label> | |
| 114 | - <label> | |
| 115 | - <input | |
| 148 | + <div class="wpo-fieldgroup__subgroup"> | |
| 149 | + <label><input | |
| 116 | 150 | type="radio" |
| 117 | 151 | name="fawesome_method" |
| 118 | - value="async" | |
| 119 | - <?php echo checked('async' === $wpo_minify_options['fawesome_method']); ?> | |
| 152 | + value="inherit" | |
| 153 | + <?php checked('inherit' === $wpo_minify_options['fawesome_method']); ?> | |
| 154 | + > | |
| 155 | + <?php esc_html_e('Inherit from the CSS settings', 'wp-optimize'); ?> | |
| 156 | + </label> | |
| 157 | + <span tabindex="0" class="wpo-tooltip" data-tooltip="<?php esc_attr_e('The stylesheets will be merged or inlined.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span><br> | |
| 158 | + </div> | |
| 159 | + <div class="wpo-fieldgroup__subgroup"> | |
| 160 | + <label><input | |
| 161 | + type="radio" | |
| 162 | + name="fawesome_method" | |
| 163 | + value="inline" | |
| 164 | + <?php checked('inline' === $wpo_minify_options['fawesome_method']); ?> | |
| 165 | + > | |
| 166 | + <?php esc_html_e('Inline the Font Awesome CSS file', 'wp-optimize'); ?> | |
| 167 | + </label> | |
| 168 | + </div> | |
| 169 | + <div class="wpo-fieldgroup__subgroup"> | |
| 170 | + <label> | |
| 171 | + <input | |
| 172 | + type="radio" | |
| 173 | + name="fawesome_method" | |
| 174 | + value="async" | |
| 175 | + <?php checked('async' === $wpo_minify_options['fawesome_method']); ?> | |
| 176 | + > | |
| 177 | + <?php esc_html_e('Asynchronously load the Font Awesome CSS file', 'wp-optimize'); ?> | |
| 178 | + </label> | |
| 179 | + <span tabindex="0" class="wpo-tooltip" data-tooltip="<?php esc_attr_e('Will use \'preload\' with LoadCSS polyfill', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span></span><br> | |
| 180 | + </div> | |
| 181 | + <div class="wpo-fieldgroup__subgroup"> | |
| 182 | + <label><input | |
| 183 | + type="radio" | |
| 184 | + name="fawesome_method" | |
| 185 | + value="exclude" | |
| 186 | + <?php checked('exclude' === $wpo_minify_options['fawesome_method']); ?> | |
| 120 | 187 | > |
| 121 | - <?php esc_html_e('Asynchronously load the Font Awesome CSS file', 'wp-optimize'); ?> | |
| 122 | - <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> | |
| 123 | - </label> | |
| 124 | - <label><input | |
| 125 | - type="radio" | |
| 126 | - name="fawesome_method" | |
| 127 | - value="exclude" | |
| 128 | - <?php echo checked('exclude' === $wpo_minify_options['fawesome_method']); ?> | |
| 129 | - > | |
| 130 | - <?php esc_html_e('Asynchronously load the Font Awesome stylesheet using JavaScript', 'wp-optimize'); ?> | |
| 131 | - <span tabindex="0" data-tooltip="<?php esc_attr_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> | |
| 132 | - </label> | |
| 188 | + <?php esc_html_e('Asynchronously load the Font Awesome stylesheet using JavaScript', 'wp-optimize'); ?> | |
| 189 | + </label> | |
| 190 | + <span tabindex="0" class="wpo-tooltip" data-tooltip="<?php esc_attr_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><br> | |
| 191 | + </div> | |
| 133 | 192 | </fieldset> |
| 134 | 193 | </div> |
| 135 | 194 | |
| 136 | - <p class="submit"> | |
| 137 | - <input | |
| 138 | - class="wp-optimize-save-minify-settings button button-primary" | |
| 139 | - type="submit" | |
| 140 | - value="<?php esc_attr_e('Save settings', 'wp-optimize'); ?>" | |
| 141 | - > | |
| 142 | - <img class="wpo_spinner" src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); ?>" alt="..."> | |
| 195 | + <div class="wpo-save-btn-container"> | |
| 196 | + <input class="wp-optimize-save-minify-settings button button-primary" type="submit" value="<?php esc_attr_e('Save settings', 'wp-optimize'); ?>"> | |
| 197 | + <img class="wpo_spinner" src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage -- N/A ?>" alt="..."> | |
| 143 | 198 | <span class="save-done dashicons dashicons-yes display-none"></span> |
| 144 | - </p> | |
| 199 | + </div> | |
| 145 | 200 | </form> |
| 146 | 201 | </div> |