WP Super Cache - Version 0.9.4

Version Description

Download this release

Release Info

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

Code changes from version 0.9.3.1 to 0.9.4

Changelog.txt CHANGED
@@ -1,3 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  2009-04-06 14:16 donncha
2
 
3
  * readme.txt, wp-cache.php: Bump version to 0.9.3.1
1
+ 2009-04-21 15:45 donncha
2
+
3
+ * readme.txt: Updated recent changes
4
+
5
+ 2009-04-21 15:44 donncha
6
+
7
+ * Changelog.txt: Updated changelog
8
+
9
+ 2009-04-21 15:43 donncha
10
+
11
+ * readme.txt, wp-cache.php: Bumped version number to 0.9.4
12
+
13
+ 2009-04-21 11:46 donncha
14
+
15
+ * wp-cache.php: Minor docs update
16
+
17
+ 2009-04-20 09:25 donncha
18
+
19
+ * wp-cache-phase2.php: Check that user is logged in before not
20
+ caching
21
+
22
+ 2009-04-20 08:49 donncha
23
+
24
+ * wp-cache-phase2.php, wp-cache.php: Added "Don't cache for logged
25
+ in users" option
26
+
27
+ 2009-04-18 22:03 donncha
28
+
29
+ * readme.txt: Updated donation link
30
+
31
+ 2009-04-15 16:38 donncha
32
+
33
+ * wp-cache.php: Display file size stats on admin page
34
+
35
+ 2009-04-15 15:27 donncha
36
+
37
+ * wp-cache-phase2.php: Clear the cache when the profile is updated.
38
+ Props djquinn http://wordpress.org/support/topic/261504?replies=6
39
+ http://www.dquinn.net/wp-super-cache-preview-draft-update-profile-wordpress/
40
+
41
+ 2009-04-15 15:25 donncha
42
+
43
+ * wp-cache-phase1.php: Don't cache post previews
44
+
45
+ 2009-04-14 14:10 donncha
46
+
47
+ * wp-cache-config-sample.php, wp-cache.php: Added backslashes to
48
+ rejected URI. See
49
+ http://wordpress.org/support/topic/260790?replies=10#post-1045412
50
+
51
+ 2009-04-06 14:17 donncha
52
+
53
+ * Changelog.txt: Updated changelog to 0.9.3.1
54
+
55
  2009-04-06 14:16 donncha
56
 
57
  * readme.txt, wp-cache.php: Bump version to 0.9.3.1
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: donncha
3
  Tags: performance,caching,wp-cache,wp-super-cache,cache
4
  Tested up to: 2.7.1
5
- Stable tag: 0.9.3.1
6
  Requires at least: 2.6
7
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3244504
8
 
9
  A very fast caching engine for WordPress that produces static html files.
10
 
@@ -13,11 +13,11 @@ This plugin generates static html files from your dynamic WordPress blog. After
13
 
14
  = Recent Changes =
15
 
16
- 1. Fix problem with saving posts in 0.9.3 [(more)](http://wordpress.org/support/topic/259636?replies=2)
17
- 2. WordPress MU cache files will go in separate directories to scale better.
18
- 3. Cache Rebuild on by default on new installs. File locking is off.
19
- 4. More PHP5 `register_shutdown_function()` object destruction fixes.
20
- 5. Warn user via html comment if path to wp-cache-phase1.php in advanced-cache.php is broken.
21
 
22
  The static html files will be served to the vast majority of your users, but because a user's details are displayed in the comment form after they leave a comment those requests are handled by PHP. Static files are served to:
23
 
2
  Contributors: donncha
3
  Tags: performance,caching,wp-cache,wp-super-cache,cache
4
  Tested up to: 2.7.1
5
+ Stable tag: 0.9.4
6
  Requires at least: 2.6
7
+ Donate link: http://ocaoimh.ie/wordpress-plugins/gifts-and-donations/
8
 
9
  A very fast caching engine for WordPress that produces static html files.
10
 
13
 
14
  = Recent Changes =
15
 
16
+ 1. Added "Don't cache for logged in users" option.
17
+ 2. Display file size stats on admin page.
18
+ 3. Clear the cache when profile page is updated.
19
+ 4. Don't cache post previews.
20
+ 5. Added backslashes to rejected URI regex list
21
 
22
  The static html files will be served to the vast majority of your users, but because a user's details are displayed in the comment form after they leave a comment those requests are handled by PHP. Static files are served to:
23
 
wp-cache-config-sample.php CHANGED
@@ -40,7 +40,7 @@ if( defined( 'VHOST' ) ) {
40
  // Array of files that have 'wp-' but should still be cached
41
  $cache_acceptable_files = array( 'wp-comments-popup.php', 'wp-links-opml.php', 'wp-locations.php' );
42
 
43
- $cache_rejected_uri = array('wp-.*.php', 'index.php');
44
  $cache_rejected_user_agent = array ( 0 => 'bot', 1 => 'ia_archive', 2 => 'slurp', 3 => 'crawl', 4 => 'spider');
45
 
46
  $cache_rebuild_files = 1;
40
  // Array of files that have 'wp-' but should still be cached
41
  $cache_acceptable_files = array( 'wp-comments-popup.php', 'wp-links-opml.php', 'wp-locations.php' );
42
 
43
+ $cache_rejected_uri = array('wp-.*\\.php', 'index\\.php');
44
  $cache_rejected_user_agent = array ( 0 => 'bot', 1 => 'ia_archive', 2 => 'slurp', 3 => 'crawl', 4 => 'spider');
45
 
46
  $cache_rebuild_files = 1;
wp-cache-phase1.php CHANGED
@@ -113,24 +113,10 @@ if( file_exists( $cache_file ) && ($mtime = @filemtime($meta_pathname)) ) {
113
  $file_expired = true; // To signal this file was expired
114
  }
115
 
116
- /*register_shutdown_function( 'wp_cache_do_output' );
117
-
118
- function wp_cache_do_output() {
119
- global $wp_cache_do_output;
120
- if( !$wp_cache_do_output ) {
121
- return false;
122
- }
123
- $buffer = ob_get_contents();
124
- ob_end_clean();
125
- $buffer = wp_cache_get_ob( $buffer );
126
- wp_cache_shutdown_callback();
127
- echo $buffer;
128
- }*/
129
-
130
  function wp_cache_postload() {
131
  global $cache_enabled;
132
 
133
- if (!$cache_enabled)
134
  return true;
135
  require_once( WPCACHEHOME . 'wp-cache-phase2.php');
136
  wp_cache_phase2();
113
  $file_expired = true; // To signal this file was expired
114
  }
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  function wp_cache_postload() {
117
  global $cache_enabled;
118
 
119
+ if ( !$cache_enabled || $_GET[ 'preview' ] )
120
  return true;
121
  require_once( WPCACHEHOME . 'wp-cache-phase2.php');
122
  wp_cache_phase2();
wp-cache-phase2.php CHANGED
@@ -2,12 +2,14 @@
2
 
3
  function wp_cache_phase2() {
4
  global $cache_filename, $cache_acceptable_files, $wp_cache_gzip_encoding, $super_cache_enabled, $cache_rebuild_files, $wp_cache_gmt_offset, $wp_cache_blog_charset, $wp_cache_last_gc;
5
- global $cache_max_time;
 
 
 
6
 
7
  $wp_cache_gmt_offset = get_option( 'gmt_offset' ); // caching for later use when wpdb is gone. http://wordpress.org/support/topic/224349
8
  $wp_cache_blog_charset = get_option( 'blog_charset' );
9
 
10
- wp_cache_mutex_init();
11
  if(function_exists('add_action') && ( !defined( 'WPLOCKDOWN' ) || ( defined( 'WPLOCKDOWN' ) && constant( 'WPLOCKDOWN' ) == '0' ) ) ) {
12
  // Post ID is received
13
  add_action('publish_post', 'wp_cache_post_edit', 0);
@@ -23,6 +25,7 @@ function wp_cache_phase2() {
23
  // No post_id is available
24
  add_action('delete_comment', 'wp_cache_no_postid', 99);
25
  add_action('switch_theme', 'wp_cache_no_postid', 99);
 
26
 
27
  add_action('wp_cache_gc','wp_cache_gc_cron');
28
 
@@ -38,6 +41,7 @@ function wp_cache_phase2() {
38
  header('Vary: Accept-Encoding, Cookie');
39
  else
40
  header('Vary: Cookie');
 
41
  ob_start( 'wp_cache_ob_callback' );
42
 
43
  // restore old supercache file temporarily
@@ -81,7 +85,6 @@ function wp_cache_phase2() {
81
  $time_to_gc_cache = 1; // tell the "shutdown gc" to run!
82
  }
83
  }
84
-
85
  }
86
 
87
  function wp_cache_get_response_headers() {
2
 
3
  function wp_cache_phase2() {
4
  global $cache_filename, $cache_acceptable_files, $wp_cache_gzip_encoding, $super_cache_enabled, $cache_rebuild_files, $wp_cache_gmt_offset, $wp_cache_blog_charset, $wp_cache_last_gc;
5
+ global $cache_max_time, $wp_cache_not_logged_in;
6
+
7
+ if( $wp_cache_not_logged_in && is_user_logged_in() )
8
+ return false;
9
 
10
  $wp_cache_gmt_offset = get_option( 'gmt_offset' ); // caching for later use when wpdb is gone. http://wordpress.org/support/topic/224349
11
  $wp_cache_blog_charset = get_option( 'blog_charset' );
12
 
 
13
  if(function_exists('add_action') && ( !defined( 'WPLOCKDOWN' ) || ( defined( 'WPLOCKDOWN' ) && constant( 'WPLOCKDOWN' ) == '0' ) ) ) {
14
  // Post ID is received
15
  add_action('publish_post', 'wp_cache_post_edit', 0);
25
  // No post_id is available
26
  add_action('delete_comment', 'wp_cache_no_postid', 99);
27
  add_action('switch_theme', 'wp_cache_no_postid', 99);
28
+ add_action('edit_user_profile_update', 'wp_cache_no_postid', 99);
29
 
30
  add_action('wp_cache_gc','wp_cache_gc_cron');
31
 
41
  header('Vary: Accept-Encoding, Cookie');
42
  else
43
  header('Vary: Cookie');
44
+ wp_cache_mutex_init();
45
  ob_start( 'wp_cache_ob_callback' );
46
 
47
  // restore old supercache file temporarily
85
  $time_to_gc_cache = 1; // tell the "shutdown gc" to run!
86
  }
87
  }
 
88
  }
89
 
90
  function wp_cache_get_response_headers() {
wp-cache.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Super Cache
4
  Plugin URI: http://ocaoimh.ie/wp-super-cache/
5
  Description: Very fast caching plugin for WordPress.
6
- Version: 0.9.3.1
7
  Author: Donncha O Caoimh
8
  Author URI: http://ocaoimh.ie/
9
  */
@@ -112,7 +112,7 @@ add_action('admin_menu', 'wp_cache_add_pages');
112
  function wp_cache_manager() {
113
  global $wp_cache_config_file, $valid_nonce, $supercachedir, $cache_path, $cache_enabled, $cache_compression, $super_cache_enabled, $wp_cache_hello_world;
114
  global $wp_cache_clear_on_post_edit, $cache_rebuild_files, $wp_cache_mutex_disabled, $wp_cache_mobile_enabled, $wp_cache_mobile_whitelist, $wp_cache_mobile_browsers;
115
- global $wp_cache_cron_check, $wp_cache_debug, $wp_cache_hide_donation;
116
 
117
  if( function_exists( 'is_site_admin' ) )
118
  if( !is_site_admin() )
@@ -307,6 +307,10 @@ jQuery(document).ready(function(){
307
  $wp_cache_hide_donation = intval( $_POST[ 'wp_cache_hide_donation' ] );
308
  wp_cache_replace_line('^ *\$wp_cache_hide_donation', "\$wp_cache_hide_donation = " . $wp_cache_hide_donation . ";", $wp_cache_config_file);
309
  }
 
 
 
 
310
  }
311
 
312
  ?>
@@ -317,6 +321,7 @@ jQuery(document).ready(function(){
317
  <label><input type='radio' name='wp_cache_status' value='all' <?php if( $cache_enabled == true && $super_cache_enabled == true ) { echo 'checked=checked'; } ?>> <strong>ON</strong> <span class="setting-description">WP Cache and Super Cache enabled</span></label><br />
318
  <label><input type='radio' name='wp_cache_status' value='wpcache' <?php if( $cache_enabled == true && $super_cache_enabled == false ) { echo 'checked=checked'; } ?>> <strong>HALF ON</strong> <span class="setting-description">Super Cache Disabled, only legacy WP-Cache caching.</span></label><br />
319
  <label><input type='radio' name='wp_cache_status' value='none' <?php if( $cache_enabled == false ) { echo 'checked=checked'; } ?>> <strong>OFF</strong> <span class="setting-description">WP Cache and Super Cache disabled</span></label><br />
 
320
  <p><label><input type='checkbox' name='wp_cache_hello_world' <?php if( $wp_cache_hello_world ) echo "checked"; ?> value='1'> Proudly tell the world your server is Digg proof! (places a message in your blog's footer)</label></p>
321
  <p><label><input type='checkbox' name='wp_cache_clear_on_post_edit' <?php if( $wp_cache_clear_on_post_edit ) echo "checked"; ?> value='1'> Clear all cache files when a post or page is published. (This may significantly slow down saving of posts.)</label></p>
322
  <p><label><input type='checkbox' name='cache_rebuild_files' <?php if( $cache_rebuild_files ) echo "checked"; ?> value='1'> Cache rebuild. Serve a supercache file to anonymous users while a new file is being generated. Recommended for <em>very</em> busy websites with lots of comments. Makes "directly cached pages" and "Lockdown mode" obsolete.</label></p>
@@ -353,7 +358,7 @@ jQuery(document).ready(function(){
353
  <div style='background: #ffc; border: 1px solid #333; margin: 2px; padding: 5px'>
354
  <h3 align='center'>Make WordPress Faster</h3>
355
  <?php if( $wp_cache_hide_donation != 1 ) { ?>
356
- <p><a href="http://ocaoimh.ie/wp-super-cache/?r=wpsc">WP Super Cache</a> makes your blog go faster. Think that's worth $10? Click the "Donate" button below.</p>
357
  <p>Thanks!<br />Donncha O Caoimh.<br /></p>
358
  <div align='center'>
359
  <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
@@ -365,8 +370,8 @@ jQuery(document).ready(function(){
365
  <p>Don't show me this again. <form action="<?php echo $_SERVER["REQUEST_URI"]; ?>" method="post"><input type='hidden' name='wp_cache_hide_donation' value='1' /><input type='submit' value='Hide' /><?php wp_nonce_field('wp-cache'); ?></form></p>
366
  </div>
367
  <?php } else { ?>
368
- <p><a href="http://ocaoimh.ie/wp-super-cache/?r=supercache">WP Super Cache</a> is maintained and developed by <a href="http://ocaoimh.ie/?r=supercache">Donncha O Caoimh</a> with contributions from many others thanks to the GPL.</p>
369
- <p>He blogs at <a href="http://ocaoimh.ie/?r=supercache">Holy Shmoly</a> and posts photos at <a href="http://inphotos.org/?r=supercache">In Photos.org</a>. You can say hi to him on <a href="http://twitter.com/donncha/">Twitter</a> too!</p>
370
  <?php } ?>
371
  </div>
372
 
@@ -811,7 +816,7 @@ function wp_cache_edit_rejected() {
811
  global $cache_acceptable_files, $cache_rejected_uri, $wp_cache_config_file, $valid_nonce;
812
 
813
  if(isset($_REQUEST['wp_rejected_uri']) && $valid_nonce) {
814
- $text = wp_cache_sanitize_value($_REQUEST['wp_rejected_uri'], $cache_rejected_uri);
815
  wp_cache_replace_line('^ *\$cache_rejected_uri', "\$cache_rejected_uri = $text;", $wp_cache_config_file);
816
  }
817
 
@@ -820,7 +825,7 @@ function wp_cache_edit_rejected() {
820
  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's enough to specify the year, i.e. '/2004/'. WP-Cache will search if that string is part of the URI and if so, it will not cache that page.</p>\n";
821
  echo '<textarea name="wp_rejected_uri" cols="40" rows="4" style="width: 50%; font-size: 12px;" class="code">';
822
  foreach ($cache_rejected_uri as $file) {
823
- echo wp_specialchars($file) . "\n";
824
  }
825
  echo '</textarea> ';
826
  echo '<div class="submit"><input type="submit" ' . SUBMITDISABLED . 'value="Save Strings &raquo;" /></div>';
@@ -1139,6 +1144,7 @@ function wp_cache_files() {
1139
  $now = time();
1140
  if ( ($handle = @opendir( $blog_cache_dir . 'meta/' )) ) {
1141
  if ($list_files) echo "<table cellspacing=\"0\" cellpadding=\"5\">";
 
1142
  while ( false !== ($file = readdir($handle))) {
1143
  if ( preg_match("/^$file_prefix.*\.meta/", $file) ) {
1144
  $this_expired = false;
@@ -1146,6 +1152,7 @@ function wp_cache_files() {
1146
  $mtime = filemtime( $blog_cache_dir . 'meta/' . $file );
1147
  if ( ! ( $fsize = @filesize( $blog_cache_dir . $content_file ) ) )
1148
  continue; // .meta does not exists
 
1149
  $fsize = intval($fsize/1024);
1150
  $age = $now - $mtime;
1151
  if ( $age > $cache_max_time ) {
@@ -1177,6 +1184,18 @@ function wp_cache_files() {
1177
  closedir($handle);
1178
  if ($list_files) echo "</table>";
1179
  }
 
 
 
 
 
 
 
 
 
 
 
 
1180
  if( $cache_enabled == true && $super_cache_enabled == true ) {
1181
  $now = time();
1182
  $sizes = array( 'expired' => 0, 'cached' => 0, 'ts' => 0 );
@@ -1197,11 +1216,19 @@ function wp_cache_files() {
1197
  $sizes[ 'ts' ] = time();
1198
  }
1199
 
1200
- echo "<p><strong>WP-Cache</strong></p>";
1201
  echo "<ul><li>$count Cached Pages</li>";
1202
  echo "<li>$expired Expired Pages</li></ul>";
1203
  if( $cache_enabled == true && $super_cache_enabled == true ) {
1204
- echo "<p><strong>WP-Super-Cache</strong></p>";
 
 
 
 
 
 
 
 
1205
  echo "<ul><li>" . intval($sizes['cached']/2) . " Cached Pages</li>";
1206
  $age = intval(($now - $sizes['ts'])/60);
1207
  echo "<li>" . intval($sizes['expired']/2) . " Expired Pages</li></ul>";
@@ -1260,6 +1287,7 @@ function wpsc_dirsize($directory, $sizes) {
1260
  } else {
1261
  $sizes[ 'cached' ]+=1;
1262
  }
 
1263
  }
1264
  }
1265
  return $sizes;
3
  Plugin Name: WP Super Cache
4
  Plugin URI: http://ocaoimh.ie/wp-super-cache/
5
  Description: Very fast caching plugin for WordPress.
6
+ Version: 0.9.4
7
  Author: Donncha O Caoimh
8
  Author URI: http://ocaoimh.ie/
9
  */
112
  function wp_cache_manager() {
113
  global $wp_cache_config_file, $valid_nonce, $supercachedir, $cache_path, $cache_enabled, $cache_compression, $super_cache_enabled, $wp_cache_hello_world;
114
  global $wp_cache_clear_on_post_edit, $cache_rebuild_files, $wp_cache_mutex_disabled, $wp_cache_mobile_enabled, $wp_cache_mobile_whitelist, $wp_cache_mobile_browsers;
115
+ global $wp_cache_cron_check, $wp_cache_debug, $wp_cache_hide_donation, $wp_cache_not_logged_in;
116
 
117
  if( function_exists( 'is_site_admin' ) )
118
  if( !is_site_admin() )
307
  $wp_cache_hide_donation = intval( $_POST[ 'wp_cache_hide_donation' ] );
308
  wp_cache_replace_line('^ *\$wp_cache_hide_donation', "\$wp_cache_hide_donation = " . $wp_cache_hide_donation . ";", $wp_cache_config_file);
309
  }
310
+ if( isset( $_POST[ 'wp_cache_not_logged_in' ] ) && $_POST[ 'wp_cache_not_logged_in' ] != $wp_cache_not_logged_in ) {
311
+ $wp_cache_not_logged_in = intval( $_POST[ 'wp_cache_not_logged_in' ] );
312
+ wp_cache_replace_line('^ *\$wp_cache_not_logged_in', "\$wp_cache_not_logged_in = " . $wp_cache_not_logged_in . ";", $wp_cache_config_file);
313
+ }
314
  }
315
 
316
  ?>
321
  <label><input type='radio' name='wp_cache_status' value='all' <?php if( $cache_enabled == true && $super_cache_enabled == true ) { echo 'checked=checked'; } ?>> <strong>ON</strong> <span class="setting-description">WP Cache and Super Cache enabled</span></label><br />
322
  <label><input type='radio' name='wp_cache_status' value='wpcache' <?php if( $cache_enabled == true && $super_cache_enabled == false ) { echo 'checked=checked'; } ?>> <strong>HALF ON</strong> <span class="setting-description">Super Cache Disabled, only legacy WP-Cache caching.</span></label><br />
323
  <label><input type='radio' name='wp_cache_status' value='none' <?php if( $cache_enabled == false ) { echo 'checked=checked'; } ?>> <strong>OFF</strong> <span class="setting-description">WP Cache and Super Cache disabled</span></label><br />
324
+ <p><label><input type='checkbox' name='wp_cache_not_logged_in' <?php if( $wp_cache_not_logged_in ) echo "checked"; ?> value='1'> Don't cache pages for logged in users.</label></p>
325
  <p><label><input type='checkbox' name='wp_cache_hello_world' <?php if( $wp_cache_hello_world ) echo "checked"; ?> value='1'> Proudly tell the world your server is Digg proof! (places a message in your blog's footer)</label></p>
326
  <p><label><input type='checkbox' name='wp_cache_clear_on_post_edit' <?php if( $wp_cache_clear_on_post_edit ) echo "checked"; ?> value='1'> Clear all cache files when a post or page is published. (This may significantly slow down saving of posts.)</label></p>
327
  <p><label><input type='checkbox' name='cache_rebuild_files' <?php if( $cache_rebuild_files ) echo "checked"; ?> value='1'> Cache rebuild. Serve a supercache file to anonymous users while a new file is being generated. Recommended for <em>very</em> busy websites with lots of comments. Makes "directly cached pages" and "Lockdown mode" obsolete.</label></p>
358
  <div style='background: #ffc; border: 1px solid #333; margin: 2px; padding: 5px'>
359
  <h3 align='center'>Make WordPress Faster</h3>
360
  <?php if( $wp_cache_hide_donation != 1 ) { ?>
361
+ <p><a href="http://ocaoimh.ie/wp-super-cache/?r=wpsc">WP Super Cache</a> makes your blog go faster. That has to be worth $10 or a small gift. Click the "Donate" button below or take a quick peek at my <a href="http://ocaoimh.ie/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy5hbWF6b24uY28udWsvZ3AvcmVnaXN0cnkvMzVaQ0dJVTJBSDROQg==">wishlist</a>.</p>
362
  <p>Thanks!<br />Donncha O Caoimh.<br /></p>
363
  <div align='center'>
364
  <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
370
  <p>Don't show me this again. <form action="<?php echo $_SERVER["REQUEST_URI"]; ?>" method="post"><input type='hidden' name='wp_cache_hide_donation' value='1' /><input type='submit' value='Hide' /><?php wp_nonce_field('wp-cache'); ?></form></p>
371
  </div>
372
  <?php } else { ?>
373
+ <p><a href="http://ocaoimh.ie/wp-super-cache/?r=supercache">WP Super Cache</a> is maintained and developed by <a href="http://ocaoimh.ie/?r=supercache">Donncha O Caoimh</a> with contributions from many others.</p>
374
+ <p>He blogs at <a href="http://ocaoimh.ie/?r=supercache">Holy Shmoly</a>, posts photos at <a href="http://inphotos.org/?r=supercache">In Photos.org</a> and <a href="http://ocaoimh.ie/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy5hbWF6b24uY28udWsvZ3AvcmVnaXN0cnkvMzVaQ0dJVTJBSDROQg==">wishes</a> he had more time to read and relax.</p><p>Please say hi to him on <a href="http://twitter.com/donncha/">Twitter</a> too!</p>
375
  <?php } ?>
376
  </div>
377
 
816
  global $cache_acceptable_files, $cache_rejected_uri, $wp_cache_config_file, $valid_nonce;
817
 
818
  if(isset($_REQUEST['wp_rejected_uri']) && $valid_nonce) {
819
+ $text = wp_cache_sanitize_value( str_replace( '\\\\', '\\', $_REQUEST['wp_rejected_uri'] ), $cache_rejected_uri );
820
  wp_cache_replace_line('^ *\$cache_rejected_uri', "\$cache_rejected_uri = $text;", $wp_cache_config_file);
821
  }
822
 
825
  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's enough to specify the year, i.e. '/2004/'. WP-Cache will search if that string is part of the URI and if so, it will not cache that page.</p>\n";
826
  echo '<textarea name="wp_rejected_uri" cols="40" rows="4" style="width: 50%; font-size: 12px;" class="code">';
827
  foreach ($cache_rejected_uri as $file) {
828
+ echo wp_specialchars( $file ) . "\n";
829
  }
830
  echo '</textarea> ';
831
  echo '<div class="submit"><input type="submit" ' . SUBMITDISABLED . 'value="Save Strings &raquo;" /></div>';
1144
  $now = time();
1145
  if ( ($handle = @opendir( $blog_cache_dir . 'meta/' )) ) {
1146
  if ($list_files) echo "<table cellspacing=\"0\" cellpadding=\"5\">";
1147
+ $wp_cache_fsize = 0;
1148
  while ( false !== ($file = readdir($handle))) {
1149
  if ( preg_match("/^$file_prefix.*\.meta/", $file) ) {
1150
  $this_expired = false;
1152
  $mtime = filemtime( $blog_cache_dir . 'meta/' . $file );
1153
  if ( ! ( $fsize = @filesize( $blog_cache_dir . $content_file ) ) )
1154
  continue; // .meta does not exists
1155
+ $wp_cache_fsize += $fsize;
1156
  $fsize = intval($fsize/1024);
1157
  $age = $now - $mtime;
1158
  if ( $age > $cache_max_time ) {
1184
  closedir($handle);
1185
  if ($list_files) echo "</table>";
1186
  }
1187
+ if( $wp_cache_fsize != 0 ) {
1188
+ $wp_cache_fsize = $wp_cache_fsize/1024;
1189
+ } else {
1190
+ $wp_cache_fsize = 0;
1191
+ }
1192
+ if( $wp_cache_fsize > 1024 ) {
1193
+ $wp_cache_fsize = number_format( $wp_cache_fsize / 1024, 2 ) . "MB";
1194
+ } elseif( $wp_cache_fsize != 0 ) {
1195
+ $wp_cache_fsize = number_format( $wp_cache_fsize, 2 ) . "KB";
1196
+ } else {
1197
+ $wp_cache_fsize = '0KB';
1198
+ }
1199
  if( $cache_enabled == true && $super_cache_enabled == true ) {
1200
  $now = time();
1201
  $sizes = array( 'expired' => 0, 'cached' => 0, 'ts' => 0 );
1216
  $sizes[ 'ts' ] = time();
1217
  }
1218
 
1219
+ echo "<p><strong>WP-Cache ({$wp_cache_fsize})</strong></p>";
1220
  echo "<ul><li>$count Cached Pages</li>";
1221
  echo "<li>$expired Expired Pages</li></ul>";
1222
  if( $cache_enabled == true && $super_cache_enabled == true ) {
1223
+ $fsize = $sizes[ 'fsize' ] / 1024;
1224
+ if( $fsize > 1024 ) {
1225
+ $fsize = number_format( $fsize / 1024, 2 ) . "MB";
1226
+ } elseif( $fsize != 0 ) {
1227
+ $fsize = number_format( $fsize, 2 ) . "KB";
1228
+ } else {
1229
+ $fsize = "0KB";
1230
+ }
1231
+ echo "<p><strong>WP-Super-Cache ({$fsize})</strong></p>";
1232
  echo "<ul><li>" . intval($sizes['cached']/2) . " Cached Pages</li>";
1233
  $age = intval(($now - $sizes['ts'])/60);
1234
  echo "<li>" . intval($sizes['expired']/2) . " Expired Pages</li></ul>";
1287
  } else {
1288
  $sizes[ 'cached' ]+=1;
1289
  }
1290
+ $sizes[ 'fsize' ] += @filesize( $directory );
1291
  }
1292
  }
1293
  return $sizes;