W3 Total Cache - Version 2.1.6

Version Description

  • Fix: JS minify issue with template literal backticks
  • Fix: Do not redirect when using WP-CLI
  • Fix: Missing whitespace in Memcached Nginx configuration
  • Fix: Setting for CDN over passive FTP
  • Fix: Updated CDN Minify regex
  • Fix: Added missing text domains and fixed translations
  • Enhancement: Allow default AWS credentials provider
  • Enhancement: Added error logging when minification base URL is not found
Download this release

Release Info

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

Code changes from version 2.1.5 to 2.1.6

CdnEngine_CloudFront.php CHANGED
@@ -30,9 +30,13 @@ class CdnEngine_CloudFront extends CdnEngine_Base {
30
  return;
31
  }
32
 
33
- $credentials = new \Aws\Credentials\Credentials(
34
- $this->_config['key'],
35
- $this->_config['secret'] );
 
 
 
 
36
 
37
  $this->api = new \Aws\CloudFront\CloudFrontClient( array(
38
  'credentials' => $credentials,
30
  return;
31
  }
32
 
33
+ if ( empty( $this->_config['key'] ) && empty( $this->_config['secret'] ) ) {
34
+ $credentials = \Aws\Credentials\CredentialProvider::defaultProvider();
35
+ } else {
36
+ $credentials = new \Aws\Credentials\Credentials(
37
+ $this->_config['key'],
38
+ $this->_config['secret'] );
39
+ }
40
 
41
  $this->api = new \Aws\CloudFront\CloudFrontClient( array(
42
  'credentials' => $credentials,
CdnEngine_Mirror_CloudFront.php CHANGED
@@ -29,9 +29,13 @@ class CdnEngine_Mirror_CloudFront extends CdnEngine_Mirror {
29
  return;
30
  }
31
 
32
- $credentials = new \Aws\Credentials\Credentials(
33
- $this->_config['key'],
34
- $this->_config['secret'] );
 
 
 
 
35
 
36
  $this->api = new \Aws\CloudFront\CloudFrontClient( array(
37
  'credentials' => $credentials,
29
  return;
30
  }
31
 
32
+ if ( empty( $this->_config['key'] ) && empty( $this->_config['secret'] ) ) {
33
+ $credentials = \Aws\Credentials\CredentialProvider::defaultProvider();
34
+ } else {
35
+ $credentials = new \Aws\Credentials\Credentials(
36
+ $this->_config['key'],
37
+ $this->_config['secret'] );
38
+ }
39
 
40
  $this->api = new \Aws\CloudFront\CloudFrontClient( array(
41
  'credentials' => $credentials,
CdnEngine_S3.php CHANGED
@@ -88,21 +88,25 @@ class CdnEngine_S3 extends CdnEngine_Base {
88
  return;
89
  }
90
 
91
- if ( empty( $this->_config['key'] ) ) {
92
- throw new \Exception( 'Empty access key.' );
93
- }
94
-
95
- if ( empty( $this->_config['secret'] ) ) {
96
- throw new \Exception( 'Empty secret key.' );
97
- }
98
-
99
  if ( empty( $this->_config['bucket'] ) ) {
100
  throw new \Exception( 'Empty bucket.' );
101
  }
102
 
103
- $credentials = new \Aws\Credentials\Credentials(
104
- $this->_config['key'],
105
- $this->_config['secret'] );
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
  $this->api = new \Aws\S3\S3Client( array(
108
  'credentials' => $credentials,
88
  return;
89
  }
90
 
 
 
 
 
 
 
 
 
91
  if ( empty( $this->_config['bucket'] ) ) {
92
  throw new \Exception( 'Empty bucket.' );
93
  }
94
 
95
+ if ( empty( $this->_config['key'] ) && empty( $this->_config['secret'] ) ) {
96
+ $credentials = \Aws\Credentials\CredentialProvider::defaultProvider();
97
+ } else {
98
+ if ( empty( $this->_config['key'] ) ) {
99
+ throw new \Exception( 'Empty access key.' );
100
+ }
101
+
102
+ if ( empty( $this->_config['secret'] ) ) {
103
+ throw new \Exception( 'Empty secret key.' );
104
+ }
105
+
106
+ $credentials = new \Aws\Credentials\Credentials(
107
+ $this->_config['key'],
108
+ $this->_config['secret'] );
109
+ }
110
 
111
  $this->api = new \Aws\S3\S3Client( array(
112
  'credentials' => $credentials,
Cdn_Plugin.php CHANGED
@@ -874,22 +874,24 @@ class _Cdn_Plugin_ContentFilter {
874
 
875
  if ( $this->_config->get_boolean( 'cdn.minify.enable' ) ) {
876
  if ( $this->_config->get_boolean( 'minify.auto' ) ) {
877
- $regexp = '~(["\'(=])\s*' .
878
- $this->minify_url_regexp( '/[a-zA-Z0-9-_]+\.(css|js)' ) .
879
- '~U';
880
- if ( Cdn_Util::is_engine_mirror( $this->_config->get_string( 'cdn.engine' ) ) )
881
  $processor = array( $this, '_link_replace_callback' );
882
- else
883
  $processor = array( $this, '_minify_auto_pushcdn_link_replace_callback' );
 
884
  } else {
885
- $regexp = '~(["\'(=])\s*' .
886
- $this->minify_url_regexp(
887
- '/[a-z0-9]+\..+\.include(-(footer|body))?(-nb)?\.[a-f0-9]+\.(css|js)' )
888
- .'~U';
889
  $processor = array( $this, '_link_replace_callback' );
890
  }
891
 
892
- $buffer = preg_replace_callback( $regexp, $processor, $buffer );
 
 
 
893
  }
894
 
895
  $buffer = $this->replace_placeholders( $buffer );
@@ -967,8 +969,10 @@ class _Cdn_Plugin_ContentFilter {
967
  Util_Environment::cache_blog_minify_dir()
968
  );
969
  $matches = null;
970
- if ( !preg_match( '~((https?://)?([^/]+))(.+)~i', $minify_base_url, $matches ) )
 
971
  return '';
 
972
 
973
  $protocol_domain_regexp = Util_Environment::get_url_regexp( $matches[1] );
974
  $path_regexp = Util_Environment::preg_quote( $matches[4] );
874
 
875
  if ( $this->_config->get_boolean( 'cdn.minify.enable' ) ) {
876
  if ( $this->_config->get_boolean( 'minify.auto' ) ) {
877
+ $minify_url_regexp = $this->minify_url_regexp( '/[a-zA-Z0-9-_]+\.(css|js)' );
878
+
879
+ if ( Cdn_Util::is_engine_mirror( $this->_config->get_string( 'cdn.engine' ) ) ) {
 
880
  $processor = array( $this, '_link_replace_callback' );
881
+ } else {
882
  $processor = array( $this, '_minify_auto_pushcdn_link_replace_callback' );
883
+ }
884
  } else {
885
+ $minify_url_regexp = $this->minify_url_regexp(
886
+ '/[a-z0-9]+\..+\.include(-(footer|body))?(-nb)?\.[a-f0-9]+\.(css|js)' );
887
+
 
888
  $processor = array( $this, '_link_replace_callback' );
889
  }
890
 
891
+ if ( !empty( $minify_url_regexp ) ) {
892
+ $regexp = '~(["\'(=])\s*' . $minify_url_regexp .'~U';
893
+ $buffer = preg_replace_callback( $regexp, $processor, $buffer );
894
+ }
895
  }
896
 
897
  $buffer = $this->replace_placeholders( $buffer );
969
  Util_Environment::cache_blog_minify_dir()
970
  );
971
  $matches = null;
972
+ if ( !preg_match( '~((https?://)?([^/]+))(.+)~i', $minify_base_url, $matches ) ) {
973
+ error_log( 'cant find minification base url, make sure minification folder sits inside WP_CONTENT_DIR and DOCUMENT_ROOT is set correctly' );
974
  return '';
975
+ }
976
 
977
  $protocol_domain_regexp = Util_Environment::get_url_regexp( $matches[1] );
978
  $path_regexp = Util_Environment::preg_quote( $matches[4] );
Cdn_RackSpace_Api_Cdn.php CHANGED
@@ -217,7 +217,7 @@ class Cdn_RackSpace_Api_Cdn {
217
  'response_json' => array(),
218
  'auth_required' => true
219
  );
220
-
221
  // try to decode response
222
  $response_json = @json_decode( $result['body'], true );
223
  if ( is_null( $response_json ) ||
217
  'response_json' => array(),
218
  'auth_required' => true
219
  );
220
+
221
  // try to decode response
222
  $response_json = @json_decode( $result['body'], true );
223
  if ( is_null( $response_json ) ||
Cdnfsd_CloudFront_Engine.php CHANGED
@@ -72,12 +72,24 @@ class Cdnfsd_CloudFront_Engine {
72
 
73
 
74
  private function _api() {
75
- if ( empty( $this->access_key ) || empty( $this->secret_key ) ||
76
- empty( $this->distribution_id ) )
77
- throw new \Exception( __( 'Access key not specified.', 'w3-total-cache' ) );
 
 
 
 
 
 
 
78
 
79
- $credentials = new \Aws\Credentials\Credentials(
80
- $this->access_key, $this->secret_key );
 
 
 
 
 
81
 
82
  return new \Aws\CloudFront\CloudFrontClient( array(
83
  'credentials' => $credentials,
72
 
73
 
74
  private function _api() {
75
+ if ( empty( $this->distribution_id ) ) {
76
+ throw new \Exception( __('CloudFront distribution not specified.', 'w3-total-cache' ) );
77
+ }
78
+
79
+ if ( empty( $this->access_key ) && empty( $this->secret_key ) ) {
80
+ $credentials = \Aws\Credentials\CredentialProvider::defaultProvider();
81
+ } else {
82
+ if ( empty( $this->access_key ) ) {
83
+ throw new \Exception( __( 'Access key not specified.', 'w3-total-cache' ) );
84
+ }
85
 
86
+ if ( empty( $this->secret_key ) ) {
87
+ throw new \Exception( __( 'Secret key not specified.', 'w3-total-cache' ) );
88
+ }
89
+
90
+ $credentials = new \Aws\Credentials\Credentials(
91
+ $this->access_key, $this->secret_key );
92
+ }
93
 
94
  return new \Aws\CloudFront\CloudFrontClient( array(
95
  'credentials' => $credentials,
Cdnfsd_CloudFront_Popup.php CHANGED
@@ -406,8 +406,12 @@ class Cdnfsd_CloudFront_Popup {
406
 
407
 
408
  private function _api( $access_key, $secret_key ) {
409
- $credentials = new \Aws\Credentials\Credentials(
410
- $access_key, $secret_key );
 
 
 
 
411
 
412
  return new \Aws\CloudFront\CloudFrontClient( array(
413
  'credentials' => $credentials,
406
 
407
 
408
  private function _api( $access_key, $secret_key ) {
409
+ if ( empty( $access_key ) && empty( $secret_key ) ) {
410
+ $credentials = \Aws\Credentials\CredentialProvider::defaultProvider();
411
+ } else {
412
+ $credentials = new \Aws\Credentials\Credentials(
413
+ $access_key, $secret_key );
414
+ }
415
 
416
  return new \Aws\CloudFront\CloudFrontClient( array(
417
  'credentials' => $credentials,
Enterprise_SnsBase.php CHANGED
@@ -34,14 +34,20 @@ class Enterprise_SnsBase {
34
  */
35
  protected function _get_api() {
36
  if ( is_null( $this->_api ) ) {
37
- if ( $this->_api_key == '' )
38
- throw new \Exception( 'API Key is not configured' );
39
- if ( $this->_api_secret == '' )
40
- throw new \Exception( 'API Secret is not configured' );
 
 
41
 
 
 
 
42
 
43
- $credentials = new \Aws\Credentials\Credentials(
44
- $this->_api_key, $this->_api_secret );
 
45
 
46
  $this->_api = new \Aws\Sns\SnsClient( array(
47
  'credentials' => $credentials,
34
  */
35
  protected function _get_api() {
36
  if ( is_null( $this->_api ) ) {
37
+ if ( empty( $this->_api_key ) && empty( $this->_api_secret ) ) {
38
+ $credentials = \Aws\Credentials\CredentialProvider::defaultProvider();
39
+ } else {
40
+ if ( empty( $this->_api_key ) ) {
41
+ throw new \Exception( 'API Key is not configured' );
42
+ }
43
 
44
+ if ( empty( $this->_api_secret ) ) {
45
+ throw new \Exception( 'API Secret is not configured' );
46
+ }
47
 
48
+ $credentials = new \Aws\Credentials\Credentials(
49
+ $this->_api_key, $this->_api_secret );
50
+ }
51
 
52
  $this->_api = new \Aws\Sns\SnsClient( array(
53
  'credentials' => $credentials,
Extension_CloudFlare_Plugin.php CHANGED
@@ -134,7 +134,7 @@ class Extension_CloudFlare_Plugin {
134
  array( 'cloudflare', 'timelimit.api_request' ) )
135
  )
136
  );
137
-
138
  try {
139
  $api->external_event( 'WP_SPAM', json_encode( $value ) );
140
  } catch ( \Exception $ex ) {
134
  array( 'cloudflare', 'timelimit.api_request' ) )
135
  )
136
  );
137
+
138
  try {
139
  $api->external_event( 'WP_SPAM', json_encode( $value ) );
140
  } catch ( \Exception $ex ) {
Extension_FragmentCache_GeneralPage_View.php CHANGED
@@ -6,7 +6,7 @@ if ( !defined( 'W3TC' ) )
6
 
7
  Util_Ui::postbox_header( 'Fragment Cache', '', 'fragmentcache' );
8
  ?>
9
- <p>Enable fragment caching reduce execution time for common operations.</p>
10
 
11
  <table class="form-table">
12
  <?php
6
 
7
  Util_Ui::postbox_header( 'Fragment Cache', '', 'fragmentcache' );
8
  ?>
9
+ <p><?php _e( 'Enable fragment caching reduce execution time for common operations.', 'w3-total-cache' ); ?></p>
10
 
11
  <table class="form-table">
12
  <?php
Generic_WidgetSpreadTheWord_View.php CHANGED
@@ -8,13 +8,13 @@ if ( !defined( 'W3TC' ) )
8
  <p><?php _e( "Enjoying W3TC? Please support us!", 'w3-total-cache' ) ?></p>
9
  <ul>
10
  <li>
11
- <label>Vote: </label>
12
  <input type="button" class="button button-vote" value="Give us a 5 stars!" />
13
  </li>
14
  </ul>
15
 
16
  <p>
17
- Or please share
18
  <a href="admin.php?page=w3tc_support&amp;request_type=new_feature">your feedback</a>
19
  so that we can improve!
20
  </p>
8
  <p><?php _e( "Enjoying W3TC? Please support us!", 'w3-total-cache' ) ?></p>
9
  <ul>
10
  <li>
11
+ <label><?php _e( 'Vote:', 'w3-total-cache' ); ?></label>
12
  <input type="button" class="button button-vote" value="Give us a 5 stars!" />
13
  </li>
14
  </ul>
15
 
16
  <p>
17
+ <?php _e( 'Or please share', 'w3-total-cache' ); ?>
18
  <a href="admin.php?page=w3tc_support&amp;request_type=new_feature">your feedback</a>
19
  so that we can improve!
20
  </p>
PgCache_Environment.php CHANGED
@@ -1218,7 +1218,7 @@ class PgCache_Environment {
1218
  $memcached_pass = !empty( $memcached_servers ) ? array_values( $memcached_servers )[0] : 'localhost:11211';
1219
 
1220
  $rules .= ' if ($w3tc_rewrite = 1) {' . "\n";
1221
- $rules .= ' memcached_pass' . $memcached_pass . ';' . "\n";
1222
  $rules .= " }\n";
1223
  $rules .= ' error_page 404 502 504 = @fallback;' . "\n";
1224
  $rules .= "}\n";
1218
  $memcached_pass = !empty( $memcached_servers ) ? array_values( $memcached_servers )[0] : 'localhost:11211';
1219
 
1220
  $rules .= ' if ($w3tc_rewrite = 1) {' . "\n";
1221
+ $rules .= ' memcached_pass ' . $memcached_pass . ';' . "\n";
1222
  $rules .= " }\n";
1223
  $rules .= ' error_page 404 502 504 = @fallback;' . "\n";
1224
  $rules .= "}\n";
PgCache_Plugin.php CHANGED
@@ -191,7 +191,7 @@ class PgCache_Plugin {
191
  public function redirect_on_foreign_domain() {
192
  $request_host = Util_Environment::host();
193
  // host not known, potentially we are in console mode not http request
194
- if ( empty( $request_host ) )
195
  return;
196
 
197
  $home_url = get_home_url();
191
  public function redirect_on_foreign_domain() {
192
  $request_host = Util_Environment::host();
193
  // host not known, potentially we are in console mode not http request
194
+ if ( empty( $request_host ) || defined( 'WP_CLI' ) && WP_CLI )
195
  return;
196
 
197
  $home_url = get_home_url();
UsageStatistics_GeneralPage_View.php CHANGED
@@ -15,7 +15,7 @@ $is_pro = Util_Environment::is_w3tc_pro( $c );
15
  <?php
16
  Util_Ui::config_item_pro( array(
17
  'key' => 'stats.enabled',
18
- 'label' => esc_html__( 'Cache usage statistics' ),
19
  'control' => 'checkbox',
20
  'checkbox_label' => __( 'Enable', 'w3-total-cache' ),
21
  'disabled' => ( $is_pro ? null : true ),
@@ -40,8 +40,7 @@ Util_Ui::config_item( array(
40
  'label' => __( 'Slot time (seconds):', 'w3-total-cache' ),
41
  'control' => 'textbox',
42
  'textbox_type' => 'number',
43
- 'description' =>
44
- 'The duration of time in seconds to collect statistics per interval.',
45
  'show_in_free' => false,
46
  ) );
47
  Util_Ui::config_item( array(
@@ -49,8 +48,7 @@ Util_Ui::config_item( array(
49
  'label' => __( 'Slots collected:', 'w3-total-cache' ),
50
  'control' => 'textbox',
51
  'textbox_type' => 'number',
52
- 'description' =>
53
- 'The number of intervals that are represented in the graph.',
54
  'show_in_free' => false,
55
  ) );
56
 
@@ -77,7 +75,7 @@ Util_Ui::config_item( array(
77
  'apache' => 'Apache',
78
  'nginx' => 'Nginx'
79
  ),
80
- 'description' => 'Webserver type generating access logs.',
81
  'show_in_free' => false,
82
  ) );
83
  Util_Ui::config_item( array(
@@ -85,7 +83,7 @@ Util_Ui::config_item( array(
85
  'label' => __( 'Access Log Filename:', 'w3-total-cache' ),
86
  'control' => 'textbox',
87
  'textbox_size' => 60,
88
- 'description' => 'Where your access log is located.',
89
  'control_after' =>
90
  '<input type="button" class="button" id="ustats_access_log_test" value="Test" /><span id="ustats_access_log_test_result" style="padding-left: 20px"></span>',
91
  'show_in_free' => false,
@@ -95,8 +93,7 @@ Util_Ui::config_item( array(
95
  'label' => __( 'Access Log Format:', 'w3-total-cache' ),
96
  'control' => 'textbox',
97
  'textbox_size' => 60,
98
- 'description' =>
99
- 'Format of your access log from webserver configuration.',
100
  'control_after' =>
101
  '<input type="button" class="button" id="ustats_access_log_format_reset" value="Reset to Default" />',
102
  'show_in_free' => false,
15
  <?php
16
  Util_Ui::config_item_pro( array(
17
  'key' => 'stats.enabled',
18
+ 'label' => esc_html__( 'Cache usage statistics', 'w3-total-cache' ),
19
  'control' => 'checkbox',
20
  'checkbox_label' => __( 'Enable', 'w3-total-cache' ),
21
  'disabled' => ( $is_pro ? null : true ),
40
  'label' => __( 'Slot time (seconds):', 'w3-total-cache' ),
41
  'control' => 'textbox',
42
  'textbox_type' => 'number',
43
+ 'description' => __( 'The duration of time in seconds to collect statistics per interval.', 'w3-total-cache' ),
 
44
  'show_in_free' => false,
45
  ) );
46
  Util_Ui::config_item( array(
48
  'label' => __( 'Slots collected:', 'w3-total-cache' ),
49
  'control' => 'textbox',
50
  'textbox_type' => 'number',
51
+ 'description' => __( 'The number of intervals that are represented in the graph.', 'w3-total-cache' ),
 
52
  'show_in_free' => false,
53
  ) );
54
 
75
  'apache' => 'Apache',
76
  'nginx' => 'Nginx'
77
  ),
78
+ 'description' => __( 'Webserver type generating access logs.' ,'w3-total-cache' ),
79
  'show_in_free' => false,
80
  ) );
81
  Util_Ui::config_item( array(
83
  'label' => __( 'Access Log Filename:', 'w3-total-cache' ),
84
  'control' => 'textbox',
85
  'textbox_size' => 60,
86
+ 'description' => __( 'Where your access log is located.', 'w3-total-cache' ),
87
  'control_after' =>
88
  '<input type="button" class="button" id="ustats_access_log_test" value="Test" /><span id="ustats_access_log_test_result" style="padding-left: 20px"></span>',
89
  'show_in_free' => false,
93
  'label' => __( 'Access Log Format:', 'w3-total-cache' ),
94
  'control' => 'textbox',
95
  'textbox_size' => 60,
96
+ 'description' => __( 'Format of your access log from webserver configuration.', 'w3-total-cache' ),
 
97
  'control_after' =>
98
  '<input type="button" class="button" id="ustats_access_log_format_reset" value="Reset to Default" />',
99
  'show_in_free' => false,
UsageStatistics_Page_View_Ad.php CHANGED
@@ -1,11 +1,11 @@
1
  <p>
2
- Users who upgrade to W3 Total Cache Pro will have access to the new
3
  Statistics page, which provides an in-depth view of the performance of your
4
- site.
5
  </p>
6
 
7
  <ul style="margin-left: 50px; margin-bottom: 20px">
8
- <li>View detailed information about your site’s performance</li>
9
- <li>Visualize your performance over time with graphs</li>
10
- <li>Examine the overall performance of caching method backends</li>
11
  </ul>
1
  <p>
2
+ <?php _e( 'Users who upgrade to W3 Total Cache Pro will have access to the new
3
  Statistics page, which provides an in-depth view of the performance of your
4
+ site.', 'w3-total-cache' ); ?>
5
  </p>
6
 
7
  <ul style="margin-left: 50px; margin-bottom: 20px">
8
+ <li><?php _e( 'View detailed information about your site’s performance', 'w3-total-cache' ); ?></li>
9
+ <li><?php _e( 'Visualize your performance over time with graphs', 'w3-total-cache' ); ?></li>
10
+ <li><?php _e( 'Examine the overall performance of caching method backends', 'w3-total-cache' ); ?></li>
11
  </ul>
UserExperience_LazyLoad_Page_View.php CHANGED
@@ -49,7 +49,7 @@ $is_google_maps_easy = ( in_array( 'google-maps-easy/gmp.php', $plugins ) );
49
  'sync_head' => 'sync (to head)',
50
  'inline_footer' => 'inline'
51
  ),
52
- 'description' => 'Use <code>inline</code> method only when your website has just a few pages'
53
  )
54
  );
55
 
@@ -60,7 +60,7 @@ $is_google_maps_easy = ( in_array( 'google-maps-easy/gmp.php', $plugins ) );
60
  <th>Google Maps</th>
61
  <td>
62
  <?php Util_Ui::pro_wrap_maybe_start(); ?>
63
- <p class="description w3tc-gopro-excerpt" style="padding-bottom: 10px">Lazy load google map</p>
64
  <div>
65
  <?php
66
  Util_Ui::control2( Util_Ui::config_item_preprocess( array(
49
  'sync_head' => 'sync (to head)',
50
  'inline_footer' => 'inline'
51
  ),
52
+ 'description' => __( 'Use <code>inline</code> method only when your website has just a few pages', 'w3-total-cache' ),
53
  )
54
  );
55
 
60
  <th>Google Maps</th>
61
  <td>
62
  <?php Util_Ui::pro_wrap_maybe_start(); ?>
63
+ <p class="description w3tc-gopro-excerpt" style="padding-bottom: 10px"><?php _e( 'Lazy load google map', 'w3-total-cache' ); ?></p>
64
  <div>
65
  <?php
66
  Util_Ui::control2( Util_Ui::config_item_preprocess( array(
Util_File.php CHANGED
@@ -335,7 +335,7 @@ class Util_File {
335
  if ( !is_dir( W3TC_CACHE_TMP_DIR ) || !is_writable( W3TC_CACHE_TMP_DIR ) ) {
336
  $e = error_get_last();
337
  $description = ( isset( $e['message'] ) ? $e['message'] : '' );
338
-
339
  throw new \Exception( 'Can\'t create folder <strong>' .
340
  W3TC_CACHE_TMP_DIR . '</strong>: ' . $description );
341
  }
335
  if ( !is_dir( W3TC_CACHE_TMP_DIR ) || !is_writable( W3TC_CACHE_TMP_DIR ) ) {
336
  $e = error_get_last();
337
  $description = ( isset( $e['message'] ) ? $e['message'] : '' );
338
+
339
  throw new \Exception( 'Can\'t create folder <strong>' .
340
  W3TC_CACHE_TMP_DIR . '</strong>: ' . $description );
341
  }
inc/options/about.php CHANGED
@@ -8,8 +8,17 @@ if ( !defined( 'W3TC' ) )
8
  <?php include W3TC_INC_DIR . '/options/common/header.php'; ?>
9
 
10
  <div id="about">
11
- <p><?php _e( 'User experience is an important aspect of every web site and all web sites can benefit from effective caching and file size reduction. We have applied web site optimization methods typically used with high traffic sites and simplified their implementation. Coupling these methods either <a href="http://memcached.org/" target="_blank">memcached</a> and/or opcode caching and the <acronym title="Content Delivery Network">CDN</acronym> of your choosing to provide the following features and benefits:' ) ?></p>
12
-
 
 
 
 
 
 
 
 
 
13
  <ul>
14
  <li><?php _e( 'Improved Google search engine ranking', 'w3-total-cache' ); ?></li>
15
  <li><?php _e( 'Increased visitor time on site', 'w3-total-cache' ); ?></li>
8
  <?php include W3TC_INC_DIR . '/options/common/header.php'; ?>
9
 
10
  <div id="about">
11
+ <p>
12
+ <?php
13
+ printf(
14
+ // translators: 1: Link for Memcached, 2: HTML acronym open tag, 3: HTML acronym and close tag.
15
+ __( 'User experience is an important aspect of every web site and all web sites can benefit from effective caching and file size reduction. We have applied web site optimization methods typically used with high traffic sites and simplified their implementation. Coupling these methods either %1$s and/or opcode caching and the %2$sContent Delivery Network%3$s of your choosing to provide the following features and benefits:', 'w3-total-cache'),
16
+ '<a href="http://memcached.org/" target="_blank">memcached</a>',
17
+ '<acronym title="',
18
+ '">CDN</acronym>'
19
+ );
20
+ ?>
21
+ </p>
22
  <ul>
23
  <li><?php _e( 'Improved Google search engine ranking', 'w3-total-cache' ); ?></li>
24
  <li><?php _e( 'Increased visitor time on site', 'w3-total-cache' ); ?></li>
inc/options/browsercache.php CHANGED
@@ -119,7 +119,7 @@ $security_session_values = array(
119
  <label><input id="browsercache_nocookies" type="checkbox"
120
  <?php Util_Ui::sealing_disabled( 'browsercache.' ) ?>
121
  name="nocookies" value="1"<?php checked( $browsercache_nocookies, true ) ?> /> <?php _e( "Don't set cookies for static files", 'w3-total-cache' ) ?></label>
122
- <p class="description"><?php _e( 'Removes Set-Cookie header for responses.' ) ?></p>
123
  </th>
124
  </tr>
125
  <tr>
119
  <label><input id="browsercache_nocookies" type="checkbox"
120
  <?php Util_Ui::sealing_disabled( 'browsercache.' ) ?>
121
  name="nocookies" value="1"<?php checked( $browsercache_nocookies, true ) ?> /> <?php _e( "Don't set cookies for static files", 'w3-total-cache' ) ?></label>
122
+ <p class="description"><?php _e( 'Removes Set-Cookie header for responses.', 'w3-total-cache' ); ?></p>
123
  </th>
124
  </tr>
125
  <tr>
inc/options/dashboard.php CHANGED
@@ -31,7 +31,7 @@ if ( Util_Environment::is_w3tc_pro( Dispatcher::config() ) ) {
31
 
32
  <form id="w3tc_dashboard" action="admin.php?page=<?php echo $this->_page; ?>" method="post">
33
  <p>
34
- Perform a
35
  <input type="button" class="button button-self-test {nonce: '<?php echo wp_create_nonce( 'w3tc' ); ?>'}" value="<?php _e( 'compatibility check', 'w3-total-cache' ) ?>" />,
36
  <?php echo Util_Ui::nonce_field( 'w3tc' ); ?>
37
  <input id="flush_all" class="button" type="submit" name="w3tc_flush_all" value="<?php _e( 'empty all caches', 'w3-total-cache' ) ?>"<?php if ( ! $enabled ): ?> disabled="disabled"<?php endif; ?> /> <?php _e( 'at once or', 'w3-total-cache' ) ?>
@@ -55,7 +55,7 @@ echo implode( " $string ", apply_filters( 'w3tc_dashboard_actions', array() ) )
55
  <div class="content">
56
  <div id="dashboard-text" style="display:inline-block;">
57
  <h1><?php _e( 'Dashboard', 'w3-total-cache' )?></h1>
58
- <p>Thanks for choosing W3TC as your Web Performance Optimization (<acronym title="Web Performance Optimization">WPO</acronym>) framework!
59
  </div>
60
  <div id="widgets-container">
61
  <?php do_meta_boxes( $screen->id, 'normal', '' ); ?>
31
 
32
  <form id="w3tc_dashboard" action="admin.php?page=<?php echo $this->_page; ?>" method="post">
33
  <p>
34
+ <?php _e( 'Perform a', 'w3-total-cache' ); ?>
35
  <input type="button" class="button button-self-test {nonce: '<?php echo wp_create_nonce( 'w3tc' ); ?>'}" value="<?php _e( 'compatibility check', 'w3-total-cache' ) ?>" />,
36
  <?php echo Util_Ui::nonce_field( 'w3tc' ); ?>
37
  <input id="flush_all" class="button" type="submit" name="w3tc_flush_all" value="<?php _e( 'empty all caches', 'w3-total-cache' ) ?>"<?php if ( ! $enabled ): ?> disabled="disabled"<?php endif; ?> /> <?php _e( 'at once or', 'w3-total-cache' ) ?>
55
  <div class="content">
56
  <div id="dashboard-text" style="display:inline-block;">
57
  <h1><?php _e( 'Dashboard', 'w3-total-cache' )?></h1>
58
+ <p><?php _e( 'Thanks for choosing W3TC as your Web Performance Optimization (<acronym title="Web Performance Optimization">WPO</acronym>) framework!', 'w3-total-cache' ); ?></p>
59
  </div>
60
  <div id="widgets-container">
61
  <?php do_meta_boxes( $screen->id, 'normal', '' ); ?>
inc/options/general.php CHANGED
@@ -17,7 +17,7 @@ echo sprintf( 'The plugin is currently %1$s If an option is disabled it means th
17
  <?php Util_Ui::postbox_header( __( 'General', 'w3-total-cache' ), '' ); ?>
18
  <table class="form-table">
19
  <tr>
20
- <th>Preview mode:</th>
21
  <td>
22
  <?php echo Util_Ui::nonce_field( 'w3tc' ); ?>
23
  <?php if ( $this->_config->is_preview() ): ?>
@@ -127,7 +127,7 @@ Util_Ui::config_overloading_button( array(
127
  ) );
128
  ?>
129
  <p><?php w3tc_e( 'minify.general.header', 'Reduce load time by decreasing the size and number of <acronym title="Cascading Style Sheet">CSS</acronym> and <acronym title="JavaScript">JS</acronym> files. Automatically remove unnecessary data from <acronym title="Cascading Style Sheet">CSS</acronym>, <acronym title="JavaScript">JS</acronym>, feed, page and post <acronym title="Hypertext Markup Language">HTML</acronym>.' ) ?></p>
130
-
131
  <table class="form-table">
132
  <?php
133
  Util_Ui::config_item(
@@ -356,7 +356,7 @@ Util_Ui::button_config_save( 'general_varnish',
356
  <?php if ( $is_pro ): ?>
357
  <?php Util_Ui::postbox_header( 'Message Bus', '', 'amazon_sns' ); ?>
358
  <p>
359
- Allows policy management to be shared between a dynamic pool of servers. For example, each server in a pool to use opcode caching (which is not a shared resource) and purging is then syncronized between any number of servers in real-time; each server therefore behaves identically even though resources are not shared.
360
  </p>
361
  <table class="form-table">
362
  <tr>
17
  <?php Util_Ui::postbox_header( __( 'General', 'w3-total-cache' ), '' ); ?>
18
  <table class="form-table">
19
  <tr>
20
+ <th><?php _e( 'Preview mode:', 'w3-total-cache' ); ?></th>
21
  <td>
22
  <?php echo Util_Ui::nonce_field( 'w3tc' ); ?>
23
  <?php if ( $this->_config->is_preview() ): ?>
127
  ) );
128
  ?>
129
  <p><?php w3tc_e( 'minify.general.header', 'Reduce load time by decreasing the size and number of <acronym title="Cascading Style Sheet">CSS</acronym> and <acronym title="JavaScript">JS</acronym> files. Automatically remove unnecessary data from <acronym title="Cascading Style Sheet">CSS</acronym>, <acronym title="JavaScript">JS</acronym>, feed, page and post <acronym title="Hypertext Markup Language">HTML</acronym>.' ) ?></p>
130
+
131
  <table class="form-table">
132
  <?php
133
  Util_Ui::config_item(
356
  <?php if ( $is_pro ): ?>
357
  <?php Util_Ui::postbox_header( 'Message Bus', '', 'amazon_sns' ); ?>
358
  <p>
359
+ <?php _e( 'Allows policy management to be shared between a dynamic pool of servers. For example, each server in a pool to use opcode caching (which is not a shared resource) and purging is then syncronized between any number of servers in real-time; each server therefore behaves identically even though resources are not shared.', 'w3-total-cache' ); ?>
360
  </p>
361
  <table class="form-table">
362
  <tr>
inc/options/minify.php CHANGED
@@ -136,7 +136,11 @@ if ( file_exists( $html_engine_file2 ) ) {
136
  <?php
137
  Util_Ui::config_item( array(
138
  'key' => 'minify.js.enable',
139
- 'label' => '<acronym title="JavaScript">JS</acronym> minify settings:',
 
 
 
 
140
  'control' => 'checkbox',
141
  'checkbox_label' => __( 'Enable', 'w3-total-cache' )
142
  ) );
@@ -145,7 +149,7 @@ if ( file_exists( $html_engine_file2 ) ) {
145
  if ( $auto ):
146
  Util_Ui::config_item( array(
147
  'key' => 'minify.js.method',
148
- 'label' => 'Minify method:',
149
  'control' => 'selectbox',
150
  'selectbox_values' => array(
151
  'both' => array(
@@ -339,7 +343,7 @@ Util_Ui::config_item( array(
339
  'label' => '<acronym title="Hypertext Markup Language">HTTP</acronym>/2 push',
340
  'control' => 'checkbox',
341
  'checkbox_label' => __( 'Enable', 'w3-total-cache' ),
342
- 'description' => __( 'For better performance, send files to browser before they are requested when using the <acronym title="Hypertext Markup Language">HTTP</acronym>/2 protocol.',
343
  'w3-total-cache' ) .
344
  ( $this->_config->get_string( 'pgcache.engine' ) != 'file_generic' ? '' :
345
  __( ' <br /><b>Not supported by "Disk: Enhanced" page cache method for Nginx</b>', 'w3-total-cache' ) )
@@ -354,7 +358,7 @@ Util_Ui::config_item( array(
354
  <?php
355
  Util_Ui::config_item( array(
356
  'key' => 'minify.css.enable',
357
- 'label' => '<acronym title="Cascading Style Sheet">CSS</acronym> minify settings:',
358
  'control' => 'checkbox',
359
  'checkbox_label' => __( 'Enable', 'w3-total-cache' )
360
  ) );
@@ -488,7 +492,7 @@ Util_Ui::config_item( array(
488
  'label' => '<acronym title="Hypertext Markup Language">HTTP</acronym>/2 push',
489
  'control' => 'checkbox',
490
  'checkbox_label' => __( 'Enable', 'w3-total-cache' ),
491
- 'description' => __( 'For better performance, send files to browser before they are requested when using the <acronym title="Hypertext Markup Language">HTTP</acronym>/2 protocol.',
492
  'w3-total-cache' ) .
493
  ( $this->_config->get_string( 'pgcache.engine' ) != 'file_generic' ? '' :
494
  __( ' <br /><b>Not supported by "Disk: Enhanced" page cache method for Nginx</b>', 'w3-total-cache' ) )
136
  <?php
137
  Util_Ui::config_item( array(
138
  'key' => 'minify.js.enable',
139
+ 'label' => sprintf(
140
+ // translators: 1: JS acronym open tag, 2: JS acronym and close tag
141
+ __( '%1$sJavaScript%2$s minify settings:', 'w3-total-cache' ),
142
+ '<acronym title="',
143
+ '">JS</acronym>' ),
144
  'control' => 'checkbox',
145
  'checkbox_label' => __( 'Enable', 'w3-total-cache' )
146
  ) );
149
  if ( $auto ):
150
  Util_Ui::config_item( array(
151
  'key' => 'minify.js.method',
152
+ 'label' => __( 'Minify method:', 'w3-total-cache' ),
153
  'control' => 'selectbox',
154
  'selectbox_values' => array(
155
  'both' => array(
343
  'label' => '<acronym title="Hypertext Markup Language">HTTP</acronym>/2 push',
344
  'control' => 'checkbox',
345
  'checkbox_label' => __( 'Enable', 'w3-total-cache' ),
346
+ 'description' => __( 'For better performance, send files to browser before they are requested when using the <acronym title="Hypertext Transfer Protocol">HTTP</acronym>/2 protocol.',
347
  'w3-total-cache' ) .
348
  ( $this->_config->get_string( 'pgcache.engine' ) != 'file_generic' ? '' :
349
  __( ' <br /><b>Not supported by "Disk: Enhanced" page cache method for Nginx</b>', 'w3-total-cache' ) )
358
  <?php
359
  Util_Ui::config_item( array(
360
  'key' => 'minify.css.enable',
361
+ 'label' => __( '<acronym title="Cascading Style Sheet">CSS</acronym> minify settings:', 'w3-total-cache' ),
362
  'control' => 'checkbox',
363
  'checkbox_label' => __( 'Enable', 'w3-total-cache' )
364
  ) );
492
  'label' => '<acronym title="Hypertext Markup Language">HTTP</acronym>/2 push',
493
  'control' => 'checkbox',
494
  'checkbox_label' => __( 'Enable', 'w3-total-cache' ),
495
+ 'description' => __( 'For better performance, send files to browser before they are requested when using the <acronym title="Hypertext Transfer Protocol">HTTP</acronym>/2 protocol.',
496
  'w3-total-cache' ) .
497
  ( $this->_config->get_string( 'pgcache.engine' ) != 'file_generic' ? '' :
498
  __( ' <br /><b>Not supported by "Disk: Enhanced" page cache method for Nginx</b>', 'w3-total-cache' ) )
inc/options/minify/css.php CHANGED
@@ -14,7 +14,7 @@ $is_pro = Util_Environment::is_w3tc_pro( $this->_config );
14
  Util_Ui::config_item_pro( array(
15
  'key' => 'minify.css.embed',
16
  'control' => 'checkbox',
17
- 'checkbox_label' => __( 'Eliminate render-blocking <acronym title="Cascading Style Sheet">CSS</acronym> by moving it to <acronym title="Hypertext Markup Language">HTTP</acronym> body', 'w3-total-cache' ),
18
  'disabled' => ( $is_pro ? null : true ),
19
  'label_class' => 'w3tc_no_trtd',
20
  'excerpt' => __( 'Website visitors cannot navigate your website until a given page is ready - reduce the wait time with this feature.', 'w3-total-cache' ),
14
  Util_Ui::config_item_pro( array(
15
  'key' => 'minify.css.embed',
16
  'control' => 'checkbox',
17
+ 'checkbox_label' => __( 'Eliminate render-blocking <acronym title="Cascading Style Sheet">CSS</acronym> by moving it to <acronym title="Hypertext Transfer Protocol">HTTP</acronym> body', 'w3-total-cache' ),
18
  'disabled' => ( $is_pro ? null : true ),
19
  'label_class' => 'w3tc_no_trtd',
20
  'excerpt' => __( 'Website visitors cannot navigate your website until a given page is ready - reduce the wait time with this feature.', 'w3-total-cache' ),
inc/options/objectcache.php CHANGED
@@ -72,13 +72,13 @@ if ( $this->_config->get_string( 'objectcache.engine' ) == 'memcached' ) {
72
 
73
  <tr>
74
  <th colspan="2">
75
- <?php $this->checkbox( 'objectcache.enabled_for_wp_admin' ) ?> Enable caching for wp-admin requests</label>
76
  <p class="description"><?php _e( 'Enabling this option will increase wp-admin performance, but may cause side-effects', 'w3-total-cache' )?></p>
77
  </th>
78
  </tr>
79
  <tr>
80
  <th colspan="2">
81
- <?php $this->checkbox( 'objectcache.fallback_transients' ) ?> Store transients in database</label>
82
  <p class="description"><?php _e( 'Use that to store transients in database even when external cache is used. That allows transient values to survive object cache cleaning / expiration', 'w3-total-cache' )?></p>
83
  </th>
84
  </tr>
72
 
73
  <tr>
74
  <th colspan="2">
75
+ <?php $this->checkbox( 'objectcache.enabled_for_wp_admin' ); _e( 'Enable caching for wp-admin requests', 'w3-total-cache' ); ?></label>
76
  <p class="description"><?php _e( 'Enabling this option will increase wp-admin performance, but may cause side-effects', 'w3-total-cache' )?></p>
77
  </th>
78
  </tr>
79
  <tr>
80
  <th colspan="2">
81
+ <?php $this->checkbox( 'objectcache.fallback_transients' ); _e( 'Store transients in database', 'w3-total-cache' ); ?></label>
82
  <p class="description"><?php _e( 'Use that to store transients in database even when external cache is used. That allows transient values to survive object cache cleaning / expiration', 'w3-total-cache' )?></p>
83
  </th>
84
  </tr>
lib/Minify/JSMin.php CHANGED
@@ -207,7 +207,7 @@ class JSMin {
207
  // fallthrough intentional
208
  case self::ACTION_DELETE_A: // 2
209
  $this->a = $this->b;
210
- if ($this->a === "'" || $this->a === '"') { // string literal
211
  $str = $this->a; // in case needed for exception
212
  for(;;) {
213
  $this->output .= $this->a;
207
  // fallthrough intentional
208
  case self::ACTION_DELETE_A: // 2
209
  $this->a = $this->b;
210
+ if ( in_array( $this->a, array( "'", '"', '`' ), true ) ) {
211
  $str = $this->a; // in case needed for exception
212
  for(;;) {
213
  $this->output .= $this->a;
pub/js/options.js CHANGED
@@ -642,7 +642,7 @@ jQuery(function() {
642
  'config[user]': jQuery('#cdn_ftp_user').val(),
643
  'config[path]': jQuery('#cdn_ftp_path').val(),
644
  'config[pass]': jQuery('#cdn_ftp_pass').val(),
645
- 'config[pasv]': jQuery('#cdn_ftp_pasv:checked').length,
646
  'config[default_keys]': jQuery('#cdn__ftp__default_keys:checked').length,
647
  'config[pubkey]': jQuery('#cdn_ftp_pubkey').val(),
648
  'config[privkey]': jQuery('#cdn_ftp_privkey').val()
642
  'config[user]': jQuery('#cdn_ftp_user').val(),
643
  'config[path]': jQuery('#cdn_ftp_path').val(),
644
  'config[pass]': jQuery('#cdn_ftp_pass').val(),
645
+ 'config[pasv]': jQuery('#cdn__ftp__pasv:checked').length,
646
  'config[default_keys]': jQuery('#cdn__ftp__default_keys:checked').length,
647
  'config[pubkey]': jQuery('#cdn_ftp_pubkey').val(),
648
  'config[privkey]': jQuery('#cdn_ftp_privkey').val()
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Plugin Name ===
2
- Contributors: boldgrid, fredericktownes, maxicusc, gidomanders, bwmarkle, harryjackson1221, joemoto
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.8
5
  Tested up to: 5.8
6
- Stable tag: 2.1.5
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -275,6 +275,16 @@ Please reach out to all of these people and support their projects if you're so
275
 
276
  == Changelog ==
277
 
 
 
 
 
 
 
 
 
 
 
278
  = 2.1.5 =
279
  * Fix: Sanitize extension argument
280
 
1
  === Plugin Name ===
2
+ Contributors: boldgrid, fredericktownes, maxicusc, gidomanders, bwmarkle, harryjackson1221, joemoto, vmarko, jacobd91
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.8
5
  Tested up to: 5.8
6
+ Stable tag: 2.1.6
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
275
 
276
  == Changelog ==
277
 
278
+ = 2.1.6 =
279
+ * Fix: JS minify issue with template literal backticks
280
+ * Fix: Do not redirect when using WP-CLI
281
+ * Fix: Missing whitespace in Memcached Nginx configuration
282
+ * Fix: Setting for CDN over passive FTP
283
+ * Fix: Updated CDN Minify regex
284
+ * Fix: Added missing text domains and fixed translations
285
+ * Enhancement: Allow default AWS credentials provider
286
+ * Enhancement: Added error logging when minification base URL is not found
287
+
288
  = 2.1.5 =
289
  * Fix: Sanitize extension argument
290
 
w3-total-cache-api.php CHANGED
@@ -5,7 +5,7 @@ if ( !defined( 'ABSPATH' ) ) {
5
  }
6
 
7
  define( 'W3TC', true );
8
- define( 'W3TC_VERSION', '2.1.5' );
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', '2.1.6' );
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
@@ -3,7 +3,7 @@
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: 2.1.5
7
  * Requires at least: 3.8
8
  * Requires PHP: 5.6
9
  * Author: BoldGrid
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: 2.1.6
7
  * Requires at least: 3.8
8
  * Requires PHP: 5.6
9
  * Author: BoldGrid