W3 Total Cache - Version 0.15.0

Version Description

  • Feature: Added TransparentCDN full-site delivery option
  • Fix: Update settings on activation in a changed environment
  • Fix: Fixed a compatibility check for Apache when PHP is running as CGI
  • Fix: Always set HSTS headers in Apache; not only for 2xx HTTP codes
  • Fix: Implemented anatomic incrementing of key version in Memcache(d)
  • Update: Allow filtering of w3tc_minify_url_for_files Minify URL for files
Download this release

Release Info

Developer joemoto
Plugin Icon 128x128 W3 Total Cache
Version 0.15.0
Comparing to
See all releases

Code changes from version 0.14.4 to 0.15.0

BrowserCache_Environment.php CHANGED
@@ -376,7 +376,7 @@ class BrowserCache_Environment {
376
 
377
  if ( $config->get_boolean( 'browsercache.hsts' ) ) {
378
  $dir = $config->get_string( 'browsercache.security.hsts.directive' );
379
- $rules .= " Header set Strict-Transport-Security \"max-age=$lifetime" . ( strpos( $dir,"inc" ) ? "; includeSubDomains" : "" ) . ( strpos( $dir, "pre" ) ? "; preload" : "" ) . "\"\n";
380
  }
381
 
382
  if ( $config->get_boolean( 'browsercache.security.xfo' ) ) {
376
 
377
  if ( $config->get_boolean( 'browsercache.hsts' ) ) {
378
  $dir = $config->get_string( 'browsercache.security.hsts.directive' );
379
+ $rules .= " Header always set Strict-Transport-Security \"max-age=$lifetime" . ( strpos( $dir,"inc" ) ? "; includeSubDomains" : "" ) . ( strpos( $dir, "pre" ) ? "; preload" : "" ) . "\"\n";
380
  }
381
 
382
  if ( $config->get_boolean( 'browsercache.security.xfo' ) ) {
Cache_Memcache.php CHANGED
@@ -176,9 +176,7 @@ class Cache_Memcache extends Cache_Base {
176
  * @return boolean
177
  */
178
  function flush( $group = '' ) {
179
- $this->_get_key_version( $group ); // initialize $this->_key_version
180
- $this->_key_version[$group]++;
181
- $this->_set_key_version( $this->_key_version[$group], $group );
182
  return true;
183
  }
184
 
@@ -224,6 +222,21 @@ class Cache_Memcache extends Cache_Base {
224
  @$this->_memcache->set( $this->_get_key_version_key( $group ), $v, false, 0 );
225
  }
226
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
  /**
228
  * Returns size used by cache
229
  */
176
  * @return boolean
177
  */
178
  function flush( $group = '' ) {
179
+ $this->_increment_key_version( $group );
 
 
180
  return true;
181
  }
182
 
222
  @$this->_memcache->set( $this->_get_key_version_key( $group ), $v, false, 0 );
223
  }
224
 
225
+ /**
226
+ * Increments key version.
227
+ *
228
+ * @since 0.14.5
229
+ *
230
+ * @param string $group Used to differentiate between groups of cache values.
231
+ */
232
+ private function _increment_key_version( $group = '' ) {
233
+ $r = @$this->_memcache->increment( $this->_get_key_version_key( $group ), 1 );
234
+ if ( ! $r ) {
235
+ // it doesn't initialize the key if it doesn't exist.
236
+ $this->_set_key_version( 0, $group );
237
+ }
238
+ }
239
+
240
  /**
241
  * Returns size used by cache
242
  */
Cache_Memcached.php CHANGED
@@ -222,9 +222,7 @@ class Cache_Memcached extends Cache_Base {
222
  * @return boolean
223
  */
224
  function flush( $group = '' ) {
225
- $this->_get_key_version( $group ); // initialize $this->_key_version
226
- $this->_key_version[$group]++;
227
- $this->_set_key_version( $this->_key_version[$group], $group );
228
 
229
  // for persistent connections - apply new config to the object
230
  // otherwise it will keep old servers list
@@ -287,6 +285,20 @@ class Cache_Memcached extends Cache_Base {
287
  @$this->_memcache->set( $this->_get_key_version_key( $group ), $v, 0 );
288
  }
289
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
 
291
  /**
292
  * Returns size used by cache
222
  * @return boolean
223
  */
224
  function flush( $group = '' ) {
225
+ $this->_increment_key_version( $group );
 
 
226
 
227
  // for persistent connections - apply new config to the object
228
  // otherwise it will keep old servers list
285
  @$this->_memcache->set( $this->_get_key_version_key( $group ), $v, 0 );
286
  }
287
 
288
+ /**
289
+ * Increments key version.
290
+ *
291
+ * @since 0.14.5
292
+ *
293
+ * @param string $group Used to differentiate between groups of cache values.
294
+ */
295
+ private function _increment_key_version( $group = '' ) {
296
+ $r = @$this->_memcache->increment( $this->_get_key_version_key( $group ), 1 );
297
+ if ( ! $r ) {
298
+ // it doesn't initialize the key if it doesn't exist.
299
+ $this->_set_key_version( 0, $group );
300
+ }
301
+ }
302
 
303
  /**
304
  * Returns size used by cache
Cdn_AdminActions.php CHANGED
@@ -410,6 +410,7 @@ class Cdn_AdminActions {
410
  $engine == 'limelight' ||
411
  $engine == 'maxcdn' ||
412
  $engine == 'stackpath' ||
 
413
  $engine == 'stackpath2' ||
414
  $engine == 'rackspace_cdn' ||
415
  $engine == 'rscf' ||
410
  $engine == 'limelight' ||
411
  $engine == 'maxcdn' ||
412
  $engine == 'stackpath' ||
413
+ $engine == 'transparentcdn' ||
414
  $engine == 'stackpath2' ||
415
  $engine == 'rackspace_cdn' ||
416
  $engine == 'rscf' ||
Cdnfsd_Core.php CHANGED
@@ -20,6 +20,14 @@ class Cdnfsd_Core {
20
  $engine_object = null; // extension handles everything
21
  break;
22
 
 
 
 
 
 
 
 
 
23
  case 'cloudfront':
24
  $engine_object = new Cdnfsd_CloudFront_Engine( array(
25
  'access_key' => $c->get_string( 'cdnfsd.cloudfront.access_key' ),
20
  $engine_object = null; // extension handles everything
21
  break;
22
 
23
+ case 'transparentcdn':
24
+ $engine_object = new Cdnfsd_TransparentCDN_Engine( array(
25
+ 'company_id' => $c->get_string( 'cdnfsd.transparentcdn.company_id' ),
26
+ 'client_id' => $c->get_string( 'cdnfsd.transparentcdn.client_id' ),
27
+ 'client_secret' => $c->get_string( 'cdnfsd.transparentcdn.client_secret' )
28
+ ) );
29
+ break;
30
+
31
  case 'cloudfront':
32
  $engine_object = new Cdnfsd_CloudFront_Engine( array(
33
  'access_key' => $c->get_string( 'cdnfsd.cloudfront.access_key' ),
Cdnfsd_Plugin_Admin.php CHANGED
@@ -57,6 +57,16 @@ class Cdnfsd_Plugin_Admin {
57
  add_action( 'w3tc_settings_box_cdnfsd', array(
58
  '\W3TC\Cdnfsd_StackPath2_Page',
59
  'w3tc_settings_box_cdnfsd' ) );
 
 
 
 
 
 
 
 
 
 
60
  }
61
 
62
  add_action( 'w3tc_settings_general_boxarea_cdn_footer',
@@ -96,6 +106,9 @@ class Cdnfsd_Plugin_Admin {
96
  $cdnfsd_engine_values['stackpath2'] = array(
97
  'label' => __( 'StackPath (recommended)', 'w3-total-cache' ),
98
  );
 
 
 
99
 
100
  $tag = '';
101
  if ( $cdnfsd_engine == 'cloudfront' ) {
57
  add_action( 'w3tc_settings_box_cdnfsd', array(
58
  '\W3TC\Cdnfsd_StackPath2_Page',
59
  'w3tc_settings_box_cdnfsd' ) );
60
+ } elseif ( 'transparentcdn' === $cdnfsd_engine ){
61
+ add_action( 'init', array(
62
+ '\W3TC\Cdnfsd_TransparentCDN_Page',
63
+ 'admin_test_api_parameters_transparentcdn' ) );
64
+ add_action( 'w3tc_ajax', array(
65
+ '\W3TC\Cdnfsd_TransparentCDN_Popup',
66
+ 'w3tc_ajax' ) );
67
+ add_action( 'w3tc_settings_box_cdnfsd', array(
68
+ '\W3TC\Cdnfsd_TransparentCDN_Page',
69
+ 'w3tc_settings_box_cdnfsd' ) );
70
  }
71
 
72
  add_action( 'w3tc_settings_general_boxarea_cdn_footer',
106
  $cdnfsd_engine_values['stackpath2'] = array(
107
  'label' => __( 'StackPath (recommended)', 'w3-total-cache' ),
108
  );
109
+ $cdnfsd_engine_values['transparentcdn'] = array(
110
+ 'label' => __( 'TransparentCDN', 'w3-total-cache' ),
111
+ );
112
 
113
  $tag = '';
114
  if ( $cdnfsd_engine == 'cloudfront' ) {
Cdnfsd_TransparentCDN_Engine.php ADDED
@@ -0,0 +1,302 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: Cdnfsd_TransparentCDN_Engine.php
4
+ *
5
+ * @since 0.15.0
6
+ */
7
+
8
+ namespace W3TC;
9
+
10
+ if ( ! defined( 'W3TC_CDN_TRANSPARENTCDN_PURGE_URL' ) ) {
11
+ define( 'W3TC_CDN_TRANSPARENTCDN_PURGE_URL', 'https://api.transparentcdn.com/v1/companies/%s/invalidate/' );
12
+ }
13
+
14
+ if ( ! defined( 'W3TC_CDN_TRANSPARENTCDN_AUTHORIZATION_URL' ) ) {
15
+ define( 'W3TC_CDN_TRANSPARENTCDN_AUTHORIZATION_URL', 'https://api.transparentcdn.com/v1/oauth2/access_token/' );
16
+ }
17
+
18
+
19
+ /**
20
+ * Class: Cdn_TransparentCDN_Api
21
+ *
22
+ * @since 0.15.0
23
+ */
24
+ class Cdn_TransparentCDN_Api {
25
+ /**
26
+ * Token.
27
+ *
28
+ * @since 0.15.0
29
+ *
30
+ * @var string
31
+ */
32
+ var $_token;
33
+
34
+ /**
35
+ * Config.
36
+ *
37
+ * @since 0.15.0
38
+ *
39
+ * @var array
40
+ */
41
+ var $_config;
42
+
43
+ /**
44
+ * Constructor.
45
+ *
46
+ * @since 0.15.0
47
+ *
48
+ * @param array $config
49
+ */
50
+ public function __construct( $config = array() ) {
51
+ $config = array_merge( array(
52
+ 'company_id' => '',
53
+ 'client_id' => '',
54
+ 'client_secret' => ''
55
+ ), $config );
56
+
57
+ $this->_config = $config;
58
+ }
59
+
60
+ /**
61
+ * Purge URL addresses.
62
+ *
63
+ * @since 0.15.0
64
+ *
65
+ * @param array $urls URL addresses
66
+ * @return bool
67
+ */
68
+ public function purge( $urls ) {
69
+ if ( empty( $this->_config['company_id'] ) ) {
70
+ return false;
71
+ }
72
+
73
+ if ( empty( $this->_config['client_id'] ) ) {
74
+ return false;
75
+ }
76
+ if ( empty( $this->_config['client_secret'] ) ) {
77
+ return false;
78
+ }
79
+
80
+ // We ask for the authorization token.
81
+ $this->_get_token();
82
+
83
+ $invalidation_urls = array();
84
+
85
+ foreach ( $urls as $url ) {
86
+ //Oh array_map+lambdas, how I miss u...
87
+ $invalidation_urls[] = $url;
88
+ }
89
+
90
+ if ( count( $invalidation_urls ) === 0 ) {
91
+ $invalidation_urls[] = '';
92
+ }
93
+
94
+ return $this->_purge_content( $invalidation_urls, $error );
95
+ }
96
+
97
+ /**
98
+ * Purge content.
99
+ *
100
+ * @since 0.15.0
101
+ *
102
+ * @param string $files Files.
103
+ * @param string $error Error.
104
+ * @return bool
105
+ */
106
+ public function _purge_content( $files, &$error ) {
107
+ $url = sprintf( W3TC_CDN_TRANSPARENTCDN_PURGE_URL, $this->_config['company_id'] );
108
+ $args = array(
109
+ 'method' => 'POST',
110
+ 'user-agent' => W3TC_POWERED_BY,
111
+ 'headers' => array(
112
+ 'Accept' => 'application/json',
113
+ 'Content-Type' => 'application/json',
114
+ 'Authorization' => sprintf( 'Bearer %s', $this->_token ),
115
+ ),
116
+ 'body' => json_encode( array( 'urls' => $files ) ),
117
+ );
118
+
119
+ $response = wp_remote_request( $url, $args );
120
+
121
+ if ( is_wp_error( $response ) ) {
122
+ $error = implode( '; ', $response->get_error_messages() );
123
+ return false;
124
+ }
125
+
126
+ switch ( $response['response']['code'] ) {
127
+ case 200:
128
+ $body = json_decode( $response['body'] );
129
+ if ( is_array( $body->urls_to_send ) && count( $body->urls_to_send ) > 0 ) {
130
+ // We have invalidated at least one URL.
131
+ return true;
132
+ }
133
+ elseif ( 0 < count( $files ) && ! empty( $files[0] ) ) {
134
+ $error = __( 'Invalid Request URL', 'w3-total-cache' );
135
+ break;
136
+ }
137
+
138
+ return true;
139
+
140
+ case 400:
141
+ if ( count( $files ) > 0 && empty( $files[0] ) ) {
142
+ // Test case.
143
+ return true;
144
+ }
145
+
146
+ $error = __( 'Invalid Request Parameter', 'w3-total-cache' );
147
+ break;
148
+
149
+ case 403:
150
+ $error = __( 'Authentication Failure or Insufficient Access Rights', 'w3-total-cache' );
151
+ break;
152
+
153
+ case 404:
154
+ $error = __( 'Invalid Request URI', 'w3-total-cache' );
155
+ break;
156
+
157
+ case 500:
158
+ $error = __( 'Server Error', 'w3-total-cache' );
159
+ break;
160
+ default:
161
+ $error = __( 'Unknown error', 'w3-total-cache' );
162
+ break;
163
+ }
164
+
165
+ return false;
166
+ }
167
+
168
+
169
+ /**
170
+ * Purges CDN completely.
171
+ *
172
+ * @since 0.15.0
173
+ *
174
+ * @todo Implement bans using "*".
175
+ *
176
+ * @param array $results Results.
177
+ * @return bool
178
+ */
179
+ public function purge_all( &$results ) {
180
+ return false;
181
+ }
182
+
183
+ /**
184
+ * Get the token to use as authorization in override requests.
185
+ *
186
+ * @since 0.15.0
187
+ *
188
+ * @todo Better bug handline.
189
+ *
190
+ * @return bool
191
+ */
192
+ public function _get_token() {
193
+ $client_id = $this->_config['client_id'];
194
+ $client_secret = $this->_config['client_secret'];
195
+ $args = array(
196
+ 'method' => 'POST',
197
+ 'user-agent' => W3TC_POWERED_BY,
198
+ 'headers' => array(
199
+ 'Accept' => 'application/json',
200
+ 'Content-Type' => 'application/x-www-form-urlencoded',
201
+ ),
202
+ 'body' => "grant_type=client_credentials&client_id=$client_id&client_secret=$client_secret",
203
+ );
204
+
205
+ $response = wp_remote_request( W3TC_CDN_TRANSPARENTCDN_AUTHORIZATION_URL, $args );
206
+
207
+ if ( is_wp_error( $response ) ) {
208
+ $error = implode( '; ', $response->get_error_messages() );
209
+ return false;
210
+ }
211
+
212
+ $body = $response['body'];
213
+ $jobj = json_decode( $body );
214
+ $this->_token = $jobj->access_token;
215
+
216
+ return true;
217
+ }
218
+ }
219
+
220
+ /**
221
+ * Class: Cdnfsd_TransparentCDN_Engine
222
+ *
223
+ * @since 0.15.0
224
+ */
225
+ class Cdnfsd_TransparentCDN_Engine {
226
+ /**
227
+ * Config.
228
+ *
229
+ * @since 0.15.0
230
+ * @access private
231
+ *
232
+ * @var array
233
+ */
234
+ private $config;
235
+
236
+ public function __construct( $config = array() ) {
237
+ $this->config = $config;
238
+ }
239
+
240
+
241
+ /**
242
+ * Flush URLs.
243
+ *
244
+ * @since 0.15.0
245
+ *
246
+ * @param array $urls URL addresses.
247
+ */
248
+ function flush_urls( $urls ) {
249
+ if ( empty( $this->config['client_id'] ) ) {
250
+ throw new \Exception( __( 'API key not specified.', 'w3-total-cache' ) );
251
+ }
252
+
253
+ $api = new Cdn_TransparentCDN_Api( $this->config );
254
+
255
+ try {
256
+ $result = $api->purge( $urls );
257
+ throw new \Exception( __( 'Problem purging', 'w3-total-cache' ) );
258
+
259
+ } catch ( \Exception $ex ) {
260
+ if ( $ex->getMessage() === 'Validation Failure: Purge url must contain one of your hostnames' ) {
261
+ throw new \Exception( __(
262
+ 'CDN site is not configured correctly: Delivery Domain must match your site domain',
263
+ 'w3-total-cache'
264
+ ) );
265
+ } else {
266
+ throw $ex;
267
+ }
268
+ }
269
+ }
270
+
271
+ /**
272
+ * Flushes CDN completely.
273
+ *
274
+ * @since 0.15.0
275
+ */
276
+ function flush_all() {
277
+ if ( empty( $this->config['client_id'] ) ) {
278
+ throw new \Exception( __( 'API key not specified.', 'w3-total-cache' ) );
279
+ }
280
+
281
+ $api = new Cdn_TransparentCDN_Api( $this->config );
282
+
283
+ $items = array();
284
+ $items[] = array(
285
+ 'url' => home_url( '/' ),
286
+ 'recursive' => true,
287
+ );
288
+
289
+ try {
290
+ $r = $api->purge( array( 'items' => $items ) );
291
+ } catch ( \Exception $ex ) {
292
+ if ( $ex->getMessage() === 'Validation Failure: Purge url must contain one of your hostnames' ) {
293
+ throw new \Exception( __(
294
+ 'CDN site is not configured correctly: Delivery Domain must match your site domain',
295
+ 'w3-total-cache'
296
+ ) );
297
+ } else {
298
+ throw $ex;
299
+ }
300
+ }
301
+ }
302
+ }
Cdnfsd_TransparentCDN_Page.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: Cdnfsd_TransparentCDN_Page.php
4
+ *
5
+ * @since 0.15.0
6
+ */
7
+
8
+ namespace W3TC;
9
+
10
+ /**
11
+ * Class: Cdnfsd_TransparentCDN_Page
12
+ *
13
+ * @since 0.15.0
14
+ */
15
+ class Cdnfsd_TransparentCDN_Page {
16
+ /**
17
+ * Test API parameters.
18
+ *
19
+ * Called from plugin-admin.
20
+ *
21
+ * @since 0.15.0
22
+ * @static
23
+ */
24
+ static public function admin_test_api_parameters_transparentcdn() {
25
+ wp_register_script(
26
+ 'w3tc_cdn_transparentcdn_fsd',
27
+ plugins_url( 'Cdnfsd_TransparentCDN_Page_View.js', W3TC_FILE )
28
+ );
29
+
30
+ wp_localize_script(
31
+ 'w3tc_cdn_transparentcdn_fsd', 'transparent_configuration_strings',
32
+ array(
33
+ 'test_string' => __( 'Test the API parameters offered for you site', 'w3-total-cache') ,
34
+ 'test_success' => __( 'Ok. Correct parameters', 'w3-total-cache', 'w3-total-cache' ),
35
+ 'test_failure' => __( 'Error. Check your parameters and try again or contact with support.', 'w3-total-cache' ),
36
+ )
37
+ );
38
+
39
+ wp_enqueue_script(
40
+ 'w3tc_cdn_transparentcdn_fsd',
41
+ plugins_url( 'Cdnfsd_TransparentCDN_Page_View.js', W3TC_FILE ),
42
+ array( 'jquery' ),
43
+ '1.0',
44
+ true
45
+ );
46
+ }
47
+
48
+ /**
49
+ * Render the settings box.
50
+ *
51
+ * @since 0.15.0
52
+ */
53
+ static public function w3tc_settings_box_cdnfsd() {
54
+ $config = Dispatcher::config();
55
+ require W3TC_DIR . '/Cdnfsd_TransparentCDN_Page_View.php';
56
+ }
57
+ }
Cdnfsd_TransparentCDN_Page_View.js ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * File: Cdnfsd_TransparentCDN_Page_View.js
3
+ *
4
+ * @since 0.15.0
5
+ */
6
+ jQuery( document ).ready( function( $ ) {
7
+ box = document.getElementById( 'tcdn_test_status' );
8
+
9
+ if ( box ){
10
+ box.innerHTML = transparent_configuration_strings.test_string;
11
+
12
+ $( '#transparentcdn_test' ).on( 'click', function( e ) {
13
+ var url = 'https://api.transparentcdn.com/v1/oauth2/access_token/',
14
+ p = document.getElementById( 'tcdn_test_text' ),
15
+ client_id = 'client_id' +
16
+ '=' +
17
+ document.getElementById( 'cdnfsd_transparentcdn_clientid' ).value,
18
+ client_secret = 'client_secret' +
19
+ '=' +
20
+ document.getElementById( 'cdnfsd_transparentcdn_clientsecret' ).value,
21
+ grant_type = 'grant_type=client_credentials',
22
+ params = grant_type +
23
+ '&' +
24
+ client_id +
25
+ '&' +
26
+ client_secret,
27
+ req = new XMLHttpRequest();
28
+
29
+ e.preventDefault();
30
+
31
+ req.open( 'POST', url, true );
32
+ req.setRequestHeader( 'Content-type', 'application/x-www-form-urlencoded' );
33
+ req.onreadystatechange = function(e) {
34
+ if ( 4 == req.readyState ) {
35
+ if ( 200 == req.status ) {
36
+ box.innerHTML = transparent_configuration_strings.test_success;
37
+ box.className = 'w3tc-status w3tc-success';
38
+ } else {
39
+ box.innerHTML = transparent_configuration_strings.test_failure;
40
+ box.className = 'w3tc-status w3tc-error';
41
+ }
42
+ }
43
+ };
44
+ req.send( params );
45
+ });
46
+ }
47
+ });
Cdnfsd_TransparentCDN_Page_View.php ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * File: Cdnfsd_TransparentCDN_Page_View.php
4
+ *
5
+ * @since 0.15.0
6
+ */
7
+
8
+ namespace W3TC;
9
+
10
+ if ( !defined( 'W3TC' ) ) {
11
+ die();
12
+ }
13
+
14
+ $key = $config->get_string( 'cdnfsd.transparentcdn.client_id' );
15
+ $authorized = ! empty( $key );
16
+
17
+ ?>
18
+ <form id="cdn_form" action="admin.php?page=w3tc_cdn" method="post">
19
+ <div class="metabox-holder">
20
+ <?php
21
+ Util_Ui::postbox_header(
22
+ __( 'Configuration: Full-Site Delivery', 'w3-total-cache' ),
23
+ '',
24
+ 'configuration'
25
+ );
26
+ ?>
27
+ <table class="form-table">
28
+ <tr>
29
+ <th style="width: 300px;">
30
+ <label for="cdnfsd_transparentcdn_company_id"> <?php _e( 'Company id:', 'w3-total-cache' ); ?> </label>
31
+ </th>
32
+ <td>
33
+ <input id="cdnfsd_transparentcdn_company_id" class="w3tc-ignore-change" type="text"
34
+ <?php Util_Ui::sealing_disabled( 'cdnfsd.transparentcdn.company_id' ) ?>
35
+ name="cdnfsd__transparentcdn__company_id"
36
+ value="<?php echo esc_attr( $config->get_string( 'cdnfsd.transparentcdn.company_id' ) ); ?>" size="60" />
37
+ </td>
38
+ </tr>
39
+ <tr>
40
+ <th style="width: 300px;"><label for="cdnfsd_transparentcdn_clientid"><?php _e( 'Client id:', 'w3-total-cache' ); ?></label></th>
41
+ <td>
42
+ <input id="cdnfsd_transparentcdn_clientid" class="w3tc-ignore-change"
43
+ <?php Util_Ui::sealing_disabled( 'cdnfsd.transparentcdn.client_id' ) ?> type="text"
44
+ name="cdnfsd__transparentcdn__client_id"
45
+ value="<?php echo esc_attr( $config->get_string( 'cdnfsd.transparentcdn.client_id' ) ); ?>" size="60" />
46
+ </td>
47
+ </tr>
48
+ <tr>
49
+ <th style="width: 300px;"><label for="cdnfsd_transparentcdn_clientsecret"><?php _e( 'Client secret:', 'w3-total-cache' ); ?></label></th>
50
+ <td>
51
+ <input id="cdnfsd_transparentcdn_clientsecret" class="w3tc-ignore-change"
52
+ <?php Util_Ui::sealing_disabled( 'cdnfsd.transparentcdn.client_secret' ) ?> type="text"
53
+ name="cdnfsd__transparentcdn__client_secret"
54
+ value="<?php echo esc_attr( $config->get_string( 'cdnfsd.transparentcdn.client_secret' ) ); ?>" size="60" />
55
+ </td>
56
+ </tr>
57
+ <tr>
58
+ <td>
59
+ <span id="transparentcdn_test" class="button {type: 'transparentcdn', nonce: '<?php echo wp_create_nonce( 'w3tc' ); ?>'}">
60
+ <?php _e( 'Test TransparentCDN', 'w3-total-cache' ); ?>
61
+ </span>
62
+ </td>
63
+ <td colspan="1">
64
+ <span id="tcdn_test_status" class="w3tc-status w3tc-process">
65
+ </span>
66
+ </td>
67
+ </tr>
68
+ </table>
69
+ <?php Util_Ui::button_config_save( 'cdn_configuration' ); ?>
70
+ <?php Util_Ui::postbox_footer(); ?>
71
+ </div>
72
+ </form>
ConfigKeys.php CHANGED
@@ -832,7 +832,8 @@ $keys = array(
832
  'type' => 'array',
833
  'default' => array(
834
  'google_ad_',
835
- 'RSPEAK_'
 
836
  )
837
  ),
838
  'minify.css.combine' => array(
@@ -1702,6 +1703,18 @@ $keys = array(
1702
  'type' => 'string',
1703
  'default' => 'auto'
1704
  ),
 
 
 
 
 
 
 
 
 
 
 
 
1705
 
1706
  'varnish.configuration_overloaded' => array(
1707
  'type' => 'boolean',
832
  'type' => 'array',
833
  'default' => array(
834
  'google_ad_',
835
+ 'RSPEAK_',
836
+ 'mfunc'
837
  )
838
  ),
839
  'minify.css.combine' => array(
1703
  'type' => 'string',
1704
  'default' => 'auto'
1705
  ),
1706
+ 'cdnfsd.transparentcdn.client_id' => array(
1707
+ 'type' => 'string',
1708
+ 'default' => ''
1709
+ ),
1710
+ 'cdnfsd.transparentcdn.client_secret' => array(
1711
+ 'type' => 'string',
1712
+ 'default' => ''
1713
+ ),
1714
+ 'cdnfsd.transparentcdn.company_id' => array(
1715
+ 'type' => 'string',
1716
+ 'default' => ''
1717
+ ),
1718
 
1719
  'varnish.configuration_overloaded' => array(
1720
  'type' => 'boolean',
Minify_Plugin.php CHANGED
@@ -1053,6 +1053,8 @@ class _W3_MinifyHelpers {
1053
  $url = Minify_Core::minified_url( $minify_filename );
1054
  $url = Util_Environment::url_to_maybe_https( $url );
1055
 
 
 
1056
  return $url;
1057
  }
1058
 
1053
  $url = Minify_Core::minified_url( $minify_filename );
1054
  $url = Util_Environment::url_to_maybe_https( $url );
1055
 
1056
+ $url = apply_filters( 'w3tc_minify_url_for_files', $url, $files, $type );
1057
+
1058
  return $url;
1059
  }
1060
 
PgCache_Plugin.php CHANGED
@@ -45,6 +45,10 @@ class PgCache_Plugin {
45
  add_filter( 'cron_schedules',
46
  array( $this, 'cron_schedules' ) );
47
 
 
 
 
 
48
  $o = Dispatcher::component( 'PgCache_ContentGrabber' );
49
 
50
  add_filter( 'w3tc_footer_comment',
@@ -380,4 +384,14 @@ class PgCache_Plugin {
380
 
381
  return $header;
382
  }
 
 
 
 
 
 
 
 
 
 
383
  }
45
  add_filter( 'cron_schedules',
46
  array( $this, 'cron_schedules' ) );
47
 
48
+ add_action( 'w3tc_config_save',
49
+ array( $this, 'w3tc_config_save' ),
50
+ 10, 1 );
51
+
52
  $o = Dispatcher::component( 'PgCache_ContentGrabber' );
53
 
54
  add_filter( 'w3tc_footer_comment',
384
 
385
  return $header;
386
  }
387
+
388
+
389
+
390
+ public function w3tc_config_save( $config ) {
391
+ // frontend activity
392
+ if ( $config->get_boolean( 'pgcache.cache.feed' ) ) {
393
+ $config->set( 'pgcache.cache.nginx_handle_xml', true );
394
+ }
395
+ }
396
+
397
  }
Root_AdminActivation.php CHANGED
@@ -37,6 +37,7 @@ class Root_AdminActivation {
37
  $e = Dispatcher::component( 'Root_Environment' );
38
 
39
  $config = Dispatcher::config();
 
40
  $e->fix_on_event( $config, 'activate' );
41
 
42
  // try to save config file if needed, optional thing so exceptions
37
  $e = Dispatcher::component( 'Root_Environment' );
38
 
39
  $config = Dispatcher::config();
40
+ $e->fix_in_wpadmin( $config, true );
41
  $e->fix_on_event( $config, 'activate' );
42
 
43
  // try to save config file if needed, optional thing so exceptions
Util_Environment.php CHANGED
@@ -512,12 +512,22 @@ class Util_Environment {
512
  $home_path = ABSPATH;
513
  if ( ! empty( $home ) && 0 !== strcasecmp( $home, $siteurl ) ) {
514
  $wp_path_rel_to_home = str_ireplace( $home, '', $siteurl ); /* $siteurl - $home */
515
- $pos = strripos( str_replace( '\\', '/', $_SERVER['SCRIPT_FILENAME'] ), trailingslashit( $wp_path_rel_to_home ) );
516
  // fix of get_home_path, used when index.php is moved outside of
517
  // wp folder.
 
 
 
518
  if ( $pos !== false ) {
519
  $home_path = substr( $_SERVER['SCRIPT_FILENAME'], 0, $pos );
520
  $home_path = trailingslashit( $home_path );
 
 
 
 
 
 
 
 
521
  }
522
  }
523
 
512
  $home_path = ABSPATH;
513
  if ( ! empty( $home ) && 0 !== strcasecmp( $home, $siteurl ) ) {
514
  $wp_path_rel_to_home = str_ireplace( $home, '', $siteurl ); /* $siteurl - $home */
 
515
  // fix of get_home_path, used when index.php is moved outside of
516
  // wp folder.
517
+ $pos = strripos(
518
+ str_replace( '\\', '/', $_SERVER['SCRIPT_FILENAME'] ),
519
+ trailingslashit( $wp_path_rel_to_home ) );
520
  if ( $pos !== false ) {
521
  $home_path = substr( $_SERVER['SCRIPT_FILENAME'], 0, $pos );
522
  $home_path = trailingslashit( $home_path );
523
+ } else if ( defined( 'WP_CLI' ) ) {
524
+ $pos = strripos(
525
+ str_replace( '\\', '/', ABSPATH ),
526
+ trailingslashit( $wp_path_rel_to_home ) );
527
+ if ( $pos !== false ) {
528
+ $home_path = substr( ABSPATH, 0, $pos );
529
+ $home_path = trailingslashit( $home_path );
530
+ }
531
  }
532
  }
533
 
inc/lightbox/self_test.php CHANGED
@@ -214,19 +214,57 @@ if ( !defined( 'W3TC' ) )
214
 
215
  <?php
216
  if ( Util_Environment::is_apache() ):
217
- $apache_modules = ( function_exists( 'apache_get_modules' ) ? apache_get_modules() : false );
218
-
219
- $modules = array(
220
- 'mod_deflate',
221
- 'mod_env',
222
- 'mod_expires',
223
- 'mod_filter',
224
- 'mod_ext_filter',
225
- 'mod_headers',
226
- 'mod_mime',
227
- 'mod_rewrite',
228
- 'mod_setenvif'
229
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  ?>
231
  <?php foreach ( $modules as $module ): ?>
232
  <li>
214
 
215
  <?php
216
  if ( Util_Environment::is_apache() ):
217
+
218
+ $modules = array(
219
+ 'mod_deflate',
220
+ 'mod_env',
221
+ 'mod_expires',
222
+ 'mod_filter',
223
+ 'mod_ext_filter',
224
+ 'mod_headers',
225
+ 'mod_mime',
226
+ 'mod_rewrite',
227
+ 'mod_setenvif'
228
+ );
229
+
230
+ if ( function_exists( 'apache_get_modules' ) ) {
231
+ // apache_get_modules only works when PHP is installed as an Apache module
232
+ $apache_modules = apache_get_modules();
233
+
234
+ } elseif ( function_exists( 'exec' )) {
235
+ // alternative modules capture for php CGI
236
+ exec( 'apache2 -t -D DUMP_MODULES', $output, $status);
237
+
238
+ if ( $status !== 0 ) {
239
+ exec( 'httpd -t -D DUMP_MODULES', $output, $status);
240
+ }
241
+
242
+ if ( $status === 0 && count($output > 0) ) {
243
+ $apache_modules = [];
244
+
245
+ foreach ($output as $line) {
246
+ if ( preg_match('/^\s(\S+)\s\((\S+)\)$/', $line, $matches) === 1) {
247
+ $apache_modules[] = $matches[1];
248
+ }
249
+ }
250
+ }
251
+
252
+ // modules have slightly different names
253
+ $modules = array(
254
+ 'deflate_module',
255
+ 'env_module',
256
+ 'expires_module',
257
+ 'filter_module',
258
+ 'ext_filter_module',
259
+ 'headers_module',
260
+ 'mime_module',
261
+ 'rewrite_module',
262
+ 'setenvif_module'
263
+ );
264
+ } else {
265
+ $apache_modules = false;
266
+ }
267
+
268
  ?>
269
  <?php foreach ( $modules as $module ): ?>
270
  <li>
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: boldgrid, fredericktownes, maxicusc, gidomanders, bwmarkle, harryj
3
  Tags: seo, cache, optimize, pagespeed, performance, caching, compression, maxcdn, nginx, varnish, redis, new relic, aws, amazon web services, s3, cloudfront, rackspace, cloudflare, azure, apache
4
  Requires at least: 3.2
5
  Tested up to: 5.5
6
- Stable tag: 0.14.4
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -104,7 +104,7 @@ It's in every web site owner's best interest is to make sure that the performanc
104
 
105
  = Which WordPress versions are supported? =
106
 
107
- To use all features in the suite, a minimum of version WordPress 2.8 with PHP 5.3 is required. Earlier versions will benefit from our Media Library Importer to get them back on the upgrade path and into a CDN of their choosing.
108
 
109
  = Why doesn't minify work for me? =
110
 
@@ -275,6 +275,14 @@ Please reach out to all of these people and support their projects if you're so
275
 
276
  == Changelog ==
277
 
 
 
 
 
 
 
 
 
278
  = 0.14.4 =
279
  * Fix: Cleanup widget and postbox display for WordPress 5.5
280
  * Fix: Update to PageSpeed API v5, show webvitals metrics
3
  Tags: seo, cache, optimize, pagespeed, performance, caching, compression, maxcdn, nginx, varnish, redis, new relic, aws, amazon web services, s3, cloudfront, rackspace, cloudflare, azure, apache
4
  Requires at least: 3.2
5
  Tested up to: 5.5
6
+ Stable tag: 0.15.0
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
104
 
105
  = Which WordPress versions are supported? =
106
 
107
+ To use all features in the suite, a minimum of version WordPress 3.2 with PHP 5.3 is required. Earlier versions will benefit from our Media Library Importer to get them back on the upgrade path and into a CDN of their choosing.
108
 
109
  = Why doesn't minify work for me? =
110
 
275
 
276
  == Changelog ==
277
 
278
+ = 0.15.0 =
279
+ * Feature: Added TransparentCDN full-site delivery option
280
+ * Fix: Update settings on activation in a changed environment
281
+ * Fix: Fixed a compatibility check for Apache when PHP is running as CGI
282
+ * Fix: Always set HSTS headers in Apache; not only for 2xx HTTP codes
283
+ * Fix: Implemented anatomic incrementing of key version in Memcache(d)
284
+ * Update: Allow filtering of w3tc_minify_url_for_files Minify URL for files
285
+
286
  = 0.14.4 =
287
  * Fix: Cleanup widget and postbox display for WordPress 5.5
288
  * Fix: Update to PageSpeed API v5, show webvitals metrics
w3-total-cache-api.php CHANGED
@@ -5,7 +5,7 @@ if ( !defined( 'ABSPATH' ) ) {
5
  }
6
 
7
  define( 'W3TC', true );
8
- define( 'W3TC_VERSION', '0.14.4' );
9
  define( 'W3TC_POWERED_BY', 'W3 Total Cache' );
10
  define( 'W3TC_EMAIL', 'w3tc@w3-edge.com' );
11
  define( 'W3TC_TEXT_DOMAIN', 'w3-total-cache' );
5
  }
6
 
7
  define( 'W3TC', true );
8
+ define( 'W3TC_VERSION', '0.15.0' );
9
  define( 'W3TC_POWERED_BY', 'W3 Total Cache' );
10
  define( 'W3TC_EMAIL', 'w3tc@w3-edge.com' );
11
  define( 'W3TC_TEXT_DOMAIN', 'w3-total-cache' );
w3-total-cache.php CHANGED
@@ -1,68 +1,75 @@
1
  <?php
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.14.4
6
- Plugin URI: https://www.boldgrid.com/totalcache/
7
- Author: BoldGrid
8
- Author URI: https://www.boldgrid.com/
9
- Network: True
10
- */
11
-
12
- /* Copyright (c) 2009 Frederick Townes <ftownes@w3-edge.com>
13
- Portions of this distribution are copyrighted by:
14
- Copyright (c) 2008 Ryan Grove <ryan@wonko.com>
15
- Copyright (c) 2008 Steve Clay <steve@mrclay.org>
16
- Copyright (c) 2007 Matt Mullenweg
17
- Copyright (c) 2007 Andy Skelton
18
- Copyright (c) 2007 Iliya Polihronov
19
- Copyright (c) 2007 Michael Adams
20
- Copyright (c) 2007 Automattic Inc.
21
- Ryan Boren
22
- All rights reserved.
23
-
24
- W3 Total Cache is distributed under the GNU General Public License, Version 2,
25
- June 1991. Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin
26
- St, Fifth Floor, Boston, MA 02110, USA
27
 
28
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
29
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
30
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
32
- ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
33
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
35
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
- if ( !defined( 'ABSPATH' ) ) {
41
  die();
42
  }
43
 
44
  /**
45
- * Abort W3TC loading if WordPress is upgrading
46
  */
47
- if ( defined( 'WP_INSTALLING' ) && WP_INSTALLING )
48
  return;
 
49
 
50
  if ( version_compare( PHP_VERSION, '5.3.0', '<') ) {
51
  require_once dirname( __FILE__ ) . '/w3-total-cache-old-php.php';
52
  register_activation_hook( __FILE__, 'w3tc_old_php_activate' );
53
- return;
54
  }
55
 
56
- if ( !defined( 'W3TC_IN_MINIFY' ) ) {
57
  /**
58
- * Require plugin configuration
59
  */
60
  require_once dirname( __FILE__ ) . '/w3-total-cache-api.php';
61
 
62
- // Load the wp cli command - if run from wp-cli
63
  if ( defined( 'WP_CLI' ) && WP_CLI )
64
  require_once W3TC_DIR . '/Cli.php';
65
 
66
- // include to prevent syntax error for older php
67
  require_once dirname( __FILE__ ) . '/Root_Loader.php';
68
  }
1
  <?php
2
  /*
3
+ * Plugin Name: W3 Total Cache
4
+ * Plugin URI: https://www.boldgrid.com/totalcache/
5
+ * 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.
6
+ * Version: 0.15.0
7
+ * Requires at least: 3.2
8
+ * Requires PHP: 5.3
9
+ * Author: BoldGrid
10
+ * Author URI: https://www.boldgrid.com/
11
+ * License: GPL v2 or later
12
+ * License URI: https://www.gnu.org/licenses/gpl-2.0.html
13
+ * Text Domain: w3-total-cache
14
+ * Network: True
15
+ */
 
 
 
 
 
 
 
 
 
 
 
16
 
17
+ /*
18
+ * Copyright (c) 2009 Frederick Townes <ftownes@w3-edge.com>
19
+ * Portions of this distribution are copyrighted by:
20
+ * Copyright (c) 2008 Ryan Grove <ryan@wonko.com>
21
+ * Copyright (c) 2008 Steve Clay <steve@mrclay.org>
22
+ * Copyright (c) 2007 Matt Mullenweg
23
+ * Copyright (c) 2007 Andy Skelton
24
+ * Copyright (c) 2007 Iliya Polihronov
25
+ * Copyright (c) 2007 Michael Adams
26
+ * Copyright (c) 2007 Automattic Inc.
27
+ * Ryan Boren
28
+ * All rights reserved.
29
+ *
30
+ * W3 Total Cache is distributed under the GNU General Public License, Version 2,
31
+ * June 1991. Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin
32
+ * St, Fifth Floor, Boston, MA 02110, USA
33
+ *
34
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
35
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
36
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
37
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
38
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
39
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
40
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
41
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
42
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
43
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44
+ */
45
 
46
+ if ( ! defined( 'ABSPATH' ) ) {
47
  die();
48
  }
49
 
50
  /**
51
+ * Abort W3TC loading if WordPress is upgrading.
52
  */
53
+ if ( defined( 'WP_INSTALLING' ) && WP_INSTALLING ) {
54
  return;
55
+ }
56
 
57
  if ( version_compare( PHP_VERSION, '5.3.0', '<') ) {
58
  require_once dirname( __FILE__ ) . '/w3-total-cache-old-php.php';
59
  register_activation_hook( __FILE__, 'w3tc_old_php_activate' );
60
+ return;
61
  }
62
 
63
+ if ( ! defined( 'W3TC_IN_MINIFY' ) ) {
64
  /**
65
+ * Require plugin configuration.
66
  */
67
  require_once dirname( __FILE__ ) . '/w3-total-cache-api.php';
68
 
69
+ // Load the wp cli command - if run from wp-cli.
70
  if ( defined( 'WP_CLI' ) && WP_CLI )
71
  require_once W3TC_DIR . '/Cli.php';
72
 
73
+ // Include to prevent syntax error for older php.
74
  require_once dirname( __FILE__ ) . '/Root_Loader.php';
75
  }