| @@ -1,17 +1,83 @@ | ||
| 1 | -<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?> | |
| 1 | +<?php if (!defined('ABSPATH')) die('No direct access allowed'); ?> | |
| 2 | 2 | |
| 3 | -<h3 class="wpo-first-child"><?php _e('URLs to exclude from caching', 'wp-optimize'); ?></h3> | |
| 3 | +<h3 class="wpo-first-child"><?php esc_html_e('Cache Gravatars', 'wp-optimize'); ?></h3> | |
| 4 | 4 | |
| 5 | +<div class="wpo-fieldgroup cache-options"> | |
| 6 | + <div class="wpo-fieldgroup__subgroup"> | |
| 7 | + <label for="wpo-show-avatars"> | |
| 8 | + <input type="checkbox" value="true" disabled <?php checked($show_avatars, 1); ?>> | |
| 9 | + <?php esc_html_e('Show avatars (WordPress core setting).', 'wp-optimize'); ?> | |
| 10 | + </label> | |
| 11 | + <span tabindex="0" class="wpo-tooltip" data-tooltip="<?php esc_attr_e('This option controls the WordPress core avatar display setting.', 'wp-optimize'); ?> <?php esc_attr_e('WP-Optimize does not manage avatars directly.', 'wp-optimize'); ?> <?php esc_attr_e('You can also change this setting in Settings → Discussion.', 'wp-optimize'); ?> <?php esc_attr_e('When disabled, locally hosted gravatars will also be disabled.', 'wp-optimize'); ?>"> | |
| 12 | + <span class="dashicons dashicons-editor-help"></span> | |
| 13 | + </span> | |
| 14 | + <p class="description"> | |
| 15 | + <?php esc_html_e('This is a WordPress core setting.', 'wp-optimize'); ?> | |
| 16 | + <?php | |
| 17 | + /* translators: %s: Link to WordPress Discussion Settings page */ | |
| 18 | + printf(esc_html__('For more avatar options, visit %s.', 'wp-optimize'), '<a href="' . esc_url(admin_url('options-discussion.php')) . '" target="_blank">' . esc_html__('Settings → Discussion', 'wp-optimize') . '</a>'); | |
| 19 | + ?> | |
| 20 | + </p> | |
| 21 | + </div> | |
| 22 | + <div class="wpo-fieldgroup__subgroup" id="wpo-host-gravatars-locally-container"> | |
| 23 | + <label for="wpo-host-gravatars-locally"> | |
| 24 | + <input type="checkbox" value="true" disabled> | |
| 25 | + <?php esc_html_e('Host gravatars locally.', 'wp-optimize'); ?> | |
| 26 | + </label> | |
| 27 | + <span tabindex="0" class="wpo-tooltip" data-tooltip="<?php esc_attr_e('Host gravatars locally to reduce http requests and enhanced privacy.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span> </span> | |
| 28 | + </div> | |
| 29 | + <p><a href="<?php echo esc_url(WP_Optimize()->premium_version_link); ?>&utm_content=host-gravatars-locally" target="_blank"><?php esc_html_e('Upgrade to WP-Optimize Premium to unlock this feature.', 'wp-optimize'); ?></a></p> | |
| 30 | +</div> | |
| 31 | + | |
| 32 | +<h3 class="wpo-first-child"><?php esc_html_e('URLs to include in caching', 'wp-optimize'); ?></h3> | |
| 33 | + | |
| 5 | 34 | <div class="wpo-fieldgroup"> |
| 35 | + <div class="wpo-fieldgroup__subgroup"> | |
| 36 | + <label for="cache_specific_urls_only"> | |
| 37 | + <input name="cache_specific_urls_only" id="cache_specific_urls_only" class="cache-settings" type="checkbox" value="true" disabled> | |
| 38 | + <?php esc_html_e('Cache Specific URLs Only', 'wp-optimize'); ?> | |
| 39 | + </label> | |
| 40 | + <span tabindex="0" class="wpo-tooltip" data-tooltip="<?php esc_attr_e('Enable or disable caching for specific URLs only.', 'wp-optimize');?>"><span class="dashicons dashicons-editor-help"></span> </span> | |
| 41 | + </div> | |
| 42 | + <p><a href="<?php echo esc_url(WP_Optimize()->premium_version_link); ?>&utm_content=cache_ignore_query_variables" target="_blank"><?php esc_html_e('Upgrade to WP-Optimize Premium to unlock this feature.', 'wp-optimize'); ?></a></p> | |
| 43 | + <p> | |
| 44 | + <?php // Translators: %s is an example path. ?> | |
| 45 | + <label for="cache_include_urls"><?php echo wp_kses_post(sprintf(__('List paths (e.g. %s) that should be cached (one per line)', 'wp-optimize'), '<code>'.esc_html_x('/sample-page', 'an example path', 'wp-optimize').'</code>')); ?> </label> | |
| 46 | + <textarea name="cache_include_urls" id="cache_include_urls" class="cache-settings" placeholder="/members/*" disabled></textarea> | |
| 47 | + </p> | |
| 6 | 48 | |
| 49 | + <span> | |
| 50 | + <?php | |
| 51 | + esc_html_e('Use the wildcard * to include child URLs.', 'wp-optimize'); | |
| 52 | + echo ' '; | |
| 53 | + // Translators: %s are examples of path using the wildcard * | |
| 54 | + echo wp_kses_post(sprintf(_x('e.g. %1$s or %2$s', '%s are examples of path using the wildcard *', 'wp-optimize'), '<code>'.esc_html_x('/shop/*', 'an example path with the wildcard (*)', 'wp-optimize').'</code>', '<code>'.esc_html_x('*sample-path*', 'a second example path using the wildcard (*) twice', 'wp-optimize').'</code>')); | |
| 55 | + ?> | |
| 56 | + </span> | |
| 57 | +</div> | |
| 58 | + | |
| 59 | +<h3 class="wpo-first-child"><?php esc_html_e('URLs to exclude from caching', 'wp-optimize'); ?></h3> | |
| 60 | + | |
| 61 | +<div class="wpo-fieldgroup"> | |
| 62 | + | |
| 7 | 63 | <p> |
| 8 | - <label for="cache_exception_urls"><?php printf(__('List paths (e.g. %s) that should not be cached (one per line)', 'wp-optimize'), '<code>'._x('/product/green-beans', 'an example path', 'wp-optimize').'</code>'); ?> </label> | |
| 9 | - <textarea name="cache_exception_urls" id="cache_exception_urls" class="cache-settings" placeholder="/members/*"><?php echo htmlspecialchars($cache_exception_urls); ?></textarea> | |
| 64 | + <label for="cache_exception_urls"> | |
| 65 | + <?php | |
| 66 | + // translators: %s is an example path | |
| 67 | + echo wp_kses_post(sprintf(__('List paths (e.g. %s) that should not be cached (one per line)', 'wp-optimize'), '<code>'.esc_html_x('/product/green-beans', 'an example path', 'wp-optimize').'</code>')); | |
| 68 | + ?> | |
| 69 | + </label> | |
| 70 | + <textarea name="cache_exception_urls" id="cache_exception_urls" class="cache-settings" placeholder="/members/*"><?php echo esc_html($cache_exception_urls); ?></textarea> | |
| 10 | 71 | </p> |
| 11 | 72 | |
| 12 | 73 | <span> |
| 13 | - <?php _e('Use the wildcard * to exclude child URLs.', 'wp-optimize'); ?> <?php printf(_x('e.g. %s or %s', '%s are examples of path using the wildcard *', 'wp-optimize'), '<code>'._x('/shop/*', 'an example path with the wildcard (*)', 'wp-optimize').'</code>', '<code>'._x('*sample-path*', 'a second example path using the wildcard (*) twice', 'wp-optimize').'</code>'); ?> | |
| 74 | + <?php | |
| 75 | + esc_html_e('Use the wildcard * to exclude child URLs.', 'wp-optimize'); | |
| 76 | + echo ' '; | |
| 77 | + // translators: %1$s and %2$s are examples of path using the wildcard * | |
| 78 | + echo wp_kses_post(sprintf(_x('e.g. %1$s or %2$s', '%s are examples of path using the wildcard *', 'wp-optimize'), '<code>'.esc_html_x('/shop/*', 'an example path with the wildcard (*)', 'wp-optimize').'</code>', '<code>'.esc_html_x('*sample-path*', 'a second example path using the wildcard (*) twice', 'wp-optimize').'</code>')); | |
| 79 | + ?> | |
| 14 | 80 | </span> |
| 15 | 81 | |
| 16 | 82 | <?php do_action('wpo_after_cache_exception_urls'); ?> |
| 17 | 83 | |
| @@ -18,29 +84,49 @@ | ||
| 18 | 84 | </div> |
| 19 | 85 | |
| 20 | 86 | <?php do_action('wpo_after_cache_exception_urls_fieldgroup'); ?> |
| 21 | 87 | |
| 22 | -<h3 class="wpo-first-child"><?php _e('Cookies which, if present, will prevent caching (one per line)', 'wp-optimize'); ?></h3> | |
| 88 | +<h3 class="wpo-first-child"><?php esc_html_e('Ignore these query variables when caching', 'wp-optimize'); ?></h3> | |
| 23 | 89 | |
| 24 | 90 | <div class="wpo-fieldgroup"> |
| 25 | 91 | |
| 26 | 92 | <p> |
| 27 | - <label for="cache_exception_cookies"><?php _e('List of cookies that will prevent caching when set.', 'wp-optimize'); ?></label> | |
| 28 | - <textarea name="cache_exception_cookies" id="cache_exception_cookies" class="cache-settings" placeholder="wordpress_*"><?php echo htmlspecialchars($cache_exception_cookies); ?></textarea> | |
| 93 | + <label for="cache_ignore_query_variables"> | |
| 94 | + <?php esc_html_e('List query variables that should be ignored while caching (one per line)', 'wp-optimize'); ?> | |
| 95 | + </label> | |
| 96 | + <textarea name="cache_ignore_query_variables" id="cache_ignore_query_variables" class="cache-settings" placeholder="wpo_cache_debug" disabled><?php echo esc_textarea($cache_ignore_query_variables); ?></textarea> | |
| 29 | 97 | </p> |
| 98 | + <p><a href="<?php echo esc_url(WP_Optimize()->premium_version_link); ?>&utm_content=cache_ignore_query_variables" target="_blank"><?php esc_html_e('Upgrade to WP-Optimize Premium to unlock this feature.', 'wp-optimize'); ?></a></p> | |
| 99 | + | |
| 100 | + <?php do_action('wpo_after_cache_ignore_query_variables'); ?> | |
| 101 | + | |
| 30 | 102 | </div> |
| 31 | 103 | |
| 32 | -<h3 class="wpo-first-child"><?php _e('Conditional tags to exclude from caching', 'wp-optimize'); ?></h3> | |
| 104 | +<?php do_action('wpo_after_cache_ignore_query_variables_fieldgroup'); ?> | |
| 33 | 105 | |
| 106 | +<h3 class="wpo-first-child"><?php esc_html_e('Cookies which, if present, will prevent caching (one per line)', 'wp-optimize'); ?></h3> | |
| 107 | + | |
| 34 | 108 | <div class="wpo-fieldgroup"> |
| 35 | 109 | |
| 36 | 110 | <p> |
| 111 | + <label for="cache_exception_cookies"><?php esc_html_e('List of cookies that will prevent caching when set.', 'wp-optimize'); ?></label> | |
| 112 | + <textarea name="cache_exception_cookies" id="cache_exception_cookies" class="cache-settings" placeholder="wordpress_*"><?php echo esc_textarea($cache_exception_cookies); ?></textarea> | |
| 113 | + </p> | |
| 114 | +</div> | |
| 115 | + | |
| 116 | +<h3 class="wpo-first-child"><?php esc_html_e('Conditional tags to exclude from caching', 'wp-optimize'); ?></h3> | |
| 117 | + | |
| 118 | +<div class="wpo-fieldgroup"> | |
| 119 | + | |
| 120 | + <p> | |
| 37 | 121 | <label for="cache_exception_conditional_tags"> |
| 38 | - <?php | |
| 39 | - printf(__('List conditional tags (e.g. %s) that should not be cached (one per line).', 'wp-optimize'), '<code>is_single</code>'); | |
| 40 | - echo ' '; | |
| 41 | - printf(__('You can find more details about condtional tags from %s here', 'wp-optimize'), '<a href="https://codex.wordpress.org/Conditional_Tags" target="_blank">'); | |
| 42 | - ?> | |
| 122 | + <?php | |
| 123 | + // translators: %s is an example conditional tag | |
| 124 | + echo wp_kses_post(sprintf(__('List conditional tags (e.g. %s) that should not be cached (one per line).', 'wp-optimize'), '<code>is_single</code>')); | |
| 125 | + echo ' '; | |
| 126 | + // translators: %1$s and %2$s are anchor tags | |
| 127 | + echo wp_kses_post(sprintf(__('You can find more details about conditional tags from %1$shere%2$s', 'wp-optimize'), '<a href="https://codex.wordpress.org/Conditional_Tags" target="_blank">', '</a>')); | |
| 128 | + ?> | |
| 43 | 129 | </label> |
| 44 | 130 | <textarea name="cache_exception_conditional_tags" id="cache_exception_conditional_tags" class="cache-settings" placeholder="is_single"><?php echo esc_textarea($cache_exception_conditional_tags); ?></textarea> |
| 45 | 131 | </p> |
| 46 | 132 | |
| @@ -47,23 +133,25 @@ | ||
| 47 | 133 | <?php do_action('wpo_after_cache_conditional_tags'); ?> |
| 48 | 134 | |
| 49 | 135 | </div> |
| 50 | 136 | |
| 51 | -<h3 class="wpo-first-child"><?php _e('List of browser agent strings which, if detected, will prevent caching', 'wp-optimize'); ?></h3> | |
| 137 | +<h3 class="wpo-first-child"><?php esc_html_e('List of browser agent strings which, if detected, will prevent caching', 'wp-optimize'); ?></h3> | |
| 52 | 138 | |
| 53 | 139 | <div class="wpo-fieldgroup"> |
| 54 | 140 | |
| 55 | 141 | <p> |
| 56 | - <label for="cache_exception_browser_agents"><?php _e('List of browser agents strings or substrings that should not be served cached files (one per line)', 'wp-optimize'); ?></label> | |
| 57 | - <textarea name="cache_exception_browser_agents" id="cache_exception_browser_agents" class="cache-settings" placeholder="AppleWebKit/*"><?php echo htmlspecialchars($cache_exception_browser_agents); ?></textarea> | |
| 142 | + <label for="cache_exception_browser_agents"><?php esc_html_e('List of browser agents strings or substrings that should not be served cached files (one per line)', 'wp-optimize'); ?></label> | |
| 143 | + <textarea name="cache_exception_browser_agents" id="cache_exception_browser_agents" class="cache-settings" placeholder="AppleWebKit/*"><?php echo esc_textarea($cache_exception_browser_agents); ?></textarea> | |
| 58 | 144 | </p> |
| 59 | 145 | |
| 60 | - <span><?php _e('If any of the above strings is found in the User-Agent HTTP header, then the requested page will not be cached.', 'wp-optimize'); ?> </span> | |
| 146 | + <span><?php esc_html_e('If any of the above strings is found in the User-Agent HTTP header, then the requested page will not be cached.', 'wp-optimize'); ?> </span> | |
| 61 | 147 | </div> |
| 62 | 148 | |
| 63 | 149 | <?php do_action('wpo_page_cache_advanced_settings', $wpo_cache_options); ?> |
| 64 | 150 | |
| 65 | -<input id="wp-optimize-save-cache-advanced-rules" class="button button-primary" type="submit" name="wp-optimize-save-cache-advanced-rules" value="Save changes"> | |
| 151 | +<div class="wpo-save-btn-container"> | |
| 152 | + <input id="wp-optimize-save-cache-advanced-rules" class="button button-primary" type="submit" name="wp-optimize-save-cache-advanced-rules" value="Save changes"> | |
| 66 | 153 | |
| 67 | -<img class="wpo_spinner" src="<?php echo esc_attr(admin_url('images/spinner-2x.gif')); ?>" alt="..."> | |
| 154 | + <img class="wpo_spinner" src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage -- N/A ?>" alt="..."> | |
| 68 | 155 | |
| 69 | -<span class="save-done dashicons dashicons-yes display-none"></span> | |
| 156 | + <span class="save-done dashicons dashicons-yes display-none"></span> | |
| 157 | +</div> | |