WP Super Cache - Version 1.7.5

Version Description

Download this release

Release Info

Developer donncha
Plugin Icon 128x128 WP Super Cache
Version 1.7.5
Comparing to
See all releases

Code changes from version 1.7.4 to 1.7.5

partials/advanced.php ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( isset( $wp_cache_front_page_checks ) == false ) {
3
+ $wp_cache_front_page_checks = true;
4
+ }
5
+ echo '<form name="wp_manager" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) ) . '" method="post">';
6
+ wp_nonce_field( 'wp-cache' );
7
+ echo '<input type="hidden" name="action" value="scupdates" />';
8
+ ?>
9
+ <table class="form-table">
10
+ <tr valign="top">
11
+ <th scope="row"><label for="wp_cache_enabled"><?php _e( 'Caching', 'wp-super-cache' ); ?></label></th>
12
+ <td>
13
+ <fieldset>
14
+ <legend class="hidden"><?php _e( 'Caching', 'wp-super-cache' ); ?></legend>
15
+ <label><input type='checkbox' name='wp_cache_enabled' value='1' <?php if ( $cache_enabled == true ) { echo 'checked=checked'; } ?>> <?php _e( 'Enable Caching', 'wp-super-cache' ); ?><br />
16
+ </fieldset>
17
+ </td>
18
+ </tr>
19
+ <tr valign="top">
20
+ <th scope="row"><label for="super_cache_enabled"><?php _e( 'Cache Delivery Method', 'wp-super-cache' ); ?></label></th>
21
+ <td>
22
+ <fieldset>
23
+ <label><input type='radio' name='wp_cache_mod_rewrite' <?php if ( $wp_cache_mod_rewrite == 0 ) echo "checked"; ?> value='0'> <?php _e( '<acronym title="Use PHP to serve cached files">Simple</acronym>', 'wp-super-cache' ); echo " <em>(" . __( "Recommended", "wp-super-cache" ) . ")</em>"; ?></label><br />
24
+ <label><input type='radio' name='wp_cache_mod_rewrite' <?php if ( $wp_cache_mod_rewrite == 1 ) echo "checked"; ?> value='1'> <?php _e( '<acronym title="Use mod_rewrite to serve cached files">Expert</acronym>', 'wp-super-cache' ); ?></label><br />
25
+ <em><small class='description'><?php _e( 'Expert caching requires changes to important server files and may require manual intervention if enabled.', 'wp-super-cache' ); ?></small></em>
26
+ <?php if ( $is_nginx ) { ?>
27
+ <em><small class='description'><?php printf( __( 'Nginx rules can be found <a href="%s">here</a> but are not officially supported.', 'wp-super-cache' ), 'https://codex.wordpress.org/Nginx#WP_Super_Cache_Rules' ); ?></small></em>
28
+ <?php } ?>
29
+ </fieldset>
30
+ </td>
31
+ </tr>
32
+ <tr valign="top">
33
+ <th scope="row"><label for="wp_cache_status"><?php esc_html_e( 'Miscellaneous', 'wp-super-cache' ); ?></label></th>
34
+ <td>
35
+ <fieldset>
36
+ <legend class="hidden">Miscellaneous</legend>
37
+ <strong><?php echo __( 'Cache Restrictions', 'wp-super-cache' ); ?></strong><br />
38
+ <label><input type='radio' name='wp_cache_not_logged_in' <?php checked( $wp_cache_not_logged_in, 0 ); ?> value='0'> <?php echo __( 'Enable caching for all visitors.', 'wp-super-cache' ); ?></label><br />
39
+ <label><input type='radio' name='wp_cache_not_logged_in' <?php checked( $wp_cache_not_logged_in, 1 ); ?> value='1'> <?php echo __( 'Disable caching for visitors who have a cookie set in their browser.', 'wp-super-cache' ); ?></label><br />
40
+ <label><input type='radio' name='wp_cache_not_logged_in' <?php checked( $wp_cache_not_logged_in, 2 ); ?> value='2'> <?php echo __( 'Disable caching for logged in visitors.', 'wp-super-cache' ) . ' <em>(' . esc_html__( 'Recommended', 'wp-super-cache' ) . ')</em>'; ?></label><br /><br />
41
+ <label><input type='checkbox' name='wp_cache_no_cache_for_get' <?php checked( $wp_cache_no_cache_for_get ); ?> value='1'> <?php _e( 'Don&#8217;t cache pages with GET parameters. (?x=y at the end of a url)', 'wp-super-cache' ); ?></label><br />
42
+ <?php if ( ! defined( 'WPSC_DISABLE_COMPRESSION' ) ) : ?>
43
+ <?php if ( ! function_exists( 'gzencode' ) ) : ?>
44
+ <em><?php esc_html_e( 'Warning! Compression is disabled as gzencode() function was not found.', 'wp-super-cache' ); ?></em><br />
45
+ <?php else : ?>
46
+ <label><input type='checkbox' name='cache_compression' <?php checked( $cache_compression ); ?> value='1'> <?php echo __( 'Compress pages so they&#8217;re served more quickly to visitors.', 'wp-super-cache' ) . ' <em>(' . esc_html__( 'Recommended', 'wp-super-cache' ) . ')</em>'; ?></label><br />
47
+ <em><?php esc_html_e( 'Compression is disabled by default because some hosts have problems with compressed files. Switching it on and off clears the cache.', 'wp-super-cache' ); ?></em><br />
48
+ <?php endif; ?>
49
+ <?php endif; ?>
50
+ <label><input type='checkbox' name='cache_rebuild_files' <?php checked( $cache_rebuild_files ); ?> value='1'> <?php echo esc_html__( 'Cache rebuild. Serve a supercache file to anonymous users while a new file is being generated.', 'wp-super-cache' ) . ' <em>(' . esc_html__( 'Recommended', 'wp-super-cache' ) . ')</em>'; ?></label><br />
51
+ <?php if ( $wp_cache_mod_rewrite ) { ?>
52
+ <br />
53
+ <p><strong><?php esc_html_e( 'Warning! The following settings are disabled because Expert caching is enabled.', 'wp-super-cache' ); ?></strong></p>
54
+ <br />
55
+ <?php } ?>
56
+ <label><input <?php disabled( $wp_cache_mod_rewrite ); ?> type='checkbox' name='wpsc_save_headers' <?php checked( $wpsc_save_headers ); ?> value='1' /> <?php esc_html_e( 'Cache HTTP headers with page content.', 'wp-super-cache' ); ?></label><br />
57
+ <label><input <?php disabled( $wp_cache_mod_rewrite ); ?> type='checkbox' name='wp_supercache_304' <?php checked( $wp_supercache_304 ); ?> value='1'> <?php echo esc_html__( '304 Browser caching. Improves site performance by checking if the page has changed since the browser last requested it.', 'wp-super-cache' ) . ' <em>(' . esc_html__( 'Recommended', 'wp-super-cache' ) . ')</em>'; ?></label><br />
58
+ <?php echo '<em>' . esc_html__( '304 support is disabled by default because some hosts have had problems with the headers used in the past.', 'wp-super-cache' ) . '</em><br />'; ?>
59
+ <label><input <?php disabled( $wp_cache_mod_rewrite ); ?> type='checkbox' name='wp_cache_make_known_anon' <?php checked( $wp_cache_make_known_anon ); ?> value='1'> <?php _e( 'Make known users anonymous so they&#8217;re served supercached static files.', 'wp-super-cache' ); ?></label><br />
60
+ </legend>
61
+ </fieldset>
62
+ </td>
63
+ </tr>
64
+ <tr valign="top">
65
+ <th scope="row"><label for="wp_cache_status"><?php _e( 'Advanced', 'wp-super-cache' ); ?></label></th>
66
+ <td>
67
+ <fieldset>
68
+ <legend class="hidden">Advanced</legend>
69
+ <label><input <?php disabled( $wp_cache_mod_rewrite ); ?> type='checkbox' name='wp_cache_mfunc_enabled' <?php if( $wp_cache_mfunc_enabled ) echo "checked"; ?> value='1'> <?php _e( 'Enable dynamic caching. (See <a href="https://wordpress.org/plugins/wp-super-cache/faq/">FAQ</a> or wp-super-cache/plugins/dynamic-cache-test.php for example code.)', 'wp-super-cache' ); ?></label><br />
70
+ <label><input type='checkbox' name='wp_cache_mobile_enabled' <?php if( $wp_cache_mobile_enabled ) echo "checked"; ?> value='1'> <?php _e( 'Mobile device support. (External plugin or theme required. See the <a href="https://wordpress.org/plugins/wp-super-cache/faq/">FAQ</a> for further details.)', 'wp-super-cache' ); ?></label><br />
71
+ <?php if ( $wp_cache_mobile_enabled ) {
72
+ echo '<blockquote><h5>' . __( 'Mobile Browsers', 'wp-super-cache' ) . '</h5>' . esc_html( $wp_cache_mobile_browsers ) . "<br /><h5>" . __( 'Mobile Prefixes', 'wp-super-cache' ) . "</h5>" . esc_html( $wp_cache_mobile_prefixes ) . "<br /></blockquote>";
73
+ } ?>
74
+ <label><input type='checkbox' name='wp_cache_disable_utf8' <?php if( $wp_cache_disable_utf8 ) echo "checked"; ?> value='1'> <?php _e( 'Remove UTF8/blog charset support from .htaccess file. Only necessary if you see odd characters or punctuation looks incorrect. Requires rewrite rules update.', 'wp-super-cache' ); ?></label><br />
75
+ <label><input type='checkbox' name='wp_cache_clear_on_post_edit' <?php if( $wp_cache_clear_on_post_edit ) echo "checked"; ?> value='1'> <?php _e( 'Clear all cache files when a post or page is published or updated.', 'wp-super-cache' ); ?></label><br />
76
+ <label><input type='checkbox' name='wp_cache_front_page_checks' <?php if( $wp_cache_front_page_checks ) echo "checked"; ?> value='1'> <?php _e( 'Extra homepage checks. (Very occasionally stops homepage caching)', 'wp-super-cache' ); ?></label><?php echo " <em>(" . __( "Recommended", "wp-super-cache" ) . ")</em>"; ?><br />
77
+ <label><input type='checkbox' name='wp_cache_refresh_single_only' <?php if( $wp_cache_refresh_single_only ) echo "checked"; ?> value='1'> <?php _e( 'Only refresh current page when comments made.', 'wp-super-cache' ); ?></label><br />
78
+ <label><input type='checkbox' name='wp_supercache_cache_list' <?php if( $wp_supercache_cache_list ) echo "checked"; ?> value='1'> <?php _e( 'List the newest cached pages on this page.', 'wp-super-cache' ); ?></label><br />
79
+ <?php if( false == defined( 'WPSC_DISABLE_LOCKING' ) ) { ?>
80
+ <label><input type='checkbox' name='wp_cache_mutex_disabled' <?php if( !$wp_cache_mutex_disabled ) echo "checked"; ?> value='0'> <?php _e( 'Coarse file locking. You do not need this as it will slow down your website.', 'wp-super-cache' ); ?></label><br />
81
+ <?php } ?>
82
+ <label><input type='checkbox' name='wp_super_cache_late_init' <?php if( $wp_super_cache_late_init ) echo "checked"; ?> value='1'> <?php _e( 'Late init. Display cached files after WordPress has loaded.', 'wp-super-cache' ); ?></label><br />
83
+ <?php printf( __( '<strong>DO NOT CACHE PAGE</strong> secret key: <a href="%s">%s</a>', 'wp-super-cache' ), trailingslashit( get_bloginfo( 'url' ) ) . "?donotcachepage={$cache_page_secret}", $cache_page_secret ); ?>
84
+ </fieldset>
85
+ </td>
86
+ </tr>
87
+ <tr valign="top">
88
+ <th scope="row"><label for="wp_cache_location"><?php _e( 'Cache Location', 'wp-super-cache' ); ?></label></th>
89
+ <td>
90
+ <fieldset>
91
+ <legend class="hidden">Cache Location</legend>
92
+ <input type='text' size=80 name='wp_cache_location' value='<?php echo esc_attr( $cache_path ); ?>' />
93
+ <p><?php printf( __( 'Change the location of your cache files. The default is WP_CONTENT_DIR . /cache/ which translates to %s.', 'wp-super-cache' ), WP_CONTENT_DIR . '/cache/' ); ?></p>
94
+ <ol>
95
+ <li><?php _e( 'Warning: do not use a shared directory like /tmp/ where other users on this server can modify files. Your cache files could be modified to deface your website.', 'wp-super-cache' ); ?></li>
96
+ <li><?php _e( 'You must give the full path to the directory.', 'wp-super-cache' ); ?></li>
97
+ <li><?php _e( 'If the directory does not exist, it will be created. Please make sure your web server user has write access to the parent directory. The parent directory must exist.', 'wp-super-cache' ); ?></li>
98
+ <li><?php _e( 'If the new cache directory does not exist, it will be created and the contents of the old cache directory will be moved there. Otherwise, the old cache directory will be left where it is.', 'wp-super-cache' ); ?></li>
99
+ <li><?php _e( 'Submit a blank entry to set it to the default directory, WP_CONTENT_DIR . /cache/.', 'wp-super-cache' ); ?></li>
100
+ <?php
101
+ if ( get_site_option( 'wp_super_cache_index_detected' ) && strlen( $cache_path ) > strlen( ABSPATH ) && ABSPATH == substr( $cache_path, 0, strlen( ABSPATH ) ) ) {
102
+ $msg = __( 'The plugin detected a bare directory index in your cache directory, which would let visitors see your cache files directly and might expose private posts.', 'wp-super-cache' );
103
+ if ( ! $is_nginx && $super_cache_enabled && $wp_cache_mod_rewrite == 1 ) {
104
+ $msg .= ' ' . __( 'You are using expert mode to serve cache files so the plugin has added <q>Options -Indexes</q> to the .htaccess file in the cache directory to disable indexes. However, if that does not work, you should contact your system administrator or support and ask for them to be disabled, or use simple mode and move the cache outside of the web root.', 'wp-super-cache' );
105
+ } else {
106
+ $msg .= ' <strong>' . sprintf( __( 'index.html files have been added in key directories, but unless directory indexes are disabled, it is probably better to store the cache files outside of the web root of %s', 'wp-super-cache' ), ABSPATH ) . '</strong>';
107
+ }
108
+ echo "<li>$msg</li>";
109
+ }
110
+ ?>
111
+
112
+ <?php if ( $super_cache_enabled && $wp_cache_mod_rewrite == 1 ) { ?>
113
+ <li><?php printf( __( 'Since you are using mod_rewrite to serve cache files, you must choose a directory in your web root which is <q>%s</q> and update the mod_rewrite rules in the .htaccess file.', 'wp-super-cache' ), ABSPATH ); ?></li>
114
+ <?php } ?>
115
+ </ol>
116
+ </fieldset>
117
+ </td>
118
+ </tr>
119
+ </table>
120
+ <h4><?php esc_html_e( 'Note:', 'wp-super-cache' ); ?></h4>
121
+ <ol>
122
+ <li><?php esc_html_e( 'Uninstall this plugin on the plugins page. It will automatically clean up after itself. If manual intervention is required, then simple instructions are provided.', 'wp-super-cache' ); ?></li>
123
+ <li><?php printf( __( 'If uninstalling this plugin, make sure the directory <em>%s</em> is writeable by the webserver so the files <em>advanced-cache.php</em> and <em>cache-config.php</em> can be deleted automatically. (Making sure those files are writeable is probably a good idea!)', 'wp-super-cache' ), esc_attr( WP_CONTENT_DIR ) ); ?></li>
124
+ <li><?php printf( __( 'Please see the <a href="%1$s/wp-super-cache/readme.txt">readme.txt</a> for instructions on uninstalling this script. Look for the heading, "How to uninstall WP Super Cache".', 'wp-super-cache' ), plugins_url() ); ?></li>
125
+ <li><?php echo '<em>' . sprintf( __( 'Need help? Check the <a href="%1$s">Super Cache readme file</a>. It includes installation documentation, a FAQ and Troubleshooting tips. The <a href="%2$s">support forum</a> is also available. Your question may already have been answered.', 'wp-super-cache' ), 'https://wordpress.org/plugins/wp-super-cache/', 'https://wordpress.org/support/topic-tag/wp-super-cache/?forum_id=10' ) . '</em>'; ?></li>
126
+ <li><?php _e( 'The location of the plugin configuration file can be changed by defining the WPCACHECONFIGPATH constant in wp-config.php. If not defined it will be set to WP_CONTENT_DIR.', 'wp-super-cache' ); ?></li>
127
+ </ol>
128
+
129
+ <?php
130
+ echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . ' value="' . esc_html__( 'Update Status', 'wp-super-cache' ) . '" /></div>';
131
+ wp_nonce_field( 'wp-cache' );
132
+ ?></form><?php
133
+
134
+ if ( ! $GLOBALS['is_nginx'] && ! defined( 'WPSC_DISABLE_HTACCESS_UPDATE' ) && $GLOBALS['cache_enabled'] === true && $GLOBALS['wp_cache_mod_rewrite'] === 1 ) {
135
+ ?>
136
+ <a name="modrewrite"></a><fieldset class="options">
137
+ <h4><?php _e( 'Mod Rewrite Rules', 'wp-super-cache' ); ?></h4>
138
+ <p><?php _e( 'When Expert cache delivery is enabled a file called <em>.htaccess</em> is modified. It should probably be in the same directory as your wp-config.php. This file has special rules that serve the cached files very quickly to visitors without ever executing PHP. The .htaccess file can be updated automatically, but if that fails, the rules will be displayed here and it can be edited by you. You will not need to update the rules unless a warning shows here.', 'wp-super-cache' ); ?></p>
139
+
140
+ <?php
141
+ extract( wpsc_get_htaccess_info() ); // $document_root, $apache_root, $home_path, $home_root, $home_root_lc, $inst_root, $wprules, $scrules, $condition_rules, $rules, $gziprules
142
+ $dohtaccess = true;
143
+ if ( strpos( $wprules, 'wordpressuser' ) ) { // Need to clear out old mod_rewrite rules
144
+ echo "<p><strong>" . __( 'Thank you for upgrading.', 'wp-super-cache' ) . "</strong> " . sprintf( __( 'The mod_rewrite rules changed since you last installed this plugin. Unfortunately, you must remove the old supercache rules before the new ones are updated. Refresh this page when you have edited your .htaccess file. If you wish to manually upgrade, change the following line: %1$s so it looks like this: %2$s The only changes are "HTTP_COOKIE" becomes "HTTP:Cookie" and "wordpressuser" becomes "wordpress". This is a WordPress 2.5 change but it&#8217;s backwards compatible with older versions if you&#8217;re brave enough to use them.', 'wp-super-cache' ), '<blockquote><code>RewriteCond %{HTTP_COOKIE} !^.*wordpressuser.*$</code></blockquote>', '<blockquote><code>RewriteCond %{HTTP:Cookie} !^.*wordpress.*$</code></blockquote>' ) . "</p>";
145
+ } else {
146
+
147
+ global $valid_nonce;
148
+ if ( $dohtaccess && ! isset( $_POST[ 'updatehtaccess' ] ) ){
149
+ if ( $scrules == '' ) {
150
+ wpsc_update_htaccess_form( 0 ); // don't hide the update htaccess form
151
+ } else {
152
+ wpsc_update_htaccess_form();
153
+ }
154
+ } elseif ( $valid_nonce && isset( $_POST[ 'updatehtaccess' ] ) ) {
155
+ if ( add_mod_rewrite_rules() ) {
156
+ echo "<h5>" . __( 'Mod Rewrite rules updated!', 'wp-super-cache' ) . "</h5>";
157
+ echo "<p><strong>" . sprintf( __( '%s.htaccess has been updated with the necessary mod_rewrite rules. Please verify they are correct. They should look like this:', 'wp-super-cache' ), $home_path ) . "</strong></p>\n";
158
+ } else {
159
+ global $update_mod_rewrite_rules_error;
160
+ echo "<h5>" . __( 'Mod Rewrite rules must be updated!', 'wp-super-cache' ) . "</h5>";
161
+ echo "<p>" . sprintf( __( 'The plugin could not update %1$s.htaccess file: %2$s.<br /> The new rules go above the regular WordPress rules as shown in the code below:', 'wp-super-cache' ), $home_path, "<strong>" . $update_mod_rewrite_rules_error . "</strong>" ) . "</p>\n";
162
+ }
163
+ echo "<div style='overflow: auto; width: 800px; height: 400px; padding:0 8px;color:#4f8a10;background-color:#dff2bf;border:1px solid #4f8a10;'>";
164
+ echo "<p><pre>" . esc_html( $rules ) . "</pre></p>\n</div>";
165
+ } else {
166
+ ?>
167
+ <p><?php printf( __( 'WP Super Cache mod rewrite rules were detected in your %s.htaccess file.<br /> Click the following link to see the lines added to that file. If you have upgraded the plugin, make sure these rules match.', 'wp-super-cache' ), $home_path ); ?></p>
168
+ <?php
169
+ if ( $rules != $scrules ) {
170
+ ?><p style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'><?php _e( 'A difference between the rules in your .htaccess file and the plugin rewrite rules has been found. This could be simple whitespace differences, but you should compare the rules in the file with those below as soon as possible. Click the &#8217;Update Mod_Rewrite Rules&#8217; button to update the rules.', 'wp-super-cache' ); ?></p><?php
171
+ }
172
+ ?><a href="javascript:toggleLayer('rewriterules');" class="button"><?php _e( 'View Mod_Rewrite Rules', 'wp-super-cache' ); ?></a><?php
173
+ wpsc_update_htaccess_form();
174
+ echo "<div id='rewriterules' style='display: none;'>";
175
+ if ( $rules != $scrules )
176
+ echo '<div style="background: #fff; border: 1px solid #333; margin: 2px;">' . wp_text_diff( $scrules, $rules, array( 'title' => __( 'Rewrite Rules', 'wp-super-cache' ), 'title_left' => __( 'Current Rules', 'wp-super-cache' ), 'title_right' => __( 'New Rules', 'wp-super-cache' ) ) ) . "</div>";
177
+ echo "<p><pre># BEGIN WPSuperCache\n" . esc_html( $rules ) . "# END WPSuperCache</pre></p>\n";
178
+ echo "<p>" . sprintf( __( 'Rules must be added to %s too:', 'wp-super-cache' ), WP_CONTENT_DIR . "/cache/.htaccess" ) . "</p>";
179
+ echo "<pre># BEGIN supercache\n" . esc_html( $gziprules ) . "# END supercache</pre></p>";
180
+ echo '</div>';
181
+ }
182
+
183
+ }
184
+ ?></fieldset><?php
185
+ }
186
+
187
+
188
+ $timezone_format = _x('Y-m-d G:i:s', 'timezone date format');
189
+
190
+ ?><fieldset class="options">
191
+ <a name='expirytime'></a>
192
+ <h4><?php _e( 'Expiry Time &amp; Garbage Collection', 'wp-super-cache' ); ?></h4><?php
193
+
194
+ ?><span id="utc-time"><?php printf( __( '<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>', 'wp-super-cache' ), date_i18n( $timezone_format, false, 'gmt' ) ); ?></span><?php
195
+ $current_offset = get_option('gmt_offset');
196
+ if ( get_option('timezone_string') || !empty($current_offset) ) {
197
+ ?><span id="local-time"><?php printf( __( 'Local time is <code>%1$s</code>', 'wp-super-cache' ), date_i18n( $timezone_format ) ); ?></span><?php
198
+ }
199
+ $next_gc = wp_next_scheduled( 'wp_cache_gc' );
200
+ if ( $next_gc )
201
+ echo "<p>" . sprintf( __( 'Next scheduled garbage collection will be at <strong>%s UTC</strong>', 'wp-super-cache' ), date_i18n( $timezone_format, $next_gc, 'gmt' ) ) . "</p>";
202
+
203
+
204
+ if ( $wp_cache_preload_on )
205
+ echo "<p>" . __( 'Warning! <strong>PRELOAD MODE</strong> activated. Supercache files will not be deleted regardless of age.', 'wp-super-cache' ) . "</p>";
206
+
207
+ echo "<script type='text/javascript'>";
208
+ echo "jQuery(function () {
209
+ jQuery('#cache_interval_time').click(function () {
210
+ jQuery('#schedule_interval').attr('checked', true);
211
+ });
212
+ jQuery('#cache_scheduled_time').click(function () {
213
+ jQuery('#schedule_time').attr('checked', true);
214
+ });
215
+ jQuery('#cache_scheduled_select').click(function () {
216
+ jQuery('#schedule_time').attr('checked', true);
217
+ });
218
+ });";
219
+ echo "</script>";
220
+ echo '<form name="wp_edit_max_time" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) . '#expirytime' ) . '" method="post">';
221
+ echo '<input name="action" value="expirytime" type="hidden" />';
222
+ echo '<table class="form-table">';
223
+ echo '<tr><td><label for="wp_max_time"><strong>' . __( 'Cache Timeout', 'wp-super-cache' ) . '</strong></label></td>';
224
+ echo "<td><input type='text' id='wp_max_time' size=6 name='wp_max_time' value='" . esc_attr( $cache_max_time ) . "' /> " . __( "seconds", 'wp-super-cache' ) . "</td></tr>\n";
225
+ echo "<tr><td></td><td>" . __( 'How long should cached pages remain fresh? Set to 0 to disable garbage collection. A good starting point is 3600 seconds.', 'wp-super-cache' ) . "</td></tr>\n";
226
+ echo '<tr><td valign="top"><strong>' . __( 'Scheduler', 'wp-super-cache' ) . '</strong></td><td><table cellpadding=0 cellspacing=0><tr><td valign="top"><input type="radio" id="schedule_interval" name="cache_schedule_type" value="interval" ' . checked( 'interval', $cache_schedule_type, false ) . ' /></td><td valign="top"><label for="cache_interval_time">' . __( 'Timer:', 'wp-super-cache' ) . '</label></td>';
227
+ echo "<td><input type='text' id='cache_interval_time' size=6 name='cache_time_interval' value='" . esc_attr( $cache_time_interval ) . "' /> " . __( "seconds", 'wp-super-cache' ) . '<br />' . __( 'Check for stale cached files every <em>interval</em> seconds.', 'wp-super-cache' ) . "</td></tr>";
228
+ echo '<tr><td valign="top"><input type="radio" id="schedule_time" name="cache_schedule_type" value="time" ' . checked( 'time', $cache_schedule_type, false ) . ' /></td><td valign="top"><label for="schedule_time">' . __( 'Clock:', 'wp-super-cache' ) . '</label></td>';
229
+ echo "<td><input type=\"text\" size=5 id='cache_scheduled_time' name='cache_scheduled_time' value=\"" . esc_attr( $cache_scheduled_time ) . "\" /> " . __( "HH:MM", 'wp-super-cache' ) . "<br />" . __( 'Check for stale cached files at this time <strong>(UTC)</strong> or starting at this time every <em>interval</em> below.', 'wp-super-cache' ) . "</td></tr>";
230
+ $schedules = wp_get_schedules();
231
+ echo "<tr><td><br /></td><td><label for='cache_scheduled_select'>" . __( 'Interval:', 'wp-super-cache' ) . "</label></td><td><select id='cache_scheduled_select' name='cache_schedule_interval' size=1>";
232
+ foreach( $schedules as $desc => $details ) {
233
+ echo "<option value='$desc' " . selected( $desc, $cache_schedule_interval, false ) . " /> {$details[ 'display' ]}</option>";
234
+ }
235
+ echo "</select></td></tr>";
236
+ echo '</table></td></tr>';
237
+ echo '<tr><td><label for="cache_gc_email_me"><strong>' . __( 'Notification Emails', 'wp-super-cache' ) . '</strong></label></td>';
238
+ echo "<td><input type='checkbox' id='cache_gc_email_me' name='cache_gc_email_me' " . checked( $cache_gc_email_me, 1, false ) . " /> " . __( 'Email me when the garbage collection runs.', 'wp-super-cache' ) . "</td></tr>\n";
239
+ echo "</table>\n";
240
+ echo "<h5>" . __( 'Garbage Collection', 'wp-super-cache' ) . "</h5>";
241
+ echo "<ol><li>" . __( '<em>Garbage collection</em> is the simple act of throwing out your garbage. For this plugin that would be old or <em>stale</em> cached files that may be out of date. New cached files are described as <em>fresh</em>.', 'wp-super-cache' ) . "</li>\n";
242
+ echo "<li>" . __( 'Cached files are fresh for a limited length of time. You can set that time in the <em>Cache Timeout</em> text box on this page.', 'wp-super-cache' ) . "</li>\n";
243
+ echo "<li>" . __( 'Stale cached files are not removed as soon as they become stale. They have to be removed by the garbage collecter. That is why you have to tell the plugin when the garbage collector should run.', 'wp-super-cache' ) . "</li>\n";
244
+ echo "<li>" . __( 'Use the <em>Timer</em> or <em>Clock</em> schedulers to define when the garbage collector should run.', 'wp-super-cache' ) . "</li>\n";
245
+ echo "<li>" . __( 'The <em>Timer</em> scheduler tells the plugin to run the garbage collector at regular intervals. When one garbage collection is done, the next run is scheduled.', 'wp-super-cache' ) . "</li>\n";
246
+ echo "<li>" . __( 'Or, the <em>Clock</em> scheduler allows the garbage collection to run at specific times. If set to run hourly or twice daily, the garbage collector will be first scheduled for the time you enter here. It will then run again at the indicated interval. If set to run daily, it will run once a day at the time specified.', 'wp-super-cache' ) . "</li>\n";
247
+ echo "</ol>";
248
+ echo "<p>" . __( 'There are no best garbage collection settings but here are a few scenarios. Garbage collection is separate to other actions that clear our cached files like leaving a comment or publishing a post.', 'wp-super-cache' ) . "</p>\n";
249
+ echo "<ol>";
250
+ echo "<li>" . __( 'Sites that want to serve lots of newly generated data should set the <em>Cache Timeout</em> to 60 and use the <em>Timer</em> scheduler set to 90 seconds.', 'wp-super-cache' ) . "</li>\n";
251
+ echo "<li>" . __( 'Sites with widgets and rss feeds in their sidebar should probably use a timeout of 3600 seconds and set the timer to 600 seconds. Stale files will be caught within 10 minutes of going stale.', 'wp-super-cache' ) . "</li>\n";
252
+ echo "<li>" . __( 'Sites with lots of static content, no widgets or rss feeds in their sidebar can use a timeout of 86400 seconds or even more and set the timer to something equally long.', 'wp-super-cache' ) . "</li>\n";
253
+ echo "<li>" . __( 'Sites where an external data source updates at a particular time every day should set the timeout to 86400 seconds and use the Clock scheduler set appropriately.', 'wp-super-cache' ) . "</li>\n";
254
+ echo "</ol>";
255
+ echo "<p>" . __( 'Checking for and deleting expired files is expensive, but it&#8217;s expensive leaving them there too. On a very busy site, you should set the expiry time to <em>600 seconds</em>. Experiment with different values and visit this page to see how many expired files remain at different times during the day.', 'wp-super-cache' ) . "</p>";
256
+ echo "<p>" . __( 'Set the expiry time to 0 seconds to disable garbage collection.', 'wp-super-cache' ) . "</p>";
257
+ echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Change Expiration', 'wp-super-cache' ) . '" /></div>';
258
+ wp_nonce_field('wp-cache');
259
+ echo "</form>\n";
260
+ ?></fieldset><?php
261
+
262
+ echo '<a name="files"></a><fieldset class="options"><h4>' . __( 'Accepted Filenames &amp; Rejected URIs', 'wp-super-cache' ) . '</h4>';
263
+
264
+ echo '<a name="rejectpages"></a>';
265
+ echo '<p>' . __( 'Do not cache the following page types. See the <a href="https://codex.wordpress.org/Conditional_Tags">Conditional Tags</a> documentation for a complete discussion on each type.', 'wp-super-cache' ) . '</p>';
266
+ echo '<form name="wp_edit_rejected_pages" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) . '#rejectpages' ) . '" method="post">';
267
+ echo '<input type="hidden" name="wp_edit_rejected_pages" value="1" />';
268
+ echo '<label><input type="checkbox" value="1" name="wp_cache_pages[single]" ' . checked( 1, $wp_cache_pages[ 'single' ], false ) . ' /> ' . __( 'Single Posts', 'wp-super-cache' ) . ' (is_single)</label><br />';
269
+ echo '<label><input type="checkbox" value="1" name="wp_cache_pages[pages]" ' . checked( 1, $wp_cache_pages[ 'pages' ], false ) . ' /> ' . __( 'Pages', 'wp-super-cache' ) . ' (is_page)</label><br />';
270
+ echo '<label><input type="checkbox" value="1" name="wp_cache_pages[frontpage]" ' . checked( 1, $wp_cache_pages[ 'frontpage' ], false ) . ' /> ' . __( 'Front Page', 'wp-super-cache' ) . ' (is_front_page)</label><br />';
271
+ echo '&nbsp;&nbsp;<label><input type="checkbox" value="1" name="wp_cache_pages[home]" ' . checked( 1, $wp_cache_pages[ 'home' ], false ) . ' /> ' . __( 'Home', 'wp-super-cache' ) . ' (is_home)</label><br />';
272
+ echo '<label><input type="checkbox" value="1" name="wp_cache_pages[archives]" ' . checked( 1, $wp_cache_pages[ 'archives' ], false ) . ' /> ' . __( 'Archives', 'wp-super-cache' ) . ' (is_archive)</label><br />';
273
+ echo '&nbsp;&nbsp;<label><input type="checkbox" value="1" name="wp_cache_pages[tag]" ' . checked( 1, $wp_cache_pages[ 'tag' ], false ) . ' /> ' . __( 'Tags', 'wp-super-cache' ) . ' (is_tag)</label><br />';
274
+ echo '&nbsp;&nbsp;<label><input type="checkbox" value="1" name="wp_cache_pages[category]" ' . checked( 1, $wp_cache_pages[ 'category' ], false ) . ' /> ' . __( 'Category', 'wp-super-cache' ) . ' (is_category)</label><br />';
275
+ echo '<label><input type="checkbox" value="1" name="wp_cache_pages[feed]" ' . checked( 1, $wp_cache_pages[ 'feed' ], false ) . ' /> ' . __( 'Feeds', 'wp-super-cache' ) . ' (is_feed)</label><br />';
276
+ echo '<label><input type="checkbox" value="1" name="wp_cache_pages[search]" ' . checked( 1, $wp_cache_pages[ 'search' ], false ) . ' /> ' . __( 'Search Pages', 'wp-super-cache' ) . ' (is_search)</label><br />';
277
+ echo '<label><input type="checkbox" value="1" name="wp_cache_pages[author]" ' . checked( 1, $wp_cache_pages[ 'author' ], false ) . ' /> ' . __( 'Author Pages', 'wp-super-cache' ) . ' (is_author)</label><br />';
278
+
279
+ echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Save Settings', 'wp-super-cache' ) . '" /></div>';
280
+ wp_nonce_field('wp-cache');
281
+ echo "</form>\n";
282
+
283
+ echo '<a name="rejecturi"></a><fieldset class="options"><h4>' . __( 'Rejected URL Strings', 'wp-super-cache' ) . '</h4>';
284
+ echo '<form name="wp_edit_rejected" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) . '#rejecturi' ) . '" method="post">';
285
+ echo "<p>" . __( 'Add here strings (not a filename) that forces a page not to be cached. For example, if your URLs include year and you dont want to cache last year posts, it&#8217;s enough to specify the year, i.e. &#8217;/2004/&#8217;. WP-Cache will search if that string is part of the URI and if so, it will not cache that page.', 'wp-super-cache' ) . "</p>\n";
286
+ echo '<textarea name="wp_rejected_uri" cols="40" rows="4" style="width: 50%; font-size: 12px;" class="code">';
287
+ foreach( $cache_rejected_uri as $file ) {
288
+ echo esc_html( $file ) . "\n";
289
+ }
290
+ echo '</textarea> ';
291
+ echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Save Strings', 'wp-super-cache' ) . '" /></div>';
292
+ wp_nonce_field( 'wp-cache' );
293
+ echo "</form>\n";
294
+
295
+ echo '<a name="rejectcookies"></a><fieldset class="options"><h4>' . __( 'Rejected Cookies', 'wp-super-cache' ) . '</h4>';
296
+ echo '<form name="wp_edit_rejected_cookies" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) . '#rejectcookies' ) . '" method="post">';
297
+ echo "<p>" . __( 'Do not cache pages when these cookies are set. Add the cookie names here, one per line. Matches on fragments, so "test" will match "WordPress_test_cookie". (Simple caching only)', 'wp-super-cache' ) . "</p>\n";
298
+ echo '<textarea name="wp_rejected_cookies" cols="40" rows="4" style="width: 50%; font-size: 12px;" class="code">';
299
+ foreach ( (array) $wpsc_rejected_cookies as $file) {
300
+ echo esc_html( $file ) . "\n";
301
+ }
302
+ echo '</textarea> ';
303
+ echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Save', 'wp-super-cache' ) . '" /></div>';
304
+ wp_nonce_field('wp-cache');
305
+ echo "</form>\n";
306
+
307
+ echo '<a name="cancache"></a><fieldset class="options"><h4>' . __( 'Always Cache Filenames', 'wp-super-cache' ) . '</h4>';
308
+ echo '<div style="clear:both"></div><form name="wp_edit_accepted" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) . '#cancache' ) . '" method="post">';
309
+ echo "<p>" . __( 'Add here those filenames that can be cached, even if they match one of the rejected substring specified above.', 'wp-super-cache' ) . "</p>\n";
310
+ echo '<textarea name="wp_accepted_files" cols="40" rows="8" style="width: 50%; font-size: 12px;" class="code">';
311
+ foreach ($cache_acceptable_files as $file) {
312
+ echo esc_html($file) . "\n";
313
+ }
314
+ echo '</textarea> ';
315
+ echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Save Files', 'wp-super-cache' ) . '" /></div>';
316
+ wp_nonce_field('wp-cache');
317
+ echo "</form>\n";
318
+
319
+ echo '</fieldset>';
partials/debug.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ extract( wpsc_update_debug_settings() ); // $wp_super_cache_debug, $wp_cache_debug_log, $wp_cache_debug_ip, $wp_super_cache_comments, $wp_super_cache_front_page_check, $wp_super_cache_front_page_clear, $wp_super_cache_front_page_text, $wp_super_cache_front_page_notification, $wp_super_cache_advanced_debug, $wp_cache_debug_username
3
+ $admin_url = admin_url( 'options-general.php?page=wpsupercache' );
4
+
5
+ echo '<a name="debug"></a>';
6
+ echo '<fieldset class="options">';
7
+ echo '<p>' . __( 'Fix problems with the plugin by debugging it here. It will log to a file in your cache directory.', 'wp-super-cache' ) . '</p>';
8
+ if ( ! isset( $wp_cache_debug_log ) || $wp_cache_debug_log == '' ) {
9
+ extract( wpsc_create_debug_log() ); // $wp_cache_debug_log, $wp_cache_debug_username
10
+ }
11
+
12
+ $log_file_link = "<a href='" . site_url( str_replace( ABSPATH, '', "{$cache_path}view_{$wp_cache_debug_log}?wp-admin=1&wp-json=1&filter=" ) ) . "'>$wp_cache_debug_log</a>";
13
+
14
+ if ( $wp_super_cache_debug == 1 ) {
15
+ echo "<p>" . sprintf( __( 'Currently logging to: %s', 'wp-super-cache' ), $log_file_link ) . "</p>";
16
+ } else {
17
+ echo "<p>" . sprintf( __( 'Last Logged to: %s', 'wp-super-cache' ), $log_file_link ) . "</p>";
18
+ }
19
+ echo "<p>" . sprintf( __( 'Username/Password: %s', 'wp-super-cache' ), $wp_cache_debug_username ) . "</p>";
20
+
21
+ echo '<form name="wpsc_delete" action="' . esc_url_raw( add_query_arg( 'tab', 'debug', $admin_url ) ) . '" method="post">';
22
+ wp_nonce_field('wp-cache');
23
+ echo "<input type='hidden' name='wpsc_delete_log' value='1' />";
24
+ submit_button( __( 'Delete', 'wp-super-cache' ), 'delete', 'wpsc_delete_log_form', false );
25
+ echo "</form>";
26
+
27
+ echo '<form name="wpsc_delete" action="' . esc_url_raw( add_query_arg( 'tab', 'debug', $admin_url ) ) . '" method="post">';
28
+ if ( ! isset( $wp_super_cache_debug ) || $wp_super_cache_debug == 0 ) {
29
+ $debug_status_message = __( 'Enable Logging', 'wp-super-cache' );
30
+ $not_status = 1;
31
+ } else {
32
+ $debug_status_message = __( 'Disable Logging', 'wp-super-cache' );
33
+ $not_status = 0;
34
+ }
35
+ echo "<input type='hidden' name='wp_super_cache_debug' value='" . $not_status . "' />";
36
+ wp_nonce_field('wp-cache');
37
+ submit_button( $debug_status_message, 'primary', 'wpsc_log_status', true );
38
+ echo "</form>";
39
+
40
+ echo '<form name="wp_cache_debug" action="' . esc_url_raw( add_query_arg( 'tab', 'debug', $admin_url ) ) . '" method="post">';
41
+ echo "<input type='hidden' name='wp_cache_debug' value='1' /><br />";
42
+ echo "<table class='form-table'>";
43
+ echo "<tr><th>" . __( 'IP Address', 'wp-super-cache' ) . "</th><td> <input type='text' size='20' name='wp_cache_debug_ip' value='{$wp_cache_debug_ip}' /> " . sprintf( __( '(only log requests from this IP address. Your IP is %s)', 'wp-super-cache' ), $_SERVER[ 'REMOTE_ADDR' ] ) . "</td></tr>";
44
+ echo "<tr><th valign='top'>" . __( 'Cache Status Messages', 'wp-super-cache' ) . "</th><td><input type='checkbox' name='wp_super_cache_comments' value='1' " . checked( 1, $wp_super_cache_comments, false ) . " /> " . __( 'enabled', 'wp-super-cache' ) . "<br />";
45
+ echo __( 'Display comments at the end of every page like this:', 'wp-super-cache' ) . "<br />";
46
+ echo "<pre>&lt;!-- Dynamic page generated in 0.450 seconds. -->
47
+ &lt;!-- Cached page generated by WP-Super-Cache on " . date( "Y-m-d H:i:s", time() ) . " -->
48
+ &lt;!-- super cache --></pre></td></tr>";
49
+ echo "</table>\n";
50
+ if ( isset( $wp_super_cache_advanced_debug ) ) {
51
+ echo "<h5>" . __( 'Advanced', 'wp-super-cache' ) . "</h5><p>" . __( 'In very rare cases two problems may arise on some blogs:<ol><li> The front page may start downloading as a zip file.</li><li> The wrong page is occasionally cached as the front page if your blog uses a static front page and the permalink structure is <em>/%category%/%postname%/</em>.</li></ol>', 'wp-super-cache' ) . '</p>';
52
+ echo "<p>" . __( 'I&#8217;m 99% certain that they aren&#8217;t bugs in WP Super Cache and they only happen in very rare cases but you can run a simple check once every 5 minutes to verify that your site is ok if you&#8217;re worried. You will be emailed if there is a problem.', 'wp-super-cache' ) . "</p>";
53
+ echo "<table class='form-table'>";
54
+ echo "<tr><td valign='top' colspan='2'><input type='checkbox' name='wp_super_cache_front_page_check' value='1' " . checked( 1, $wp_super_cache_front_page_check, false ) . " /> " . __( 'Check front page every 5 minutes.', 'wp-super-cache' ) . "</td></tr>";
55
+ echo "<tr><td valign='top'>" . __( 'Front page text', 'wp-super-cache' ) . "</td><td> <input type='text' size='30' name='wp_super_cache_front_page_text' value='{$wp_super_cache_front_page_text}' /> (" . __( 'Text to search for on your front page. If this text is missing, the cache will be cleared. Leave blank to disable.', 'wp-super-cache' ) . ")</td></tr>";
56
+ echo "<tr><td valign='top' colspan='2'><input type='checkbox' name='wp_super_cache_front_page_clear' value='1' " . checked( 1, $wp_super_cache_front_page_clear, false ) . " /> " . __( 'Clear cache on error.', 'wp-super-cache' ) . "</td></tr>";
57
+ echo "<tr><td valign='top' colspan='2'><input type='checkbox' name='wp_super_cache_front_page_notification' value='1' " . checked( 1, $wp_super_cache_front_page_notification, false ) . " /> " . __( 'Email the blog admin when checks are made. (useful for testing)', 'wp-super-cache' ) . "</td></tr>";
58
+
59
+ echo "</table>\n";
60
+ }
61
+ echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Save Settings', 'wp-super-cache' ) . '" /></div>';
62
+ wp_nonce_field('wp-cache');
63
+ echo "</form>\n";
64
+ echo '</fieldset>';
partials/easy.php ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ echo '<form name="wp_manager" action="' . esc_url_raw( add_query_arg( 'tab', 'easy', $admin_url ) ) . '" method="post">';
3
+ echo '<input type="hidden" name="action" value="easysetup" />';
4
+ wp_nonce_field( 'wp-cache' );
5
+ ?>
6
+ <table class="form-table">
7
+ <tr valign="top">
8
+ <th scope="row"><label for="wp_cache_status"><?php esc_html_e( 'Caching', 'wp-super-cache' ); ?></label></th>
9
+ <td>
10
+ <fieldset>
11
+ <label><input type='radio' name='wp_cache_easy_on' value='1' <?php checked( $cache_enabled ); ?> ><?php echo esc_html__( 'Caching On', 'wp-super-cache' ) . ' <em>(' . esc_html__( 'Recommended', 'wp-super-cache' ) . ')</em>'; ?></label><br />
12
+ <label><input type='radio' name='wp_cache_easy_on' value='0' <?php checked( ! $cache_enabled ); ?> ><?php esc_html_e( 'Caching Off', 'wp-super-cache' ); ?></label><br />
13
+ </fieldset>
14
+ </td>
15
+ </tr>
16
+ </table>
17
+ <p><?php _e( 'The following recommended settings will be enabled:', 'wp-super-cache' ); ?></p>
18
+ <ol>
19
+ <li><?php _e( 'Caching disabled for logged in visitors.', 'wp-super-cache' ); ?></li>
20
+ <li><?php _e( 'Simple caching.', 'wp-super-cache' ); ?></li>
21
+ <li><?php _e( 'Cache Rebuild.', 'wp-super-cache' ); ?></li>
22
+ <li><?php _e( 'Interval garbage collection every 10 minutes with a cache lifetime of 30 minutes (if not configured already).', 'wp-super-cache' ); ?></li>
23
+ </ol>
24
+ <p><?php _e( 'These settings can be modified on the Advanced Settings page.', 'wp-super-cache' ); ?></p>
25
+ <?php
26
+ if ( ! $is_nginx && $cache_enabled && ! $wp_cache_mod_rewrite ) {
27
+ $scrules = trim( implode( "\n", extract_from_markers( trailingslashit( get_home_path() ) . '.htaccess', 'WPSuperCache' ) ) );
28
+ if ( ! empty( $scrules ) ) {
29
+ echo '<p><strong>' . esc_html__( 'Notice: Simple caching enabled but Supercache mod_rewrite rules from expert mode detected. Cached files will be served using those rules. If your site is working ok, please ignore this message. Otherwise, you can edit the .htaccess file in the root of your install and remove the SuperCache rules.', 'wp-super-cache' ) . '</strong></p>';
30
+ }
31
+ }
32
+ echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . ' value="' . esc_html__( 'Update Status', 'wp-super-cache' ) . '" /></div></form>';
33
+ if ( $cache_enabled ) {
34
+ echo '<h4>' . esc_html__( 'Cache Tester', 'wp-super-cache' ) . '</h4>';
35
+ echo '<p>' . esc_html__( 'Test your cached website by clicking the test button below.', 'wp-super-cache' ) . '</p>';
36
+ echo '<p>' . __( 'Note: if you use Cloudflare or other transparent front-end proxy service this test may fail.<ol><li> If you have Cloudflare minification enabled this plugin may detect differences in the pages and report an error.</li><li> Try using the development mode of Cloudflare to perform the test. You can disable development mode afterwards if the test succeeds.</li></ol>', 'wp-super-cache' ) . '</p>';
37
+ if ( array_key_exists( 'action', $_POST ) && 'test' === $_POST['action'] && $valid_nonce ) {
38
+ $url = trailingslashit( get_bloginfo( 'url' ) );
39
+ if ( isset( $_POST['httponly'] ) ) {
40
+ $url = str_replace( 'https://', 'http://', $url );
41
+ }
42
+ $test_messages = array( esc_html__( 'Fetching %s to prime cache: ', 'wp-super-cache' ), esc_html__( 'Fetching first copy of %s: ', 'wp-super-cache' ), esc_html__( 'Fetching second copy of %s: ', 'wp-super-cache' ) );
43
+ $c = 0;
44
+ $cache_test_error = false;
45
+ $page = array();
46
+ foreach ( $test_messages as $message ) {
47
+ echo '<p>' . sprintf( $message, $url );
48
+ $page[ $c ] = wp_remote_get( $url, array( 'timeout' => 60, 'blocking' => true ) );
49
+ if ( ! is_wp_error( $page[ $c ] ) ) {
50
+ $fp = fopen( $cache_path . $c . '.html', 'w' );
51
+ fwrite( $fp, $page[ $c ]['body'] );
52
+ fclose( $fp );
53
+ echo '<span style="color: #0a0; font-weight: bold;">' . esc_html__( 'OK', 'wp-super-cache' ) . "</span> (<a href='" . esc_url_raw( WP_CONTENT_URL . '/cache/' . $c . '.html' ) . "'>" . $c . '.html</a>)</p>';
54
+ sleep( 1 );
55
+ } else {
56
+ $cache_test_error = true;
57
+ echo '<span style="color: #a00; font-weight: bold;">' . esc_html__( 'FAILED', 'wp-super-cache' ) . '</span></p>';
58
+ $errors = '';
59
+ $messages = '';
60
+ foreach ( $page[ $c ]->get_error_codes() as $code ) {
61
+ $severity = $page[ $c ]->get_error_data( $code );
62
+ foreach ( $page[ $c ]->get_error_messages( $code ) as $err ) {
63
+ $errors .= $severity . ': ' . $err . "<br />\n";
64
+ }
65
+ }
66
+ if ( ! empty( $errors ) ) {
67
+ echo '<p>' . sprintf( __( '<strong>Errors:</strong> %s', 'wp-super-cache' ), $errors ) . '</p>';
68
+ }
69
+ }
70
+ $c ++;
71
+ }
72
+
73
+ if ( false == $cache_test_error ) {
74
+ echo '<ul><li>' . sprintf( esc_html__( 'Page %d: %d (%s)', 'wp-super-cache' ), 1, intval( $page[1]['response']['code'] ), esc_attr( $page[1]['response']['message'] ) ) . '</li>';
75
+ echo '<li>' . sprintf( esc_html__( 'Page %d: %d (%s)', 'wp-super-cache' ), 2, intval( $page[2]['response']['code'] ), esc_attr( $page[2]['response']['message'] ) ) . '</li></ul>';
76
+ }
77
+
78
+ if ( false == $cache_test_error && preg_match( '/(Cached page generated by WP-Super-Cache on) ([0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]*)/', $page[1]['body'], $matches1 ) &&
79
+ preg_match( '/(Cached page generated by WP-Super-Cache on) ([0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]*)/', $page[2]['body'], $matches2 ) && $matches1[2] == $matches2[2]
80
+ ) {
81
+ echo '<p>' . sprintf( esc_html__( 'Page 1: %s', 'wp-super-cache' ), $matches1[2] ) . '</p>';
82
+ echo '<p>' . sprintf( esc_html__( 'Page 2: %s', 'wp-super-cache' ), $matches2[2] ) . '</p>';
83
+ echo '<p><span style="color: #0a0; font-weight: bold;">' . esc_html__( 'The timestamps on both pages match!', 'wp-super-cache' ) . '</span></p>';
84
+ } else {
85
+ echo '<p><strong>' . esc_html__( 'The pages do not match! Timestamps differ or were not found!', 'wp-super-cache' ) . '</strong></p>';
86
+ echo '<p>' . esc_html__( 'Things you can do:', 'wp-super-cache' ) . '</p>';
87
+ echo '<ol><li>' . esc_html__( 'Load your homepage in a logged out browser, check the timestamp at the end of the html source. Load the page again and compare the timestamp. Caching is working if the timestamps match.', 'wp-super-cache' ) . '</li>';
88
+ echo '<li>' . esc_html__( 'Enable logging on the Debug page here. That should help you track down the problem.', 'wp-super-cache' ) . '</li>';
89
+ echo '<li>' . esc_html__( 'You should check Page 1 and Page 2 above for errors. Your local server configuration may not allow your website to access itself.', 'wp-super-cache' ) . '</li>';
90
+ echo '</ol>';
91
+ }
92
+ }
93
+ echo '<form name="cache_tester" action="' . esc_url_raw( add_query_arg( 'tab', 'easy', $admin_url ) ) . '" method="post">';
94
+ echo '<input type="hidden" name="action" value="test" />';
95
+ if ( ! empty( $_SERVER['HTTPS'] ) && 'on' === strtolower( $_SERVER['HTTPS'] ) ) {
96
+ echo '<input type="checkbox" name="httponly" checked="checked" value="1" /> ' . esc_html__( 'Send non-secure (non https) request for homepage', 'wp-super-cache' );
97
+ }
98
+
99
+ if ( isset( $wp_super_cache_comments ) && $wp_super_cache_comments == 0 ) {
100
+ echo '<p>' . __( '<strong>Warning!</strong> Cache comments are currently disabled. Please go to the Debug page and enable Cache Status Messages there. You should clear the cache before testing.', 'wp-super-cache' ) . '</p>';
101
+ echo '<div class="submit"><input disabled style="color: #aaa" class="button-secondary" type="submit" name="test" value="' . esc_html__( 'Test Cache', 'wp-super-cache' ) . '" /></div>';
102
+ } else {
103
+ echo '<div class="submit"><input class="button-secondary" type="submit" name="test" value="' . __( 'Test Cache', 'wp-super-cache' ) . '" /></div>';
104
+ }
105
+
106
+ wp_nonce_field( 'wp-cache' );
107
+ echo '</form>';
108
+ }
109
+ echo '<h4>' . esc_html__( 'Delete Cached Pages', 'wp-super-cache' ) . '</h4>';
110
+ echo '<p>' . esc_html__( 'Cached pages are stored on your server as html and PHP files. If you need to delete them, use the button below.', 'wp-super-cache' ) . '</p>';
111
+ echo '<form name="wp_cache_content_delete" action="' . esc_url_raw( add_query_arg( 'tab', 'contents', $admin_url ) ) . '" method="post">';
112
+ echo '<input type="hidden" name="wp_delete_cache" />';
113
+ echo '<div class="submit"><input id="deletepost" class="button-secondary" type="submit" ' . SUBMITDISABLED . 'value="' . esc_html__( 'Delete Cache', 'wp-super-cache' ) . ' " /></div>';
114
+ wp_nonce_field( 'wp-cache' );
115
+ echo "</form>\n";
116
+
117
+ if ( is_multisite() && wpsupercache_site_admin() ) {
118
+ echo '<form name="wp_cache_content_delete" action="' . esc_url_raw( add_query_arg( 'tab', 'contents', $admin_url ) . '#listfiles' ) . '" method="post">';
119
+ echo '<input type="hidden" name="wp_delete_all_cache" />';
120
+ echo '<div class="submit"><input id="deleteallpost" class="button-secondary" type="submit" ' . SUBMITDISABLED . 'value="' . esc_html__( 'Delete Cache On All Blogs', 'wp-super-cache' ) . '" /></div>';
121
+ wp_nonce_field( 'wp-cache' );
122
+ echo "</form><br />\n";
123
+ }
124
+ ?>
125
+ <h4 class="clear"><?php esc_html_e( 'Recommended Links and Plugins', 'wp-super-cache' ); ?></h4>
126
+ <p><?php esc_html_e( 'Caching is only one part of making a website faster. Here are some other plugins that will help:', 'wp-super-cache' ); ?></p>
127
+ <ul style="list-style: square; margin-left: 2em;">
128
+ <li><?php printf( __( '<a href="%s">Jetpack</a> provides everything you need to build a successful WordPress website including an image/photo CDN (free) and a video hosting service (paid).', 'wp-super-cache' ), 'https://jetpack.com/redirect/?source=jitm-wpsc-recommended' ); ?></li>
129
+ <li><?php printf( __( '<a href="%s">Yahoo! Yslow</a> analyzes web pages and suggests ways to improve their performance based on a set of rules for high performance web pages. Also try the performance tools online at <a href="%s">GTMetrix</a>.', 'wp-super-cache' ), 'http://yslow.org/', 'https://gtmetrix.com/' ); ?></li>
130
+ <li><?php printf( __( '<a href="%s">Use Google Libraries</a> allows you to load some commonly used Javascript libraries from Google webservers. Ironically, it may reduce your Yslow score.', 'wp-super-cache' ), 'https://wordpress.org/plugins/use-google-libraries/' ); ?></li>
131
+ <li><?php printf( __( '<strong>Advanced users only:</strong> Install an object cache. Choose from <a href="%s">Memcached</a>, <a href="%s">XCache</a>, <a href="%s">eAcccelerator</a> and others.', 'wp-super-cache' ), 'https://wordpress.org/plugins/memcached/', 'https://neosmart.net/WP/XCache/', 'https://neosmart.net/WP/eAccelerator/' ); ?></li>
132
+ <li><?php printf( __( '<a href="%s">WP Crontrol</a> is a useful plugin to use when trying to debug garbage collection and preload problems.', 'wp-super-cache' ), 'https://wordpress.org/plugins/wp-crontrol/' ); ?></li>
133
+ </ul>
134
+
partials/lockdown.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <a name='lockdown'></a>
2
+ <fieldset class="options">
3
+ <h4><?php _e( 'Lock Down:', 'wp-super-cache' ); ?> <?php echo $wp_lock_down == '0' ? '<span style="color:red">' . __( 'Disabled', 'wp-super-cache' ) . '</span>' : '<span style="color:green">' . __( 'Enabled', 'wp-super-cache' ) . '</span>'; ?></h4>
4
+ <p><?php _e( 'Prepare your server for an expected spike in traffic by enabling the lock down. When this is enabled, new comments on a post will not refresh the cached static files.', 'wp-super-cache' ); ?></p>
5
+ <p><?php _e( 'Developers: Make your plugin lock down compatible by checking the "WPLOCKDOWN" constant. The following code will make sure your plugin respects the WPLOCKDOWN setting.', 'wp-super-cache' ); ?>
6
+ <blockquote><code>if( defined( 'WPLOCKDOWN' ) && constant( 'WPLOCKDOWN' ) ) {
7
+ &nbsp;&nbsp;&nbsp;&nbsp;echo "<?php _e( 'Sorry. My blog is locked down. Updates will appear shortly', 'wp-super-cache' ); ?>";
8
+ }</code></blockquote>
9
+ <?php
10
+ if( $wp_lock_down == '1' ) {
11
+ ?><p><?php _e( 'WordPress is locked down. Super Cache static files will not be deleted when new comments are made.', 'wp-super-cache' ); ?></p><?php
12
+ } else {
13
+ ?><p><?php _e( 'WordPress is not locked down. New comments will refresh Super Cache static files as normal.', 'wp-super-cache' ); ?></p><?php
14
+ }
15
+ $new_lockdown = $wp_lock_down == '1' ? '0' : '1';
16
+ $new_lockdown_desc = $wp_lock_down == '1' ? __( 'Disable', 'wp-super-cache' ) : __( 'Enable', 'wp-super-cache' );
17
+ echo '<form name="wp_lock_down" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) . '#lockdown' ) . '" method="post">';
18
+ echo "<input type='hidden' name='wp_lock_down' value='{$new_lockdown}' />";
19
+ echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . ' value="' . esc_attr( $new_lockdown_desc . ' ' . __( 'Lock Down', 'wp-super-cache' ) ) . '" /></div>';
20
+ wp_nonce_field( 'wp-cache' );
21
+ echo '</form>';
22
+
23
+ ?></fieldset><?php
24
+ if( $cache_enabled == true && $super_cache_enabled == true ) {
25
+ ?><a name='direct'></a>
26
+ <fieldset class="options">
27
+ <h4><?php _e( 'Directly Cached Files', 'wp-super-cache' ); ?></h4><?php
28
+
29
+ $cached_direct_pages = wpsc_update_direct_pages();
30
+
31
+ $readonly = '';
32
+ if( !is_writeable_ACLSafe( ABSPATH ) ) {
33
+ $readonly = 'READONLY';
34
+ ?><p style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'><strong><?php _e( 'Warning!', 'wp-super-cache' ); ?></strong> <?php printf( __( 'You must make %s writable to enable this feature. As this is a security risk, please make it read-only after your page is generated.', 'wp-super-cache' ), ABSPATH ); ?></p><?php
35
+ } else {
36
+ $abspath_stat = stat(ABSPATH . '/');
37
+ $abspath_mode = decoct( $abspath_stat[ 'mode' ] & 0777 );
38
+ if ( substr( $abspath_mode, -2 ) == '77' ) {
39
+ ?><p style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'><strong><?php _e( 'Warning!', 'wp-super-cache' ); ?></strong> <?php printf( __( '%s is writable. Please make it readonly after your page is generated as this is a security risk.', 'wp-super-cache' ), ABSPATH ); ?></p><?php
40
+ }
41
+ }
42
+ echo '<form name="direct_page" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) . '#direct' ) . '" method="post">';
43
+ if( is_array( $cached_direct_pages ) ) {
44
+ $out = '';
45
+ foreach( $cached_direct_pages as $page ) {
46
+ if( $page == '' )
47
+ continue;
48
+ $generated = '';
49
+ if( is_file( ABSPATH . $page . '/index.html' ) )
50
+ $generated = '<input class="button-secondary" type="Submit" name="deletepage" value="' . $page . '">';
51
+ $out .= "<tr><td><input type='text' $readonly name='direct_pages[]' size='30' value='$page' /></td><td>$generated</td></tr>";
52
+ }
53
+ if( $out != '' ) {
54
+ ?><table><tr><th><?php _e( 'Existing direct page', 'wp-super-cache' ); ?></th><th><?php _e( 'Delete cached file', 'wp-super-cache' ); ?></th></tr><?php
55
+ echo "$out</table>";
56
+ }
57
+ }
58
+
59
+ if ( 'READONLY' !== $readonly ) {
60
+ echo esc_html__( 'Add direct page:', 'wp-super-cache' ) . '<input type="text" name="new_direct_page" size="30" value="" />';
61
+ }
62
+ echo '<p>' . sprintf(
63
+ esc_html__( 'Directly cached files are files created directly off %s where your blog lives. This feature is only useful if you are expecting a major Digg or Slashdot level of traffic to one post or page.', 'wp-super-cache' ),
64
+ esc_attr( ABSPATH )
65
+ ) . '</p>';
66
+ if ( 'READONLY' !== $readonly ) {
67
+ echo '<p>' . sprintf( __( 'For example: to cache <em>%1$sabout/</em>, you would enter %1$sabout/ or /about/. The cached file will be generated the next time an anonymous user visits that page.', 'wp-super-cache' ),
68
+ esc_attr( trailingslashit( get_option( 'home' ) ) )
69
+ ) . '</p>';
70
+ echo '<p>' . esc_html__( 'Make the textbox blank to remove it from the list of direct pages and delete the cached file.', 'wp-super-cache' ) . '</p>';
71
+
72
+ echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . ' value="' . esc_attr__( 'Update Direct Pages', 'wp-super-cache' ) . '" /></div>';
73
+ }
74
+ wp_nonce_field( 'wp-cache' );
75
+ echo '</form>';
76
+ ?>
77
+ </fieldset>
78
+ <?php
79
+ } // if $super_cache_enabled
partials/preload.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ echo '<a name="preload"></a>';
3
+ if ( ! $cache_enabled || ! $super_cache_enabled || true === defined( 'DISABLESUPERCACHEPRELOADING' ) ) {
4
+ echo '<div class="notice notice-warning"><p>' . __( 'Preloading of cache disabled. Please make sure simple or expert mode is enabled or talk to your host administrator.', 'wp-super-cache' ) . '</p></div>';
5
+ return;
6
+ }
7
+
8
+ $count = wpsc_post_count();
9
+ if ( $count > 1000 ) {
10
+ $min_refresh_interval = 720;
11
+ } else {
12
+ $min_refresh_interval = 30;
13
+ }
14
+
15
+ echo '<p>' . __( 'This will cache every published post and page on your site. It will create supercache static files so unknown visitors (including bots) will hit a cached page. This will probably help your Google ranking as they are using speed as a metric when judging websites now.', 'wp-super-cache' ) . '</p>';
16
+ echo '<p>' . __( 'Preloading creates lots of files however. Caching is done from the newest post to the oldest so please consider only caching the newest if you have lots (10,000+) of posts. This is especially important on shared hosting.', 'wp-super-cache' ) . '</p>';
17
+ echo '<p>' . __( 'In &#8217;Preload Mode&#8217; regular garbage collection will be disabled so that old cache files are not deleted. This is a recommended setting when the cache is preloaded.', 'wp-super-cache' ) . '</p>';
18
+ echo '<form name="cache_filler" action="' . esc_url_raw( add_query_arg( 'tab', 'preload', $admin_url ) ) . '" method="POST">';
19
+ echo '<input type="hidden" name="action" value="preload" />';
20
+ echo '<input type="hidden" name="page" value="wpsupercache" />';
21
+ echo '<p>' . sprintf( __( 'Refresh preloaded cache files every %s minutes. (0 to disable, minimum %d minutes.)', 'wp-super-cache' ), "<input type='text' size=4 name='wp_cache_preload_interval' value='" . (int) $wp_cache_preload_interval . "' />", $min_refresh_interval ) . '</p>';
22
+ if ( $count > 100 ) {
23
+ $step = (int)( $count / 10 );
24
+
25
+ $select = "<select name='wp_cache_preload_posts' size=1>";
26
+ $select .= "<option value='all' ";
27
+ if ( ! isset( $wp_cache_preload_posts ) || $wp_cache_preload_posts == 'all' ) {
28
+ $checked = 'selectect=1 ';
29
+ $best = 'all';
30
+ } else {
31
+ $checked = ' ';
32
+ $best = $wp_cache_preload_posts;
33
+ }
34
+ $select .= "{$checked}>" . __( 'all', 'wp-super-cache' ) . "</option>";
35
+
36
+ for( $c = $step; $c < $count; $c += $step ) {
37
+ $checked = ' ';
38
+ if ( $best == $c )
39
+ $checked = 'selected=1 ';
40
+ $select .= "<option value='$c'{$checked}>$c</option>";
41
+ }
42
+ $checked = ' ';
43
+ if ( $best == $count )
44
+ $checked = 'selected=1 ';
45
+ $select .= "<option value='$count'{$checked}>$count</option>";
46
+ $select .= "</select>";
47
+ echo '<p>' . sprintf( __( 'Preload %s posts.', 'wp-super-cache' ), $select ) . '</p>';
48
+ } else {
49
+ echo '<input type="hidden" name="wp_cache_preload_posts" value="' . $count . '" />';
50
+ }
51
+
52
+ echo '<input type="checkbox" name="wp_cache_preload_on" value="1" ';
53
+ echo $wp_cache_preload_on == 1 ? 'checked=1' : '';
54
+ echo ' /> ' . __( 'Preload mode (garbage collection disabled. Recommended.)', 'wp-super-cache' ) . '<br />';
55
+ echo '<input type="checkbox" name="wp_cache_preload_taxonomies" value="1" ';
56
+ echo $wp_cache_preload_taxonomies == 1 ? 'checked=1' : '';
57
+ echo ' /> ' . __( 'Preload tags, categories and other taxonomies.', 'wp-super-cache' ) . '<br />';
58
+ echo __( 'Send me status emails when files are refreshed.', 'wp-super-cache' ) . '<br />';
59
+ if ( !isset( $wp_cache_preload_email_volume ) )
60
+ $wp_cache_preload_email_volume = 'none';
61
+ echo '<select type="select" name="wp_cache_preload_email_volume">';
62
+ echo '<option value="none" '. selected( 'none', $wp_cache_preload_email_volume ) . '>'. __( 'No Emails', 'wp-super-cache' ) . '</option>';
63
+ echo '<option value="many" '. selected( 'many', $wp_cache_preload_email_volume ) . '>'. __( 'Many emails, 2 emails per 100 posts.', 'wp-super-cache' ) . '</option>';
64
+ echo '<option value="medium" '. selected( 'medium', $wp_cache_preload_email_volume ) . '>'. __( 'Medium, 1 email per 100 posts.', 'wp-super-cache' ) . '</option>';
65
+ echo '<option value="less" '. selected( 'less', $wp_cache_preload_email_volume ) . '>'. __( 'Less emails, 1 at the start and 1 at the end of preloading all posts.', 'wp-super-cache' ) . '</option>';
66
+ echo "</select>";
67
+
68
+ if ( wp_next_scheduled( 'wp_cache_preload_hook' ) || wp_next_scheduled( 'wp_cache_full_preload_hook' ) ) {
69
+ $currently_preloading = true;
70
+ }
71
+ echo '<div class="submit"><input class="button-primary" type="submit" name="preload" value="' . __( 'Save Settings', 'wp-super-cache' ) . '" />';
72
+ echo '</div>';
73
+ wp_nonce_field( 'wp-cache' );
74
+ echo '</form>';
75
+ echo '<form name="do_preload" action="' . esc_url_raw( add_query_arg( 'tab', 'preload', $admin_url ) ) . '" method="POST">';
76
+ echo '<input type="hidden" name="action" value="preload" />';
77
+ echo '<input type="hidden" name="page" value="wpsupercache" />';
78
+ echo '<div class="submit">';
79
+ if ( false == $currently_preloading ) {
80
+ echo '<input class="button-primary" type="submit" name="preload_now" value="' . __( 'Preload Cache Now', 'wp-super-cache' ) . '" />';
81
+ } else {
82
+ echo '<input class="button-primary" type="submit" name="preload_off" value="' . __( 'Cancel Cache Preload', 'wp-super-cache' ) . '" />';
83
+ }
84
+ echo '</div>';
85
+ wp_nonce_field( 'wp-cache' );
86
+ echo '</form>';
partials/rejected_user_agents.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ echo '<a name="useragents"></a><fieldset class="options"><h4>' . __( 'Rejected User Agents', 'wp-super-cache' ) . '</h4>';
3
+ echo "<p>" . __( 'Strings in the HTTP &#8217;User Agent&#8217; header that prevent WP-Cache from caching bot, spiders, and crawlers&#8217; requests. Note that super cached files are still sent to these agents if they already exists.', 'wp-super-cache' ) . "</p>\n";
4
+ echo '<form name="wp_edit_rejected_user_agent" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) . '#useragents' ) . '" method="post">';
5
+ echo '<textarea name="wp_rejected_user_agent" cols="40" rows="4" style="width: 50%; font-size: 12px;" class="code">';
6
+ foreach( $cache_rejected_user_agent as $ua ) {
7
+ echo esc_html( $ua ) . "\n";
8
+ }
9
+ echo '</textarea> ';
10
+ echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Save UA Strings', 'wp-super-cache' ) . '" /></div>';
11
+ wp_nonce_field('wp-cache');
12
+ echo '</form>';
13
+ echo "</fieldset>\n";
14
+
partials/restore.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+ echo '<fieldset class="options"><h4>' . __( 'Fix Configuration', 'wp-super-cache' ) . '</h4>';
3
+ echo '<form name="wp_restore" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) . '#top' ) . '" method="post">';
4
+ echo '<input type="hidden" name="wp_restore_config" />';
5
+ echo '<div class="submit"><input class="button-secondary" type="submit" ' . SUBMITDISABLED . 'id="deletepost" value="' . __( 'Restore Default Configuration', 'wp-super-cache' ) . '" /></div>';
6
+ wp_nonce_field('wp-cache');
7
+ echo "</form>\n";
8
+ echo '</fieldset>';
partials/tracking_parameters.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ echo '<a name="trackingparameters"></a><fieldset class="options"><h4>' . __( 'Tracking Parameters', 'wp-super-cache' ) . '</h4>';
3
+ echo '<form name="edit_tracking_parameters" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) . '#trackingparameters' ) . '" method="post">';
4
+ echo "<p>" . __( 'Tracking parameters to ignore when caching. Visitors from Facebook, Twitter and elsewhere to your website will go to a URL with tracking parameters added. This setting allows the plugin to ignore those parameters and show an already cached page. Any actual tracking by Google Analytics or other Javascript based code should still work as the URL of the page is not modified.', 'wp-super-cache' ) . "</p>\n";
5
+ echo '<textarea name="tracking_parameters" cols="20" rows="10" style="width: 50%; font-size: 12px;" class="code">';
6
+ foreach ( $wpsc_tracking_parameters as $parameter) {
7
+ echo esc_html( $parameter ) . "\n";
8
+ }
9
+ echo '</textarea> ';
10
+ echo "<p><label><input type='checkbox' name='wpsc_ignore_tracking_parameters' value='1' " . checked( 1, $wpsc_ignore_tracking_parameters, false ) . " /> " . __( 'Enable', 'wp-super-cache' ) . "</label></p>";
11
+ echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Save', 'wp-super-cache' ) . '" /></div>';
12
+ wp_nonce_field('wp-cache');
13
+ echo "</form>\n";
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  # WP Super Cache #
2
  * Contributors: donncha, automattic
3
  * Tags: performance, caching, wp-cache, wp-super-cache, cache
4
- * Tested up to: 5.8.1
5
- * Stable tag: 1.7.4
6
  * Requires at least: 3.1
7
  * Requires PHP: 5.2.4
8
  * License: GPLv2 or later
@@ -269,6 +269,14 @@ Your theme is probably responsive which means it resizes the page to suit whatev
269
 
270
  ## Changelog ##
271
 
 
 
 
 
 
 
 
 
272
  ### 1.7.4 ###
273
  * Make config file path configurable, props @sebastianpopp #755
274
  * Stop a very rare/difficult attack when updating wp-config.php, props @guyasyou for reporting. #780
@@ -767,4 +775,4 @@ Your theme is probably responsive which means it resizes the page to suit whatev
767
 
768
 
769
  ## Upgrade Notice ##
770
- Security and new feature release. Security issue is very difficult to perform but you should upgrade.
1
  # WP Super Cache #
2
  * Contributors: donncha, automattic
3
  * Tags: performance, caching, wp-cache, wp-super-cache, cache
4
+ * Tested up to: 5.9
5
+ * Stable tag: 1.7.5
6
  * Requires at least: 3.1
7
  * Requires PHP: 5.2.4
8
  * License: GPLv2 or later
269
 
270
  ## Changelog ##
271
 
272
+ ### 1.7.5 ###
273
+ * Move the text of the settings pages into separate files. #791
274
+ * Allow editors to delete all the cache files. #793
275
+ * Only clear the cache from the current site, not the whole network (admin bar link). #794
276
+ * Check $cache_path is somewhat sane. #797
277
+ * realpath returns false if directory not found. #798
278
+ * Don't reject bots for new installs. They "preload pages" too. #800
279
+
280
  ### 1.7.4 ###
281
  * Make config file path configurable, props @sebastianpopp #755
282
  * Stop a very rare/difficult attack when updating wp-config.php, props @guyasyou for reporting. #780
775
 
776
 
777
  ## Upgrade Notice ##
778
+ Bug fix release
wp-cache-config-sample.php CHANGED
@@ -21,7 +21,7 @@ $ossdlcdn = 0;
21
  $cache_acceptable_files = array( 'wp-comments-popup.php', 'wp-links-opml.php', 'wp-locations.php' );
22
 
23
  $cache_rejected_uri = array('wp-.*\\.php', 'index\\.php');
24
- $cache_rejected_user_agent = array ( 0 => 'bot', 1 => 'ia_archive', 2 => 'slurp', 3 => 'crawl', 4 => 'spider', 5 => 'Yandex' );
25
 
26
  $cache_rebuild_files = 1;
27
 
21
  $cache_acceptable_files = array( 'wp-comments-popup.php', 'wp-links-opml.php', 'wp-locations.php' );
22
 
23
  $cache_rejected_uri = array('wp-.*\\.php', 'index\\.php');
24
+ $cache_rejected_user_agent = array();
25
 
26
  $cache_rebuild_files = 1;
27
 
wp-cache-phase1.php CHANGED
@@ -24,6 +24,13 @@ if ( defined( 'DISABLE_SUPERCACHE' ) ) {
24
 
25
  require WPCACHEHOME . 'wp-cache-base.php';
26
 
 
 
 
 
 
 
 
27
  if ( $blogcacheid != '' ) {
28
  $blog_cache_dir = str_replace( '//', '/', $cache_path . 'blogs/' . $blogcacheid . '/' );
29
  } else {
24
 
25
  require WPCACHEHOME . 'wp-cache-base.php';
26
 
27
+ if ( '/' === $cache_path || empty( $cache_path ) ) {
28
+ define( 'WPSCSHUTDOWNMESSAGE', 'WARNING! Caching disabled. Configuration corrupted. Reset configuration on Advanced Settings page.' );
29
+ add_action( 'wp_footer', 'wpsc_shutdown_message' );
30
+ define( 'DONOTCACHEPAGE', 1 );
31
+ return;
32
+ }
33
+
34
  if ( $blogcacheid != '' ) {
35
  $blog_cache_dir = str_replace( '//', '/', $cache_path . 'blogs/' . $blogcacheid . '/' );
36
  } else {
wp-cache-phase2.php CHANGED
@@ -67,8 +67,19 @@ function wp_super_cache_init() {
67
 
68
  $cache_filename = $file_prefix . $key . '.php';
69
  $meta_file = $file_prefix . $key . '.php';
70
- $cache_file = wpsc_get_realpath( $blog_cache_dir ) . '/' . $cache_filename;
71
- $meta_pathname = wpsc_get_realpath( $blog_cache_dir . 'meta/' ) . '/' . $meta_file;
 
 
 
 
 
 
 
 
 
 
 
72
  return compact( 'key', 'cache_filename', 'meta_file', 'cache_file', 'meta_pathname' );
73
  }
74
 
@@ -109,6 +120,11 @@ function wp_cache_serve_cache_file() {
109
  return false;
110
  }
111
 
 
 
 
 
 
112
  wp_cache_debug( "wp-cache file exists: $cache_file", 5 );
113
  if ( !( $meta = json_decode( wp_cache_get_legacy_cache( $meta_pathname ), true ) ) ) {
114
  wp_cache_debug( "couldn't load wp-cache meta file", 5 );
@@ -214,6 +230,7 @@ function wp_cache_serve_cache_file() {
214
 
215
  // don't try to match modified dates if using dynamic code.
216
  if ( $wp_cache_mfunc_enabled == 0 && $wp_supercache_304 ) {
 
217
  $headers = apache_request_headers();
218
  $remote_mod_time = isset ( $headers['If-Modified-Since'] ) ? $headers['If-Modified-Since'] : null;
219
 
@@ -223,8 +240,11 @@ function wp_cache_serve_cache_file() {
223
 
224
  $local_mod_time = gmdate("D, d M Y H:i:s",filemtime( $file )).' GMT';
225
  if ( ! is_null( $remote_mod_time ) && $remote_mod_time == $local_mod_time ) {
 
226
  header( $_SERVER[ 'SERVER_PROTOCOL' ] . " 304 Not Modified" );
227
  exit();
 
 
228
  }
229
  header( 'Last-Modified: ' . $local_mod_time );
230
  }
@@ -686,6 +706,13 @@ function get_current_url_supercache_dir( $post_id = 0 ) {
686
  }
687
  } else {
688
  $uri = strtolower( $wp_cache_request_uri );
 
 
 
 
 
 
 
689
  }
690
  $uri = wpsc_deep_replace( array( '..', '\\', 'index.php', ), preg_replace( '/[ <>\'\"\r\n\t\(\)]/', '', preg_replace( "/(\?.*)?(#.*)?$/", '', $uri ) ) );
691
  $hostname = $WPSC_HTTP_HOST;
@@ -725,6 +752,7 @@ function wpsc_rebuild_files( $dir ) {
725
  // realpath() doesn't always remove the trailing slash
726
  function wpsc_get_realpath( $directory ) {
727
  if ( $directory == '/' ) {
 
728
  return false;
729
  }
730
 
67
 
68
  $cache_filename = $file_prefix . $key . '.php';
69
  $meta_file = $file_prefix . $key . '.php';
70
+
71
+ $cache_file = wpsc_get_realpath( $blog_cache_dir );
72
+
73
+ if ( $cache_file ) {
74
+ $cache_file .= '/' . $cache_filename;
75
+ }
76
+
77
+ $meta_pathname = wpsc_get_realpath( $blog_cache_dir . 'meta/' );
78
+
79
+ if ( $meta_pathname ) {
80
+ $meta_pathname .= '/' . $meta_file;
81
+ }
82
+
83
  return compact( 'key', 'cache_filename', 'meta_file', 'cache_file', 'meta_pathname' );
84
  }
85
 
120
  return false;
121
  }
122
 
123
+ if ( ! $meta_pathname ) {
124
+ wp_cache_debug( 'wp_cache_serve_cache_file: meta pathname is empty. Could not load wp-cache meta file.' );
125
+ return true;
126
+ }
127
+
128
  wp_cache_debug( "wp-cache file exists: $cache_file", 5 );
129
  if ( !( $meta = json_decode( wp_cache_get_legacy_cache( $meta_pathname ), true ) ) ) {
130
  wp_cache_debug( "couldn't load wp-cache meta file", 5 );
230
 
231
  // don't try to match modified dates if using dynamic code.
232
  if ( $wp_cache_mfunc_enabled == 0 && $wp_supercache_304 ) {
233
+ wp_cache_debug( 'wp_cache_serve_cache_file: checking age of cached vs served files.' );
234
  $headers = apache_request_headers();
235
  $remote_mod_time = isset ( $headers['If-Modified-Since'] ) ? $headers['If-Modified-Since'] : null;
236
 
240
 
241
  $local_mod_time = gmdate("D, d M Y H:i:s",filemtime( $file )).' GMT';
242
  if ( ! is_null( $remote_mod_time ) && $remote_mod_time == $local_mod_time ) {
243
+ wp_cache_debug( 'wp_cache_serve_cache_file: Send 304 Not Modified header.' );
244
  header( $_SERVER[ 'SERVER_PROTOCOL' ] . " 304 Not Modified" );
245
  exit();
246
+ } else {
247
+ wp_cache_debug( 'wp_cache_serve_cache_file: 304 browser caching not possible as timestamps differ.' );
248
  }
249
  header( 'Last-Modified: ' . $local_mod_time );
250
  }
706
  }
707
  } else {
708
  $uri = strtolower( $wp_cache_request_uri );
709
+ $uri = preg_replace_callback(
710
+ "/%[a-f0-9]{2}/",
711
+ function ( $matches ) {
712
+ return strtoupper( $matches[0] );
713
+ },
714
+ $uri
715
+ );
716
  }
717
  $uri = wpsc_deep_replace( array( '..', '\\', 'index.php', ), preg_replace( '/[ <>\'\"\r\n\t\(\)]/', '', preg_replace( "/(\?.*)?(#.*)?$/", '', $uri ) ) );
718
  $hostname = $WPSC_HTTP_HOST;
752
  // realpath() doesn't always remove the trailing slash
753
  function wpsc_get_realpath( $directory ) {
754
  if ( $directory == '/' ) {
755
+ wp_cache_debug( "wpsc_get_realpath: cannot get realpath of '/'" );
756
  return false;
757
  }
758
 
wp-cache.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Super Cache
4
  Plugin URI: https://wordpress.org/plugins/wp-super-cache/
5
  Description: Very fast caching plugin for WordPress.
6
- Version: 1.7.4
7
  Author: Automattic
8
  Author URI: https://automattic.com/
9
  License: GPL2+
@@ -45,7 +45,7 @@ function wpsc_init() {
45
 
46
  if ( !defined( 'WPCACHECONFIGPATH' ) ) {
47
  define( 'WPCACHECONFIGPATH', WP_CONTENT_DIR );
48
- }
49
 
50
  $wp_cache_config_file = WPCACHECONFIGPATH . '/wp-cache-config.php';
51
 
@@ -512,6 +512,12 @@ function admin_bar_delete_page() {
512
  $path = $valid_nonce ? realpath( trailingslashit( get_supercache_dir() . str_replace( '..', '', preg_replace( '/:.*$/', '', $req_path ) ) ) ) : false;
513
 
514
  if ( $path ) {
 
 
 
 
 
 
515
  $path = trailingslashit( $path );
516
  $supercachepath = realpath( get_supercache_dir() );
517
 
@@ -524,6 +530,11 @@ function admin_bar_delete_page() {
524
  wpsc_delete_files( $path );
525
  }
526
 
 
 
 
 
 
527
  if ( $referer && $req_path && ( false !== stripos( $referer, $req_path ) || 0 === stripos( $referer, wp_login_url() ) ) ) {
528
  wp_safe_redirect( esc_url_raw( home_url( $req_path ) ) );
529
  exit;
@@ -966,386 +977,104 @@ table.wpsc-settings-table {
966
  wp_cache_files();
967
  break;
968
  case 'preload':
969
- if ( ! $cache_enabled ) {
970
- wp_die( esc_html__( 'Caching must be enabled to use this feature', 'wp-super-cache' ) );
971
- }
972
- echo '<a name="preload"></a>';
973
- if ( $super_cache_enabled == true && false == defined( 'DISABLESUPERCACHEPRELOADING' ) ) {
974
- echo '<p>' . __( 'This will cache every published post and page on your site. It will create supercache static files so unknown visitors (including bots) will hit a cached page. This will probably help your Google ranking as they are using speed as a metric when judging websites now.', 'wp-super-cache' ) . '</p>';
975
- echo '<p>' . __( 'Preloading creates lots of files however. Caching is done from the newest post to the oldest so please consider only caching the newest if you have lots (10,000+) of posts. This is especially important on shared hosting.', 'wp-super-cache' ) . '</p>';
976
- echo '<p>' . __( 'In &#8217;Preload Mode&#8217; regular garbage collection will be disabled so that old cache files are not deleted. This is a recommended setting when the cache is preloaded.', 'wp-super-cache' ) . '</p>';
977
- echo '<form name="cache_filler" action="' . esc_url_raw( add_query_arg( 'tab', 'preload', $admin_url ) ) . '" method="POST">';
978
- echo '<input type="hidden" name="action" value="preload" />';
979
- echo '<input type="hidden" name="page" value="wpsupercache" />';
980
- echo '<p>' . sprintf( __( 'Refresh preloaded cache files every %s minutes. (0 to disable, minimum %d minutes.)', 'wp-super-cache' ), "<input type='text' size=4 name='wp_cache_preload_interval' value='" . (int) $wp_cache_preload_interval . "' />", $min_refresh_interval ) . '</p>';
981
- if ( $count > 100 ) {
982
- $step = (int)( $count / 10 );
983
-
984
- $select = "<select name='wp_cache_preload_posts' size=1>";
985
- $select .= "<option value='all' ";
986
- if ( !isset( $wp_cache_preload_posts ) || $wp_cache_preload_posts == 'all' ) {
987
- $checked = 'selectect=1 ';
988
- $best = 'all';
989
- } else {
990
- $checked = ' ';
991
- $best = $wp_cache_preload_posts;
992
- }
993
- $select .= "{$checked}>" . __( 'all', 'wp-super-cache' ) . "</option>";
994
-
995
- for( $c = $step; $c < $count; $c += $step ) {
996
- $checked = ' ';
997
- if ( $best == $c )
998
- $checked = 'selected=1 ';
999
- $select .= "<option value='$c'{$checked}>$c</option>";
1000
- }
1001
- $checked = ' ';
1002
- if ( $best == $count )
1003
- $checked = 'selected=1 ';
1004
- $select .= "<option value='$count'{$checked}>$count</option>";
1005
- $select .= "</select>";
1006
- echo '<p>' . sprintf( __( 'Preload %s posts.', 'wp-super-cache' ), $select ) . '</p>';
1007
- } else {
1008
- echo '<input type="hidden" name="wp_cache_preload_posts" value="' . $count . '" />';
1009
- }
1010
 
1011
- echo '<input type="checkbox" name="wp_cache_preload_on" value="1" ';
1012
- echo $wp_cache_preload_on == 1 ? 'checked=1' : '';
1013
- echo ' /> ' . __( 'Preload mode (garbage collection disabled. Recommended.)', 'wp-super-cache' ) . '<br />';
1014
- echo '<input type="checkbox" name="wp_cache_preload_taxonomies" value="1" ';
1015
- echo $wp_cache_preload_taxonomies == 1 ? 'checked=1' : '';
1016
- echo ' /> ' . __( 'Preload tags, categories and other taxonomies.', 'wp-super-cache' ) . '<br />';
1017
- echo __( 'Send me status emails when files are refreshed.', 'wp-super-cache' ) . '<br />';
1018
- if ( !isset( $wp_cache_preload_email_volume ) )
1019
- $wp_cache_preload_email_volume = 'none';
1020
- echo '<select type="select" name="wp_cache_preload_email_volume">';
1021
- echo '<option value="none" '. selected( 'none', $wp_cache_preload_email_volume ) . '>'. __( 'No Emails', 'wp-super-cache' ) . '</option>';
1022
- echo '<option value="many" '. selected( 'many', $wp_cache_preload_email_volume ) . '>'. __( 'Many emails, 2 emails per 100 posts.', 'wp-super-cache' ) . '</option>';
1023
- echo '<option value="medium" '. selected( 'medium', $wp_cache_preload_email_volume ) . '>'. __( 'Medium, 1 email per 100 posts.', 'wp-super-cache' ) . '</option>';
1024
- echo '<option value="less" '. selected( 'less', $wp_cache_preload_email_volume ) . '>'. __( 'Less emails, 1 at the start and 1 at the end of preloading all posts.', 'wp-super-cache' ) . '</option>';
1025
- echo "</select>";
1026
-
1027
- if ( wp_next_scheduled( 'wp_cache_preload_hook' ) || wp_next_scheduled( 'wp_cache_full_preload_hook' ) ) {
1028
- $currently_preloading = true;
1029
- }
1030
- echo '<div class="submit"><input class="button-primary" type="submit" name="preload" value="' . __( 'Save Settings', 'wp-super-cache' ) . '" />';
1031
- echo '</div>';
1032
- wp_nonce_field( 'wp-cache' );
1033
- echo '</form>';
1034
- echo '<form name="do_preload" action="' . esc_url_raw( add_query_arg( 'tab', 'preload', $admin_url ) ) . '" method="POST">';
1035
- echo '<input type="hidden" name="action" value="preload" />';
1036
- echo '<input type="hidden" name="page" value="wpsupercache" />';
1037
- echo '<div class="submit">';
1038
- if ( false == $currently_preloading ) {
1039
- echo '<input class="button-primary" type="submit" name="preload_now" value="' . __( 'Preload Cache Now', 'wp-super-cache' ) . '" />';
1040
- } else {
1041
- echo '<input class="button-primary" type="submit" name="preload_off" value="' . __( 'Cancel Cache Preload', 'wp-super-cache' ) . '" />';
1042
- }
1043
- echo '</div>';
1044
- wp_nonce_field( 'wp-cache' );
1045
- echo '</form>';
1046
- } else {
1047
- echo '<div class="notice notice-warning"><p>' . __( 'Preloading of cache disabled. Please make sure simple or expert mode is enabled or talk to your host administrator.', 'wp-super-cache' ) . '</p></div>';
1048
- }
1049
  break;
1050
  case 'plugins':
1051
  wpsc_plugins_tab();
1052
  break;
1053
  case 'debug':
1054
- wp_cache_debug_settings();
 
 
 
1055
  break;
1056
  case 'settings':
1057
- if ( isset( $wp_cache_front_page_checks ) == false ) {
1058
- $wp_cache_front_page_checks = true;
1059
- }
1060
- echo '<form name="wp_manager" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) ) . '" method="post">';
1061
- wp_nonce_field( 'wp-cache' );
1062
- echo '<input type="hidden" name="action" value="scupdates" />';
1063
- ?>
1064
- <table class="form-table">
1065
- <tr valign="top">
1066
- <th scope="row"><label for="wp_cache_enabled"><?php _e( 'Caching', 'wp-super-cache' ); ?></label></th>
1067
- <td>
1068
- <fieldset>
1069
- <legend class="hidden"><?php _e( 'Caching', 'wp-super-cache' ); ?></legend>
1070
- <label><input type='checkbox' name='wp_cache_enabled' value='1' <?php if ( $cache_enabled == true ) { echo 'checked=checked'; } ?>> <?php _e( 'Enable Caching', 'wp-super-cache' ); ?><br />
1071
- </fieldset>
1072
- </td>
1073
- </tr>
1074
- <tr valign="top">
1075
- <th scope="row"><label for="super_cache_enabled"><?php _e( 'Cache Delivery Method', 'wp-super-cache' ); ?></label></th>
1076
- <td>
1077
- <fieldset>
1078
- <label><input type='radio' name='wp_cache_mod_rewrite' <?php if ( $wp_cache_mod_rewrite == 0 ) echo "checked"; ?> value='0'> <?php _e( '<acronym title="Use PHP to serve cached files">Simple</acronym>', 'wp-super-cache' ); echo " <em>(" . __( "Recommended", "wp-super-cache" ) . ")</em>"; ?></label><br />
1079
- <label><input type='radio' name='wp_cache_mod_rewrite' <?php if ( $wp_cache_mod_rewrite == 1 ) echo "checked"; ?> value='1'> <?php _e( '<acronym title="Use mod_rewrite to serve cached files">Expert</acronym>', 'wp-super-cache' ); ?></label><br />
1080
- <em><small class='description'><?php _e( 'Expert caching requires changes to important server files and may require manual intervention if enabled.', 'wp-super-cache' ); ?></small></em>
1081
- <?php if ( $is_nginx ) { ?>
1082
- <em><small class='description'><?php printf( __( 'Nginx rules can be found <a href="%s">here</a> but are not officially supported.', 'wp-super-cache' ), 'https://codex.wordpress.org/Nginx#WP_Super_Cache_Rules' ); ?></small></em>
1083
- <?php } ?>
1084
- </fieldset>
1085
- </td>
1086
- </tr>
1087
- <tr valign="top">
1088
- <th scope="row"><label for="wp_cache_status"><?php esc_html_e( 'Miscellaneous', 'wp-super-cache' ); ?></label></th>
1089
- <td>
1090
- <fieldset>
1091
- <legend class="hidden">Miscellaneous</legend>
1092
- <strong><?php echo __( 'Cache Restrictions', 'wp-super-cache' ); ?></strong><br />
1093
- <label><input type='radio' name='wp_cache_not_logged_in' <?php checked( $wp_cache_not_logged_in, 0 ); ?> value='0'> <?php echo __( 'Enable caching for all visitors.', 'wp-super-cache' ); ?></label><br />
1094
- <label><input type='radio' name='wp_cache_not_logged_in' <?php checked( $wp_cache_not_logged_in, 1 ); ?> value='1'> <?php echo __( 'Disable caching for visitors who have a cookie set in their browser.', 'wp-super-cache' ); ?></label><br />
1095
- <label><input type='radio' name='wp_cache_not_logged_in' <?php checked( $wp_cache_not_logged_in, 2 ); ?> value='2'> <?php echo __( 'Disable caching for logged in visitors.', 'wp-super-cache' ) . ' <em>(' . esc_html__( 'Recommended', 'wp-super-cache' ) . ')</em>'; ?></label><br /><br />
1096
- <label><input type='checkbox' name='wp_cache_no_cache_for_get' <?php checked( $wp_cache_no_cache_for_get ); ?> value='1'> <?php _e( 'Don&#8217;t cache pages with GET parameters. (?x=y at the end of a url)', 'wp-super-cache' ); ?></label><br />
1097
- <?php if ( ! defined( 'WPSC_DISABLE_COMPRESSION' ) ) : ?>
1098
- <?php if ( ! function_exists( 'gzencode' ) ) : ?>
1099
- <em><?php esc_html_e( 'Warning! Compression is disabled as gzencode() function was not found.', 'wp-super-cache' ); ?></em><br />
1100
- <?php else : ?>
1101
- <label><input type='checkbox' name='cache_compression' <?php checked( $cache_compression ); ?> value='1'> <?php echo __( 'Compress pages so they&#8217;re served more quickly to visitors.', 'wp-super-cache' ) . ' <em>(' . esc_html__( 'Recommended', 'wp-super-cache' ) . ')</em>'; ?></label><br />
1102
- <em><?php esc_html_e( 'Compression is disabled by default because some hosts have problems with compressed files. Switching it on and off clears the cache.', 'wp-super-cache' ); ?></em><br />
1103
- <?php endif; ?>
1104
- <?php endif; ?>
1105
- <label><input type='checkbox' name='cache_rebuild_files' <?php checked( $cache_rebuild_files ); ?> value='1'> <?php echo esc_html__( 'Cache rebuild. Serve a supercache file to anonymous users while a new file is being generated.', 'wp-super-cache' ) . ' <em>(' . esc_html__( 'Recommended', 'wp-super-cache' ) . ')</em>'; ?></label><br />
1106
- <?php if ( $wp_cache_mod_rewrite ) { ?>
1107
- <br />
1108
- <p><strong><?php esc_html_e( 'Warning! The following settings are disabled because Expert caching is enabled.', 'wp-super-cache' ); ?></strong></p>
1109
- <br />
1110
- <?php } ?>
1111
- <label><input <?php disabled( $wp_cache_mod_rewrite ); ?> type='checkbox' name='wpsc_save_headers' <?php checked( $wpsc_save_headers ); ?> value='1' /> <?php esc_html_e( 'Cache HTTP headers with page content.', 'wp-super-cache' ); ?></label><br />
1112
- <label><input <?php disabled( $wp_cache_mod_rewrite ); ?> type='checkbox' name='wp_supercache_304' <?php checked( $wp_supercache_304 ); ?> value='1'> <?php echo esc_html__( '304 Browser caching. Improves site performance by checking if the page has changed since the browser last requested it.', 'wp-super-cache' ) . ' <em>(' . esc_html__( 'Recommended', 'wp-super-cache' ) . ')</em>'; ?></label><br />
1113
- <?php echo '<em>' . esc_html__( '304 support is disabled by default because some hosts have had problems with the headers used in the past.', 'wp-super-cache' ) . '</em><br />'; ?>
1114
- <label><input <?php disabled( $wp_cache_mod_rewrite ); ?> type='checkbox' name='wp_cache_make_known_anon' <?php checked( $wp_cache_make_known_anon ); ?> value='1'> <?php _e( 'Make known users anonymous so they&#8217;re served supercached static files.', 'wp-super-cache' ); ?></label><br />
1115
- </legend>
1116
- </fieldset>
1117
- </td>
1118
- </tr>
1119
- <tr valign="top">
1120
- <th scope="row"><label for="wp_cache_status"><?php _e( 'Advanced', 'wp-super-cache' ); ?></label></th>
1121
- <td>
1122
- <fieldset>
1123
- <legend class="hidden">Advanced</legend>
1124
- <label><input <?php disabled( $wp_cache_mod_rewrite ); ?> type='checkbox' name='wp_cache_mfunc_enabled' <?php if( $wp_cache_mfunc_enabled ) echo "checked"; ?> value='1'> <?php _e( 'Enable dynamic caching. (See <a href="https://wordpress.org/plugins/wp-super-cache/faq/">FAQ</a> or wp-super-cache/plugins/dynamic-cache-test.php for example code.)', 'wp-super-cache' ); ?></label><br />
1125
- <label><input type='checkbox' name='wp_cache_mobile_enabled' <?php if( $wp_cache_mobile_enabled ) echo "checked"; ?> value='1'> <?php _e( 'Mobile device support. (External plugin or theme required. See the <a href="https://wordpress.org/plugins/wp-super-cache/faq/">FAQ</a> for further details.)', 'wp-super-cache' ); ?></label><br />
1126
- <?php if ( $wp_cache_mobile_enabled ) {
1127
- echo '<blockquote><h5>' . __( 'Mobile Browsers', 'wp-super-cache' ) . '</h5>' . esc_html( $wp_cache_mobile_browsers ) . "<br /><h5>" . __( 'Mobile Prefixes', 'wp-super-cache' ) . "</h5>" . esc_html( $wp_cache_mobile_prefixes ) . "<br /></blockquote>";
1128
- } ?>
1129
- <label><input type='checkbox' name='wp_cache_disable_utf8' <?php if( $wp_cache_disable_utf8 ) echo "checked"; ?> value='1'> <?php _e( 'Remove UTF8/blog charset support from .htaccess file. Only necessary if you see odd characters or punctuation looks incorrect. Requires rewrite rules update.', 'wp-super-cache' ); ?></label><br />
1130
- <label><input type='checkbox' name='wp_cache_clear_on_post_edit' <?php if( $wp_cache_clear_on_post_edit ) echo "checked"; ?> value='1'> <?php _e( 'Clear all cache files when a post or page is published or updated.', 'wp-super-cache' ); ?></label><br />
1131
- <label><input type='checkbox' name='wp_cache_front_page_checks' <?php if( $wp_cache_front_page_checks ) echo "checked"; ?> value='1'> <?php _e( 'Extra homepage checks. (Very occasionally stops homepage caching)', 'wp-super-cache' ); ?></label><?php echo " <em>(" . __( "Recommended", "wp-super-cache" ) . ")</em>"; ?><br />
1132
- <label><input type='checkbox' name='wp_cache_refresh_single_only' <?php if( $wp_cache_refresh_single_only ) echo "checked"; ?> value='1'> <?php _e( 'Only refresh current page when comments made.', 'wp-super-cache' ); ?></label><br />
1133
- <label><input type='checkbox' name='wp_supercache_cache_list' <?php if( $wp_supercache_cache_list ) echo "checked"; ?> value='1'> <?php _e( 'List the newest cached pages on this page.', 'wp-super-cache' ); ?></label><br />
1134
- <?php if( false == defined( 'WPSC_DISABLE_LOCKING' ) ) { ?>
1135
- <label><input type='checkbox' name='wp_cache_mutex_disabled' <?php if( !$wp_cache_mutex_disabled ) echo "checked"; ?> value='0'> <?php _e( 'Coarse file locking. You do not need this as it will slow down your website.', 'wp-super-cache' ); ?></label><br />
1136
- <?php } ?>
1137
- <label><input type='checkbox' name='wp_super_cache_late_init' <?php if( $wp_super_cache_late_init ) echo "checked"; ?> value='1'> <?php _e( 'Late init. Display cached files after WordPress has loaded.', 'wp-super-cache' ); ?></label><br />
1138
- <?php printf( __( '<strong>DO NOT CACHE PAGE</strong> secret key: <a href="%s">%s</a>', 'wp-super-cache' ), trailingslashit( get_bloginfo( 'url' ) ) . "?donotcachepage={$cache_page_secret}", $cache_page_secret ); ?>
1139
- </fieldset>
1140
- </td>
1141
- </tr>
1142
- <tr valign="top">
1143
- <th scope="row"><label for="wp_cache_location"><?php _e( 'Cache Location', 'wp-super-cache' ); ?></label></th>
1144
- <td>
1145
- <fieldset>
1146
- <legend class="hidden">Cache Location</legend>
1147
- <input type='text' size=80 name='wp_cache_location' value='<?php echo esc_attr( $cache_path ); ?>' />
1148
- <p><?php printf( __( 'Change the location of your cache files. The default is WP_CONTENT_DIR . /cache/ which translates to %s.', 'wp-super-cache' ), WP_CONTENT_DIR . '/cache/' ); ?></p>
1149
- <ol>
1150
- <li><?php _e( 'Warning: do not use a shared directory like /tmp/ where other users on this server can modify files. Your cache files could be modified to deface your website.', 'wp-super-cache' ); ?></li>
1151
- <li><?php _e( 'You must give the full path to the directory.', 'wp-super-cache' ); ?></li>
1152
- <li><?php _e( 'If the directory does not exist, it will be created. Please make sure your web server user has write access to the parent directory. The parent directory must exist.', 'wp-super-cache' ); ?></li>
1153
- <li><?php _e( 'If the new cache directory does not exist, it will be created and the contents of the old cache directory will be moved there. Otherwise, the old cache directory will be left where it is.', 'wp-super-cache' ); ?></li>
1154
- <li><?php _e( 'Submit a blank entry to set it to the default directory, WP_CONTENT_DIR . /cache/.', 'wp-super-cache' ); ?></li>
1155
- <?php if ( get_site_option( 'wp_super_cache_index_detected' ) && strlen( $cache_path ) > strlen( ABSPATH ) && ABSPATH == substr( $cache_path, 0, strlen( ABSPATH ) ) ) {
1156
- $msg = __( 'The plugin detected a bare directory index in your cache directory, which would let visitors see your cache files directly and might expose private posts.', 'wp-super-cache' );
1157
- if ( ! $is_nginx && $super_cache_enabled && $wp_cache_mod_rewrite == 1 ) {
1158
- $msg .= ' ' . __( 'You are using expert mode to serve cache files so the plugin has added <q>Options -Indexes</q> to the .htaccess file in the cache directory to disable indexes. However, if that does not work, you should contact your system administrator or support and ask for them to be disabled, or use simple mode and move the cache outside of the web root.', 'wp-super-cache' );
1159
- } else {
1160
- $msg .= ' <strong>' . sprintf( __( 'index.html files have been added in key directories, but unless directory indexes are disabled, it is probably better to store the cache files outside of the web root of %s', 'wp-super-cache' ), ABSPATH ) . '</strong>';
1161
- }
1162
- echo "<li>$msg</li>";
1163
- } ?>
1164
-
1165
-
1166
- <?php if ( $super_cache_enabled && $wp_cache_mod_rewrite == 1 ) { ?>
1167
- <li><?php printf( __( 'Since you are using mod_rewrite to serve cache files, you must choose a directory in your web root which is <q>%s</q> and update the mod_rewrite rules in the .htaccess file.', 'wp-super-cache' ), ABSPATH ); ?></li>
1168
- <?php } ?>
1169
- </ol>
1170
- <p><?php _e( '', 'wp-super-cache' ); ?></p>
1171
- </fieldset>
1172
- </td>
1173
- </tr>
1174
- </table>
1175
- <h4><?php esc_html_e( 'Note:', 'wp-super-cache' ); ?></h4>
1176
- <ol>
1177
- <li><?php esc_html_e( 'Uninstall this plugin on the plugins page. It will automatically clean up after itself. If manual intervention is required, then simple instructions are provided.', 'wp-super-cache' ); ?></li>
1178
- <li><?php printf( __( 'If uninstalling this plugin, make sure the directory <em>%s</em> is writeable by the webserver so the files <em>advanced-cache.php</em> and <em>cache-config.php</em> can be deleted automatically. (Making sure those files are writeable is probably a good idea!)', 'wp-super-cache' ), esc_attr( WP_CONTENT_DIR ) ); ?></li>
1179
- <li><?php printf( __( 'Please see the <a href="%1$s/wp-super-cache/readme.txt">readme.txt</a> for instructions on uninstalling this script. Look for the heading, "How to uninstall WP Super Cache".', 'wp-super-cache' ), plugins_url() ); ?></li>
1180
- <li><?php echo '<em>' . sprintf( __( 'Need help? Check the <a href="%1$s">Super Cache readme file</a>. It includes installation documentation, a FAQ and Troubleshooting tips. The <a href="%2$s">support forum</a> is also available. Your question may already have been answered.', 'wp-super-cache' ), 'https://wordpress.org/plugins/wp-super-cache/', 'https://wordpress.org/support/topic-tag/wp-super-cache/?forum_id=10' ) . '</em>'; ?></li>
1181
- <li><?php _e( 'The location of the plugin configuration file can be changed by defining the WPCACHECONFIGPATH constant in wp-config.php. If not defined it will be set to WP_CONTENT_DIR.', 'wp-super-cache' ); ?></li>
1182
- </ol>
1183
-
1184
- <?php
1185
- echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . ' value="' . esc_html__( 'Update Status', 'wp-super-cache' ) . '" /></div>';
1186
- wp_nonce_field( 'wp-cache' );
1187
-
1188
- ?></form><?php
1189
-
1190
- wsc_mod_rewrite();
1191
-
1192
- wp_cache_edit_max_time();
1193
-
1194
- echo '<a name="files"></a><fieldset class="options"><h4>' . __( 'Accepted Filenames &amp; Rejected URIs', 'wp-super-cache' ) . '</h4>';
1195
- wp_cache_edit_rejected_pages();
1196
- echo "\n";
1197
- wp_cache_edit_rejected();
1198
- echo "\n";
1199
- wp_cache_edit_rejected_cookies();
1200
- echo "\n";
1201
- wp_cache_edit_accepted();
1202
- echo '</fieldset>';
1203
 
1204
  wpsc_edit_tracking_parameters();
1205
-
1206
- wp_cache_edit_rejected_ua();
1207
-
1208
- wp_lock_down();
1209
-
1210
- wp_cache_restore();
1211
 
1212
  break;
1213
  case 'easy':
1214
  default:
1215
- echo '<form name="wp_manager" action="' . esc_url_raw( add_query_arg( 'tab', 'easy', $admin_url ) ) . '" method="post">';
1216
- echo '<input type="hidden" name="action" value="easysetup" />';
1217
- wp_nonce_field( 'wp-cache' );
1218
- ?>
1219
- <table class="form-table">
1220
- <tr valign="top">
1221
- <th scope="row"><label for="wp_cache_status"><?php esc_html_e( 'Caching', 'wp-super-cache' ); ?></label></th>
1222
- <td>
1223
- <fieldset>
1224
- <label><input type='radio' name='wp_cache_easy_on' value='1' <?php checked( $cache_enabled ); ?> ><?php echo esc_html__( 'Caching On', 'wp-super-cache' ) . ' <em>(' . esc_html__( 'Recommended', 'wp-super-cache' ) . ')</em>'; ?></label><br />
1225
- <label><input type='radio' name='wp_cache_easy_on' value='0' <?php checked( ! $cache_enabled ); ?> ><?php esc_html_e( 'Caching Off', 'wp-super-cache' ); ?></label><br />
1226
- </fieldset>
1227
- </td>
1228
- </tr>
1229
- </table>
1230
- <p><?php _e( 'The following recommended settings will be enabled:', 'wp-super-cache' ); ?></p>
1231
- <ol>
1232
- <li><?php _e( 'Caching disabled for logged in visitors.', 'wp-super-cache' ); ?></li>
1233
- <li><?php _e( 'Simple caching.', 'wp-super-cache' ); ?></li>
1234
- <li><?php _e( 'Cache Rebuild.', 'wp-super-cache' ); ?></li>
1235
- <li><?php _e( 'Interval garbage collection every 10 minutes with a cache lifetime of 30 minutes (if not configured already).', 'wp-super-cache' ); ?></li>
1236
- </ol>
1237
- <p><?php _e( 'These settings can be modified on the Advanced Settings page.', 'wp-super-cache' ); ?></p>
1238
- <?php
1239
- if ( ! $is_nginx && $cache_enabled && ! $wp_cache_mod_rewrite ) {
1240
- $scrules = trim( implode( "\n", extract_from_markers( trailingslashit( get_home_path() ) . '.htaccess', 'WPSuperCache' ) ) );
1241
- if ( ! empty( $scrules ) ) {
1242
- echo '<p><strong>' . esc_html__( 'Notice: Simple caching enabled but Supercache mod_rewrite rules from expert mode detected. Cached files will be served using those rules. If your site is working ok, please ignore this message. Otherwise, you can edit the .htaccess file in the root of your install and remove the SuperCache rules.', 'wp-super-cache' ) . '</strong></p>';
1243
- }
1244
- }
1245
- echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . ' value="' . esc_html__( 'Update Status', 'wp-super-cache' ) . '" /></div></form>';
1246
- if ( $cache_enabled ) {
1247
- echo '<h4>' . esc_html__( 'Cache Tester', 'wp-super-cache' ) . '</h4>';
1248
- echo '<p>' . esc_html__( 'Test your cached website by clicking the test button below.', 'wp-super-cache' ) . '</p>';
1249
- echo '<p>' . __( 'Note: if you use Cloudflare or other transparent front-end proxy service this test may fail.<ol><li> If you have Cloudflare minification enabled this plugin may detect differences in the pages and report an error.</li><li> Try using the development mode of Cloudflare to perform the test. You can disable development mode afterwards if the test succeeds.</li></ol>', 'wp-super-cache' ) . '</p>';
1250
- if ( array_key_exists( 'action', $_POST ) && 'test' === $_POST['action'] && $valid_nonce ) {
1251
- $url = trailingslashit( get_bloginfo( 'url' ) );
1252
- if ( isset( $_POST['httponly'] ) ) {
1253
- $url = str_replace( 'https://', 'http://', $url );
1254
- }
1255
- $test_messages = array( esc_html__( 'Fetching %s to prime cache: ', 'wp-super-cache' ), esc_html__( 'Fetching first copy of %s: ', 'wp-super-cache' ), esc_html__( 'Fetching second copy of %s: ', 'wp-super-cache' ) );
1256
- $c = 0;
1257
- $cache_test_error = false;
1258
- $page = array();
1259
- foreach ( $test_messages as $message ) {
1260
- echo '<p>' . sprintf( $message, $url );
1261
- $page[ $c ] = wp_remote_get( $url, array( 'timeout' => 60, 'blocking' => true ) );
1262
- if ( ! is_wp_error( $page[ $c ] ) ) {
1263
- $fp = fopen( $cache_path . $c . '.html', 'w' );
1264
- fwrite( $fp, $page[ $c ]['body'] );
1265
- fclose( $fp );
1266
- echo '<span style="color: #0a0; font-weight: bold;">' . esc_html__( 'OK', 'wp-super-cache' ) . "</span> (<a href='" . esc_url_raw( WP_CONTENT_URL . '/cache/' . $c . '.html' ) . "'>" . $c . '.html</a>)</p>';
1267
- sleep( 1 );
1268
- } else {
1269
- $cache_test_error = true;
1270
- echo '<span style="color: #a00; font-weight: bold;">' . esc_html__( 'FAILED', 'wp-super-cache' ) . '</span></p>';
1271
- $errors = '';
1272
- $messages = '';
1273
- foreach ( $page[ $c ]->get_error_codes() as $code ) {
1274
- $severity = $page[ $c ]->get_error_data( $code );
1275
- foreach ( $page[ $c ]->get_error_messages( $code ) as $err ) {
1276
- $errors .= $severity . ': ' . $err . "<br />\n";
1277
- }
1278
- }
1279
- if ( ! empty( $errors ) ) {
1280
- echo '<p>' . sprintf( __( '<strong>Errors:</strong> %s', 'wp-super-cache' ), $errors ) . '</p>';
1281
- }
1282
- }
1283
- $c ++;
1284
- }
1285
-
1286
- if ( false == $cache_test_error ) {
1287
- echo '<ul><li>' . sprintf( esc_html__( 'Page %d: %d (%s)', 'wp-super-cache' ), 1, intval( $page[1]['response']['code'] ), esc_attr( $page[1]['response']['message'] ) ) . '</li>';
1288
- echo '<li>' . sprintf( esc_html__( 'Page %d: %d (%s)', 'wp-super-cache' ), 2, intval( $page[2]['response']['code'] ), esc_attr( $page[2]['response']['message'] ) ) . '</li></ul>';
1289
- }
1290
-
1291
- if ( false == $cache_test_error && preg_match( '/(Cached page generated by WP-Super-Cache on) ([0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]*)/', $page[1]['body'], $matches1 ) &&
1292
- preg_match( '/(Cached page generated by WP-Super-Cache on) ([0-9]*-[0-9]*-[0-9]* [0-9]*:[0-9]*:[0-9]*)/', $page[2]['body'], $matches2 ) && $matches1[2] == $matches2[2]
1293
- ) {
1294
- echo '<p>' . sprintf( esc_html__( 'Page 1: %s', 'wp-super-cache' ), $matches1[2] ) . '</p>';
1295
- echo '<p>' . sprintf( esc_html__( 'Page 2: %s', 'wp-super-cache' ), $matches2[2] ) . '</p>';
1296
- echo '<p><span style="color: #0a0; font-weight: bold;">' . esc_html__( 'The timestamps on both pages match!', 'wp-super-cache' ) . '</span></p>';
1297
- } else {
1298
- echo '<p><strong>' . esc_html__( 'The pages do not match! Timestamps differ or were not found!', 'wp-super-cache' ) . '</strong></p>';
1299
- echo '<p>' . esc_html__( 'Things you can do:', 'wp-super-cache' ) . '</p>';
1300
- echo '<ol><li>' . esc_html__( 'Load your homepage in a logged out browser, check the timestamp at the end of the html source. Load the page again and compare the timestamp. Caching is working if the timestamps match.', 'wp-super-cache' ) . '</li>';
1301
- echo '<li>' . esc_html__( 'Enable logging on the Debug page here. That should help you track down the problem.', 'wp-super-cache' ) . '</li>';
1302
- echo '<li>' . esc_html__( 'You should check Page 1 and Page 2 above for errors. Your local server configuration may not allow your website to access itself.', 'wp-super-cache' ) . '</li>';
1303
- echo '</ol>';
1304
- }
1305
- }
1306
- echo '<form name="cache_tester" action="' . esc_url_raw( add_query_arg( 'tab', 'easy', $admin_url ) ) . '" method="post">';
1307
- echo '<input type="hidden" name="action" value="test" />';
1308
- if ( ! empty( $_SERVER['HTTPS'] ) && 'on' === strtolower( $_SERVER['HTTPS'] ) ) {
1309
- echo '<input type="checkbox" name="httponly" checked="checked" value="1" /> ' . esc_html__( 'Send non-secure (non https) request for homepage', 'wp-super-cache' );
1310
- }
1311
-
1312
- if ( isset( $wp_super_cache_comments ) && $wp_super_cache_comments == 0 ) {
1313
- echo '<p>' . __( '<strong>Warning!</strong> Cache comments are currently disabled. Please go to the Debug page and enable Cache Status Messages there. You should clear the cache before testing.', 'wp-super-cache' ) . '</p>';
1314
- echo '<div class="submit"><input disabled style="color: #aaa" class="button-secondary" type="submit" name="test" value="' . esc_html__( 'Test Cache', 'wp-super-cache' ) . '" /></div>';
1315
- } else {
1316
- echo '<div class="submit"><input class="button-secondary" type="submit" name="test" value="' . __( 'Test Cache', 'wp-super-cache' ) . '" /></div>';
1317
- }
1318
-
1319
- wp_nonce_field( 'wp-cache' );
1320
- echo '</form>';
1321
- }
1322
- echo '<h4>' . esc_html__( 'Delete Cached Pages', 'wp-super-cache' ) . '</h4>';
1323
- echo '<p>' . esc_html__( 'Cached pages are stored on your server as html and PHP files. If you need to delete them, use the button below.', 'wp-super-cache' ) . '</p>';
1324
- echo '<form name="wp_cache_content_delete" action="' . esc_url_raw( add_query_arg( 'tab', 'contents', $admin_url ) ) . '" method="post">';
1325
- echo '<input type="hidden" name="wp_delete_cache" />';
1326
- echo '<div class="submit"><input id="deletepost" class="button-secondary" type="submit" ' . SUBMITDISABLED . 'value="' . esc_html__( 'Delete Cache', 'wp-super-cache' ) . ' " /></div>';
1327
- wp_nonce_field( 'wp-cache' );
1328
- echo "</form>\n";
1329
-
1330
- if ( is_multisite() && wpsupercache_site_admin() ) {
1331
- echo '<form name="wp_cache_content_delete" action="' . esc_url_raw( add_query_arg( 'tab', 'contents', $admin_url ) . '#listfiles' ) . '" method="post">';
1332
- echo '<input type="hidden" name="wp_delete_all_cache" />';
1333
- echo '<div class="submit"><input id="deleteallpost" class="button-secondary" type="submit" ' . SUBMITDISABLED . 'value="' . esc_html__( 'Delete Cache On All Blogs', 'wp-super-cache' ) . '" /></div>';
1334
- wp_nonce_field( 'wp-cache' );
1335
- echo "</form><br />\n";
1336
- }
1337
- ?>
1338
- <h4 class="clear"><?php esc_html_e( 'Recommended Links and Plugins', 'wp-super-cache' ); ?></h4>
1339
- <p><?php esc_html_e( 'Caching is only one part of making a website faster. Here are some other plugins that will help:', 'wp-super-cache' ); ?></p>
1340
- <ul style="list-style: square; margin-left: 2em;">
1341
- <li><?php printf( __( '<a href="%s">Jetpack</a> provides everything you need to build a successful WordPress website including an image/photo CDN (free) and a video hosting service (paid).', 'wp-super-cache' ), 'https://jetpack.com/redirect/?source=jitm-wpsc-recommended' ); ?></li>
1342
- <li><?php printf( __( '<a href="%s">Yahoo! Yslow</a> analyzes web pages and suggests ways to improve their performance based on a set of rules for high performance web pages. Also try the performance tools online at <a href="%s">GTMetrix</a>.', 'wp-super-cache' ), 'http://yslow.org/', 'https://gtmetrix.com/' ); ?></li>
1343
- <li><?php printf( __( '<a href="%s">Use Google Libraries</a> allows you to load some commonly used Javascript libraries from Google webservers. Ironically, it may reduce your Yslow score.', 'wp-super-cache' ), 'https://wordpress.org/plugins/use-google-libraries/' ); ?></li>
1344
- <li><?php printf( __( '<strong>Advanced users only:</strong> Install an object cache. Choose from <a href="%s">Memcached</a>, <a href="%s">XCache</a>, <a href="%s">eAcccelerator</a> and others.', 'wp-super-cache' ), 'https://wordpress.org/plugins/memcached/', 'https://neosmart.net/WP/XCache/', 'https://neosmart.net/WP/eAccelerator/' ); ?></li>
1345
- <li><?php printf( __( '<a href="%s">WP Crontrol</a> is a useful plugin to use when trying to debug garbage collection and preload problems.', 'wp-super-cache' ), 'https://wordpress.org/plugins/wp-crontrol/' ); ?></li>
1346
- </ul>
1347
- <?php
1348
-
1349
  break;
1350
  }
1351
  ?>
@@ -1452,81 +1181,12 @@ function wpsc_admin_tabs( $current = '' ) {
1452
  echo '</div></h3>';
1453
  }
1454
 
1455
- function wsc_mod_rewrite() {
1456
- global $valid_nonce, $cache_path;
1457
-
1458
- if ( $GLOBALS['is_nginx'] ) {
1459
- return false;
1460
- }
1461
-
1462
- if ( defined( 'WPSC_DISABLE_HTACCESS_UPDATE' ) ) {
1463
- return false;
1464
- }
1465
-
1466
- if ( $GLOBALS['cache_enabled'] !== true || $GLOBALS['wp_cache_mod_rewrite'] !== 1 ) {
1467
- return false;
1468
- }
1469
-
1470
- ?>
1471
- <a name="modrewrite"></a><fieldset class="options">
1472
- <h4><?php _e( 'Mod Rewrite Rules', 'wp-super-cache' ); ?></h4>
1473
- <p><?php _e( 'When Expert cache delivery is enabled a file called <em>.htaccess</em> is modified. It should probably be in the same directory as your wp-config.php. This file has special rules that serve the cached files very quickly to visitors without ever executing PHP. The .htaccess file can be updated automatically, but if that fails, the rules will be displayed here and it can be edited by you. You will not need to update the rules unless a warning shows here.', 'wp-super-cache' ); ?></p>
1474
-
1475
- <?php
1476
- extract( wpsc_get_htaccess_info() ); // $document_root, $apache_root, $home_path, $home_root, $home_root_lc, $inst_root, $wprules, $scrules, $condition_rules, $rules, $gziprules
1477
- $dohtaccess = true;
1478
- if( strpos( $wprules, 'wordpressuser' ) ) { // Need to clear out old mod_rewrite rules
1479
- echo "<p><strong>" . __( 'Thank you for upgrading.', 'wp-super-cache' ) . "</strong> " . sprintf( __( 'The mod_rewrite rules changed since you last installed this plugin. Unfortunately, you must remove the old supercache rules before the new ones are updated. Refresh this page when you have edited your .htaccess file. If you wish to manually upgrade, change the following line: %1$s so it looks like this: %2$s The only changes are "HTTP_COOKIE" becomes "HTTP:Cookie" and "wordpressuser" becomes "wordpress". This is a WordPress 2.5 change but it&#8217;s backwards compatible with older versions if you&#8217;re brave enough to use them.', 'wp-super-cache' ), '<blockquote><code>RewriteCond %{HTTP_COOKIE} !^.*wordpressuser.*$</code></blockquote>', '<blockquote><code>RewriteCond %{HTTP:Cookie} !^.*wordpress.*$</code></blockquote>' ) . "</p>";
1480
- echo "</fieldset></div>";
1481
- return;
1482
- }
1483
- if ( $dohtaccess && !isset( $_POST[ 'updatehtaccess' ] ) ){
1484
- if ( $scrules == '' ) {
1485
- wpsc_update_htaccess_form( 0 ); // don't hide the update htaccess form
1486
- } else {
1487
- wpsc_update_htaccess_form();
1488
- }
1489
- } elseif ( $valid_nonce && isset( $_POST[ 'updatehtaccess' ] ) ) {
1490
- if ( add_mod_rewrite_rules() ) {
1491
- echo "<h5>" . __( 'Mod Rewrite rules updated!', 'wp-super-cache' ) . "</h5>";
1492
- echo "<p><strong>" . sprintf( __( '%s.htaccess has been updated with the necessary mod_rewrite rules. Please verify they are correct. They should look like this:', 'wp-super-cache' ), $home_path ) . "</strong></p>\n";
1493
- } else {
1494
- global $update_mod_rewrite_rules_error;
1495
- echo "<h5>" . __( 'Mod Rewrite rules must be updated!', 'wp-super-cache' ) . "</h5>";
1496
- echo "<p>" . sprintf( __( 'The plugin could not update %1$s.htaccess file: %2$s.<br /> The new rules go above the regular WordPress rules as shown in the code below:', 'wp-super-cache' ), $home_path, "<strong>" . $update_mod_rewrite_rules_error . "</strong>" ) . "</p>\n";
1497
- }
1498
- echo "<div style='overflow: auto; width: 800px; height: 400px; padding:0 8px;color:#4f8a10;background-color:#dff2bf;border:1px solid #4f8a10;'>";
1499
- echo "<p><pre>" . esc_html( $rules ) . "</pre></p>\n</div>";
1500
- } else {
1501
- ?>
1502
- <p><?php printf( __( 'WP Super Cache mod rewrite rules were detected in your %s.htaccess file.<br /> Click the following link to see the lines added to that file. If you have upgraded the plugin, make sure these rules match.', 'wp-super-cache' ), $home_path ); ?></p>
1503
- <?php
1504
- if ( $rules != $scrules ) {
1505
- ?><p style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'><?php _e( 'A difference between the rules in your .htaccess file and the plugin rewrite rules has been found. This could be simple whitespace differences, but you should compare the rules in the file with those below as soon as possible. Click the &#8217;Update Mod_Rewrite Rules&#8217; button to update the rules.', 'wp-super-cache' ); ?></p><?php
1506
- }
1507
- ?><a href="javascript:toggleLayer('rewriterules');" class="button"><?php _e( 'View Mod_Rewrite Rules', 'wp-super-cache' ); ?></a><?php
1508
- wpsc_update_htaccess_form();
1509
- echo "<div id='rewriterules' style='display: none;'>";
1510
- if ( $rules != $scrules )
1511
- echo '<div style="background: #fff; border: 1px solid #333; margin: 2px;">' . wp_text_diff( $scrules, $rules, array( 'title' => __( 'Rewrite Rules', 'wp-super-cache' ), 'title_left' => __( 'Current Rules', 'wp-super-cache' ), 'title_right' => __( 'New Rules', 'wp-super-cache' ) ) ) . "</div>";
1512
- echo "<p><pre># BEGIN WPSuperCache\n" . esc_html( $rules ) . "# END WPSuperCache</pre></p>\n";
1513
- echo "<p>" . sprintf( __( 'Rules must be added to %s too:', 'wp-super-cache' ), WP_CONTENT_DIR . "/cache/.htaccess" ) . "</p>";
1514
- echo "<pre># BEGIN supercache\n" . esc_html( $gziprules ) . "# END supercache</pre></p>";
1515
- echo '</div>';
1516
- }
1517
-
1518
- ?></fieldset><?php
1519
- }
1520
-
1521
- function wp_cache_restore() {
1522
  $admin_url = admin_url( 'options-general.php?page=wpsupercache' );
1523
- echo '<fieldset class="options"><h4>' . __( 'Fix Configuration', 'wp-super-cache' ) . '</h4>';
1524
- echo '<form name="wp_restore" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) . '#top' ) . '" method="post">';
1525
- echo '<input type="hidden" name="wp_restore_config" />';
1526
- echo '<div class="submit"><input class="button-secondary" type="submit" ' . SUBMITDISABLED . 'id="deletepost" value="' . __( 'Restore Default Configuration', 'wp-super-cache' ) . '" /></div>';
1527
- wp_nonce_field('wp-cache');
1528
- echo "</form>\n";
1529
- echo '</fieldset>';
1530
 
1531
  }
1532
 
@@ -1631,91 +1291,17 @@ function wpsc_update_direct_pages() {
1631
  return $cached_direct_pages;
1632
  }
1633
 
1634
- function wp_lock_down() {
1635
  global $cached_direct_pages, $cache_enabled, $super_cache_enabled;
1636
 
1637
  $admin_url = admin_url( 'options-general.php?page=wpsupercache' );
1638
  $wp_lock_down = wp_update_lock_down();
1639
 
1640
- ?><a name='lockdown'></a>
1641
- <fieldset class="options">
1642
- <h4><?php _e( 'Lock Down:', 'wp-super-cache' ); ?> <?php echo $wp_lock_down == '0' ? '<span style="color:red">' . __( 'Disabled', 'wp-super-cache' ) . '</span>' : '<span style="color:green">' . __( 'Enabled', 'wp-super-cache' ) . '</span>'; ?></h4>
1643
- <p><?php _e( 'Prepare your server for an expected spike in traffic by enabling the lock down. When this is enabled, new comments on a post will not refresh the cached static files.', 'wp-super-cache' ); ?></p>
1644
- <p><?php _e( 'Developers: Make your plugin lock down compatible by checking the "WPLOCKDOWN" constant. The following code will make sure your plugin respects the WPLOCKDOWN setting.', 'wp-super-cache' ); ?>
1645
- <blockquote><code>if( defined( 'WPLOCKDOWN' ) && constant( 'WPLOCKDOWN' ) ) {
1646
- &nbsp;&nbsp;&nbsp;&nbsp;echo "<?php _e( 'Sorry. My blog is locked down. Updates will appear shortly', 'wp-super-cache' ); ?>";
1647
- }</code></blockquote>
1648
- <?php
1649
- if( $wp_lock_down == '1' ) {
1650
- ?><p><?php _e( 'WordPress is locked down. Super Cache static files will not be deleted when new comments are made.', 'wp-super-cache' ); ?></p><?php
1651
- } else {
1652
- ?><p><?php _e( 'WordPress is not locked down. New comments will refresh Super Cache static files as normal.', 'wp-super-cache' ); ?></p><?php
1653
- }
1654
- $new_lockdown = $wp_lock_down == '1' ? '0' : '1';
1655
- $new_lockdown_desc = $wp_lock_down == '1' ? __( 'Disable', 'wp-super-cache' ) : __( 'Enable', 'wp-super-cache' );
1656
- echo '<form name="wp_lock_down" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) . '#lockdown' ) . '" method="post">';
1657
- echo "<input type='hidden' name='wp_lock_down' value='{$new_lockdown}' />";
1658
- echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . ' value="' . esc_attr( $new_lockdown_desc . ' ' . __( 'Lock Down', 'wp-super-cache' ) ) . '" /></div>';
1659
- wp_nonce_field( 'wp-cache' );
1660
- echo '</form>';
1661
-
1662
- ?></fieldset><?php
1663
- if( $cache_enabled == true && $super_cache_enabled == true ) {
1664
- ?><a name='direct'></a>
1665
- <fieldset class="options">
1666
- <h4><?php _e( 'Directly Cached Files', 'wp-super-cache' ); ?></h4><?php
1667
-
1668
- $cached_direct_pages = wpsc_update_direct_pages();
1669
-
1670
- $readonly = '';
1671
- if( !is_writeable_ACLSafe( ABSPATH ) ) {
1672
- $readonly = 'READONLY';
1673
- ?><p style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'><strong><?php _e( 'Warning!', 'wp-super-cache' ); ?></strong> <?php printf( __( 'You must make %s writable to enable this feature. As this is a security risk, please make it read-only after your page is generated.', 'wp-super-cache' ), ABSPATH ); ?></p><?php
1674
- } else {
1675
- $abspath_stat = stat(ABSPATH . '/');
1676
- $abspath_mode = decoct( $abspath_stat[ 'mode' ] & 0777 );
1677
- if ( substr( $abspath_mode, -2 ) == '77' ) {
1678
- ?><p style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'><strong><?php _e( 'Warning!', 'wp-super-cache' ); ?></strong> <?php printf( __( '%s is writable. Please make it readonly after your page is generated as this is a security risk.', 'wp-super-cache' ), ABSPATH ); ?></p><?php
1679
- }
1680
- }
1681
- echo '<form name="direct_page" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) . '#direct' ) . '" method="post">';
1682
- if( is_array( $cached_direct_pages ) ) {
1683
- $out = '';
1684
- foreach( $cached_direct_pages as $page ) {
1685
- if( $page == '' )
1686
- continue;
1687
- $generated = '';
1688
- if( is_file( ABSPATH . $page . '/index.html' ) )
1689
- $generated = '<input class="button-secondary" type="Submit" name="deletepage" value="' . $page . '">';
1690
- $out .= "<tr><td><input type='text' $readonly name='direct_pages[]' size='30' value='$page' /></td><td>$generated</td></tr>";
1691
- }
1692
- if( $out != '' ) {
1693
- ?><table><tr><th><?php _e( 'Existing direct page', 'wp-super-cache' ); ?></th><th><?php _e( 'Delete cached file', 'wp-super-cache' ); ?></th></tr><?php
1694
- echo "$out</table>";
1695
- }
1696
- }
1697
-
1698
- if ( 'READONLY' !== $readonly ) {
1699
- echo esc_html__( 'Add direct page:', 'wp-super-cache' ) . '<input type="text" name="new_direct_page" size="30" value="" />';
1700
- }
1701
- echo '<p>' . sprintf(
1702
- esc_html__( 'Directly cached files are files created directly off %s where your blog lives. This feature is only useful if you are expecting a major Digg or Slashdot level of traffic to one post or page.', 'wp-super-cache' ),
1703
- esc_attr( ABSPATH )
1704
- ) . '</p>';
1705
- if ( 'READONLY' !== $readonly ) {
1706
- echo '<p>' . sprintf( __( 'For example: to cache <em>%1$sabout/</em>, you would enter %1$sabout/ or /about/. The cached file will be generated the next time an anonymous user visits that page.', 'wp-super-cache' ),
1707
- esc_attr( trailingslashit( get_option( 'home' ) ) )
1708
- ) . '</p>';
1709
- echo '<p>' . esc_html__( 'Make the textbox blank to remove it from the list of direct pages and delete the cached file.', 'wp-super-cache' ) . '</p>';
1710
 
1711
- echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . ' value="' . esc_attr__( 'Update Direct Pages', 'wp-super-cache' ) . '" /></div>';
1712
- }
1713
- wp_nonce_field( 'wp-cache' );
1714
- echo '</form>';
1715
- ?>
1716
- </fieldset>
1717
- <?php
1718
- } // if $super_cache_enabled
1719
  }
1720
 
1721
  function RecursiveFolderDelete ( $folderPath ) { // from http://www.php.net/manual/en/function.rmdir.php
@@ -1817,87 +1403,6 @@ function wp_cache_time_update() {
1817
 
1818
  }
1819
 
1820
- function wp_cache_edit_max_time() {
1821
- global $cache_max_time, $wp_cache_config_file, $valid_nonce, $super_cache_enabled, $cache_schedule_type, $cache_scheduled_time, $cache_schedule_interval, $cache_time_interval, $cache_gc_email_me, $wp_cache_preload_on;
1822
-
1823
- $admin_url = admin_url( 'options-general.php?page=wpsupercache' );
1824
- $timezone_format = _x('Y-m-d G:i:s', 'timezone date format');
1825
-
1826
- wp_cache_time_update();
1827
-
1828
- ?><fieldset class="options">
1829
- <a name='expirytime'></a>
1830
- <h4><?php _e( 'Expiry Time &amp; Garbage Collection', 'wp-super-cache' ); ?></h4><?php
1831
-
1832
- ?><span id="utc-time"><?php printf( __( '<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>', 'wp-super-cache' ), date_i18n( $timezone_format, false, 'gmt' ) ); ?></span><?php
1833
- $current_offset = get_option('gmt_offset');
1834
- if ( get_option('timezone_string') || !empty($current_offset) ) {
1835
- ?><span id="local-time"><?php printf( __( 'Local time is <code>%1$s</code>', 'wp-super-cache' ), date_i18n( $timezone_format ) ); ?></span><?php
1836
- }
1837
- $next_gc = wp_next_scheduled( 'wp_cache_gc' );
1838
- if ( $next_gc )
1839
- echo "<p>" . sprintf( __( 'Next scheduled garbage collection will be at <strong>%s UTC</strong>', 'wp-super-cache' ), date_i18n( $timezone_format, $next_gc, 'gmt' ) ) . "</p>";
1840
-
1841
-
1842
- if ( $wp_cache_preload_on )
1843
- echo "<p>" . __( 'Warning! <strong>PRELOAD MODE</strong> activated. Supercache files will not be deleted regardless of age.', 'wp-super-cache' ) . "</p>";
1844
-
1845
- echo "<script type='text/javascript'>";
1846
- echo "jQuery(function () {
1847
- jQuery('#cache_interval_time').click(function () {
1848
- jQuery('#schedule_interval').attr('checked', true);
1849
- });
1850
- jQuery('#cache_scheduled_time').click(function () {
1851
- jQuery('#schedule_time').attr('checked', true);
1852
- });
1853
- jQuery('#cache_scheduled_select').click(function () {
1854
- jQuery('#schedule_time').attr('checked', true);
1855
- });
1856
- });";
1857
- echo "</script>";
1858
- echo '<form name="wp_edit_max_time" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) . '#expirytime' ) . '" method="post">';
1859
- echo '<input name="action" value="expirytime" type="hidden" />';
1860
- echo '<table class="form-table">';
1861
- echo '<tr><td><label for="wp_max_time"><strong>' . __( 'Cache Timeout', 'wp-super-cache' ) . '</strong></label></td>';
1862
- echo "<td><input type='text' id='wp_max_time' size=6 name='wp_max_time' value='" . esc_attr( $cache_max_time ) . "' /> " . __( "seconds", 'wp-super-cache' ) . "</td></tr>\n";
1863
- echo "<tr><td></td><td>" . __( 'How long should cached pages remain fresh? Set to 0 to disable garbage collection. A good starting point is 3600 seconds.', 'wp-super-cache' ) . "</td></tr>\n";
1864
- echo '<tr><td valign="top"><strong>' . __( 'Scheduler', 'wp-super-cache' ) . '</strong></td><td><table cellpadding=0 cellspacing=0><tr><td valign="top"><input type="radio" id="schedule_interval" name="cache_schedule_type" value="interval" ' . checked( 'interval', $cache_schedule_type, false ) . ' /></td><td valign="top"><label for="cache_interval_time">' . __( 'Timer:', 'wp-super-cache' ) . '</label></td>';
1865
- echo "<td><input type='text' id='cache_interval_time' size=6 name='cache_time_interval' value='" . esc_attr( $cache_time_interval ) . "' /> " . __( "seconds", 'wp-super-cache' ) . '<br />' . __( 'Check for stale cached files every <em>interval</em> seconds.', 'wp-super-cache' ) . "</td></tr>";
1866
- echo '<tr><td valign="top"><input type="radio" id="schedule_time" name="cache_schedule_type" value="time" ' . checked( 'time', $cache_schedule_type, false ) . ' /></td><td valign="top"><label for="schedule_time">' . __( 'Clock:', 'wp-super-cache' ) . '</label></td>';
1867
- echo "<td><input type=\"text\" size=5 id='cache_scheduled_time' name='cache_scheduled_time' value=\"" . esc_attr( $cache_scheduled_time ) . "\" /> " . __( "HH:MM", 'wp-super-cache' ) . "<br />" . __( 'Check for stale cached files at this time <strong>(UTC)</strong> or starting at this time every <em>interval</em> below.', 'wp-super-cache' ) . "</td></tr>";
1868
- $schedules = wp_get_schedules();
1869
- echo "<tr><td><br /></td><td><label for='cache_scheduled_select'>" . __( 'Interval:', 'wp-super-cache' ) . "</label></td><td><select id='cache_scheduled_select' name='cache_schedule_interval' size=1>";
1870
- foreach( $schedules as $desc => $details ) {
1871
- echo "<option value='$desc' " . selected( $desc, $cache_schedule_interval, false ) . " /> {$details[ 'display' ]}</option>";
1872
- }
1873
- echo "</select></td></tr>";
1874
- echo '</table></td></tr>';
1875
- echo '<tr><td><label for="cache_gc_email_me"><strong>' . __( 'Notification Emails', 'wp-super-cache' ) . '</strong></label></td>';
1876
- echo "<td><input type='checkbox' id='cache_gc_email_me' name='cache_gc_email_me' " . checked( $cache_gc_email_me, 1, false ) . " /> " . __( 'Email me when the garbage collection runs.', 'wp-super-cache' ) . "</td></tr>\n";
1877
- echo "</table>\n";
1878
- echo "<h5>" . __( 'Garbage Collection', 'wp-super-cache' ) . "</h5>";
1879
- echo "<ol><li>" . __( '<em>Garbage collection</em> is the simple act of throwing out your garbage. For this plugin that would be old or <em>stale</em> cached files that may be out of date. New cached files are described as <em>fresh</em>.', 'wp-super-cache' ) . "</li>\n";
1880
- echo "<li>" . __( 'Cached files are fresh for a limited length of time. You can set that time in the <em>Cache Timeout</em> text box on this page.', 'wp-super-cache' ) . "</li>\n";
1881
- echo "<li>" . __( 'Stale cached files are not removed as soon as they become stale. They have to be removed by the garbage collecter. That is why you have to tell the plugin when the garbage collector should run.', 'wp-super-cache' ) . "</li>\n";
1882
- echo "<li>" . __( 'Use the <em>Timer</em> or <em>Clock</em> schedulers to define when the garbage collector should run.', 'wp-super-cache' ) . "</li>\n";
1883
- echo "<li>" . __( 'The <em>Timer</em> scheduler tells the plugin to run the garbage collector at regular intervals. When one garbage collection is done, the next run is scheduled.', 'wp-super-cache' ) . "</li>\n";
1884
- echo "<li>" . __( 'Or, the <em>Clock</em> scheduler allows the garbage collection to run at specific times. If set to run hourly or twice daily, the garbage collector will be first scheduled for the time you enter here. It will then run again at the indicated interval. If set to run daily, it will run once a day at the time specified.', 'wp-super-cache' ) . "</li>\n";
1885
- echo "</ol>";
1886
- echo "<p>" . __( 'There are no best garbage collection settings but here are a few scenarios. Garbage collection is separate to other actions that clear our cached files like leaving a comment or publishing a post.', 'wp-super-cache' ) . "</p>\n";
1887
- echo "<ol>";
1888
- echo "<li>" . __( 'Sites that want to serve lots of newly generated data should set the <em>Cache Timeout</em> to 60 and use the <em>Timer</em> scheduler set to 90 seconds.', 'wp-super-cache' ) . "</li>\n";
1889
- echo "<li>" . __( 'Sites with widgets and rss feeds in their sidebar should probably use a timeout of 3600 seconds and set the timer to 600 seconds. Stale files will be caught within 10 minutes of going stale.', 'wp-super-cache' ) . "</li>\n";
1890
- echo "<li>" . __( 'Sites with lots of static content, no widgets or rss feeds in their sidebar can use a timeout of 86400 seconds or even more and set the timer to something equally long.', 'wp-super-cache' ) . "</li>\n";
1891
- echo "<li>" . __( 'Sites where an external data source updates at a particular time every day should set the timeout to 86400 seconds and use the Clock scheduler set appropriately.', 'wp-super-cache' ) . "</li>\n";
1892
- echo "</ol>";
1893
- echo "<p>" . __( 'Checking for and deleting expired files is expensive, but it&#8217;s expensive leaving them there too. On a very busy site, you should set the expiry time to <em>600 seconds</em>. Experiment with different values and visit this page to see how many expired files remain at different times during the day.', 'wp-super-cache' ) . "</p>";
1894
- echo "<p>" . __( 'Set the expiry time to 0 seconds to disable garbage collection.', 'wp-super-cache' ) . "</p>";
1895
- echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Change Expiration', 'wp-super-cache' ) . '" /></div>';
1896
- wp_nonce_field('wp-cache');
1897
- echo "</form>\n";
1898
- ?></fieldset><?php
1899
- }
1900
-
1901
  function wp_cache_sanitize_value($text, & $array) {
1902
  $text = esc_html(strip_tags($text));
1903
  $array = preg_split("/[\s,]+/", chop($text));
@@ -1922,8 +1427,8 @@ function wp_cache_update_rejected_ua() {
1922
  }
1923
  }
1924
 
1925
- function wp_cache_edit_rejected_ua() {
1926
- global $cache_rejected_user_agent, $wp_cache_config_file, $valid_nonce;
1927
 
1928
  if ( ! function_exists( 'apache_request_headers' ) ) {
1929
  return;
@@ -1931,19 +1436,11 @@ function wp_cache_edit_rejected_ua() {
1931
 
1932
  $admin_url = admin_url( 'options-general.php?page=wpsupercache' );
1933
  wp_cache_update_rejected_ua();
 
 
 
 
1934
 
1935
- echo '<a name="useragents"></a><fieldset class="options"><h4>' . __( 'Rejected User Agents', 'wp-super-cache' ) . '</h4>';
1936
- echo "<p>" . __( 'Strings in the HTTP &#8217;User Agent&#8217; header that prevent WP-Cache from caching bot, spiders, and crawlers&#8217; requests. Note that super cached files are still sent to these agents if they already exists.', 'wp-super-cache' ) . "</p>\n";
1937
- echo '<form name="wp_edit_rejected_user_agent" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) . '#useragents' ) . '" method="post">';
1938
- echo '<textarea name="wp_rejected_user_agent" cols="40" rows="4" style="width: 50%; font-size: 12px;" class="code">';
1939
- foreach( $cache_rejected_user_agent as $ua ) {
1940
- echo esc_html( $ua ) . "\n";
1941
- }
1942
- echo '</textarea> ';
1943
- echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Save UA Strings', 'wp-super-cache' ) . '" /></div>';
1944
- wp_nonce_field('wp-cache');
1945
- echo '</form>';
1946
- echo "</fieldset>\n";
1947
  }
1948
 
1949
  function wp_cache_update_rejected_pages() {
@@ -1963,33 +1460,6 @@ function wp_cache_update_rejected_pages() {
1963
  }
1964
  }
1965
 
1966
- function wp_cache_edit_rejected_pages() {
1967
- global $wp_cache_config_file, $valid_nonce, $wp_cache_pages;
1968
-
1969
- $admin_url = admin_url( 'options-general.php?page=wpsupercache' );
1970
- wp_cache_update_rejected_pages();
1971
-
1972
- echo '<a name="rejectpages"></a>';
1973
- echo '<p>' . __( 'Do not cache the following page types. See the <a href="https://codex.wordpress.org/Conditional_Tags">Conditional Tags</a> documentation for a complete discussion on each type.', 'wp-super-cache' ) . '</p>';
1974
- echo '<form name="wp_edit_rejected_pages" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) . '#rejectpages' ) . '" method="post">';
1975
- echo '<input type="hidden" name="wp_edit_rejected_pages" value="1" />';
1976
- echo '<label><input type="checkbox" value="1" name="wp_cache_pages[single]" ' . checked( 1, $wp_cache_pages[ 'single' ], false ) . ' /> ' . __( 'Single Posts', 'wp-super-cache' ) . ' (is_single)</label><br />';
1977
- echo '<label><input type="checkbox" value="1" name="wp_cache_pages[pages]" ' . checked( 1, $wp_cache_pages[ 'pages' ], false ) . ' /> ' . __( 'Pages', 'wp-super-cache' ) . ' (is_page)</label><br />';
1978
- echo '<label><input type="checkbox" value="1" name="wp_cache_pages[frontpage]" ' . checked( 1, $wp_cache_pages[ 'frontpage' ], false ) . ' /> ' . __( 'Front Page', 'wp-super-cache' ) . ' (is_front_page)</label><br />';
1979
- echo '&nbsp;&nbsp;<label><input type="checkbox" value="1" name="wp_cache_pages[home]" ' . checked( 1, $wp_cache_pages[ 'home' ], false ) . ' /> ' . __( 'Home', 'wp-super-cache' ) . ' (is_home)</label><br />';
1980
- echo '<label><input type="checkbox" value="1" name="wp_cache_pages[archives]" ' . checked( 1, $wp_cache_pages[ 'archives' ], false ) . ' /> ' . __( 'Archives', 'wp-super-cache' ) . ' (is_archive)</label><br />';
1981
- echo '&nbsp;&nbsp;<label><input type="checkbox" value="1" name="wp_cache_pages[tag]" ' . checked( 1, $wp_cache_pages[ 'tag' ], false ) . ' /> ' . __( 'Tags', 'wp-super-cache' ) . ' (is_tag)</label><br />';
1982
- echo '&nbsp;&nbsp;<label><input type="checkbox" value="1" name="wp_cache_pages[category]" ' . checked( 1, $wp_cache_pages[ 'category' ], false ) . ' /> ' . __( 'Category', 'wp-super-cache' ) . ' (is_category)</label><br />';
1983
- echo '<label><input type="checkbox" value="1" name="wp_cache_pages[feed]" ' . checked( 1, $wp_cache_pages[ 'feed' ], false ) . ' /> ' . __( 'Feeds', 'wp-super-cache' ) . ' (is_feed)</label><br />';
1984
- echo '<label><input type="checkbox" value="1" name="wp_cache_pages[search]" ' . checked( 1, $wp_cache_pages[ 'search' ], false ) . ' /> ' . __( 'Search Pages', 'wp-super-cache' ) . ' (is_search)</label><br />';
1985
- echo '<label><input type="checkbox" value="1" name="wp_cache_pages[author]" ' . checked( 1, $wp_cache_pages[ 'author' ], false ) . ' /> ' . __( 'Author Pages', 'wp-super-cache' ) . ' (is_author)</label><br />';
1986
-
1987
- echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Save Settings', 'wp-super-cache' ) . '" /></div>';
1988
- wp_nonce_field('wp-cache');
1989
- echo "</form>\n";
1990
-
1991
- }
1992
-
1993
  function wpsc_update_tracking_parameters() {
1994
  global $wpsc_tracking_parameters, $valid_nonce, $wp_cache_config_file;
1995
 
@@ -2013,19 +1483,10 @@ function wpsc_edit_tracking_parameters() {
2013
  if ( ! isset( $wpsc_ignore_tracking_parameters ) ) {
2014
  $wpsc_ignore_tracking_parameters = 0;
2015
  }
2016
-
2017
- echo '<a name="trackingparameters"></a><fieldset class="options"><h4>' . __( 'Tracking Parameters', 'wp-super-cache' ) . '</h4>';
2018
- echo '<form name="edit_tracking_parameters" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) . '#trackingparameters' ) . '" method="post">';
2019
- echo "<p>" . __( 'Tracking parameters to ignore when caching. Visitors from Facebook, Twitter and elsewhere to your website will go to a URL with tracking parameters added. This setting allows the plugin to ignore those parameters and show an already cached page. Any actual tracking by Google Analytics or other Javascript based code should still work as the URL of the page is not modified.', 'wp-super-cache' ) . "</p>\n";
2020
- echo '<textarea name="tracking_parameters" cols="20" rows="10" style="width: 50%; font-size: 12px;" class="code">';
2021
- foreach ( $wpsc_tracking_parameters as $parameter) {
2022
- echo esc_html( $parameter ) . "\n";
2023
- }
2024
- echo '</textarea> ';
2025
- echo "<p><label><input type='checkbox' name='wpsc_ignore_tracking_parameters' value='1' " . checked( 1, $wpsc_ignore_tracking_parameters, false ) . " /> " . __( 'Enable', 'wp-super-cache' ) . "</label></p>";
2026
- echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Save', 'wp-super-cache' ) . '" /></div>';
2027
- wp_nonce_field('wp-cache');
2028
- echo "</form>\n";
2029
  }
2030
 
2031
  function wp_cache_update_rejected_cookies() {
@@ -2037,25 +1498,6 @@ function wp_cache_update_rejected_cookies() {
2037
  }
2038
  }
2039
 
2040
- function wp_cache_edit_rejected_cookies() {
2041
- global $wpsc_rejected_cookies;
2042
-
2043
- $admin_url = admin_url( 'options-general.php?page=wpsupercache' );
2044
- wp_cache_update_rejected_cookies();
2045
-
2046
- echo '<a name="rejectcookies"></a><fieldset class="options"><h4>' . __( 'Rejected Cookies', 'wp-super-cache' ) . '</h4>';
2047
- echo '<form name="wp_edit_rejected_cookies" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) . '#rejectcookies' ) . '" method="post">';
2048
- echo "<p>" . __( 'Do not cache pages when these cookies are set. Add the cookie names here, one per line. Matches on fragments, so "test" will match "WordPress_test_cookie". (Simple caching only)', 'wp-super-cache' ) . "</p>\n";
2049
- echo '<textarea name="wp_rejected_cookies" cols="40" rows="4" style="width: 50%; font-size: 12px;" class="code">';
2050
- foreach ( $wpsc_rejected_cookies as $file) {
2051
- echo esc_html( $file ) . "\n";
2052
- }
2053
- echo '</textarea> ';
2054
- echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Save', 'wp-super-cache' ) . '" /></div>';
2055
- wp_nonce_field('wp-cache');
2056
- echo "</form>\n";
2057
- }
2058
-
2059
  function wp_cache_update_rejected_strings() {
2060
  global $cache_rejected_uri, $wp_cache_config_file, $valid_nonce;
2061
 
@@ -2066,25 +1508,6 @@ function wp_cache_update_rejected_strings() {
2066
 
2067
  }
2068
 
2069
- function wp_cache_edit_rejected() {
2070
- global $cache_rejected_uri;
2071
-
2072
- $admin_url = admin_url( 'options-general.php?page=wpsupercache' );
2073
- wp_cache_update_rejected_strings();
2074
-
2075
- echo '<a name="rejecturi"></a><fieldset class="options"><h4>' . __( 'Rejected URL Strings', 'wp-super-cache' ) . '</h4>';
2076
- echo '<form name="wp_edit_rejected" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) . '#rejecturi' ) . '" method="post">';
2077
- echo "<p>" . __( 'Add here strings (not a filename) that forces a page not to be cached. For example, if your URLs include year and you dont want to cache last year posts, it&#8217;s enough to specify the year, i.e. &#8217;/2004/&#8217;. WP-Cache will search if that string is part of the URI and if so, it will not cache that page.', 'wp-super-cache' ) . "</p>\n";
2078
- echo '<textarea name="wp_rejected_uri" cols="40" rows="4" style="width: 50%; font-size: 12px;" class="code">';
2079
- foreach ($cache_rejected_uri as $file) {
2080
- echo esc_html( $file ) . "\n";
2081
- }
2082
- echo '</textarea> ';
2083
- echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Save Strings', 'wp-super-cache' ) . '" /></div>';
2084
- wp_nonce_field('wp-cache');
2085
- echo "</form>\n";
2086
- }
2087
-
2088
  function wp_cache_update_accepted_strings() {
2089
  global $cache_acceptable_files, $wp_cache_config_file, $valid_nonce;
2090
 
@@ -2094,25 +1517,6 @@ function wp_cache_update_accepted_strings() {
2094
  }
2095
  }
2096
 
2097
- function wp_cache_edit_accepted() {
2098
- global $cache_acceptable_files;
2099
-
2100
- wp_cache_update_accepted_strings();
2101
- $admin_url = admin_url( 'options-general.php?page=wpsupercache' );
2102
-
2103
- echo '<a name="cancache"></a><fieldset class="options"><h4>' . __( 'Always Cache Filenames', 'wp-super-cache' ) . '</h4>';
2104
- echo '<div style="clear:both"></div><form name="wp_edit_accepted" action="' . esc_url_raw( add_query_arg( 'tab', 'settings', $admin_url ) . '#cancache' ) . '" method="post">';
2105
- echo "<p>" . __( 'Add here those filenames that can be cached, even if they match one of the rejected substring specified above.', 'wp-super-cache' ) . "</p>\n";
2106
- echo '<textarea name="wp_accepted_files" cols="40" rows="8" style="width: 50%; font-size: 12px;" class="code">';
2107
- foreach ($cache_acceptable_files as $file) {
2108
- echo esc_html($file) . "\n";
2109
- }
2110
- echo '</textarea> ';
2111
- echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Save Files', 'wp-super-cache' ) . '" /></div>';
2112
- wp_nonce_field('wp-cache');
2113
- echo "</form>\n";
2114
- }
2115
-
2116
  function wpsc_update_debug_settings() {
2117
  global $wp_super_cache_debug, $wp_cache_debug_log, $wp_cache_debug_ip, $cache_path, $valid_nonce, $wp_cache_config_file, $wp_super_cache_comments;
2118
  global $wp_super_cache_front_page_check, $wp_super_cache_front_page_clear, $wp_super_cache_front_page_text, $wp_super_cache_front_page_notification, $wp_super_cache_advanced_debug;
@@ -2194,76 +1598,6 @@ function wpsc_update_debug_settings() {
2194
  );
2195
  }
2196
 
2197
- function wp_cache_debug_settings() {
2198
- global $wp_super_cache_debug, $wp_cache_debug_log, $wp_cache_debug_ip, $cache_path, $valid_nonce, $wp_cache_config_file, $wp_super_cache_comments;
2199
- global $wp_super_cache_front_page_check, $wp_super_cache_front_page_clear, $wp_super_cache_front_page_text, $wp_super_cache_front_page_notification, $wp_super_cache_advanced_debug;
2200
- global $wp_cache_debug_username;
2201
-
2202
- extract( wpsc_update_debug_settings() ); // $wp_super_cache_debug, $wp_cache_debug_log, $wp_cache_debug_ip, $wp_super_cache_comments, $wp_super_cache_front_page_check, $wp_super_cache_front_page_clear, $wp_super_cache_front_page_text, $wp_super_cache_front_page_notification, $wp_super_cache_advanced_debug, $wp_cache_debug_username
2203
- $admin_url = admin_url( 'options-general.php?page=wpsupercache' );
2204
-
2205
- echo '<a name="debug"></a>';
2206
- echo '<fieldset class="options">';
2207
- echo '<p>' . __( 'Fix problems with the plugin by debugging it here. It will log to a file in your cache directory.', 'wp-super-cache' ) . '</p>';
2208
- if ( ! isset( $wp_cache_debug_log ) || $wp_cache_debug_log == '' ) {
2209
- extract( wpsc_create_debug_log() ); // $wp_cache_debug_log, $wp_cache_debug_username
2210
- }
2211
-
2212
- $log_file_link = "<a href='" . site_url( str_replace( ABSPATH, '', "{$cache_path}view_{$wp_cache_debug_log}?wp-admin=1&wp-json=1&filter=" ) ) . "'>$wp_cache_debug_log</a>";
2213
-
2214
- if ( $wp_super_cache_debug == 1 ) {
2215
- echo "<p>" . sprintf( __( 'Currently logging to: %s', 'wp-super-cache' ), $log_file_link ) . "</p>";
2216
- } else {
2217
- echo "<p>" . sprintf( __( 'Last Logged to: %s', 'wp-super-cache' ), $log_file_link ) . "</p>";
2218
- }
2219
- echo "<p>" . sprintf( __( 'Username/Password: %s', 'wp-super-cache' ), $wp_cache_debug_username ) . "</p>";
2220
-
2221
- echo '<form name="wpsc_delete" action="' . esc_url_raw( add_query_arg( 'tab', 'debug', $admin_url ) ) . '" method="post">';
2222
- wp_nonce_field('wp-cache');
2223
- echo "<input type='hidden' name='wpsc_delete_log' value='1' />";
2224
- submit_button( __( 'Delete', 'wp-super-cache' ), 'delete', 'wpsc_delete_log_form', false );
2225
- echo "</form>";
2226
-
2227
- echo '<form name="wpsc_delete" action="' . esc_url_raw( add_query_arg( 'tab', 'debug', $admin_url ) ) . '" method="post">';
2228
- if ( ! isset( $wp_super_cache_debug ) || $wp_super_cache_debug == 0 ) {
2229
- $debug_status_message = __( 'Enable Logging', 'wp-super-cache' );
2230
- $not_status = 1;
2231
- } else {
2232
- $debug_status_message = __( 'Disable Logging', 'wp-super-cache' );
2233
- $not_status = 0;
2234
- }
2235
- echo "<input type='hidden' name='wp_super_cache_debug' value='" . $not_status . "' />";
2236
- wp_nonce_field('wp-cache');
2237
- submit_button( $debug_status_message, 'primary', 'wpsc_log_status', true );
2238
- echo "</form>";
2239
-
2240
- echo '<form name="wp_cache_debug" action="' . esc_url_raw( add_query_arg( 'tab', 'debug', $admin_url ) ) . '" method="post">';
2241
- echo "<input type='hidden' name='wp_cache_debug' value='1' /><br />";
2242
- echo "<table class='form-table'>";
2243
- echo "<tr><th>" . __( 'IP Address', 'wp-super-cache' ) . "</th><td> <input type='text' size='20' name='wp_cache_debug_ip' value='{$wp_cache_debug_ip}' /> " . sprintf( __( '(only log requests from this IP address. Your IP is %s)', 'wp-super-cache' ), $_SERVER[ 'REMOTE_ADDR' ] ) . "</td></tr>";
2244
- echo "<tr><th valign='top'>" . __( 'Cache Status Messages', 'wp-super-cache' ) . "</th><td><input type='checkbox' name='wp_super_cache_comments' value='1' " . checked( 1, $wp_super_cache_comments, false ) . " /> " . __( 'enabled', 'wp-super-cache' ) . "<br />";
2245
- echo __( 'Display comments at the end of every page like this:', 'wp-super-cache' ) . "<br />";
2246
- echo "<pre>&lt;!-- Dynamic page generated in 0.450 seconds. -->
2247
- &lt;!-- Cached page generated by WP-Super-Cache on " . date( "Y-m-d H:i:s", time() ) . " -->
2248
- &lt;!-- super cache --></pre></td></tr>";
2249
- echo "</table>\n";
2250
- if ( isset( $wp_super_cache_advanced_debug ) ) {
2251
- echo "<h5>" . __( 'Advanced', 'wp-super-cache' ) . "</h5><p>" . __( 'In very rare cases two problems may arise on some blogs:<ol><li> The front page may start downloading as a zip file.</li><li> The wrong page is occasionally cached as the front page if your blog uses a static front page and the permalink structure is <em>/%category%/%postname%/</em>.</li></ol>', 'wp-super-cache' ) . '</p>';
2252
- echo "<p>" . __( 'I&#8217;m 99% certain that they aren&#8217;t bugs in WP Super Cache and they only happen in very rare cases but you can run a simple check once every 5 minutes to verify that your site is ok if you&#8217;re worried. You will be emailed if there is a problem.', 'wp-super-cache' ) . "</p>";
2253
- echo "<table class='form-table'>";
2254
- echo "<tr><td valign='top' colspan='2'><input type='checkbox' name='wp_super_cache_front_page_check' value='1' " . checked( 1, $wp_super_cache_front_page_check, false ) . " /> " . __( 'Check front page every 5 minutes.', 'wp-super-cache' ) . "</td></tr>";
2255
- echo "<tr><td valign='top'>" . __( 'Front page text', 'wp-super-cache' ) . "</td><td> <input type='text' size='30' name='wp_super_cache_front_page_text' value='{$wp_super_cache_front_page_text}' /> (" . __( 'Text to search for on your front page. If this text is missing, the cache will be cleared. Leave blank to disable.', 'wp-super-cache' ) . ")</td></tr>";
2256
- echo "<tr><td valign='top' colspan='2'><input type='checkbox' name='wp_super_cache_front_page_clear' value='1' " . checked( 1, $wp_super_cache_front_page_clear, false ) . " /> " . __( 'Clear cache on error.', 'wp-super-cache' ) . "</td></tr>";
2257
- echo "<tr><td valign='top' colspan='2'><input type='checkbox' name='wp_super_cache_front_page_notification' value='1' " . checked( 1, $wp_super_cache_front_page_notification, false ) . " /> " . __( 'Email the blog admin when checks are made. (useful for testing)', 'wp-super-cache' ) . "</td></tr>";
2258
-
2259
- echo "</table>\n";
2260
- }
2261
- echo '<div class="submit"><input class="button-primary" type="submit" ' . SUBMITDISABLED . 'value="' . __( 'Save Settings', 'wp-super-cache' ) . '" /></div>';
2262
- wp_nonce_field('wp-cache');
2263
- echo "</form>\n";
2264
- echo '</fieldset>';
2265
- }
2266
-
2267
  function wp_cache_enable() {
2268
  global $wp_cache_config_file, $cache_enabled;
2269
 
@@ -3952,8 +3286,10 @@ function wpsc_admin_bar_render( $wp_admin_bar ) {
3952
  return false;
3953
  }
3954
 
 
3955
  if ( ( is_singular() || is_archive() || is_front_page() || is_search() ) && current_user_can( 'delete_others_posts' ) ) {
3956
- $site_regex = preg_quote( rtrim( (string) parse_url( get_option( 'home' ), PHP_URL_PATH ), '/' ), '`' );
 
3957
  $req_uri = preg_replace( '/[ <>\'\"\r\n\t\(\)]/', '', $_SERVER[ 'REQUEST_URI' ] );
3958
  $path = preg_replace( '`^' . $site_regex . '`', '', $req_uri );
3959
 
@@ -3966,13 +3302,13 @@ function wpsc_admin_bar_render( $wp_admin_bar ) {
3966
  ) );
3967
  }
3968
 
3969
- if ( is_admin() && wpsupercache_site_admin() && current_user_can( 'manage_options' ) ) {
3970
  $wp_admin_bar->add_menu( array(
3971
  'parent' => '',
3972
  'id' => 'delete-cache',
3973
  'title' => __( 'Delete Cache', 'wp-super-cache' ),
3974
  'meta' => array( 'title' => __( 'Delete Super Cache cached files', 'wp-super-cache' ) ),
3975
- 'href' => wp_nonce_url( admin_url( 'options-general.php?page=wpsupercache&tab=contents&wp_delete_cache=1' ), 'wp-cache' )
3976
  ) );
3977
  }
3978
  }
@@ -4415,3 +3751,32 @@ function wpsc_update_check() {
4415
  }
4416
  }
4417
  add_action( 'admin_init', 'wpsc_update_check' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  Plugin Name: WP Super Cache
4
  Plugin URI: https://wordpress.org/plugins/wp-super-cache/
5
  Description: Very fast caching plugin for WordPress.
6
+ Version: 1.7.5
7
  Author: Automattic
8
  Author URI: https://automattic.com/
9
  License: GPL2+
45
 
46
  if ( !defined( 'WPCACHECONFIGPATH' ) ) {
47
  define( 'WPCACHECONFIGPATH', WP_CONTENT_DIR );
48
+ }
49
 
50
  $wp_cache_config_file = WPCACHECONFIGPATH . '/wp-cache-config.php';
51
 
512
  $path = $valid_nonce ? realpath( trailingslashit( get_supercache_dir() . str_replace( '..', '', preg_replace( '/:.*$/', '', $req_path ) ) ) ) : false;
513
 
514
  if ( $path ) {
515
+ if ( isset( $_GET['admin'] ) ) {
516
+ global $file_prefix;
517
+ wp_cache_clean_cache( $file_prefix );
518
+ wp_safe_redirect( admin_url( '/' ) );
519
+ exit;
520
+ }
521
  $path = trailingslashit( $path );
522
  $supercachepath = realpath( get_supercache_dir() );
523
 
530
  wpsc_delete_files( $path );
531
  }
532
 
533
+ if ( isset( $_GET['admin'] ) ) {
534
+ wp_safe_redirect( admin_url( '/' ) );
535
+ exit;
536
+ }
537
+
538
  if ( $referer && $req_path && ( false !== stripos( $referer, $req_path ) || 0 === stripos( $referer, wp_login_url() ) ) ) {
539
  wp_safe_redirect( esc_url_raw( home_url( $req_path ) ) );
540
  exit;
977
  wp_cache_files();
978
  break;
979
  case 'preload':
980
+ wpsc_render_partial(
981
+ 'preload',
982
+ compact(
983
+ 'cache_enabled',
984
+ 'super_cache_enabled',
985
+ 'admin_url',
986
+ 'wp_cache_preload_interval',
987
+ 'wp_cache_preload_on',
988
+ 'wp_cache_preload_taxonomies',
989
+ 'wp_cache_preload_email_me',
990
+ 'wp_cache_preload_email_volume',
991
+ 'wp_cache_preload_posts',
992
+ )
993
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
994
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
995
  break;
996
  case 'plugins':
997
  wpsc_plugins_tab();
998
  break;
999
  case 'debug':
1000
+ wpsc_render_partial(
1001
+ 'debug',
1002
+ compact( 'wp_super_cache_debug', 'wp_cache_debug_log', 'wp_cache_debug_ip', 'cache_path', 'valid_nonce', 'wp_cache_config_file', 'wp_super_cache_comments', 'wp_super_cache_front_page_check', 'wp_super_cache_front_page_clear', 'wp_super_cache_front_page_text', 'wp_super_cache_front_page_notification', 'wp_super_cache_advanced_debug', 'wp_cache_debug_username' )
1003
+ );
1004
  break;
1005
  case 'settings':
1006
+ global $cache_acceptable_files, $wpsc_rejected_cookies, $cache_rejected_uri, $wp_cache_pages;
1007
+ global $cache_max_time, $wp_cache_config_file, $valid_nonce, $super_cache_enabled, $cache_schedule_type, $cache_scheduled_time, $cache_schedule_interval, $cache_time_interval, $cache_gc_email_me, $wp_cache_preload_on;
1008
+
1009
+ wp_cache_update_rejected_pages();
1010
+ wp_cache_update_rejected_cookies();
1011
+ wp_cache_update_rejected_strings();
1012
+ wp_cache_update_accepted_strings();
1013
+ wp_cache_time_update();
1014
+
1015
+ wpsc_render_partial(
1016
+ 'advanced',
1017
+ compact(
1018
+ 'wp_cache_front_page_checks',
1019
+ 'admin_url',
1020
+ 'cache_enabled',
1021
+ 'super_cache_enabled',
1022
+ 'wp_cache_mod_rewrite',
1023
+ 'is_nginx',
1024
+ 'wp_cache_not_logged_in',
1025
+ 'wp_cache_no_cache_for_get',
1026
+ 'cache_compression',
1027
+ 'cache_rebuild_files',
1028
+ 'wpsc_save_headers',
1029
+ 'wp_supercache_304',
1030
+ 'wp_cache_make_known_anon',
1031
+ 'wp_cache_mfunc_enabled',
1032
+ 'wp_cache_mobile_enabled',
1033
+ 'wp_cache_mobile_browsers',
1034
+ 'wp_cache_disable_utf8',
1035
+ 'wp_cache_clear_on_post_edit',
1036
+ 'wp_cache_front_page_checks',
1037
+ 'wp_cache_refresh_single_only',
1038
+ 'wp_supercache_cache_list',
1039
+ 'wp_cache_mutex_disabled',
1040
+ 'wp_super_cache_late_init',
1041
+ 'cache_page_secret',
1042
+ 'cache_path',
1043
+ 'cache_acceptable_files',
1044
+ 'wpsc_rejected_cookies',
1045
+ 'cache_rejected_uri',
1046
+ 'wp_cache_pages',
1047
+ 'cache_max_time',
1048
+ 'valid_nonce',
1049
+ 'super_cache_enabled',
1050
+ 'cache_schedule_type',
1051
+ 'cache_scheduled_time',
1052
+ 'cache_schedule_interval',
1053
+ 'cache_time_interval',
1054
+ 'cache_gc_email_me',
1055
+ 'wp_cache_preload_on',
1056
+ )
1057
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1058
 
1059
  wpsc_edit_tracking_parameters();
1060
+ wpsc_edit_rejected_ua();
1061
+ wpsc_lockdown();
1062
+ wpsc_restore_settings();
 
 
 
1063
 
1064
  break;
1065
  case 'easy':
1066
  default:
1067
+ wpsc_render_partial(
1068
+ 'easy',
1069
+ array(
1070
+ 'admin_url' => $admin_url,
1071
+ 'cache_enabled' => $cache_enabled,
1072
+ 'is_nginx' => $is_nginx,
1073
+ 'wp_cache_mod_rewrite' => $wp_cache_mod_rewrite,
1074
+ 'valid_nonce' => $valid_nonce,
1075
+ 'wp_super_cache_comments' => $wp_super_cache_comments,
1076
+ )
1077
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1078
  break;
1079
  }
1080
  ?>
1181
  echo '</div></h3>';
1182
  }
1183
 
1184
+ function wpsc_restore_settings() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1185
  $admin_url = admin_url( 'options-general.php?page=wpsupercache' );
1186
+ wpsc_render_partial(
1187
+ 'restore',
1188
+ compact( 'admin_url' )
1189
+ );
 
 
 
1190
 
1191
  }
1192
 
1291
  return $cached_direct_pages;
1292
  }
1293
 
1294
+ function wpsc_lockdown() {
1295
  global $cached_direct_pages, $cache_enabled, $super_cache_enabled;
1296
 
1297
  $admin_url = admin_url( 'options-general.php?page=wpsupercache' );
1298
  $wp_lock_down = wp_update_lock_down();
1299
 
1300
+ wpsc_render_partial(
1301
+ 'lockdown',
1302
+ compact( 'cached_direct_pages', 'cache_enabled', 'super_cache_enabled', 'admin_url', 'wp_lock_down' )
1303
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1304
 
 
 
 
 
 
 
 
 
1305
  }
1306
 
1307
  function RecursiveFolderDelete ( $folderPath ) { // from http://www.php.net/manual/en/function.rmdir.php
1403
 
1404
  }
1405
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1406
  function wp_cache_sanitize_value($text, & $array) {
1407
  $text = esc_html(strip_tags($text));
1408
  $array = preg_split("/[\s,]+/", chop($text));
1427
  }
1428
  }
1429
 
1430
+ function wpsc_edit_rejected_ua() {
1431
+ global $cache_rejected_user_agent;
1432
 
1433
  if ( ! function_exists( 'apache_request_headers' ) ) {
1434
  return;
1436
 
1437
  $admin_url = admin_url( 'options-general.php?page=wpsupercache' );
1438
  wp_cache_update_rejected_ua();
1439
+ wpsc_render_partial(
1440
+ 'rejected_user_agents',
1441
+ compact( 'cache_rejected_user_agent', 'admin_url' )
1442
+ );
1443
 
 
 
 
 
 
 
 
 
 
 
 
 
1444
  }
1445
 
1446
  function wp_cache_update_rejected_pages() {
1460
  }
1461
  }
1462
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1463
  function wpsc_update_tracking_parameters() {
1464
  global $wpsc_tracking_parameters, $valid_nonce, $wp_cache_config_file;
1465
 
1483
  if ( ! isset( $wpsc_ignore_tracking_parameters ) ) {
1484
  $wpsc_ignore_tracking_parameters = 0;
1485
  }
1486
+ wpsc_render_partial(
1487
+ 'tracking_parameters',
1488
+ compact( 'wpsc_ignore_tracking_parameters', 'wpsc_tracking_parameters', 'admin_url' )
1489
+ );
 
 
 
 
 
 
 
 
 
1490
  }
1491
 
1492
  function wp_cache_update_rejected_cookies() {
1498
  }
1499
  }
1500
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1501
  function wp_cache_update_rejected_strings() {
1502
  global $cache_rejected_uri, $wp_cache_config_file, $valid_nonce;
1503
 
1508
 
1509
  }
1510
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1511
  function wp_cache_update_accepted_strings() {
1512
  global $cache_acceptable_files, $wp_cache_config_file, $valid_nonce;
1513
 
1517
  }
1518
  }
1519
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1520
  function wpsc_update_debug_settings() {
1521
  global $wp_super_cache_debug, $wp_cache_debug_log, $wp_cache_debug_ip, $cache_path, $valid_nonce, $wp_cache_config_file, $wp_super_cache_comments;
1522
  global $wp_super_cache_front_page_check, $wp_super_cache_front_page_clear, $wp_super_cache_front_page_text, $wp_super_cache_front_page_notification, $wp_super_cache_advanced_debug;
1598
  );
1599
  }
1600
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1601
  function wp_cache_enable() {
1602
  global $wp_cache_config_file, $cache_enabled;
1603
 
3286
  return false;
3287
  }
3288
 
3289
+ $path_to_home = rtrim( (string) parse_url( get_option( 'home' ), PHP_URL_PATH ), '/' );
3290
  if ( ( is_singular() || is_archive() || is_front_page() || is_search() ) && current_user_can( 'delete_others_posts' ) ) {
3291
+
3292
+ $site_regex = preg_quote( $path_to_home, '`' );
3293
  $req_uri = preg_replace( '/[ <>\'\"\r\n\t\(\)]/', '', $_SERVER[ 'REQUEST_URI' ] );
3294
  $path = preg_replace( '`^' . $site_regex . '`', '', $req_uri );
3295
 
3302
  ) );
3303
  }
3304
 
3305
+ if ( is_admin() && ( wpsupercache_site_admin() || current_user_can( 'delete_others_posts' ) ) ) {
3306
  $wp_admin_bar->add_menu( array(
3307
  'parent' => '',
3308
  'id' => 'delete-cache',
3309
  'title' => __( 'Delete Cache', 'wp-super-cache' ),
3310
  'meta' => array( 'title' => __( 'Delete Super Cache cached files', 'wp-super-cache' ) ),
3311
+ 'href' => wp_nonce_url( admin_url( 'index.php?admin=1&action=delcachepage&path=' . rawurlencode( trailingslashit( $path_to_home ) ) ), 'delete-cache' )
3312
  ) );
3313
  }
3314
  }
3751
  }
3752
  }
3753
  add_action( 'admin_init', 'wpsc_update_check' );
3754
+
3755
+ /**
3756
+ * Renders a partial/template.
3757
+ *
3758
+ * The global $current_user is made available for any rendered template.
3759
+ *
3760
+ * @param string $partial - Filename under ./partials directory, with or without .php (appended if absent).
3761
+ * @param array $page_vars - Variables made available for the template.
3762
+ */
3763
+ function wpsc_render_partial( $partial, array $page_vars = array() ) {
3764
+ if ( substr( $partial, -4 ) !== '.php' ) {
3765
+ $partial .= '.php';
3766
+ }
3767
+
3768
+ if ( strpos( $partial, 'partials/' ) !== 0 ) {
3769
+ $partial = 'partials/' . $partial;
3770
+ }
3771
+
3772
+ $path = __DIR__ . '/' . $partial;
3773
+ if ( ! file_exists( $path ) ) {
3774
+ return;
3775
+ }
3776
+
3777
+ foreach ( $page_vars as $key => $val ) {
3778
+ $$key = $val;
3779
+ }
3780
+ global $current_user;
3781
+ include $path;
3782
+ }