Version Description
- Fixed saving settings issue with CloudFlare on activation
- Fixed issue with DbCache and Object Cache flushing
- Improved security for CloudFlare API calls
- Improved security for mfunc, now disabled by default and requires security string in order to execute
- Improved behavior of GET string, used for detecting blogs in disk enhanced page caching mode for multi site to prevent redirect loops and other issues
Download this release
Release Info
Developer | fredericktownes |
Plugin | W3 Total Cache |
Version | 0.9.2.9 |
Comparing to | |
See all releases |
Code changes from version 0.9.2.8 to 0.9.2.9
- inc/define.php +12 -3
- inc/options/general.php +1 -1
- languages/faq-en_US.xml +18 -0
- lib/W3/CloudFlare.php +20 -2
- lib/W3/PgCache.php +7 -4
- lib/W3/Plugin/CloudFlare.php +0 -34
- lib/W3/Plugin/CloudFlareAdmin.php +109 -34
- lib/W3/Plugin/DbCache.php +55 -13
- lib/W3/Plugin/ObjectCache.php +54 -12
- lib/W3/Plugin/TotalCache.php +11 -7
- lib/W3/Plugin/TotalCacheAdmin.php +1 -67
- lib/W3/Plugins.php +1 -0
- pub/js/options.js +133 -6
- readme.txt +11 -4
- w3-total-cache.php +1 -1
inc/define.php
CHANGED
@@ -5,7 +5,7 @@ if (!defined('ABSPATH')) {
|
|
5 |
}
|
6 |
|
7 |
define('W3TC', true);
|
8 |
-
define('W3TC_VERSION', '0.9.2.
|
9 |
define('W3TC_POWERED_BY', 'W3 Total Cache/' . W3TC_VERSION);
|
10 |
define('W3TC_EMAIL', 'w3tc@w3-edge.com');
|
11 |
define('W3TC_PAYPAL_URL', 'https://www.paypal.com/cgi-bin/webscr');
|
@@ -121,9 +121,18 @@ function w3_filename_to_url($filename) {
|
|
121 |
|
122 |
$site_url_ssl = w3_get_url_ssl(w3_get_home_url());
|
123 |
|
124 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
-
$url = $site_url_ssl . '/' . $content_path . $uri_from_wp_content;
|
127 |
|
128 |
return $url;
|
129 |
}
|
5 |
}
|
6 |
|
7 |
define('W3TC', true);
|
8 |
+
define('W3TC_VERSION', '0.9.2.9');
|
9 |
define('W3TC_POWERED_BY', 'W3 Total Cache/' . W3TC_VERSION);
|
10 |
define('W3TC_EMAIL', 'w3tc@w3-edge.com');
|
11 |
define('W3TC_PAYPAL_URL', 'https://www.paypal.com/cgi-bin/webscr');
|
121 |
|
122 |
$site_url_ssl = w3_get_url_ssl(w3_get_home_url());
|
123 |
|
124 |
+
$dir = '';
|
125 |
+
if (substr(WP_CONTENT_DIR, 0, strlen(w3_get_site_root())) == w3_get_site_root()) {
|
126 |
+
$dir = str_replace($site_url_ssl, '', w3_get_url_ssl(w3_get_site_url()));
|
127 |
+
$dir = trim($dir, '/');
|
128 |
+
if ($dir)
|
129 |
+
$dir = '/' . $dir;
|
130 |
+
$content_path = trim(substr(WP_CONTENT_DIR, strlen(w3_get_site_root())), '/');
|
131 |
+
}
|
132 |
+
else
|
133 |
+
$content_path = trim(substr(WP_CONTENT_DIR, strlen(w3_get_document_root())), '/');
|
134 |
|
135 |
+
$url = $site_url_ssl . $dir . '/' . $content_path . $uri_from_wp_content;
|
136 |
|
137 |
return $url;
|
138 |
}
|
inc/options/general.php
CHANGED
@@ -552,7 +552,7 @@
|
|
552 |
<?php endif; ?>
|
553 |
</td>
|
554 |
</tr>
|
555 |
-
<?php if ($this->is_network_and_master()): ?>
|
556 |
<tr>
|
557 |
<th>Network policy:</th>
|
558 |
<td>
|
552 |
<?php endif; ?>
|
553 |
</td>
|
554 |
</tr>
|
555 |
+
<?php if ($this->is_network_and_master() && !w3_force_master()): ?>
|
556 |
<tr>
|
557 |
<th>Network policy:</th>
|
558 |
<td>
|
languages/faq-en_US.xml
CHANGED
@@ -496,6 +496,24 @@ Note: To disable page caching of specific theme templates or plugin files you ne
|
|
496 |
</p>
|
497 |
]]></answer>
|
498 |
</entry>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
499 |
<entry>
|
500 |
<question><![CDATA[ I see garbage characters instead of the normal web site, what's going on here? ]]></question>
|
501 |
<answer><![CDATA[ <p>If a theme or it's files use the call php_flush() or function flush() that will interfere with the plugins normal operation; making the plugin send cached files before essential operations have finished. The flush() call is no longer necessary and should be removed.</p> ]]></answer>
|
496 |
</p>
|
497 |
]]></answer>
|
498 |
</entry>
|
499 |
+
<entry>
|
500 |
+
<question><![CDATA[ How do I implement page fragment caching? ]]></question>
|
501 |
+
<answer><![CDATA[
|
502 |
+
<p>First you need to define W3TC_DYNAMIC_SECURITY in your wp-config.php file.</p>
|
503 |
+
<pre>
|
504 |
+
define('W3TC_DYNAMIC_SECURITY', 'somesecurestring');
|
505 |
+
</pre>
|
506 |
+
<p>Edit your templates with the following syntax to ensure that dynamic features remain so. Replace <W3TC_DYNAMIC_SECURITY> with content of the constant:</p>
|
507 |
+
<ul>
|
508 |
+
<li>Example 1:<br /><!-- mfunc {the W3TC_DYNAMIC_SECURITY string} any PHP code --><!-- /mfunc {the W3TC_DYNAMIC_SECURITY string} --></li>
|
509 |
+
<li>Example 2:<br /><!-- mfunc {the W3TC_DYNAMIC_SECURITY string} -->any PHP code<!-- /mfunc {the W3TC_DYNAMIC_SECURITY string} --></li>
|
510 |
+
<li>Example 3:<br /><!--MFUNC {the W3TC_DYNAMIC_SECURITY string} --><br /> echo rand();<br /><!--/mfunc {the W3TC_DYNAMIC_SECURITY string} --></li>
|
511 |
+
<li>Example 4:<br /><!-- mclude {the W3TC_DYNAMIC_SECURITY string} path/to/file.php --><!-- /mclude {the W3TC_DYNAMIC_SECURITY string} --></li>
|
512 |
+
<li>Example 5:<br /><!-- mclude {the W3TC_DYNAMIC_SECURITY string} -->path/to/file.php<!-- /mclude {the W3TC_DYNAMIC_SECURITY string} --></li>
|
513 |
+
</ul>
|
514 |
+
<p>Be aware that WordPress functions will not be available.</p>
|
515 |
+
]]></answer>
|
516 |
+
</entry>
|
517 |
<entry>
|
518 |
<question><![CDATA[ I see garbage characters instead of the normal web site, what's going on here? ]]></question>
|
519 |
<answer><![CDATA[ <p>If a theme or it's files use the call php_flush() or function flush() that will interfere with the plugins normal operation; making the plugin send cached files before essential operations have finished. The flush() call is no longer necessary and should be removed.</p> ]]></answer>
|
lib/W3/CloudFlare.php
CHANGED
@@ -62,6 +62,14 @@ class W3_CloudFlare {
|
|
62 |
*/
|
63 |
function api_request($action, $value = null) {
|
64 |
w3_require_once(W3TC_INC_DIR . '/functions/http.php');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
$url = sprintf('%s?email=%s&tkn=%s&z=%s&a=%s', W3TC_CLOUDFLARE_API_URL, urlencode($this->_cf_config['email']), urlencode($this->_cf_config['key']), urlencode($this->_cf_config['zone']), urlencode($action));
|
67 |
|
@@ -96,7 +104,15 @@ class W3_CloudFlare {
|
|
96 |
*/
|
97 |
function external_event($type, $value) {
|
98 |
w3_require_once(W3TC_INC_DIR . '/functions/http.php');
|
99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
$url = sprintf('%s?u=%s&tkn=%s&evnt_t=%s&evnt_v=%s', W3TC_CLOUDFLARE_EXTERNAL_EVENT_URL, urlencode($this->_cf_config['email']), urlencode($this->_cf_config['key']), urlencode($type), urlencode($value));
|
101 |
$response = w3_http_get($url);
|
102 |
|
@@ -113,7 +129,7 @@ class W3_CloudFlare {
|
|
113 |
* @return void
|
114 |
*/
|
115 |
function fix_remote_addr() {
|
116 |
-
if (!empty($_SERVER['HTTP_CF_CONNECTING_IP'])) {
|
117 |
w3_require_once(W3TC_INC_DIR . '/functions/ip_in_range.php');
|
118 |
if (strpos($_SERVER["REMOTE_ADDR"], ":") === FALSE) {
|
119 |
$ip4_ranges = $this->_config->get_array('cloudflare.ips.ip4');
|
@@ -150,6 +166,8 @@ class W3_CloudFlare {
|
|
150 |
|
151 |
/**
|
152 |
* Check
|
|
|
|
|
153 |
*/
|
154 |
public function update_ip_ranges() {
|
155 |
$ip4_diff = $ip6_diff = false;
|
62 |
*/
|
63 |
function api_request($action, $value = null) {
|
64 |
w3_require_once(W3TC_INC_DIR . '/functions/http.php');
|
65 |
+
if (empty($this->_cf_config['email']) || !filter_var($this->_cf_config['email'], FILTER_VALIDATE_EMAIL))
|
66 |
+
return false;
|
67 |
+
|
68 |
+
if (empty($this->_cf_config['key']) || !is_string($this->_cf_config['key']))
|
69 |
+
return false;
|
70 |
+
|
71 |
+
if (empty($this->_cf_config['zone']) || !is_string($this->_cf_config['zone']) || strpos($this->_cf_config['zone'], '.') === false)
|
72 |
+
return false;
|
73 |
|
74 |
$url = sprintf('%s?email=%s&tkn=%s&z=%s&a=%s', W3TC_CLOUDFLARE_API_URL, urlencode($this->_cf_config['email']), urlencode($this->_cf_config['key']), urlencode($this->_cf_config['zone']), urlencode($action));
|
75 |
|
104 |
*/
|
105 |
function external_event($type, $value) {
|
106 |
w3_require_once(W3TC_INC_DIR . '/functions/http.php');
|
107 |
+
if (empty($this->_cf_config['email']) || !filter_var($this->_cf_config['email'], FILTER_VALIDATE_EMAIL))
|
108 |
+
return false;
|
109 |
+
|
110 |
+
if (empty($this->_cf_config['key']) || !is_string($this->_cf_config['key']))
|
111 |
+
return false;
|
112 |
+
|
113 |
+
if ($this->get_last_error())
|
114 |
+
return false;
|
115 |
+
|
116 |
$url = sprintf('%s?u=%s&tkn=%s&evnt_t=%s&evnt_v=%s', W3TC_CLOUDFLARE_EXTERNAL_EVENT_URL, urlencode($this->_cf_config['email']), urlencode($this->_cf_config['key']), urlencode($type), urlencode($value));
|
117 |
$response = w3_http_get($url);
|
118 |
|
129 |
* @return void
|
130 |
*/
|
131 |
function fix_remote_addr() {
|
132 |
+
if (isset($_SERVER['HTTP_CF_CONNECTING_IP']) && !empty($_SERVER['HTTP_CF_CONNECTING_IP'])) {
|
133 |
w3_require_once(W3TC_INC_DIR . '/functions/ip_in_range.php');
|
134 |
if (strpos($_SERVER["REMOTE_ADDR"], ":") === FALSE) {
|
135 |
$ip4_ranges = $this->_config->get_array('cloudflare.ips.ip4');
|
166 |
|
167 |
/**
|
168 |
* Check
|
169 |
+
* @throws FilesystemOperationException
|
170 |
+
* @throws FileOperationException
|
171 |
*/
|
172 |
public function update_ip_ranges() {
|
173 |
$ip4_diff = $ip6_diff = false;
|
lib/W3/PgCache.php
CHANGED
@@ -1385,15 +1385,16 @@ class W3_PgCache {
|
|
1385 |
|
1386 |
/**
|
1387 |
* Parses dynamic tags
|
1388 |
-
* @return string
|
1389 |
*/
|
1390 |
function _parse_dynamic(&$buffer) {
|
1391 |
-
|
|
|
|
|
1392 |
&$this,
|
1393 |
'_parse_dynamic_mfunc'
|
1394 |
), $buffer);
|
1395 |
|
1396 |
-
$buffer = preg_replace_callback('~<!--\s*mclude(.*)-->(.*)<!--\s*/mclude\s*-->~Uis', array(
|
1397 |
&$this,
|
1398 |
'_parse_dynamic_mclude'
|
1399 |
), $buffer);
|
@@ -1463,7 +1464,9 @@ class W3_PgCache {
|
|
1463 |
* @return boolean
|
1464 |
*/
|
1465 |
function _has_dynamic(&$buffer) {
|
1466 |
-
|
|
|
|
|
1467 |
}
|
1468 |
|
1469 |
/**
|
1385 |
|
1386 |
/**
|
1387 |
* Parses dynamic tags
|
|
|
1388 |
*/
|
1389 |
function _parse_dynamic(&$buffer) {
|
1390 |
+
if (!defined('W3TC_DYNAMIC_SECURITY'))
|
1391 |
+
return;
|
1392 |
+
$buffer = preg_replace_callback('~<!--\s*mfunc\s*' . W3TC_DYNAMIC_SECURITY . '(.*)-->(.*)<!--\s*/mfunc\s*' . W3TC_DYNAMIC_SECURITY . '\s*-->~Uis', array(
|
1393 |
&$this,
|
1394 |
'_parse_dynamic_mfunc'
|
1395 |
), $buffer);
|
1396 |
|
1397 |
+
$buffer = preg_replace_callback('~<!--\s*mclude\s*' . W3TC_DYNAMIC_SECURITY . '(.*)-->(.*)<!--\s*/mclude\s*' . W3TC_DYNAMIC_SECURITY . '\s*-->~Uis', array(
|
1398 |
&$this,
|
1399 |
'_parse_dynamic_mclude'
|
1400 |
), $buffer);
|
1464 |
* @return boolean
|
1465 |
*/
|
1466 |
function _has_dynamic(&$buffer) {
|
1467 |
+
if (!defined('W3TC_DYNAMIC_SECURITY'))
|
1468 |
+
return false;
|
1469 |
+
return preg_match('~<!--\s*m(func|clude)\s*' . W3TC_DYNAMIC_SECURITY . '(.*)-->(.*)<!--\s*/m(func|clude)\s*' . W3TC_DYNAMIC_SECURITY . '\s*-->~Uis', $buffer);
|
1470 |
}
|
1471 |
|
1472 |
/**
|
lib/W3/Plugin/CloudFlare.php
CHANGED
@@ -13,47 +13,13 @@ w3_require_once(W3TC_LIB_W3_DIR . '/Plugin.php');
|
|
13 |
* Class W3_Plugin_CloudFlare
|
14 |
*/
|
15 |
class W3_Plugin_CloudFlare extends W3_Plugin{
|
16 |
-
|
17 |
/**
|
18 |
* Runs plugin
|
19 |
*/
|
20 |
function run() {
|
21 |
-
if (is_admin()) {
|
22 |
-
$this->check_ip_versions();
|
23 |
-
$this->get_admin()->run();
|
24 |
-
}
|
25 |
add_action('wp_set_comment_status', array($this, 'set_comment_status'), 1, 2);
|
26 |
}
|
27 |
|
28 |
-
/**
|
29 |
-
* @return array
|
30 |
-
*/
|
31 |
-
function deactivate() {
|
32 |
-
return $this->get_admin()->deactivate();
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Get the corresponding Admin plugin for the module
|
37 |
-
*
|
38 |
-
* @return W3_Plugin_CloudFlareAdmin
|
39 |
-
*/
|
40 |
-
function get_admin() {
|
41 |
-
return w3_instance('W3_Plugin_CloudFlareAdmin');
|
42 |
-
}
|
43 |
-
|
44 |
-
/**
|
45 |
-
* Check if last check has expired. If so update CloudFlare ips
|
46 |
-
*/
|
47 |
-
function check_ip_versions() {
|
48 |
-
$checked = get_transient('w3tc_cloudflare_ip_check');
|
49 |
-
|
50 |
-
if (false === $checked) {
|
51 |
-
$cf = w3_instance('W3_CloudFlare');
|
52 |
-
$cf->update_ip_ranges();
|
53 |
-
set_transient('w3tc_cloudflare_ip_check', time(), 3600*24);
|
54 |
-
}
|
55 |
-
}
|
56 |
-
|
57 |
/**
|
58 |
* @param $id
|
59 |
* @param $status
|
13 |
* Class W3_Plugin_CloudFlare
|
14 |
*/
|
15 |
class W3_Plugin_CloudFlare extends W3_Plugin{
|
|
|
16 |
/**
|
17 |
* Runs plugin
|
18 |
*/
|
19 |
function run() {
|
|
|
|
|
|
|
|
|
20 |
add_action('wp_set_comment_status', array($this, 'set_comment_status'), 1, 2);
|
21 |
}
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
/**
|
24 |
* @param $id
|
25 |
* @param $status
|
lib/W3/Plugin/CloudFlareAdmin.php
CHANGED
@@ -13,50 +13,125 @@ w3_require_once(W3TC_LIB_W3_DIR . '/Plugin.php');
|
|
13 |
* Class W3_Plugin_CloudFlareAdmin
|
14 |
*/
|
15 |
class W3_Plugin_CloudFlareAdmin extends W3_Plugin{
|
16 |
-
|
17 |
function run() {
|
|
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
31 |
|
32 |
-
/**
|
33 |
-
* @return array|void
|
34 |
-
*/
|
35 |
-
function deactivate() {
|
36 |
-
/**
|
37 |
-
* @var $dispatcher W3_Dispatcher
|
38 |
-
*/
|
39 |
-
$dispatcher = w3_instance('W3_Dispatcher');
|
40 |
-
return $dispatcher->remove_cloudflare_rules_with_message();
|
41 |
}
|
42 |
|
43 |
/**
|
44 |
-
*
|
45 |
-
* @return array
|
46 |
*/
|
47 |
-
function
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
|
|
53 |
}
|
54 |
|
55 |
function admin_notices() {
|
56 |
$plugins = get_plugins();
|
57 |
-
if (array_key_exists('cloudflare/cloudflare.php', $plugins))
|
58 |
-
|
59 |
-
plugin
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
}
|
13 |
* Class W3_Plugin_CloudFlareAdmin
|
14 |
*/
|
15 |
class W3_Plugin_CloudFlareAdmin extends W3_Plugin{
|
|
|
16 |
function run() {
|
17 |
+
$this->check_ip_versions();
|
18 |
|
19 |
+
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
|
20 |
+
$page = W3_Request::get_string('page');
|
21 |
+
if ($page && strpos($page, 'w3tc_') !== false) {
|
22 |
+
/**
|
23 |
+
* Only admin can see W3TC notices and errors
|
24 |
+
*/
|
25 |
+
add_action('admin_notices', array(
|
26 |
+
&$this,
|
27 |
+
'admin_notices'
|
28 |
+
));
|
29 |
+
add_action('network_admin_notices', array(
|
30 |
+
&$this,
|
31 |
+
'admin_notices'
|
32 |
+
));
|
33 |
+
}
|
34 |
+
add_action('wp_ajax_w3tc_cloudflare_api_request', array($this, 'action_cloudflare_api_request'));
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
37 |
|
38 |
/**
|
39 |
+
* Check if last check has expired. If so update CloudFlare ips
|
|
|
40 |
*/
|
41 |
+
function check_ip_versions() {
|
42 |
+
$checked = get_transient('w3tc_cloudflare_ip_check');
|
43 |
+
|
44 |
+
if (false === $checked) {
|
45 |
+
$cf = w3_instance('W3_CloudFlare');
|
46 |
+
try {
|
47 |
+
$cf->update_ip_ranges();
|
48 |
+
} catch (Exception $ex) {}
|
49 |
+
set_transient('w3tc_cloudflare_ip_check', time(), 3600*24);
|
50 |
+
}
|
51 |
}
|
52 |
|
53 |
function admin_notices() {
|
54 |
$plugins = get_plugins();
|
55 |
+
if (array_key_exists('cloudflare/cloudflare.php', $plugins) && $this->_config->get_boolean('notes.cloudflare_plugin')) {
|
56 |
+
w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/other.php');
|
57 |
+
echo sprintf('<div class="error"><p>%s %s</p></div>', __('The CloudFlare plugin is detected. Please note that CloudFlare should only be administered from either CloudFlare or W3 Total Cache in order to avoid confusion. Either can work, but make changes from only a single place while testing. Also note, CloudFlare support may be discontinued in the future.', 'w3-total-cache'),
|
58 |
+
w3tc_button_hide_note('Hide this message', 'cloudflare_plugin')
|
59 |
+
);
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Send CloudFlare API request
|
66 |
+
*
|
67 |
+
* @return void
|
68 |
+
*/
|
69 |
+
function action_cloudflare_api_request() {
|
70 |
+
$result = false;
|
71 |
+
$response = null;
|
72 |
+
|
73 |
+
$actions = array(
|
74 |
+
'devmode',
|
75 |
+
'sec_lvl',
|
76 |
+
'fpurge_ts'
|
77 |
+
);
|
78 |
+
|
79 |
+
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
|
80 |
+
|
81 |
+
$email = W3_Request::get_string('email');
|
82 |
+
$key = W3_Request::get_string('key');
|
83 |
+
$zone = W3_Request::get_string('zone');
|
84 |
+
$action = W3_Request::get_string('command');
|
85 |
+
$value = W3_Request::get_string('value');
|
86 |
+
$nonce = W3_Request::get_string('_wpnonce');
|
87 |
+
|
88 |
+
if ( !wp_verify_nonce( $nonce, 'w3tc' ) ) die('not allowed');
|
89 |
+
|
90 |
+
if (!$email) {
|
91 |
+
$error = 'Empty email.';
|
92 |
+
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
93 |
+
$error = 'Invalid email.';
|
94 |
+
} elseif (!$key) {
|
95 |
+
$error = 'Empty key.';
|
96 |
+
} elseif (!$zone) {
|
97 |
+
$error = 'Empty zone.';
|
98 |
+
} elseif (strpos($zone, '.') === false) {
|
99 |
+
$error = 'Invalid domain.';
|
100 |
+
} elseif (!in_array($action, $actions)) {
|
101 |
+
$error = 'Invalid action.';
|
102 |
+
} else {
|
103 |
+
$config = array(
|
104 |
+
'email' => $email,
|
105 |
+
'key' => $key,
|
106 |
+
'zone' => $zone
|
107 |
+
);
|
108 |
+
|
109 |
+
w3_require_once(W3TC_LIB_W3_DIR . '/CloudFlare.php');
|
110 |
+
@$w3_cloudflare = new W3_CloudFlare($config);
|
111 |
+
|
112 |
+
@set_time_limit($this->_config->get_integer('timelimit.cloudflare_api_request'));
|
113 |
+
|
114 |
+
$response = $w3_cloudflare->api_request($action, $value);
|
115 |
+
|
116 |
+
if ($response) {
|
117 |
+
if ($response->result == 'success') {
|
118 |
+
$result = true;
|
119 |
+
$error = 'OK';
|
120 |
+
} else {
|
121 |
+
$error = $response->msg;
|
122 |
+
}
|
123 |
+
} else {
|
124 |
+
$error = 'Unable to make CloudFlare API request.';
|
125 |
+
}
|
126 |
+
}
|
127 |
+
|
128 |
+
$return = array(
|
129 |
+
'result' => $result,
|
130 |
+
'error' => $error,
|
131 |
+
'response' => $response
|
132 |
+
);
|
133 |
+
|
134 |
+
echo json_encode($return);
|
135 |
+
exit;
|
136 |
}
|
137 |
}
|
lib/W3/Plugin/DbCache.php
CHANGED
@@ -36,50 +36,50 @@ class W3_Plugin_DbCache extends W3_Plugin {
|
|
36 |
|
37 |
add_action('wp_trash_post', array(
|
38 |
&$this,
|
39 |
-
'
|
40 |
), 0);
|
41 |
|
42 |
add_action('save_post', array(
|
43 |
&$this,
|
44 |
-
'
|
45 |
), 0);
|
46 |
|
47 |
global $wp_version;
|
48 |
if (version_compare($wp_version,'3.5', '>=')) {
|
49 |
add_action('clean_post_cache', array(
|
50 |
&$this,
|
51 |
-
'
|
52 |
), 0, 2);
|
53 |
}
|
54 |
|
55 |
add_action('comment_post', array(
|
56 |
&$this,
|
57 |
-
'
|
58 |
), 0);
|
59 |
|
60 |
add_action('edit_comment', array(
|
61 |
&$this,
|
62 |
-
'
|
63 |
), 0);
|
64 |
|
65 |
add_action('delete_comment', array(
|
66 |
&$this,
|
67 |
-
'
|
68 |
), 0);
|
69 |
|
70 |
add_action('wp_set_comment_status', array(
|
71 |
&$this,
|
72 |
-
'
|
73 |
-
), 0);
|
74 |
|
75 |
add_action('trackback_post', array(
|
76 |
&$this,
|
77 |
-
'
|
78 |
), 0);
|
79 |
|
80 |
add_action('pingback_post', array(
|
81 |
&$this,
|
82 |
-
'
|
83 |
), 0);
|
84 |
|
85 |
add_action('switch_theme', array(
|
@@ -101,7 +101,7 @@ class W3_Plugin_DbCache extends W3_Plugin {
|
|
101 |
|
102 |
add_action('delete_post', array(
|
103 |
&$this,
|
104 |
-
'
|
105 |
), 0);
|
106 |
}
|
107 |
|
@@ -168,7 +168,7 @@ class W3_Plugin_DbCache extends W3_Plugin {
|
|
168 |
wp_clear_scheduled_hook('w3_dbcache_cleanup');
|
169 |
}
|
170 |
}
|
171 |
-
|
172 |
/**
|
173 |
* Does disk cache cleanup
|
174 |
*
|
@@ -205,7 +205,21 @@ class W3_Plugin_DbCache extends W3_Plugin {
|
|
205 |
/**
|
206 |
* Change action
|
207 |
*/
|
208 |
-
function on_change(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
static $flushed = false;
|
210 |
|
211 |
if (!$flushed) {
|
@@ -222,4 +236,32 @@ class W3_Plugin_DbCache extends W3_Plugin {
|
|
222 |
$flushed = true;
|
223 |
}
|
224 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
}
|
36 |
|
37 |
add_action('wp_trash_post', array(
|
38 |
&$this,
|
39 |
+
'on_post_change'
|
40 |
), 0);
|
41 |
|
42 |
add_action('save_post', array(
|
43 |
&$this,
|
44 |
+
'on_post_change'
|
45 |
), 0);
|
46 |
|
47 |
global $wp_version;
|
48 |
if (version_compare($wp_version,'3.5', '>=')) {
|
49 |
add_action('clean_post_cache', array(
|
50 |
&$this,
|
51 |
+
'on_post_change'
|
52 |
), 0, 2);
|
53 |
}
|
54 |
|
55 |
add_action('comment_post', array(
|
56 |
&$this,
|
57 |
+
'on_comment_change'
|
58 |
), 0);
|
59 |
|
60 |
add_action('edit_comment', array(
|
61 |
&$this,
|
62 |
+
'on_comment_change'
|
63 |
), 0);
|
64 |
|
65 |
add_action('delete_comment', array(
|
66 |
&$this,
|
67 |
+
'on_comment_change'
|
68 |
), 0);
|
69 |
|
70 |
add_action('wp_set_comment_status', array(
|
71 |
&$this,
|
72 |
+
'on_comment_status'
|
73 |
+
), 0, 2);
|
74 |
|
75 |
add_action('trackback_post', array(
|
76 |
&$this,
|
77 |
+
'on_comment_change'
|
78 |
), 0);
|
79 |
|
80 |
add_action('pingback_post', array(
|
81 |
&$this,
|
82 |
+
'on_comment_change'
|
83 |
), 0);
|
84 |
|
85 |
add_action('switch_theme', array(
|
101 |
|
102 |
add_action('delete_post', array(
|
103 |
&$this,
|
104 |
+
'on_post_change'
|
105 |
), 0);
|
106 |
}
|
107 |
|
168 |
wp_clear_scheduled_hook('w3_dbcache_cleanup');
|
169 |
}
|
170 |
}
|
171 |
+
|
172 |
/**
|
173 |
* Does disk cache cleanup
|
174 |
*
|
205 |
/**
|
206 |
* Change action
|
207 |
*/
|
208 |
+
function on_change() {
|
209 |
+
static $flushed = false;
|
210 |
+
|
211 |
+
if (!$flushed) {
|
212 |
+
$flusher = w3_instance('W3_CacheFlush');
|
213 |
+
$flusher->dbcache_flush();
|
214 |
+
|
215 |
+
$flushed = true;
|
216 |
+
}
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Change post action
|
221 |
+
*/
|
222 |
+
function on_post_change($post_id = 0, $post = null) {
|
223 |
static $flushed = false;
|
224 |
|
225 |
if (!$flushed) {
|
236 |
$flushed = true;
|
237 |
}
|
238 |
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* Comment change action
|
242 |
+
*
|
243 |
+
* @param integer $comment_id
|
244 |
+
*/
|
245 |
+
function on_comment_change($comment_id) {
|
246 |
+
$post_id = 0;
|
247 |
+
|
248 |
+
if ($comment_id) {
|
249 |
+
$comment = get_comment($comment_id, ARRAY_A);
|
250 |
+
$post_id = !empty($comment['comment_post_ID']) ? (int) $comment['comment_post_ID'] : 0;
|
251 |
+
}
|
252 |
+
|
253 |
+
$this->on_post_change($post_id);
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* Comment status action
|
258 |
+
*
|
259 |
+
* @param integer $comment_id
|
260 |
+
* @param string $status
|
261 |
+
*/
|
262 |
+
function on_comment_status($comment_id, $status) {
|
263 |
+
if ($status === 'approve' || $status === '1') {
|
264 |
+
$this->on_comment_change($comment_id);
|
265 |
+
}
|
266 |
+
}
|
267 |
}
|
lib/W3/Plugin/ObjectCache.php
CHANGED
@@ -36,50 +36,50 @@ class W3_Plugin_ObjectCache extends W3_Plugin {
|
|
36 |
|
37 |
add_action('wp_trash_post', array(
|
38 |
&$this,
|
39 |
-
'
|
40 |
), 0);
|
41 |
|
42 |
add_action('save_post', array(
|
43 |
&$this,
|
44 |
-
'
|
45 |
), 0);
|
46 |
|
47 |
global $wp_version;
|
48 |
if (version_compare($wp_version,'3.5', '>=')) {
|
49 |
add_action('clean_post_cache', array(
|
50 |
&$this,
|
51 |
-
'
|
52 |
), 0, 2);
|
53 |
}
|
54 |
|
55 |
add_action('comment_post', array(
|
56 |
&$this,
|
57 |
-
'
|
58 |
), 0);
|
59 |
|
60 |
add_action('edit_comment', array(
|
61 |
&$this,
|
62 |
-
'
|
63 |
), 0);
|
64 |
|
65 |
add_action('delete_comment', array(
|
66 |
&$this,
|
67 |
-
'
|
68 |
), 0);
|
69 |
|
70 |
add_action('wp_set_comment_status', array(
|
71 |
&$this,
|
72 |
-
'
|
73 |
-
), 0);
|
74 |
|
75 |
add_action('trackback_post', array(
|
76 |
&$this,
|
77 |
-
'
|
78 |
), 0);
|
79 |
|
80 |
add_action('pingback_post', array(
|
81 |
&$this,
|
82 |
-
'
|
83 |
), 0);
|
84 |
|
85 |
add_action('switch_theme', array(
|
@@ -115,7 +115,7 @@ class W3_Plugin_ObjectCache extends W3_Plugin {
|
|
115 |
|
116 |
add_action('delete_post', array(
|
117 |
&$this,
|
118 |
-
'
|
119 |
), 0);
|
120 |
}
|
121 |
|
@@ -198,7 +198,20 @@ class W3_Plugin_ObjectCache extends W3_Plugin {
|
|
198 |
/**
|
199 |
* Change action
|
200 |
*/
|
201 |
-
function on_change(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
static $flushed = false;
|
203 |
|
204 |
if (!$flushed) {
|
@@ -260,4 +273,33 @@ class W3_Plugin_ObjectCache extends W3_Plugin {
|
|
260 |
$o = w3_instance('W3_ObjectCache');
|
261 |
$o->switch_blog($blog_id);
|
262 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
}
|
36 |
|
37 |
add_action('wp_trash_post', array(
|
38 |
&$this,
|
39 |
+
'on_post_change'
|
40 |
), 0);
|
41 |
|
42 |
add_action('save_post', array(
|
43 |
&$this,
|
44 |
+
'on_post_change'
|
45 |
), 0);
|
46 |
|
47 |
global $wp_version;
|
48 |
if (version_compare($wp_version,'3.5', '>=')) {
|
49 |
add_action('clean_post_cache', array(
|
50 |
&$this,
|
51 |
+
'on_post_change'
|
52 |
), 0, 2);
|
53 |
}
|
54 |
|
55 |
add_action('comment_post', array(
|
56 |
&$this,
|
57 |
+
'on_comment_change'
|
58 |
), 0);
|
59 |
|
60 |
add_action('edit_comment', array(
|
61 |
&$this,
|
62 |
+
'on_comment_change'
|
63 |
), 0);
|
64 |
|
65 |
add_action('delete_comment', array(
|
66 |
&$this,
|
67 |
+
'on_comment_change'
|
68 |
), 0);
|
69 |
|
70 |
add_action('wp_set_comment_status', array(
|
71 |
&$this,
|
72 |
+
'on_comment_status'
|
73 |
+
), 0, 2);
|
74 |
|
75 |
add_action('trackback_post', array(
|
76 |
&$this,
|
77 |
+
'on_comment_change'
|
78 |
), 0);
|
79 |
|
80 |
add_action('pingback_post', array(
|
81 |
&$this,
|
82 |
+
'on_comment_change'
|
83 |
), 0);
|
84 |
|
85 |
add_action('switch_theme', array(
|
115 |
|
116 |
add_action('delete_post', array(
|
117 |
&$this,
|
118 |
+
'on_post_change'
|
119 |
), 0);
|
120 |
}
|
121 |
|
198 |
/**
|
199 |
* Change action
|
200 |
*/
|
201 |
+
function on_change() {
|
202 |
+
static $flushed = false;
|
203 |
+
|
204 |
+
if (!$flushed) {
|
205 |
+
$flush = w3_instance('W3_CacheFlush');
|
206 |
+
$flush->objectcache_flush();
|
207 |
+
$flushed = true;
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
* Change post action
|
213 |
+
*/
|
214 |
+
function on_post_change($post_id = 0, $post = null) {
|
215 |
static $flushed = false;
|
216 |
|
217 |
if (!$flushed) {
|
273 |
$o = w3_instance('W3_ObjectCache');
|
274 |
$o->switch_blog($blog_id);
|
275 |
}
|
276 |
+
|
277 |
+
|
278 |
+
/**
|
279 |
+
* Comment change action
|
280 |
+
*
|
281 |
+
* @param integer $comment_id
|
282 |
+
*/
|
283 |
+
function on_comment_change($comment_id) {
|
284 |
+
$post_id = 0;
|
285 |
+
|
286 |
+
if ($comment_id) {
|
287 |
+
$comment = get_comment($comment_id, ARRAY_A);
|
288 |
+
$post_id = !empty($comment['comment_post_ID']) ? (int) $comment['comment_post_ID'] : 0;
|
289 |
+
}
|
290 |
+
|
291 |
+
$this->on_post_change($post_id);
|
292 |
+
}
|
293 |
+
|
294 |
+
/**
|
295 |
+
* Comment status action
|
296 |
+
*
|
297 |
+
* @param integer $comment_id
|
298 |
+
* @param string $status
|
299 |
+
*/
|
300 |
+
function on_comment_status($comment_id, $status) {
|
301 |
+
if ($status === 'approve' || $status === '1') {
|
302 |
+
$this->on_comment_change($comment_id);
|
303 |
+
}
|
304 |
+
}
|
305 |
}
|
lib/W3/Plugin/TotalCache.php
CHANGED
@@ -81,16 +81,9 @@ class W3_Plugin_TotalCache extends W3_Plugin {
|
|
81 |
* CloudFlare support
|
82 |
*/
|
83 |
if ($this->_config->get_boolean('cloudflare.enabled')) {
|
84 |
-
add_action('wp_set_comment_status', array(
|
85 |
-
&$this,
|
86 |
-
'cloudflare_set_comment_status'
|
87 |
-
), 1, 2);
|
88 |
-
|
89 |
w3_require_once(W3TC_LIB_W3_DIR . '/CloudFlare.php');
|
90 |
@$w3_cloudflare = new W3_CloudFlare();
|
91 |
-
|
92 |
$w3_cloudflare->fix_remote_addr();
|
93 |
-
|
94 |
}
|
95 |
|
96 |
if ($this->_config->get_string('common.support') == 'footer') {
|
@@ -139,6 +132,17 @@ class W3_Plugin_TotalCache extends W3_Plugin {
|
|
139 |
* @return void
|
140 |
*/
|
141 |
function init() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
if (isset($GLOBALS['w3tc_blogmap_register_new_item'])) {
|
143 |
$do_redirect = false;
|
144 |
// true value is a sign to just generate config cache
|
81 |
* CloudFlare support
|
82 |
*/
|
83 |
if ($this->_config->get_boolean('cloudflare.enabled')) {
|
|
|
|
|
|
|
|
|
|
|
84 |
w3_require_once(W3TC_LIB_W3_DIR . '/CloudFlare.php');
|
85 |
@$w3_cloudflare = new W3_CloudFlare();
|
|
|
86 |
$w3_cloudflare->fix_remote_addr();
|
|
|
87 |
}
|
88 |
|
89 |
if ($this->_config->get_string('common.support') == 'footer') {
|
132 |
* @return void
|
133 |
*/
|
134 |
function init() {
|
135 |
+
if (is_multisite()) {
|
136 |
+
global $w3_current_blog_id, $current_blog;
|
137 |
+
if ($w3_current_blog_id != $current_blog->blog_id && !isset($GLOBALS['w3tc_blogmap_register_new_item'])) {
|
138 |
+
$url = w3_get_host() . $_SERVER['REQUEST_URI'];
|
139 |
+
$pos = strpos($url, '?');
|
140 |
+
if ($pos !== false)
|
141 |
+
$url = substr($url, 0, $pos);
|
142 |
+
$GLOBALS['w3tc_blogmap_register_new_item'] = $url;
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
if (isset($GLOBALS['w3tc_blogmap_register_new_item'])) {
|
147 |
$do_redirect = false;
|
148 |
// true value is a sign to just generate config cache
|
lib/W3/Plugin/TotalCacheAdmin.php
CHANGED
@@ -4805,72 +4805,6 @@ class W3_Plugin_TotalCacheAdmin extends W3_Plugin {
|
|
4805 |
include W3TC_INC_DIR . '/lightbox/minify_recommendations.php';
|
4806 |
}
|
4807 |
|
4808 |
-
/**
|
4809 |
-
* Send CloudFlare API request
|
4810 |
-
*
|
4811 |
-
* @return void
|
4812 |
-
*/
|
4813 |
-
function action_cloudflare_api_request() {
|
4814 |
-
$result = false;
|
4815 |
-
$response = null;
|
4816 |
-
|
4817 |
-
$actions = array(
|
4818 |
-
'devmode',
|
4819 |
-
'sec_lvl',
|
4820 |
-
'fpurge_ts'
|
4821 |
-
);
|
4822 |
-
|
4823 |
-
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
|
4824 |
-
|
4825 |
-
$email = W3_Request::get_string('email');
|
4826 |
-
$key = W3_Request::get_string('key');
|
4827 |
-
$zone = W3_Request::get_string('zone');
|
4828 |
-
$action = W3_Request::get_string('action');
|
4829 |
-
$value = W3_Request::get_string('value');
|
4830 |
-
|
4831 |
-
if (!$email) {
|
4832 |
-
$error = 'Empty email.';
|
4833 |
-
} elseif (!$key) {
|
4834 |
-
$error = 'Empty key.';
|
4835 |
-
} elseif (!$zone) {
|
4836 |
-
$error = 'Empty zone.';
|
4837 |
-
} elseif (!in_array($action, $actions)) {
|
4838 |
-
$error = 'Invalid action.';
|
4839 |
-
} else {
|
4840 |
-
$config = array(
|
4841 |
-
'email' => $email,
|
4842 |
-
'key' => $key,
|
4843 |
-
'zone' => $zone
|
4844 |
-
);
|
4845 |
-
|
4846 |
-
w3_require_once(W3TC_LIB_W3_DIR . '/CloudFlare.php');
|
4847 |
-
@$w3_cloudflare = new W3_CloudFlare($config);
|
4848 |
-
|
4849 |
-
@set_time_limit($this->_config->get_integer('timelimit.cloudflare_api_request'));
|
4850 |
-
|
4851 |
-
$response = $w3_cloudflare->api_request($action, $value);
|
4852 |
-
|
4853 |
-
if ($response) {
|
4854 |
-
if ($response->result == 'success') {
|
4855 |
-
$result = true;
|
4856 |
-
$error = 'OK';
|
4857 |
-
} else {
|
4858 |
-
$error = $response->msg;
|
4859 |
-
}
|
4860 |
-
} else {
|
4861 |
-
$error = 'Unable to make CloudFlare API request.';
|
4862 |
-
}
|
4863 |
-
}
|
4864 |
-
|
4865 |
-
$return = array(
|
4866 |
-
'result' => $result,
|
4867 |
-
'error' => $error,
|
4868 |
-
'response' => $response
|
4869 |
-
);
|
4870 |
-
|
4871 |
-
echo json_encode($return);
|
4872 |
-
}
|
4873 |
-
|
4874 |
/**
|
4875 |
* Self test action
|
4876 |
*/
|
@@ -5583,7 +5517,7 @@ class W3_Plugin_TotalCacheAdmin extends W3_Plugin {
|
|
5583 |
$cacheflush->cdncache_purge();
|
5584 |
}
|
5585 |
|
5586 |
-
|
5587 |
* Purge the CloudFlare cache
|
5588 |
* @return void
|
5589 |
*/
|
4805 |
include W3TC_INC_DIR . '/lightbox/minify_recommendations.php';
|
4806 |
}
|
4807 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4808 |
/**
|
4809 |
* Self test action
|
4810 |
*/
|
5517 |
$cacheflush->cdncache_purge();
|
5518 |
}
|
5519 |
|
5520 |
+
/**
|
5521 |
* Purge the CloudFlare cache
|
5522 |
* @return void
|
5523 |
*/
|
lib/W3/Plugins.php
CHANGED
@@ -33,6 +33,7 @@ class W3_Plugins {
|
|
33 |
array('class_name' => 'W3_Plugin_NewRelic', 'enable_options' => 'newrelic.enabled')
|
34 |
);
|
35 |
if (is_admin()) {
|
|
|
36 |
$this->_plugins[] = array('class_name' => 'W3_Plugin_TotalCacheAdmin', 'enable_options' => null);
|
37 |
$this->_plugins[] = array('class_name' => 'W3_Plugin_NewRelicAdmin', 'enable_options' => null);
|
38 |
$this->_plugins[] = array('class_name' => 'W3_Widget_SpreadTheWord', 'enable_options' => null);
|
33 |
array('class_name' => 'W3_Plugin_NewRelic', 'enable_options' => 'newrelic.enabled')
|
34 |
);
|
35 |
if (is_admin()) {
|
36 |
+
$this->_plugins[] = array('class_name' => 'W3_Plugin_CloudFlareAdmin', 'enable_options' => 'cloudflare.enabled');
|
37 |
$this->_plugins[] = array('class_name' => 'W3_Plugin_TotalCacheAdmin', 'enable_options' => null);
|
38 |
$this->_plugins[] = array('class_name' => 'W3_Plugin_NewRelicAdmin', 'enable_options' => null);
|
39 |
$this->_plugins[] = array('class_name' => 'W3_Widget_SpreadTheWord', 'enable_options' => null);
|
pub/js/options.js
CHANGED
@@ -115,6 +115,121 @@ function w3tc_minify_css_theme(theme) {
|
|
115 |
w3tc_minify_css_file_clear();
|
116 |
}
|
117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
function w3tc_cdn_get_cnames() {
|
119 |
var cnames = [];
|
120 |
|
@@ -199,12 +314,12 @@ function w3tc_cloudflare_api_request(action, value, nonce) {
|
|
199 |
return false;
|
200 |
}
|
201 |
|
202 |
-
jQuery.post(
|
203 |
-
w3tc_cloudflare_api_request
|
204 |
email: email.val(),
|
205 |
key: key.val(),
|
206 |
zone: zone.val(),
|
207 |
-
|
208 |
value: value,
|
209 |
_wpnonce: nonce
|
210 |
}, function(data) {
|
@@ -332,9 +447,8 @@ jQuery(function() {
|
|
332 |
jQuery('.button-rating').live('click', function() {
|
333 |
window.open('http://wordpress.org/support/view/plugin-reviews/w3-total-cache?rate=5#postform', '_blank');
|
334 |
});
|
335 |
-
jQuery('
|
336 |
-
|
337 |
-
jQuery('#w3tc_technical_info').toggle();
|
338 |
});
|
339 |
|
340 |
jQuery('#newrelic_verify_api_key').click(function() {
|
@@ -1463,6 +1577,19 @@ jQuery(function() {
|
|
1463 |
}
|
1464 |
});
|
1465 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1466 |
// show hide missing files
|
1467 |
jQuery('.w3tc-show-technical-info').click(function() {
|
1468 |
var btn = jQuery(this), info = jQuery('.w3tc-technical-info');
|
115 |
w3tc_minify_css_file_clear();
|
116 |
}
|
117 |
|
118 |
+
function w3tc_minify_filename_test(url, success, failure) {
|
119 |
+
var timestamp = new Date().getTime();
|
120 |
+
jQuery.get(url + '?t=' + timestamp, function (data) {
|
121 |
+
success(data, url);
|
122 |
+
})
|
123 |
+
.fail(function (data) {
|
124 |
+
failure(data, url);
|
125 |
+
});
|
126 |
+
}
|
127 |
+
function w3tc_minify_filename_test_once(url, filename) {
|
128 |
+
jQuery(function($) {
|
129 |
+
w3tc_minify_filename_test(url + filename + '.css',
|
130 |
+
function(data, url) {
|
131 |
+
if (data == 'retry') {
|
132 |
+
$.get(url, function(data2) {
|
133 |
+
if (data2 != 'content ok') {
|
134 |
+
$('#minify_auto_error').show();
|
135 |
+
w3tc_start_minify_try_solve();
|
136 |
+
} else {
|
137 |
+
$.get(ajaxurl, {action:'w3tc_minify_disable_filename_test'});
|
138 |
+
}
|
139 |
+
});
|
140 |
+
} else if (data != 'content ok') {
|
141 |
+
$('#minify_auto_error').show();
|
142 |
+
w3tc_start_minify_try_solve();
|
143 |
+
}
|
144 |
+
},
|
145 |
+
function (data, url) {
|
146 |
+
$('#minify_auto_error').show();
|
147 |
+
w3tc_start_minify_try_solve();
|
148 |
+
}
|
149 |
+
);
|
150 |
+
})
|
151 |
+
}
|
152 |
+
|
153 |
+
function w3tc_filename_auto_solve(testUrl) {
|
154 |
+
var minLength = 100, maxLength = 246;
|
155 |
+
jQuery('#minify_auto_test_loading').toggleClass('minify_auto_test');
|
156 |
+
w3tc_do_filename_auto_step(testUrl,minLength, maxLength, maxLength, false);
|
157 |
+
}
|
158 |
+
|
159 |
+
function w3tc_do_filename_auto_step(testUrl,minLength, maxLength, tryLength, minTestedAndSuccessful) {
|
160 |
+
tryLength = Math.floor(tryLength);
|
161 |
+
var testString = new Array(tryLength+1).join('X');
|
162 |
+
var timestamp = new Date().getTime();
|
163 |
+
var url = testUrl + testString + '.css' + '?t=' + timestamp;
|
164 |
+
jQuery.get(url, function (data) {
|
165 |
+
if (data == 'retry') {
|
166 |
+
jQuery.get(url, function (retryResult) {
|
167 |
+
if (retryResult == 'content ok') {
|
168 |
+
w3tc_do_success(testUrl,minLength, maxLength, tryLength, minTestedAndSuccessful);
|
169 |
+
} else {
|
170 |
+
jQuery.get(ajaxurl, {action:'w3tc_minify_disable_filename_test'});
|
171 |
+
alert('Plugin could not solve the Minify Auto issue automatically.');
|
172 |
+
jQuery('#minify_auto_test_loading').toggleClass('minify_auto_test');
|
173 |
+
jQuery('#minify_auto_error').html('<p>Minify Auto does not work properly. Try using Minify Manual instead ' +
|
174 |
+
'or try another Minify cache method.</p>');
|
175 |
+
}
|
176 |
+
});
|
177 |
+
} else if (data == 'content ok') {
|
178 |
+
w3tc_do_success(testUrl,minLength, maxLength, tryLength, minTestedAndSuccessful);
|
179 |
+
} else {
|
180 |
+
w3tc_do_failure(testUrl,minLength, maxLength, tryLength, minTestedAndSuccessful);
|
181 |
+
}
|
182 |
+
}).fail(function (data) {
|
183 |
+
w3tc_do_failure(testUrl,minLength, maxLength, tryLength, minTestedAndSuccessful);
|
184 |
+
});
|
185 |
+
}
|
186 |
+
|
187 |
+
function w3tc_do_success(testUrl,minLength, maxLength, tryLength, minTestedAndSuccessful) {
|
188 |
+
if ((maxLength - tryLength) < 10) {
|
189 |
+
w3tc_finish_with(tryLength);
|
190 |
+
return;
|
191 |
+
}
|
192 |
+
w3tc_do_filename_auto_step(testUrl, tryLength, maxLength, (tryLength + maxLength) / 2, true);
|
193 |
+
}
|
194 |
+
|
195 |
+
function w3tc_do_failure(testUrl,minLength, maxLength, tryLength, minTestedAndSuccessful) {
|
196 |
+
if ((tryLength - minLength) < 10) {
|
197 |
+
if (minTestedAndSuccessful) {
|
198 |
+
w3tc_finish_with(minLength);
|
199 |
+
return;
|
200 |
+
} else if (tryLength <= minLength) {
|
201 |
+
jQuery.get(ajaxurl, {action:'w3tc_minify_disable_filename_test'});
|
202 |
+
alert('Plugin could not solve the Minify Auto issue automatically.');
|
203 |
+
jQuery('#minify_auto_test_loading').toggleClass('minify_auto_test');
|
204 |
+
jQuery('#minify_auto_error').html('<p>Minify Auto does not work properly. Try using Minify Manual instead ' +
|
205 |
+
'or try another Minify cache method. You can also try a lower filename length value manually on ' +
|
206 |
+
'<a href="admin.php?page=w3tc_minify#advanced">settings page</a></p>');
|
207 |
+
return;
|
208 |
+
}
|
209 |
+
else {
|
210 |
+
w3tc_do_filename_auto_step(testUrl,minLength, maxLength, minLength, false);
|
211 |
+
return;
|
212 |
+
}
|
213 |
+
}
|
214 |
+
w3tc_do_filename_auto_step(testUrl, minLength, maxLength, (tryLength + minLength) / 2, minTestedAndSuccessful);
|
215 |
+
}
|
216 |
+
|
217 |
+
function w3tc_finish_with(length) {
|
218 |
+
jQuery.get(ajaxurl, {action:'w3tc_minify_change_filename_length', maxlength: length}, function (changeResult) {
|
219 |
+
if (changeResult == 1) {
|
220 |
+
jQuery('#minify_auto_filename_length').val(length);
|
221 |
+
jQuery('#minify_auto_test_loading').toggleClass('minify_auto_test');
|
222 |
+
alert('Minify Auto filename length changed too ' + length);
|
223 |
+
jQuery('#minify_auto_error').hide();
|
224 |
+
} else {
|
225 |
+
jQuery('#minify_auto_test_loading').toggleClass('minify_auto_test');
|
226 |
+
alert('Tried to change Minify Auto filename length too ' + length + ' but failed.');
|
227 |
+
jQuery('#minify_auto_error').hide();
|
228 |
+
}
|
229 |
+
});
|
230 |
+
|
231 |
+
}
|
232 |
+
|
233 |
function w3tc_cdn_get_cnames() {
|
234 |
var cnames = [];
|
235 |
|
314 |
return false;
|
315 |
}
|
316 |
|
317 |
+
jQuery.post(ajaxurl, {
|
318 |
+
action:'w3tc_cloudflare_api_request',
|
319 |
email: email.val(),
|
320 |
key: key.val(),
|
321 |
zone: zone.val(),
|
322 |
+
command: action,
|
323 |
value: value,
|
324 |
_wpnonce: nonce
|
325 |
}, function(data) {
|
447 |
jQuery('.button-rating').live('click', function() {
|
448 |
window.open('http://wordpress.org/support/view/plugin-reviews/w3-total-cache?rate=5#postform', '_blank');
|
449 |
});
|
450 |
+
jQuery('.w3tc_read_technical_info').click(function() {
|
451 |
+
jQuery('.w3tc_technical_info').toggle();
|
|
|
452 |
});
|
453 |
|
454 |
jQuery('#newrelic_verify_api_key').click(function() {
|
1577 |
}
|
1578 |
});
|
1579 |
|
1580 |
+
// show hide missing files
|
1581 |
+
jQuery('.w3tc-show-ftp-form').click(function() {
|
1582 |
+
var btn = jQuery(this), rules = jQuery('.w3tc-ftp-form');
|
1583 |
+
|
1584 |
+
if (rules.is(':visible')) {
|
1585 |
+
rules.css('display', 'none');
|
1586 |
+
btn.val('Update via FTP');
|
1587 |
+
} else {
|
1588 |
+
rules.css('display', 'block');
|
1589 |
+
btn.val('Cancel FTP Update');
|
1590 |
+
}
|
1591 |
+
});
|
1592 |
+
|
1593 |
// show hide missing files
|
1594 |
jQuery('.w3tc-show-technical-info').click(function() {
|
1595 |
var btn = jQuery(this), info = jQuery('.w3tc-technical-info');
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
=== Plugin Name ===
|
2 |
Contributors: fredericktownes
|
3 |
Tags: wpo, web performance optimization, performance, availability, scaling, scalability, user experience, cache, caching, page cache, css cache, js cache, db cache, disk cache, disk caching, database cache, http compression, gzip, deflate, minify, cdn, content delivery network, media library, performance, speed, multiple hosts, css, merge, combine, unobtrusive javascript, compress, optimize, optimizer, javascript, js, cascading style sheet, plugin, yslow, yui, google, google rank, google page speed, mod_pagespeed, new relic, newrelic, aws, s3, cloudfront, sns, elasticache, rds, flash media server, amazon web services, cloud files, rackspace, akamai, max cdn, netdna, limelight, cloudflare, mod_cloudflare, microsoft, microsoft azure, iis, nginx, litespeed, apache, varnish, xcache, apc, eacclerator, wincache, mysql, w3 total cache, batcache, wp cache, wp super cache, quick cache, wp minify, bwp-minify, buddypress
|
4 |
Requires at least: 2.8
|
5 |
Tested up to: 3.5.1
|
6 |
-
Stable tag: 0.9.2.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -731,6 +731,13 @@ It's quite difficult to recall all of the innovators that have shared their thou
|
|
731 |
Please reach out to all of these people and support their projects if you're so inclined.
|
732 |
|
733 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
734 |
= 0.9.2.8 =
|
735 |
* Fixed /tmp file creation issue when saving settings
|
736 |
* Fixed an issue with auto minify
|
@@ -1234,5 +1241,5 @@ Please reach out to all of these people and support their projects if you're so
|
|
1234 |
|
1235 |
== Upgrade Notice ==
|
1236 |
|
1237 |
-
= 0.9.2.
|
1238 |
-
Thanks for using W3 Total Cache! As always, this update is very strongly recommended.
|
1 |
+
=== Plugin Name ===
|
2 |
Contributors: fredericktownes
|
3 |
Tags: wpo, web performance optimization, performance, availability, scaling, scalability, user experience, cache, caching, page cache, css cache, js cache, db cache, disk cache, disk caching, database cache, http compression, gzip, deflate, minify, cdn, content delivery network, media library, performance, speed, multiple hosts, css, merge, combine, unobtrusive javascript, compress, optimize, optimizer, javascript, js, cascading style sheet, plugin, yslow, yui, google, google rank, google page speed, mod_pagespeed, new relic, newrelic, aws, s3, cloudfront, sns, elasticache, rds, flash media server, amazon web services, cloud files, rackspace, akamai, max cdn, netdna, limelight, cloudflare, mod_cloudflare, microsoft, microsoft azure, iis, nginx, litespeed, apache, varnish, xcache, apc, eacclerator, wincache, mysql, w3 total cache, batcache, wp cache, wp super cache, quick cache, wp minify, bwp-minify, buddypress
|
4 |
Requires at least: 2.8
|
5 |
Tested up to: 3.5.1
|
6 |
+
Stable tag: 0.9.2.9
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
731 |
Please reach out to all of these people and support their projects if you're so inclined.
|
732 |
|
733 |
== Changelog ==
|
734 |
+
= 0.9.2.9 =
|
735 |
+
* Fixed saving settings issue with CloudFlare on activation
|
736 |
+
* Fixed issue with DbCache and Object Cache flushing
|
737 |
+
* Improved security for CloudFlare API calls
|
738 |
+
* Improved security for mfunc, now disabled by default and requires security string in order to execute
|
739 |
+
* Improved behavior of GET string, used for detecting blogs in disk enhanced page caching mode for multi site to prevent redirect loops and other issues
|
740 |
+
|
741 |
= 0.9.2.8 =
|
742 |
* Fixed /tmp file creation issue when saving settings
|
743 |
* Fixed an issue with auto minify
|
1241 |
|
1242 |
== Upgrade Notice ==
|
1243 |
|
1244 |
+
= 0.9.2.9 =
|
1245 |
+
Thanks for using W3 Total Cache! As always, this update is very strongly recommended. This release addresses security issues for Cloudflare users as well as users that implement fragment caching via the mfunc functionality. For those using mfunc, temporarily disable page caching to allow yourself time to check the FAQ tab for new usage instructions; if you have a staging environment, that is the most convenient way to test prior to production roll out.
|
w3-total-cache.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: W3 Total Cache
|
4 |
Description: The highest rated and most complete WordPress performance plugin. Dramatically improve the speed and user experience of your site. Add browser, page, object and database caching as well as minify and content delivery network (CDN) to WordPress.
|
5 |
-
Version: 0.9.2.
|
6 |
Plugin URI: http://www.w3-edge.com/wordpress-plugins/w3-total-cache/
|
7 |
Author: Frederick Townes
|
8 |
Author URI: http://www.linkedin.com/in/w3edge
|
2 |
/*
|
3 |
Plugin Name: W3 Total Cache
|
4 |
Description: The highest rated and most complete WordPress performance plugin. Dramatically improve the speed and user experience of your site. Add browser, page, object and database caching as well as minify and content delivery network (CDN) to WordPress.
|
5 |
+
Version: 0.9.2.9
|
6 |
Plugin URI: http://www.w3-edge.com/wordpress-plugins/w3-total-cache/
|
7 |
Author: Frederick Townes
|
8 |
Author URI: http://www.linkedin.com/in/w3edge
|