WP Super Cache - Version 1.5.9

Version Description

Download this release

Release Info

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

Code changes from version 1.5.8 to 1.5.9

advanced-cache.php CHANGED
@@ -1,28 +1,30 @@
1
  <?php
2
- # WP SUPER CACHE 1.2
3
  function wpcache_broken_message() {
4
  global $wp_cache_config_file;
5
- if ( isset( $wp_cache_config_file ) == false )
6
  return '';
 
7
 
8
- $doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
9
  $xmlrpc_request = defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST;
10
- $rest_request = defined( 'REST_REQUEST' ) && REST_REQUEST;
11
- $robots_request = strpos( $_SERVER[ 'REQUEST_URI' ], 'robots.txt' ) != false;
12
 
13
- $skip_output = ( $doing_ajax || $xmlrpc_request || $rest_request || $robots_request);
14
- if ( false == strpos( $_SERVER[ 'REQUEST_URI' ], 'wp-admin' ) && !$skip_output ) {
15
- echo "<!-- WP Super Cache is installed but broken. The constant WPCACHEHOME must be set in the file wp-config.php and point at the WP Super Cache plugin directory. -->";
16
  }
17
  }
18
 
19
  if ( false == defined( 'WPCACHEHOME' ) ) {
20
  define( 'ADVANCEDCACHEPROBLEM', 1 );
21
- } elseif ( !include_once( WPCACHEHOME . 'wp-cache-phase1.php' ) ) {
22
- if ( !@is_file( WPCACHEHOME . 'wp-cache-phase1.php' ) ) {
23
  define( 'ADVANCEDCACHEPROBLEM', 1 );
24
  }
25
  }
26
- if ( defined( 'ADVANCEDCACHEPROBLEM' ) )
27
  register_shutdown_function( 'wpcache_broken_message' );
28
- ?>
 
1
  <?php
2
+ // WP SUPER CACHE 1.2
3
  function wpcache_broken_message() {
4
  global $wp_cache_config_file;
5
+ if ( isset( $wp_cache_config_file ) == false ) {
6
  return '';
7
+ }
8
 
9
+ $doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
10
  $xmlrpc_request = defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST;
11
+ $rest_request = defined( 'REST_REQUEST' ) && REST_REQUEST;
12
+ $robots_request = strpos( $_SERVER['REQUEST_URI'], 'robots.txt' ) != false;
13
 
14
+ $skip_output = ( $doing_ajax || $xmlrpc_request || $rest_request || $robots_request );
15
+ if ( false == strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) && ! $skip_output ) {
16
+ echo '<!-- WP Super Cache is installed but broken. The constant WPCACHEHOME must be set in the file wp-config.php and point at the WP Super Cache plugin directory. -->';
17
  }
18
  }
19
 
20
  if ( false == defined( 'WPCACHEHOME' ) ) {
21
  define( 'ADVANCEDCACHEPROBLEM', 1 );
22
+ } elseif ( ! include_once WPCACHEHOME . 'wp-cache-phase1.php' ) {
23
+ if ( ! @is_file( WPCACHEHOME . 'wp-cache-phase1.php' ) ) {
24
  define( 'ADVANCEDCACHEPROBLEM', 1 );
25
  }
26
  }
27
+ if ( defined( 'ADVANCEDCACHEPROBLEM' ) ) {
28
  register_shutdown_function( 'wpcache_broken_message' );
29
+ }
30
+
languages/wp-super-cache-sr_RS.po CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013
2
  # This file is distributed under the same license as the package.
3
  msgid ""
4
  msgstr ""
1
+ # Copyright (C) 2013
2
  # This file is distributed under the same license as the package.
3
  msgid ""
4
  msgstr ""
languages/wp-super-cache-zh_CN.po CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012
2
  # This file is distributed under the same license as the package.
3
  msgid ""
4
  msgstr ""
1
+ # Copyright (C) 2012
2
  # This file is distributed under the same license as the package.
3
  msgid ""
4
  msgstr ""
ossdl-cdn.php CHANGED
@@ -3,38 +3,47 @@
3
  /* Taken from OSSDL CDN off-linker, a plugin by W-Mark Kubacki (http://mark.ossdl.de/) and used with permission */
4
 
5
  /* Set up some defaults */
6
- if ( get_option( 'ossdl_off_cdn_url' ) == false )
7
  add_option( 'ossdl_off_cdn_url', get_option( 'siteurl' ) );
8
- if ( get_option( 'ossdl_off_blog_url' ) == false )
 
9
  add_option( 'ossdl_off_blog_url', apply_filters( 'ossdl_off_blog_url', untrailingslashit( get_option( 'siteurl' ) ) ) );
 
10
  $ossdl_off_blog_url = get_option( 'ossdl_off_blog_url' );
11
- $ossdl_off_cdn_url = trim( get_option('ossdl_off_cdn_url') );
12
- if ( get_option( 'ossdl_off_include_dirs' ) == false )
13
- add_option('ossdl_off_include_dirs', 'wp-content,wp-includes');
14
- $ossdl_off_include_dirs = trim(get_option('ossdl_off_include_dirs'));
15
- if ( get_option( 'ossdl_off_exclude' ) == false )
16
- add_option('ossdl_off_exclude', '.php');
17
- $ossdl_off_exclude = trim(get_option('ossdl_off_exclude'));
18
- $arr_of_excludes = array_map('trim', explode(',', $ossdl_off_exclude));
19
- if ( !is_array( $arr_of_excludes ) )
 
 
20
  $arr_of_excludes = array();
 
21
 
22
- if ( get_option( 'ossdl_cname' ) == false )
23
- add_option('ossdl_cname', '');
24
- $ossdl_cname = trim(get_option('ossdl_cname'));
25
- $ossdl_https = intval(get_option('ossdl_https'));
26
- $arr_of_cnames = array_map('trim', explode(',', $ossdl_cname));
27
- if ($arr_of_cnames[0] == '') $arr_of_cnames = array();
 
 
 
28
 
29
  /**
30
  * Determines whether to exclude a match.
31
  *
32
- * @param String $match URI to examine
33
- * @param Array $excludes array of "badwords"
34
- * @return Boolean true if to exclude given match from rewriting
 
35
  */
36
- function scossdl_off_exclude_match($match, $excludes) {
37
- foreach( $excludes as $badword ) {
38
  if ( ! empty( $badword ) && stripos( $match, $badword ) !== false ) {
39
  return true;
40
  }
@@ -42,14 +51,19 @@ function scossdl_off_exclude_match($match, $excludes) {
42
  return false;
43
  }
44
 
45
- /**
46
  * Compute string modulo, based on SHA1 hash
 
 
 
 
 
47
  */
48
- function scossdl_string_mod($s, $mod) {
49
  /* The full SHA1 is too large for PHP integer types. This should be
50
  * enough for our purpose */
51
- $n = hexdec(substr(sha1($s), 0, 5));
52
- return $n % $mod;
53
  }
54
 
55
  /**
@@ -57,29 +71,32 @@ function scossdl_string_mod($s, $mod) {
57
  *
58
  * Called by #scossdl_off_filter.
59
  */
60
- function scossdl_off_rewriter($match) {
61
  global $ossdl_off_blog_url, $ossdl_off_cdn_url, $arr_of_excludes, $arr_of_cnames, $ossdl_https;
62
 
63
- if ( $ossdl_off_cdn_url == '' )
64
  return $match[0];
 
65
 
66
- if ( $ossdl_https && substr( $match[0], 0, 5 ) == 'https' )
67
  return $match[0];
 
68
 
69
- if ( false == in_array( $ossdl_off_cdn_url, $arr_of_cnames ) )
70
  $arr_of_cnames[] = $ossdl_off_cdn_url;
 
71
 
72
  if ( scossdl_off_exclude_match( $match[0], $arr_of_excludes ) ) {
73
  return $match[0];
74
- } else {
75
- $include_dirs = scossdl_off_additional_directories();
76
- if ( preg_match( '/' . $include_dirs . '/', $match[0] ) ) {
77
- $offset = scossdl_string_mod($match[1], count($arr_of_cnames));
78
- return str_replace($ossdl_off_blog_url, $arr_of_cnames[$offset], $match[0]);
79
- } else {
80
- return $match[0];
81
- }
82
  }
 
 
 
 
 
 
 
 
83
  }
84
 
85
  /**
@@ -88,27 +105,29 @@ function scossdl_off_rewriter($match) {
88
  * @return String with the pattern with {@literal |} as prefix, or empty
89
  */
90
  function scossdl_off_additional_directories() {
91
- global $ossdl_off_include_dirs;
92
- $input = explode(',', $ossdl_off_include_dirs);
93
- if ($ossdl_off_include_dirs == '' || count($input) < 1) {
94
- return 'wp\-content|wp\-includes';
95
- } else {
96
- return implode('|', array_map('quotemeta', array_map('trim', $input)));
97
- }
 
98
  }
99
 
100
  /**
101
  * Output filter which runs the actual plugin logic.
102
  */
103
- function scossdl_off_filter($content) {
104
  global $ossdl_off_blog_url, $ossdl_off_cdn_url;
105
- if ($ossdl_off_blog_url == $ossdl_off_cdn_url) { // no rewrite needed
 
106
  return $content;
107
- } else {
108
- $dirs = scossdl_off_additional_directories();
109
- $regex = '#(?<=[(\"\'])'.quotemeta($ossdl_off_blog_url).'/(?:((?:'.$dirs.')[^\"\')]+)|([^/\"\']+\.[^/\"\')]+))(?=[\"\')])#';
110
- return preg_replace_callback($regex, 'scossdl_off_rewriter', $content);
111
  }
 
 
 
 
112
  }
113
 
114
  /**
@@ -116,40 +135,39 @@ function scossdl_off_filter($content) {
116
  */
117
  function do_scossdl_off_ob_start() {
118
  global $ossdl_off_blog_url, $ossdl_off_cdn_url;
119
- if ($ossdl_off_blog_url != $ossdl_off_cdn_url) {
120
  add_filter( 'wp_cache_ob_callback_filter', 'scossdl_off_filter' );
121
  }
122
  }
123
- if ( false == isset( $ossdlcdn ) )
124
  $ossdlcdn = 1; // have to default to on for existing users.
125
- if ( $ossdlcdn == 1 )
126
- add_action('init', 'do_scossdl_off_ob_start');
 
 
127
 
128
  function scossdl_off_update() {
129
- global $ossdlcdn, $wp_cache_config_file;
130
-
131
- $valid_nonce = isset($_REQUEST['_wpnonce']) ? wp_verify_nonce($_REQUEST['_wpnonce'], 'wp-cache') : false;
132
-
133
- if ( $valid_nonce && isset($_POST['action']) && ( $_POST['action'] == 'update_ossdl_off' )){
134
- update_option( 'ossdl_off_cdn_url', untrailingslashit( $_POST[ 'ossdl_off_cdn_url' ] ) );
135
- update_option( 'ossdl_off_blog_url', untrailingslashit( $_POST[ 'ossdl_off_blog_url' ] ) );
136
- update_option('ossdl_off_include_dirs', $_POST['ossdl_off_include_dirs'] == '' ? 'wp-content,wp-includes' : $_POST['ossdl_off_include_dirs']);
137
- update_option('ossdl_off_exclude', $_POST['ossdl_off_exclude']);
138
- update_option('ossdl_cname', $_POST['ossdl_cname']);
139
- if ( !isset( $_POST[ 'ossdl_https' ] ) )
140
- $_POST[ 'ossdl_https' ] = 0;
141
- update_option('ossdl_https', (int)$_POST['ossdl_https']);
142
- if ( isset( $_POST[ 'ossdlcdn' ] ) ) {
143
- $ossdlcdn = 1;
144
- } else {
145
- $ossdlcdn = 0;
146
- }
147
- wp_cache_replace_line('^ *\$ossdlcdn', "\$ossdlcdn = $ossdlcdn;", $wp_cache_config_file);
148
  }
149
  }
150
 
151
  function scossdl_off_options() {
152
- global $ossdlcdn, $wp_cache_config_file, $ossdl_off_blog_url;
153
 
154
  scossdl_off_update();
155
 
@@ -158,9 +176,9 @@ function scossdl_off_options() {
158
  $example_cnames .= ',' . str_replace( 'http://cdn.', 'http://cdn2.', $example_cdn_uri );
159
  $example_cnames .= ',' . str_replace( 'http://cdn.', 'http://cdn3.', $example_cdn_uri );
160
 
161
- $example_cdn_uri = get_option('ossdl_off_cdn_url') == get_option( 'siteurl' ) ? $example_cdn_uri : get_option('ossdl_off_cdn_url');
162
  $example_cdn_uri .= '/wp-includes/js/jquery/jquery-migrate.js';
163
- $example_cdn_uri = esc_url( $example_cdn_uri );
164
  ?>
165
  <p><?php _e( 'Your website probably uses lots of static files. Image, Javascript and CSS files are usually static files that could just as easily be served from another site or CDN. Therefore, this plugin replaces any links in the <code>wp-content</code> and <code>wp-includes</code> directories (except for PHP files) on your site with the URL you provide below. That way you can either copy all the static content to a dedicated host or mirror the files to a CDN by <a href="https://knowledgelayer.softlayer.com/faq/how-does-origin-pull-work" target="_blank">origin pull</a>.', 'wp-super-cache' ); ?></p>
166
  <p><?php printf( __( '<strong style="color: red">WARNING:</strong> Test some static urls e.g., %s to ensure your CDN service is fully working before saving changes.', 'wp-super-cache' ), '<code>' . esc_html( $example_cdn_uri ) . '</code>' ); ?></p>
@@ -171,11 +189,11 @@ function scossdl_off_options() {
171
 
172
  <p><?php _e( 'You can define different CDN URLs for each site on a multsite network.', 'wp-super-cache' ); ?></p>
173
  <p><form method="post" action="">
174
- <?php wp_nonce_field('wp-cache'); ?>
175
  <table class="form-table"><tbody>
176
  <tr valign="top">
177
  <td style='text-align: right'>
178
- <input id='ossdlcdn' type="checkbox" name="ossdlcdn" value="1" <?php if ( $ossdlcdn ) echo "checked=1"; ?> />
179
  </td>
180
  <th scope="row"><label for="ossdlcdn"><?php _e( 'Enable CDN Support', 'wp-super-cache' ); ?></label></th>
181
  </tr>
@@ -219,9 +237,8 @@ function scossdl_off_options() {
219
  </tr>
220
  </tbody></table>
221
  <input type="hidden" name="action" value="update_ossdl_off" />
222
- <p class="submit"><input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'wp-super-cache' ) ?>" /></p>
223
  </form></p>
224
- <p><?php _e( 'CDN functionality provided by <a href="http://wordpress.org/plugins/ossdl-cdn-off-linker/">OSSDL CDN Off Linker</a> by <a href="http://mark.ossdl.de/">Mark Kubacki</a>', 'wp-super-cache' ); ?></p>
225
  <?php
226
  }
227
- ?>
3
  /* Taken from OSSDL CDN off-linker, a plugin by W-Mark Kubacki (http://mark.ossdl.de/) and used with permission */
4
 
5
  /* Set up some defaults */
6
+ if ( get_option( 'ossdl_off_cdn_url' ) === false ) {
7
  add_option( 'ossdl_off_cdn_url', get_option( 'siteurl' ) );
8
+ }
9
+ if ( get_option( 'ossdl_off_blog_url' ) === false ) {
10
  add_option( 'ossdl_off_blog_url', apply_filters( 'ossdl_off_blog_url', untrailingslashit( get_option( 'siteurl' ) ) ) );
11
+ }
12
  $ossdl_off_blog_url = get_option( 'ossdl_off_blog_url' );
13
+ $ossdl_off_cdn_url = trim( get_option( 'ossdl_off_cdn_url' ) );
14
+ if ( get_option( 'ossdl_off_include_dirs' ) === false ) {
15
+ add_option( 'ossdl_off_include_dirs', 'wp-content,wp-includes' );
16
+ }
17
+ $ossdl_off_include_dirs = trim( get_option( 'ossdl_off_include_dirs' ) );
18
+ if ( get_option( 'ossdl_off_exclude' ) === false ) {
19
+ add_option( 'ossdl_off_exclude', '.php' );
20
+ }
21
+ $ossdl_off_exclude = trim( get_option( 'ossdl_off_exclude' ) );
22
+ $arr_of_excludes = array_map( 'trim', explode( ',', $ossdl_off_exclude ) );
23
+ if ( ! is_array( $arr_of_excludes ) ) {
24
  $arr_of_excludes = array();
25
+ }
26
 
27
+ if ( get_option( 'ossdl_cname' ) == false ) {
28
+ add_option( 'ossdl_cname', '' );
29
+ }
30
+ $ossdl_cname = trim( get_option( 'ossdl_cname' ) );
31
+ $ossdl_https = intval( get_option( 'ossdl_https' ) );
32
+ $arr_of_cnames = array_map( 'trim', explode( ',', $ossdl_cname ) );
33
+ if ( $arr_of_cnames[0] == '' ) {
34
+ $arr_of_cnames = array();
35
+ }
36
 
37
  /**
38
  * Determines whether to exclude a match.
39
  *
40
+ * @param string $match URI to examine.
41
+ * @param array $excludes Array of "badwords".
42
+ *
43
+ * @return boolean true if to exclude given match from rewriting.
44
  */
45
+ function scossdl_off_exclude_match( $match, $excludes ) {
46
+ foreach ( $excludes as $badword ) {
47
  if ( ! empty( $badword ) && stripos( $match, $badword ) !== false ) {
48
  return true;
49
  }
51
  return false;
52
  }
53
 
54
+ /**
55
  * Compute string modulo, based on SHA1 hash
56
+ *
57
+ * @param string $str
58
+ * @param int $mod
59
+ *
60
+ * @return int
61
  */
62
+ function scossdl_string_mod( $str, $mod ) {
63
  /* The full SHA1 is too large for PHP integer types. This should be
64
  * enough for our purpose */
65
+ $num = hexdec( substr( sha1( $str ), 0, 5 ) );
66
+ return $num % $mod;
67
  }
68
 
69
  /**
71
  *
72
  * Called by #scossdl_off_filter.
73
  */
74
+ function scossdl_off_rewriter( $match ) {
75
  global $ossdl_off_blog_url, $ossdl_off_cdn_url, $arr_of_excludes, $arr_of_cnames, $ossdl_https;
76
 
77
+ if ( $ossdl_off_cdn_url == '' ) {
78
  return $match[0];
79
+ }
80
 
81
+ if ( $ossdl_https && 0 === strncmp( $match[0], 'https', 5 ) ) {
82
  return $match[0];
83
+ }
84
 
85
+ if ( false === in_array( $ossdl_off_cdn_url, $arr_of_cnames ) ) {
86
  $arr_of_cnames[] = $ossdl_off_cdn_url;
87
+ }
88
 
89
  if ( scossdl_off_exclude_match( $match[0], $arr_of_excludes ) ) {
90
  return $match[0];
 
 
 
 
 
 
 
 
91
  }
92
+
93
+ $include_dirs = scossdl_off_additional_directories();
94
+ if ( preg_match( '/' . $include_dirs . '/', $match[0] ) ) {
95
+ $offset = scossdl_string_mod( $match[1], count( $arr_of_cnames ) );
96
+ return str_replace( $ossdl_off_blog_url, $arr_of_cnames[ $offset ], $match[0] );
97
+ }
98
+
99
+ return $match[0];
100
  }
101
 
102
  /**
105
  * @return String with the pattern with {@literal |} as prefix, or empty
106
  */
107
  function scossdl_off_additional_directories() {
108
+ global $ossdl_off_include_dirs;
109
+
110
+ $arr_dirs = explode( ',', $ossdl_off_include_dirs );
111
+ if ( $ossdl_off_include_dirs == '' || count( $arr_dirs ) < 1 ) {
112
+ return 'wp\-content|wp\-includes';
113
+ }
114
+
115
+ return implode( '|', array_map( 'preg_quote', array_map( 'trim', $arr_dirs ) ) );
116
  }
117
 
118
  /**
119
  * Output filter which runs the actual plugin logic.
120
  */
121
+ function scossdl_off_filter( $content ) {
122
  global $ossdl_off_blog_url, $ossdl_off_cdn_url;
123
+
124
+ if ( $ossdl_off_blog_url == $ossdl_off_cdn_url ) { // no rewrite needed
125
  return $content;
 
 
 
 
126
  }
127
+
128
+ $dirs = scossdl_off_additional_directories();
129
+ $regex = '#(?<=[(\"\'])' . preg_quote( $ossdl_off_blog_url ) . '/(?:((?:' . $dirs . ')[^\"\')]+)|([^/\"\']+\.[^/\"\')]+))(?=[\"\')])#';
130
+ return preg_replace_callback( $regex, 'scossdl_off_rewriter', $content );
131
  }
132
 
133
  /**
135
  */
136
  function do_scossdl_off_ob_start() {
137
  global $ossdl_off_blog_url, $ossdl_off_cdn_url;
138
+ if ( $ossdl_off_blog_url != $ossdl_off_cdn_url ) {
139
  add_filter( 'wp_cache_ob_callback_filter', 'scossdl_off_filter' );
140
  }
141
  }
142
+ if ( false == isset( $ossdlcdn ) ) {
143
  $ossdlcdn = 1; // have to default to on for existing users.
144
+ }
145
+ if ( $ossdlcdn == 1 ) {
146
+ add_action( 'init', 'do_scossdl_off_ob_start' );
147
+ }
148
 
149
  function scossdl_off_update() {
150
+
151
+ if ( isset( $_POST['action'], $_POST['_wpnonce'] )
152
+ && 'update_ossdl_off' === $_POST['action']
153
+ && wp_verify_nonce( $_POST['_wpnonce'], 'wp-cache' )
154
+ ) {
155
+ update_option( 'ossdl_off_cdn_url', untrailingslashit( $_POST['ossdl_off_cdn_url'] ) );
156
+ update_option( 'ossdl_off_blog_url', untrailingslashit( $_POST['ossdl_off_blog_url'] ) );
157
+ update_option( 'ossdl_off_include_dirs', $_POST['ossdl_off_include_dirs'] == '' ? 'wp-content,wp-includes' : $_POST['ossdl_off_include_dirs'] );
158
+ update_option( 'ossdl_off_exclude', $_POST['ossdl_off_exclude'] );
159
+ update_option( 'ossdl_cname', $_POST['ossdl_cname'] );
160
+
161
+ $ossdl_https = empty( $_POST['ossdl_https'] ) ? 0 : 1;
162
+ $ossdlcdn = empty( $_POST['ossdlcdn'] ) ? 0 : 1;
163
+
164
+ update_option( 'ossdl_https', $ossdl_https );
165
+ wp_cache_setting( 'ossdlcdn', $ossdlcdn );
 
 
 
166
  }
167
  }
168
 
169
  function scossdl_off_options() {
170
+ global $ossdlcdn, $ossdl_off_blog_url;
171
 
172
  scossdl_off_update();
173
 
176
  $example_cnames .= ',' . str_replace( 'http://cdn.', 'http://cdn2.', $example_cdn_uri );
177
  $example_cnames .= ',' . str_replace( 'http://cdn.', 'http://cdn3.', $example_cdn_uri );
178
 
179
+ $example_cdn_uri = get_option( 'ossdl_off_cdn_url' ) == get_option( 'siteurl' ) ? $example_cdn_uri : get_option( 'ossdl_off_cdn_url' );
180
  $example_cdn_uri .= '/wp-includes/js/jquery/jquery-migrate.js';
181
+ $example_cdn_uri = esc_url( $example_cdn_uri );
182
  ?>
183
  <p><?php _e( 'Your website probably uses lots of static files. Image, Javascript and CSS files are usually static files that could just as easily be served from another site or CDN. Therefore, this plugin replaces any links in the <code>wp-content</code> and <code>wp-includes</code> directories (except for PHP files) on your site with the URL you provide below. That way you can either copy all the static content to a dedicated host or mirror the files to a CDN by <a href="https://knowledgelayer.softlayer.com/faq/how-does-origin-pull-work" target="_blank">origin pull</a>.', 'wp-super-cache' ); ?></p>
184
  <p><?php printf( __( '<strong style="color: red">WARNING:</strong> Test some static urls e.g., %s to ensure your CDN service is fully working before saving changes.', 'wp-super-cache' ), '<code>' . esc_html( $example_cdn_uri ) . '</code>' ); ?></p>
189
 
190
  <p><?php _e( 'You can define different CDN URLs for each site on a multsite network.', 'wp-super-cache' ); ?></p>
191
  <p><form method="post" action="">
192
+ <?php wp_nonce_field( 'wp-cache' ); ?>
193
  <table class="form-table"><tbody>
194
  <tr valign="top">
195
  <td style='text-align: right'>
196
+ <input id='ossdlcdn' type="checkbox" name="ossdlcdn" value="1" <?php if ( $ossdlcdn ) { echo "checked=1"; } ?> />
197
  </td>
198
  <th scope="row"><label for="ossdlcdn"><?php _e( 'Enable CDN Support', 'wp-super-cache' ); ?></label></th>
199
  </tr>
237
  </tr>
238
  </tbody></table>
239
  <input type="hidden" name="action" value="update_ossdl_off" />
240
+ <p class="submit"><input type="submit" class="button-primary" value="<?php _e( 'Save Changes', 'wp-super-cache' ); ?>" /></p>
241
  </form></p>
242
+ <p><?php _e( 'CDN functionality provided by <a href="https://wordpress.org/plugins/ossdl-cdn-off-linker/">OSSDL CDN Off Linker</a> by <a href="http://mark.ossdl.de/">Mark Kubacki</a>', 'wp-super-cache' ); ?></p>
243
  <?php
244
  }
 
plugins/awaitingmoderation.php CHANGED
@@ -7,21 +7,21 @@ function awaitingmoderation_action( $buffer ) {
7
 
8
  function awaitingmoderation_actions() {
9
  global $cache_awaitingmoderation;
10
- if( $cache_awaitingmoderation == '1' ) {
11
  add_filter( 'wpsupercache_buffer', 'awaitingmoderation_action' );
12
  }
13
  }
14
  add_cacheaction( 'add_cacheaction', 'awaitingmoderation_actions' );
15
 
16
- //Your comment is awaiting moderation.
17
  function wp_supercache_awaitingmoderation_admin() {
18
  global $cache_awaitingmoderation, $wp_cache_config_file, $valid_nonce;
19
 
20
- $cache_awaitingmoderation = $cache_awaitingmoderation == '' ? '0' : $cache_awaitingmoderation;
21
 
22
- if(isset($_POST['cache_awaitingmoderation']) && $valid_nonce) {
23
- $cache_awaitingmoderation = (int)$_POST['cache_awaitingmoderation'];
24
- wp_cache_replace_line('^ *\$cache_awaitingmoderation', "\$cache_awaitingmoderation = '$cache_awaitingmoderation';", $wp_cache_config_file);
25
  $changed = true;
26
  } else {
27
  $changed = false;
@@ -31,19 +31,20 @@ function wp_supercache_awaitingmoderation_admin() {
31
  <fieldset id="<?php echo $id; ?>" class="options">
32
  <h4><?php _e( 'Awaiting Moderation', 'wp-super-cache' ); ?></h4>
33
  <form name="wp_manager" action="" method="post">
34
- <label><input type="radio" name="cache_awaitingmoderation" value="1" <?php if( $cache_awaitingmoderation ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Enabled', 'wp-super-cache' ); ?></label>
35
- <label><input type="radio" name="cache_awaitingmoderation" value="0" <?php if( !$cache_awaitingmoderation ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Disabled', 'wp-super-cache' ); ?></label>
36
  <p><?php _e( 'Enables or disables plugin to Remove the text "Your comment is awaiting moderation." when someone leaves a moderated comment.', 'wp-super-cache' ); ?></p>
37
  <?php
38
- if ($changed) {
39
- if ( $cache_awaitingmoderation )
40
- $status = __( "enabled", 'wp-super-cache' );
41
- else
42
- $status = __( "disabled", 'wp-super-cache' );
43
- echo "<p><strong>" . sprintf( __( "Awaiting Moderation is now %s", 'wp-super-cache' ), $status ) . "</strong></p>";
 
44
  }
45
- echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
46
- wp_nonce_field('wp-cache');
47
  ?>
48
  </form>
49
  </fieldset>
@@ -53,13 +54,12 @@ function wp_supercache_awaitingmoderation_admin() {
53
  add_cacheaction( 'cache_admin_page', 'wp_supercache_awaitingmoderation_admin' );
54
 
55
  function wpsc_awaiting_moderation_list( $list ) {
56
- $list[ 'awaitingmoderation' ] = array(
57
- 'key' => 'awaitingmoderation',
58
- 'url' => '',
59
  'title' => __( 'Awaiting Moderation', 'wp-super-cache' ),
60
- 'desc' => __( 'Enables or disables plugin to Remove the text "Your comment is awaiting moderation." when someone leaves a moderated comment.', 'wp-super-cache' ),
61
  );
62
  return $list;
63
  }
64
  add_cacheaction( 'wpsc_filter_list', 'wpsc_awaiting_moderation_list' );
65
- ?>
7
 
8
  function awaitingmoderation_actions() {
9
  global $cache_awaitingmoderation;
10
+ if ( '1' === $cache_awaitingmoderation ) {
11
  add_filter( 'wpsupercache_buffer', 'awaitingmoderation_action' );
12
  }
13
  }
14
  add_cacheaction( 'add_cacheaction', 'awaitingmoderation_actions' );
15
 
16
+ // Your comment is awaiting moderation.
17
  function wp_supercache_awaitingmoderation_admin() {
18
  global $cache_awaitingmoderation, $wp_cache_config_file, $valid_nonce;
19
 
20
+ $cache_awaitingmoderation = '' === $cache_awaitingmoderation ? '0' : $cache_awaitingmoderation;
21
 
22
+ if ( isset( $_POST['cache_awaitingmoderation'] ) && $valid_nonce ) {
23
+ $cache_awaitingmoderation = (int) $_POST['cache_awaitingmoderation'];
24
+ wp_cache_replace_line( '^ *\$cache_awaitingmoderation', "\$cache_awaitingmoderation = '$cache_awaitingmoderation';", $wp_cache_config_file );
25
  $changed = true;
26
  } else {
27
  $changed = false;
31
  <fieldset id="<?php echo $id; ?>" class="options">
32
  <h4><?php _e( 'Awaiting Moderation', 'wp-super-cache' ); ?></h4>
33
  <form name="wp_manager" action="" method="post">
34
+ <label><input type="radio" name="cache_awaitingmoderation" value="1" <?php if ( $cache_awaitingmoderation ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Enabled', 'wp-super-cache' ); ?></label>
35
+ <label><input type="radio" name="cache_awaitingmoderation" value="0" <?php if ( ! $cache_awaitingmoderation ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Disabled', 'wp-super-cache' ); ?></label>
36
  <p><?php _e( 'Enables or disables plugin to Remove the text "Your comment is awaiting moderation." when someone leaves a moderated comment.', 'wp-super-cache' ); ?></p>
37
  <?php
38
+ if ( $changed ) {
39
+ if ( $cache_awaitingmoderation ) {
40
+ $status = __( 'enabled', 'wp-super-cache' );
41
+ } else {
42
+ $status = __( 'disabled', 'wp-super-cache' );
43
+ }
44
+ echo '<p><strong>' . sprintf( __( 'Awaiting Moderation is now %s', 'wp-super-cache' ), $status ) . '</strong></p>';
45
  }
46
+ echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
47
+ wp_nonce_field( 'wp-cache' );
48
  ?>
49
  </form>
50
  </fieldset>
54
  add_cacheaction( 'cache_admin_page', 'wp_supercache_awaitingmoderation_admin' );
55
 
56
  function wpsc_awaiting_moderation_list( $list ) {
57
+ $list['awaitingmoderation'] = array(
58
+ 'key' => 'awaitingmoderation',
59
+ 'url' => '',
60
  'title' => __( 'Awaiting Moderation', 'wp-super-cache' ),
61
+ 'desc' => __( 'Enables or disables plugin to Remove the text "Your comment is awaiting moderation." when someone leaves a moderated comment.', 'wp-super-cache' ),
62
  );
63
  return $list;
64
  }
65
  add_cacheaction( 'wpsc_filter_list', 'wpsc_awaiting_moderation_list' );
 
plugins/badbehaviour.php CHANGED
@@ -3,8 +3,9 @@
3
  function wp_supercache_badbehaviour( $file ) {
4
  global $cache_badbehaviour;
5
 
6
- if( $cache_badbehaviour != 1 )
7
  return $file;
 
8
  wp_supercache_badbehaviour_include();
9
  return $file;
10
  }
@@ -12,18 +13,20 @@ add_cacheaction( 'wp_cache_served_cache_file', 'wp_supercache_badbehaviour' );
12
 
13
  function wp_supercache_badbehaviour_include() {
14
  $bbfile = get_bb_file_loc();
15
- if( !$bbfile )
16
- require_once( $bbfile );
 
17
  }
18
 
19
  function get_bb_file_loc() {
20
  global $cache_badbehaviour_file;
21
- if( $cache_badbehaviour_file )
22
  return $cache_badbehaviour_file;
 
23
 
24
- if( file_exists( WP_CONTENT_DIR . '/plugins/bad-behavior/bad-behavior-generic.php' ) ) {
25
  $bbfile = WP_CONTENT_DIR . '/plugins/bad-behavior/bad-behavior-generic.php';
26
- } elseif( file_exists( WP_CONTENT_DIR . '/plugins/Bad-Behavior/bad-behavior-generic.php' ) ) {
27
  $bbfile = WP_CONTENT_DIR . '/plugins/Bad-Behavior/bad-behavior-generic.php';
28
  } else {
29
  $bbfile = false;
@@ -34,27 +37,28 @@ function get_bb_file_loc() {
34
  function wp_supercache_badbehaviour_admin() {
35
  global $cache_badbehaviour, $wp_cache_config_file, $valid_nonce;
36
 
37
- $cache_badbehaviour = $cache_badbehaviour == '' ? 0 : $cache_badbehaviour;
38
- if ( $cache_badbehaviour == 'no' )
39
  $cache_badbehaviour = 0;
 
40
 
41
  $err = false;
42
 
43
  if ( isset( $_POST['cache_badbehaviour'] ) && $valid_nonce ) {
44
  $bbfile = get_bb_file_loc();
45
- if( !$bbfile ) {
46
- $_POST[ 'cache_badbehaviour' ] = 0;
47
  $err = __( 'Bad Behaviour not found. Please check your install.', 'wp-super-cache' );
48
  }
49
- if ( $cache_badbehaviour == (int)$_POST['cache_badbehaviour'] ) {
50
  $changed = false;
51
  } else {
52
  $changed = true;
53
  }
54
- $cache_badbehaviour = (int)$_POST['cache_badbehaviour'];
55
- wp_cache_replace_line('^ *\$cache_compression', "\$cache_compression = 0;", $wp_cache_config_file);
56
- wp_cache_replace_line('^ *\$cache_badbehaviour', "\$cache_badbehaviour = $cache_badbehaviour;", $wp_cache_config_file);
57
- wp_cache_replace_line('^ *\$cache_badbehaviour_file', "\$cache_badbehaviour_file = '$bbfile';", $wp_cache_config_file);
58
  $changed = true;
59
  }
60
  $id = 'badbehavior-section';
@@ -62,31 +66,33 @@ function wp_supercache_badbehaviour_admin() {
62
  <fieldset id="<?php echo $id; ?>" class="options">
63
  <h4><?php _e( 'Bad Behavior', 'wp-super-cache' ); ?></h4>
64
  <form name="wp_manager" action="" method="post">
65
- <label><input type="radio" name="cache_badbehaviour" value="1" <?php if( $cache_badbehaviour ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Enabled', 'wp-super-cache' ); ?></label>
66
- <label><input type="radio" name="cache_badbehaviour" value="0" <?php if( !$cache_badbehaviour ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Disabled', 'wp-super-cache' ); ?></label>
67
  <p><?php _e( '', 'wp-super-cache' ); ?></p><?php
68
  echo '<p>' . sprintf( __( '(Only WPCache caching supported, disabled compression and requires <a href="http://www.bad-behavior.ioerror.us/">Bad Behavior</a> in "%s/plugins/bad-behavior/") ', 'wp-super-cache' ), WP_CONTENT_DIR ) . '</p>';
69
  if ( isset( $changed ) && $changed ) {
70
- if ( $cache_badbehaviour )
71
- $status = __( "enabled", 'wp-super-cache' );
72
- else
73
- $status = __( "disabled", 'wp-super-cache' );
74
- echo "<p><strong>" . sprintf( __( "Bad Behavior support is now %s", 'wp-super-cache' ), $status ) . "</strong></p>";
 
75
  }
76
- echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
77
- wp_nonce_field('wp-cache');
78
  ?>
79
  </form>
80
  </fieldset>
81
  <?php
82
- if( $err )
83
- echo "<p><strong>" . __( 'Warning!', 'wp-super-cache' ) . "</strong> $err</p>";
 
84
 
85
  }
86
  add_cacheaction( 'cache_admin_page', 'wp_supercache_badbehaviour_admin' );
87
 
88
  function wpsc_badbehaviour_list( $list ) {
89
- $list[ 'badbehaviour' ] = array(
90
  'key' => 'badbehaviour',
91
  'url' => 'http://www.bad-behavior.ioerror.us/',
92
  'title' => __( 'Bad Behavior', 'wp-super-cache' ),
@@ -95,5 +101,3 @@ function wpsc_badbehaviour_list( $list ) {
95
  return $list;
96
  }
97
  add_cacheaction( 'wpsc_filter_list', 'wpsc_badbehaviour_list' );
98
-
99
- ?>
3
  function wp_supercache_badbehaviour( $file ) {
4
  global $cache_badbehaviour;
5
 
6
+ if ( 1 !== $cache_badbehaviour ) {
7
  return $file;
8
+ }
9
  wp_supercache_badbehaviour_include();
10
  return $file;
11
  }
13
 
14
  function wp_supercache_badbehaviour_include() {
15
  $bbfile = get_bb_file_loc();
16
+ if ( ! $bbfile ) {
17
+ require_once $bbfile;
18
+ }
19
  }
20
 
21
  function get_bb_file_loc() {
22
  global $cache_badbehaviour_file;
23
+ if ( $cache_badbehaviour_file ) {
24
  return $cache_badbehaviour_file;
25
+ }
26
 
27
+ if ( file_exists( WP_CONTENT_DIR . '/plugins/bad-behavior/bad-behavior-generic.php' ) ) {
28
  $bbfile = WP_CONTENT_DIR . '/plugins/bad-behavior/bad-behavior-generic.php';
29
+ } elseif ( file_exists( WP_CONTENT_DIR . '/plugins/Bad-Behavior/bad-behavior-generic.php' ) ) {
30
  $bbfile = WP_CONTENT_DIR . '/plugins/Bad-Behavior/bad-behavior-generic.php';
31
  } else {
32
  $bbfile = false;
37
  function wp_supercache_badbehaviour_admin() {
38
  global $cache_badbehaviour, $wp_cache_config_file, $valid_nonce;
39
 
40
+ $cache_badbehaviour = '' === $cache_badbehaviour ? 0 : $cache_badbehaviour;
41
+ if ( 'no' === $cache_badbehaviour ) {
42
  $cache_badbehaviour = 0;
43
+ }
44
 
45
  $err = false;
46
 
47
  if ( isset( $_POST['cache_badbehaviour'] ) && $valid_nonce ) {
48
  $bbfile = get_bb_file_loc();
49
+ if ( ! $bbfile ) {
50
+ $_POST['cache_badbehaviour'] = 0;
51
  $err = __( 'Bad Behaviour not found. Please check your install.', 'wp-super-cache' );
52
  }
53
+ if ( $cache_badbehaviour === (int) $_POST['cache_badbehaviour'] ) {
54
  $changed = false;
55
  } else {
56
  $changed = true;
57
  }
58
+ $cache_badbehaviour = (int) $_POST['cache_badbehaviour'];
59
+ wp_cache_replace_line( '^ *\$cache_compression', "\$cache_compression = 0;", $wp_cache_config_file );
60
+ wp_cache_replace_line( '^ *\$cache_badbehaviour', "\$cache_badbehaviour = $cache_badbehaviour;", $wp_cache_config_file );
61
+ wp_cache_replace_line( '^ *\$cache_badbehaviour_file', "\$cache_badbehaviour_file = '$bbfile';", $wp_cache_config_file );
62
  $changed = true;
63
  }
64
  $id = 'badbehavior-section';
66
  <fieldset id="<?php echo $id; ?>" class="options">
67
  <h4><?php _e( 'Bad Behavior', 'wp-super-cache' ); ?></h4>
68
  <form name="wp_manager" action="" method="post">
69
+ <label><input type="radio" name="cache_badbehaviour" value="1" <?php if ( $cache_badbehaviour ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Enabled', 'wp-super-cache' ); ?></label>
70
+ <label><input type="radio" name="cache_badbehaviour" value="0" <?php if ( ! $cache_badbehaviour ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Disabled', 'wp-super-cache' ); ?></label>
71
  <p><?php _e( '', 'wp-super-cache' ); ?></p><?php
72
  echo '<p>' . sprintf( __( '(Only WPCache caching supported, disabled compression and requires <a href="http://www.bad-behavior.ioerror.us/">Bad Behavior</a> in "%s/plugins/bad-behavior/") ', 'wp-super-cache' ), WP_CONTENT_DIR ) . '</p>';
73
  if ( isset( $changed ) && $changed ) {
74
+ if ( $cache_badbehaviour ) {
75
+ $status = __( 'enabled', 'wp-super-cache' );
76
+ } else {
77
+ $status = __( 'disable', 'wp-super-cache' );
78
+ }
79
+ echo '<p><strong>' . sprintf( __( 'Bad Behavior support is now %s', 'wp-super-cache' ), $status ) . '</strong></p>';
80
  }
81
+ echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
82
+ wp_nonce_field( 'wp-cache' );
83
  ?>
84
  </form>
85
  </fieldset>
86
  <?php
87
+ if ( $err ) {
88
+ echo '<p><strong>' . __( 'Warning!', 'wp-super-cache' ) . "</strong> $err</p>";
89
+ }
90
 
91
  }
92
  add_cacheaction( 'cache_admin_page', 'wp_supercache_badbehaviour_admin' );
93
 
94
  function wpsc_badbehaviour_list( $list ) {
95
+ $list['badbehaviour'] = array(
96
  'key' => 'badbehaviour',
97
  'url' => 'http://www.bad-behavior.ioerror.us/',
98
  'title' => __( 'Bad Behavior', 'wp-super-cache' ),
101
  return $list;
102
  }
103
  add_cacheaction( 'wpsc_filter_list', 'wpsc_badbehaviour_list' );
 
 
plugins/domain-mapping.php CHANGED
@@ -3,28 +3,31 @@
3
  function domain_mapping_gc_cache( $function, $directory ) {
4
  global $cache_path;
5
 
6
- if ( !function_exists( 'domain_mapping_warning' ) )
7
  return false;
 
8
 
9
  $siteurl = domain_mapping_siteurl( false );
10
- if ( !$siteurl )
11
  return false;
 
12
 
13
- $protocol = ( isset( $_SERVER['HTTPS' ] ) && 'on' == strtolower( $_SERVER['HTTPS' ] ) ) ? 'https://' : 'http://';
14
- $siteurl = trailingslashit( str_replace( $protocol, '', $siteurl ) );
15
 
16
- if ( $directory == 'homepage' )
17
  $directory = '';
 
18
 
19
- switch( $function ) {
20
- case "rebuild":
21
  @wp_cache_rebuild_or_delete( $cache_path . 'supercache/' . $siteurl . $directory . 'index.html' );
22
  @wp_cache_rebuild_or_delete( $cache_path . 'supercache/' . $siteurl . $directory . 'index.html.gz' );
23
- break;
24
- case "prune":
25
  prune_super_cache( $cache_path . 'supercache/' . $siteurl . $directory . 'index.html', true, true );
26
  prune_super_cache( $cache_path . 'supercache/' . $siteurl . $directory . 'index.html.gz', true, true );
27
- break;
28
  }
29
 
30
  return $directory;
@@ -32,21 +35,23 @@ function domain_mapping_gc_cache( $function, $directory ) {
32
 
33
  function domain_mapping_supercachedir( $dir ) {
34
  global $cache_path;
35
- if ( !function_exists( 'domain_mapping_warning' ) )
36
  return $dir;
 
37
 
38
  $siteurl = domain_mapping_siteurl( false );
39
- if ( !$siteurl )
40
  return $dir;
 
41
 
42
- $protocol = ( isset( $_SERVER['HTTPS' ] ) && 'on' == strtolower( $_SERVER['HTTPS' ] ) ) ? 'https://' : 'http://';
43
- $siteurl = str_replace( $protocol, '', $siteurl );
44
  return trailingslashit( $cache_path . 'supercache/' . $siteurl );
45
  }
46
 
47
  function domain_mapping_actions() {
48
  global $cache_domain_mapping;
49
- if( $cache_domain_mapping == '1' ) {
50
  add_filter( 'wp_super_cache_supercachedir', 'domain_mapping_supercachedir' );
51
  add_action( 'gc_cache', 'domain_mapping_gc_cache', 10, 2 );
52
  }
@@ -56,35 +61,37 @@ add_cacheaction( 'add_cacheaction', 'domain_mapping_actions' );
56
  function wp_supercache_domain_mapping_admin() {
57
  global $cache_domain_mapping, $wp_cache_config_file, $valid_nonce;
58
 
59
- $cache_domain_mapping = $cache_domain_mapping == '' ? '0' : $cache_domain_mapping;
60
 
61
- if(isset($_POST['cache_domain_mapping']) && $valid_nonce) {
62
- if ( $cache_domain_mapping == (int)$_POST['cache_domain_mapping'] ) {
63
  $changed = false;
64
  } else {
65
  $changed = true;
66
  }
67
- $cache_domain_mapping = (int)$_POST['cache_domain_mapping'];
68
- wp_cache_replace_line('^ *\$cache_domain_mapping', "\$cache_domain_mapping = '$cache_domain_mapping';", $wp_cache_config_file);
69
  }
70
  $id = 'domain_mapping-section';
71
  ?>
72
  <fieldset id="<?php echo $id; ?>" class="options">
73
  <h4><?php _e( 'Domain Mapping', 'wp-super-cache' ); ?></h4>
74
  <form name="wp_manager" action="" method="post">
75
- <label><input type="radio" name="cache_domain_mapping" value="1" <?php if( $cache_domain_mapping ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Enabled', 'wp-super-cache' ); ?></label>
76
- <label><input type="radio" name="cache_domain_mapping" value="0" <?php if( !$cache_domain_mapping ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Disabled', 'wp-super-cache' ); ?></label>
77
- <p><?php _e( '', 'wp-super-cache' ); ?></p><?php
78
- echo '<p>' . __( 'Provides support for <a href="http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/">Domain Mapping</a> plugin to map multiple domains to a blog.', 'wp-super-cache' ) . '</p>';
79
- if ( isset( $changed ) && $changed ) {
80
- if ( $cache_domain_mapping )
81
- $status = __( "enabled", 'wp-super-cache' );
82
- else
83
- $status = __( "disabled", 'wp-super-cache' );
84
- echo "<p><strong>" . sprintf( __( "Domain Mapping support is now %s", 'wp-super-cache' ), $status ) . "</strong></p>";
85
  }
 
 
86
  echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
87
- wp_nonce_field('wp-cache');
88
  ?>
89
  </form>
90
  </fieldset>
@@ -94,31 +101,32 @@ add_cacheaction( 'cache_admin_page', 'wp_supercache_domain_mapping_admin' );
94
 
95
  function wp_supercache_domain_mapping_notice() {
96
  global $cache_enabled;
97
- if( $cache_enabled )
98
- echo '<div class="error"><p><strong>' . __('Domain Mapping plugin detected! Please go to the Supercache plugins page and enable the domain mapping helper plugin.', 'wp-super-cache' ) . '</strong></p></div>';
 
99
  }
100
  function wp_supercache_domain_mapping_exists() {
101
  global $cache_domain_mapping;
102
- if ( $cache_domain_mapping == 1 )
103
  return false;
 
104
 
105
- if ( is_admin() && function_exists( 'domain_mapping_warning' ) )
106
  add_action( 'admin_notices', 'wp_supercache_domain_mapping_notice' );
 
107
  }
108
 
109
- if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] == 'wpsupercache' ) {
110
  add_cacheaction( 'add_cacheaction', 'wp_supercache_domain_mapping_exists' );
111
  }
112
 
113
  function wpsc_domain_mapping_list( $list ) {
114
- $list[ 'domain_mapping' ] = array(
115
  'key' => 'domain_mapping',
116
- 'url' => 'http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/',
117
  'title' => __( 'Domain Mapping', 'wp-super-cache' ),
118
  'desc' => __( 'Provides support for Domain Mapping plugin to map multiple domains to a blog.', 'wp-super-cache' ),
119
  );
120
  return $list;
121
  }
122
  add_cacheaction( 'wpsc_filter_list', 'wpsc_domain_mapping_list' );
123
-
124
- ?>
3
  function domain_mapping_gc_cache( $function, $directory ) {
4
  global $cache_path;
5
 
6
+ if ( ! function_exists( 'domain_mapping_warning' ) ) {
7
  return false;
8
+ }
9
 
10
  $siteurl = domain_mapping_siteurl( false );
11
+ if ( ! $siteurl ) {
12
  return false;
13
+ }
14
 
15
+ $protocol = ( isset( $_SERVER['HTTPS'] ) && 'on' === strtolower( $_SERVER['HTTPS'] ) ) ? 'https://' : 'http://';
16
+ $siteurl = trailingslashit( str_replace( $protocol, '', $siteurl ) );
17
 
18
+ if ( 'homepage' === $directory ) {
19
  $directory = '';
20
+ }
21
 
22
+ switch ( $function ) {
23
+ case 'rebuild':
24
  @wp_cache_rebuild_or_delete( $cache_path . 'supercache/' . $siteurl . $directory . 'index.html' );
25
  @wp_cache_rebuild_or_delete( $cache_path . 'supercache/' . $siteurl . $directory . 'index.html.gz' );
26
+ break;
27
+ case 'prune':
28
  prune_super_cache( $cache_path . 'supercache/' . $siteurl . $directory . 'index.html', true, true );
29
  prune_super_cache( $cache_path . 'supercache/' . $siteurl . $directory . 'index.html.gz', true, true );
30
+ break;
31
  }
32
 
33
  return $directory;
35
 
36
  function domain_mapping_supercachedir( $dir ) {
37
  global $cache_path;
38
+ if ( ! function_exists( 'domain_mapping_warning' ) ) {
39
  return $dir;
40
+ }
41
 
42
  $siteurl = domain_mapping_siteurl( false );
43
+ if ( ! $siteurl ) {
44
  return $dir;
45
+ }
46
 
47
+ $protocol = ( isset( $_SERVER['HTTPS'] ) && 'on' === strtolower( $_SERVER['HTTPS'] ) ) ? 'https://' : 'http://';
48
+ $siteurl = str_replace( $protocol, '', $siteurl );
49
  return trailingslashit( $cache_path . 'supercache/' . $siteurl );
50
  }
51
 
52
  function domain_mapping_actions() {
53
  global $cache_domain_mapping;
54
+ if ( '1' === $cache_domain_mapping ) {
55
  add_filter( 'wp_super_cache_supercachedir', 'domain_mapping_supercachedir' );
56
  add_action( 'gc_cache', 'domain_mapping_gc_cache', 10, 2 );
57
  }
61
  function wp_supercache_domain_mapping_admin() {
62
  global $cache_domain_mapping, $wp_cache_config_file, $valid_nonce;
63
 
64
+ $cache_domain_mapping = '' === $cache_domain_mapping ? '0' : $cache_domain_mapping;
65
 
66
+ if ( isset( $_POST['cache_domain_mapping'] ) && $valid_nonce ) {
67
+ if ( $cache_domain_mapping === (int) $_POST['cache_domain_mapping'] ) {
68
  $changed = false;
69
  } else {
70
  $changed = true;
71
  }
72
+ $cache_domain_mapping = (int) $_POST['cache_domain_mapping'];
73
+ wp_cache_replace_line( '^ *\$cache_domain_mapping', "\$cache_domain_mapping = '$cache_domain_mapping';", $wp_cache_config_file );
74
  }
75
  $id = 'domain_mapping-section';
76
  ?>
77
  <fieldset id="<?php echo $id; ?>" class="options">
78
  <h4><?php _e( 'Domain Mapping', 'wp-super-cache' ); ?></h4>
79
  <form name="wp_manager" action="" method="post">
80
+ <label><input type="radio" name="cache_domain_mapping" value="1" <?php if ( $cache_domain_mapping ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Enabled', 'wp-super-cache' ); ?></label>
81
+ <label><input type="radio" name="cache_domain_mapping" value="0" <?php if ( ! $cache_domain_mapping ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Disabled', 'wp-super-cache' ); ?></label>
82
+ <p><?php _e( '', 'wp-super-cache' ); ?></p>
83
+ <?php
84
+ echo '<p>' . __( 'Provides support for <a href="https://wordpress.org/plugins/wordpress-mu-domain-mapping/">Domain Mapping</a> plugin to map multiple domains to a blog.', 'wp-super-cache' ) . '</p>';
85
+ if ( isset( $changed ) && $changed ) {
86
+ if ( $cache_domain_mapping ) {
87
+ $status = __( 'enabled', 'wp-super-cache' );
88
+ } else {
89
+ $status = __( 'disabled', 'wp-super-cache' );
90
  }
91
+ echo '<p><strong>' . sprintf( __( 'Domain Mapping support is now %s', 'wp-super-cache' ), $status ) . '</strong></p>';
92
+ }
93
  echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
94
+ wp_nonce_field( 'wp-cache' );
95
  ?>
96
  </form>
97
  </fieldset>
101
 
102
  function wp_supercache_domain_mapping_notice() {
103
  global $cache_enabled;
104
+ if ( $cache_enabled ) {
105
+ echo '<div class="error"><p><strong>' . __( 'Domain Mapping plugin detected! Please go to the Supercache plugins page and enable the domain mapping helper plugin.', 'wp-super-cache' ) . '</strong></p></div>';
106
+ }
107
  }
108
  function wp_supercache_domain_mapping_exists() {
109
  global $cache_domain_mapping;
110
+ if ( '1' === $cache_domain_mapping ) {
111
  return false;
112
+ }
113
 
114
+ if ( is_admin() && function_exists( 'domain_mapping_warning' ) ) {
115
  add_action( 'admin_notices', 'wp_supercache_domain_mapping_notice' );
116
+ }
117
  }
118
 
119
+ if ( isset( $_GET['page'] ) && 'wpsupercache' === $_GET['page'] ) {
120
  add_cacheaction( 'add_cacheaction', 'wp_supercache_domain_mapping_exists' );
121
  }
122
 
123
  function wpsc_domain_mapping_list( $list ) {
124
+ $list['domain_mapping'] = array(
125
  'key' => 'domain_mapping',
126
+ 'url' => 'https://wordpress.org/plugins/wordpress-mu-domain-mapping/',
127
  'title' => __( 'Domain Mapping', 'wp-super-cache' ),
128
  'desc' => __( 'Provides support for Domain Mapping plugin to map multiple domains to a blog.', 'wp-super-cache' ),
129
  );
130
  return $list;
131
  }
132
  add_cacheaction( 'wpsc_filter_list', 'wpsc_domain_mapping_list' );
 
 
plugins/dynamic-cache-test.php CHANGED
@@ -23,6 +23,11 @@
23
  * for processing.
24
  *
25
  * **** MAKE SURE YOU KEEP THE TEMPLATE TAG SECRET ****
 
 
 
 
 
26
  */
27
 
28
  /*
@@ -63,26 +68,26 @@
63
  * 4. The wp_footer action fires and the TAG is printed to the page.
64
  * 5. Processing continues and the page is created.
65
  * 6. The output buffer finishes. A WP Super Cache callback function runs
66
- * and saves the output buffer to a cache file. The wpsc_cachedata
67
  * filter is called.
68
  * 7. The function dynamic_cache_test_filter() runs and replaces the TAG in
69
  * the buffer with the "Hello world" string.
70
  * 8. The output buffer is pushed to the browser to be displayed.
71
  */
72
- define( 'DYNAMIC_CACHE_TEST_TAG', '' ); // Change this to a secret placeholder tag
73
- if ( DYNAMIC_CACHE_TEST_TAG != '' ) {
74
  function dynamic_cache_test_safety( $safety ) {
75
  return 1;
76
  }
77
  add_cacheaction( 'wpsc_cachedata_safety', 'dynamic_cache_test_safety' );
78
 
79
- function dynamic_cache_test_filter( &$cachedata) {
80
- return str_replace( DYNAMIC_CACHE_TEST_TAG, "<!-- Hello world at " . date( 'H:i:s' ) . " -->", $cachedata );
81
  }
82
  add_cacheaction( 'wpsc_cachedata', 'dynamic_cache_test_filter' );
83
 
84
  function dynamic_cache_test_template_tag() {
85
- echo DYNAMIC_CACHE_TEST_TAG; // This is the template tag
86
  }
87
 
88
  function dynamic_cache_test_init() {
@@ -133,7 +138,6 @@ if ( DYNAMIC_CACHE_TEST_TAG != '' ) {
133
  * very last line of dynamic_output_buffer_test() replaces the placeholder tag
134
  * with the dynamic content in the cache file.
135
  *
136
- *
137
  * Use an output buffer to capture dynamic content while the page is generated
138
  * and insert into the right place:
139
  * Remember to add the DYNAMIC_OUTPUT_BUFFER_TAG text (as defined below) to
@@ -145,23 +149,25 @@ if ( DYNAMIC_CACHE_TEST_TAG != '' ) {
145
  *
146
  */
147
 
148
- define( 'DYNAMIC_OUTPUT_BUFFER_TAG', '' ); // Change this to a secret placeholder tag
149
 
150
- if ( DYNAMIC_OUTPUT_BUFFER_TAG != '' ) {
151
- function dynamic_output_buffer_test( &$cachedata = 0 ) {
152
- if ( defined( 'DYNAMIC_OB_TEXT' ) )
153
  return str_replace( DYNAMIC_OUTPUT_BUFFER_TAG, DYNAMIC_OB_TEXT, $cachedata );
 
154
 
155
  ob_start();
156
  // call the sidebar function, do something dynamic
157
- echo "<p>This is a test. The current time on the server is: " . date( 'H:i:s' ) . "</p>";
158
  $text = ob_get_contents();
159
  ob_end_clean();
160
 
161
- if ( $cachedata === 0 ) { // called directly from the theme so store the output
162
  define( 'DYNAMIC_OB_TEXT', $text );
163
- } else // called via the wpsc_cachedata filter. We only get here in cached pages in wp-cache-phase1.php
164
  return str_replace( DYNAMIC_OUTPUT_BUFFER_TAG, $text, $cachedata );
 
165
 
166
  }
167
  add_cacheaction( 'wpsc_cachedata', 'dynamic_output_buffer_test' );
@@ -172,11 +178,11 @@ if ( DYNAMIC_OUTPUT_BUFFER_TAG != '' ) {
172
  add_cacheaction( 'add_cacheaction', 'dynamic_output_buffer_init' );
173
 
174
  function dynamic_output_buffer_test_safety( $safety ) {
175
- if ( defined( 'DYNAMIC_OB_TEXT' ) ) // this is set when you call dynamic_output_buffer_test() from the theme
176
  return 1; // ready to replace tag with dynamic content.
177
- else
178
  return 0; // tag cannot be replaced.
 
179
  }
180
  add_cacheaction( 'wpsc_cachedata_safety', 'dynamic_output_buffer_test_safety' );
181
  }
182
- ?>
23
  * for processing.
24
  *
25
  * **** MAKE SURE YOU KEEP THE TEMPLATE TAG SECRET ****
26
+ * You should probably add 'deny from all' to the .htaccess in the cache directory
27
+ * so visitors can't directly load any cached html files and discover the secret
28
+ * tag. Or you can move the cache directory out of the web path and set the
29
+ * cache location to that new directory on the advanced settings page.
30
+ *
31
  */
32
 
33
  /*
68
  * 4. The wp_footer action fires and the TAG is printed to the page.
69
  * 5. Processing continues and the page is created.
70
  * 6. The output buffer finishes. A WP Super Cache callback function runs
71
+ * and saves the output buffer to a cache file. The wpsc_cachedata
72
  * filter is called.
73
  * 7. The function dynamic_cache_test_filter() runs and replaces the TAG in
74
  * the buffer with the "Hello world" string.
75
  * 8. The output buffer is pushed to the browser to be displayed.
76
  */
77
+ define( 'DYNAMIC_CACHE_TEST_TAG', '' ); // Change this to a secret placeholder tag.
78
+ if ( '' !== DYNAMIC_CACHE_TEST_TAG ) {
79
  function dynamic_cache_test_safety( $safety ) {
80
  return 1;
81
  }
82
  add_cacheaction( 'wpsc_cachedata_safety', 'dynamic_cache_test_safety' );
83
 
84
+ function dynamic_cache_test_filter( $cachedata ) {
85
+ return str_replace( DYNAMIC_CACHE_TEST_TAG, '<!-- Hello world at ' . date( 'H:i:s' ) . ' -->', $cachedata );
86
  }
87
  add_cacheaction( 'wpsc_cachedata', 'dynamic_cache_test_filter' );
88
 
89
  function dynamic_cache_test_template_tag() {
90
+ echo DYNAMIC_CACHE_TEST_TAG; // This is the template tag.
91
  }
92
 
93
  function dynamic_cache_test_init() {
138
  * very last line of dynamic_output_buffer_test() replaces the placeholder tag
139
  * with the dynamic content in the cache file.
140
  *
 
141
  * Use an output buffer to capture dynamic content while the page is generated
142
  * and insert into the right place:
143
  * Remember to add the DYNAMIC_OUTPUT_BUFFER_TAG text (as defined below) to
149
  *
150
  */
151
 
152
+ define( 'DYNAMIC_OUTPUT_BUFFER_TAG', '' ); // Change this to a secret placeholder tag.
153
 
154
+ if ( '' !== DYNAMIC_OUTPUT_BUFFER_TAG ) {
155
+ function dynamic_output_buffer_test( $cachedata = 0 ) {
156
+ if ( defined( 'DYNAMIC_OB_TEXT' ) ) {
157
  return str_replace( DYNAMIC_OUTPUT_BUFFER_TAG, DYNAMIC_OB_TEXT, $cachedata );
158
+ }
159
 
160
  ob_start();
161
  // call the sidebar function, do something dynamic
162
+ echo '<p>This is a test. The current time on the server is: ' . date( 'H:i:s' ) . '</p>';
163
  $text = ob_get_contents();
164
  ob_end_clean();
165
 
166
+ if ( 0 === $cachedata ) { // called directly from the theme so store the output.
167
  define( 'DYNAMIC_OB_TEXT', $text );
168
+ } else { // called via the wpsc_cachedata filter. We only get here in cached pages in wp-cache-phase1.php.
169
  return str_replace( DYNAMIC_OUTPUT_BUFFER_TAG, $text, $cachedata );
170
+ }
171
 
172
  }
173
  add_cacheaction( 'wpsc_cachedata', 'dynamic_output_buffer_test' );
178
  add_cacheaction( 'add_cacheaction', 'dynamic_output_buffer_init' );
179
 
180
  function dynamic_output_buffer_test_safety( $safety ) {
181
+ if ( defined( 'DYNAMIC_OB_TEXT' ) ) {// this is set when you call dynamic_output_buffer_test() from the theme.
182
  return 1; // ready to replace tag with dynamic content.
183
+ } else {
184
  return 0; // tag cannot be replaced.
185
+ }
186
  }
187
  add_cacheaction( 'wpsc_cachedata_safety', 'dynamic_output_buffer_test_safety' );
188
  }
 
plugins/jetpack.php CHANGED
@@ -3,20 +3,20 @@
3
  function wp_super_cache_jetpack_admin() {
4
  global $cache_jetpack, $wp_cache_config_file, $valid_nonce;
5
 
6
- $cache_jetpack = $cache_jetpack == '' ? '0' : $cache_jetpack;
7
 
8
- if(isset($_POST['cache_jetpack']) && $valid_nonce) {
9
- if ( $cache_jetpack == (int)$_POST['cache_jetpack'] ) {
10
  $changed = false;
11
  } else {
12
  $changed = true;
13
  }
14
- $cache_jetpack = (int)$_POST['cache_jetpack'];
15
- wp_cache_replace_line('^ *\$cache_jetpack', "\$cache_jetpack = '$cache_jetpack';", $wp_cache_config_file);
16
  if ( $changed && $cache_jetpack ) {
17
- wp_cache_replace_line('^ *\$wp_cache_mobile_enabled', '$wp_cache_mobile_enabled = 1;', $wp_cache_config_file);
18
- wp_cache_replace_line('^ *\$wp_cache_mod_rewrite', '$wp_cache_mod_rewrite = 0;', $wp_cache_config_file);
19
- wp_cache_replace_line('^ *\$super_cache_enabled', '$super_cache_enabled = 1;', $wp_cache_config_file);
20
  }
21
  }
22
  $id = 'jetpack-section';
@@ -24,23 +24,25 @@ function wp_super_cache_jetpack_admin() {
24
  <fieldset id="<?php echo $id; ?>" class="options">
25
  <h4><?php _e( 'Jetpack Mobile Theme', 'wp-super-cache' ); ?></h4>
26
  <?php
27
- if ( false == file_exists( dirname( WPCACHEHOME ) . '/jetpack/class.jetpack-user-agent.php' ) ) {
28
- echo "<strong>" . sprintf( __( "Jetpack not found in %s. Install it and enable the mobile theme and this helper plugin to cache visits by mobile visitors.", 'wp-super-cache' ), dirname( WPCACHEHOME ) ) . "</strong>";
29
- } else { ?>
 
30
  <form name="wp_manager" action="" method="post">
31
- <label><input type="radio" name="cache_jetpack" value="1" <?php if( $cache_jetpack ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Enabled', 'wp-super-cache' ); ?></label>
32
- <label><input type="radio" name="cache_jetpack" value="0" <?php if( !$cache_jetpack ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Disabled', 'wp-super-cache' ); ?></label>
33
  <?php
34
- echo '<p>' . __( 'Provides support for the <a href="http://wordpress.org/extend/plugins/jetpack/">Jetpack</a> mobile theme and plugin. PHP caching mode and mobile support will be enabled too.', 'wp-super-cache' ) . '</p>';
35
  if ( isset( $changed ) && $changed ) {
36
- if ( $cache_jetpack )
37
- $status = __( "enabled", 'wp-super-cache' );
38
- else
39
- $status = __( "disabled", 'wp-super-cache' );
40
- echo "<p><strong>" . sprintf( __( "Jetpack Mobile Theme support is now %s", 'wp-super-cache' ), $status ) . "</strong></p>";
 
41
  }
42
  echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
43
- wp_nonce_field('wp-cache');
44
  ?>
45
  </form>
46
  <?php } ?>
@@ -50,41 +52,40 @@ function wp_super_cache_jetpack_admin() {
50
  add_cacheaction( 'cache_admin_page', 'wp_super_cache_jetpack_admin' );
51
 
52
  function wp_super_cache_jetpack_cookie_check( $cache_key ) {
53
- if ( function_exists( "jetpack_is_mobile" ) == false ) {
54
 
55
  if ( file_exists( dirname( WPCACHEHOME ) . '/jetpack-dev/class.jetpack-user-agent.php' ) ) {
56
  wp_cache_debug( "wp_super_cache_jetpack_cookie_check: jetpack dev detected. Returning 'normal' to avoid loading Jetpack." );
57
- return "normal";
58
  } elseif ( file_exists( dirname( WPCACHEHOME ) . '/jetpack/class.jetpack-user-agent.php' ) ) {
59
- include_once( dirname( WPCACHEHOME ) . '/jetpack/class.jetpack-user-agent.php' );
60
  } else {
61
- wp_cache_debug( "wp_super_cache_jetpack_cookie_check: jetpack UA file not found." );
62
  }
63
  }
64
 
65
- if ( function_exists( "jetpack_is_mobile" ) ) {
66
- if ( jetpack_is_mobile() )
67
  return 'mobile';
68
- else
69
  return 'normal';
 
70
  } else {
71
- return "normal";
72
  }
73
  }
74
 
75
- if ( isset( $cache_jetpack ) && $cache_jetpack == 1 ) {
76
  add_cacheaction( 'wp_cache_check_mobile', 'wp_super_cache_jetpack_cookie_check' );
77
  }
78
 
79
  function wpsc_cache_jetpack_list( $list ) {
80
- $list[ 'jetpack' ] = array(
81
  'key' => 'jetpack',
82
- 'url' => 'http://wordpress.org/extend/plugins/jetpack/',
83
  'title' => __( 'Jetpack Mobile Theme', 'wp-super-cache' ),
84
  'desc' => __( 'Provides support for the Jetpack mobile theme and plugin. PHP caching mode and mobile support will be enabled too.', 'wp-super-cache' ),
85
  );
86
  return $list;
87
  }
88
  add_cacheaction( 'wpsc_filter_list', 'wpsc_cache_jetpack_list' );
89
-
90
- ?>
3
  function wp_super_cache_jetpack_admin() {
4
  global $cache_jetpack, $wp_cache_config_file, $valid_nonce;
5
 
6
+ $cache_jetpack = '' === $cache_jetpack ? '0' : $cache_jetpack;
7
 
8
+ if ( isset( $_POST['cache_jetpack'] ) && $valid_nonce ) {
9
+ if ( $cache_jetpack === (int) $_POST['cache_jetpack'] ) {
10
  $changed = false;
11
  } else {
12
  $changed = true;
13
  }
14
+ $cache_jetpack = (int) $_POST['cache_jetpack'];
15
+ wp_cache_replace_line( '^ *\$cache_jetpack', "\$cache_jetpack = '$cache_jetpack';", $wp_cache_config_file );
16
  if ( $changed && $cache_jetpack ) {
17
+ wp_cache_replace_line( '^ *\$wp_cache_mobile_enabled', '$wp_cache_mobile_enabled = 1;', $wp_cache_config_file );
18
+ wp_cache_replace_line( '^ *\$wp_cache_mod_rewrite', '$wp_cache_mod_rewrite = 0;', $wp_cache_config_file );
19
+ wp_cache_replace_line( '^ *\$super_cache_enabled', '$super_cache_enabled = 1;', $wp_cache_config_file );
20
  }
21
  }
22
  $id = 'jetpack-section';
24
  <fieldset id="<?php echo $id; ?>" class="options">
25
  <h4><?php _e( 'Jetpack Mobile Theme', 'wp-super-cache' ); ?></h4>
26
  <?php
27
+ if ( false === file_exists( dirname( WPCACHEHOME ) . '/jetpack/class.jetpack-user-agent.php' ) ) {
28
+ echo '<strong>' . sprintf( __( 'Jetpack not found in %s. Install it and enable the mobile theme and this helper plugin to cache visits by mobile visitors.', 'wp-super-cache' ), dirname( WPCACHEHOME ) ) . '</strong>';
29
+ } else {
30
+ ?>
31
  <form name="wp_manager" action="" method="post">
32
+ <label><input type="radio" name="cache_jetpack" value="1" <?php if ( $cache_jetpack ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Enabled', 'wp-super-cache' ); ?></label>
33
+ <label><input type="radio" name="cache_jetpack" value="0" <?php if ( ! $cache_jetpack ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Disabled', 'wp-super-cache' ); ?></label>
34
  <?php
35
+ echo '<p>' . __( 'Provides support for the <a href="https://wordpress.org/plugins/jetpack/">Jetpack</a> mobile theme and plugin. PHP caching mode and mobile support will be enabled too.', 'wp-super-cache' ) . '</p>';
36
  if ( isset( $changed ) && $changed ) {
37
+ if ( $cache_jetpack ) {
38
+ $status = __( 'enabled', 'wp-super-cache' );
39
+ } else {
40
+ $status = __( 'disabled', 'wp-super-cache' );
41
+ }
42
+ echo '<p><strong>' . sprintf( __( 'Jetpack Mobile Theme support is now %s', 'wp-super-cache' ), $status ) . '</strong></p>';
43
  }
44
  echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
45
+ wp_nonce_field( 'wp-cache' );
46
  ?>
47
  </form>
48
  <?php } ?>
52
  add_cacheaction( 'cache_admin_page', 'wp_super_cache_jetpack_admin' );
53
 
54
  function wp_super_cache_jetpack_cookie_check( $cache_key ) {
55
+ if ( false === function_exists( 'jetpack_is_mobile' ) ) {
56
 
57
  if ( file_exists( dirname( WPCACHEHOME ) . '/jetpack-dev/class.jetpack-user-agent.php' ) ) {
58
  wp_cache_debug( "wp_super_cache_jetpack_cookie_check: jetpack dev detected. Returning 'normal' to avoid loading Jetpack." );
59
+ return 'normal';
60
  } elseif ( file_exists( dirname( WPCACHEHOME ) . '/jetpack/class.jetpack-user-agent.php' ) ) {
61
+ include_once dirname( WPCACHEHOME ) . '/jetpack/class.jetpack-user-agent.php';
62
  } else {
63
+ wp_cache_debug( 'wp_super_cache_jetpack_cookie_check: jetpack UA file not found.' );
64
  }
65
  }
66
 
67
+ if ( function_exists( 'jetpack_is_mobile' ) ) {
68
+ if ( jetpack_is_mobile() ) {
69
  return 'mobile';
70
+ } else {
71
  return 'normal';
72
+ }
73
  } else {
74
+ return 'normal';
75
  }
76
  }
77
 
78
+ if ( isset( $cache_jetpack ) && '1' === $cache_jetpack ) {
79
  add_cacheaction( 'wp_cache_check_mobile', 'wp_super_cache_jetpack_cookie_check' );
80
  }
81
 
82
  function wpsc_cache_jetpack_list( $list ) {
83
+ $list['jetpack'] = array(
84
  'key' => 'jetpack',
85
+ 'url' => 'https://wordpress.org/plugins/jetpack/',
86
  'title' => __( 'Jetpack Mobile Theme', 'wp-super-cache' ),
87
  'desc' => __( 'Provides support for the Jetpack mobile theme and plugin. PHP caching mode and mobile support will be enabled too.', 'wp-super-cache' ),
88
  );
89
  return $list;
90
  }
91
  add_cacheaction( 'wpsc_filter_list', 'wpsc_cache_jetpack_list' );
 
 
plugins/multisite.php CHANGED
@@ -1,7 +1,8 @@
1
  <?php
2
 
3
- if ( ( defined( 'WP_ALLOW_MULTISITE' ) && constant( 'WP_ALLOW_MULTISITE' ) == true ) || defined( 'SUBDOMAIN_INSTALL' ) || defined( 'VHOST' ) || defined( 'SUNRISE' ) )
4
  add_cacheaction( 'add_cacheaction', 'wp_super_cache_multisite_init' );
 
5
 
6
  function wp_super_cache_multisite_init() {
7
  add_filter( 'wpmu_blogs_columns', 'wp_super_cache_blogs_col' );
@@ -10,48 +11,52 @@ function wp_super_cache_multisite_init() {
10
  }
11
 
12
  function wp_super_cache_blogs_col( $col ) {
13
- $col[ 'wp_super_cache' ] = __( 'Cached', 'wp-super-cache' );
14
  return $col;
15
  }
16
 
17
  function wp_super_cache_blogs_field( $name, $blog_id ) {
18
- if ( $name != 'wp_super_cache' )
19
  return false;
 
20
 
21
- if ( isset( $_GET[ 'id' ] ) && $blog_id == $_GET[ 'id' ] ) {
22
- $valid_nonce = isset( $_GET[ '_wpnonce' ] ) ? wp_verify_nonce( $_GET[ '_wpnonce' ], 'wp-cache' . $_GET[ 'id' ] ) : false;
23
- if ( $valid_nonce && isset( $_GET[ 'action' ] ) && $_GET[ 'action' ] == 'disable_cache' ) {
24
- add_blog_option( $_GET[ 'id' ], 'wp_super_cache_disabled', 1 );
25
- } elseif ( $valid_nonce && isset( $_GET[ 'action' ] ) && $_GET[ 'action' ] == 'enable_cache' ) {
26
- delete_blog_option( $_GET[ 'id' ], 'wp_super_cache_disabled' );
 
 
27
  }
28
  }
29
 
30
- if ( get_blog_option( $blog_id, 'wp_super_cache_disabled' ) == 1 ) {
31
- echo "<a href='" . wp_nonce_url( add_query_arg( array( 'action' => 'enable_cache', 'id' => $blog_id ) ), 'wp-cache' . $blog_id ) . "'>" . __( 'Enable', 'wp-super-cache' ) . "</a>";
32
  } else {
33
- echo "<a href='" . wp_nonce_url( add_query_arg( array( 'action' => 'disable_cache', 'id' => $blog_id ) ), 'wp-cache' . $blog_id ) . "'>" . __( 'Disable', 'wp-super-cache' ) . "</a>";
34
  }
35
  }
36
 
37
  function wp_super_cache_multisite_notice() {
38
- if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] == 'wpsupercache' )
39
  echo '<div class="error"><p><strong>' . __( 'Caching has been disabled on this blog on the Network Admin Sites page.', 'wp-super-cache' ) . '</strong></p></div>';
 
40
  }
41
 
42
  function wp_super_cache_override_on_flag() {
43
  global $cache_enabled, $super_cache_enabled;
44
- if ( $cache_enabled != true )
45
  return false;
 
46
 
47
  if ( get_option( 'wp_super_cache_disabled' ) ) {
48
  $cache_enabled = false;
49
  $super_cache_enabled = false;
50
  define( 'DONOTCACHEPAGE', 1 );
51
- define( "SUBMITDISABLED", 'disabled style="color: #aaa" ' );
52
- if ( is_admin() )
53
  add_action( 'admin_notices', 'wp_super_cache_multisite_notice' );
 
54
  }
55
  }
56
-
57
- ?>
1
  <?php
2
 
3
+ if ( ( defined( 'WP_ALLOW_MULTISITE' ) && constant( 'WP_ALLOW_MULTISITE' ) === true ) || defined( 'SUBDOMAIN_INSTALL' ) || defined( 'VHOST' ) || defined( 'SUNRISE' ) ) {
4
  add_cacheaction( 'add_cacheaction', 'wp_super_cache_multisite_init' );
5
+ }
6
 
7
  function wp_super_cache_multisite_init() {
8
  add_filter( 'wpmu_blogs_columns', 'wp_super_cache_blogs_col' );
11
  }
12
 
13
  function wp_super_cache_blogs_col( $col ) {
14
+ $col['wp_super_cache'] = __( 'Cached', 'wp-super-cache' );
15
  return $col;
16
  }
17
 
18
  function wp_super_cache_blogs_field( $name, $blog_id ) {
19
+ if ( 'wp_super_cache' !== $name ) {
20
  return false;
21
+ }
22
 
23
+ if ( isset( $_GET['id'], $_GET['action'], $_GET['_wpnonce'] )
24
+ && $blog_id === intval( $_GET['id'] )
25
+ && wp_verify_nonce( $_GET['_wpnonce'], 'wp-cache' . $blog_id )
26
+ ) {
27
+ if ( 'disable_cache' === $_GET['action'] ) {
28
+ add_blog_option( $_GET['id'], 'wp_super_cache_disabled', 1 );
29
+ } elseif ( 'enable_cache' === $_GET['action'] ) {
30
+ delete_blog_option( $_GET['id'], 'wp_super_cache_disabled' );
31
  }
32
  }
33
 
34
+ if ( get_blog_option( $blog_id, 'wp_super_cache_disabled' ) === 1 ) {
35
+ echo '<a href="' . wp_nonce_url( add_query_arg( array( 'action' => 'enable_cache', 'id' => $blog_id ) ), 'wp-cache' . $blog_id ) . '">' . __( 'Enable', 'wp-super-cache' ) . '</a>';
36
  } else {
37
+ echo '<a href="' . wp_nonce_url( add_query_arg( array( 'action' => 'disable_cache', 'id' => $blog_id ) ), 'wp-cache' . $blog_id ) . '">' . __( 'Disable', 'wp-super-cache' ) . '</a>';
38
  }
39
  }
40
 
41
  function wp_super_cache_multisite_notice() {
42
+ if ( isset( $_GET['page'] ) && 'wpsupercache' === $_GET['page'] ) {
43
  echo '<div class="error"><p><strong>' . __( 'Caching has been disabled on this blog on the Network Admin Sites page.', 'wp-super-cache' ) . '</strong></p></div>';
44
+ }
45
  }
46
 
47
  function wp_super_cache_override_on_flag() {
48
  global $cache_enabled, $super_cache_enabled;
49
+ if ( true !== $cache_enabled ) {
50
  return false;
51
+ }
52
 
53
  if ( get_option( 'wp_super_cache_disabled' ) ) {
54
  $cache_enabled = false;
55
  $super_cache_enabled = false;
56
  define( 'DONOTCACHEPAGE', 1 );
57
+ define( 'SUBMITDISABLED', 'disabled style="color: #aaa" ' );
58
+ if ( is_admin() ) {
59
  add_action( 'admin_notices', 'wp_super_cache_multisite_notice' );
60
+ }
61
  }
62
  }
 
 
plugins/searchengine.php CHANGED
@@ -1,32 +1,32 @@
1
  <?php
 
2
  function wp_supercache_searchengine( $string ) {
3
  global $passingthrough, $nevershowads, $cache_no_adverts_for_friends;
4
 
5
  $cache_no_adverts_for_friends = wpsc_get_searchengine_setting();
6
- if ( ! $cache_no_adverts_for_friends )
7
- return $string;
8
-
9
- if( $string != '' )
10
  return $string;
 
11
 
12
- if( isset( $_COOKIE[ '7a1254cba80da02d5478d91cfd0a873a' ] ) && $_COOKIE[ '7a1254cba80da02d5478d91cfd0a873a' ] == 1 ) {
13
  $string = 'searchengine';
14
- } elseif( isset( $_SERVER[ 'HTTP_REFERER' ] ) && $_SERVER[ 'HTTP_REFERER' ] != '' ) {
15
- if( is_array( $passingthrough ) == false )
16
  return $string;
 
17
 
18
- foreach( $passingthrough as $url ) {
19
- if( strpos( $_SERVER[ 'HTTP_REFERER' ], $url ) ) {
20
  reset( $nevershowads );
21
  $se = false;
22
- foreach( $nevershowads as $whitesite ) {
23
- if( false == strpos( $_SERVER[ 'HTTP_REFERER' ], $whitesite ) ) {
24
  $se = true;
25
  }
26
  }
27
- if( $se ) {
28
  $string = 'searchengine';
29
- @setcookie( '7a1254cba80da02d5478d91cfd0a873a', 1, time()+3600, '/' );
30
  }
31
  }
32
  }
@@ -37,7 +37,7 @@ function wp_supercache_searchengine( $string ) {
37
  add_cacheaction( 'wp_cache_get_cookies_values', 'wp_supercache_searchengine' );
38
 
39
  function searchenginesupercache( $user_info ) {
40
- if( $user_info == 'searchengine' && is_single() && is_old_post() ) {
41
  return true;
42
  } else {
43
  return false;
@@ -52,10 +52,10 @@ function wpsc_get_searchengine_setting() {
52
  }
53
 
54
  $changed = false;
55
- if ( $cache_no_adverts_for_friends === 'yes' || $cache_no_adverts_for_friends === '1' ) {
56
  $cache_no_adverts_for_friends = 1;
57
  $changed = true;
58
- } elseif ( $cache_no_adverts_for_friends === 'no' ) {
59
  $cache_no_adverts_for_friends = 0;
60
  $changed = true;
61
  }
@@ -81,13 +81,13 @@ function wp_supercache_searchengine_admin() {
81
 
82
  $cache_no_adverts_for_friends = wpsc_get_searchengine_setting();
83
 
84
- if(isset($_POST['cache_no_adverts_for_friends']) && $valid_nonce) {
85
- if ( $cache_no_adverts_for_friends != (int)$_POST[ 'cache_no_adverts_for_friends' ] ) {
86
  $changed = 1;
87
  } else {
88
  $changed = 0;
89
  }
90
- $cache_no_adverts_for_friends = (int)$_POST[ 'cache_no_adverts_for_friends' ];
91
  wp_cache_setting( 'cache_no_adverts_for_friends', $cache_no_adverts_for_friends );
92
  }
93
  ?>
@@ -99,14 +99,15 @@ function wp_supercache_searchengine_admin() {
99
  <?php
100
  echo '<p>' . __( 'Provides support for <a href="https://odd.blog/no-adverts-for-friends/">No Adverts for Friends</a>.', 'wp-super-cache' ) . '</p>';
101
  if ( isset( $changed ) && $changed ) {
102
- if ( $cache_no_adverts_for_friends )
103
- $status = __( "enabled", 'wp-super-cache' );
104
- else
105
- $status = __( "disabled", 'wp-super-cache' );
106
- echo "<p><strong>" . sprintf( __( "No Adverts for Friends support is now %s", 'wp-super-cache' ), $status ) . "</strong></p>";
 
107
  }
108
  echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
109
- wp_nonce_field('wp-cache');
110
  ?>
111
  </form>
112
  </fieldset>
@@ -116,7 +117,7 @@ function wp_supercache_searchengine_admin() {
116
  add_cacheaction( 'cache_admin_page', 'wp_supercache_searchengine_admin' );
117
 
118
  function wpsc_cache_no_adverts_for_friends_list( $list ) {
119
- $list[ 'no_adverts_for_friends' ] = array(
120
  'key' => 'no_adverts_for_friends',
121
  'url' => 'https://odd.blog/no-adverts-for-friends/',
122
  'title' => __( 'No Adverts for Friends', 'wp-super-cache' ),
@@ -125,5 +126,3 @@ function wpsc_cache_no_adverts_for_friends_list( $list ) {
125
  return $list;
126
  }
127
  add_cacheaction( 'wpsc_filter_list', 'wpsc_cache_no_adverts_for_friends_list' );
128
-
129
- ?>
1
  <?php
2
+
3
  function wp_supercache_searchengine( $string ) {
4
  global $passingthrough, $nevershowads, $cache_no_adverts_for_friends;
5
 
6
  $cache_no_adverts_for_friends = wpsc_get_searchengine_setting();
7
+ if ( ! $cache_no_adverts_for_friends || '' != $string ) {
 
 
 
8
  return $string;
9
+ }
10
 
11
+ if ( isset( $_COOKIE['7a1254cba80da02d5478d91cfd0a873a'] ) && '1' === $_COOKIE['7a1254cba80da02d5478d91cfd0a873a'] ) {
12
  $string = 'searchengine';
13
+ } elseif ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
14
+ if ( is_array( $passingthrough ) === false ) {
15
  return $string;
16
+ }
17
 
18
+ foreach ( $passingthrough as $url ) {
19
+ if ( strpos( $_SERVER['HTTP_REFERER'], $url ) ) {
20
  reset( $nevershowads );
21
  $se = false;
22
+ foreach ( $nevershowads as $whitesite ) {
23
+ if ( false === strpos( $_SERVER['HTTP_REFERER'], $whitesite ) ) {
24
  $se = true;
25
  }
26
  }
27
+ if ( $se ) {
28
  $string = 'searchengine';
29
+ @setcookie( '7a1254cba80da02d5478d91cfd0a873a', 1, time() + 3600, '/' );
30
  }
31
  }
32
  }
37
  add_cacheaction( 'wp_cache_get_cookies_values', 'wp_supercache_searchengine' );
38
 
39
  function searchenginesupercache( $user_info ) {
40
+ if ( 'searchengine' === $user_info && is_single() && is_old_post() ) {
41
  return true;
42
  } else {
43
  return false;
52
  }
53
 
54
  $changed = false;
55
+ if ( 'yes' === $cache_no_adverts_for_friends || '1' === $cache_no_adverts_for_friends ) {
56
  $cache_no_adverts_for_friends = 1;
57
  $changed = true;
58
+ } elseif ( 'no' === $cache_no_adverts_for_friends ) {
59
  $cache_no_adverts_for_friends = 0;
60
  $changed = true;
61
  }
81
 
82
  $cache_no_adverts_for_friends = wpsc_get_searchengine_setting();
83
 
84
+ if ( isset( $_POST['cache_no_adverts_for_friends'] ) && $valid_nonce ) {
85
+ if ( $cache_no_adverts_for_friends !== (int) $_POST['cache_no_adverts_for_friends'] ) {
86
  $changed = 1;
87
  } else {
88
  $changed = 0;
89
  }
90
+ $cache_no_adverts_for_friends = (int) $_POST['cache_no_adverts_for_friends'];
91
  wp_cache_setting( 'cache_no_adverts_for_friends', $cache_no_adverts_for_friends );
92
  }
93
  ?>
99
  <?php
100
  echo '<p>' . __( 'Provides support for <a href="https://odd.blog/no-adverts-for-friends/">No Adverts for Friends</a>.', 'wp-super-cache' ) . '</p>';
101
  if ( isset( $changed ) && $changed ) {
102
+ if ( $cache_no_adverts_for_friends ) {
103
+ $status = __( 'enabled', 'wp-super-cache' );
104
+ } else {
105
+ $status = __( 'disabled', 'wp-super-cache' );
106
+ }
107
+ echo '<p><strong>' . sprintf( __( 'No Adverts for Friends support is now %s', 'wp-super-cache' ), $status ) . '</strong></p>';
108
  }
109
  echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
110
+ wp_nonce_field( 'wp-cache' );
111
  ?>
112
  </form>
113
  </fieldset>
117
  add_cacheaction( 'cache_admin_page', 'wp_supercache_searchengine_admin' );
118
 
119
  function wpsc_cache_no_adverts_for_friends_list( $list ) {
120
+ $list['no_adverts_for_friends'] = array(
121
  'key' => 'no_adverts_for_friends',
122
  'url' => 'https://odd.blog/no-adverts-for-friends/',
123
  'title' => __( 'No Adverts for Friends', 'wp-super-cache' ),
126
  return $list;
127
  }
128
  add_cacheaction( 'wpsc_filter_list', 'wpsc_cache_no_adverts_for_friends_list' );
 
 
plugins/wptouch.php CHANGED
@@ -3,35 +3,36 @@
3
  function wp_super_cache_wptouch_admin() {
4
  global $cache_wptouch, $wp_cache_config_file, $valid_nonce;
5
 
6
- $cache_wptouch = $cache_wptouch == '' ? '0' : $cache_wptouch;
7
 
8
- if(isset($_POST['cache_wptouch']) && $valid_nonce) {
9
- if ( $cache_wptouch == (int)$_POST['cache_wptouch'] ) {
10
  $changed = false;
11
  } else {
12
  $changed = true;
13
  }
14
- $cache_wptouch = (int)$_POST['cache_wptouch'];
15
- wp_cache_replace_line('^ *\$cache_wptouch', "\$cache_wptouch = '$cache_wptouch';", $wp_cache_config_file);
16
  }
17
  $id = 'wptouch-section';
18
  ?>
19
  <fieldset id="<?php echo $id; ?>" class="options">
20
  <h4><?php _e( 'WPTouch', 'wp-super-cache' ); ?></h4>
21
  <form name="wp_manager" action="" method="post">
22
- <label><input type="radio" name="cache_wptouch" value="1" <?php if( $cache_wptouch ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Enabled', 'wp-super-cache' ); ?></label>
23
- <label><input type="radio" name="cache_wptouch" value="0" <?php if( !$cache_wptouch ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Disabled', 'wp-super-cache' ); ?></label>
24
- <?php
25
- echo '<p>' . __( 'Provides support for <a href="http://wordpress.org/extend/plugins/wptouch/">WPTouch</a> mobile theme and plugin.', 'wp-super-cache' ) . '</p>';
26
- if ( isset( $changed ) && $changed ) {
27
- if ( $cache_wptouch )
28
- $status = __( "enabled", 'wp-super-cache' );
29
- else
30
- $status = __( "disabled", 'wp-super-cache' );
31
- echo "<p><strong>" . sprintf( __( "WPTouch support is now %s", 'wp-super-cache' ), $status ) . "</strong></p>";
32
  }
 
 
33
  echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
34
- wp_nonce_field('wp-cache');
35
  ?>
36
  </form>
37
  </fieldset>
@@ -41,36 +42,42 @@ add_cacheaction( 'cache_admin_page', 'wp_super_cache_wptouch_admin' );
41
 
42
  function wp_super_cache_wptouch_notice() {
43
  global $cache_enabled;
44
- if( $cache_enabled )
45
- echo '<div class="error"><p><strong>' . __('WPTouch plugin detected! Please go to the Supercache plugins page and enable the WPTouch helper plugin.', 'wp-super-cache' ) . '</strong></p></div>';
 
46
  }
47
  function wp_super_cache_wptouch_exists() {
48
  global $cache_wptouch;
49
- if ( $cache_wptouch == 1 )
50
  return false;
 
51
 
52
- if ( is_admin() && function_exists( 'wptouch_get_plugin_dir_name' ) )
53
  add_action( 'admin_notices', 'wp_super_cache_wptouch_notice' );
 
54
  }
55
 
56
- if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] == 'wpsupercache' ) {
57
  add_cacheaction( 'add_cacheaction', 'wp_super_cache_wptouch_exists' );
58
  }
59
 
60
- // disable mobile checking if
61
  function wp_super_cache_maybe_disable_wptouch( $t ) {
62
  global $cache_wptouch, $wptouch_exclude_ua;
63
- if ( $cache_wptouch != 1 )
64
  return false;
 
65
 
66
- if ( ( isset( $_COOKIE[ 'wptouch_switch_toggle' ] ) && $_COOKIE[ 'wptouch_switch_toggle' ] == 'normal' ) ||
67
- ( isset( $_COOKIE[ 'wptouch-pro-view' ] ) && $_COOKIE[ 'wptouch-pro-view' ] == 'desktop' ) )
68
  return true;
 
69
 
70
- $ua = explode( ",", $wptouch_exclude_ua );
71
- foreach( $ua as $agent ) {
72
- if ( preg_match( "#$agent#i", $_SERVER[ 'HTTP_HOST' ] ) )
73
- return true; // disable mobile ua check if matches the exclude list in wptouch
 
74
  }
75
 
76
  return false;
@@ -82,12 +89,13 @@ add_cacheaction( 'disable_mobile_check', 'wp_super_cache_maybe_disable_wptouch'
82
  function wp_super_cache_wptouch_browsers( $browsers ) {
83
  global $wptouch_exclude_ua, $wp_cache_config_file;
84
 
85
- if ( false == function_exists( 'bnc_wptouch_get_exclude_user_agents' ) || false == function_exists( 'bnc_wptouch_get_user_agents' ) )
86
  return $browsers;
 
87
 
88
- $browsers = implode( ',', bnc_wptouch_get_exclude_user_agents() ); // hack, support exclude agents too
89
- if ( $browsers != $wptouch_exclude_ua ) {
90
- wp_cache_replace_line('^ *\$wptouch_exclude_ua', "\$wptouch_exclude_ua = '$browsers';", $wp_cache_config_file);
91
  $wptouch_exclude_ua = $browsers;
92
  }
93
 
@@ -95,40 +103,41 @@ function wp_super_cache_wptouch_browsers( $browsers ) {
95
  }
96
 
97
  function wp_super_cache_wptouch_prefixes( $prefixes ) {
98
- return array(); // wptouch doesn't support UA prefixes
99
  }
100
 
101
  function wp_super_cache_wptouch_cookie_check( $cache_key ) {
102
- if ( false == isset( $_COOKIE[ 'wptouch_switch_toggle' ] ) )
103
  return $cache_key;
104
- if ( $_COOKIE[ 'wptouch_switch_toggle' ] == 'normal' || $_COOKIE[ 'wptouch_switch_toggle' ] == 'mobile' )
105
- return $_COOKIE[ 'wptouch_switch_toggle' ];
 
 
106
 
107
- if ( isset( $_COOKIE[ 'wptouch-pro-view' ] ) ) {
108
- if ( $_COOKIE[ 'wptouch-pro-view' ] == 'desktop' )
109
  return 'normal';
110
- else
111
- return $_COOKIE[ 'wptouch-pro-view' ];
 
112
  }
113
 
114
  return $cache_key;
115
  }
116
 
117
- if ( isset( $cache_wptouch ) && $cache_wptouch == 1 ) {
118
  add_cacheaction( 'wp_super_cache_mobile_browsers', 'wp_super_cache_wptouch_browsers' );
119
  add_cacheaction( 'wp_super_cache_mobile_prefixes', 'wp_super_cache_wptouch_prefixes' );
120
  add_cacheaction( 'wp_cache_check_mobile', 'wp_super_cache_wptouch_cookie_check' );
121
  }
122
 
123
  function wpsc_wptouch_list( $list ) {
124
- $list[ 'wptouch' ] = array(
125
  'key' => 'wptouch',
126
- 'url' => 'http://wordpress.org/extend/plugins/wptouch/',
127
  'title' => __( 'WPTouch', 'wp-super-cache' ),
128
  'desc' => __( 'Provides support for WPTouch mobile theme and plugin.', 'wp-super-cache' ),
129
  );
130
  return $list;
131
  }
132
  add_cacheaction( 'wpsc_filter_list', 'wpsc_wptouch_list' );
133
-
134
- ?>
3
  function wp_super_cache_wptouch_admin() {
4
  global $cache_wptouch, $wp_cache_config_file, $valid_nonce;
5
 
6
+ $cache_wptouch = '' === $cache_wptouch ? '0' : $cache_wptouch;
7
 
8
+ if ( isset( $_POST['cache_wptouch'] ) && $valid_nonce ) {
9
+ if ( $cache_wptouch === (int) $_POST['cache_wptouch'] ) {
10
  $changed = false;
11
  } else {
12
  $changed = true;
13
  }
14
+ $cache_wptouch = (int) $_POST['cache_wptouch'];
15
+ wp_cache_replace_line( '^ *\$cache_wptouch', "\$cache_wptouch = '$cache_wptouch';", $wp_cache_config_file );
16
  }
17
  $id = 'wptouch-section';
18
  ?>
19
  <fieldset id="<?php echo $id; ?>" class="options">
20
  <h4><?php _e( 'WPTouch', 'wp-super-cache' ); ?></h4>
21
  <form name="wp_manager" action="" method="post">
22
+ <label><input type="radio" name="cache_wptouch" value="1" <?php if ( $cache_wptouch ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Enabled', 'wp-super-cache' ); ?></label>
23
+ <label><input type="radio" name="cache_wptouch" value="0" <?php if ( ! $cache_wptouch ) { echo 'checked="checked" '; } ?>/> <?php _e( 'Disabled', 'wp-super-cache' ); ?></label>
24
+ <?php
25
+ echo '<p>' . __( 'Provides support for <a href="https://wordpress.org/plugins/wptouch/">WPTouch</a> mobile theme and plugin.', 'wp-super-cache' ) . '</p>';
26
+ if ( isset( $changed ) && $changed ) {
27
+ if ( $cache_wptouch ) {
28
+ $status = __( 'enabled', 'wp-super-cache' );
29
+ } else {
30
+ $status = __( 'disabled', 'wp-super-cache' );
 
31
  }
32
+ echo '<p><strong>' . sprintf( __( 'WPTouch support is now %s', 'wp-super-cache' ), $status ) . '</strong></p>';
33
+ }
34
  echo '<div class="submit"><input class="button-primary" ' . SUBMITDISABLED . 'type="submit" value="' . __( 'Update', 'wp-super-cache' ) . '" /></div>';
35
+ wp_nonce_field( 'wp-cache' );
36
  ?>
37
  </form>
38
  </fieldset>
42
 
43
  function wp_super_cache_wptouch_notice() {
44
  global $cache_enabled;
45
+ if ( $cache_enabled ) {
46
+ echo '<div class="error"><p><strong>' . __( 'WPTouch plugin detected! Please go to the Supercache plugins page and enable the WPTouch helper plugin.', 'wp-super-cache' ) . '</strong></p></div>';
47
+ }
48
  }
49
  function wp_super_cache_wptouch_exists() {
50
  global $cache_wptouch;
51
+ if ( '1' === $cache_wptouch ) {
52
  return false;
53
+ }
54
 
55
+ if ( is_admin() && function_exists( 'wptouch_get_plugin_dir_name' ) ) {
56
  add_action( 'admin_notices', 'wp_super_cache_wptouch_notice' );
57
+ }
58
  }
59
 
60
+ if ( isset( $_GET['page'] ) && 'wpsupercache' === $_GET['page'] ) {
61
  add_cacheaction( 'add_cacheaction', 'wp_super_cache_wptouch_exists' );
62
  }
63
 
64
+ // disable mobile checking if.
65
  function wp_super_cache_maybe_disable_wptouch( $t ) {
66
  global $cache_wptouch, $wptouch_exclude_ua;
67
+ if ( '1' !== $cache_wptouch ) {
68
  return false;
69
+ }
70
 
71
+ if ( ( isset( $_COOKIE['wptouch_switch_toggle'] ) && 'normal' === $_COOKIE['wptouch_switch_toggle'] ) ||
72
+ ( isset( $_COOKIE['wptouch-pro-view'] ) && 'desktop' === $_COOKIE['wptouch-pro-view'] ) ) {
73
  return true;
74
+ }
75
 
76
+ $ua = explode( ',', $wptouch_exclude_ua );
77
+ foreach ( $ua as $agent ) {
78
+ if ( preg_match( "#$agent#i", $_SERVER['HTTP_HOST'] ) ) {
79
+ return true; // disable mobile ua check if matches the exclude list in wptouch.
80
+ }
81
  }
82
 
83
  return false;
89
  function wp_super_cache_wptouch_browsers( $browsers ) {
90
  global $wptouch_exclude_ua, $wp_cache_config_file;
91
 
92
+ if ( false === function_exists( 'bnc_wptouch_get_exclude_user_agents' ) || false === function_exists( 'bnc_wptouch_get_user_agents' ) ) {
93
  return $browsers;
94
+ }
95
 
96
+ $browsers = implode( ',', bnc_wptouch_get_exclude_user_agents() ); // hack, support exclude agents too.
97
+ if ( $browsers !== $wptouch_exclude_ua ) {
98
+ wp_cache_replace_line( '^ *\$wptouch_exclude_ua', "\$wptouch_exclude_ua = '$browsers';", $wp_cache_config_file );
99
  $wptouch_exclude_ua = $browsers;
100
  }
101
 
103
  }
104
 
105
  function wp_super_cache_wptouch_prefixes( $prefixes ) {
106
+ return array(); // wptouch doesn't support UA prefixes.
107
  }
108
 
109
  function wp_super_cache_wptouch_cookie_check( $cache_key ) {
110
+ if ( false === isset( $_COOKIE['wptouch_switch_toggle'] ) ) {
111
  return $cache_key;
112
+ }
113
+ if ( 'normal' === $_COOKIE['wptouch_switch_toggle'] || 'mobile' === $_COOKIE['wptouch_switch_toggle'] ) {
114
+ return $_COOKIE['wptouch_switch_toggle'];
115
+ }
116
 
117
+ if ( isset( $_COOKIE['wptouch-pro-view'] ) ) {
118
+ if ( 'desktop' === $_COOKIE['wptouch-pro-view'] ) {
119
  return 'normal';
120
+ } else {
121
+ return $_COOKIE['wptouch-pro-view'];
122
+ }
123
  }
124
 
125
  return $cache_key;
126
  }
127
 
128
+ if ( isset( $cache_wptouch ) && '1' === $cache_wptouch ) {
129
  add_cacheaction( 'wp_super_cache_mobile_browsers', 'wp_super_cache_wptouch_browsers' );
130
  add_cacheaction( 'wp_super_cache_mobile_prefixes', 'wp_super_cache_wptouch_prefixes' );
131
  add_cacheaction( 'wp_cache_check_mobile', 'wp_super_cache_wptouch_cookie_check' );
132
  }
133
 
134
  function wpsc_wptouch_list( $list ) {
135
+ $list['wptouch'] = array(
136
  'key' => 'wptouch',
137
+ 'url' => 'https://wordpress.org/plugins/wptouch/',
138
  'title' => __( 'WPTouch', 'wp-super-cache' ),
139
  'desc' => __( 'Provides support for WPTouch mobile theme and plugin.', 'wp-super-cache' ),
140
  );
141
  return $list;
142
  }
143
  add_cacheaction( 'wpsc_filter_list', 'wpsc_wptouch_list' );
 
 
readme.txt CHANGED
@@ -1,20 +1,23 @@
1
- === WP Super Cache ===
2
- Contributors: donncha, automattic, kraftbj
3
- Tags: performance,caching,wp-cache,wp-super-cache,cache
4
- Tested up to: 4.8.3
5
- Stable tag: 1.5.8
6
- Requires at least: 3.0
 
 
 
7
 
8
  A very fast caching engine for WordPress that produces static html files.
9
 
10
- == Description ==
11
  This plugin generates static html files from your dynamic WordPress blog. After a html file is generated your webserver will serve that file instead of processing the comparatively heavier and more expensive WordPress PHP scripts.
12
 
13
  The static html files will be served to the vast majority of your users:
14
 
15
- 1. Users who are not logged in.
16
- 2. Users who have not left a comment on your blog.
17
- 3. Or users who have not viewed a password protected post.
18
 
19
  99% of your visitors will be served static html files. One cached file can be served thousands of times. Other visitors will be served custom cached files tailored to their visit. If they are logged in, or have left comments those details will be displayed and cached for them.
20
 
@@ -26,8 +29,7 @@ The plugin serves cached files in 3 ways (ranked by speed):
26
 
27
  If you're not comfortable with editing PHP files then use simple mode. It's easy to set up and very fast.
28
 
29
- = Recommended Settings =
30
-
31
  1. Simple caching.
32
  2. Compress pages.
33
  3. Don't cache pages for known users.
@@ -39,24 +41,233 @@ Garbage collection is the act of cleaning up cache files that are out of date an
39
 
40
  Consider deleting the contents of the "Rejected User Agents" text box and allow search engines to cache files for you.
41
 
42
- Likewise, preload as many posts as you can and enable "Preload Mode". Garbage collection will still occur but it won't affect the preloaded files. If you don't care about sidebar widgets updating often set the preload interval to 2880 minutes (2 days) so all your posts aren't recached very often. When the preload occurs the cache files for the post being refreshed is deleted and then regenerated. Afterwards a garbage collection of all old files is performed to clean out stale cache files.
43
- Cached files will still be deleted when posts are made or edited or comments made when preloading is enabled.
44
 
45
- See the [WP Super Cache homepage](https://wordpress.org/plugins/wp-super-cache/) for further information. [Developer documentation](https://odd.blog/wp-super-cache-developers/) is also available for those who need to interact with the cache or write plugins.
 
 
46
 
47
- There's a [GIT repository](https://github.com/Automattic/wp-super-cache) too if you want to contribute a patch.
 
48
 
49
- The [commit list](https://github.com/Automattic/wp-super-cache/commits/master) is a good place to start if you want to know what has changed since you last downloaded the plugin.
 
 
50
 
51
- Interested in translating WP Super Cache to your language? See the [translation page](https://translate.wordpress.org/projects/wp-plugins/wp-super-cache) for the plugin.
 
 
 
 
 
 
 
52
 
53
  The cache directory, usually wp-content/cache/ is only for temporary files. Do not ever put important files or symlinks to important files or directories in that directory. They will be deleted if the plugin has write access to them.
54
 
55
- == Upgrade Notice ==
56
- Many bug fixes
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
- == Changelog ==
59
- = 1.5.8 =
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  * PHP 7 fixes. (#429)
61
  * Fix debug comments checkbox. (#433)
62
  * Only register uninstall function in admin pages to save queries. (#430)
@@ -71,15 +282,15 @@ Many bug fixes
71
  * Fixed more PHP warnings in #438 and #437
72
  * Hide mod_rewrite warnings for Nginx users. #434
73
 
74
- = 1.5.7.1 =
75
  * If the HTTP HOST is empty then don't use it in strpos to avoid a PHP warning. (#408)
76
  * Don't preload posts with permalinks that contain rejected strings. (#407)
77
  * Generate a list of archive feeds that can be deleted when the site is updated. Also fixes corrupted config file issue and fatal error with older versions of WordPress. (#403)
78
 
79
- = 1.5.7 =
80
  * Fix fatal error in plugins/searchengine.php (#398)
81
 
82
- = 1.5.6 =
83
  * REST API: Added /plugins endpoint to handle the plugins settings page. (#382)
84
  * Minor changes to indentaion and spaces to tabs conversion (#371) (#395)
85
  * Don't set $wp_super_cache_comments here as it's not saved. (#379)
@@ -90,14 +301,14 @@ Many bug fixes
90
  * Fix some PHP notices when comments are edited/published/maintained. (#386)
91
  * Minor changes to description on plugins page. (#393)
92
 
93
- = 1.5.5 =
94
  * Catch fatal errors so they're not cached, improve code that catches unknown page types. (#367)
95
  * Fix caching on older WP installs, and if the plugin is inactive on a blog, but still caching, give feeds a short TTL to ensure they're fresh. (#366)
96
  * When preloading don't delete sub-directories, or child pages, when caching pages. (#363)
97
  * Avoid PHP warnings from the REST API for settings that are not yet defined. (#361)
98
  * Added missing settings to the config file. (#360)
99
 
100
- = 1.5.4 =
101
  * Fix messages related to creating advanced-cache.php (#355, #354)
102
  * Deleting the plugin doesn't need to delete the cache directory as it's already done on deactivation. (#323)
103
  * Disable Jetpack mobile detection if Jetpack Beta is detected. (#298)
@@ -117,10 +328,10 @@ Many bug fixes
117
  * Other minor changes to html or typos
118
  (Numbers are [pull requests](https://github.com/Automattic/wp-super-cache/pulls) on Github.)
119
 
120
- = 1.5.3 =
121
  * Fix a critical bug that caused unlink to be run on null while deleting the plugin.
122
 
123
- = 1.5.2 =
124
  * Add a trailing slash to home path. Fixes problems with finding the .htaccess file.
125
  * Delete WPCACHEHOME and WP_CACHE from wp-config.php when plugin deactivated.
126
  * Check that WPCACHEHOME is the right path on each load of the settings page.
@@ -133,19 +344,19 @@ Many bug fixes
133
  * Added more information for when updating the .htaccess file fails.
134
  * "Served by" header is now optional. Enable it by setting $wpsc_served_header to true in the config file.
135
 
136
- = 1.5.1 =
137
  * Don't use anonymous functions in REST API
138
  * Check that REST API Controller is available before loading the REST API.
139
  * Don't use multibyte string functions because some sites don't have it enabled.
140
 
141
- = 1.5.0 =
142
  * REST API settings endpoints.
143
  * Simplified settings page.
144
  * WP-Cache files reorganised.
145
  * Caching of more http headers.
146
  * Lots of bug fixes.
147
 
148
- = 1.4.9 =
149
  * Fixed bug when not running sem_remove after sem_release. See https://github.com/Automattic/wp-super-cache/issues/85
150
  * Fixed a PHP error impacting PHP 7.1.
151
  * Fixed a bug where we cached PUT and DELETE requests. We're treating them like POST requests now.
@@ -160,17 +371,17 @@ Many bug fixes
160
  * Add fix for customizer [#161](https://github.com/Automattic/wp-super-cache/pull/161) and don't cache PUT AND DELETE requests [#178](https://github.com/Automattic/wp-super-cache/pull/178)
161
  * Check for superglobals before using them. [#131](https://github.com/Automattic/wp-super-cache/pull/131)
162
 
163
- = 1.4.8 =
164
  * Removed malware URL in a code comment. (harmless to operation of plugin but gets flagged by A/V software)
165
  * Updated translation file.
166
 
167
- = 1.4.7 =
168
  * Update the settings page for WordPress 4.4. layout changes.
169
 
170
- = 1.4.6 =
171
  * Generate the file cache/.htaccess even when one exists so gzip rules are created and gzipped pages are served correctly. Props Tigertech. https://wordpress.org/support/topic/all-website-pages-downloading-gz-file-after-latest-update?replies=36#post-7494087
172
 
173
- = 1.4.5 =
174
  * Enhancement: Only preload public post types. Props webaware.
175
  * Added an uninstall function that deletes the config file. Deactivate function doesn't delete it any more.
176
  * Possible to deactivate the plugin without visiting the settings page now.
@@ -185,47 +396,47 @@ Many bug fixes
185
  * Hide cache files when servers display directory indexes.
186
  * Prevent PHP object injection through use of serialize().
187
 
188
- = 1.4.4 =
189
  * Fixed fatal error in output handler if GET parameters present in query. Props webaware.
190
  * Fixed debug log. It wasn't logging the right message.
191
 
192
- = 1.4.3 =
193
  * Security release fixing an XSS bug in the settings page. Props Marc Montpas from Sucuri.
194
  * Added wp_debug_log(). Props Jen Heilemann.
195
  * Minor fixes.
196
 
197
- = 1.4.2 =
198
  * Fixed "acceptable file list".
199
  * Fixed "Don't cache GET requests" feature.
200
  * Maybe fixed "304 not modified" problem for some users.
201
  * Fixed some PHP warnings.
202
 
203
- = 1.4.1 =
204
  * Fixed XSS in settings page. Props Simon Waters, Surevine Limited.
205
  * Fix to object cache so entries may now be deleted when posts updated. (object cache still experimental)
206
  * Documentation updates and cleanup of settings page.
207
 
208
- = 1.4 =
209
  * Replace legacy mfunc/mnclude/dynamic-cached-content functionality with a "wpsc_cachedata" cacheaction filter.
210
  * Added dynamic-cache-test.php plugin example wpsc_cachedata filter plugin.
211
  * Delete post, tag and category cache when a post changes from draft to publish or vice versa. Props @Biranit.
212
  * Update advanced-cache.php and wp-config.php if wp-cache-phase1.php doesn't load, usually happening after migrating to a new hosting service.
213
  * Misc bugfixes.
214
 
215
- = 1.3.2 =
216
  * Any mfunc/mclude/dynamic-cached-content tags in comments are now removed.
217
  * Dynamic cached content feature disabled by default and must be enabled on the Advanced Settings page.
218
  * Support for the mobile theme in Jetpack via helper plugin on script's Plugins tab.
219
 
220
- = 1.3.1 =
221
  * Minor updates to documentation
222
  * Fixed XSS in settings page.
223
 
224
- = 1.3 =
225
  * mfunc tags could be executed in comments. Fixed.
226
  * More support for sites that use the LOGGED_IN_COOKIE constant and custom cookies.
227
 
228
- = 1.2 =
229
  * Garbage collection of old cache files is significantly improved. I added a scheduled job that keeps an eye on things and restarts the job if necessary. Also, if you enable caching from the Easy page garbage collection will be enabled too.
230
  * Editors can delete single cached files from the admin bar now.
231
  * Fixed the cached page counter on the settings page.
@@ -238,7 +449,7 @@ Many bug fixes
238
  * Some sites had problems with scheduled posts. For some reason the plugin thought the post was in draft mode and then because it only checked the same post once, when the post magically became published the cache wasn.t cleared. That.s fixed, thanks to the debug logging of several patient users.
239
  * And more bug fixes and translation updates.
240
 
241
- = 1.1 =
242
  * Use $_SERVER[ 'SERVER_NAME' ] to create cache directories.
243
  * Only create blogs cached directories if valid requests and blogs exist.
244
  * Only clear current blog's cache files if navigation menu is modified
@@ -265,7 +476,7 @@ Many bug fixes
265
  * Removed debug level from logging as it wasn't helpful.
266
  * Removed mention of wp-minify.
267
 
268
- = 1.0 =
269
  * Removed AddDefaultCharset .htaccess rule
270
  * Fixed problem with blogs in a folder and don't have a trailing slash
271
  * New scheduling of garbage collection
@@ -279,7 +490,7 @@ Many bug fixes
279
  * Use WP 3.0 variables to detect multisite installs
280
  * Hash filenames so files are served from the same CDNs
281
 
282
- = 0.9.9.9 =
283
  * Fixed typo, is_front_page.
284
  * Serve repeated static files from the same CDN hostname.
285
  * Updated translations.
@@ -288,7 +499,7 @@ Many bug fixes
288
  * Remove 5 second check on age of existing cache files. Should help with posts that get lots of comments and traffic.
289
  * Lots of bugs fixed.
290
 
291
- = 0.9.9.8 =
292
  * CDN updates: can be switched off, multiple CNAMEs.
293
  * Uninstall process improved. It removes generated files and fixes edited files.
294
  * Cached dynamic pages can now be stored in Supercache files and compressed.
@@ -296,20 +507,20 @@ Many bug fixes
296
  * Remove log by email functionality as it caused problems for users who were inundated by email
297
  * Many more minor fixes and changes.
298
 
299
- = 0.9.9.6 =
300
  * Fixed problem serving cached files with PHP
301
  * Added support for 304 "file not modified" header to help browser caching. (PHP caching only)
302
  * Added French & German translations, updated Italian translation and fixed translation strings.
303
  * Sleep 4 seconds between preload urls to reduce load on the server
304
  * Updated docs and FAQs.
305
 
306
- = 0.9.9.5 =
307
  * Disable compression on on easy setup page. Still causes problems on some hosts.
308
  * Remove footerlink on easy setup page.
309
  * Don't delete mod_rewrite rules when caching is disabled.
310
  * Don't stop users using settings page when in safe mode.
311
 
312
- = 0.9.9.4 =
313
  * Settings page split into tabbed pages.
314
  * Added new "Easy" settings page for new users.
315
  * New PHP caching mode to serve supercached files.
@@ -324,16 +535,16 @@ Many bug fixes
324
  * Serve the gzipped page when first cached if the client supports compression.
325
  * Lots more bug fixes..
326
 
327
- = 0.9.9.3 =
328
  * Fixed division by zero error in half on mode.
329
  * Always show "delete cache" button.
330
  * Fixed "Update mod_rewrite rules" button.
331
  * Minor text changes to admin page.
332
 
333
- = 0.9.9.2 =
334
  * Forgot to change version number in wp-cache.php
335
 
336
- = 0.9.9.1 =
337
  * Added preloading of static cache.
338
  * Better mobile plugin support
339
  * .htaccess rules can be updated now. Added wpsc_update_htaccess().
@@ -342,7 +553,7 @@ Many bug fixes
342
  * Added clear_post_supercache() to clear supercache for a single post.
343
  * Put quotes around rewrite rules in case paths have spaces.
344
 
345
- = 0.9.9 =
346
  * Added experimental object cache support.
347
  * Added Chinese(Traditional) translation by Pseric.
348
  * Added FAQ on WP-Cache vs Supercache files.
@@ -358,7 +569,7 @@ Many bug fixes
358
  * Updated Italian translation.
359
  * Link to WP Mobile Edition from admin page for mobile support.
360
 
361
- = 0.9.8 =
362
  * Added Spanish translation by Omi.
363
  * Added Italian translation by Gianni Diurno.
364
  * Addded advanced debug code to check front page for category problem. Enable by setting $wp_super_cache_advanced_debug to 1 in the config file.
@@ -370,7 +581,7 @@ Many bug fixes
370
  * Fixed problem deleting cache file.
371
  * Don't delete cache files when moderated comments are deleted.
372
 
373
- = 0.9.7 =
374
  * Fixed problem with blogs in folders.
375
  * Added cache file listing and delete links to admin page.
376
  * Added "Newest Cached Pages" listing in sidebox.
@@ -386,12 +597,12 @@ Many bug fixes
386
  * Fixed problem with PHP safe_mode detection.
387
  * Various bugfixes and documentation updates. See Changelog.txt
388
 
389
- = 0.9.6.1 =
390
  * Move "not logged in" message init below check for POST.
391
  * Add is_admin() check so plugin definitely can't cache the backend.
392
  * Add "do not cache" page type to admin page.
393
 
394
- = 0.9.6 =
395
  * Add uninstall.php uninstall script.
396
  * Updated cache/.htaccess rules (option to upgrade that)
397
  * Added FAQ about category and static homepage problem.
@@ -399,7 +610,7 @@ Many bug fixes
399
  * Show message for logged in users when caching disable for them.
400
  * Check filemtime on correct supercache file
401
 
402
- = 0.9.5 =
403
  * Show next and last GC times in minutes, not local time.
404
  * Don't serve wp_cache cache files to rejected user agents. Supercache files are still served to them.
405
  * If enabled, mobile support now serves php cached files to mobile clients and static cached files to everyone else.
@@ -407,7 +618,7 @@ Many bug fixes
407
  * Added check for DONOTCACHEPAGE constant to avoid caching a page.
408
  * Use PHP_DOCUMENT_ROOT when creating .htaccess if necessary.
409
 
410
- = 0.9.4.3 =
411
  1. Added "Don't cache for logged in users" option.
412
  2. Display file size stats on admin page.
413
  3. Clear the cache when profile page is updated.
@@ -415,230 +626,6 @@ Many bug fixes
415
  5. Added backslashes to rejected URI regex list.
416
  6. Fixed problems with posts and comments not refreshing.
417
 
418
- == Installation ==
419
- Install like any other plugin, directly from your plugins page but make sure you have custom permalinks enabled. Go to the plugin settings page at Settings->WP Super Cache and enable caching.
420
-
421
- == How to uninstall WP Super Cache ==
422
-
423
- Almost all you have to do is deactivate the plugin on the plugins page. The plugin should clean up most of the files it created and modified, but it doesn't as yet remove the mod_rewrite rules from the .htaccess file. Look for the section in that file marked by SuperCache BEGIN and END tags. The plugin doesn't remove those because some people add the WordPress rules in that block too.
424
-
425
- To manually uninstall:
426
-
427
- 1. Turn off caching on the plugin settings page and clear the cache.
428
- 2. Deactivate the plugin on the plugins page.
429
- 3. Remove the WP_CACHE define from wp-config.php. It looks like `define( 'WP_CACHE', true );`
430
- 4. Remove the Super Cache mod_rewrite rules from your .htaccess file.
431
- 5. Remove the files wp-content/advanced-cache.php and wp-content/wp-cache-config.php
432
- 6. Remove the directory wp-content/cache/
433
- 7. Remove the directory wp-super-cache from your plugins directory.
434
-
435
- == If all else fails and your site is broken ==
436
- 1. Remove the WP_CACHE define from wp-config.php. It looks like `define( 'WP_CACHE', true );`
437
- 2. Remove the rules (see above) that the plugin wrote to the .htaccess file in your root directory.
438
- 3. Delete the wp-super-cache folder in the plugins folder.
439
- 4. Optionally delete advanced-cache.php, wp-cache-config.php and the cache folder in wp-content/.
440
-
441
- == Frequently Asked Questions ==
442
-
443
- = How do I know my blog is being cached? =
444
-
445
- Go to Settings->WP Super Cache and look for the "Cache Tester" form on the easy settings page. Click "Test Cache" and the plugin will request the front page of the site twice, comparing a timestamp on each to make sure they match.
446
-
447
- If you want to do it manually, enable debugging in the plugin settings page and load the log file in a new browser tab. Then view your blog while logged in and logged out. You should see activity in the log. View the source of any page on your site. When a page is first created, you'll see the text "Dynamic page generated in XXXX seconds." and "Cached page generated by WP-Super-Cache on YYYY-MM-DD HH:MM:SS" at the end of the source code. On reload, a cached page will show the same timestamp so wait a few seconds before checking.
448
- If Supercaching is disabled and you have compression enabled, the text "Compression = gzip" will be added. If compression is disabled and the page is served as a static html file, the text "super cache" will be added. The only other way to check if your cached file was served by PHP script or from the static cache is by looking at the HTTP headers. PHP cached pages will have the header "WP-Super-Cache: Served supercache file from PHP". WPCache cached files will have the header, "WP-Super-Cache: Served WPCache cache file". You should also check your cache directory in wp-content/cache/supercache/hostname/ for static cache files.
449
- If the plugin rules are missing from your .htaccess file, the plugin will attempt to serve the super cached page if it's found. The header "WP-Super-Cache: Served supercache file from PHP" if this happens.
450
-
451
- = How do I disable Supercaching? =
452
-
453
- If you only want to use the WP-Cache engine then edit your wp-config.php or create an mu-plugin that sets the constant 'DISABLE_SUPERCACHE' to 1.
454
-
455
- = WP-Cache vs Supercache files =
456
-
457
- All cache files are stored in wp-content/cache/supercache/HOSTNAME/ where HOSTNANE is your domain name. The files are stored in directories matching your site's permalink structure. Supercache files are index.html or some variant of that, depending on what type of visitor hit the blog. Other files are named wp-cache-XXXXXXXXXXXXXXXXX.php. Associated meta filesnames start with "meta". Those files contain information about the cached file. These files are generated by the "WPCache caching" engine in the plugin.
458
-
459
- = Will comments and other dynamic parts of my blog update immediately? =
460
-
461
- Comments will show as soon as they are moderated, depending on the comment policy of the blog owner. Other dynamic elements on a page may not update unless they are written in Javascript, Flash, Java or another client side browser language. The plugin really produces static html pages. No PHP is executed when those pages are served. "Popularity Contest" is one such plugin that will not work.
462
-
463
- = Will the Super Cache compression slow down my server? =
464
-
465
- No, it will do the opposite. Super Cache files are compressed and stored that way so the heavy compression is done only once. These files are generally much smaller and are sent to a visitor's browser much more quickly than uncompressed html. As a result, your server spends less time talking over the network which saves CPU time and bandwidth, and can also serve the next request much more quickly.
466
-
467
- = How do I make certain parts of the page stay dynamic? =
468
-
469
- Note: this functionality is disabled by default. You will have to enable it on the Advanced Settings page.
470
-
471
- There are 2 ways of doing this. You can use Javascript to draw the part of the page you want to keep dynamic. That's what Google Adsense and many widgets from external sites do and is the recommended way. Or you can use a WP Super Cache filter to do the job but you can't use mod_rewrite mode caching. You have to use the "simple" delivery method or disable supercaching.
472
-
473
- WP Super Cache 1.4 introduced a cacheaction filter called wpsc_cachedata. The cached page to be displayed goes through this filter and allows modification of the page. If the page contains a placeholder tag the filter can be used to replace that tag with your dynamically generated html.
474
- The function that hooks on to the wpsc_cachedata filter should be put in a file in the WP Super Cache plugins folder unless you use the late_init feature. An example plugin is included. Edit [dynamic-cache-test.php](http://svn.wp-plugins.org/wp-super-cache/trunk/plugins/dynamic-cache-test.php) to see the example code.
475
- There are two example functions there. There's a simple function that replaces a string (or tag) you define when the cached page is served. The other example function uses an output buffer to generate the dynamic content. Due to a limitation in how PHP works the output buffer code MUST run before the wpsc_cachedata filter is hit, at least for when a page is cached. It doesn't matter when serving cached pages. See [this post](https://odd.blog/y/6j) for a more technical and longer explanation.
476
- To execute WordPress functions you must enable the 'Late init' feature on the advanced settings page.
477
-
478
- = How do I use WordPress functions in cached dynamic pages? =
479
- = How do I delay serving the cache until the "init" action fires? =
480
-
481
- Cached files are served before almost all of WordPress is loaded. While that's great for performance it's a pain when you want to extend the plugin using a core part of WordPress. Enable 'Late init' mode on the Advanced settings page and cached files will be served when "init" fires. WordPress and it's plugins will be loaded now.
482
-
483
- = Why don't WP UserOnline, Popularity Contest, WP Postratings or plugin X not work or update on my blog now? =
484
-
485
- This plugin caches entire pages but some plugins think they can run PHP code every time a page loads. To fix this, the plugin needs to use Javascript/AJAX methods or the wpsc_cachedata filter described in the previous answer to update or display dynamic information.
486
-
487
- = Why do my WP Super Cache plugins disappear when I upgrade the plugin? =
488
-
489
- WordPress deletes the plugin folder when it updates a plugin. This is the same with WP Super Cache so any modified files in wp-super-cache/plugins/ will be deleted. You can define the variable $wp_cache_plugins_dir in wp-config.php or wp-content/wp-cache-config.php and point it at a directory outside of the wp-super-cache folder. The plugin will look there for it's plugins.
490
-
491
- = What does the Cache Rebuild feature do? =
492
-
493
- When a visitor leaves a comment the cached file for that page is deleted and the next visitor recreates the cached page. A page takes time to load so what happens if it receives 100 visitors during this time? There won't be a cached page so WordPress will serve a fresh page for each user and the plugin will try to create a cached page for each of those 100 visitors causing a huge load on your server. This feature stops this happening. The cached page is not cleared when a comment is left. It is marked for rebuilding instead. The next visitor within the next 10 seconds will regenerate the cached page while the old page is served to the other 99 visitors. The page is eventually loaded by the first visitor and the cached page updated. See [this post](https://odd.blog/2009/01/23/wp-super-cache-089/) for more.
494
-
495
- = Why doesn't the plugin cache requests by search engine bots by default? =
496
-
497
- Those bots usually only visit each page once and if the page is not popular there's no point creating a cache file that will sit idle on your server. However you can allow these visits to be cached by removing the list of bots from "Rejected User Agents" on the Advanced settings page.
498
-
499
- = A category page is showing instead of my homepage =
500
-
501
- A tiny proportion of websites will have problems with the following configuration:
502
-
503
- 1. Uses a static page for the front page.
504
- 2. Uses /%category%/%postname%/ permalink structure.
505
-
506
- Sometimes a category page is cached as the homepage of the site instead of the static page. I can't [replicate the problem](http://wordpress.org/support/topic/237415/page/2?replies=38) but a simple solution is to use the "Simple" mode. You can also enable "Extra homepage checks" on the Advanced Settings page.
507
-
508
- = Why do I get warnings about caching from http://ismyblogworking.com/ =
509
-
510
- "Your blog doesn't support client caching (no 304 response to If-modified-since)."
511
- "Your feed doesn't support caching (no 304 response to If-modified-since)"
512
-
513
- Supercache doesn't support 304 header checks in Expert mode but does support it in Simple mode. This is caching done by your browser, not the server. It is a check your browser does to ask the server if an updated version of the current page is available. If not, it doesn't download the old version again. The page is still cached by your server, just not by your visitors' browsers.
514
- Try the Cacheability Engine at http://www.ircache.net/cgi-bin/cacheability.py or http://redbot.org/ for further analysis.
515
-
516
- = How should I best use the utm_source tracking tools in Google Analytics with this plugin? =
517
-
518
- That tracking adds a query string to each url linked from various sources like Twitter and feedreaders. Unfortunately it stops pages being supercached. See [Joost's comment here](https://odd.blog/remove-unused-utmsource-urls/#comment-672813) for how to turn it into an anchor tag which can be supercached.
519
-
520
- = The plugin complains that wp-content is writable! htdocs is writable! =
521
-
522
- It's not good when the web server can write to these directories but sometimes shared hosting accounts are set up in this way to make administration easier. Use `chmod 755 directory` to fix the permissions or find the permissions section of your ftp client. This [Google search](http://www.google.ie/search?sourceid=chrome&ie=UTF-8&q=ftp+fix+directory+permissions+755) will lead you to more information on this topic and there's also [this codex page](http://codex.wordpress.org/Changing_File_Permissions) too. Unfortunately some hosts require that those directories be writable. If that's the case just ignore this warning.
523
-
524
- = How do I delete the WP_CACHE define from wp-config.php? =
525
-
526
- Load your desktop ftp client and connect to your site. Navigate to the root (or the directory below it) of your site where you'll find wp-config.php. Download that file and edit it in a text editor. Delete the line `define( 'WP_CACHE', true );` and save the file. Now upload it, overwriting the wp-config.php on your server.
527
-
528
- = How do I delete the Super Cache rules from the .htaccess file? =
529
-
530
- Load your desktop ftp client and connect to your site. You may need to enable "Show hidden files" in the preferences of the ftp client. Navigate to the root of your site where you'll find the .htaccess file. Download that file and edit it in a text editor. Delete the lines between "# BEGIN WPSuperCache" and "# END WPSuperCache" and save the file. Now upload it, overwriting the .htaccess file on your server.
531
-
532
- = How do I change file permissions? =
533
-
534
- This [page](http://codex.wordpress.org/Changing_File_Permissions) on the WordPress Codex explains everything you need to know about file permissions on your server and various ways of changing them.
535
-
536
- = Why do I get load spikes when new posts are made? =
537
-
538
- You may have the "clear all cached files when new posts are made" option set. Clearing those files can take time plus your visitors will now be visiting uncached pages. Are you using Google Analytics campaign tracking with utm_source in the url? Those pages aren't cached. See the question, "How should I best use the utm_source tracking tools in Google Analytics with this plugin" above for how to use them properly.
539
- Cached pages have to be refreshed when posts are made. Perhaps your server just isn't up to the job of serving the amount of traffic you get. Enable the "cache rebuild" feature as that may help.
540
-
541
- = How many pages can I cache? =
542
-
543
- The only real limit are limits defined by your server. For example, EXT2 and EXT3 allow a maximum of 31,999 sub directories so if you have a flat permalink structure (like /%POSTNAME%/) and more than 32,000 posts you may run into problems. Likewise, if you run a multisite network and have more than 31,999 sites (blogs) you won't be able to cache all of them. Realistically if you had that many active sites you wouldn't be running on one server.
544
-
545
- = How do I serve cached mobile pages to clients on small screens like phones and tablets? =
546
-
547
- Your theme is probably responsive which means it resizes the page to suit whatever device is displaying the page. If it's not responsive, you'll have to use a separate mobile plugin to render a page formatted for those visitors. The following plugins have been tested but YMMV depending on mobile client. You'll have to enable mobile browser support as well on the Advanced settings page.
548
-
549
- * [Jetpack's Mobile Theme Module](http://wordpress.org/plugins/jetpack)
550
- * [WPTouch](http://wordpress.org/plugins/wptouch/)
551
- * [WordPress Mobile Edition](http://wordpress.org/plugins/wordpress-mobile-edition/)
552
- * [WordPress Mobile Pack](http://wordpress.org/plugins/wordpress-mobile-pack/) (can't have "Don't cache pages for known users." enabled)
553
-
554
- = Troubleshooting =
555
-
556
- If things don't work when you installed the plugin here are a few things to check:
557
-
558
- 1. Is wp-content writable by the web server?
559
- 2. Is there a wp-content/wp-cache-config.php ? If not, copy the file wp-super-cache/wp-cache-config-sample.php to wp-content/wp-cache-config.php and make sure WPCACHEHOME points at the right place.
560
- 3. Is there a wp-content/advanced-cache.php ? If not, then you must copy wp-super-cache/advanced-cache.php into wp-content/. You must edit the file and change the path so it points at the wp-super-cache folder.
561
- 4. If pages are not cached at all, remove wp-content/advanced-cache.php and recreate it, following the advice above.
562
- 5. Make sure the following line is in wp-config.php and it is ABOVE the "require_once(ABSPATH.'wp-settings.php');" line:
563
-
564
- `define( 'WP_CACHE', true );`
565
- 6. Try the Settings->WP Super Cache page again and enable cache.
566
- 7. Look in wp-content/cache/supercache/. Are there directories and files there?
567
- 8. Anything in your php error_log?
568
- 9. If your browser keeps asking you to save the file after the super cache is installed you must disable Super Cache compression. Go to the Settings->WP Super Cache page and disable it there.
569
- 10. The plugin does not work very well when PHP's safe mode is active. This must be disabled by your administrator.
570
- 11. If pages are randomly super cached and sometimes not, your blog can probably be viewed with and without the "www" prefix on the URL. You should choose one way and install the [Enforce www preference](http://txfx.net/code/wordpress/enforce-www-preference/) plugin if you are using an old WordPress install. The latest versions redirect themselves (you should always be running the latest version of WordPress anyway!)
571
- 12. Private Server users at Dreamhost should edit wp-content/wp-cache-config.php and set the cache dir to "/tmp/" if they are getting errors about increasing CPU usage. See this [discussion](http://wordpress.org/support/topic/145895?replies=42) for more.
572
- 13. File locking errors such as "failed to acquire key 0x152b: Permission denied in..." or "Page not cached by WP Super Cache. Could not get mutex lock." are a sign that you may have to use file locking. Edit wp-content/wp-cache-config.php and uncomment "$use_flock = true" or set $sem_id to a different value. You can also disable file locking from the Admin screen as a last resort.
573
- 14. Make sure cache/wp_cache_mutex.lock is writable by the web server if using coarse file locking.
574
- 15. The cache folder cannot be put on an NFS or Samba or NAS share. It has to be on a local disk. File locking and deleting expired files will not work properly unless the cache folder is on the local machine.
575
- 16. Garbage collection of old cache files won't work if WordPress can't find wp-cron.php. If your hostname resolves to 127.0.0.1 it could be preventing the garbage collection from working. Check your access_logs for wp-cron.php entries. Do they return a 404 (file not found) or 200 code? If it's 404 or you don't see wp-cron.php anywhere WordPress may be looking for that script in the wrong place. You should speak to your server administator to correct this or edit /etc/hosts on Unix servers and remove the following line. Your hostname must resolve to the external IP address other servers on the network/Internet use. See http://yoast.com/wp-cron-issues/ for more. A line like "127.0.0.1 localhost localhost.localdomain" is ok.
576
-
577
- `127.0.0.1 myhostname.com`
578
- 17. If old pages are being served to your visitors via the supercache, you may be missing Apache modules (or their equivalents if you don't use Apache). 3 modules are required: mod_mime, mod_headers and mod_expires. The last two are especially important for making sure browsers load new versions of existing pages on your site.
579
- 18. The error message, "WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed!" appears at the end of every page. Open the file wp-content/advanced-cache.php in your favourite editor. Is the path to wp-cache-phase1.php correct? This file will normally be in wp-content/plugins/wp-super-cache/. If it is not correct the caching engine will not load.
580
- 19. Caching doesn't work. The timestamp on my blog keeps changing when I reload. Check that the path in your .htaccess rules matches where the supercache directory is. You may have to hardcode it. Try disabling supercache mode.
581
- 20. If supercache cache files are generated but not served, check the permissions on all your wp-content/cache/supercache folders (and each of wp-content cache and supercache folders) and wp-content/cache/.htaccess. If your PHP runs as a different user to Apache and permissions are strict Apache may not be able to read the PHP generated cache files. To fix you must add the following line to your wp-config.php (Add it above the WP_CACHE define.) Then clear your cache.
582
-
583
- `umask( 0022 );`
584
- 21. If you see garbage in your browser after enabling compression in the plugin, compression may already be enabled in your web server. In Apache you must disable mod_deflate, or in PHP zlib compression may be enabled. You can disable that in three ways. If you have root access, edit your php.ini and find the zlib.output_compression setting and make sure it's "Off" or add this line to your .htaccess:
585
-
586
- `php_flag zlib.output_compression off`
587
- If that doesn't work, add this line to your wp-config.php:
588
-
589
- `ini_set('zlib.output_compression', 0);`
590
- 22. The "white screen of death" or a blank page when you visit your site is almost always caused by a PHP error but [it may also be caused by APC](http://www.johnberns.com/2010/03/19/wp-super-cache-blank-page-problem-fixed/). Disable that PHP extension if you have trouble and replace with eAccelerator or Xcache.
591
- 23. After uninstalling, your permalinks may break if you remove the WordPress mod_rewrite rules too. Regenerate those rules by visiting the Settings->Permalink page and saving that form again.
592
- 24. If your blog refuses to load make sure your wp-config.php is correct. Are you missing an opening or closing PHP tag?
593
- 25. Your front page is ok but posts and pages give a 404? Go to Settings->permalinks and click "Save" once you've selected a custom permalink structure. You may need to manually update your .htaccess file.
594
- 26. If certain characters do not appear correctly on your website your server may not be configured correctly. You need to tell visitors what character set is used. Go to Settings->Reading and copy the 'Encoding for pages and feeds' value. Edit the .htaccess file with all your Supercache and WordPress rewrite rules and add this at the top, replacing CHARSET with the copied value. (for example, 'UTF-8')
595
-
596
- `AddDefaultCharset CHARSET`
597
- 27. Use [Cron View](http://wordpress.org/plugins/cron-view/) to help diagnose garbage collection and preload problems. Use the plugin to make sure jobs are scheduled and for what time. Look for the wp_cache_gc and wp_cache_full_preload_hook jobs.
598
- 18. The error message, "WP Super Cache is installed but broken. The constant WPCACHEHOME must be set in the file wp-config.php and point at the WP Super Cache plugin directory." appears at the end of every page. You can delete wp-content/advanced-cache.php and reload the plugin settings page or edit wp-config.php and look for WPCACHEHOME and make sure it points at the wp-super-cache folder. This will normally be wp-content/plugins/wp-super-cache/ but you'll likely need the full path to that file (so it's easier to let the settings page fix it). If it is not correct the caching engine will not load.
599
- 19. If your server is running into trouble because of the number of semaphores used by the plugin it's because your users are using file locking which is not recommended (but is needed by a small number of users). You can globally disable file locking by defining the constant WPSC_DISABLE_LOCKING, or defining the constant WPSC_REMOVE_SEMAPHORE so that sem_remove() is called after every page is cached but that seems to cause problems for other processes requesting the same semaphore. Best to disable it.
600
-
601
- == Preloading ==
602
-
603
- You can generate cached files for the posts, categories and tags of your site by preloading. Preloading will visit each page of your site generating a cached page as it goes along, just like any other visitor to the site. Due to the sequential nature of this function, it can take some time to preload a complete site if there are many posts.
604
- To make preloading more effective it can be useful to disable garbage collection so that older cache files are not deleted. This is done by enabling "Preload Mode" in the settings. Be aware however, that pages will go out of date eventually but that updates by submitting comments or editing posts will clear portions of the cache.
605
-
606
- == Garbage Collection ==
607
-
608
- Your cache directory fills up over time, which takes up space on your server. If space is limited or billed by capacity, or if you worry that the cached pages of your site will go stale then garbage collection has to be done. Garbage collection happens on a regular basis and deletes old files in the cache directory. On the advanced settings page you can specify:
609
- 1. Cache timeout. How long cache files are considered fresh for. After this time they are stale and can be deleted.
610
- 2. Scheduler. Setup how often garbage collection should be done.
611
- 3. Notification emails. You can be informed on garbage collection job progress.
612
- There's no right or wrong settings for garbage collection. It depends on your own site.
613
- If your site gets regular updates, or comments then set the timeout to 1800 seconds, and set the timer to 600 seconds.
614
- If your site is mostly static you can disable garbage collection by entering 0 as the timeout, or use a really large timeout value.
615
-
616
- == CDN ==
617
-
618
- A Content Delivery Network (CDN) is usually a network of computers situated around the world that will serve the content of your website faster by using servers close to you. Static files like images, Javascript and CSS files can be served through these networks to speed up how fast your site loads. You can also create a "poor man's CDN" by using a sub domain of your domain to serve static files too.
619
-
620
- [OSSDL CDN off-linker](http://wordpress.org/plugins/ossdl-cdn-off-linker/) has been integrated into WP Super Cache to provide basic CDN support. It works by rewriting the URLs of files (excluding .php files) in wp-content and wp-includes on your server so they point at a different hostname. Many CDNs support [origin pull](http://www.google.com/search?hl=en&q=%22origin+pull%22). This means the CDN will download the file automatically from your server when it's first requested, and will continue to serve it for a configurable length of time before downloading it again from your server.
621
-
622
- Configure this on the "CDN" tab of the plugin settings page. This is an advanced technique and requires a basic understanding of how your webserver or CDNs work. Please be sure to clear the file cache after you configure the CDN.
623
-
624
- == REST API ==
625
-