WP Super Cache - Version 1.6.4

Version Description

Download this release

Release Info

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

Code changes from version 1.6.3 to 1.6.4

Files changed (4) hide show
  1. readme.txt +11 -3
  2. wp-cache-base.php +7 -3
  3. wp-cache-phase2.php +37 -16
  4. wp-cache.php +119 -72
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  * Contributors: donncha, automattic, kraftbj
3
  * Tags: performance, caching, wp-cache, wp-super-cache, cache
4
  * Tested up to: 4.9.8
5
- * Stable tag: 1.6.3
6
- * Requires at least: 3.0
7
  * Requires PHP: 5.2.4
8
  * License: GPLv2 or later
9
  * License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -266,6 +266,14 @@ Your theme is probably responsive which means it resizes the page to suit whatev
266
 
267
  ## Changelog ##
268
 
 
 
 
 
 
 
 
 
269
  ### 1.6.3 ###
270
  * Changes between [1.6.2 and 1.6.3](https://github.com/Automattic/wp-super-cache/compare/1.6.2...1.6.3)
271
  * Added cookie helper functions (#580)
@@ -683,4 +691,4 @@ Your theme is probably responsive which means it resizes the page to suit whatev
683
 
684
 
685
  ## Upgrade Notice ##
686
- Bug fixes and new features
2
  * Contributors: donncha, automattic, kraftbj
3
  * Tags: performance, caching, wp-cache, wp-super-cache, cache
4
  * Tested up to: 4.9.8
5
+ * Stable tag: 1.6.4
6
+ * Requires at least: 3.1
7
  * Requires PHP: 5.2.4
8
  * License: GPLv2 or later
9
  * License URI: https://www.gnu.org/licenses/gpl-2.0.html
266
 
267
  ## Changelog ##
268
 
269
+ ### 1.6.4 ###
270
+ * Changes between [1.6.3 and 1.6.4](https://github.com/Automattic/wp-super-cache/compare/1.6.3...1.6.4)
271
+ * Fixes for WP-CLI (#587) (#592)
272
+ * Bumped the minimum WordPress version to 3.1 to use functions introduced then. (#591)
273
+ * Fixes to wpsc_post_transition to avoid a fatal error using get_sample_permalink. (#595)
274
+ * Fixed the admin bar "Delete Cache" link. (#589)
275
+ * Fixed the headings used in the settings page. (#597)
276
+
277
  ### 1.6.3 ###
278
  * Changes between [1.6.2 and 1.6.3](https://github.com/Automattic/wp-super-cache/compare/1.6.2...1.6.3)
279
  * Added cookie helper functions (#580)
691
 
692
 
693
  ## Upgrade Notice ##
694
+ Bug fixes
wp-cache-base.php CHANGED
@@ -1,9 +1,13 @@
1
  <?php
2
- if ( false == isset( $_SERVER['HTTP_HOST'] ) ) {
 
 
 
 
 
 
3
  $cache_enabled = false;
4
  $WPSC_HTTP_HOST = '';
5
- } else {
6
- $WPSC_HTTP_HOST = htmlentities( $_SERVER['HTTP_HOST'] );
7
  }
8
 
9
  // We want to be able to identify each blog in a WordPress MU install
1
  <?php
2
+ global $WPSC_HTTP_HOST, $blogcacheid;
3
+
4
+ if ( ! empty( $_SERVER['HTTP_HOST'] ) ) {
5
+ $WPSC_HTTP_HOST = htmlentities( $_SERVER['HTTP_HOST'] );
6
+ } elseif ( PHP_SAPI === 'cli' && function_exists( 'get_option' ) ) {
7
+ $WPSC_HTTP_HOST = (string) parse_url( get_option( 'home' ), PHP_URL_HOST );
8
+ } else {
9
  $cache_enabled = false;
10
  $WPSC_HTTP_HOST = '';
 
 
11
  }
12
 
13
  // We want to be able to identify each blog in a WordPress MU install
wp-cache-phase2.php CHANGED
@@ -711,9 +711,10 @@ function wpsc_delete_files( $dir, $delete = true ) {
711
  }
712
  }
713
 
 
714
  $dir = wpsc_get_realpath( $dir );
715
  if ( ! $dir ) {
716
- wp_cache_debug( 'wpsc_delete_files: directory does not exist: ' . $dir );
717
  return false;
718
  }
719
 
@@ -2717,34 +2718,45 @@ function wpsc_delete_cats_tags( $post ) {
2717
 
2718
  function wpsc_post_transition( $new_status, $old_status, $post ) {
2719
 
 
 
 
 
 
2720
  if ( $old_status === 'publish' && $new_status !== 'publish' ) { // post unpublished
2721
- list( $permalink, $post_name ) = get_sample_permalink( $post->ID );
2722
- $post_url = str_replace( array( '%pagename%', '%postname%' ), $post->post_name, $permalink );
 
 
 
2723
  }
2724
- elseif ( $new_status === 'publish' ) { // post published or updated
2725
- $post_url = get_permalink( $post->ID );
 
2726
  }
2727
 
2728
  if ( ! empty( $post_url ) ) {
2729
- wpsc_delete_post_archives( $post );
2730
- wpsc_delete_url_cache( $post_url );
2731
  wp_cache_debug( 'wpsc_post_transition: deleting cache of post: ' . $post_url );
 
 
2732
  }
2733
  }
2734
 
2735
  /* check if we want to clear out all cached files on post updates, otherwise call standard wp_cache_post_change() */
2736
- function wp_cache_post_edit($post_id) {
2737
  global $wp_cache_clear_on_post_edit, $cache_path, $blog_cache_dir, $wp_cache_object_cache;
2738
  static $last_post_edited = -1;
2739
 
2740
  if ( $post_id == $last_post_edited ) {
2741
- wp_cache_debug( "wp_cache_post_edit: Already processed post $post_id.", 4 );
 
2742
  return $post_id;
2743
  }
2744
 
2745
  $post = get_post( $post_id );
2746
- if ( is_object( $post ) == false )
2747
  return $post_id;
 
2748
 
2749
  // Some users are inexplicibly seeing this error on scheduled posts.
2750
  // define this constant to disable the post status check.
@@ -2764,7 +2776,8 @@ function wp_cache_post_edit($post_id) {
2764
  prune_super_cache( get_supercache_dir(), true );
2765
  }
2766
  } else {
2767
- wp_cache_debug( "wp_cache_post_edit: Clearing cache for post $post_id on post edit.", 2 );
 
2768
  wp_cache_post_change( $post_id );
2769
  wpsc_delete_post_archives( $post_id ); // delete related archive pages.
2770
  }
@@ -2808,7 +2821,8 @@ function wp_cache_post_change( $post_id ) {
2808
  static $last_processed = -1;
2809
 
2810
  if ( $post_id == $last_processed ) {
2811
- wp_cache_debug( "wp_cache_post_change: Already processed post $post_id.", 4 );
 
2812
  return $post_id;
2813
  }
2814
  $post = get_post( $post_id );
@@ -2866,10 +2880,17 @@ function wp_cache_post_change( $post_id ) {
2866
  if ( get_option( 'show_on_front' ) == 'page' ) {
2867
  wp_cache_debug( 'Post change: deleting page_on_front and page_for_posts pages.', 4 );
2868
  wp_cache_debug( 'Post change: page_on_front ' . get_option( 'page_on_front' ), 4 );
2869
- $permalink = trailingslashit( str_replace( get_option( 'home' ), '', get_permalink( get_option( 'page_for_posts' ) ) ) );
2870
- wp_cache_debug( 'Post change: Deleting files in: ' . str_replace( '//', '/', $dir . $permalink ) );
2871
- wpsc_rebuild_files( $dir . $permalink );
2872
- do_action( 'gc_cache', 'prune', $permalink );
 
 
 
 
 
 
 
2873
  }
2874
  } else {
2875
  wp_cache_debug( 'wp_cache_post_change: not deleting all pages.', 4 );
711
  }
712
  }
713
 
714
+ $orig_dir = $dir;
715
  $dir = wpsc_get_realpath( $dir );
716
  if ( ! $dir ) {
717
+ wp_cache_debug( 'wpsc_delete_files: directory does not exist: ' . $orig_dir );
718
  return false;
719
  }
720
 
2718
 
2719
  function wpsc_post_transition( $new_status, $old_status, $post ) {
2720
 
2721
+ $ptype = is_object( $post ) ? get_post_type_object( $post->post_type ) : null;
2722
+ if ( empty( $ptype ) || ! $ptype->public ) {
2723
+ return;
2724
+ }
2725
+
2726
  if ( $old_status === 'publish' && $new_status !== 'publish' ) { // post unpublished
2727
+ if ( ! function_exists( 'get_sample_permalink' ) ) {
2728
+ require_once( ABSPATH . 'wp-admin/includes/post.php' );
2729
+ }
2730
+ list( $permalink, $post_name ) = get_sample_permalink( $post );
2731
+ $post_url = str_replace( array( "%postname%", "%pagename%" ), $post->post_name, $permalink );
2732
  }
2733
+ elseif ( $old_status !== 'publish' && $new_status === 'publish' ) { // post published
2734
+ wp_cache_post_edit( $post->ID );
2735
+ return;
2736
  }
2737
 
2738
  if ( ! empty( $post_url ) ) {
 
 
2739
  wp_cache_debug( 'wpsc_post_transition: deleting cache of post: ' . $post_url );
2740
+ wpsc_delete_url_cache( $post_url );
2741
+ wpsc_delete_post_archives( $post );
2742
  }
2743
  }
2744
 
2745
  /* check if we want to clear out all cached files on post updates, otherwise call standard wp_cache_post_change() */
2746
+ function wp_cache_post_edit( $post_id ) {
2747
  global $wp_cache_clear_on_post_edit, $cache_path, $blog_cache_dir, $wp_cache_object_cache;
2748
  static $last_post_edited = -1;
2749
 
2750
  if ( $post_id == $last_post_edited ) {
2751
+ $action = current_filter();
2752
+ wp_cache_debug( "wp_cache_post_edit(${action}): Already processed post $post_id.", 4 );
2753
  return $post_id;
2754
  }
2755
 
2756
  $post = get_post( $post_id );
2757
+ if ( ! is_object( $post ) || 'auto-draft' === $post->post_status ) {
2758
  return $post_id;
2759
+ }
2760
 
2761
  // Some users are inexplicibly seeing this error on scheduled posts.
2762
  // define this constant to disable the post status check.
2776
  prune_super_cache( get_supercache_dir(), true );
2777
  }
2778
  } else {
2779
+ $action = current_filter();
2780
+ wp_cache_debug( "wp_cache_post_edit: Clearing cache for post $post_id on ${action}", 2 );
2781
  wp_cache_post_change( $post_id );
2782
  wpsc_delete_post_archives( $post_id ); // delete related archive pages.
2783
  }
2821
  static $last_processed = -1;
2822
 
2823
  if ( $post_id == $last_processed ) {
2824
+ $action = current_filter();
2825
+ wp_cache_debug( "wp_cache_post_change(${action}): Already processed post $post_id.", 4 );
2826
  return $post_id;
2827
  }
2828
  $post = get_post( $post_id );
2880
  if ( get_option( 'show_on_front' ) == 'page' ) {
2881
  wp_cache_debug( 'Post change: deleting page_on_front and page_for_posts pages.', 4 );
2882
  wp_cache_debug( 'Post change: page_on_front ' . get_option( 'page_on_front' ), 4 );
2883
+ /**
2884
+ * It's possible that page_for_posts is zero.
2885
+ * Quick fix to reduce issues in debugging.
2886
+ */
2887
+ wp_cache_debug( 'Post change: page_for_posts ' . get_option( 'page_for_posts' ), 4 );
2888
+ if ( get_option( 'page_for_posts' ) ) {
2889
+ $permalink = trailingslashit( str_replace( get_option( 'home' ), '', get_permalink( get_option( 'page_for_posts' ) ) ) );
2890
+ wp_cache_debug( 'Post change: Deleting files in: ' . str_replace( '//', '/', $dir . $permalink ) );
2891
+ wpsc_rebuild_files( $dir . $permalink );
2892
+ do_action( 'gc_cache', 'prune', $permalink );
2893
+ }
2894
  }
2895
  } else {
2896
  wp_cache_debug( 'wp_cache_post_change: not deleting all pages.', 4 );
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.6.3
7
  Author: Automattic
8
  Author URI: https://automattic.com/
9
  License: GPL2+
@@ -65,10 +65,22 @@ wpsc_init();
65
  * WP-CLI requires explicit declaration of global variables.
66
  * It's minimal list of global variables.
67
  */
68
- global $super_cache_enabled, $cache_enabled, $wp_cache_home_path, $cache_path;
69
- global $wp_cache_mutex_disabled, $mutex_filename, $sem_id;
 
 
 
 
 
 
 
70
  global $wp_cache_config_file, $wp_cache_config_file_sample;
71
 
 
 
 
 
 
72
  if( !@include($wp_cache_config_file) ) {
73
  get_wpcachehome();
74
  $wp_cache_config_file_sample = WPCACHEHOME . 'wp-cache-config-sample.php';
@@ -225,7 +237,7 @@ function wp_cache_manager_error_checks() {
225
  return false;
226
 
227
  if ( version_compare( PHP_VERSION, '5.3.0', '<' ) && ( 1 == ini_get( 'safe_mode' ) || "on" == strtolower( ini_get( 'safe_mode' ) ) ) ) {
228
- echo '<div class="notice notice-error"><h3>' . __( 'Warning! PHP Safe Mode Enabled!', 'wp-super-cache' ) . '</h3><p>' .
229
  __( 'You may experience problems running this plugin because SAFE MODE is enabled.', 'wp-super-cache' ) . '<br />';
230
 
231
 
@@ -239,7 +251,7 @@ function wp_cache_manager_error_checks() {
239
  }
240
 
241
  if ( '' == get_option( 'permalink_structure' ) ) {
242
- echo '<div class="notice notice-error"><h3>' . __( 'Permlink Structure Error', 'wp-super-cache' ) . '</h3>';
243
  echo "<p>" . __( 'A custom url or permalink structure is required for this plugin to work correctly. Please go to the <a href="options-permalink.php">Permalinks Options Page</a> to configure your permalinks.', 'wp-super-cache' ) . "</p>";
244
  echo '</div>';
245
  return false;
@@ -248,7 +260,7 @@ function wp_cache_manager_error_checks() {
248
  if ( $wp_cache_debug || ! $wp_cache_cron_check ) {
249
  if ( defined( 'DISABLE_WP_CRON' ) && constant( 'DISABLE_WP_CRON' ) ) {
250
  ?>
251
- <div class="notice notice-error"><h3><?php _e( 'CRON System Disabled', 'wp-super-cache' ); ?></h3>
252
  <p><?php _e( 'The WordPress CRON jobs system is disabled. This means the garbage collection system will not work unless you run the CRON system manually.', 'wp-super-cache' ); ?></p>
253
  </div>
254
  <?php
@@ -258,7 +270,7 @@ function wp_cache_manager_error_checks() {
258
  $hostname = substr( $hostname, 0, strpos( $hostname, '/' ) );
259
  $ip = gethostbyname( $hostname );
260
  if( substr( $ip, 0, 3 ) == '127' || substr( $ip, 0, 7 ) == '192.168' ) {
261
- ?><div class="notice notice-warning"><h3><?php printf( __( 'Warning! Your hostname "%s" resolves to %s', 'wp-super-cache' ), $hostname, $ip ); ?></h3>
262
  <p><?php printf( __( 'Your server thinks your hostname resolves to %s. Some services such as garbage collection by this plugin, and WordPress scheduled posts may not operate correctly.', 'wp-super-cache' ), $ip ); ?></p>
263
  <p><?php printf( __( 'Please see entry 16 in the <a href="%s">Troubleshooting section</a> of the readme.txt', 'wp-super-cache' ), 'https://wordpress.org/plugins/wp-super-cache/faq/' ); ?></p>
264
  </div>
@@ -272,7 +284,7 @@ function wp_cache_manager_error_checks() {
272
  $cron = wp_remote_get($cron_url, array('timeout' => 0.01, 'blocking' => true));
273
  if( is_array( $cron ) ) {
274
  if( $cron[ 'response' ][ 'code' ] == '404' ) {
275
- ?><div class="notice notice-error"><h3>Warning! wp-cron.php not found!</h3>
276
  <p><?php _e( 'Unfortunately, WordPress cannot find the file wp-cron.php. This script is required for the correct operation of garbage collection by this plugin, WordPress scheduled posts as well as other critical activities.', 'wp-super-cache' ); ?></p>
277
  <p><?php printf( __( 'Please see entry 16 in the <a href="%s">Troubleshooting section</a> of the readme.txt', 'wp-super-cache' ), 'https://wordpress.org/plugins/wp-super-cache/faq/' ); ?></p>
278
  </div>
@@ -303,7 +315,7 @@ function wp_cache_manager_error_checks() {
303
  }
304
 
305
  if ( 1 == ini_get( 'zlib.output_compression' ) || "on" == strtolower( ini_get( 'zlib.output_compression' ) ) ) {
306
- ?><div class="notice notice-warning"><h3><?php _e( 'Zlib Output Compression Enabled!', 'wp-super-cache' ); ?></h3>
307
  <p><?php _e( 'PHP is compressing the data sent to the visitors of your site. Disabling this is recommended as the plugin caches the compressed output once instead of compressing the same page over and over again. Also see #21 in the Troubleshooting section. See <a href="http://php.net/manual/en/zlib.configuration.php">this page</a> for instructions on modifying your php.ini.', 'wp-super-cache' ); ?></p></div><?php
308
  }
309
 
@@ -314,14 +326,14 @@ function wp_cache_manager_error_checks() {
314
  ! got_mod_rewrite() &&
315
  ! $is_nginx
316
  ) {
317
- ?><div class="notice notice-warning"><h3><?php _e( 'Mod rewrite may not be installed!', 'wp-super-cache' ); ?></h3>
318
  <p><?php _e( 'It appears that mod_rewrite is not installed. Sometimes this check isn&#8217;t 100% reliable, especially if you are not using Apache. Please verify that the mod_rewrite module is loaded. It is required for serving Super Cache static files in expert mode. You will still be able to simple mode.', 'wp-super-cache' ); ?></p></div><?php
319
  }
320
 
321
  if( !is_writeable_ACLSafe( $wp_cache_config_file ) ) {
322
  if ( !defined( 'SUBMITDISABLED' ) )
323
  define( "SUBMITDISABLED", 'disabled style="color: #aaa" ' );
324
- ?><div class="notice notice-error"><h3><?php _e( 'Read Only Mode. Configuration cannot be changed.', 'wp-super-cache' ); ?></h3>
325
  <p><?php printf( __( 'The WP Super Cache configuration file is <code>%s/wp-cache-config.php</code> and cannot be modified. That file must be writeable by the web server to make any changes.', 'wp-super-cache' ), WP_CONTENT_DIR ); ?>
326
  <?php _e( 'A simple way of doing that is by changing the permissions temporarily using the CHMOD command or through your ftp client. Make sure it&#8217;s globally writeable and it should be fine.', 'wp-super-cache' ); ?></p>
327
  <p><?php _e( '<a href="https://codex.wordpress.org/Changing_File_Permissions">This page</a> explains how to change file permissions.', 'wp-super-cache' ); ?></p>
@@ -344,7 +356,7 @@ function wp_cache_manager_error_checks() {
344
  $gc_flag = get_gc_flag();
345
  if ( $dismiss_gc_warning == 0 ) {
346
  if ( false == maybe_stop_gc( $gc_flag ) && false == wp_next_scheduled( 'wp_cache_gc' ) ) {
347
- ?><div class="notice notice-warning"><h3><?php _e( 'Warning! Garbage collection is not scheduled!', 'wp-super-cache' ); ?></h3>
348
  <p><?php _e( 'Garbage collection by this plugin clears out expired and old cached pages on a regular basis. Use <a href="#expirytime">this form</a> to enable it.', 'wp-super-cache' ); ?> </p>
349
  <form action="" method="POST">
350
  <input type="hidden" name="action" value="dismiss_gc_warning" />
@@ -371,7 +383,7 @@ function wp_cache_manager_error_checks() {
371
  $wp_content_stat = stat(WP_CONTENT_DIR . '/');
372
  $wp_content_mode = decoct( $wp_content_stat[ 'mode' ] & 0777 );
373
  if( substr( $wp_content_mode, -2 ) == '77' ) {
374
- ?><div class="notice notice-warning"><h3><?php printf( __( 'Warning! %s is writeable!', 'wp-super-cache' ), WP_CONTENT_DIR ); ?></h3>
375
  <p><?php printf( __( 'You should change the permissions on %s and make it more restrictive. Use your ftp client, or the following command to fix things:', 'wp-super-cache' ), WP_CONTENT_DIR ); ?> <code>chmod 755 <?php echo WP_CONTENT_DIR; ?>/</code></p>
376
  <p><?php _e( '<a href="https://codex.wordpress.org/Changing_File_Permissions">This page</a> explains how to change file permissions.', 'wp-super-cache' ); ?></p>
377
  <form action="" method="POST">
@@ -394,14 +406,14 @@ function wp_cache_manager_error_checks() {
394
  }
395
  $scrules = implode( "\n", extract_from_markers( $home_path.'.htaccess', 'WPSuperCache' ) );
396
  if ( $cache_enabled && $wp_cache_mod_rewrite && !$wp_cache_mobile_enabled && strpos( $scrules, addcslashes( str_replace( ', ', '|', $wp_cache_mobile_browsers ), ' ' ) ) ) {
397
- echo '<div class="notice notice-warning"><h3>' . __( 'Mobile rewrite rules detected', 'wp-super-cache' ) . "</h3>";
398
  echo "<p>" . __( 'For best performance you should enable "Mobile device support" or delete the mobile rewrite rules in your .htaccess. Look for the 2 lines with the text "2.0\ MMP|240x320" and delete those.', 'wp-super-cache' ) . "</p><p>" . __( 'This will have no affect on ordinary users but mobile users will see uncached pages.', 'wp-super-cache' ) . "</p></div>";
399
  } elseif ( $wp_cache_mod_rewrite && $cache_enabled && $wp_cache_mobile_enabled && $scrules != '' && (
400
  ( '' != $wp_cache_mobile_prefixes && false === strpos( $scrules, addcslashes( str_replace( ', ', '|', $wp_cache_mobile_prefixes ), ' ' ) ) ) ||
401
  ( '' != $wp_cache_mobile_browsers && false === strpos( $scrules, addcslashes( str_replace( ', ', '|', $wp_cache_mobile_browsers ), ' ' ) ) ) )
402
  ) {
403
  ?>
404
- <div class="notice notice-warning"><h3><?php _e( 'Rewrite rules must be updated', 'wp-super-cache' ); ?></h3>
405
  <p><?php _e( 'The rewrite rules required by this plugin have changed or are missing. ', 'wp-super-cache' ); ?>
406
  <?php _e( 'Mobile support requires extra rules in your .htaccess file, or you can set the plugin to simple mode. Here are your options (in order of difficulty):', 'wp-super-cache' ); ?>
407
  <ol><li> <?php _e( 'Set the plugin to simple mode and enable mobile support.', 'wp-super-cache' ); ?></li>
@@ -412,7 +424,7 @@ function wp_cache_manager_error_checks() {
412
  }
413
 
414
  if ( $cache_enabled && $super_cache_enabled && $wp_cache_mod_rewrite && $scrules == '' ) {
415
- ?><div class='notice notice-warning'><h3><?php _e( 'Rewrite rules must be updated', 'wp-super-cache' ); ?></h3>
416
  <p><?php _e( 'The rewrite rules required by this plugin have changed or are missing. ', 'wp-super-cache' ); ?>
417
  <?php _e( 'Scroll down the Advanced Settings page and click the <strong>Update Mod_Rewrite Rules</strong> button.', 'wp-super-cache' ); ?></p></div><?php
418
  }
@@ -427,7 +439,7 @@ function wp_cache_manager_error_checks() {
427
  }
428
  }
429
  if( isset( $missing_mods) && is_array( $missing_mods ) ) {
430
- ?><div class='notice notice-warning'><h3><?php _e( 'Missing Apache Modules', 'wp-super-cache' ); ?></h3>
431
  <p><?php __( 'The following Apache modules are missing. The plugin will work in simple mode without them but in expert mode, your visitors may see corrupted pages or out of date content however.', 'wp-super-cache' ); ?></p><?php
432
  echo "<ul>";
433
  foreach( $missing_mods as $req => $desc ) {
@@ -447,7 +459,7 @@ function wp_cache_manager_error_checks() {
447
  if ( isset( $disable_supercache_htaccess_warning ) == false )
448
  $disable_supercache_htaccess_warning = false;
449
  if ( ! $is_nginx && $dismiss_htaccess_warning == 0 && $wp_cache_mod_rewrite && $super_cache_enabled && $disable_supercache_htaccess_warning == false && get_option( 'siteurl' ) != get_option( 'home' ) ) {
450
- ?><div class="notice notice-info"><h3><?php _e( '.htaccess file may need to be moved', 'wp-super-cache' ); ?></h3>
451
  <p><?php _e( 'It appears you have WordPress installed in a sub directory as described <a href="https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">here</a>. Unfortunately, WordPress writes to the .htaccess in the install directory, not where your site is served from.<br />When you update the rewrite rules in this plugin you will have to copy the file to where your site is hosted. This will be fixed in the future.', 'wp-super-cache' ); ?></p>
452
  <form action="" method="POST">
453
  <input type="hidden" name="action" value="dismiss_htaccess_warning" />
@@ -480,7 +492,7 @@ function admin_bar_delete_page() {
480
  $path = $valid_nonce ? realpath( trailingslashit( get_supercache_dir() . str_replace( '..', '', preg_replace( '/:.*$/', '', $req_path ) ) ) ) : false;
481
 
482
  if ( $path ) {
483
- $path .= '/';
484
  $supercachepath = realpath( get_supercache_dir() );
485
 
486
  if ( false == wp_cache_confirm_delete( $path ) || substr( $path, 0, strlen( $supercachepath ) ) != $supercachepath ) {
@@ -491,7 +503,7 @@ function admin_bar_delete_page() {
491
  }
492
 
493
  if ( $referer && $req_path && ( false !== stripos( $referer, $req_path ) || 0 === stripos( $referer, wp_login_url() ) ) ) {
494
- wp_redirect( preg_replace( '/[ <>\'\"\r\n\t\(\)]/', '', $req_path ) );
495
  exit;
496
  }
497
  }
@@ -816,17 +828,17 @@ function toggleLayer( whichLayer ) {
816
  // -->
817
  //Clicking header opens fieldset options
818
  jQuery(document).ready(function(){
819
- jQuery("fieldset h3").css("cursor","pointer").click(function(){
820
  jQuery(this).parent("fieldset").find("p,form,ul,blockquote").toggle("slow");
821
  });
822
  });
823
  </script>
824
 
825
  <style type='text/css'>
826
- #nav h2 {
827
  border-bottom: 1px solid #ccc;
828
  padding-bottom: 0;
829
- height: 2em;
830
  }
831
  table.wpsc-settings-table {
832
  clear: both;
@@ -835,7 +847,7 @@ table.wpsc-settings-table {
835
  <?php
836
  echo '<a name="top"></a>';
837
  echo '<div class="wrap">';
838
- echo '<h2>' . __( 'WP Super Cache Settings', 'wp-super-cache' ) . '</h2>';
839
 
840
  // set a default
841
  if ( $cache_enabled == false && isset( $wp_cache_mod_rewrite ) == false ) {
@@ -881,7 +893,7 @@ table.wpsc-settings-table {
881
  $msg .="<p>" . sprintf( __( "<strong>Page last cached:</strong> %s", 'wp-super-cache' ), $url ) . "</p>";
882
  }
883
  if ( $msg != '' ) {
884
- echo '<div class="notice notice-warning"><h3>' . __( 'Preload Active', 'wp-super-cache' ) . '</h3>' . $msg;
885
  echo '<form name="do_preload" action="" method="POST">';
886
  echo '<input type="hidden" name="action" value="preload" />';
887
  echo '<input type="hidden" name="page" value="wpsupercache" />';
@@ -1101,7 +1113,7 @@ table.wpsc-settings-table {
1101
  <label><input type='checkbox' name='wp_cache_mfunc_enabled' <?php if( $wp_cache_mfunc_enabled ) echo "checked"; ?> value='1' <?php if ( $wp_cache_mod_rewrite ) { echo "disabled='disabled'"; } ?>> <?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 />
1102
  <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 />
1103
  <?php if ( $wp_cache_mobile_enabled ) {
1104
- echo '<blockquote><h4>' . __( 'Mobile Browsers', 'wp-super-cache' ) . '</h4>' . esc_html( $wp_cache_mobile_browsers ) . "<br /><h4>" . __( 'Mobile Prefixes', 'wp-super-cache' ) . "</h4>" . esc_html( $wp_cache_mobile_prefixes ) . "<br /></blockquote>";
1105
  } ?>
1106
  <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 />
1107
  <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 />
@@ -1150,7 +1162,7 @@ table.wpsc-settings-table {
1150
  </td>
1151
  </tr>
1152
  </table>
1153
- <h3><?php _e( 'Note:', 'wp-super-cache' ); ?></h3>
1154
  <ol>
1155
  <li><?php _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>
1156
  <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' ), WP_CONTENT_DIR ); ?></li>
@@ -1165,7 +1177,7 @@ table.wpsc-settings-table {
1165
 
1166
  wp_cache_edit_max_time();
1167
 
1168
- echo '<a name="files"></a><fieldset class="options"><h3>' . __( 'Accepted Filenames &amp; Rejected URIs', 'wp-super-cache' ) . '</h3>';
1169
  wp_cache_edit_rejected_pages();
1170
  echo "\n";
1171
  wp_cache_edit_rejected();
@@ -1205,7 +1217,7 @@ table.wpsc-settings-table {
1205
  }
1206
  echo "<div class='submit'><input class='button-primary' type='submit' " . SUBMITDISABLED . " value='" . __( 'Update Status', 'wp-super-cache' ) . "' /></div></form>";
1207
  if ( $cache_enabled ) {
1208
- echo "<h3>" . __( 'Cache Tester', 'wp-super-cache' ) . "</h3>";
1209
  echo '<p>' . __( 'Test your cached website by clicking the test button below.', 'wp-super-cache' ) . '</p>';
1210
  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>';
1211
  if ( array_key_exists('action', $_POST) && $_POST[ 'action' ] == 'test' && $valid_nonce ) {
@@ -1276,7 +1288,7 @@ table.wpsc-settings-table {
1276
  wp_nonce_field('wp-cache');
1277
  echo '</form>';
1278
  }
1279
- echo "<h3>" . __( "Delete Cached Pages", 'wp-super-cache' ) . "</h3>";
1280
  echo "<p>" . __( "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>";
1281
  echo '<form name="wp_cache_content_delete" action="?page=wpsupercache&tab=contents" method="post">';
1282
  echo '<input type="hidden" name="wp_delete_cache" />';
@@ -1292,7 +1304,7 @@ table.wpsc-settings-table {
1292
  echo "</form><br />\n";
1293
  }
1294
  ?>
1295
- <h3 class="clear"><?php _e( 'Recommended Links and Plugins', 'wp-super-cache' ); ?></h3>
1296
  <p><?php _e( 'Caching is only one part of making a website faster. Here are some other plugins that will help:', 'wp-super-cache' ); ?></p>
1297
  <ul style="list-style: square; margin-left: 2em;">
1298
  <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>
@@ -1310,19 +1322,19 @@ table.wpsc-settings-table {
1310
  </fieldset>
1311
  </td><td valign='top' style='width: 300px'>
1312
  <div style='background: #ffc; border: 1px solid #333; margin: 2px; padding: 3px 15px'>
1313
- <h3><?php _e( 'More Site Speed Tools', 'wp-super-cache' ); ?></h3>
1314
  <ul style="list-style: square; margin-left: 2em;">
1315
  <li><a href="https://jetpack.com/redirect/?source=jitm-wpsc-generic"><?php _e( 'Speed up images and photos (free)', 'wp-super-cache' ); ?></a></li>
1316
  <li><a href="https://jetpack.com/redirect/?source=jitm-wpsc-premium"><?php _e( 'Fast video hosting (paid)', 'wp-super-cache' ); ?></a></li>
1317
  </ul>
1318
- <h3><?php _e( 'Need Help?', 'wp-super-cache' ); ?></h3>
1319
  <ol>
1320
  <li><?php printf( __( 'Use the <a href="%1$s">Debug tab</a> for diagnostics.', 'wp-super-cache' ), admin_url( 'options-general.php?page=wpsupercache&tab=debug' ) ); ?></li>
1321
  <li><?php printf( __( 'Check out the <a href="%1$s">support forum</a> and <a href="%2$s">FAQ</a>.', 'wp-super-cache' ), 'https://wordpress.org/support/plugin/wp-super-cache', 'https://wordpress.org/plugins/wp-super-cache/#faq' ); ?></li>
1322
  <li><?php printf( __( 'Visit the <a href="%1$s">plugin homepage</a>.', 'wp-super-cache' ), 'https://wordpress.org/plugins/wp-super-cache/' ); ?></li>
1323
  <li><?php printf( __( 'Try out the <a href="%1$s">development version</a> for the latest fixes (<a href="%2$s">changelog</a>).', 'wp-super-cache' ), 'https://odd.blog/y/2o', 'https://plugins.trac.wordpress.org/log/wp-super-cache/' ); ?></li>
1324
  </ol>
1325
- <h3><?php _e( 'Rate This Plugin', 'wp-super-cache' ); ?></h3>
1326
  <p><?php printf( __( 'Please <a href="%s">rate us</a> and give feedback.', 'wp-super-cache' ), 'https://wordpress.org/support/plugin/wp-super-cache/reviews?rate=5#new-post' ); ?></p>
1327
 
1328
  <?php
@@ -1368,7 +1380,7 @@ function wpsc_plugins_tab() {
1368
  $out = ob_get_contents();
1369
  ob_end_clean();
1370
  if( SUBMITDISABLED == ' ' && $out != '' ) {
1371
- echo '<h3>' . __( 'Available Plugins', 'wp-super-cache' ) . '</h3>';
1372
  echo "<ol>";
1373
  echo $out;
1374
  echo "</ol>";
@@ -1395,9 +1407,9 @@ function wpsc_admin_tabs( $current = 0 ) {
1395
  }
1396
  }
1397
  if ( $wp_db_version >= 15477 ) {
1398
- echo '<div id="nav"><h2 class="themes-php">';
1399
  echo implode( "", $links );
1400
- echo '</div></h2>';
1401
  } else {
1402
  echo implode( " | ", $links );
1403
  }
@@ -1420,7 +1432,7 @@ function wsc_mod_rewrite() {
1420
 
1421
  ?>
1422
  <a name="modrewrite"></a><fieldset class="options">
1423
- <h3><?php _e( 'Mod Rewrite Rules', 'wp-super-cache' ); ?></h3>
1424
  <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>
1425
 
1426
  <?php
@@ -1439,11 +1451,11 @@ function wsc_mod_rewrite() {
1439
  }
1440
  } elseif ( $valid_nonce && isset( $_POST[ 'updatehtaccess' ] ) ) {
1441
  if ( add_mod_rewrite_rules() ) {
1442
- echo "<h4>" . __( 'Mod Rewrite rules updated!', 'wp-super-cache' ) . "</h4>";
1443
  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";
1444
  } else {
1445
  global $update_mod_rewrite_rules_error;
1446
- echo "<h4>" . __( 'Mod Rewrite rules must be updated!', 'wp-super-cache' ) . "</h4>";
1447
  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";
1448
  }
1449
  echo "<div style='overflow: auto; width: 800px; height: 400px; padding:0 8px;color:#4f8a10;background-color:#dff2bf;border:1px solid #4f8a10;'>";
@@ -1470,7 +1482,7 @@ function wsc_mod_rewrite() {
1470
  }
1471
 
1472
  function wp_cache_restore() {
1473
- echo '<fieldset class="options"><h3>' . __( 'Fix Configuration', 'wp-super-cache' ) . '</h3>';
1474
  echo '<form name="wp_restore" action="#top" method="post">';
1475
  echo '<input type="hidden" name="wp_restore_config" />';
1476
  echo '<div class="submit"><input class="button-secondary" type="submit" ' . SUBMITDISABLED . 'id="deletepost" value="' . __( 'Restore Default Configuration', 'wp-super-cache' ) . '" /></div>';
@@ -1588,7 +1600,7 @@ function wp_lock_down() {
1588
 
1589
  ?><a name='lockdown'></a>
1590
  <fieldset class="options">
1591
- <h3><?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>'; ?></h3>
1592
  <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>
1593
  <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' ); ?>
1594
  <blockquote><code>if( defined( 'WPLOCKDOWN' ) && constant( 'WPLOCKDOWN' ) ) {
@@ -1612,7 +1624,7 @@ function wp_lock_down() {
1612
  if( $cache_enabled == true && $super_cache_enabled == true ) {
1613
  ?><a name='direct'></a>
1614
  <fieldset class="options">
1615
- <h3><?php _e( 'Directly Cached Files', 'wp-super-cache' ); ?></h3><?php
1616
 
1617
  $cached_direct_pages = wpsc_update_direct_pages();
1618
 
@@ -1763,7 +1775,7 @@ function wp_cache_edit_max_time() {
1763
 
1764
  ?><fieldset class="options">
1765
  <a name='expirytime'></a>
1766
- <h3><?php _e( 'Expiry Time &amp; Garbage Collection', 'wp-super-cache' ); ?></h3><?php
1767
 
1768
  ?><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
1769
  $current_offset = get_option('gmt_offset');
@@ -1811,7 +1823,7 @@ function wp_cache_edit_max_time() {
1811
  echo '<tr><td><label for="cache_gc_email_me"><strong>' . __( 'Notification Emails', 'wp-super-cache' ) . '</strong></label></td>';
1812
  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";
1813
  echo "</table>\n";
1814
- echo "<h4>" . __( 'Garbage Collection', 'wp-super-cache' ) . "</h4>";
1815
  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";
1816
  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";
1817
  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";
@@ -1865,7 +1877,7 @@ function wp_cache_edit_rejected_ua() {
1865
 
1866
  wp_cache_update_rejected_ua();
1867
 
1868
- echo '<a name="useragents"></a><fieldset class="options"><h3>' . __( 'Rejected User Agents', 'wp-super-cache' ) . '</h3>';
1869
  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";
1870
  echo '<form name="wp_edit_rejected_user_agent" action="#useragents" method="post">';
1871
  echo '<textarea name="wp_rejected_user_agent" cols="40" rows="4" style="width: 50%; font-size: 12px;" class="code">';
@@ -2108,7 +2120,7 @@ function wp_cache_debug_settings() {
2108
  &lt;!-- super cache --></pre></td></tr>";
2109
  echo "</table>\n";
2110
  if ( isset( $wp_super_cache_advanced_debug ) ) {
2111
- echo "<h4>" . __( 'Advanced', 'wp-super-cache' ) . "</h4><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>';
2112
  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>";
2113
  echo "<table class='form-table'>";
2114
  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>";
@@ -2261,13 +2273,13 @@ function wp_cache_index_notice() {
2261
  if ( get_site_option( 'wp_super_cache_index_detected' ) == 2 ) {
2262
  update_site_option( 'wp_super_cache_index_detected', 3 );
2263
  echo "<div class='error' style='padding: 10px 10px 50px 10px'>";
2264
- echo "<h1>" . __( 'WP Super Cache Warning!', 'wp-super-cache' ) . '</h1>';
2265
  echo '<p>' . __( 'All users of this site have been logged out to refresh their login cookies.', 'wp-super-cache' ) . '</p>';
2266
  echo '</div>';
2267
  return false;
2268
  } elseif ( get_site_option( 'wp_super_cache_index_detected' ) != 3 ) {
2269
  echo "<div id='wpsc-index-warning' class='error notice' style='padding: 10px 10px 50px 10px'>";
2270
- echo "<h1>" . __( 'WP Super Cache Warning!', 'wp-super-cache' ) . '</h1>';
2271
  echo '<p>' . __( 'Your server is configured to show files and directories, which may expose sensitive data such as login cookies to attackers in the cache directories. That has been fixed by adding a file named index.html to each directory. If you use simple caching, consider moving the location of the cache directory on the Advanced Settings page.', 'wp-super-cache' ) . '</p>';
2272
  echo "<p><strong>";
2273
  _e( 'If you just installed WP Super Cache for the first time, you can dismiss this message. Otherwise, you should probably refresh the login cookies of all logged in WordPress users here by clicking the logout link below.', 'wp-super-cache' );
@@ -2501,12 +2513,12 @@ function wp_cache_create_advanced_cache() {
2501
  $line = 'define( \'WPCACHEHOME\', \'' . dirname( __FILE__ ) . '/\' );';
2502
 
2503
  if ( ! apply_filters( 'wpsc_enable_wp_config_edit', true ) ) {
2504
- echo '<div class="notice notice-error"><h3>' . __( 'Warning', 'wp-super-cache' ) . "! " . sprintf( __( 'Not allowed to edit %s per configuration.', 'wp-super-cache' ), $global_config_file ) . "</h3></div>";
2505
  return false;
2506
  }
2507
 
2508
  if ( !is_writeable_ACLSafe($global_config_file) || !wp_cache_replace_line('define *\( *\'WPCACHEHOME\'', $line, $global_config_file ) ) {
2509
- echo '<div class="notice notice-error"><h3>' . __( 'Warning', 'wp-super-cache' ) . "! <em>" . sprintf( __( 'Could not update %s!</em> WPCACHEHOME must be set in config file.', 'wp-super-cache' ), $global_config_file ) . "</h3></div>";
2510
  return false;
2511
  }
2512
  $ret = true;
@@ -2542,7 +2554,7 @@ function wp_cache_check_link() {
2542
  }
2543
 
2544
  if( false == $ret ) {
2545
- echo '<div class="notice notice-error"><h3>' . __( 'Warning', 'wp-super-cache' ) . "! <em>" . sprintf( __( '%s/advanced-cache.php</em> does not exist or cannot be updated.', 'wp-super-cache' ), WP_CONTENT_DIR ) . "</h3>";
2546
  echo "<p><ol><li>" . __( 'If it already exists, please delete the file first.', 'wp-super-cache' ) . "</li>";
2547
  echo "<li>" . sprintf( __( 'Make %1$s writable using the chmod command through your ftp or server software. (<em>chmod 777 %1$s</em>) and refresh this page. This is only a temporary measure and you&#8217;ll have to make it read only afterwards again. (Change 777 to 755 in the previous command)', 'wp-super-cache' ), WP_CONTENT_DIR ) . "</li>";
2548
  echo "<li>" . sprintf( __( 'Refresh this page to update <em>%s/advanced-cache.php</em>', 'wp-super-cache' ), WP_CONTENT_DIR ) . "</li></ol>";
@@ -2571,14 +2583,14 @@ function wp_cache_check_global_config() {
2571
  $line = 'define(\'WP_CACHE\', true);';
2572
  if (!is_writeable_ACLSafe($global) || !wp_cache_replace_line('define *\( *\'WP_CACHE\'', $line, $global) ) {
2573
  if ( defined( 'WP_CACHE' ) && constant( 'WP_CACHE' ) == false ) {
2574
- echo '<div class="notice notice-error">' . __( "<h3>WP_CACHE constant set to false</h3><p>The WP_CACHE constant is used by WordPress to load the code that serves cached pages. Unfortunately, it is set to false. Please edit your wp-config.php and add or edit the following line above the final require_once command:<br /><br /><code>define('WP_CACHE', true);</code></p>", 'wp-super-cache' ) . "</div>";
2575
  } else {
2576
  echo '<div class="notice notice-error"><p>' . __( "<strong>Error: WP_CACHE is not enabled</strong> in your <code>wp-config.php</code> file and I couldn&#8217;t modify it.", 'wp-super-cache' ) . "</p>";
2577
  echo "<p>" . sprintf( __( "Edit <code>%s</code> and add the following line:<br /> <code>define('WP_CACHE', true);</code><br />Otherwise, <strong>WP-Cache will not be executed</strong> by WordPress core. ", 'wp-super-cache' ), $global ) . "</p></div>";
2578
  }
2579
  return false;
2580
  } else {
2581
- echo "<div class='notice notice-warning'>" . __( '<h3>WP_CACHE constant added to wp-config.php</h3><p>If you continue to see this warning message please see point 5 of the <a href="https://wordpress.org/plugins/wp-super-cache/faq/">Troubleshooting Guide</a>. The WP_CACHE line must be moved up.', 'wp-super-cache' ) . "</p></div>";
2582
  }
2583
  return true;
2584
  }
@@ -2672,7 +2684,7 @@ function wp_cache_files() {
2672
  }
2673
  }
2674
  echo "<a name='listfiles'></a>";
2675
- echo '<fieldset class="options" id="show-this-fieldset"><h3>' . __( 'Cache Contents', 'wp-super-cache' ) . '</h3>';
2676
 
2677
  if ( $wp_cache_object_cache ) {
2678
  echo "<p>" . __( "Object cache in use. No cache listing available.", 'wp-super-cache' ) . "</p>";
@@ -2793,7 +2805,7 @@ function wp_cache_files() {
2793
  continue;
2794
  foreach( array( 'cached_list' => 'Fresh', 'expired_list' => 'Stale' ) as $list => $description ) {
2795
  if ( is_array( $details[ $list ] ) & !empty( $details[ $list ] ) ) {
2796
- echo "<h4>" . sprintf( __( '%s %s Files', 'wp-super-cache' ), $description, $cache_description[ $type ] ) . "</h4>";
2797
  echo "<table class='widefat'><tr><th>#</th><th>" . __( 'URI', 'wp-super-cache' ) . "</th><th>" . __( 'Files', 'wp-super-cache' ) . "</th><th>" . __( 'Age', 'wp-super-cache' ) . "</th><th>" . __( 'Delete', 'wp-super-cache' ) . "</th></tr>";
2798
  $c = 1;
2799
  $flip = 1;
@@ -2854,6 +2866,10 @@ function wp_cache_delete_buttons() {
2854
  }
2855
 
2856
  function delete_cache_dashboard() {
 
 
 
 
2857
  if ( false == wpsupercache_site_admin() )
2858
  return false;
2859
 
@@ -2862,7 +2878,7 @@ function delete_cache_dashboard() {
2862
 
2863
  echo "<li><a href='" . wp_nonce_url( 'options-general.php?page=wpsupercache&wp_delete_cache=1', 'wp-cache' ) . "' target='_blank' title='" . __( 'Delete Super Cache cached files (opens in new window)', 'wp-super-cache' ) . "'>" . __( 'Delete Cache', 'wp-super-cache' ) . "</a></li>";
2864
  }
2865
- add_action( 'dashmenu', 'delete_cache_dashboard' );
2866
 
2867
  function wpsc_dirsize($directory, $sizes) {
2868
  global $cache_max_time, $cache_path, $valid_nonce, $wp_cache_preload_on, $file_prefix;
@@ -3090,6 +3106,10 @@ function wp_cache_catch_404() {
3090
  //add_action( 'template_redirect', 'wp_cache_catch_404' );
3091
 
3092
  function wp_cache_favorite_action( $actions ) {
 
 
 
 
3093
  if ( false == wpsupercache_site_admin() )
3094
  return $actions;
3095
 
@@ -3100,7 +3120,7 @@ function wp_cache_favorite_action( $actions ) {
3100
 
3101
  return $actions;
3102
  }
3103
- add_filter( 'favorite_actions', 'wp_cache_favorite_action' );
3104
 
3105
  function wp_cache_plugin_notice( $plugin ) {
3106
  global $cache_enabled;
@@ -3200,7 +3220,7 @@ function wpsc_update_htaccess_form( $short_form = true ) {
3200
 
3201
  extract( wpsc_get_htaccess_info() ); // $document_root, $apache_root, $home_path, $home_root, $home_root_lc, $inst_root, $wprules, $scrules, $condition_rules, $rules, $gziprules
3202
  if( !is_writeable_ACLSafe( $home_path . ".htaccess" ) ) {
3203
- echo "<div style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'><h4>" . __( 'Cannot update .htaccess', 'wp-super-cache' ) . "</h4><p>" . sprintf( __( 'The file <code>%s.htaccess</code> cannot be modified by the web server. Please correct this using the chmod command or your ftp client.', 'wp-super-cache' ), $home_path ) . "</p><p>" . __( 'Refresh this page when the file permissions have been modified.' ) . "</p><p>" . sprintf( __( 'Alternatively, you can edit your <code>%s.htaccess</code> file manually and add the following code (before any WordPress rules):', 'wp-super-cache' ), $home_path ) . "</p>";
3204
  echo "<p><pre># BEGIN WPSuperCache\n" . esc_html( $rules ) . "# END WPSuperCache</pre></p></div>";
3205
  } else {
3206
  if ( $short_form == false ) {
@@ -3210,7 +3230,7 @@ function wpsc_update_htaccess_form( $short_form = true ) {
3210
  echo "<div style='overflow: auto; width: 800px; height: 400px; padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'>";
3211
  echo "<pre># BEGIN WPSuperCache\n" . esc_html( $rules ) . "# END WPSuperCache</pre></p>";
3212
  echo "</div>";
3213
- echo "<h4>" . sprintf( __( 'Rules must be added to %s too:', 'wp-super-cache' ), WP_CONTENT_DIR . "/cache/.htaccess" ) . "</h4>";
3214
  echo "<div style='overflow: auto; width: 800px; height: 400px; padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'>";
3215
  echo "<pre># BEGIN supercache\n" . esc_html( $gziprules ) . "# END supercache</pre></p>";
3216
  echo "</div>";
@@ -3712,22 +3732,49 @@ function uninstall_supercache( $folderPath ) { // from http://www.php.net/manual
3712
  }
3713
 
3714
  function supercache_admin_bar_render() {
3715
- global $wp_admin_bar, $wp_cache_not_logged_in;
3716
- if ( !is_user_logged_in() || !$wp_cache_not_logged_in )
3717
- return false;
3718
 
3719
- if ( function_exists('current_user_can') && false == current_user_can('delete_others_posts') )
 
 
 
 
 
 
 
 
 
 
 
 
3720
  return false;
 
3721
 
3722
- $wp_admin_bar->add_menu( array(
3723
- 'parent' => '',
3724
- 'id' => 'delete-cache',
3725
- 'title' => __( 'Delete Cache', 'wp-super-cache' ),
3726
- 'meta' => array( 'title' => __( 'Delete cache of the current page', 'wp-super-cache' ) ),
3727
- 'href' => wp_nonce_url( admin_url( 'index.php?action=delcachepage&path=' . urlencode( preg_replace( '/[ <>\'\"\r\n\t\(\)]/', '', $_SERVER[ 'REQUEST_URI' ] ) ) ), 'delete-cache' )
3728
- ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3729
  }
3730
- add_action( 'wp_before_admin_bar_render', 'supercache_admin_bar_render' );
3731
 
3732
  function wpsc_cancel_preload() {
3733
  global $cache_path;
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.6.4
7
  Author: Automattic
8
  Author URI: https://automattic.com/
9
  License: GPL2+
65
  * WP-CLI requires explicit declaration of global variables.
66
  * It's minimal list of global variables.
67
  */
68
+ global $super_cache_enabled, $cache_enabled, $wp_cache_mod_rewrite, $wp_cache_home_path, $cache_path, $file_prefix;
69
+ global $wp_cache_mutex_disabled, $mutex_filename, $sem_id, $wp_super_cache_late_init;
70
+ global $cache_compression, $cache_max_time, $wp_cache_shutdown_gc, $cache_rebuild_files;
71
+ global $wp_super_cache_debug, $wp_super_cache_advanced_debug, $wp_cache_debug_level, $wp_cache_debug_to_file;
72
+ global $wp_cache_debug_log, $wp_cache_debug_ip, $wp_cache_debug_username, $wp_cache_debug_email;
73
+ global $cache_time_interval, $cache_scheduled_time, $cache_schedule_interval, $cache_schedule_type, $cache_gc_email_me;
74
+ global $wp_cache_preload_on, $wp_cache_preload_interval, $wp_cache_preload_posts, $wp_cache_preload_taxonomies;
75
+ global $wp_cache_preload_email_me, $wp_cache_preload_email_volume;
76
+ global $wp_cache_mobile, $wp_cache_mobile_enabled, $wp_cache_mobile_browsers, $wp_cache_mobile_prefixes;
77
  global $wp_cache_config_file, $wp_cache_config_file_sample;
78
 
79
+ // WP-CLI: Hotfix for $blog_cache_dir for single site. It'll be removed after merging #590
80
+ if ( empty( $GLOBALS['blog_cache_dir'] ) && ! is_multisite() ) {
81
+ $GLOBALS['blog_cache_dir'] = $cache_path;
82
+ }
83
+
84
  if( !@include($wp_cache_config_file) ) {
85
  get_wpcachehome();
86
  $wp_cache_config_file_sample = WPCACHEHOME . 'wp-cache-config-sample.php';
237
  return false;
238
 
239
  if ( version_compare( PHP_VERSION, '5.3.0', '<' ) && ( 1 == ini_get( 'safe_mode' ) || "on" == strtolower( ini_get( 'safe_mode' ) ) ) ) {
240
+ echo '<div class="notice notice-error"><h4>' . __( 'Warning! PHP Safe Mode Enabled!', 'wp-super-cache' ) . '</h4><p>' .
241
  __( 'You may experience problems running this plugin because SAFE MODE is enabled.', 'wp-super-cache' ) . '<br />';
242
 
243
 
251
  }
252
 
253
  if ( '' == get_option( 'permalink_structure' ) ) {
254
+ echo '<div class="notice notice-error"><h4>' . __( 'Permlink Structure Error', 'wp-super-cache' ) . '</h4>';
255
  echo "<p>" . __( 'A custom url or permalink structure is required for this plugin to work correctly. Please go to the <a href="options-permalink.php">Permalinks Options Page</a> to configure your permalinks.', 'wp-super-cache' ) . "</p>";
256
  echo '</div>';
257
  return false;
260
  if ( $wp_cache_debug || ! $wp_cache_cron_check ) {
261
  if ( defined( 'DISABLE_WP_CRON' ) && constant( 'DISABLE_WP_CRON' ) ) {
262
  ?>
263
+ <div class="notice notice-error"><h4><?php _e( 'CRON System Disabled', 'wp-super-cache' ); ?></h4>
264
  <p><?php _e( 'The WordPress CRON jobs system is disabled. This means the garbage collection system will not work unless you run the CRON system manually.', 'wp-super-cache' ); ?></p>
265
  </div>
266
  <?php
270
  $hostname = substr( $hostname, 0, strpos( $hostname, '/' ) );
271
  $ip = gethostbyname( $hostname );
272
  if( substr( $ip, 0, 3 ) == '127' || substr( $ip, 0, 7 ) == '192.168' ) {
273
+ ?><div class="notice notice-warning"><h4><?php printf( __( 'Warning! Your hostname "%s" resolves to %s', 'wp-super-cache' ), $hostname, $ip ); ?></h4>
274
  <p><?php printf( __( 'Your server thinks your hostname resolves to %s. Some services such as garbage collection by this plugin, and WordPress scheduled posts may not operate correctly.', 'wp-super-cache' ), $ip ); ?></p>
275
  <p><?php printf( __( 'Please see entry 16 in the <a href="%s">Troubleshooting section</a> of the readme.txt', 'wp-super-cache' ), 'https://wordpress.org/plugins/wp-super-cache/faq/' ); ?></p>
276
  </div>
284
  $cron = wp_remote_get($cron_url, array('timeout' => 0.01, 'blocking' => true));
285
  if( is_array( $cron ) ) {
286
  if( $cron[ 'response' ][ 'code' ] == '404' ) {
287
+ ?><div class="notice notice-error"><h4>Warning! wp-cron.php not found!</h4>
288
  <p><?php _e( 'Unfortunately, WordPress cannot find the file wp-cron.php. This script is required for the correct operation of garbage collection by this plugin, WordPress scheduled posts as well as other critical activities.', 'wp-super-cache' ); ?></p>
289
  <p><?php printf( __( 'Please see entry 16 in the <a href="%s">Troubleshooting section</a> of the readme.txt', 'wp-super-cache' ), 'https://wordpress.org/plugins/wp-super-cache/faq/' ); ?></p>
290
  </div>
315
  }
316
 
317
  if ( 1 == ini_get( 'zlib.output_compression' ) || "on" == strtolower( ini_get( 'zlib.output_compression' ) ) ) {
318
+ ?><div class="notice notice-warning"><h4><?php _e( 'Zlib Output Compression Enabled!', 'wp-super-cache' ); ?></h4>
319
  <p><?php _e( 'PHP is compressing the data sent to the visitors of your site. Disabling this is recommended as the plugin caches the compressed output once instead of compressing the same page over and over again. Also see #21 in the Troubleshooting section. See <a href="http://php.net/manual/en/zlib.configuration.php">this page</a> for instructions on modifying your php.ini.', 'wp-super-cache' ); ?></p></div><?php
320
  }
321
 
326
  ! got_mod_rewrite() &&
327
  ! $is_nginx
328
  ) {
329
+ ?><div class="notice notice-warning"><h4><?php _e( 'Mod rewrite may not be installed!', 'wp-super-cache' ); ?></h4>
330
  <p><?php _e( 'It appears that mod_rewrite is not installed. Sometimes this check isn&#8217;t 100% reliable, especially if you are not using Apache. Please verify that the mod_rewrite module is loaded. It is required for serving Super Cache static files in expert mode. You will still be able to simple mode.', 'wp-super-cache' ); ?></p></div><?php
331
  }
332
 
333
  if( !is_writeable_ACLSafe( $wp_cache_config_file ) ) {
334
  if ( !defined( 'SUBMITDISABLED' ) )
335
  define( "SUBMITDISABLED", 'disabled style="color: #aaa" ' );
336
+ ?><div class="notice notice-error"><h4><?php _e( 'Read Only Mode. Configuration cannot be changed.', 'wp-super-cache' ); ?></h4>
337
  <p><?php printf( __( 'The WP Super Cache configuration file is <code>%s/wp-cache-config.php</code> and cannot be modified. That file must be writeable by the web server to make any changes.', 'wp-super-cache' ), WP_CONTENT_DIR ); ?>
338
  <?php _e( 'A simple way of doing that is by changing the permissions temporarily using the CHMOD command or through your ftp client. Make sure it&#8217;s globally writeable and it should be fine.', 'wp-super-cache' ); ?></p>
339
  <p><?php _e( '<a href="https://codex.wordpress.org/Changing_File_Permissions">This page</a> explains how to change file permissions.', 'wp-super-cache' ); ?></p>
356
  $gc_flag = get_gc_flag();
357
  if ( $dismiss_gc_warning == 0 ) {
358
  if ( false == maybe_stop_gc( $gc_flag ) && false == wp_next_scheduled( 'wp_cache_gc' ) ) {
359
+ ?><div class="notice notice-warning"><h4><?php _e( 'Warning! Garbage collection is not scheduled!', 'wp-super-cache' ); ?></h4>
360
  <p><?php _e( 'Garbage collection by this plugin clears out expired and old cached pages on a regular basis. Use <a href="#expirytime">this form</a> to enable it.', 'wp-super-cache' ); ?> </p>
361
  <form action="" method="POST">
362
  <input type="hidden" name="action" value="dismiss_gc_warning" />
383
  $wp_content_stat = stat(WP_CONTENT_DIR . '/');
384
  $wp_content_mode = decoct( $wp_content_stat[ 'mode' ] & 0777 );
385
  if( substr( $wp_content_mode, -2 ) == '77' ) {
386
+ ?><div class="notice notice-warning"><h4><?php printf( __( 'Warning! %s is writeable!', 'wp-super-cache' ), WP_CONTENT_DIR ); ?></h4>
387
  <p><?php printf( __( 'You should change the permissions on %s and make it more restrictive. Use your ftp client, or the following command to fix things:', 'wp-super-cache' ), WP_CONTENT_DIR ); ?> <code>chmod 755 <?php echo WP_CONTENT_DIR; ?>/</code></p>
388
  <p><?php _e( '<a href="https://codex.wordpress.org/Changing_File_Permissions">This page</a> explains how to change file permissions.', 'wp-super-cache' ); ?></p>
389
  <form action="" method="POST">
406
  }
407
  $scrules = implode( "\n", extract_from_markers( $home_path.'.htaccess', 'WPSuperCache' ) );
408
  if ( $cache_enabled && $wp_cache_mod_rewrite && !$wp_cache_mobile_enabled && strpos( $scrules, addcslashes( str_replace( ', ', '|', $wp_cache_mobile_browsers ), ' ' ) ) ) {
409
+ echo '<div class="notice notice-warning"><h4>' . __( 'Mobile rewrite rules detected', 'wp-super-cache' ) . "</h4>";
410
  echo "<p>" . __( 'For best performance you should enable "Mobile device support" or delete the mobile rewrite rules in your .htaccess. Look for the 2 lines with the text "2.0\ MMP|240x320" and delete those.', 'wp-super-cache' ) . "</p><p>" . __( 'This will have no affect on ordinary users but mobile users will see uncached pages.', 'wp-super-cache' ) . "</p></div>";
411
  } elseif ( $wp_cache_mod_rewrite && $cache_enabled && $wp_cache_mobile_enabled && $scrules != '' && (
412
  ( '' != $wp_cache_mobile_prefixes && false === strpos( $scrules, addcslashes( str_replace( ', ', '|', $wp_cache_mobile_prefixes ), ' ' ) ) ) ||
413
  ( '' != $wp_cache_mobile_browsers && false === strpos( $scrules, addcslashes( str_replace( ', ', '|', $wp_cache_mobile_browsers ), ' ' ) ) ) )
414
  ) {
415
  ?>
416
+ <div class="notice notice-warning"><h4><?php _e( 'Rewrite rules must be updated', 'wp-super-cache' ); ?></h4>
417
  <p><?php _e( 'The rewrite rules required by this plugin have changed or are missing. ', 'wp-super-cache' ); ?>
418
  <?php _e( 'Mobile support requires extra rules in your .htaccess file, or you can set the plugin to simple mode. Here are your options (in order of difficulty):', 'wp-super-cache' ); ?>
419
  <ol><li> <?php _e( 'Set the plugin to simple mode and enable mobile support.', 'wp-super-cache' ); ?></li>
424
  }
425
 
426
  if ( $cache_enabled && $super_cache_enabled && $wp_cache_mod_rewrite && $scrules == '' ) {
427
+ ?><div class='notice notice-warning'><h4><?php _e( 'Rewrite rules must be updated', 'wp-super-cache' ); ?></h4>
428
  <p><?php _e( 'The rewrite rules required by this plugin have changed or are missing. ', 'wp-super-cache' ); ?>
429
  <?php _e( 'Scroll down the Advanced Settings page and click the <strong>Update Mod_Rewrite Rules</strong> button.', 'wp-super-cache' ); ?></p></div><?php
430
  }
439
  }
440
  }
441
  if( isset( $missing_mods) && is_array( $missing_mods ) ) {
442
+ ?><div class='notice notice-warning'><h4><?php _e( 'Missing Apache Modules', 'wp-super-cache' ); ?></h4>
443
  <p><?php __( 'The following Apache modules are missing. The plugin will work in simple mode without them but in expert mode, your visitors may see corrupted pages or out of date content however.', 'wp-super-cache' ); ?></p><?php
444
  echo "<ul>";
445
  foreach( $missing_mods as $req => $desc ) {
459
  if ( isset( $disable_supercache_htaccess_warning ) == false )
460
  $disable_supercache_htaccess_warning = false;
461
  if ( ! $is_nginx && $dismiss_htaccess_warning == 0 && $wp_cache_mod_rewrite && $super_cache_enabled && $disable_supercache_htaccess_warning == false && get_option( 'siteurl' ) != get_option( 'home' ) ) {
462
+ ?><div class="notice notice-info"><h4><?php _e( '.htaccess file may need to be moved', 'wp-super-cache' ); ?></h4>
463
  <p><?php _e( 'It appears you have WordPress installed in a sub directory as described <a href="https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">here</a>. Unfortunately, WordPress writes to the .htaccess in the install directory, not where your site is served from.<br />When you update the rewrite rules in this plugin you will have to copy the file to where your site is hosted. This will be fixed in the future.', 'wp-super-cache' ); ?></p>
464
  <form action="" method="POST">
465
  <input type="hidden" name="action" value="dismiss_htaccess_warning" />
492
  $path = $valid_nonce ? realpath( trailingslashit( get_supercache_dir() . str_replace( '..', '', preg_replace( '/:.*$/', '', $req_path ) ) ) ) : false;
493
 
494
  if ( $path ) {
495
+ $path = trailingslashit( $path );
496
  $supercachepath = realpath( get_supercache_dir() );
497
 
498
  if ( false == wp_cache_confirm_delete( $path ) || substr( $path, 0, strlen( $supercachepath ) ) != $supercachepath ) {
503
  }
504
 
505
  if ( $referer && $req_path && ( false !== stripos( $referer, $req_path ) || 0 === stripos( $referer, wp_login_url() ) ) ) {
506
+ wp_redirect( site_url( preg_replace( '/[ <>\'\"\r\n\t\(\)]/', '', $req_path ) ) );
507
  exit;
508
  }
509
  }
828
  // -->
829
  //Clicking header opens fieldset options
830
  jQuery(document).ready(function(){
831
+ jQuery("fieldset h4").css("cursor","pointer").click(function(){
832
  jQuery(this).parent("fieldset").find("p,form,ul,blockquote").toggle("slow");
833
  });
834
  });
835
  </script>
836
 
837
  <style type='text/css'>
838
+ #nav h3 {
839
  border-bottom: 1px solid #ccc;
840
  padding-bottom: 0;
841
+ height: 1.5em;
842
  }
843
  table.wpsc-settings-table {
844
  clear: both;
847
  <?php
848
  echo '<a name="top"></a>';
849
  echo '<div class="wrap">';
850
+ echo '<h3>' . __( 'WP Super Cache Settings', 'wp-super-cache' ) . '</h3>';
851
 
852
  // set a default
853
  if ( $cache_enabled == false && isset( $wp_cache_mod_rewrite ) == false ) {
893
  $msg .="<p>" . sprintf( __( "<strong>Page last cached:</strong> %s", 'wp-super-cache' ), $url ) . "</p>";
894
  }
895
  if ( $msg != '' ) {
896
+ echo '<div class="notice notice-warning"><h4>' . __( 'Preload Active', 'wp-super-cache' ) . '</h4>' . $msg;
897
  echo '<form name="do_preload" action="" method="POST">';
898
  echo '<input type="hidden" name="action" value="preload" />';
899
  echo '<input type="hidden" name="page" value="wpsupercache" />';
1113
  <label><input type='checkbox' name='wp_cache_mfunc_enabled' <?php if( $wp_cache_mfunc_enabled ) echo "checked"; ?> value='1' <?php if ( $wp_cache_mod_rewrite ) { echo "disabled='disabled'"; } ?>> <?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 />
1114
  <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 />
1115
  <?php if ( $wp_cache_mobile_enabled ) {
1116
+ 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>";
1117
  } ?>
1118
  <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 />
1119
  <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 />
1162
  </td>
1163
  </tr>
1164
  </table>
1165
+ <h4><?php _e( 'Note:', 'wp-super-cache' ); ?></h4>
1166
  <ol>
1167
  <li><?php _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>
1168
  <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' ), WP_CONTENT_DIR ); ?></li>
1177
 
1178
  wp_cache_edit_max_time();
1179
 
1180
+ echo '<a name="files"></a><fieldset class="options"><h4>' . __( 'Accepted Filenames &amp; Rejected URIs', 'wp-super-cache' ) . '</h4>';
1181
  wp_cache_edit_rejected_pages();
1182
  echo "\n";
1183
  wp_cache_edit_rejected();
1217
  }
1218
  echo "<div class='submit'><input class='button-primary' type='submit' " . SUBMITDISABLED . " value='" . __( 'Update Status', 'wp-super-cache' ) . "' /></div></form>";
1219
  if ( $cache_enabled ) {
1220
+ echo "<h4>" . __( 'Cache Tester', 'wp-super-cache' ) . "</h4>";
1221
  echo '<p>' . __( 'Test your cached website by clicking the test button below.', 'wp-super-cache' ) . '</p>';
1222
  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>';
1223
  if ( array_key_exists('action', $_POST) && $_POST[ 'action' ] == 'test' && $valid_nonce ) {
1288
  wp_nonce_field('wp-cache');
1289
  echo '</form>';
1290
  }
1291
+ echo "<h4>" . __( "Delete Cached Pages", 'wp-super-cache' ) . "</h4>";
1292
  echo "<p>" . __( "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>";
1293
  echo '<form name="wp_cache_content_delete" action="?page=wpsupercache&tab=contents" method="post">';
1294
  echo '<input type="hidden" name="wp_delete_cache" />';
1304
  echo "</form><br />\n";
1305
  }
1306
  ?>
1307
+ <h4 class="clear"><?php _e( 'Recommended Links and Plugins', 'wp-super-cache' ); ?></h4>
1308
  <p><?php _e( 'Caching is only one part of making a website faster. Here are some other plugins that will help:', 'wp-super-cache' ); ?></p>
1309
  <ul style="list-style: square; margin-left: 2em;">
1310
  <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>
1322
  </fieldset>
1323
  </td><td valign='top' style='width: 300px'>
1324
  <div style='background: #ffc; border: 1px solid #333; margin: 2px; padding: 3px 15px'>
1325
+ <h4><?php _e( 'More Site Speed Tools', 'wp-super-cache' ); ?></h4>
1326
  <ul style="list-style: square; margin-left: 2em;">
1327
  <li><a href="https://jetpack.com/redirect/?source=jitm-wpsc-generic"><?php _e( 'Speed up images and photos (free)', 'wp-super-cache' ); ?></a></li>
1328
  <li><a href="https://jetpack.com/redirect/?source=jitm-wpsc-premium"><?php _e( 'Fast video hosting (paid)', 'wp-super-cache' ); ?></a></li>
1329
  </ul>
1330
+ <h4><?php _e( 'Need Help?', 'wp-super-cache' ); ?></h4>
1331
  <ol>
1332
  <li><?php printf( __( 'Use the <a href="%1$s">Debug tab</a> for diagnostics.', 'wp-super-cache' ), admin_url( 'options-general.php?page=wpsupercache&tab=debug' ) ); ?></li>
1333
  <li><?php printf( __( 'Check out the <a href="%1$s">support forum</a> and <a href="%2$s">FAQ</a>.', 'wp-super-cache' ), 'https://wordpress.org/support/plugin/wp-super-cache', 'https://wordpress.org/plugins/wp-super-cache/#faq' ); ?></li>
1334
  <li><?php printf( __( 'Visit the <a href="%1$s">plugin homepage</a>.', 'wp-super-cache' ), 'https://wordpress.org/plugins/wp-super-cache/' ); ?></li>
1335
  <li><?php printf( __( 'Try out the <a href="%1$s">development version</a> for the latest fixes (<a href="%2$s">changelog</a>).', 'wp-super-cache' ), 'https://odd.blog/y/2o', 'https://plugins.trac.wordpress.org/log/wp-super-cache/' ); ?></li>
1336
  </ol>
1337
+ <h4><?php _e( 'Rate This Plugin', 'wp-super-cache' ); ?></h4>
1338
  <p><?php printf( __( 'Please <a href="%s">rate us</a> and give feedback.', 'wp-super-cache' ), 'https://wordpress.org/support/plugin/wp-super-cache/reviews?rate=5#new-post' ); ?></p>
1339
 
1340
  <?php
1380
  $out = ob_get_contents();
1381
  ob_end_clean();
1382
  if( SUBMITDISABLED == ' ' && $out != '' ) {
1383
+ echo '<h4>' . __( 'Available Plugins', 'wp-super-cache' ) . '</h4>';
1384
  echo "<ol>";
1385
  echo $out;
1386
  echo "</ol>";
1407
  }
1408
  }
1409
  if ( $wp_db_version >= 15477 ) {
1410
+ echo '<div id="nav"><h3 class="themes-php">';
1411
  echo implode( "", $links );
1412
+ echo '</div></h3>';
1413
  } else {
1414
  echo implode( " | ", $links );
1415
  }
1432
 
1433
  ?>
1434
  <a name="modrewrite"></a><fieldset class="options">
1435
+ <h4><?php _e( 'Mod Rewrite Rules', 'wp-super-cache' ); ?></h4>
1436
  <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>
1437
 
1438
  <?php
1451
  }
1452
  } elseif ( $valid_nonce && isset( $_POST[ 'updatehtaccess' ] ) ) {
1453
  if ( add_mod_rewrite_rules() ) {
1454
+ echo "<h5>" . __( 'Mod Rewrite rules updated!', 'wp-super-cache' ) . "</h5>";
1455
  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";
1456
  } else {
1457
  global $update_mod_rewrite_rules_error;
1458
+ echo "<h5>" . __( 'Mod Rewrite rules must be updated!', 'wp-super-cache' ) . "</h5>";
1459
  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";
1460
  }
1461
  echo "<div style='overflow: auto; width: 800px; height: 400px; padding:0 8px;color:#4f8a10;background-color:#dff2bf;border:1px solid #4f8a10;'>";
1482
  }
1483
 
1484
  function wp_cache_restore() {
1485
+ echo '<fieldset class="options"><h4>' . __( 'Fix Configuration', 'wp-super-cache' ) . '</h4>';
1486
  echo '<form name="wp_restore" action="#top" method="post">';
1487
  echo '<input type="hidden" name="wp_restore_config" />';
1488
  echo '<div class="submit"><input class="button-secondary" type="submit" ' . SUBMITDISABLED . 'id="deletepost" value="' . __( 'Restore Default Configuration', 'wp-super-cache' ) . '" /></div>';
1600
 
1601
  ?><a name='lockdown'></a>
1602
  <fieldset class="options">
1603
+ <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>
1604
  <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>
1605
  <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' ); ?>
1606
  <blockquote><code>if( defined( 'WPLOCKDOWN' ) && constant( 'WPLOCKDOWN' ) ) {
1624
  if( $cache_enabled == true && $super_cache_enabled == true ) {
1625
  ?><a name='direct'></a>
1626
  <fieldset class="options">
1627
+ <h4><?php _e( 'Directly Cached Files', 'wp-super-cache' ); ?></h4><?php
1628
 
1629
  $cached_direct_pages = wpsc_update_direct_pages();
1630
 
1775
 
1776
  ?><fieldset class="options">
1777
  <a name='expirytime'></a>
1778
+ <h4><?php _e( 'Expiry Time &amp; Garbage Collection', 'wp-super-cache' ); ?></h4><?php
1779
 
1780
  ?><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
1781
  $current_offset = get_option('gmt_offset');
1823
  echo '<tr><td><label for="cache_gc_email_me"><strong>' . __( 'Notification Emails', 'wp-super-cache' ) . '</strong></label></td>';
1824
  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";
1825
  echo "</table>\n";
1826
+ echo "<h5>" . __( 'Garbage Collection', 'wp-super-cache' ) . "</h5>";
1827
  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";
1828
  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";
1829
  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";
1877
 
1878
  wp_cache_update_rejected_ua();
1879
 
1880
+ echo '<a name="useragents"></a><fieldset class="options"><h4>' . __( 'Rejected User Agents', 'wp-super-cache' ) . '</h4>';
1881
  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";
1882
  echo '<form name="wp_edit_rejected_user_agent" action="#useragents" method="post">';
1883
  echo '<textarea name="wp_rejected_user_agent" cols="40" rows="4" style="width: 50%; font-size: 12px;" class="code">';
2120
  &lt;!-- super cache --></pre></td></tr>";
2121
  echo "</table>\n";
2122
  if ( isset( $wp_super_cache_advanced_debug ) ) {
2123
+ 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>';
2124
  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>";
2125
  echo "<table class='form-table'>";
2126
  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>";
2273
  if ( get_site_option( 'wp_super_cache_index_detected' ) == 2 ) {
2274
  update_site_option( 'wp_super_cache_index_detected', 3 );
2275
  echo "<div class='error' style='padding: 10px 10px 50px 10px'>";
2276
+ echo "<h2>" . __( 'WP Super Cache Warning!', 'wp-super-cache' ) . '</h2>';
2277
  echo '<p>' . __( 'All users of this site have been logged out to refresh their login cookies.', 'wp-super-cache' ) . '</p>';
2278
  echo '</div>';
2279
  return false;
2280
  } elseif ( get_site_option( 'wp_super_cache_index_detected' ) != 3 ) {
2281
  echo "<div id='wpsc-index-warning' class='error notice' style='padding: 10px 10px 50px 10px'>";
2282
+ echo "<h2>" . __( 'WP Super Cache Warning!', 'wp-super-cache' ) . '</h2>';
2283
  echo '<p>' . __( 'Your server is configured to show files and directories, which may expose sensitive data such as login cookies to attackers in the cache directories. That has been fixed by adding a file named index.html to each directory. If you use simple caching, consider moving the location of the cache directory on the Advanced Settings page.', 'wp-super-cache' ) . '</p>';
2284
  echo "<p><strong>";
2285
  _e( 'If you just installed WP Super Cache for the first time, you can dismiss this message. Otherwise, you should probably refresh the login cookies of all logged in WordPress users here by clicking the logout link below.', 'wp-super-cache' );
2513
  $line = 'define( \'WPCACHEHOME\', \'' . dirname( __FILE__ ) . '/\' );';
2514
 
2515
  if ( ! apply_filters( 'wpsc_enable_wp_config_edit', true ) ) {
2516
+ echo '<div class="notice notice-error"><h4>' . __( 'Warning', 'wp-super-cache' ) . "! " . sprintf( __( 'Not allowed to edit %s per configuration.', 'wp-super-cache' ), $global_config_file ) . "</h4></div>";
2517
  return false;
2518
  }
2519
 
2520
  if ( !is_writeable_ACLSafe($global_config_file) || !wp_cache_replace_line('define *\( *\'WPCACHEHOME\'', $line, $global_config_file ) ) {
2521
+ echo '<div class="notice notice-error"><h4>' . __( 'Warning', 'wp-super-cache' ) . "! <em>" . sprintf( __( 'Could not update %s!</em> WPCACHEHOME must be set in config file.', 'wp-super-cache' ), $global_config_file ) . "</h4></div>";
2522
  return false;
2523
  }
2524
  $ret = true;
2554
  }
2555
 
2556
  if( false == $ret ) {
2557
+ echo '<div class="notice notice-error"><h4>' . __( 'Warning', 'wp-super-cache' ) . "! <em>" . sprintf( __( '%s/advanced-cache.php</em> does not exist or cannot be updated.', 'wp-super-cache' ), WP_CONTENT_DIR ) . "</h4>";
2558
  echo "<p><ol><li>" . __( 'If it already exists, please delete the file first.', 'wp-super-cache' ) . "</li>";
2559
  echo "<li>" . sprintf( __( 'Make %1$s writable using the chmod command through your ftp or server software. (<em>chmod 777 %1$s</em>) and refresh this page. This is only a temporary measure and you&#8217;ll have to make it read only afterwards again. (Change 777 to 755 in the previous command)', 'wp-super-cache' ), WP_CONTENT_DIR ) . "</li>";
2560
  echo "<li>" . sprintf( __( 'Refresh this page to update <em>%s/advanced-cache.php</em>', 'wp-super-cache' ), WP_CONTENT_DIR ) . "</li></ol>";
2583
  $line = 'define(\'WP_CACHE\', true);';
2584
  if (!is_writeable_ACLSafe($global) || !wp_cache_replace_line('define *\( *\'WP_CACHE\'', $line, $global) ) {
2585
  if ( defined( 'WP_CACHE' ) && constant( 'WP_CACHE' ) == false ) {
2586
+ echo '<div class="notice notice-error">' . __( "<h4>WP_CACHE constant set to false</h4><p>The WP_CACHE constant is used by WordPress to load the code that serves cached pages. Unfortunately, it is set to false. Please edit your wp-config.php and add or edit the following line above the final require_once command:<br /><br /><code>define('WP_CACHE', true);</code></p>", 'wp-super-cache' ) . "</div>";
2587
  } else {
2588
  echo '<div class="notice notice-error"><p>' . __( "<strong>Error: WP_CACHE is not enabled</strong> in your <code>wp-config.php</code> file and I couldn&#8217;t modify it.", 'wp-super-cache' ) . "</p>";
2589
  echo "<p>" . sprintf( __( "Edit <code>%s</code> and add the following line:<br /> <code>define('WP_CACHE', true);</code><br />Otherwise, <strong>WP-Cache will not be executed</strong> by WordPress core. ", 'wp-super-cache' ), $global ) . "</p></div>";
2590
  }
2591
  return false;
2592
  } else {
2593
+ echo "<div class='notice notice-warning'>" . __( '<h4>WP_CACHE constant added to wp-config.php</h4><p>If you continue to see this warning message please see point 5 of the <a href="https://wordpress.org/plugins/wp-super-cache/faq/">Troubleshooting Guide</a>. The WP_CACHE line must be moved up.', 'wp-super-cache' ) . "</p></div>";
2594
  }
2595
  return true;
2596
  }
2684
  }
2685
  }
2686
  echo "<a name='listfiles'></a>";
2687
+ echo '<fieldset class="options" id="show-this-fieldset"><h4>' . __( 'Cache Contents', 'wp-super-cache' ) . '</h4>';
2688
 
2689
  if ( $wp_cache_object_cache ) {
2690
  echo "<p>" . __( "Object cache in use. No cache listing available.", 'wp-super-cache' ) . "</p>";
2805
  continue;
2806
  foreach( array( 'cached_list' => 'Fresh', 'expired_list' => 'Stale' ) as $list => $description ) {
2807
  if ( is_array( $details[ $list ] ) & !empty( $details[ $list ] ) ) {
2808
+ echo "<h5>" . sprintf( __( '%s %s Files', 'wp-super-cache' ), $description, $cache_description[ $type ] ) . "</h5>";
2809
  echo "<table class='widefat'><tr><th>#</th><th>" . __( 'URI', 'wp-super-cache' ) . "</th><th>" . __( 'Files', 'wp-super-cache' ) . "</th><th>" . __( 'Age', 'wp-super-cache' ) . "</th><th>" . __( 'Delete', 'wp-super-cache' ) . "</th></tr>";
2810
  $c = 1;
2811
  $flip = 1;
2866
  }
2867
 
2868
  function delete_cache_dashboard() {
2869
+ if ( function_exists( '_deprecated_function' ) ) {
2870
+ _deprecated_function( __FUNCTION__, 'WP Super Cache 1.6.4' );
2871
+ }
2872
+
2873
  if ( false == wpsupercache_site_admin() )
2874
  return false;
2875
 
2878
 
2879
  echo "<li><a href='" . wp_nonce_url( 'options-general.php?page=wpsupercache&wp_delete_cache=1', 'wp-cache' ) . "' target='_blank' title='" . __( 'Delete Super Cache cached files (opens in new window)', 'wp-super-cache' ) . "'>" . __( 'Delete Cache', 'wp-super-cache' ) . "</a></li>";
2880
  }
2881
+ //add_action( 'dashmenu', 'delete_cache_dashboard' );
2882
 
2883
  function wpsc_dirsize($directory, $sizes) {
2884
  global $cache_max_time, $cache_path, $valid_nonce, $wp_cache_preload_on, $file_prefix;
3106
  //add_action( 'template_redirect', 'wp_cache_catch_404' );
3107
 
3108
  function wp_cache_favorite_action( $actions ) {
3109
+ if ( function_exists( '_deprecated_function' ) ) {
3110
+ _deprecated_function( __FUNCTION__, 'WP Super Cache 1.6.4' );
3111
+ }
3112
+
3113
  if ( false == wpsupercache_site_admin() )
3114
  return $actions;
3115
 
3120
 
3121
  return $actions;
3122
  }
3123
+ //add_filter( 'favorite_actions', 'wp_cache_favorite_action' );
3124
 
3125
  function wp_cache_plugin_notice( $plugin ) {
3126
  global $cache_enabled;
3220
 
3221
  extract( wpsc_get_htaccess_info() ); // $document_root, $apache_root, $home_path, $home_root, $home_root_lc, $inst_root, $wprules, $scrules, $condition_rules, $rules, $gziprules
3222
  if( !is_writeable_ACLSafe( $home_path . ".htaccess" ) ) {
3223
+ echo "<div style='padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'><h5>" . __( 'Cannot update .htaccess', 'wp-super-cache' ) . "</h5><p>" . sprintf( __( 'The file <code>%s.htaccess</code> cannot be modified by the web server. Please correct this using the chmod command or your ftp client.', 'wp-super-cache' ), $home_path ) . "</p><p>" . __( 'Refresh this page when the file permissions have been modified.' ) . "</p><p>" . sprintf( __( 'Alternatively, you can edit your <code>%s.htaccess</code> file manually and add the following code (before any WordPress rules):', 'wp-super-cache' ), $home_path ) . "</p>";
3224
  echo "<p><pre># BEGIN WPSuperCache\n" . esc_html( $rules ) . "# END WPSuperCache</pre></p></div>";
3225
  } else {
3226
  if ( $short_form == false ) {
3230
  echo "<div style='overflow: auto; width: 800px; height: 400px; padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'>";
3231
  echo "<pre># BEGIN WPSuperCache\n" . esc_html( $rules ) . "# END WPSuperCache</pre></p>";
3232
  echo "</div>";
3233
+ echo "<h5>" . sprintf( __( 'Rules must be added to %s too:', 'wp-super-cache' ), WP_CONTENT_DIR . "/cache/.htaccess" ) . "</h5>";
3234
  echo "<div style='overflow: auto; width: 800px; height: 400px; padding:0 8px;color:#9f6000;background-color:#feefb3;border:1px solid #9f6000;'>";
3235
  echo "<pre># BEGIN supercache\n" . esc_html( $gziprules ) . "# END supercache</pre></p>";
3236
  echo "</div>";
3732
  }
3733
 
3734
  function supercache_admin_bar_render() {
3735
+ global $wp_admin_bar;
 
 
3736
 
3737
+ if ( function_exists( '_deprecated_function' ) ) {
3738
+ _deprecated_function( __FUNCTION__, 'WP Super Cache 1.6.4' );
3739
+ }
3740
+
3741
+ wpsc_admin_bar_render( $wp_admin_bar );
3742
+ }
3743
+
3744
+ /**
3745
+ * Adds "Delete Cache" button in WP Admin Bar.
3746
+ */
3747
+ function wpsc_admin_bar_render( $wp_admin_bar ) {
3748
+
3749
+ if ( ! function_exists( 'current_user_can' ) || ! is_user_logged_in() ) {
3750
  return false;
3751
+ }
3752
 
3753
+ if ( ( is_singular() || is_archive() || is_front_page() || is_search() ) && current_user_can( 'delete_others_posts' ) ) {
3754
+ $site_regex = preg_quote( rtrim( (string) parse_url( get_option( 'home' ), PHP_URL_PATH ), '/' ), '`' );
3755
+ $req_uri = preg_replace( '/[ <>\'\"\r\n\t\(\)]/', '', $_SERVER[ 'REQUEST_URI' ] );
3756
+ $path = preg_replace( '`^' . $site_regex . '`', '', $req_uri );
3757
+
3758
+ $wp_admin_bar->add_menu( array(
3759
+ 'parent' => '',
3760
+ 'id' => 'delete-cache',
3761
+ 'title' => __( 'Delete Cache', 'wp-super-cache' ),
3762
+ 'meta' => array( 'title' => __( 'Delete cache of the current page', 'wp-super-cache' ) ),
3763
+ 'href' => wp_nonce_url( admin_url( 'index.php?action=delcachepage&path=' . urlencode( $path ) ), 'delete-cache' )
3764
+ ) );
3765
+ }
3766
+
3767
+ if ( is_admin() && wpsupercache_site_admin() && current_user_can( 'manage_options' ) ) {
3768
+ $wp_admin_bar->add_menu( array(
3769
+ 'parent' => '',
3770
+ 'id' => 'delete-cache',
3771
+ 'title' => __( 'Delete Cache', 'wp-super-cache' ),
3772
+ 'meta' => array( 'title' => __( 'Delete Super Cache cached files (opens in new window)', 'wp-super-cache' ), 'target' => '_blank' ),
3773
+ 'href' => wp_nonce_url( admin_url( 'options-general.php?page=wpsupercache&tab=contents&wp_delete_cache=1' ), 'wp-cache' )
3774
+ ) );
3775
+ }
3776
  }
3777
+ add_action( 'admin_bar_menu', 'wpsc_admin_bar_render', 99 );
3778
 
3779
  function wpsc_cancel_preload() {
3780
  global $cache_path;