W3 Total Cache - Version 2.1.2

Version Description

  • Fix: Skip removing spaces around "
  • " tags in HTML Minify
  • Fix: Updated admin URL logic for multisite installations
  • Fix: TransparentCDN purge URL validation
  • Fix: Added an option to use ABSPATH as the document root for Minify
  • Fix: Database cache debug message
  • Update: Added regions for AWS S3 (af-south-1, cn-north-1, cn-northwest-1, eu-south-1)
  • Update: Added MIME types AVIF and AVIFS for Browser Cache rules
  • Update: Enhanced "get_pagenum_link" filter
  • Update: Removed "comment" from the non-persistent object cache group
Download this release

Release Info

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

Code changes from version 2.1.1 to 2.1.2

Files changed (64) hide show
  1. BrowserCache_Environment.php +2 -0
  2. CdnEngine_S3.php +26 -16
  3. Cdnfsd_TransparentCDN_Engine.php +4 -2
  4. ConfigKeys.php +5 -1
  5. DbCache_WpdbInjection_QueryCaching.php +3 -3
  6. FeatureShowcase_Plugin_Admin.php +26 -19
  7. Generic_Plugin_Admin.php +2 -6
  8. Minify_ContentMinifier.php +2 -1
  9. Minify_MinifiedFileRequestHandler.php +1 -1
  10. SetupGuide_Plugin_Admin.php +7 -3
  11. Util_Environment.php +8 -0
  12. Util_PageUrls.php +1 -1
  13. Util_Ui.php +5 -8
  14. inc/mime/all.php +2 -0
  15. inc/mime/other.php +2 -0
  16. inc/options/browsercache.php +0 -0
  17. inc/options/general.php +16 -0
  18. inc/options/minify.php +1 -1
  19. lib/Minify/Minify/Build.php +10 -1
  20. lib/Minify/Minify/CSS.php +11 -2
  21. lib/Minify/Minify/CSS/UriRewriter.php +15 -3
  22. lib/Minify/Minify/Controller/Files.php +4 -1
  23. lib/Minify/Minify/Controller/Groups.php +11 -1
  24. lib/Minify/Minify/Controller/MinApp.php +19 -3
  25. lib/Minify/Minify/Controller/Version1.php +13 -2
  26. lib/Minify/Minify/HTML.php +1 -1
  27. lib/Minify/Minify/HTML/Helper.php +14 -2
  28. lib/Minify/Minify/HTMLTidy.php +3 -2
  29. lib/Minify/Minify/ImportProcessor.php +5 -1
  30. lib/Minify/Minify/Lines.php +12 -1
  31. lib/Minify/Minify/Source.php +11 -1
  32. lib/S3Compatible.php +1 -1
  33. pub/css/wizard.css +4 -0
  34. pub/img/W3TC_dashboard_logo_title-retina.png +0 -0
  35. pub/img/W3TC_dashboard_logo_title.png +0 -0
  36. pub/img/cdn-highwinds-logo.png +0 -0
  37. pub/img/google-logo.png +0 -0
  38. pub/img/overlay/ceo.png +0 -0
  39. pub/img/overlay/gray-check.png +0 -0
  40. pub/img/overlay/lite-gray-check.png +0 -0
  41. pub/img/overlay/lock.png +0 -0
  42. pub/img/overlay/overlay-close.png +0 -0
  43. pub/img/overlay/overlay-down-arrow.png +0 -0
  44. pub/img/overlay/overlay-logo.png +0 -0
  45. pub/img/overlay/save-close.png +0 -0
  46. pub/img/overlay/select-arrow.png +0 -0
  47. pub/img/overlay/twitter-bird-dark-bgs.png +0 -0
  48. pub/img/overlay/wordpress-logo-simplified-rgb.png +0 -0
  49. pub/img/w3tc_google-logo-retina.png +0 -0
  50. pub/img/w3tc_google-logo.png +0 -0
  51. pub/img/w3tc_maxcdn-logo-retina.png +0 -0
  52. pub/img/w3tc_maxcdn-logo.png +0 -0
  53. pub/img/w3tc_netdna-logo-retina.png +0 -0
  54. pub/img/w3tc_netdna-logo.png +0 -0
  55. pub/img/w3tc_newrelic-logo-retina.png +0 -0
  56. pub/img/w3tc_newrelic-logo.png +0 -0
  57. pub/img/w3tc_swarmify-logo-retina.png +0 -0
  58. pub/img/w3tc_swarmify-logo.png +0 -0
  59. pub/img/w3tc_w3edge-logo-retina.png +0 -0
  60. pub/img/w3tc_w3edge-logo.png +0 -0
  61. pub/img/w3tc_w3tc-logo-retina.png +0 -0
  62. readme.txt +12 -1
  63. w3-total-cache-api.php +1 -1
  64. w3-total-cache.php +1 -1
BrowserCache_Environment.php CHANGED
@@ -97,6 +97,8 @@ class BrowserCache_Environment {
97
  $other_compression = $a['other'];
98
  unset( $other_compression['asf|asx|wax|wmv|wmx'] );
99
  unset( $other_compression['avi'] );
 
 
100
  unset( $other_compression['divx'] );
101
  unset( $other_compression['gif'] );
102
  unset( $other_compression['br'] );
97
  $other_compression = $a['other'];
98
  unset( $other_compression['asf|asx|wax|wmv|wmx'] );
99
  unset( $other_compression['avi'] );
100
+ unset( $other_compression['avif'] );
101
+ unset( $other_compression['avifs'] );
102
  unset( $other_compression['divx'] );
103
  unset( $other_compression['gif'] );
104
  unset( $other_compression['br'] );
CdnEngine_S3.php CHANGED
@@ -11,28 +11,38 @@ if ( !defined( 'W3TC_SKIPLIB_AWS' ) ) {
11
  class CdnEngine_S3 extends CdnEngine_Base {
12
  private $api;
13
 
 
 
 
 
 
 
 
14
  static public function regions_list() {
15
  return array(
16
- 'us-east-1' => __( 'US East (N. Virginia)', 'w3-total-cache' ),
17
- 'us-east-2' => __( 'US East (Ohio)', 'w3-total-cache' ),
18
- 'us-west-1' => __( 'US-West (N. California)', 'w3-total-cache' ),
19
- 'us-west-2' => __( 'US-West (Oregon)', 'w3-total-cache' ),
20
- 'ap-east-1' => __( 'Asia Pacific (Hong Kong)', 'w3-total-cache' ),
21
- 'ap-northeast-1'=> __( 'Asia Pacific (Tokyo)', 'w3-total-cache' ),
 
22
  'ap-northeast-2' => __( 'Asia Pacific (Seoul)', 'w3-total-cache' ),
23
  'ap-northeast-3' => __( 'Asia Pacific (Osaka-Local)', 'w3-total-cache' ),
24
- 'ap-south-1' => __( 'Asia Pacific (Mumbai)', 'w3-total-cache' ),
25
  'ap-southeast-1' => __( 'Asia Pacific (Singapore)', 'w3-total-cache' ),
26
  'ap-southeast-2' => __( 'Asia Pacific (Sydney)', 'w3-total-cache' ),
27
- 'ca-central-1' => __( 'Canada (Central)', 'w3-total-cache' ),
28
- 'cn-northwest-1.cn' => __( 'China (Ningxia)', 'w3-total-cache' ),
29
- 'eu-central-1' => __( 'EU (Frankfurt)', 'w3-total-cache' ),
30
- 'eu-north-1' => __( 'EU (Stockholm)', 'w3-total-cache' ),
31
- 'eu-west-1' => __( 'EU (Ireland)', 'w3-total-cache' ),
32
- 'eu-west-2' => __( 'EU (London)', 'w3-total-cache' ),
33
- 'eu-west-3' => __( 'EU (Paris)', 'w3-total-cache' ),
34
- 'me-south-1' => __( 'Middle East (Bahrain)', 'w3-total-cache' ),
35
- 'sa-east-1' => __( 'South America (São Paulo)', 'w3-total-cache' ),
 
 
36
  );
37
  }
38
 
11
  class CdnEngine_S3 extends CdnEngine_Base {
12
  private $api;
13
 
14
+ /**
15
+ * Regions list.
16
+ *
17
+ * @link https://docs.aws.amazon.com/general/latest/gr/rande.html
18
+ *
19
+ * @return array
20
+ */
21
  static public function regions_list() {
22
  return array(
23
+ 'us-east-1' => __( 'US East (N. Virginia)', 'w3-total-cache' ),
24
+ 'us-east-2' => __( 'US East (Ohio)', 'w3-total-cache' ),
25
+ 'us-west-1' => __( 'US West (N. California)', 'w3-total-cache' ),
26
+ 'us-west-2' => __( 'US West (Oregon)', 'w3-total-cache' ),
27
+ 'af-south-1' => __( 'Africa (Cape Town)', 'w3-total-cache' ),
28
+ 'ap-east-1' => __( 'Asia Pacific (Hong Kong)', 'w3-total-cache' ),
29
+ 'ap-northeast-1' => __( 'Asia Pacific (Tokyo)', 'w3-total-cache' ),
30
  'ap-northeast-2' => __( 'Asia Pacific (Seoul)', 'w3-total-cache' ),
31
  'ap-northeast-3' => __( 'Asia Pacific (Osaka-Local)', 'w3-total-cache' ),
32
+ 'ap-south-1' => __( 'Asia Pacific (Mumbai)', 'w3-total-cache' ),
33
  'ap-southeast-1' => __( 'Asia Pacific (Singapore)', 'w3-total-cache' ),
34
  'ap-southeast-2' => __( 'Asia Pacific (Sydney)', 'w3-total-cache' ),
35
+ 'ca-central-1' => __( 'Canada (Central)', 'w3-total-cache' ),
36
+ 'cn-north-1' => __( 'China (Beijing)', 'w3-total-cache' ),
37
+ 'cn-northwest-1' => __( 'China (Ningxia)', 'w3-total-cache' ),
38
+ 'eu-central-1' => __( 'Europe (Frankfurt)', 'w3-total-cache' ),
39
+ 'eu-north-1' => __( 'Europe (Stockholm)', 'w3-total-cache' ),
40
+ 'eu-south-1' => __( 'Europe (Milan)', 'w3-total-cache' ),
41
+ 'eu-west-1' => __( 'Europe (Ireland)', 'w3-total-cache' ),
42
+ 'eu-west-2' => __( 'Europe (London)', 'w3-total-cache' ),
43
+ 'eu-west-3' => __( 'Europe (Paris)', 'w3-total-cache' ),
44
+ 'me-south-1' => __( 'Middle East (Bahrain)', 'w3-total-cache' ),
45
+ 'sa-east-1' => __( 'South America (São Paulo)', 'w3-total-cache' ),
46
  );
47
  }
48
 
Cdnfsd_TransparentCDN_Engine.php CHANGED
@@ -81,10 +81,12 @@ class Cdn_TransparentCDN_Api {
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 ) {
81
  $this->_get_token();
82
 
83
  $invalidation_urls = array();
84
+ //Included a regex filter because some of our clients reported receiving urls as "True" or "False"
85
  foreach ( $urls as $url ) {
86
  //Oh array_map+lambdas, how I miss u...
87
+ if ( filter_var( $url, FILTER_VALIDATE_URL ) ) {
88
+ $invalidation_urls[] = $url;
89
+ }
90
  }
91
 
92
  if ( count( $invalidation_urls ) === 0 ) {
ConfigKeys.php CHANGED
@@ -161,6 +161,11 @@ $keys = array(
161
  )
162
  ),
163
 
 
 
 
 
 
164
  'lazyload.enabled' => array(
165
  'type' => 'boolean',
166
  'default' => false
@@ -316,7 +321,6 @@ $keys = array(
316
  'objectcache.groups.nonpersistent' => array(
317
  'type' => 'array',
318
  'default' => array(
319
- 'comment',
320
  'counts',
321
  'plugins'
322
  )
161
  )
162
  ),
163
 
164
+ 'docroot_fix.enable' => array(
165
+ 'type' => 'boolean',
166
+ 'default' => false,
167
+ ),
168
+
169
  'lazyload.enabled' => array(
170
  'type' => 'boolean',
171
  'default' => false
321
  'objectcache.groups.nonpersistent' => array(
322
  'type' => 'array',
323
  'default' => array(
 
324
  'counts',
325
  'plugins'
326
  )
DbCache_WpdbInjection_QueryCaching.php CHANGED
@@ -745,9 +745,9 @@ class DbCache_WpdbInjection_QueryCaching extends DbCache_WpdbInjection {
745
  if ( $this->debug ) {
746
  $strings[] = '';
747
  $strings[] = 'Db cache debug info:';
748
- $strings[] = sprintf( "%1$s%2$d", str_pad( 'Total queries: ', 20 ), $this->query_total );
749
- $strings[] = sprintf( "%1$s%2$d", str_pad( 'Cached queries: ', 20 ), $this->query_hits );
750
- $strings[] = sprintf( "%1$s%2$.4f", str_pad( 'Total query time: ', 20 ), $this->time_total );
751
  }
752
 
753
  if ( $this->log_filehandle ) {
745
  if ( $this->debug ) {
746
  $strings[] = '';
747
  $strings[] = 'Db cache debug info:';
748
+ $strings[] = sprintf( '%1$s%2$d', str_pad( 'Total queries: ', 20 ), $this->query_total );
749
+ $strings[] = sprintf( '%1$s%2$d', str_pad( 'Cached queries: ', 20 ), $this->query_hits );
750
+ $strings[] = sprintf( '%1$s%2$.4f', str_pad( 'Total query time: ', 20 ), $this->time_total );
751
  }
752
 
753
  if ( $this->log_filehandle ) {
FeatureShowcase_Plugin_Admin.php CHANGED
@@ -137,6 +137,13 @@ class FeatureShowcase_Plugin_Admin {
137
  * @return int
138
  */
139
  public static function get_unseen_count() {
 
 
 
 
 
 
 
140
  global $current_user;
141
 
142
  $unseen_count = 0;
@@ -170,7 +177,7 @@ class FeatureShowcase_Plugin_Admin {
170
  'icon' => 'dashicons-superhero',
171
  'text' => esc_html__( 'The Setup Guide wizard quickly walks you through configuring W3 Total Cache.', 'w3-total-cache' ),
172
  'button' => '<button class="button" onclick="window.location=\'' .
173
- esc_url( admin_url( 'admin.php?page=w3tc_setup_guide' ) ) . '\'">' .
174
  __( 'Launch', 'w3-total-cache' ) . '</button>',
175
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/setup-guide-wizard/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=setup_guide' ) .
176
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
@@ -182,7 +189,7 @@ class FeatureShowcase_Plugin_Admin {
182
  'icon' => 'dashicons-admin-site',
183
  'text' => esc_html__( 'Defer loading offscreen Google Maps, making pages load faster.', 'w3-total-cache' ),
184
  'button' => '<button class="button" onclick="window.location=\'' .
185
- esc_url( admin_url( 'admin.php?page=w3tc_userexperience' ) ) . '\'">' .
186
  __( 'Settings', 'w3-total-cache' ) . '</button>',
187
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/lazy-load-google-maps/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=pro_lazyload_googlemaps' ) .
188
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
@@ -194,7 +201,7 @@ class FeatureShowcase_Plugin_Admin {
194
  'icon' => 'dashicons-networking',
195
  'text' => esc_html__( 'Provide the best user experience possible by enhancing by hosting HTML pages and RSS feeds with (supported) CDN\'s high speed global networks.', 'w3-total-cache' ),
196
  'button' => '<button class="button" onclick="window.location=\'' .
197
- esc_url( admin_url( 'admin.php?page=w3tc_general#cdn' ) ) . '\'">' .
198
  __( 'Settings', 'w3-total-cache' ) . '</button>',
199
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/cdn-full-site-delivery/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=pro_cdn_fsd' ) .
200
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
@@ -206,7 +213,7 @@ class FeatureShowcase_Plugin_Admin {
206
  'icon' => 'dashicons-table-row-delete',
207
  'text' => esc_html__( 'Render blocking CSS delays a webpage from being visible in a timely manner. Eliminate this easily with the click of a button in W3 Total Cache Pro.', 'w3-total-cache' ),
208
  'button' => '<button class="button" onclick="window.location=\'' .
209
- esc_url( admin_url( 'admin.php?page=w3tc_minify#css' ) ) . '\'">' .
210
  __( 'Settings', 'w3-total-cache' ) . '</button>',
211
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/how-to-use-manual-minify-for-css-and-js/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=pro_minify_CSS' ) .
212
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
@@ -218,7 +225,7 @@ class FeatureShowcase_Plugin_Admin {
218
  'icon' => 'dashicons-insert',
219
  'text' => esc_html__( 'Improve the performance of your Genesis, WPML powered site, and much more. StudioPress\' Genesis Framework is up to 60% faster with W3TC Pro.', 'w3-total-cache' ),
220
  'button' => '<button class="button" onclick="window.location=\'' .
221
- esc_url( admin_url( 'admin.php?page=w3tc_extensions' ) ) . '\'">' .
222
  __( 'Settings', 'w3-total-cache' ) . '</button>',
223
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/extension-framework-pro/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=pro_extensions' ) .
224
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
@@ -230,7 +237,7 @@ class FeatureShowcase_Plugin_Admin {
230
  'icon' => 'dashicons-chart-pie',
231
  'text' => esc_html__( 'Unlocking the fragment caching module delivers enhanced performance for plugins and themes that use the WordPress Transient API.', 'w3-total-cache' ),
232
  'button' => '<button class="button" onclick="window.location=\'' .
233
- esc_url( admin_url( 'admin.php?page=w3tc_general#fragmentcache' ) ) . '\'">' .
234
  __( 'Settings', 'w3-total-cache' ) . '</button>',
235
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/choosing-a-fragment-caching-method-for-w3-total-cache/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=pro_fragment_cache' ) .
236
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
@@ -242,7 +249,7 @@ class FeatureShowcase_Plugin_Admin {
242
  'icon' => 'dashicons-embed-generic',
243
  'text' => esc_html__( 'Save server resources or add scale and performance by caching the WordPress Rest API with W3TC Pro.', 'w3-total-cache' ),
244
  'button' => '<button class="button" onclick="window.location=\'' .
245
- esc_url( admin_url( 'admin.php?page=w3tc_pgcache#rest' ) ) . '\'">' .
246
  __( 'Settings', 'w3-total-cache' ) . '</button>',
247
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/achieve-ultimate-wordpress-performance-with-w3-total-cache-pro/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=pro_rest_api_caching' ) .
248
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
@@ -254,7 +261,7 @@ class FeatureShowcase_Plugin_Admin {
254
  'icon' => 'dashicons-chart-line',
255
  'text' => esc_html__( 'Analytics for your WordPress and Server cache that allow you to track the size, time and hit/miss ratio of each type of cache, giving you the information needed to gain maximum performance.', 'w3-total-cache' ),
256
  'button' => '<button class="button" onclick="window.location=\'' .
257
- esc_url( admin_url( 'admin.php?page=w3tc_stats' ) ) . '\'">' .
258
  __( 'Settings', 'w3-total-cache' ) . '</button>',
259
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/configuring-w3-total-cache-statistics-to-give-detailed-information-about-your-cache/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=pro_stats' ) .
260
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
@@ -266,7 +273,7 @@ class FeatureShowcase_Plugin_Admin {
266
  'icon' => 'dashicons-search',
267
  'text' => esc_html__( 'Purge Logs provide information on when your cache has been purged and what triggered it. If you are troubleshooting an issue with your cache being cleared, Purge Logs can tell you why.', 'w3-total-cache' ),
268
  'button' => '<button class="button" onclick="window.location=\'' .
269
- esc_url( admin_url( 'admin.php?page=w3tc_general#debug' ) ) . '\'">' .
270
  __( 'Settings', 'w3-total-cache' ) . '</button>',
271
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/purge-cache-log/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=pro_purge_logs' ) .
272
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
@@ -278,7 +285,7 @@ class FeatureShowcase_Plugin_Admin {
278
  'icon' => 'dashicons-format-aside',
279
  'text' => esc_html__( 'Page caching decreases the website response time, making pages load faster.', 'w3-total-cache' ),
280
  'button' => '<button class="button" onclick="window.location=\'' .
281
- esc_url( admin_url( 'admin.php?page=w3tc_general#page_cache' ) ) . '\'">' .
282
  __( 'Settings', 'w3-total-cache' ) . '</button>',
283
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/configuring-page-caching-in-w3-total-cache-for-shared-hosting/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=page_cache' ) .
284
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
@@ -290,7 +297,7 @@ class FeatureShowcase_Plugin_Admin {
290
  'icon' => 'dashicons-media-text',
291
  'text' => esc_html__( 'Reduce load time by decreasing the size and number of CSS and JS files.', 'w3-total-cache' ),
292
  'button' => '<button class="button" onclick="window.location=\'' .
293
- esc_url( admin_url( 'admin.php?page=w3tc_general#minify' ) ) . '\'">' .
294
  __( 'Settings', 'w3-total-cache' ) . '</button>',
295
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/choosing-a-minification-method-for-w3-total-cache/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=minify' ) .
296
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
@@ -302,7 +309,7 @@ class FeatureShowcase_Plugin_Admin {
302
  'icon' => 'dashicons-format-image',
303
  'text' => esc_html__( 'Defer loading offscreen images, making pages load faster.', 'w3-total-cache' ),
304
  'button' => '<button class="button" onclick="window.location=\'' .
305
- esc_url( admin_url( 'admin.php?page=w3tc_general#userexperience' ) ) . '\'">' .
306
  __( 'Settings', 'w3-total-cache' ) . '</button>',
307
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/configuring-lazy-loading-for-your-wordpress-website-with-w3-total-cache/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=lazyload' ) .
308
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
@@ -314,7 +321,7 @@ class FeatureShowcase_Plugin_Admin {
314
  'icon' => 'dashicons-format-gallery',
315
  'text' => esc_html__( 'Host static files with a CDN to reduce page load time.', 'w3-total-cache' ),
316
  'button' => '<button class="button" onclick="window.location=\'' .
317
- esc_url( admin_url( 'admin.php?page=w3tc_general#cdn' ) ) . '\'">' .
318
  __( 'Settings', 'w3-total-cache' ) . '</button>',
319
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/configuring-w3-total-cache-with-stackpath-for-cdn-objects/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=cdn' ) .
320
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
@@ -326,7 +333,7 @@ class FeatureShowcase_Plugin_Admin {
326
  'icon' => 'dashicons-performance',
327
  'text' => esc_html__( 'Improves PHP performance by storing precompiled script bytecode in shared memory.', 'w3-total-cache' ),
328
  'button' => '<button class="button" onclick="window.location=\'' .
329
- esc_url( admin_url( 'admin.php?page=w3tc_general#system_opcache' ) ) . '\'">' .
330
  __( 'Settings', 'w3-total-cache' ) . '</button>',
331
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/choosing-an-opcode-caching-method-with-w3-total-cache/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=opcode_cache' ) .
332
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
@@ -338,7 +345,7 @@ class FeatureShowcase_Plugin_Admin {
338
  'icon' => 'dashicons-database-view',
339
  'text' => esc_html__( 'Persistently store data to reduce post, page and feed creation time.', 'w3-total-cache' ),
340
  'button' => '<button class="button" onclick="window.location=\'' .
341
- esc_url( admin_url( 'admin.php?page=w3tc_general#database_cache' ) ) . '\'">' .
342
  __( 'Settings', 'w3-total-cache' ) . '</button>',
343
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/choosing-a-database-caching-method-in-w3-total-cache/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=database_cache' ) .
344
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
@@ -350,7 +357,7 @@ class FeatureShowcase_Plugin_Admin {
350
  'icon' => 'dashicons-archive',
351
  'text' => esc_html__( 'Persistently store objects to reduce execution time for common operations.', 'w3-total-cache' ),
352
  'button' => '<button class="button" onclick="window.location=\'' .
353
- esc_url( admin_url( 'admin.php?page=w3tc_general#object_cache' ) ) . '\'">' .
354
  __( 'Settings', 'w3-total-cache' ) . '</button>',
355
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/configuring-object-caching-methods-in-w3-total-cache/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=object_cache' ) .
356
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
@@ -362,7 +369,7 @@ class FeatureShowcase_Plugin_Admin {
362
  'icon' => 'dashicons-welcome-widgets-menus',
363
  'text' => esc_html__( 'Reduce server load and decrease response time by using the cache available in site visitor\'s web browser.', 'w3-total-cache' ),
364
  'button' => '<button class="button" onclick="window.location=\'' .
365
- esc_url( admin_url( 'admin.php?page=w3tc_general#browser_cache' ) ) . '\'">' .
366
  __( 'Settings', 'w3-total-cache' ) . '</button>',
367
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/configuring-browser-caching-in-w3-total-cache/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=browser_cache' ) .
368
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
@@ -374,7 +381,7 @@ class FeatureShowcase_Plugin_Admin {
374
  'icon' => 'dashicons-editor-kitchensink',
375
  'text' => esc_html__( 'Additional features to extend the functionality of W3 Total Cache, such as Accelerated Mobile Pages (AMP) for Minify and support for New Relic.', 'w3-total-cache' ),
376
  'button' => '<button class="button" onclick="window.location=\'' .
377
- esc_url( admin_url( 'admin.php?page=w3tc_extensions' ) ) . '\'">' .
378
  __( 'Settings', 'w3-total-cache' ) . '</button>',
379
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/extension-framework/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=extensions' ) .
380
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
@@ -386,7 +393,7 @@ class FeatureShowcase_Plugin_Admin {
386
  'icon' => 'dashicons-image-filter',
387
  'text' => esc_html__( 'Manage cache groups for user agents, referrers, and cookies.', 'w3-total-cache' ),
388
  'button' => '<button class="button" onclick="window.location=\'' .
389
- esc_url( admin_url( 'admin.php?page=w3tc_cachegroups' ) ) . '\'">' .
390
  __( 'Settings', 'w3-total-cache' ) . '</button>',
391
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/cache-groups/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=cache_groups' ) .
392
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
137
  * @return int
138
  */
139
  public static function get_unseen_count() {
140
+ $config = Dispatcher::config();
141
+ $force_master_config = $config->get_boolean( 'common.force_master' );
142
+
143
+ if ( is_multisite() && $force_master_config && ! is_super_admin() ) {
144
+ return 0;
145
+ }
146
+
147
  global $current_user;
148
 
149
  $unseen_count = 0;
177
  'icon' => 'dashicons-superhero',
178
  'text' => esc_html__( 'The Setup Guide wizard quickly walks you through configuring W3 Total Cache.', 'w3-total-cache' ),
179
  'button' => '<button class="button" onclick="window.location=\'' .
180
+ esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_setup_guide' ) ) . '\'">' .
181
  __( 'Launch', 'w3-total-cache' ) . '</button>',
182
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/setup-guide-wizard/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=setup_guide' ) .
183
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
189
  'icon' => 'dashicons-admin-site',
190
  'text' => esc_html__( 'Defer loading offscreen Google Maps, making pages load faster.', 'w3-total-cache' ),
191
  'button' => '<button class="button" onclick="window.location=\'' .
192
+ esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_userexperience' ) ) . '\'">' .
193
  __( 'Settings', 'w3-total-cache' ) . '</button>',
194
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/lazy-load-google-maps/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=pro_lazyload_googlemaps' ) .
195
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
201
  'icon' => 'dashicons-networking',
202
  'text' => esc_html__( 'Provide the best user experience possible by enhancing by hosting HTML pages and RSS feeds with (supported) CDN\'s high speed global networks.', 'w3-total-cache' ),
203
  'button' => '<button class="button" onclick="window.location=\'' .
204
+ esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_general#cdn' ) ) . '\'">' .
205
  __( 'Settings', 'w3-total-cache' ) . '</button>',
206
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/cdn-full-site-delivery/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=pro_cdn_fsd' ) .
207
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
213
  'icon' => 'dashicons-table-row-delete',
214
  'text' => esc_html__( 'Render blocking CSS delays a webpage from being visible in a timely manner. Eliminate this easily with the click of a button in W3 Total Cache Pro.', 'w3-total-cache' ),
215
  'button' => '<button class="button" onclick="window.location=\'' .
216
+ esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_minify#css' ) ) . '\'">' .
217
  __( 'Settings', 'w3-total-cache' ) . '</button>',
218
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/how-to-use-manual-minify-for-css-and-js/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=pro_minify_CSS' ) .
219
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
225
  'icon' => 'dashicons-insert',
226
  'text' => esc_html__( 'Improve the performance of your Genesis, WPML powered site, and much more. StudioPress\' Genesis Framework is up to 60% faster with W3TC Pro.', 'w3-total-cache' ),
227
  'button' => '<button class="button" onclick="window.location=\'' .
228
+ esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_extensions' ) ) . '\'">' .
229
  __( 'Settings', 'w3-total-cache' ) . '</button>',
230
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/extension-framework-pro/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=pro_extensions' ) .
231
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
237
  'icon' => 'dashicons-chart-pie',
238
  'text' => esc_html__( 'Unlocking the fragment caching module delivers enhanced performance for plugins and themes that use the WordPress Transient API.', 'w3-total-cache' ),
239
  'button' => '<button class="button" onclick="window.location=\'' .
240
+ esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_general#fragmentcache' ) ) . '\'">' .
241
  __( 'Settings', 'w3-total-cache' ) . '</button>',
242
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/choosing-a-fragment-caching-method-for-w3-total-cache/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=pro_fragment_cache' ) .
243
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
249
  'icon' => 'dashicons-embed-generic',
250
  'text' => esc_html__( 'Save server resources or add scale and performance by caching the WordPress Rest API with W3TC Pro.', 'w3-total-cache' ),
251
  'button' => '<button class="button" onclick="window.location=\'' .
252
+ esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_pgcache#rest' ) ) . '\'">' .
253
  __( 'Settings', 'w3-total-cache' ) . '</button>',
254
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/achieve-ultimate-wordpress-performance-with-w3-total-cache-pro/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=pro_rest_api_caching' ) .
255
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
261
  'icon' => 'dashicons-chart-line',
262
  'text' => esc_html__( 'Analytics for your WordPress and Server cache that allow you to track the size, time and hit/miss ratio of each type of cache, giving you the information needed to gain maximum performance.', 'w3-total-cache' ),
263
  'button' => '<button class="button" onclick="window.location=\'' .
264
+ esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_stats' ) ) . '\'">' .
265
  __( 'Settings', 'w3-total-cache' ) . '</button>',
266
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/configuring-w3-total-cache-statistics-to-give-detailed-information-about-your-cache/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=pro_stats' ) .
267
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
273
  'icon' => 'dashicons-search',
274
  'text' => esc_html__( 'Purge Logs provide information on when your cache has been purged and what triggered it. If you are troubleshooting an issue with your cache being cleared, Purge Logs can tell you why.', 'w3-total-cache' ),
275
  'button' => '<button class="button" onclick="window.location=\'' .
276
+ esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_general#debug' ) ) . '\'">' .
277
  __( 'Settings', 'w3-total-cache' ) . '</button>',
278
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/purge-cache-log/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=pro_purge_logs' ) .
279
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
285
  'icon' => 'dashicons-format-aside',
286
  'text' => esc_html__( 'Page caching decreases the website response time, making pages load faster.', 'w3-total-cache' ),
287
  'button' => '<button class="button" onclick="window.location=\'' .
288
+ esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_general#page_cache' ) ) . '\'">' .
289
  __( 'Settings', 'w3-total-cache' ) . '</button>',
290
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/configuring-page-caching-in-w3-total-cache-for-shared-hosting/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=page_cache' ) .
291
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
297
  'icon' => 'dashicons-media-text',
298
  'text' => esc_html__( 'Reduce load time by decreasing the size and number of CSS and JS files.', 'w3-total-cache' ),
299
  'button' => '<button class="button" onclick="window.location=\'' .
300
+ esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_general#minify' ) ) . '\'">' .
301
  __( 'Settings', 'w3-total-cache' ) . '</button>',
302
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/choosing-a-minification-method-for-w3-total-cache/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=minify' ) .
303
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
309
  'icon' => 'dashicons-format-image',
310
  'text' => esc_html__( 'Defer loading offscreen images, making pages load faster.', 'w3-total-cache' ),
311
  'button' => '<button class="button" onclick="window.location=\'' .
312
+ esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_general#userexperience' ) ) . '\'">' .
313
  __( 'Settings', 'w3-total-cache' ) . '</button>',
314
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/configuring-lazy-loading-for-your-wordpress-website-with-w3-total-cache/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=lazyload' ) .
315
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
321
  'icon' => 'dashicons-format-gallery',
322
  'text' => esc_html__( 'Host static files with a CDN to reduce page load time.', 'w3-total-cache' ),
323
  'button' => '<button class="button" onclick="window.location=\'' .
324
+ esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_general#cdn' ) ) . '\'">' .
325
  __( 'Settings', 'w3-total-cache' ) . '</button>',
326
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/configuring-w3-total-cache-with-stackpath-for-cdn-objects/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=cdn' ) .
327
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
333
  'icon' => 'dashicons-performance',
334
  'text' => esc_html__( 'Improves PHP performance by storing precompiled script bytecode in shared memory.', 'w3-total-cache' ),
335
  'button' => '<button class="button" onclick="window.location=\'' .
336
+ esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_general#system_opcache' ) ) . '\'">' .
337
  __( 'Settings', 'w3-total-cache' ) . '</button>',
338
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/choosing-an-opcode-caching-method-with-w3-total-cache/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=opcode_cache' ) .
339
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
345
  'icon' => 'dashicons-database-view',
346
  'text' => esc_html__( 'Persistently store data to reduce post, page and feed creation time.', 'w3-total-cache' ),
347
  'button' => '<button class="button" onclick="window.location=\'' .
348
+ esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_general#database_cache' ) ) . '\'">' .
349
  __( 'Settings', 'w3-total-cache' ) . '</button>',
350
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/choosing-a-database-caching-method-in-w3-total-cache/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=database_cache' ) .
351
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
357
  'icon' => 'dashicons-archive',
358
  'text' => esc_html__( 'Persistently store objects to reduce execution time for common operations.', 'w3-total-cache' ),
359
  'button' => '<button class="button" onclick="window.location=\'' .
360
+ esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_general#object_cache' ) ) . '\'">' .
361
  __( 'Settings', 'w3-total-cache' ) . '</button>',
362
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/configuring-object-caching-methods-in-w3-total-cache/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=object_cache' ) .
363
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
369
  'icon' => 'dashicons-welcome-widgets-menus',
370
  'text' => esc_html__( 'Reduce server load and decrease response time by using the cache available in site visitor\'s web browser.', 'w3-total-cache' ),
371
  'button' => '<button class="button" onclick="window.location=\'' .
372
+ esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_general#browser_cache' ) ) . '\'">' .
373
  __( 'Settings', 'w3-total-cache' ) . '</button>',
374
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/configuring-browser-caching-in-w3-total-cache/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=browser_cache' ) .
375
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
381
  'icon' => 'dashicons-editor-kitchensink',
382
  'text' => esc_html__( 'Additional features to extend the functionality of W3 Total Cache, such as Accelerated Mobile Pages (AMP) for Minify and support for New Relic.', 'w3-total-cache' ),
383
  'button' => '<button class="button" onclick="window.location=\'' .
384
+ esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_extensions' ) ) . '\'">' .
385
  __( 'Settings', 'w3-total-cache' ) . '</button>',
386
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/extension-framework/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=extensions' ) .
387
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
393
  'icon' => 'dashicons-image-filter',
394
  'text' => esc_html__( 'Manage cache groups for user agents, referrers, and cookies.', 'w3-total-cache' ),
395
  'button' => '<button class="button" onclick="window.location=\'' .
396
+ esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_cachegroups' ) ) . '\'">' .
397
  __( 'Settings', 'w3-total-cache' ) . '</button>',
398
  'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/cache-groups/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=cache_groups' ) .
399
  '">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
Generic_Plugin_Admin.php CHANGED
@@ -268,16 +268,12 @@ class Generic_Plugin_Admin {
268
  function admin_head() {
269
  $page = isset( $_GET['page'] ) ? $_GET['page'] : null;
270
 
271
- if ( false !== strpos( $page, 'w3tc' ) && 'w3tc_setup_guide' !== $page && ! get_site_option( 'w3tc_setupguide_completed' ) ) {
272
  $config = new Config();
273
  $state_master = Dispatcher::config_state_master();
274
 
275
  if ( ! $config->get_boolean( 'pgcache.enabled' ) && $state_master->get_integer( 'common.install' ) > strtotime( 'NOW - 1 WEEK' ) ) {
276
- if ( is_multisite() ) {
277
- wp_redirect( esc_url( network_admin_url( 'admin.php?page=w3tc_setup_guide' ) ) );
278
- } else {
279
- wp_redirect( esc_url( admin_url( 'admin.php?page=w3tc_setup_guide' ) ) );
280
- }
281
  }
282
  }
283
 
268
  function admin_head() {
269
  $page = isset( $_GET['page'] ) ? $_GET['page'] : null;
270
 
271
+ if ( ( ! is_multisite() || is_super_admin() ) && false !== strpos( $page, 'w3tc' ) && 'w3tc_setup_guide' !== $page && ! get_site_option( 'w3tc_setupguide_completed' ) ) {
272
  $config = new Config();
273
  $state_master = Dispatcher::config_state_master();
274
 
275
  if ( ! $config->get_boolean( 'pgcache.enabled' ) && $state_master->get_integer( 'common.install' ) > strtotime( 'NOW - 1 WEEK' ) ) {
276
+ wp_redirect( esc_url( network_admin_url( 'admin.php?page=w3tc_setup_guide' ) ) );
 
 
 
 
277
  }
278
  }
279
 
Minify_ContentMinifier.php CHANGED
@@ -158,9 +158,10 @@ class Minify_ContentMinifier {
158
  );
159
 
160
  $symlinks = $this->_config->get_array( 'minify.symlinks' );
 
161
 
162
  foreach ( $symlinks as $link => $target ) {
163
- $link = str_replace( '//', realpath( $_SERVER['DOCUMENT_ROOT'] ), $link );
164
  $link = strtr( $link, '/', DIRECTORY_SEPARATOR );
165
  $options['symlinks'][$link] = realpath( $target );
166
  }
158
  );
159
 
160
  $symlinks = $this->_config->get_array( 'minify.symlinks' );
161
+ $docroot = Util_Environment::document_root();
162
 
163
  foreach ( $symlinks as $link => $target ) {
164
+ $link = str_replace( '//', realpath( $docroot ), $link );
165
  $link = strtr( $link, '/', DIRECTORY_SEPARATOR );
166
  $options['symlinks'][$link] = realpath( $target );
167
  }
Minify_MinifiedFileRequestHandler.php CHANGED
@@ -532,7 +532,7 @@ class Minify_MinifiedFileRequestHandler {
532
  } else {
533
  $path = Util_Environment::docroot_to_full_filename( $docroot_filename );
534
 
535
- if ( file_exists( $path ) ) {
536
  $result[] = $file;
537
  } else {
538
  Minify_Core::debug_error( sprintf( 'File "%s" doesn\'t exist', $file ) );
532
  } else {
533
  $path = Util_Environment::docroot_to_full_filename( $docroot_filename );
534
 
535
+ if ( @file_exists( $path ) ) {
536
  $result[] = $file;
537
  } else {
538
  Minify_Core::debug_error( sprintf( 'File "%s" doesn\'t exist', $file ) );
SetupGuide_Plugin_Admin.php CHANGED
@@ -40,7 +40,7 @@ class SetupGuide_Plugin_Admin {
40
  public function __construct() {
41
  $page = Util_Request::get_string( 'page' );
42
  $is_w3tc_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX &&
43
- isset( $_POST['action'] ) && 0 === strpos( $_POST['action'], 'w3tc_' );
44
 
45
  if ( 'w3tc_setup_guide' === $page || $is_w3tc_ajax ) {
46
  require_once W3TC_INC_DIR . '/wizard/template.php';
@@ -884,6 +884,7 @@ class SetupGuide_Plugin_Admin {
884
  $browsercache_enabled = $config->get_boolean( 'browsercache.enabled' );
885
  $page = Util_Request::get_string( 'page' );
886
  $state = Dispatcher::config_state();
 
887
 
888
  if ( 'w3tc_extensions' === $page ) {
889
  $page = 'extensions/' . Util_Request::get_string( 'extension' );
@@ -934,7 +935,7 @@ class SetupGuide_Plugin_Admin {
934
  'disk_enhanced' => __( 'Disk: Enhanced', 'w3-total-cache' ),
935
  'enabled' => __( 'Enabled', 'w3-total-cache' ),
936
  'notEnabled' => __( 'Not Enabled', 'w3-total-cache' ),
937
- 'dashboardUrl' => esc_url( admin_url( 'admin.php?page=w3tc_dashboard' ) ),
938
  ),
939
  ),
940
  ),
@@ -1386,7 +1387,10 @@ class SetupGuide_Plugin_Admin {
1386
  'Please visit %1$sGeneral Settings%2$s to learn more about these features.',
1387
  'w3-total-cache'
1388
  ),
1389
- '<a href="' . esc_url( admin_url( 'admin.php?page=w3tc_general' ) ) . '">',
 
 
 
1390
  '</a>'
1391
  ) . '</p>
1392
  <h3>' . esc_html__( 'Need help?', 'w3-total-cache' ) . '</h3>
40
  public function __construct() {
41
  $page = Util_Request::get_string( 'page' );
42
  $is_w3tc_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX &&
43
+ isset( $_POST['action'] ) && 0 === strpos( $_POST['action'], 'w3tc_' ); // phpcs:ignore
44
 
45
  if ( 'w3tc_setup_guide' === $page || $is_w3tc_ajax ) {
46
  require_once W3TC_INC_DIR . '/wizard/template.php';
884
  $browsercache_enabled = $config->get_boolean( 'browsercache.enabled' );
885
  $page = Util_Request::get_string( 'page' );
886
  $state = Dispatcher::config_state();
887
+ $force_master_config = $config->get_boolean( 'common.force_master' );
888
 
889
  if ( 'w3tc_extensions' === $page ) {
890
  $page = 'extensions/' . Util_Request::get_string( 'extension' );
935
  'disk_enhanced' => __( 'Disk: Enhanced', 'w3-total-cache' ),
936
  'enabled' => __( 'Enabled', 'w3-total-cache' ),
937
  'notEnabled' => __( 'Not Enabled', 'w3-total-cache' ),
938
+ 'dashboardUrl' => esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_dashboard' ) ),
939
  ),
940
  ),
941
  ),
1387
  'Please visit %1$sGeneral Settings%2$s to learn more about these features.',
1388
  'w3-total-cache'
1389
  ),
1390
+ '<a href="' . esc_url(
1391
+ $force_master_config || is_network_admin() ?
1392
+ network_admin_url( 'admin.php?page=w3tc_general' ) : admin_url( 'admin.php?page=w3tc_general' )
1393
+ ) . '">',
1394
  '</a>'
1395
  ) . '</p>
1396
  <h3>' . esc_html__( 'Need help?', 'w3-total-cache' ) . '</h3>
Util_Environment.php CHANGED
@@ -549,6 +549,14 @@ class Util_Environment {
549
  if ( !is_null( $document_root ) )
550
  return $document_root;
551
 
 
 
 
 
 
 
 
 
552
  if ( !empty( $_SERVER['SCRIPT_FILENAME'] ) &&
553
  !empty( $_SERVER['PHP_SELF'] ) ) {
554
  $script_filename = Util_Environment::normalize_path(
549
  if ( !is_null( $document_root ) )
550
  return $document_root;
551
 
552
+ $c = Dispatcher::config();
553
+ $docroot_fix = $c->get_boolean( 'docroot_fix.enable' );
554
+
555
+ if ( $docroot_fix ) {
556
+ $document_root = untrailingslashit( ABSPATH );
557
+ return $document_root;
558
+ }
559
+
560
  if ( !empty( $_SERVER['SCRIPT_FILENAME'] ) &&
561
  !empty( $_SERVER['PHP_SELF'] ) ) {
562
  $script_filename = Util_Environment::normalize_path(
Util_PageUrls.php CHANGED
@@ -511,7 +511,7 @@ class Util_PageUrls {
511
  }
512
 
513
  $result = $base . $request . $query_string;
514
- $result = apply_filters( 'get_pagenum_link', $result );
515
  return $result;
516
  }
517
 
511
  }
512
 
513
  $result = $base . $request . $query_string;
514
+ $result = apply_filters( 'get_pagenum_link', $result, $pagenum );
515
  return $result;
516
  }
517
 
Util_Ui.php CHANGED
@@ -1044,16 +1044,13 @@ class Util_Ui {
1044
  }
1045
 
1046
  /**
 
1047
  *
1048
- *
1049
- * @param string $path
1050
- * @return string|void
1051
  */
1052
- static public function admin_url( $path ) {
1053
- if ( is_network_admin() ) {
1054
- return network_admin_url( $path );
1055
- }
1056
- return admin_url( $path );
1057
  }
1058
 
1059
  /**
1044
  }
1045
 
1046
  /**
1047
+ * Get the admin URL based on the path and the interface (network or site).
1048
  *
1049
+ * @param string $path Admin path/URI.
1050
+ * @return string
 
1051
  */
1052
+ public static function admin_url( $path ) {
1053
+ return is_network_admin() ? network_admin_url( $path ) : admin_url( $path );
 
 
 
1054
  }
1055
 
1056
  /**
inc/mime/all.php CHANGED
@@ -36,6 +36,8 @@ return array(
36
  'atx' => 'application/vnd.antix.game-component',
37
  'au|snd' => 'audio/basic',
38
  'avi' => 'video/x-msvideo',
 
 
39
  'aw' => 'application/applixware',
40
  'azf' => 'application/vnd.airzip.filesecure.azf',
41
  'azs' => 'application/vnd.airzip.filesecure.azs',
36
  'atx' => 'application/vnd.antix.game-component',
37
  'au|snd' => 'audio/basic',
38
  'avi' => 'video/x-msvideo',
39
+ 'avif' => 'image/avif',
40
+ 'avifs' => 'image/avif-sequence',
41
  'aw' => 'application/applixware',
42
  'azf' => 'application/vnd.airzip.filesecure.azf',
43
  'azs' => 'application/vnd.airzip.filesecure.azs',
inc/mime/other.php CHANGED
@@ -6,6 +6,8 @@
6
  return array(
7
  'asf|asx|wax|wmv|wmx' => 'video/asf',
8
  'avi' => 'video/avi',
 
 
9
  'bmp' => 'image/bmp',
10
  'class' => 'application/java',
11
  'divx' => 'video/divx',
6
  return array(
7
  'asf|asx|wax|wmv|wmx' => 'video/asf',
8
  'avi' => 'video/avi',
9
+ 'avif' => 'image/avif',
10
+ 'avifs' => 'image/avif-sequence',
11
  'bmp' => 'image/bmp',
12
  'class' => 'application/java',
13
  'divx' => 'video/divx',
inc/options/browsercache.php CHANGED
File without changes
inc/options/general.php CHANGED
@@ -508,6 +508,22 @@ Util_Ui::config_item( array(
508
  </th>
509
  </tr>
510
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
511
  Util_Ui::config_item( array(
512
  'key' => 'common.track_usage',
513
  'control' => 'checkbox',
508
  </th>
509
  </tr>
510
  <?php
511
+
512
+ Util_Ui::config_item(
513
+ array(
514
+ 'key' => 'docroot_fix.enable',
515
+ 'control' => 'checkbox',
516
+ 'checkbox_label' => __( 'Fix document root path', 'w3-total-cache' ),
517
+ 'label_class' => 'w3tc_single_column',
518
+ 'description' => sprintf(
519
+ // translators: 1: WordPress ABSPATH value, 2: Server document root value.
520
+ __( 'Fix incorrect server document root path. Uses the WordPress ABSPATH ("%1$s") in place of the current server document root ("%2$s").', 'w3-total-cache' ),
521
+ esc_html( untrailingslashit( ABSPATH ) ),
522
+ esc_html( $_SERVER['DOCUMENT_ROOT'] )
523
+ ),
524
+ )
525
+ );
526
+
527
  Util_Ui::config_item( array(
528
  'key' => 'common.track_usage',
529
  'control' => 'checkbox',
inc/options/minify.php CHANGED
@@ -159,7 +159,7 @@ if ( file_exists( $html_engine_file2 ) ) {
159
  )
160
  )
161
  ) );
162
- endif;
163
  ?>
164
  <tr>
165
  <th><?php _e( 'Minify engine settings:', 'w3-total-cache' ); ?></th>
159
  )
160
  )
161
  ) );
162
+ endif;
163
  ?>
164
  <tr>
165
  <th><?php _e( 'Minify engine settings:', 'w3-total-cache' ); ?></th>
lib/Minify/Minify/Build.php CHANGED
@@ -1,4 +1,10 @@
1
  <?php
 
 
 
 
 
 
2
  namespace W3TCL\Minify;
3
 
4
  /**
@@ -85,13 +91,16 @@ class Minify_Build {
85
  */
86
  public function __construct($sources)
87
  {
 
 
 
88
  $max = 0;
89
  foreach ((array)$sources as $source) {
90
  if ($source instanceof Minify_Source) {
91
  $max = max($max, $source->lastModified);
92
  } elseif (is_string($source)) {
93
  if (0 === strpos($source, '//')) {
94
- $source = $_SERVER['DOCUMENT_ROOT'] . substr($source, 1);
95
  }
96
  if (is_file($source)) {
97
  $max = max($max, filemtime($source));
1
  <?php
2
+ /**
3
+ * File: Build.php
4
+ *
5
+ * NOTE: Fixes have been included in this file; look for "W3TC FIX".
6
+ */
7
+
8
  namespace W3TCL\Minify;
9
 
10
  /**
91
  */
92
  public function __construct($sources)
93
  {
94
+ // W3TC FIX: Override $_SERVER['DOCUMENT_ROOT'] if enabled in settings.
95
+ $docroot = \W3TC\Util_Environment::document_root();
96
+
97
  $max = 0;
98
  foreach ((array)$sources as $source) {
99
  if ($source instanceof Minify_Source) {
100
  $max = max($max, $source->lastModified);
101
  } elseif (is_string($source)) {
102
  if (0 === strpos($source, '//')) {
103
+ $source = $docroot . substr($source, 1);
104
  }
105
  if (is_file($source)) {
106
  $max = max($max, filemtime($source));
lib/Minify/Minify/CSS.php CHANGED
@@ -1,5 +1,11 @@
1
  <?php
2
- namespace W3TCL\Minify;
 
 
 
 
 
 
3
  /**
4
  * Class Minify_CSS
5
  * @package Minify
@@ -56,12 +62,15 @@ class Minify_CSS {
56
  */
57
  public static function minify($css, $options = array())
58
  {
 
 
 
59
  $options = array_merge(array(
60
  'compress' => true,
61
  'removeCharsets' => true,
62
  'preserveComments' => true,
63
  'currentDir' => null,
64
- 'docRoot' => $_SERVER['DOCUMENT_ROOT'],
65
  'prependRelativePath' => null,
66
  'symlinks' => array(),
67
  ), $options);
1
  <?php
2
+ /**
3
+ * File: CSS.php
4
+ *
5
+ * NOTE: Fixes have been included in this file; look for "W3TC FIX".
6
+ */
7
+
8
+ namespace W3TCL\Minify;
9
  /**
10
  * Class Minify_CSS
11
  * @package Minify
62
  */
63
  public static function minify($css, $options = array())
64
  {
65
+ // W3TC FIX: Override $_SERVER['DOCUMENT_ROOT'] if enabled in settings.
66
+ $docroot = \W3TC\Util_Environment::document_root();
67
+
68
  $options = array_merge(array(
69
  'compress' => true,
70
  'removeCharsets' => true,
71
  'preserveComments' => true,
72
  'currentDir' => null,
73
+ 'docRoot' => $docroot,
74
  'prependRelativePath' => null,
75
  'symlinks' => array(),
76
  ), $options);
lib/Minify/Minify/CSS/UriRewriter.php CHANGED
@@ -1,5 +1,11 @@
1
  <?php
2
- namespace W3TCL\Minify;
 
 
 
 
 
 
3
  /**
4
  * Class Minify_CSS_UriRewriter
5
  * @package Minify
@@ -54,8 +60,11 @@ class Minify_CSS_UriRewriter {
54
  (isset($options['browserCacheExtensions']) ?
55
  $options['browserCacheExtensions'] : array());
56
 
 
 
 
57
  if (isset($options['currentDir'])) {
58
- $document_root = (isset($options['docRoot']) ? $options['docRoot'] : $_SERVER['DOCUMENT_ROOT']);
59
  $symlinks = (isset($options['symlinks']) ? $options['symlinks'] : array());
60
  $prependAbsolutePath = (isset($options['prependAbsolutePath']) ? $options['prependAbsolutePath'] : '');
61
  $prependAbsolutePathCallback = (isset($options['prependAbsolutePathCallback']) ? $options['prependAbsolutePathCallback'] : '');
@@ -111,8 +120,11 @@ class Minify_CSS_UriRewriter {
111
  private static function _rewrite($css, $currentDir,
112
  $prependAbsolutePath = null, $prependAbsolutePathCallback = null,
113
  $docRoot = null, $symlinks = array()) {
 
 
 
114
  self::$_docRoot = self::_realpath(
115
- $docRoot ? $docRoot : $_SERVER['DOCUMENT_ROOT']
116
  );
117
  self::$_currentDir = self::_realpath($currentDir);
118
  self::$_prependAbsolutePath = $prependAbsolutePath;
1
  <?php
2
+ /**
3
+ * File: UriRewriter.php
4
+ *
5
+ * NOTE: Fixes have been included in this file; look for "W3TC FIX".
6
+ */
7
+
8
+ namespace W3TCL\Minify;
9
  /**
10
  * Class Minify_CSS_UriRewriter
11
  * @package Minify
60
  (isset($options['browserCacheExtensions']) ?
61
  $options['browserCacheExtensions'] : array());
62
 
63
+ // W3TC FIX: Override $_SERVER['DOCUMENT_ROOT'] if enabled in settings.
64
+ $docroot = \W3TC\Util_Environment::document_root();
65
+
66
  if (isset($options['currentDir'])) {
67
+ $document_root = (isset($options['docRoot']) ? $options['docRoot'] : $docroot);
68
  $symlinks = (isset($options['symlinks']) ? $options['symlinks'] : array());
69
  $prependAbsolutePath = (isset($options['prependAbsolutePath']) ? $options['prependAbsolutePath'] : '');
70
  $prependAbsolutePathCallback = (isset($options['prependAbsolutePathCallback']) ? $options['prependAbsolutePathCallback'] : '');
120
  private static function _rewrite($css, $currentDir,
121
  $prependAbsolutePath = null, $prependAbsolutePathCallback = null,
122
  $docRoot = null, $symlinks = array()) {
123
+ // W3TC FIX: Override $_SERVER['DOCUMENT_ROOT'] if enabled in settings.
124
+ $docroot = \W3TC\Util_Environment::document_root();
125
+
126
  self::$_docRoot = self::_realpath(
127
+ $docRoot ? $docRoot : $docroot
128
  );
129
  self::$_currentDir = self::_realpath($currentDir);
130
  self::$_prependAbsolutePath = $prependAbsolutePath;
lib/Minify/Minify/Controller/Files.php CHANGED
@@ -38,6 +38,9 @@ class Minify_Controller_Files extends Minify_Controller_Base {
38
  * 'files': (required) array of complete file paths, or a single path
39
  */
40
  public function setupSources($options) {
 
 
 
41
  // strip controller options
42
 
43
  $files = $options['files'];
@@ -59,7 +62,7 @@ class Minify_Controller_Files extends Minify_Controller_Base {
59
  if ( is_file( ABSPATH . substr($file, 1) ) ) {
60
  $file = ABSPATH . substr( $file, 1 );
61
  } else {
62
- $file = $_SERVER['DOCUMENT_ROOT'] . substr( $file, 1 );
63
  }
64
  }
65
  $realPath = realpath($file);
38
  * 'files': (required) array of complete file paths, or a single path
39
  */
40
  public function setupSources($options) {
41
+ // W3TC FIX: Override $_SERVER['DOCUMENT_ROOT'] if enabled in settings.
42
+ $docroot = \W3TC\Util_Environment::document_root();
43
+
44
  // strip controller options
45
 
46
  $files = $options['files'];
62
  if ( is_file( ABSPATH . substr($file, 1) ) ) {
63
  $file = ABSPATH . substr( $file, 1 );
64
  } else {
65
+ $file = $docroot . substr( $file, 1 );
66
  }
67
  }
68
  $realPath = realpath($file);
lib/Minify/Minify/Controller/Groups.php CHANGED
@@ -1,4 +1,10 @@
1
  <?php
 
 
 
 
 
 
2
  namespace W3TCL\Minify;
3
  /**
4
  * Class Minify_Controller_Groups
@@ -65,13 +71,17 @@ class Minify_Controller_Groups extends Minify_Controller_Base {
65
  } elseif (! is_array($files)) {
66
  $files = (array)$files;
67
  }
 
 
 
 
68
  foreach ($files as $file) {
69
  if ($file instanceof Minify_Source) {
70
  $sources[] = $file;
71
  continue;
72
  }
73
  if (0 === strpos($file, '//')) {
74
- $file = $_SERVER['DOCUMENT_ROOT'] . substr($file, 1);
75
  }
76
  $realPath = realpath($file);
77
  if (is_file($realPath)) {
1
  <?php
2
+ /**
3
+ * File: Groups.php
4
+ *
5
+ * NOTE: Fixes have been included in this file; look for "W3TC FIX".
6
+ */
7
+
8
  namespace W3TCL\Minify;
9
  /**
10
  * Class Minify_Controller_Groups
71
  } elseif (! is_array($files)) {
72
  $files = (array)$files;
73
  }
74
+
75
+ // W3TC FIX: Override $_SERVER['DOCUMENT_ROOT'] if enabled in settings.
76
+ $docroot = \W3TC\Util_Environment::document_root();
77
+
78
  foreach ($files as $file) {
79
  if ($file instanceof Minify_Source) {
80
  $sources[] = $file;
81
  continue;
82
  }
83
  if (0 === strpos($file, '//')) {
84
+ $file = $docroot . substr($file, 1);
85
  }
86
  $realPath = realpath($file);
87
  if (is_file($realPath)) {
lib/Minify/Minify/Controller/MinApp.php CHANGED
@@ -3,6 +3,8 @@ namespace W3TCL\Minify;
3
  /**
4
  * Class Minify_Controller_MinApp
5
  * @package Minify
 
 
6
  */
7
 
8
  /**
@@ -21,6 +23,9 @@ class Minify_Controller_MinApp extends Minify_Controller_Base {
21
  * @return array Minify options
22
  */
23
  public function setupSources($options) {
 
 
 
24
  // PHP insecure by default: realpath() and other FS functions can't handle null bytes.
25
  foreach (array('g', 'b', 'f') as $key) {
26
  if (isset($_GET[$key])) {
@@ -69,7 +74,10 @@ class Minify_Controller_MinApp extends Minify_Controller_Base {
69
  continue;
70
  }
71
  if (0 === strpos($file, '//')) {
72
- $file = $_SERVER['DOCUMENT_ROOT'] . substr($file, 1);
 
 
 
73
  }
74
  $realpath = \W3TC\Util_Environment::realpath($file);
75
  if ($realpath && is_file($realpath)) {
@@ -118,7 +126,10 @@ class Minify_Controller_MinApp extends Minify_Controller_Base {
118
  }
119
  $allowDirs = array();
120
  foreach ((array)$cOptions['allowDirs'] as $allowDir) {
121
- $allowDirs[] = \W3TC\Util_Environment::realpath(str_replace('//', $_SERVER['DOCUMENT_ROOT'] . '/', $allowDir));
 
 
 
122
  }
123
  $basenames = array(); // just for cache id
124
  foreach ($files as $file) {
@@ -128,7 +139,12 @@ class Minify_Controller_MinApp extends Minify_Controller_Base {
128
  }
129
 
130
  $uri = $base . $file;
131
- $path = $_SERVER['DOCUMENT_ROOT'] . $uri;
 
 
 
 
 
132
  $realpath = \W3TC\Util_Environment::realpath($path);
133
  if (false === $realpath || ! is_file($realpath)) {
134
  $this->log("The path \"{$path}\" (realpath \"{$realpath}\") could not be found (or was not a file)");
3
  /**
4
  * Class Minify_Controller_MinApp
5
  * @package Minify
6
+ *
7
+ * NOTE: Fixes have been included in this file; look for "W3TC FIX".
8
  */
9
 
10
  /**
23
  * @return array Minify options
24
  */
25
  public function setupSources($options) {
26
+ // W3TC FIX: Override $_SERVER['DOCUMENT_ROOT'] if enabled in settings.
27
+ $docroot = \W3TC\Util_Environment::document_root();
28
+
29
  // PHP insecure by default: realpath() and other FS functions can't handle null bytes.
30
  foreach (array('g', 'b', 'f') as $key) {
31
  if (isset($_GET[$key])) {
74
  continue;
75
  }
76
  if (0 === strpos($file, '//')) {
77
+ //$file = $_SERVER['DOCUMENT_ROOT'] . substr($file, 1);
78
+
79
+ // W3TC FIX.
80
+ $file = $docroot . substr($file, 1);
81
  }
82
  $realpath = \W3TC\Util_Environment::realpath($file);
83
  if ($realpath && is_file($realpath)) {
126
  }
127
  $allowDirs = array();
128
  foreach ((array)$cOptions['allowDirs'] as $allowDir) {
129
+ //$allowDirs[] = \W3TC\Util_Environment::realpath(str_replace('//', $_SERVER['DOCUMENT_ROOT'] . '/', $allowDir));
130
+
131
+ // W3TC FIX.
132
+ $allowDirs[] = \W3TC\Util_Environment::realpath(str_replace('//', $docroot . '/', $allowDir));
133
  }
134
  $basenames = array(); // just for cache id
135
  foreach ($files as $file) {
139
  }
140
 
141
  $uri = $base . $file;
142
+
143
+ //$path = $_SERVER['DOCUMENT_ROOT'] . $uri;
144
+
145
+ // W3TC FIX.
146
+ $path = $docroot . $uri;
147
+
148
  $realpath = \W3TC\Util_Environment::realpath($path);
149
  if (false === $realpath || ! is_file($realpath)) {
150
  $this->log("The path \"{$path}\" (realpath \"{$realpath}\") could not be found (or was not a file)");
lib/Minify/Minify/Controller/Version1.php CHANGED
@@ -1,4 +1,9 @@
1
  <?php
 
 
 
 
 
2
  namespace W3TCL\Minify;
3
  /**
4
  * Class Minify_Controller_Version1
@@ -61,10 +66,13 @@ class Minify_Controller_Version1 extends Minify_Controller_Base {
61
  return $options;
62
  }
63
 
 
 
 
64
  // strings for prepending to relative/absolute paths
65
  $prependRelPaths = dirname($_SERVER['SCRIPT_FILENAME'])
66
  . DIRECTORY_SEPARATOR;
67
- $prependAbsPaths = $_SERVER['DOCUMENT_ROOT'];
68
 
69
  $goodFiles = array();
70
  $hasBadSource = false;
@@ -103,8 +111,11 @@ class Minify_Controller_Version1 extends Minify_Controller_Base {
103
 
104
  private static function _setupDefines()
105
  {
 
 
 
106
  $defaults = array(
107
- 'MINIFY_BASE_DIR' => realpath($_SERVER['DOCUMENT_ROOT'])
108
  ,'MINIFY_ENCODING' => 'utf-8'
109
  ,'MINIFY_MAX_FILES' => 16
110
  ,'MINIFY_REWRITE_CSS_URLS' => true
1
  <?php
2
+ /**
3
+ * File: Version1.php
4
+ *
5
+ * NOTE: Fixes have been included in this file; look for "W3TC FIX".
6
+ */
7
  namespace W3TCL\Minify;
8
  /**
9
  * Class Minify_Controller_Version1
66
  return $options;
67
  }
68
 
69
+ // W3TC FIX: Override $_SERVER['DOCUMENT_ROOT'] if enabled in settings.
70
+ $docroot = \W3TC\Util_Environment::document_root();
71
+
72
  // strings for prepending to relative/absolute paths
73
  $prependRelPaths = dirname($_SERVER['SCRIPT_FILENAME'])
74
  . DIRECTORY_SEPARATOR;
75
+ $prependAbsPaths = $docroot;
76
 
77
  $goodFiles = array();
78
  $hasBadSource = false;
111
 
112
  private static function _setupDefines()
113
  {
114
+ // W3TC FIX: Override $_SERVER['DOCUMENT_ROOT'] if enabled in settings.
115
+ $docroot = \W3TC\Util_Environment::document_root();
116
+
117
  $defaults = array(
118
+ 'MINIFY_BASE_DIR' => realpath($docroot)
119
  ,'MINIFY_ENCODING' => 'utf-8'
120
  ,'MINIFY_MAX_FILES' => 16
121
  ,'MINIFY_REWRITE_CSS_URLS' => true
lib/Minify/Minify/HTML.php CHANGED
@@ -142,7 +142,7 @@ class Minify_HTML {
142
  // remove ws around block/undisplayed elements
143
  $this->_html = preg_replace('/\\s+(<\\/?(?:area|article|aside|base(?:font)?|blockquote|body'
144
  .'|canvas|caption|center|col(?:group)?|dd|dir|div|dl|dt|fieldset|figcaption|figure|footer|form'
145
- .'|frame(?:set)?|h[1-6]|head|header|hgroup|hr|html|legend|li|link|main|map|menu|meta|nav'
146
  .'|ol|opt(?:group|ion)|output|p|param|section|t(?:able|body|head|d|h||r|foot|itle)'
147
  .'|ul|video)\\b[^>]*>)/i', '$1', $this->_html);
148
 
142
  // remove ws around block/undisplayed elements
143
  $this->_html = preg_replace('/\\s+(<\\/?(?:area|article|aside|base(?:font)?|blockquote|body'
144
  .'|canvas|caption|center|col(?:group)?|dd|dir|div|dl|dt|fieldset|figcaption|figure|footer|form'
145
+ .'|frame(?:set)?|h[1-6]|head|header|hgroup|hr|html|legend|link|main|map|menu|meta|nav'
146
  .'|ol|opt(?:group|ion)|output|p|param|section|t(?:able|body|head|d|h||r|foot|itle)'
147
  .'|ul|video)\\b[^>]*>)/i', '$1', $this->_html);
148
 
lib/Minify/Minify/HTML/Helper.php CHANGED
@@ -1,4 +1,10 @@
1
  <?php
 
 
 
 
 
 
2
  namespace W3TCL\Minify;
3
  /**
4
  * Class Minify_HTML_Helper
@@ -87,6 +93,9 @@ class Minify_HTML_Helper {
87
  */
88
  public function setFiles($files, $checkLastModified = true)
89
  {
 
 
 
90
  $this->_groupKey = null;
91
  if ($checkLastModified) {
92
  $this->_lastModified = self::getLastModified($files);
@@ -97,7 +106,7 @@ class Minify_HTML_Helper {
97
  $file = substr($file, 2);
98
  } elseif (0 === strpos($file, '/')
99
  || 1 === strpos($file, ':\\')) {
100
- $file = substr($file, strlen($_SERVER['DOCUMENT_ROOT']) + 1);
101
  }
102
  $file = strtr($file, '\\', '/');
103
  $files[$k] = $file;
@@ -139,13 +148,16 @@ class Minify_HTML_Helper {
139
  */
140
  public static function getLastModified($sources, $lastModified = 0)
141
  {
 
 
 
142
  $max = $lastModified;
143
  foreach ((array)$sources as $source) {
144
  if (is_object($source) && isset($source->lastModified)) {
145
  $max = max($max, $source->lastModified);
146
  } elseif (is_string($source)) {
147
  if (0 === strpos($source, '//')) {
148
- $source = $_SERVER['DOCUMENT_ROOT'] . substr($source, 1);
149
  }
150
  if (is_file($source)) {
151
  $max = max($max, filemtime($source));
1
  <?php
2
+ /**
3
+ * File: Helper.php
4
+ *
5
+ * NOTE: Fixes have been included in this file; look for "W3TC FIX".
6
+ */
7
+
8
  namespace W3TCL\Minify;
9
  /**
10
  * Class Minify_HTML_Helper
93
  */
94
  public function setFiles($files, $checkLastModified = true)
95
  {
96
+ // W3TC FIX: Override $_SERVER['DOCUMENT_ROOT'] if enabled in settings.
97
+ $docroot = \W3TC\Util_Environment::document_root();
98
+
99
  $this->_groupKey = null;
100
  if ($checkLastModified) {
101
  $this->_lastModified = self::getLastModified($files);
106
  $file = substr($file, 2);
107
  } elseif (0 === strpos($file, '/')
108
  || 1 === strpos($file, ':\\')) {
109
+ $file = substr($file, strlen($docroot) + 1);
110
  }
111
  $file = strtr($file, '\\', '/');
112
  $files[$k] = $file;
148
  */
149
  public static function getLastModified($sources, $lastModified = 0)
150
  {
151
+ // W3TC FIX: Override $_SERVER['DOCUMENT_ROOT'] if enabled in settings.
152
+ $docroot = \W3TC\Util_Environment::document_root();
153
+
154
  $max = $lastModified;
155
  foreach ((array)$sources as $source) {
156
  if (is_object($source) && isset($source->lastModified)) {
157
  $max = max($max, $source->lastModified);
158
  } elseif (is_string($source)) {
159
  if (0 === strpos($source, '//')) {
160
+ $source = $docroot . substr($source, 1);
161
  }
162
  if (is_file($source)) {
163
  $max = max($max, filemtime($source));
lib/Minify/Minify/HTMLTidy.php CHANGED
@@ -14,10 +14,11 @@ class Minify_HTMLTidy {
14
  'show-errors' => 0,
15
  'show-warnings' => false,
16
  'force-output' => true,
17
- 'tidy-mark' => false
 
18
  ));
19
 
20
- $tidy = new tidy();
21
  $tidy->parseString($content, $options);
22
  $tidy->cleanRepair();
23
 
14
  'show-errors' => 0,
15
  'show-warnings' => false,
16
  'force-output' => true,
17
+ 'tidy-mark' => false,
18
+ 'output-xhtml' => false,
19
  ));
20
 
21
+ $tidy = new \tidy();
22
  $tidy->parseString($content, $options);
23
  $tidy->cleanRepair();
24
 
lib/Minify/Minify/ImportProcessor.php CHANGED
@@ -116,7 +116,11 @@ class Minify_ImportProcessor {
116
  if ('/' === $url[0]) {
117
  // protocol-relative or root path
118
  $url = ltrim($url, '/');
119
- $file = realpath($_SERVER['DOCUMENT_ROOT']) . DIRECTORY_SEPARATOR
 
 
 
 
120
  . strtr($url, '/', DIRECTORY_SEPARATOR);
121
  } else {
122
  // relative to current path
116
  if ('/' === $url[0]) {
117
  // protocol-relative or root path
118
  $url = ltrim($url, '/');
119
+
120
+ // W3TC FIX: Override $_SERVER['DOCUMENT_ROOT'] if enabled in settings.
121
+ $docroot = \W3TC\Util_Environment::document_root();
122
+
123
+ $file = realpath($docroot) . DIRECTORY_SEPARATOR
124
  . strtr($url, '/', DIRECTORY_SEPARATOR);
125
  } else {
126
  // relative to current path
lib/Minify/Minify/Lines.php CHANGED
@@ -1,5 +1,12 @@
1
  <?php
 
 
 
 
 
 
2
  namespace W3TCL\Minify;
 
3
  /**
4
  * Class Minify_Lines
5
  * @package Minify
@@ -68,7 +75,11 @@ class Minify_Lines
68
  // check for desired URI rewriting
69
  if (isset($options['currentDir'])) {
70
  Minify_CSS_UriRewriter::$debugText = '';
71
- $docRoot = isset($options['docRoot']) ? $options['docRoot'] : $_SERVER['DOCUMENT_ROOT'];
 
 
 
 
72
  $symlinks = isset($options['symlinks']) ? $options['symlinks'] : array();
73
 
74
  $content = Minify_CSS_UriRewriter::rewrite($content, $options['currentDir'], $docRoot, $symlinks);
1
  <?php
2
+ /**
3
+ * File: Lines.php
4
+ *
5
+ * NOTE: Fixes have been included in this file; look for "W3TC FIX".
6
+ */
7
+
8
  namespace W3TCL\Minify;
9
+
10
  /**
11
  * Class Minify_Lines
12
  * @package Minify
75
  // check for desired URI rewriting
76
  if (isset($options['currentDir'])) {
77
  Minify_CSS_UriRewriter::$debugText = '';
78
+
79
+ // W3TC FIX: Override $_SERVER['DOCUMENT_ROOT'] if enabled in settings.
80
+ $docroot = \W3TC\Util_Environment::document_root();
81
+
82
+ $docRoot = isset($options['docRoot']) ? $options['docRoot'] : $docroot;
83
  $symlinks = isset($options['symlinks']) ? $options['symlinks'] : array();
84
 
85
  $content = Minify_CSS_UriRewriter::rewrite($content, $options['currentDir'], $docRoot, $symlinks);
lib/Minify/Minify/Source.php CHANGED
@@ -1,5 +1,12 @@
1
  <?php
 
 
 
 
 
 
2
  namespace W3TCL\Minify;
 
3
  /**
4
  * Class Minify_Source
5
  * @package Minify
@@ -58,7 +65,10 @@ class Minify_Source {
58
  {
59
  if (isset($spec['filepath'])) {
60
  if (0 === strpos($spec['filepath'], '//')) {
61
- $spec['filepath'] = $_SERVER['DOCUMENT_ROOT'] . substr($spec['filepath'], 1);
 
 
 
62
  }
63
  $segments = explode('.', $spec['filepath']);
64
  $ext = strtolower(array_pop($segments));
1
  <?php
2
+ /**
3
+ * File: Source.php
4
+ *
5
+ * NOTE: Fixes have been included in this file; look for "W3TC FIX".
6
+ */
7
+
8
  namespace W3TCL\Minify;
9
+
10
  /**
11
  * Class Minify_Source
12
  * @package Minify
65
  {
66
  if (isset($spec['filepath'])) {
67
  if (0 === strpos($spec['filepath'], '//')) {
68
+ // W3TC FIX: Override $_SERVER['DOCUMENT_ROOT'] if enabled in settings.
69
+ $docroot = \W3TC\Util_Environment::document_root();
70
+
71
+ $spec['filepath'] = $docroot . substr($spec['filepath'], 1);
72
  }
73
  $segments = explode('.', $spec['filepath']);
74
  $ext = strtolower(array_pop($segments));
lib/S3Compatible.php CHANGED
@@ -1203,7 +1203,7 @@ final class S3Request
1203
  elseif ($header == 'content-type')
1204
  $this->response->headers['type'] = $value;
1205
  elseif ($header == 'etag')
1206
- $this->response->headers['hash'] = $value{0} == '"' ? substr($value, 1, -1) : $value;
1207
  elseif (preg_match('/^x-amz-meta-.*$/', $header))
1208
  $this->response->headers[$header] = $value;
1209
  }
1203
  elseif ($header == 'content-type')
1204
  $this->response->headers['type'] = $value;
1205
  elseif ($header == 'etag')
1206
+ $this->response->headers['hash'] = $value[0] == '"' ? substr($value, 1, -1) : $value;
1207
  elseif (preg_match('/^x-amz-meta-.*$/', $header))
1208
  $this->response->headers[$header] = $value;
1209
  }
pub/css/wizard.css CHANGED
@@ -135,6 +135,10 @@ ul#w3tc-options-menu {
135
  display: none;
136
  }
137
 
 
 
 
 
138
  /* Spinner */
139
  .spinner.inline {
140
  float: none;
135
  display: none;
136
  }
137
 
138
+ #wpfooter {
139
+ position: relative;
140
+ }
141
+
142
  /* Spinner */
143
  .spinner.inline {
144
  float: none;
pub/img/W3TC_dashboard_logo_title-retina.png CHANGED
File without changes
pub/img/W3TC_dashboard_logo_title.png CHANGED
File without changes
pub/img/cdn-highwinds-logo.png CHANGED
File without changes
pub/img/google-logo.png CHANGED
File without changes
pub/img/overlay/ceo.png CHANGED
File without changes
pub/img/overlay/gray-check.png CHANGED
File without changes
pub/img/overlay/lite-gray-check.png CHANGED
File without changes
pub/img/overlay/lock.png CHANGED
File without changes
pub/img/overlay/overlay-close.png CHANGED
File without changes
pub/img/overlay/overlay-down-arrow.png CHANGED
File without changes
pub/img/overlay/overlay-logo.png CHANGED
File without changes
pub/img/overlay/save-close.png CHANGED
File without changes
pub/img/overlay/select-arrow.png CHANGED
File without changes
pub/img/overlay/twitter-bird-dark-bgs.png CHANGED
File without changes
pub/img/overlay/wordpress-logo-simplified-rgb.png CHANGED
File without changes
pub/img/w3tc_google-logo-retina.png CHANGED
File without changes
pub/img/w3tc_google-logo.png CHANGED
File without changes
pub/img/w3tc_maxcdn-logo-retina.png CHANGED
File without changes
pub/img/w3tc_maxcdn-logo.png CHANGED
File without changes
pub/img/w3tc_netdna-logo-retina.png CHANGED
File without changes
pub/img/w3tc_netdna-logo.png CHANGED
File without changes
pub/img/w3tc_newrelic-logo-retina.png CHANGED
File without changes
pub/img/w3tc_newrelic-logo.png CHANGED
File without changes
pub/img/w3tc_swarmify-logo-retina.png CHANGED
File without changes
pub/img/w3tc_swarmify-logo.png CHANGED
File without changes
pub/img/w3tc_w3edge-logo-retina.png CHANGED
File without changes
pub/img/w3tc_w3edge-logo.png CHANGED
File without changes
pub/img/w3tc_w3tc-logo-retina.png CHANGED
File without changes
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.8
5
  Tested up to: 5.7
6
- Stable tag: 2.1.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -275,6 +275,17 @@ Please reach out to all of these people and support their projects if you're so
275
 
276
  == Changelog ==
277
 
 
 
 
 
 
 
 
 
 
 
 
278
  = 2.1.1 =
279
  * Fix: Move Minify library to a namespace to avoid conflicts with other plugins
280
  * Fix: Check for AWS before loading functions
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.7
6
+ Stable tag: 2.1.2
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.2 =
279
+ * Fix: Skip removing spaces around "<li>" tags in HTML Minify
280
+ * Fix: Updated admin URL logic for multisite installations
281
+ * Fix: TransparentCDN purge URL validation
282
+ * Fix: Added an option to use ABSPATH as the document root for Minify
283
+ * Fix: Database cache debug message
284
+ * Update: Added regions for AWS S3 (af-south-1, cn-north-1, cn-northwest-1, eu-south-1)
285
+ * Update: Added MIME types AVIF and AVIFS for Browser Cache rules
286
+ * Update: Enhanced "get_pagenum_link" filter
287
+ * Update: Removed "comment" from the non-persistent object cache group
288
+
289
  = 2.1.1 =
290
  * Fix: Move Minify library to a namespace to avoid conflicts with other plugins
291
  * Fix: Check for AWS before loading functions
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.1' );
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.2' );
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.1
7
  * Requires at least: 3.8
8
  * Requires PHP: 5.3
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.2
7
  * Requires at least: 3.8
8
  * Requires PHP: 5.3
9
  * Author: BoldGrid