W3 Total Cache - Version 0.13.2

Version Description

  • Fix: Dont store content of HEAD requests.
  • Updated informational URL on page cache static page comments.
Download this release

Release Info

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

Code changes from version 0.13.1 to 0.13.2

Files changed (80) hide show
  1. Cache_File.php +1 -1
  2. Cache_File_Generic.php +1 -1
  3. Cdn_StackPath2_Widget.php +2 -8
  4. Config.php +13 -4
  5. ConfigState.php +1 -0
  6. Extension_CloudFlare_Widget.php +1 -10
  7. Extensions_Page.php +5 -4
  8. Extensions_Util.php +5 -2
  9. Generic_AdminActions_Default.php +18 -4
  10. Generic_Plugin.php +1 -1
  11. Generic_Plugin_Admin.php +4 -0
  12. Generic_WidgetBoldGrid.php +13 -21
  13. LazyLoad_GeneralPage_View.php +0 -28
  14. LazyLoad_Page_View.php +0 -67
  15. LazyLoad_Plugin_Admin.php +0 -36
  16. Minify_AutoJs.php +65 -41
  17. Minify_Plugin.php +16 -13
  18. PgCache_ContentGrabber.php +10 -4
  19. PgCache_Page.php +8 -0
  20. PgCache_Plugin_Admin.php +7 -1
  21. Root_Loader.php +2 -2
  22. UsageStatistics_Page.php +3 -3
  23. UsageStatistics_Source_DbQueriesLog.php +1 -1
  24. UsageStatistics_Source_ObjectCacheLog.php +1 -1
  25. UsageStatistics_Source_PageCacheLog.php +1 -1
  26. UsageStatistics_Widget.php +1 -10
  27. UserExperience_Emoji_Extension.php +54 -0
  28. LazyLoad_GeneralPage.php → UserExperience_GeneralPage.php +3 -5
  29. UserExperience_GeneralPage_View.php +44 -0
  30. LazyLoad_Mutator.php → UserExperience_LazyLoad_Mutator.php +3 -5
  31. LazyLoad_Mutator_Picture.php → UserExperience_LazyLoad_Mutator_Picture.php +1 -3
  32. LazyLoad_Mutator_Unmutable.php → UserExperience_LazyLoad_Mutator_Unmutable.php +1 -3
  33. UserExperience_LazyLoad_Page_View.php +53 -0
  34. LazyLoad_Plugin.php → UserExperience_LazyLoad_Plugin.php +2 -4
  35. UserExperience_OEmbed_Extension.php +19 -0
  36. LazyLoad_Page.php → UserExperience_Page.php +2 -4
  37. UserExperience_Page_View.php +23 -0
  38. UserExperience_Plugin_Admin.php +56 -0
  39. Util_Environment.php +1 -1
  40. Util_Ui.php +24 -4
  41. Util_Widget.php +51 -2
  42. inc/options/browsercache.php +0 -0
  43. inc/options/extensions/list.php +5 -1
  44. inc/options/general.php +2 -1
  45. inc/options/pgcache.php +3 -0
  46. lib/OAuth/W3tcOAuth.php +1 -11
  47. pub/img/W3TC_dashboard_logo_title-retina.png +0 -0
  48. pub/img/W3TC_dashboard_logo_title.png +0 -0
  49. pub/img/cdn-highwinds-logo.png +0 -0
  50. pub/img/google-logo.png +0 -0
  51. pub/img/overlay/ceo.png +0 -0
  52. pub/img/overlay/gray-check.png +0 -0
  53. pub/img/overlay/list-check.png +0 -0
  54. pub/img/overlay/lite-gray-check.png +0 -0
  55. pub/img/overlay/lock.png +0 -0
  56. pub/img/overlay/overlay-close.png +0 -0
  57. pub/img/overlay/overlay-down-arrow.png +0 -0
  58. pub/img/overlay/overlay-logo.png +0 -0
  59. pub/img/overlay/save-close.png +0 -0
  60. pub/img/overlay/select-arrow.png +0 -0
  61. pub/img/overlay/twitter-bird-dark-bgs.png +0 -0
  62. pub/img/overlay/wordpress-logo-simplified-rgb.png +0 -0
  63. pub/img/w3tc_google-logo-retina.png +0 -0
  64. pub/img/w3tc_google-logo.png +0 -0
  65. pub/img/w3tc_maxcdn-logo-retina.png +0 -0
  66. pub/img/w3tc_maxcdn-logo.png +0 -0
  67. pub/img/w3tc_netdna-logo-retina.png +0 -0
  68. pub/img/w3tc_netdna-logo.png +0 -0
  69. pub/img/w3tc_newrelic-logo-retina.png +0 -0
  70. pub/img/w3tc_newrelic-logo.png +0 -0
  71. pub/img/w3tc_swarmify-logo-retina.png +0 -0
  72. pub/img/w3tc_swarmify-logo.png +0 -0
  73. pub/img/w3tc_w3edge-logo-retina.png +0 -0
  74. pub/img/w3tc_w3edge-logo.png +0 -0
  75. pub/img/w3tc_w3tc-logo-retina.png +0 -0
  76. pub/js/options-validator.js +22 -0
  77. pub/js/options.js +6 -0
  78. readme.txt +6 -1
  79. w3-total-cache-api.php +1 -1
  80. w3-total-cache.php +1 -1
Cache_File.php CHANGED
@@ -445,7 +445,7 @@ class Cache_File extends Cache_Base {
445
  $dir = dirname( $path );
446
 
447
  if ( !@is_dir( $dir ) ) {
448
- if ( !Util_File::mkdir_from( $dir, W3TC_CACHE_DIR ) )
449
  return false;
450
  }
451
 
445
  $dir = dirname( $path );
446
 
447
  if ( !@is_dir( $dir ) ) {
448
+ if ( !Util_File::mkdir_from( $dir, dirname( W3TC_CACHE_DIR ) ) )
449
  return false;
450
  }
451
 
Cache_File_Generic.php CHANGED
@@ -44,7 +44,7 @@ class Cache_File_Generic extends Cache_File {
44
  $dir = dirname( $path );
45
 
46
  if ( !@is_dir( $dir ) ) {
47
- if ( !Util_File::mkdir_from_safe( $dir, W3TC_CACHE_DIR ) )
48
  return false;
49
  }
50
 
44
  $dir = dirname( $path );
45
 
46
  if ( !@is_dir( $dir ) ) {
47
+ if ( !Util_File::mkdir_from_safe( $dir, dirname( W3TC_CACHE_DIR ) ) )
48
  return false;
49
  }
50
 
Cdn_StackPath2_Widget.php CHANGED
@@ -8,16 +8,10 @@ class Cdn_StackPath2_Widget {
8
  array( $o, 'admin_print_styles' ) );
9
  add_action( 'admin_print_scripts',
10
  array( $o, 'admin_print_scripts' ) );
11
- add_action( 'w3tc_widget_setup',
12
- array( $o, 'w3tc_widget_setup' ), 2000 );
13
- }
14
-
15
-
16
 
17
- public function w3tc_widget_setup() {
18
- Util_Widget::add( 'w3tc_stackpath',
19
  '<div class="w3tc-widget-stackpath2-logo"></div>',
20
- array( $this, 'widget_form' ),
21
  Util_Ui::admin_url( 'admin.php?page=w3tc_cdn' ),
22
  'normal' );
23
  }
8
  array( $o, 'admin_print_styles' ) );
9
  add_action( 'admin_print_scripts',
10
  array( $o, 'admin_print_scripts' ) );
 
 
 
 
 
11
 
12
+ Util_Widget::add2( 'w3tc_stackpath', 2000,
 
13
  '<div class="w3tc-widget-stackpath2-logo"></div>',
14
+ array( $o, 'widget_form' ),
15
  Util_Ui::admin_url( 'admin.php?page=w3tc_cdn' ),
16
  'normal' );
17
  }
Config.php CHANGED
@@ -77,10 +77,19 @@ class Config {
77
  static public function util_config_filename( $blog_id, $preview ) {
78
  $postfix = ( $preview ? '-preview' : '' ) . '.php';
79
 
80
- if ( $blog_id <= 0 )
81
- return W3TC_CONFIG_DIR . '/master' . $postfix;
82
- else
83
- return W3TC_CONFIG_DIR . '/' . sprintf( '%06d', $blog_id ) . $postfix;
 
 
 
 
 
 
 
 
 
84
  }
85
 
86
 
77
  static public function util_config_filename( $blog_id, $preview ) {
78
  $postfix = ( $preview ? '-preview' : '' ) . '.php';
79
 
80
+ if ( $blog_id <= 0 ) {
81
+ $filename = W3TC_CONFIG_DIR . '/master' . $postfix;
82
+ } else {
83
+ $filename = W3TC_CONFIG_DIR . '/' . sprintf( '%06d', $blog_id ) . $postfix;
84
+ }
85
+
86
+ $d = w3tc_apply_filters( 'config_filename', array(
87
+ 'blog_id' => $blog_id,
88
+ 'preview' => $preview,
89
+ 'filename' => $filename
90
+ ) );
91
+
92
+ return $d['filename'];
93
  }
94
 
95
 
ConfigState.php CHANGED
@@ -191,5 +191,6 @@ class ConfigState {
191
 
192
  private function apply_defaults() {
193
  $this->set( 'common.install', time() );
 
194
  }
195
  }
191
 
192
  private function apply_defaults() {
193
  $this->set( 'common.install', time() );
194
+ $this->set( 'common.install_version', W3TC_VERSION );
195
  }
196
  }
Extension_CloudFlare_Widget.php CHANGED
@@ -11,16 +11,7 @@ class Extension_CloudFlare_Widget {
11
  add_action( 'admin_print_scripts-toplevel_page_w3tc_dashboard',
12
  array( $this, 'admin_print_scripts_w3tc_dashboard' ) );
13
 
14
- add_action( 'w3tc_widget_setup', array(
15
- $this,
16
- 'w3tc_widget_setup'
17
- ), 10000 );
18
- }
19
-
20
-
21
-
22
- function w3tc_widget_setup() {
23
- Util_Widget::add( 'w3tc_cloudflare',
24
  '<div class="w3tc_cloudflare_widget_logo"></div>',
25
  array( $this, 'widget_form' ),
26
  Util_Ui::admin_url( 'admin.php?page=w3tc_general#cloudflare' ),
11
  add_action( 'admin_print_scripts-toplevel_page_w3tc_dashboard',
12
  array( $this, 'admin_print_scripts_w3tc_dashboard' ) );
13
 
14
+ Util_Widget::add2( 'w3tc_cloudflare', 10000,
 
 
 
 
 
 
 
 
 
15
  '<div class="w3tc_cloudflare_widget_logo"></div>',
16
  array( $this, 'widget_form' ),
17
  Util_Ui::admin_url( 'admin.php?page=w3tc_general#cloudflare' ),
Extensions_Page.php CHANGED
@@ -6,10 +6,10 @@ namespace W3TC;
6
  /* todo - sort by name
7
  function extensions_sort_cmp_name($a, $b)
8
  {
9
- if ($a['name'] == $b['name']) {
10
- return 0;
11
- }
12
- return ($a['name'] < $b['name']) ? -1 : 1;
13
  }*/
14
 
15
 
@@ -84,6 +84,7 @@ class Extensions_Page extends Base_Page_Settings {
84
  'enabled' => true,
85
  'requirements' => array(),
86
  'core' => false,
 
87
  'path' => ''
88
  );
89
  return array_merge( $default, $meta );
6
  /* todo - sort by name
7
  function extensions_sort_cmp_name($a, $b)
8
  {
9
+ if ($a['name'] == $b['name']) {
10
+ return 0;
11
+ }
12
+ return ($a['name'] < $b['name']) ? -1 : 1;
13
  }*/
14
 
15
 
84
  'enabled' => true,
85
  'requirements' => array(),
86
  'core' => false,
87
+ 'public' => true,
88
  'path' => ''
89
  );
90
  return array_merge( $default, $meta );
Extensions_Util.php CHANGED
@@ -61,7 +61,7 @@ class Extensions_Util {
61
  * @param Config $w3_config
62
  * @return bool
63
  */
64
- static public function activate_extension( $extension, $w3_config ) {
65
  $all_extensions = Extensions_Util::get_extensions( $w3_config );
66
  $extensions = $w3_config->get_array( 'extensions.active' );
67
 
@@ -85,8 +85,11 @@ class Extensions_Util {
85
  $w3_config->set_extension_active_frontend( $extension, true );
86
  }
87
 
 
88
  try {
89
- $w3_config->save();
 
 
90
  return true;
91
  } catch ( \Exception $ex ) {
92
  }
61
  * @param Config $w3_config
62
  * @return bool
63
  */
64
+ static public function activate_extension( $extension, $w3_config, $dont_save_config = false ) {
65
  $all_extensions = Extensions_Util::get_extensions( $w3_config );
66
  $extensions = $w3_config->get_array( 'extensions.active' );
67
 
85
  $w3_config->set_extension_active_frontend( $extension, true );
86
  }
87
 
88
+
89
  try {
90
+ if ( !$dont_save_config ) {
91
+ $w3_config->save();
92
+ }
93
  return true;
94
  } catch ( \Exception $ex ) {
95
  }
Generic_AdminActions_Default.php CHANGED
@@ -809,12 +809,26 @@ class Generic_AdminActions_Default {
809
  include W3TC_DIR . '/ConfigKeys.php'; // define $keys
810
 
811
  foreach ( $request as $request_key => $request_value ) {
812
- if ( is_array( $request_value ) )
813
  array_map( 'stripslashes_deep', $request_value );
814
- else
815
  $request_value = stripslashes( $request_value );
816
- if ( strpos( $request_key, 'memcached__servers' ) || strpos( $request_key, 'redis__servers' ) )
817
- $request_value = explode( ',', $request_value );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
818
 
819
  $key = Util_Ui::config_key_from_http_name( $request_key );
820
  if ( is_array( $key ) ) {
809
  include W3TC_DIR . '/ConfigKeys.php'; // define $keys
810
 
811
  foreach ( $request as $request_key => $request_value ) {
812
+ if ( is_array( $request_value ) ) {
813
  array_map( 'stripslashes_deep', $request_value );
814
+ } else {
815
  $request_value = stripslashes( $request_value );
816
+
817
+ if ( strpos( $request_key, 'memcached__servers' ) || strpos( $request_key, 'redis__servers' ) ) {
818
+ $request_value = explode( ',', $request_value );
819
+ }
820
+ }
821
+
822
+ if ( substr( $request_key, 0, 11 ) == 'extension__' ) {
823
+ $extension_id = Util_Ui::config_key_from_http_name(
824
+ substr( $request_key, 11 ) );
825
+
826
+ if ( $request_value == '1' ) {
827
+ Extensions_Util::activate_extension( $extension_id, $config, true );
828
+ } else {
829
+ Extensions_Util::deactivate_extension( $extension_id, $config, true );
830
+ }
831
+ }
832
 
833
  $key = Util_Ui::config_key_from_http_name( $request_key );
834
  if ( is_array( $key ) ) {
Generic_Plugin.php CHANGED
@@ -520,7 +520,7 @@ class Generic_Plugin {
520
  $strings = array();
521
 
522
  if ( !$this->_config->get_boolean( 'common.tweeted' ) ) {
523
- $strings[] = 'Performance optimized by W3 Total Cache. Learn more: https://www.w3-edge.com/products/';
524
  $strings[] = '';
525
  }
526
 
520
  $strings = array();
521
 
522
  if ( !$this->_config->get_boolean( 'common.tweeted' ) ) {
523
+ $strings[] = 'Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/';
524
  $strings[] = '';
525
  }
526
 
Generic_Plugin_Admin.php CHANGED
@@ -269,6 +269,7 @@ class Generic_Plugin_Admin {
269
  else
270
  $profile = 'UA-2264433-8';
271
 
 
272
  ?>
273
  <script type="text/javascript">
274
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@@ -286,6 +287,9 @@ class Generic_Plugin_Admin {
286
  'dimension5': '<?php echo esc_attr( $_SERVER["SERVER_SOFTWARE"] ) ?>',
287
  'dimension6': 'mysql<?php global $wpdb; echo $wpdb->db_version() ?>',
288
  'dimension7': '<?php echo Util_Environment::home_url_host() ?>',
 
 
 
289
  'userId': '<?php echo $current_user->user_email ?>',
290
  'page': '<?php echo $page ?>'
291
  });
269
  else
270
  $profile = 'UA-2264433-8';
271
 
272
+ $state = Dispatcher::config_state();
273
  ?>
274
  <script type="text/javascript">
275
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
287
  'dimension5': '<?php echo esc_attr( $_SERVER["SERVER_SOFTWARE"] ) ?>',
288
  'dimension6': 'mysql<?php global $wpdb; echo $wpdb->db_version() ?>',
289
  'dimension7': '<?php echo Util_Environment::home_url_host() ?>',
290
+ 'dimension9': '<?php echo esc_attr( $state->get_string( 'common.install_version' ) ) ?>',
291
+ 'dimension10': '<?php echo esc_attr( Util_Environment::w3tc_edition( $this->_config ) ) ?>',
292
+ 'dimension11': '<?php echo esc_attr( Util_Widget::list_widgets() ) ?>',
293
  'userId': '<?php echo $current_user->user_email ?>',
294
  'page': '<?php echo $page ?>'
295
  });
Generic_WidgetBoldGrid.php CHANGED
@@ -3,35 +3,27 @@ namespace W3TC;
3
 
4
  class Generic_WidgetBoldGrid {
5
  static public function admin_init_w3tc_dashboard() {
6
- $o = new Generic_WidgetBoldGrid();
7
-
8
- add_action( 'w3tc_widget_setup', array( $o, 'wp_dashboard_setup' ), 3000 );
9
- add_action( 'w3tc_network_dashboard_setup',
10
- array( $o, 'wp_dashboard_setup' ), 5000 );
11
-
12
- add_thickbox();
13
- wp_enqueue_script( 'plugin-install' );
14
-
15
- wp_enqueue_script( 'w3tc-boldgrid-widget',
16
- plugins_url( 'Generic_WidgetBoldGrid_View.js', W3TC_FILE ),
17
- array( 'thickbox' ), W3TC_VERSION );
18
- }
19
-
20
-
21
-
22
- function wp_dashboard_setup() {
23
- $show = apply_filters( 'w3tc_generic_boldgrid_show', $this->should_show_widget() );
24
  if ( !$show ) {
25
  return;
26
  }
27
 
28
- Util_Widget::add( 'w3tc_boldgrid',
 
 
29
  '<div class="w3tc-widget-boldgrid-logo"></div>',
30
- array( $this, 'widget_form' ),
31
  self_admin_url(
32
  'plugin-install.php?tab=plugin-information&amp;plugin=boldgrid-backup' .
33
  '&amp;TB_iframe=true&amp;width=772&amp;height=550'
34
  ), 'normal', __( 'View Details' ), 'thickbox open-plugin-details-modal' );
 
 
 
 
 
 
 
35
  }
36
 
37
 
@@ -46,7 +38,7 @@ class Generic_WidgetBoldGrid {
46
  *
47
  * @return bool
48
  */
49
- private function should_show_widget() {
50
  $plugins = get_option( 'active_plugins' );
51
 
52
  $backup_plugins = array(
3
 
4
  class Generic_WidgetBoldGrid {
5
  static public function admin_init_w3tc_dashboard() {
6
+ $show = apply_filters( 'w3tc_generic_boldgrid_show', self::should_show_widget() );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  if ( !$show ) {
8
  return;
9
  }
10
 
11
+ $o = new Generic_WidgetBoldGrid();
12
+
13
+ Util_Widget::add2( 'w3tc_boldgrid', 5000,
14
  '<div class="w3tc-widget-boldgrid-logo"></div>',
15
+ array( $o, 'widget_form' ),
16
  self_admin_url(
17
  'plugin-install.php?tab=plugin-information&amp;plugin=boldgrid-backup' .
18
  '&amp;TB_iframe=true&amp;width=772&amp;height=550'
19
  ), 'normal', __( 'View Details' ), 'thickbox open-plugin-details-modal' );
20
+
21
+ add_thickbox();
22
+ wp_enqueue_script( 'plugin-install' );
23
+
24
+ wp_enqueue_script( 'w3tc-boldgrid-widget',
25
+ plugins_url( 'Generic_WidgetBoldGrid_View.js', W3TC_FILE ),
26
+ array( 'thickbox' ), W3TC_VERSION );
27
  }
28
 
29
 
38
  *
39
  * @return bool
40
  */
41
+ static private function should_show_widget() {
42
  $plugins = get_option( 'active_plugins' );
43
 
44
  $backup_plugins = array(
LazyLoad_GeneralPage_View.php DELETED
@@ -1,28 +0,0 @@
1
- <?php
2
- namespace W3TC;
3
-
4
- if ( !defined( 'W3TC' ) )
5
- die();
6
-
7
- ?>
8
- <?php
9
- Util_Ui::postbox_header( __( 'User Experience', 'w3-total-cache' ), '', 'userexperience' );
10
- Util_Ui::config_overloading_button( array(
11
- 'key' => 'lazyload.configuration_overloaded'
12
- ) );
13
- ?>
14
-
15
- <table class="form-table">
16
- <?php
17
- Util_Ui::config_item( array(
18
- 'key' => 'lazyload.enabled',
19
- 'control' => 'checkbox',
20
- 'checkbox_label' => __( 'Lazy Loading', 'w3-total-cache' ),
21
- 'description' => __( 'Defer loading offscreen images.',
22
- 'w3-total-cache' )
23
- ) );
24
- ?>
25
- </table>
26
-
27
- <?php Util_Ui::button_config_save( 'general_userexperience' ); ?>
28
- <?php Util_Ui::postbox_footer(); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
LazyLoad_Page_View.php DELETED
@@ -1,67 +0,0 @@
1
- <?php
2
- namespace W3TC;
3
-
4
- if ( !defined( 'W3TC' ) )
5
- die();
6
-
7
- ?>
8
- <p>
9
- Lazy loading is currently
10
- <?php if ( $c->get_boolean( 'lazyload.enabled' ) ): ?>
11
- <span class="w3tc-enabled">enabled</span>
12
- <?php else: ?>
13
- <span class="w3tc-disabled">disabled</span>
14
- <?php endif ?>
15
- .
16
- <p>
17
-
18
- <form action="admin.php?page=w3tc_userexperience" method="post">
19
- <div class="metabox-holder">
20
- <?php Util_Ui::postbox_header( __( 'Lazy Loading', 'w3-total-cache' ), '', 'application' ); ?>
21
- <table class="form-table">
22
- <?php
23
- Util_Ui::config_item( array(
24
- 'key' => 'lazyload.process_img',
25
- 'control' => 'checkbox',
26
- 'checkbox_label' => __( 'Process HTML image tags', 'w3-total-cache' ),
27
- 'description' => __( 'Process <code>img</code> tags',
28
- 'w3-total-cache' )
29
- ) );
30
-
31
- Util_Ui::config_item( array(
32
- 'key' => 'lazyload.process_background',
33
- 'control' => 'checkbox',
34
- 'checkbox_label' => __( 'Process background images', 'w3-total-cache' ),
35
- 'description' => __( 'Process <code>background</code> styles',
36
- 'w3-total-cache' )
37
- ) );
38
-
39
- Util_Ui::config_item( array(
40
- 'key' => 'lazyload.exclude',
41
- 'label' => 'Exclude words:',
42
- 'control' => 'textarea',
43
- 'description' => __( 'Exclude tags containing words',
44
- 'w3-total-cache' )
45
- ) );
46
-
47
- Util_Ui::config_item( array(
48
- 'key' => 'lazyload.embed_method',
49
- 'label' => __( 'Script Embed method:', 'w3-total-cache' ),
50
- 'control' => 'selectbox',
51
- 'selectbox_values' => array(
52
- 'async_head' => 'async',
53
- 'sync_head' => 'sync (to head)',
54
- 'inline_footer' => 'inline'
55
- ),
56
- 'description' => 'Use <code>inline</code> method only when your website has just a few pages'
57
- )
58
- );
59
- ?>
60
- </table>
61
- <p class="submit">
62
- <?php Util_Ui::button_config_save( 'lazyload' ); ?>
63
- </p>
64
-
65
- <?php Util_Ui::postbox_footer(); ?>
66
- </form>
67
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
LazyLoad_Plugin_Admin.php DELETED
@@ -1,36 +0,0 @@
1
- <?php
2
- namespace W3TC;
3
-
4
-
5
-
6
- class LazyLoad_Plugin_Admin {
7
- function run() {
8
- add_filter( 'w3tc_admin_menu', array( $this, 'w3tc_admin_menu' ) );
9
- add_action( 'w3tc_settings_page-w3tc_userexperience',
10
- array( $this, 'w3tc_settings_page_w3tc_userexperience' ) );
11
- add_action( 'admin_init_w3tc_general',
12
- array( '\W3TC\LazyLoad_GeneralPage', 'admin_init_w3tc_general' ) );
13
- }
14
-
15
-
16
-
17
- public function w3tc_admin_menu( $menu ) {
18
- $c = Dispatcher::config();
19
-
20
- $menu['w3tc_userexperience'] = array(
21
- 'page_title' => __( 'User Experience', 'w3-total-cache' ),
22
- 'menu_text' => __( 'User Experience', 'w3-total-cache' ),
23
- 'visible_always' => false,
24
- 'order' => 1200
25
- );
26
-
27
- return $menu;
28
- }
29
-
30
-
31
-
32
- public function w3tc_settings_page_w3tc_userexperience() {
33
- $v = new LazyLoad_Page();
34
- $v->render_content();
35
- }
36
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Minify_AutoJs.php CHANGED
@@ -43,16 +43,7 @@ class Minify_AutoJs {
43
  private $debug_minified_urls = array();
44
 
45
  /**
46
- * Current position to embed minified script
47
- *
48
- * @var integer
49
- */
50
- private $embed_pos;
51
-
52
- /**
53
- * Current list of files to minify
54
- *
55
- * @var array
56
  */
57
  private $files_to_minify;
58
 
@@ -63,12 +54,6 @@ class Minify_AutoJs {
63
  */
64
  private $group_type = 'head';
65
 
66
- /**
67
- * Current number of minification group
68
- *
69
- * @var integer
70
- */
71
- private $minify_group_number = 0;
72
  private $debug = false;
73
 
74
  /**
@@ -120,14 +105,28 @@ class Minify_AutoJs {
120
  $script_tags );
121
 
122
  // pass scripts
123
- $this->embed_pos = null;
124
- $this->files_to_minify = array();
 
 
 
 
 
 
 
 
 
 
 
 
125
 
126
  for ( $n = 0; $n < count( $script_tags ); $n++ ) {
127
  $this->process_script_tag( $script_tags[$n], $n );
128
  }
129
 
130
- $this->flush_collected( '' );
 
 
131
 
132
  return $this->buffer;
133
  }
@@ -191,7 +190,7 @@ class Minify_AutoJs {
191
  Minify_Core::log( 'its not src=, flushing' );
192
  }
193
 
194
- $this->flush_collected( $script_tag );
195
 
196
  if ( preg_match( '~</head>~is', $script_tag, $match ) )
197
  $this->group_type = 'body';
@@ -210,9 +209,8 @@ class Minify_AutoJs {
210
 
211
  $step1 = !empty( $step1_result );
212
  $step2 = !in_array( $file, $this->ignore_js_files );
213
- $step3 = !preg_match( '~\s+(async|defer)[> ]~is', $script_tag );
214
 
215
- $do_tag_minification = $step1 && $step2 && $step3;
216
  $do_tag_minification = apply_filters( 'w3tc_minify_js_do_tag_minification',
217
  $do_tag_minification, $script_tag, $file );
218
 
@@ -244,7 +242,7 @@ class Minify_AutoJs {
244
  strlen( $script_tag ) );
245
  }
246
 
247
- $this->flush_collected( $script_tag );
248
  return;
249
  }
250
 
@@ -252,33 +250,51 @@ class Minify_AutoJs {
252
  $this->buffer = substr_replace( $this->buffer, '',
253
  $tag_pos, strlen( $script_tag ) );
254
 
255
- // for head group - put minified file at the place of first script
256
- // for body - put at the place of last script, to make as more DOM
257
- // objects available as possible
258
- if ( count( $this->files_to_minify ) <= 0 || $this->group_type == 'body' )
259
- $this->embed_pos = $tag_pos;
260
- $this->files_to_minify[] = $file;
 
 
 
 
 
 
 
 
 
 
 
261
  }
262
 
263
  /**
264
  * Minifies collected scripts
265
  */
266
- private function flush_collected( $last_script_tag ) {
267
- if ( count( $this->files_to_minify ) <= 0 )
268
  return;
 
269
  $do_flush_collected = apply_filters( 'w3tc_minify_js_do_flush_collected',
270
- true, $last_script_tag, $this );
271
- if ( !$do_flush_collected )
272
  return;
273
-
274
- // find embed position
275
- $embed_pos = $this->embed_pos;
276
 
277
  // build minified script tag
 
 
 
 
 
 
 
 
278
  $data = array(
279
- 'files_to_minify' => $this->files_to_minify,
280
- 'embed_pos' => $embed_pos,
281
- 'embed_type' => $this->embed_type[$this->group_type],
282
  'buffer' => $this->buffer
283
  );
284
 
@@ -309,9 +325,17 @@ class Minify_AutoJs {
309
  // replace
310
  $this->buffer = substr_replace( $this->buffer,
311
  $data['script_to_embed_body'], $data['embed_pos'], 0 );
 
 
 
 
 
 
312
  }
313
 
314
- $this->files_to_minify = array();
315
- $this->minify_group_number++;
 
 
316
  }
317
  }
43
  private $debug_minified_urls = array();
44
 
45
  /**
46
+ * Current list of script files to minify
 
 
 
 
 
 
 
 
 
47
  */
48
  private $files_to_minify;
49
 
54
  */
55
  private $group_type = 'head';
56
 
 
 
 
 
 
 
57
  private $debug = false;
58
 
59
  /**
105
  $script_tags );
106
 
107
  // pass scripts
108
+ $this->files_to_minify = array(
109
+ 'sync' => array(
110
+ 'embed_pos' => 0,
111
+ 'files' => array()
112
+ ),
113
+ 'async' => array(
114
+ 'embed_pos' => 0,
115
+ 'files' => array()
116
+ ),
117
+ 'defer' => array(
118
+ 'embed_pos' => 0,
119
+ 'files' => array()
120
+ )
121
+ );
122
 
123
  for ( $n = 0; $n < count( $script_tags ); $n++ ) {
124
  $this->process_script_tag( $script_tags[$n], $n );
125
  }
126
 
127
+ $this->flush_collected( 'sync', '' );
128
+ $this->flush_collected( 'async', '' );
129
+ $this->flush_collected( 'defer', '' );
130
 
131
  return $this->buffer;
132
  }
190
  Minify_Core::log( 'its not src=, flushing' );
191
  }
192
 
193
+ $this->flush_collected( 'sync', $script_tag );
194
 
195
  if ( preg_match( '~</head>~is', $script_tag, $match ) )
196
  $this->group_type = 'body';
209
 
210
  $step1 = !empty( $step1_result );
211
  $step2 = !in_array( $file, $this->ignore_js_files );
 
212
 
213
+ $do_tag_minification = $step1 && $step2;
214
  $do_tag_minification = apply_filters( 'w3tc_minify_js_do_tag_minification',
215
  $do_tag_minification, $script_tag, $file );
216
 
242
  strlen( $script_tag ) );
243
  }
244
 
245
+ $this->flush_collected( 'sync', $script_tag );
246
  return;
247
  }
248
 
250
  $this->buffer = substr_replace( $this->buffer, '',
251
  $tag_pos, strlen( $script_tag ) );
252
 
253
+ $m = null;
254
+ if ( !preg_match( '~\s+(async|defer)[> ]~is', $script_tag, $m ) ) {
255
+ $sync_type = 'sync';
256
+
257
+ // for head group - put minified file at the place of first script
258
+ // for body - put at the place of last script, to make as more DOM
259
+ // objects available as possible
260
+ if ( count( $this->files_to_minify[$sync_type]['files'] ) <= 0 ||
261
+ $this->group_type == 'body' ) {
262
+ $this->files_to_minify[$sync_type]['embed_pos'] = $tag_pos;
263
+ }
264
+ } else {
265
+ $sync_type = strtolower( $m[1] );
266
+ $this->files_to_minify[$sync_type]['embed_pos'] = $tag_pos;
267
+ }
268
+
269
+ $this->files_to_minify[$sync_type]['files'][] = $file;
270
  }
271
 
272
  /**
273
  * Minifies collected scripts
274
  */
275
+ private function flush_collected( $sync_type, $last_script_tag ) {
276
+ if ( count( $this->files_to_minify[$sync_type]['files'] ) <= 0 ) {
277
  return;
278
+ }
279
  $do_flush_collected = apply_filters( 'w3tc_minify_js_do_flush_collected',
280
+ true, $last_script_tag, $this, $sync_type );
281
+ if ( !$do_flush_collected ) {
282
  return;
283
+ }
 
 
284
 
285
  // build minified script tag
286
+ if ( $sync_type == 'sync' ) {
287
+ $embed_type = $this->embed_type[$this->group_type];
288
+ } elseif ( $sync_type == 'async' ) {
289
+ $embed_type = 'nb-async';
290
+ } elseif ( $sync_type == 'defer' ) {
291
+ $embed_type = 'nb-defer';
292
+ }
293
+
294
  $data = array(
295
+ 'files_to_minify' => $this->files_to_minify[$sync_type]['files'],
296
+ 'embed_pos' => $this->files_to_minify[$sync_type]['embed_pos'],
297
+ 'embed_type' => $embed_type,
298
  'buffer' => $this->buffer
299
  );
300
 
325
  // replace
326
  $this->buffer = substr_replace( $this->buffer,
327
  $data['script_to_embed_body'], $data['embed_pos'], 0 );
328
+
329
+ foreach ( $this->files_to_minify as $key => $i ) {
330
+ if ( $key != $sync_type && $i['embed_pos'] >= $data['embed_pos'] ) {
331
+ $this->files_to_minify[$key]['embed_pos'] += strlen( $data['script_to_embed_body'] );
332
+ }
333
+ }
334
  }
335
 
336
+ $this->files_to_minify[$sync_type] = array(
337
+ 'embed_pos' => 0,
338
+ 'files' => array()
339
+ );
340
  }
341
  }
Minify_Plugin.php CHANGED
@@ -1106,19 +1106,22 @@ class _W3_MinifyHelpers {
1106
  $script .= "<script>w3tc_load_js('" .
1107
  $url . "');</script>";
1108
 
1109
- } else if ( $embed_type == 'nb-async' ) {
1110
- $script = '<script async src="' .
1111
- str_replace( '&', '&amp;', $url ) . '"></script>';
1112
- } else if ( $embed_type == 'nb-defer' ) {
1113
- $script = '<script defer src="' .
1114
- str_replace( '&', '&amp;', $url ) . '"></script>';
1115
- } else if ( $embed_type == 'extsrc' ) {
1116
- $script = '<script extsrc="' .
1117
- str_replace( '&', '&amp;', $url ) . '"></script>';
1118
- } else if ( $embed_type == 'asyncsrc' ) {
1119
- $script = '<script asyncsrc="' .
1120
- str_replace( '&', '&amp;', $url ) . '"></script>';
1121
- }
 
 
 
1122
  }
1123
 
1124
  return $script . "\r\n";
1106
  $script .= "<script>w3tc_load_js('" .
1107
  $url . "');</script>";
1108
 
1109
+ } elseif ( $embed_type == 'nb-async' ) {
1110
+ $script = '<script async src="' .
1111
+ str_replace( '&', '&amp;', $url ) . '"></script>';
1112
+ } elseif ( $embed_type == 'nb-defer' ) {
1113
+ $script = '<script defer src="' .
1114
+ str_replace( '&', '&amp;', $url ) . '"></script>';
1115
+ } elseif ( $embed_type == 'extsrc' ) {
1116
+ $script = '<script extsrc="' .
1117
+ str_replace( '&', '&amp;', $url ) . '"></script>';
1118
+ } elseif ( $embed_type == 'asyncsrc' ) {
1119
+ $script = '<script asyncsrc="' .
1120
+ str_replace( '&', '&amp;', $url ) . '"></script>';
1121
+ } else {
1122
+ $script = '<script src="' .
1123
+ str_replace( '&', '&amp;', $url ) . '"></script>';
1124
+ }
1125
  }
1126
 
1127
  return $script . "\r\n";
PgCache_ContentGrabber.php CHANGED
@@ -198,7 +198,7 @@ class PgCache_ContentGrabber {
198
  }
199
 
200
  // TODO: call modifies object state, rename method at least
201
- $this->_caching = $this->_can_cache();
202
  global $w3_late_init;
203
 
204
  if ( $this->_debug ) {
@@ -423,7 +423,7 @@ class PgCache_ContentGrabber {
423
  $response_headers = $this->_get_response_headers();
424
 
425
  // TODO: call modifies object state, rename method at least
426
- $original_can_cache = $this->_can_cache2( $buffer, $response_headers );
427
  $can_cache = apply_filters( 'w3tc_can_cache', $original_can_cache, $this, $buffer );
428
  if ( $can_cache != $original_can_cache ) {
429
  $this->cache_reject_reason = 'Third-party plugin has modified caching activity';
@@ -508,7 +508,7 @@ class PgCache_ContentGrabber {
508
  *
509
  * @return boolean
510
  */
511
- private function _can_cache() {
512
  /**
513
  * Don't cache in console mode
514
  */
@@ -637,7 +637,7 @@ class PgCache_ContentGrabber {
637
  * @param string $buffer
638
  * @return boolean
639
  */
640
- private function _can_cache2( $buffer, $response_headers ) {
641
  /**
642
  * Skip if caching is disabled
643
  */
@@ -775,6 +775,12 @@ class PgCache_ContentGrabber {
775
  }
776
  }
777
 
 
 
 
 
 
 
778
  return true;
779
  }
780
 
198
  }
199
 
200
  // TODO: call modifies object state, rename method at least
201
+ $this->_caching = $this->_can_read_cache();
202
  global $w3_late_init;
203
 
204
  if ( $this->_debug ) {
423
  $response_headers = $this->_get_response_headers();
424
 
425
  // TODO: call modifies object state, rename method at least
426
+ $original_can_cache = $this->_can_write_cache( $buffer, $response_headers );
427
  $can_cache = apply_filters( 'w3tc_can_cache', $original_can_cache, $this, $buffer );
428
  if ( $can_cache != $original_can_cache ) {
429
  $this->cache_reject_reason = 'Third-party plugin has modified caching activity';
508
  *
509
  * @return boolean
510
  */
511
+ private function _can_read_cache() {
512
  /**
513
  * Don't cache in console mode
514
  */
637
  * @param string $buffer
638
  * @return boolean
639
  */
640
+ private function _can_write_cache( $buffer, $response_headers ) {
641
  /**
642
  * Skip if caching is disabled
643
  */
775
  }
776
  }
777
 
778
+ if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] == 'HEAD' ) {
779
+ $this->cache_reject_reason = 'HEAD request';
780
+ $this->process_status = 'miss_request_method';
781
+ return;
782
+ }
783
+
784
  return true;
785
  }
786
 
PgCache_Page.php CHANGED
@@ -4,6 +4,14 @@ namespace W3TC;
4
 
5
 
6
  class PgCache_Page extends Base_Page_Settings {
 
 
 
 
 
 
 
 
7
  /**
8
  * Current page
9
  *
4
 
5
 
6
  class PgCache_Page extends Base_Page_Settings {
7
+ static public function admin_print_scripts_w3tc_pgcache() {
8
+ wp_enqueue_script( 'w3tc-options-validator',
9
+ plugins_url( 'pub/js/options-validator.js', W3TC_FILE ),
10
+ array(), W3TC_VERSION );
11
+ }
12
+
13
+
14
+
15
  /**
16
  * Current page
17
  *
PgCache_Plugin_Admin.php CHANGED
@@ -36,8 +36,14 @@ class PgCache_Plugin_Admin {
36
  $this, 'w3tc_usage_statistics_summary_from_history' ), 10, 2 );
37
  }
38
 
39
- // cookie groups
40
  add_filter( 'w3tc_admin_menu', array( $this, 'w3tc_admin_menu' ) );
 
 
 
 
 
 
 
41
  add_action( 'admin_init_w3tc_pgcache_cookiegroups', array(
42
  '\W3TC\PgCache_Page_CookieGroups',
43
  'admin_init_w3tc_pgcache_cookiegroups'
36
  $this, 'w3tc_usage_statistics_summary_from_history' ), 10, 2 );
37
  }
38
 
 
39
  add_filter( 'w3tc_admin_menu', array( $this, 'w3tc_admin_menu' ) );
40
+
41
+ add_action( 'admin_print_scripts-performance_page_w3tc_pgcache', array(
42
+ '\W3TC\PgCache_Page',
43
+ 'admin_print_scripts_w3tc_pgcache'
44
+ ) );
45
+
46
+ // cookie groups
47
  add_action( 'admin_init_w3tc_pgcache_cookiegroups', array(
48
  '\W3TC\PgCache_Page_CookieGroups',
49
  'admin_init_w3tc_pgcache_cookiegroups'
Root_Loader.php CHANGED
@@ -32,7 +32,7 @@ class Root_Loader {
32
  if ( $c->get_boolean( 'cdnfsd.enabled' ) )
33
  $plugins[] = new Cdnfsd_Plugin();
34
  if ( $c->get_boolean( 'lazyload.enabled' ) )
35
- $plugins[] = new LazyLoad_Plugin();
36
  if ( $c->get_boolean( 'browsercache.enabled' ) )
37
  $plugins[] = new BrowserCache_Plugin();
38
  if ( $c->get_boolean( 'minify.enabled' ) )
@@ -46,7 +46,7 @@ class Root_Loader {
46
  $plugins[] = new Generic_Plugin_Admin();
47
  $plugins[] = new BrowserCache_Plugin_Admin();
48
  $plugins[] = new DbCache_Plugin_Admin();
49
- $plugins[] = new LazyLoad_Plugin_Admin();
50
  $plugins[] = new ObjectCache_Plugin_Admin();
51
  $plugins[] = new PgCache_Plugin_Admin();
52
  $plugins[] = new Minify_Plugin_Admin();
32
  if ( $c->get_boolean( 'cdnfsd.enabled' ) )
33
  $plugins[] = new Cdnfsd_Plugin();
34
  if ( $c->get_boolean( 'lazyload.enabled' ) )
35
+ $plugins[] = new UserExperience_LazyLoad_Plugin();
36
  if ( $c->get_boolean( 'browsercache.enabled' ) )
37
  $plugins[] = new BrowserCache_Plugin();
38
  if ( $c->get_boolean( 'minify.enabled' ) )
46
  $plugins[] = new Generic_Plugin_Admin();
47
  $plugins[] = new BrowserCache_Plugin_Admin();
48
  $plugins[] = new DbCache_Plugin_Admin();
49
+ $plugins[] = new UserExperience_Plugin_Admin();
50
  $plugins[] = new ObjectCache_Plugin_Admin();
51
  $plugins[] = new PgCache_Plugin_Admin();
52
  $plugins[] = new Minify_Plugin_Admin();
UsageStatistics_Page.php CHANGED
@@ -50,7 +50,7 @@ class UsageStatistics_Page {
50
 
51
  $reader = new UsageStatistics_Source_DbQueriesLog( $timestamp_start,
52
  $sort_column );
53
- $items = $reader->list();
54
 
55
  $result = array(
56
  'date_min' =>
@@ -80,7 +80,7 @@ class UsageStatistics_Page {
80
 
81
  $reader = new UsageStatistics_Source_ObjectCacheLog( $timestamp_start,
82
  $sort_column );
83
- $items = $reader->list();
84
 
85
  $result = array(
86
  'date_min' =>
@@ -110,7 +110,7 @@ class UsageStatistics_Page {
110
 
111
  $reader = new UsageStatistics_Source_PageCacheLog( $timestamp_start,
112
  $_REQUEST['status'], $sort_column );
113
- $items = $reader->list();
114
 
115
  $result = array(
116
  'date_min' =>
50
 
51
  $reader = new UsageStatistics_Source_DbQueriesLog( $timestamp_start,
52
  $sort_column );
53
+ $items = $reader->list_entries();
54
 
55
  $result = array(
56
  'date_min' =>
80
 
81
  $reader = new UsageStatistics_Source_ObjectCacheLog( $timestamp_start,
82
  $sort_column );
83
+ $items = $reader->list_entries();
84
 
85
  $result = array(
86
  'date_min' =>
110
 
111
  $reader = new UsageStatistics_Source_PageCacheLog( $timestamp_start,
112
  $_REQUEST['status'], $sort_column );
113
+ $items = $reader->list_entries();
114
 
115
  $result = array(
116
  'date_min' =>
UsageStatistics_Source_DbQueriesLog.php CHANGED
@@ -26,7 +26,7 @@ class UsageStatistics_Source_DbQueriesLog {
26
  /**
27
  * Lists entries from log
28
  **/
29
- public function list() {
30
  $log_filename = Util_Debug::log_filename( 'dbcache-queries' );
31
  $h = @fopen( $log_filename, 'rb' );
32
  if ( !$h ) {
26
  /**
27
  * Lists entries from log
28
  **/
29
+ public function list_entries() {
30
  $log_filename = Util_Debug::log_filename( 'dbcache-queries' );
31
  $h = @fopen( $log_filename, 'rb' );
32
  if ( !$h ) {
UsageStatistics_Source_ObjectCacheLog.php CHANGED
@@ -26,7 +26,7 @@ class UsageStatistics_Source_ObjectCacheLog {
26
  /**
27
  * Lists entries from log
28
  **/
29
- public function list() {
30
  $log_filename = Util_Debug::log_filename( 'objectcache-calls' );
31
  $h = @fopen( $log_filename, 'rb' );
32
  if ( !$h ) {
26
  /**
27
  * Lists entries from log
28
  **/
29
+ public function list_entries() {
30
  $log_filename = Util_Debug::log_filename( 'objectcache-calls' );
31
  $h = @fopen( $log_filename, 'rb' );
32
  if ( !$h ) {
UsageStatistics_Source_PageCacheLog.php CHANGED
@@ -28,7 +28,7 @@ class UsageStatistics_Source_PageCacheLog {
28
  /**
29
  * Lists entries from log with specified cache reject reason code
30
  **/
31
- public function list() {
32
  $log_filename = Util_Debug::log_filename( 'pagecache' );
33
  $h = @fopen( $log_filename, 'rb' );
34
  if ( !$h ) {
28
  /**
29
  * Lists entries from log with specified cache reject reason code
30
  **/
31
+ public function list_entries() {
32
  $log_filename = Util_Debug::log_filename( 'pagecache' );
33
  $h = @fopen( $log_filename, 'rb' );
34
  if ( !$h ) {
UsageStatistics_Widget.php CHANGED
@@ -19,16 +19,7 @@ class UsageStatistics_Widget {
19
 
20
 
21
  public function init() {
22
- add_action( 'w3tc_widget_setup', array(
23
- $this,
24
- 'w3tc_widget_setup'
25
- ), 1000 );
26
- }
27
-
28
-
29
-
30
- public function w3tc_widget_setup() {
31
- Util_Widget::add( 'w3tc_usage_statistics',
32
  '<div class="w3tc-widget-w3tc-logo"></div>' .
33
  '<div class="w3tc-widget-text">' .
34
  __( 'Caching Statistics', 'w3-total-cache' ) .
19
 
20
 
21
  public function init() {
22
+ Util_Widget::add2( 'w3tc_usage_statistics', 1000,
 
 
 
 
 
 
 
 
 
23
  '<div class="w3tc-widget-w3tc-logo"></div>' .
24
  '<div class="w3tc-widget-text">' .
25
  __( 'Caching Statistics', 'w3-total-cache' ) .
UserExperience_Emoji_Extension.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace W3TC;
3
+
4
+ class UserExperience_Emoji_Extension {
5
+ public function run() {
6
+ remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
7
+ remove_action( 'wp_print_styles', 'print_emoji_styles' );
8
+ remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
9
+
10
+ remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
11
+ remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
12
+
13
+ remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
14
+ remove_action( 'admin_print_styles', 'print_emoji_styles' );
15
+
16
+ add_filter( 'tiny_mce_plugins', array( $this, 'tiny_mce_plugins' ) );
17
+ add_filter( 'wp_resource_hints',
18
+ array( $this, 'wp_resource_hints' ), 10, 2 );
19
+ }
20
+
21
+
22
+
23
+ public function tiny_mce_plugins( $plugins ) {
24
+ if ( !is_array( $plugins ) ) {
25
+ return array();
26
+ }
27
+
28
+ return array_filter( $plugins,
29
+ function( $v ) {
30
+ return $v != 'wpemoji';
31
+ }
32
+ );
33
+ }
34
+
35
+
36
+
37
+ public function wp_resource_hints( $urls, $relation_type ) {
38
+ if ( !is_array( $urls ) || $relation_type != 'dns-prefetch' ) {
39
+ return $urls;
40
+ }
41
+
42
+ // remove s.w.org dns-prefetch used by emojis
43
+ return array_filter( $urls,
44
+ function( $v ) {
45
+ return ( substr( $v, 0, 16) != 'https://s.w.org/' );
46
+ }
47
+ );
48
+ }
49
+ }
50
+
51
+
52
+
53
+ $o = new UserExperience_Emoji_Extension();
54
+ $o->run();
LazyLoad_GeneralPage.php → UserExperience_GeneralPage.php RENAMED
@@ -1,14 +1,12 @@
1
  <?php
2
  namespace W3TC;
3
 
4
-
5
-
6
- class LazyLoad_GeneralPage {
7
  /**
8
  * W3TC General settings page modifications
9
  */
10
  static public function admin_init_w3tc_general() {
11
- $o = new LazyLoad_GeneralPage();
12
 
13
  add_filter( 'w3tc_settings_general_anchors',
14
  array( $o, 'w3tc_settings_general_anchors' ) );
@@ -29,6 +27,6 @@ class LazyLoad_GeneralPage {
29
  public function w3tc_settings_general_boxarea_userexperience() {
30
  $config = Dispatcher::config();
31
 
32
- include W3TC_DIR . '/LazyLoad_GeneralPage_View.php';
33
  }
34
  }
1
  <?php
2
  namespace W3TC;
3
 
4
+ class UserExperience_GeneralPage {
 
 
5
  /**
6
  * W3TC General settings page modifications
7
  */
8
  static public function admin_init_w3tc_general() {
9
+ $o = new UserExperience_GeneralPage();
10
 
11
  add_filter( 'w3tc_settings_general_anchors',
12
  array( $o, 'w3tc_settings_general_anchors' ) );
27
  public function w3tc_settings_general_boxarea_userexperience() {
28
  $config = Dispatcher::config();
29
 
30
+ include W3TC_DIR . '/UserExperience_GeneralPage_View.php';
31
  }
32
  }
UserExperience_GeneralPage_View.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace W3TC;
3
+
4
+ if ( !defined( 'W3TC' ) )
5
+ die();
6
+
7
+ ?>
8
+ <?php
9
+ Util_Ui::postbox_header( __( 'User Experience', 'w3-total-cache' ), '', 'userexperience' );
10
+ Util_Ui::config_overloading_button( array(
11
+ 'key' => 'lazyload.configuration_overloaded'
12
+ ) );
13
+ ?>
14
+
15
+ <table class="form-table">
16
+ <?php
17
+ Util_Ui::config_item( array(
18
+ 'key' => 'lazyload.enabled',
19
+ 'control' => 'checkbox',
20
+ 'checkbox_label' => __( 'Lazy Loading', 'w3-total-cache' ),
21
+ 'description' => __( 'Defer loading offscreen images.',
22
+ 'w3-total-cache' )
23
+ ) );
24
+ ?>
25
+ <?php
26
+ Util_Ui::config_item_extension_enabled( array(
27
+ 'extension_id' => 'user-experience-emoji',
28
+ 'checkbox_label' => __( 'Disable Emoji', 'w3-total-cache' ),
29
+ 'description' => __( 'Remove emojis support from your website.',
30
+ 'w3-total-cache' )
31
+ ) );
32
+ ?>
33
+ <?php
34
+ Util_Ui::config_item_extension_enabled( array(
35
+ 'extension_id' => 'user-experience-oembed',
36
+ 'checkbox_label' => __( 'Disable wp-embed script', 'w3-total-cache' ),
37
+ 'description' => __( 'Remove wp-embed.js script from your website. oEmbed functionality still works but you will not be able to embed other WordPress posts on your pages.',
38
+ 'w3-total-cache' )
39
+ ) );
40
+ ?>
41
+ </table>
42
+
43
+ <?php Util_Ui::button_config_save( 'general_userexperience' ); ?>
44
+ <?php Util_Ui::postbox_footer(); ?>
LazyLoad_Mutator.php → UserExperience_LazyLoad_Mutator.php RENAMED
@@ -1,9 +1,7 @@
1
  <?php
2
  namespace W3TC;
3
 
4
-
5
-
6
- class LazyLoad_Mutator {
7
  private $config;
8
  private $modified = false;
9
  private $excludes;
@@ -22,7 +20,7 @@ class LazyLoad_Mutator {
22
  $this->excludes = apply_filters( 'w3tc_lazyload_excludes',
23
  $this->config->get_array( 'lazyload.exclude' ) );
24
 
25
- $unmutable = new LazyLoad_Mutator_Unmutable();
26
  $buffer = $unmutable->remove_unmutable( $buffer );
27
 
28
  if ( $this->config->get_boolean( 'lazyload.process_img' ) ) {
@@ -63,7 +61,7 @@ class LazyLoad_Mutator {
63
  return $content;
64
  }
65
 
66
- $m = new LazyLoad_Mutator_Picture( $this );
67
  return $m->run( $content );
68
  }
69
 
1
  <?php
2
  namespace W3TC;
3
 
4
+ class UserExperience_LazyLoad_Mutator {
 
 
5
  private $config;
6
  private $modified = false;
7
  private $excludes;
20
  $this->excludes = apply_filters( 'w3tc_lazyload_excludes',
21
  $this->config->get_array( 'lazyload.exclude' ) );
22
 
23
+ $unmutable = new UserExperience_LazyLoad_Mutator_Unmutable();
24
  $buffer = $unmutable->remove_unmutable( $buffer );
25
 
26
  if ( $this->config->get_boolean( 'lazyload.process_img' ) ) {
61
  return $content;
62
  }
63
 
64
+ $m = new UserExperience_LazyLoad_Mutator_Picture( $this );
65
  return $m->run( $content );
66
  }
67
 
LazyLoad_Mutator_Picture.php → UserExperience_LazyLoad_Mutator_Picture.php RENAMED
@@ -1,9 +1,7 @@
1
  <?php
2
  namespace W3TC;
3
 
4
-
5
-
6
- class LazyLoad_Mutator_Picture {
7
  private $common;
8
 
9
 
1
  <?php
2
  namespace W3TC;
3
 
4
+ class UserExperience_LazyLoad_Mutator_Picture {
 
 
5
  private $common;
6
 
7
 
LazyLoad_Mutator_Unmutable.php → UserExperience_LazyLoad_Mutator_Unmutable.php RENAMED
@@ -1,9 +1,7 @@
1
  <?php
2
  namespace W3TC;
3
 
4
-
5
-
6
- class LazyLoad_Mutator_Unmutable {
7
  private $placeholders = array();
8
 
9
 
1
  <?php
2
  namespace W3TC;
3
 
4
+ class UserExperience_LazyLoad_Mutator_Unmutable {
 
 
5
  private $placeholders = array();
6
 
7
 
UserExperience_LazyLoad_Page_View.php ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace W3TC;
3
+
4
+ if ( !defined( 'W3TC' ) )
5
+ die();
6
+
7
+ ?>
8
+ <?php Util_Ui::postbox_header( __( 'Lazy Loading', 'w3-total-cache' ), '', 'application' ); ?>
9
+ <table class="form-table">
10
+ <?php
11
+ Util_Ui::config_item( array(
12
+ 'key' => 'lazyload.process_img',
13
+ 'control' => 'checkbox',
14
+ 'checkbox_label' => __( 'Process HTML image tags', 'w3-total-cache' ),
15
+ 'description' => __( 'Process <code>img</code> tags',
16
+ 'w3-total-cache' )
17
+ ) );
18
+
19
+ Util_Ui::config_item( array(
20
+ 'key' => 'lazyload.process_background',
21
+ 'control' => 'checkbox',
22
+ 'checkbox_label' => __( 'Process background images', 'w3-total-cache' ),
23
+ 'description' => __( 'Process <code>background</code> styles',
24
+ 'w3-total-cache' )
25
+ ) );
26
+
27
+ Util_Ui::config_item( array(
28
+ 'key' => 'lazyload.exclude',
29
+ 'label' => 'Exclude words:',
30
+ 'control' => 'textarea',
31
+ 'description' => __( 'Exclude tags containing words',
32
+ 'w3-total-cache' )
33
+ ) );
34
+
35
+ Util_Ui::config_item( array(
36
+ 'key' => 'lazyload.embed_method',
37
+ 'label' => __( 'Script Embed method:', 'w3-total-cache' ),
38
+ 'control' => 'selectbox',
39
+ 'selectbox_values' => array(
40
+ 'async_head' => 'async',
41
+ 'sync_head' => 'sync (to head)',
42
+ 'inline_footer' => 'inline'
43
+ ),
44
+ 'description' => 'Use <code>inline</code> method only when your website has just a few pages'
45
+ )
46
+ );
47
+ ?>
48
+ </table>
49
+ <p class="submit">
50
+ <?php Util_Ui::button_config_save( 'lazyload' ); ?>
51
+ </p>
52
+
53
+ <?php Util_Ui::postbox_footer(); ?>
LazyLoad_Plugin.php → UserExperience_LazyLoad_Plugin.php RENAMED
@@ -1,9 +1,7 @@
1
  <?php
2
  namespace W3TC;
3
 
4
-
5
-
6
- class LazyLoad_Plugin {
7
  private $config;
8
  private $posts_by_url = array();
9
 
@@ -57,7 +55,7 @@ class LazyLoad_Plugin {
57
  return $buffer;
58
  }
59
 
60
- $mutator = new LazyLoad_Mutator( $this->config, $this->posts_by_url );
61
  $buffer = $mutator->run( $buffer );
62
 
63
  // embed lazyload script
1
  <?php
2
  namespace W3TC;
3
 
4
+ class UserExperience_LazyLoad_Plugin {
 
 
5
  private $config;
6
  private $posts_by_url = array();
7
 
55
  return $buffer;
56
  }
57
 
58
+ $mutator = new UserExperience_LazyLoad_Mutator( $this->config, $this->posts_by_url );
59
  $buffer = $mutator->run( $buffer );
60
 
61
  // embed lazyload script
UserExperience_OEmbed_Extension.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace W3TC;
3
+
4
+ class UserExperience_OEmbed_Extension {
5
+ public function run() {
6
+ add_action( 'wp_footer', array( $this, 'wp_footer' ) );
7
+ }
8
+
9
+
10
+
11
+ public function wp_footer() {
12
+ wp_deregister_script( 'wp-embed' );
13
+ }
14
+ }
15
+
16
+
17
+
18
+ $o = new UserExperience_OEmbed_Extension();
19
+ $o->run();
LazyLoad_Page.php → UserExperience_Page.php RENAMED
@@ -1,11 +1,9 @@
1
  <?php
2
  namespace W3TC;
3
 
4
-
5
-
6
- class LazyLoad_Page {
7
  public function render_content() {
8
  $c = Dispatcher::config();
9
- include W3TC_DIR . '/LazyLoad_Page_View.php';
10
  }
11
  }
1
  <?php
2
  namespace W3TC;
3
 
4
+ class UserExperience_Page {
 
 
5
  public function render_content() {
6
  $c = Dispatcher::config();
7
+ include W3TC_DIR . '/UserExperience_Page_View.php';
8
  }
9
  }
UserExperience_Page_View.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace W3TC;
3
+
4
+ if ( !defined( 'W3TC' ) )
5
+ die();
6
+
7
+ ?>
8
+ <p>
9
+ Lazy loading is currently
10
+ <?php if ( $c->get_boolean( 'lazyload.enabled' ) ): ?>
11
+ <span class="w3tc-enabled">enabled</span>
12
+ <?php else: ?>
13
+ <span class="w3tc-disabled">disabled</span>
14
+ <?php endif ?>
15
+ .
16
+ <p>
17
+
18
+ <form action="admin.php?page=w3tc_userexperience" method="post">
19
+ <div class="metabox-holder">
20
+ <?php /* decouple it when too much */ ?>
21
+ <?php include W3TC_DIR . '/UserExperience_LazyLoad_Page_View.php' ?>
22
+ </div>
23
+ </form>
UserExperience_Plugin_Admin.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace W3TC;
3
+
4
+ class UserExperience_Plugin_Admin {
5
+ function run() {
6
+ add_filter( 'w3tc_admin_menu', array( $this, 'w3tc_admin_menu' ) );
7
+ add_action( 'w3tc_settings_page-w3tc_userexperience',
8
+ array( $this, 'w3tc_settings_page_w3tc_userexperience' ) );
9
+ add_action( 'admin_init_w3tc_general',
10
+ array( '\W3TC\UserExperience_GeneralPage', 'admin_init_w3tc_general' ) );
11
+ add_filter( 'w3tc_extensions', array(
12
+ '\W3TC\UserExperience_Plugin_Admin',
13
+ 'w3tc_extensions' ),
14
+ 10, 2 );
15
+
16
+ }
17
+
18
+
19
+
20
+ public function w3tc_admin_menu( $menu ) {
21
+ $c = Dispatcher::config();
22
+
23
+ $menu['w3tc_userexperience'] = array(
24
+ 'page_title' => __( 'User Experience', 'w3-total-cache' ),
25
+ 'menu_text' => __( 'User Experience', 'w3-total-cache' ),
26
+ 'visible_always' => false,
27
+ 'order' => 1200
28
+ );
29
+
30
+ return $menu;
31
+ }
32
+
33
+
34
+
35
+ static public function w3tc_extensions( $extensions, $config ) {
36
+ $extensions['user-experience-emoji'] = array(
37
+ 'public' => false,
38
+ 'extension_id' => 'user-experience-emoji',
39
+ 'path' => 'w3-total-cache/UserExperience_Emoji_Extension.php'
40
+ );
41
+ $extensions['user-experience-oembed'] = array(
42
+ 'public' => false,
43
+ 'extension_id' => 'user-experience-oembed',
44
+ 'path' => 'w3-total-cache/UserExperience_OEmbed_Extension.php'
45
+ );
46
+
47
+ return $extensions;
48
+ }
49
+
50
+
51
+
52
+ public function w3tc_settings_page_w3tc_userexperience() {
53
+ $v = new UserExperience_Page();
54
+ $v->render_content();
55
+ }
56
+ }
Util_Environment.php CHANGED
@@ -1038,7 +1038,7 @@ class Util_Environment {
1038
  return $post_ID;
1039
  } elseif ( $comment_post_ID ) {
1040
  return $comment_post_ID;
1041
- } elseif ( ( is_single() || is_page() ) && isset( $posts[0]->ID ) ) {
1042
  return $posts[0]->ID;
1043
  } elseif ( isset( $posts->ID ) ) {
1044
  return $posts->ID;
1038
  return $post_ID;
1039
  } elseif ( $comment_post_ID ) {
1040
  return $comment_post_ID;
1041
+ } elseif ( ( is_single() || is_page() ) && is_array( $posts ) && isset( $posts[0]->ID ) ) {
1042
  return $posts[0]->ID;
1043
  } elseif ( isset( $posts->ID ) ) {
1044
  return $posts->ID;
Util_Ui.php CHANGED
@@ -491,7 +491,7 @@ class Util_Ui {
491
  echo '</label>' . $postfix . "\n";
492
  if ( $pro_feature ) {
493
  Util_Ui::pro_wrap_description( $label_or_array['pro_excerpt'],
494
- $label_or_array['pro_description'] );
495
 
496
  Util_Ui::pro_wrap_maybe_end( $name . '__' . $key );
497
  }
@@ -750,6 +750,26 @@ class Util_Ui {
750
 
751
 
752
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
753
  static public function config_item_pro( $a ) {
754
  $a = Util_Ui::config_item_preprocess( $a );
755
 
@@ -771,7 +791,7 @@ class Util_Ui {
771
  echo $a['control_after'];
772
  }
773
 
774
- Util_Ui::pro_wrap_description( $a['excerpt'], $a['description'] );
775
  Util_Ui::pro_wrap_maybe_end( $a['control_name'] );
776
 
777
  if ( $a['label_class'] != 'w3tc_no_trtd' ) {
@@ -889,7 +909,7 @@ class Util_Ui {
889
 
890
 
891
 
892
- static public function pro_wrap_description( $excerpt, $description ) {
893
  echo '<p class="description w3tc-gopro-excerpt">' . $excerpt . '</p>';
894
 
895
  if ( !empty( $description ) ) {
@@ -901,7 +921,7 @@ class Util_Ui {
901
  );
902
 
903
  echo '<div class="w3tc-gopro-description">' . implode( "\n", $d ) . '</div>';
904
- echo '<a href="#" class="w3tc-gopro-more">Show More <span class="dashicons dashicons-arrow-down-alt2"></span></a>';
905
  }
906
  }
907
 
491
  echo '</label>' . $postfix . "\n";
492
  if ( $pro_feature ) {
493
  Util_Ui::pro_wrap_description( $label_or_array['pro_excerpt'],
494
+ $label_or_array['pro_description'], $name . '__' . $key );
495
 
496
  Util_Ui::pro_wrap_maybe_end( $name . '__' . $key );
497
  }
750
 
751
 
752
 
753
+ static public function config_item_extension_enabled( $a ) {
754
+ echo "<tr><th class=''></th>\n<td>\n";
755
+
756
+ $c = Dispatcher::config();
757
+ Util_Ui::checkbox2( array(
758
+ 'name' => 'extension__' . Util_Ui::config_key_to_http_name( $a['extension_id'] ),
759
+ 'value' => $c->is_extension_active_frontend( $a['extension_id'] ),
760
+ 'label' => $a['checkbox_label']
761
+ ) );
762
+
763
+ if ( isset( $a['description'] ) ) {
764
+ echo '<p class="description">' . $a['description'] . '</p>';
765
+ }
766
+
767
+ echo "</td>";
768
+ echo "</tr>\n";
769
+ }
770
+
771
+
772
+
773
  static public function config_item_pro( $a ) {
774
  $a = Util_Ui::config_item_preprocess( $a );
775
 
791
  echo $a['control_after'];
792
  }
793
 
794
+ Util_Ui::pro_wrap_description( $a['excerpt'], $a['description'], $a['control_name'] );
795
  Util_Ui::pro_wrap_maybe_end( $a['control_name'] );
796
 
797
  if ( $a['label_class'] != 'w3tc_no_trtd' ) {
909
 
910
 
911
 
912
+ static public function pro_wrap_description( $excerpt, $description, $data_href ) {
913
  echo '<p class="description w3tc-gopro-excerpt">' . $excerpt . '</p>';
914
 
915
  if ( !empty( $description ) ) {
921
  );
922
 
923
  echo '<div class="w3tc-gopro-description">' . implode( "\n", $d ) . '</div>';
924
+ echo '<a href="#" class="w3tc-gopro-more" data-href="w3tc-gopro-more-' . $data_href . '">Show More <span class="dashicons dashicons-arrow-down-alt2"></span></a>';
925
  }
926
  }
927
 
Util_Widget.php CHANGED
@@ -2,6 +2,8 @@
2
  namespace W3TC;
3
 
4
  class Util_Widget {
 
 
5
  /**
6
  * Registers dashboard widgets.
7
  *
@@ -48,11 +50,32 @@ class Util_Widget {
48
  do_action( 'do_meta_boxes', $screen->id, 'side', '' );
49
  }
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  /**
52
  * Registers widget
53
  */
54
  static public function add( $widget_id, $widget_name, $callback,
55
- $control_callback = null, $location = 'normal', $header_text = null, $header_class = '') {
 
56
  $screen = get_current_screen();
57
  global $w3tc_dashboard_control_callbacks;
58
 
@@ -103,7 +126,6 @@ class Util_Widget {
103
  add_meta_box( $widget_id, $widget_name, $callback, $screen, $location, $priority );
104
  }
105
 
106
-
107
  /* Dashboard Widgets Controls */
108
  static public function _dashboard_control_callback( $dashboard, $meta_box ) {
109
  echo '<form action="" method="post" class="dashboard-widget-control-form">';
@@ -114,6 +136,10 @@ class Util_Widget {
114
  echo '</form>';
115
  }
116
 
 
 
 
 
117
  /**
118
  * Calls widget control callback.
119
  *
@@ -129,3 +155,26 @@ class Util_Widget {
129
  }
130
  }
131
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  namespace W3TC;
3
 
4
  class Util_Widget {
5
+ static $w3tc_dashboard_widgets = array();
6
+
7
  /**
8
  * Registers dashboard widgets.
9
  *
50
  do_action( 'do_meta_boxes', $screen->id, 'side', '' );
51
  }
52
 
53
+ static public function add2( $widget_id, $priority, $widget_name, $callback,
54
+ $control_callback = null, $location = 'normal', $header_text = null,
55
+ $header_class = '') {
56
+ $o = new _Util_Widget_Postponed( array(
57
+ 'widget_id' => $widget_id,
58
+ 'widget_name' => $widget_name,
59
+ 'callback' => $callback,
60
+ 'control_callback' => $control_callback,
61
+ 'location' => $location,
62
+ 'header_text' => $header_text,
63
+ 'header_class' => $header_class
64
+ ) );
65
+
66
+ add_action( 'w3tc_widget_setup',
67
+ array( $o, 'wp_dashboard_setup' ), $priority );
68
+ add_action( 'w3tc_network_dashboard_setup',
69
+ array( $o, 'wp_dashboard_setup' ), $priority );
70
+ self::$w3tc_dashboard_widgets[$widget_id] = '*';
71
+ }
72
+
73
  /**
74
  * Registers widget
75
  */
76
  static public function add( $widget_id, $widget_name, $callback,
77
+ $control_callback = null, $location = 'normal', $header_text = null,
78
+ $header_class = '') {
79
  $screen = get_current_screen();
80
  global $w3tc_dashboard_control_callbacks;
81
 
126
  add_meta_box( $widget_id, $widget_name, $callback, $screen, $location, $priority );
127
  }
128
 
 
129
  /* Dashboard Widgets Controls */
130
  static public function _dashboard_control_callback( $dashboard, $meta_box ) {
131
  echo '<form action="" method="post" class="dashboard-widget-control-form">';
136
  echo '</form>';
137
  }
138
 
139
+ static public function list_widgets() {
140
+ return implode(',', array_keys(self::$w3tc_dashboard_widgets));
141
+ }
142
+
143
  /**
144
  * Calls widget control callback.
145
  *
155
  }
156
  }
157
  }
158
+
159
+
160
+
161
+ class _Util_Widget_Postponed {
162
+ private $data = array();
163
+
164
+ public function __construct( $data ) {
165
+ $this->data = $data;
166
+ }
167
+
168
+
169
+ public function wp_dashboard_setup() {
170
+ Util_Widget::add(
171
+ $this->data['widget_id'],
172
+ $this->data['widget_name'],
173
+ $this->data['callback'],
174
+ $this->data['control_callback'],
175
+ $this->data['location'],
176
+ $this->data['header_text'],
177
+ $this->data['header_class']
178
+ );
179
+ }
180
+ }
inc/options/browsercache.php CHANGED
File without changes
inc/options/extensions/list.php CHANGED
@@ -57,6 +57,10 @@ $cb_id = 0;
57
  foreach ( $extension_keys as $extension ):
58
  $meta = $extensions[$extension];
59
  $meta = $this->default_meta( $meta );
 
 
 
 
60
  $cb_id++;
61
  ?>
62
  <?php do_action( "w3tc_extension_before_row-{$extension}" ) ?>
@@ -114,7 +118,7 @@ if ( $links ) {
114
  <p>
115
  <?php if ( isset( $meta['pro_feature'] ) && $meta['pro_feature'] ): ?>
116
  <?php Util_Ui::pro_wrap_maybe_start() ?>
117
- <?php Util_Ui::pro_wrap_description( $meta['pro_excerpt'], $meta['pro_description'] ) ?>
118
  <?php Util_Ui::pro_wrap_maybe_end( "extension_$extension" ) ?>
119
  <?php else: ?>
120
  <?php _e( $meta['description'] ) ?>
57
  foreach ( $extension_keys as $extension ):
58
  $meta = $extensions[$extension];
59
  $meta = $this->default_meta( $meta );
60
+ if (!$meta['public']) {
61
+ continue;
62
+ }
63
+
64
  $cb_id++;
65
  ?>
66
  <?php do_action( "w3tc_extension_before_row-{$extension}" ) ?>
118
  <p>
119
  <?php if ( isset( $meta['pro_feature'] ) && $meta['pro_feature'] ): ?>
120
  <?php Util_Ui::pro_wrap_maybe_start() ?>
121
+ <?php Util_Ui::pro_wrap_description( $meta['pro_excerpt'], $meta['pro_description'], 'extension-' .$extension ) ?>
122
  <?php Util_Ui::pro_wrap_maybe_end( "extension_$extension" ) ?>
123
  <?php else: ?>
124
  <?php _e( $meta['description'] ) ?>
inc/options/general.php CHANGED
@@ -548,7 +548,8 @@ Util_Ui::config_item( array(
548
  __( 'Purge Logs provide information on when your cache has been purged and what triggered it.', 'w3-total-cache' ),
549
  array(
550
  __( 'If you are troubleshooting a complex issue in which you are not sure why your cache is being cleared, Purge Logs can tell you why', 'w3-total-cache' )
551
- )
 
552
  );
553
  ?>
554
  <?php \W3TC\Util_Ui::pro_wrap_maybe_end( 'debug_purge' ) ?>
548
  __( 'Purge Logs provide information on when your cache has been purged and what triggered it.', 'w3-total-cache' ),
549
  array(
550
  __( 'If you are troubleshooting a complex issue in which you are not sure why your cache is being cleared, Purge Logs can tell you why', 'w3-total-cache' )
551
+ ),
552
+ 'general-purge-log'
553
  );
554
  ?>
555
  <?php \W3TC\Util_Ui::pro_wrap_maybe_end( 'debug_purge' ) ?>
inc/options/pgcache.php CHANGED
@@ -394,6 +394,7 @@ if ( $this->_config->get_string( 'pgcache.engine' ) == 'memcached' ||
394
  <th><label for="pgcache_reject_uri"><?php Util_Ui::e_config_label( 'pgcache.reject.uri' ) ?></label></th>
395
  <td>
396
  <textarea id="pgcache_reject_uri" name="pgcache__reject__uri"
 
397
  <?php Util_Ui::sealing_disabled( 'pgcache.' ) ?>
398
  cols="40" rows="5"><?php echo esc_textarea( implode( "\r\n", $this->_config->get_array( 'pgcache.reject.uri' ) ) ); ?></textarea>
399
  <p class="description">
@@ -447,6 +448,7 @@ if ( $this->_config->get_string( 'pgcache.engine' ) == 'memcached' ||
447
  <th><label for="pgcache_accept_files"><?php Util_Ui::e_config_label( 'pgcache.accept.files' ) ?></label></th>
448
  <td>
449
  <textarea id="pgcache_accept_files" name="pgcache__accept__files"
 
450
  <?php Util_Ui::sealing_disabled( 'pgcache.' ) ?>
451
  cols="40" rows="5"><?php echo esc_textarea( implode( "\r\n", $this->_config->get_array( 'pgcache.accept.files' ) ) ); ?></textarea>
452
  <p class="description"><?php echo sprintf( __( 'Cache the specified pages / directories even if listed in the "never cache the following pages" field. Supports regular expression (See <a href="%s"><acronym title="Frequently Asked Questions">FAQ</acronym></a>)', 'w3-total-cache' ), network_admin_url( 'admin.php?page=w3tc_faq' ) ); ?></p>
@@ -457,6 +459,7 @@ if ( $this->_config->get_string( 'pgcache.engine' ) == 'memcached' ||
457
  <th><label for="pgcache_accept_uri"><?php Util_Ui::e_config_label( 'pgcache.accept.uri' ) ?></label></th>
458
  <td>
459
  <textarea id="pgcache_accept_uri" name="pgcache__accept__uri"
 
460
  <?php Util_Ui::sealing_disabled( 'pgcache.' ) ?>
461
  cols="40" rows="5"><?php echo esc_textarea( implode( "\r\n", $this->_config->get_array( 'pgcache.accept.uri' ) ) ); ?></textarea>
462
  <p class="description"><?php _e( 'Cache the specified pages even if they don\'t have tailing slash.', 'w3-total-cache' ); ?></p>
394
  <th><label for="pgcache_reject_uri"><?php Util_Ui::e_config_label( 'pgcache.reject.uri' ) ?></label></th>
395
  <td>
396
  <textarea id="pgcache_reject_uri" name="pgcache__reject__uri"
397
+ w3tc-data-validator="regexps"
398
  <?php Util_Ui::sealing_disabled( 'pgcache.' ) ?>
399
  cols="40" rows="5"><?php echo esc_textarea( implode( "\r\n", $this->_config->get_array( 'pgcache.reject.uri' ) ) ); ?></textarea>
400
  <p class="description">
448
  <th><label for="pgcache_accept_files"><?php Util_Ui::e_config_label( 'pgcache.accept.files' ) ?></label></th>
449
  <td>
450
  <textarea id="pgcache_accept_files" name="pgcache__accept__files"
451
+ w3tc-data-validator="regexps"
452
  <?php Util_Ui::sealing_disabled( 'pgcache.' ) ?>
453
  cols="40" rows="5"><?php echo esc_textarea( implode( "\r\n", $this->_config->get_array( 'pgcache.accept.files' ) ) ); ?></textarea>
454
  <p class="description"><?php echo sprintf( __( 'Cache the specified pages / directories even if listed in the "never cache the following pages" field. Supports regular expression (See <a href="%s"><acronym title="Frequently Asked Questions">FAQ</acronym></a>)', 'w3-total-cache' ), network_admin_url( 'admin.php?page=w3tc_faq' ) ); ?></p>
459
  <th><label for="pgcache_accept_uri"><?php Util_Ui::e_config_label( 'pgcache.accept.uri' ) ?></label></th>
460
  <td>
461
  <textarea id="pgcache_accept_uri" name="pgcache__accept__uri"
462
+ w3tc-data-validator="regexps"
463
  <?php Util_Ui::sealing_disabled( 'pgcache.' ) ?>
464
  cols="40" rows="5"><?php echo esc_textarea( implode( "\r\n", $this->_config->get_array( 'pgcache.accept.uri' ) ) ); ?></textarea>
465
  <p class="description"><?php _e( 'Cache the specified pages even if they don\'t have tailing slash.', 'w3-total-cache' ); ?></p>
lib/OAuth/W3tcOAuth.php CHANGED
@@ -92,17 +92,7 @@ abstract class W3tcOAuthSignatureMethod {
92
  return false;
93
  }
94
 
95
- if (strlen($built) != strlen($signature)) {
96
- return false;
97
- }
98
-
99
- // Avoid a timing leak with a (hopefully) time insensitive compare
100
- $result = 0;
101
- for ($i = 0; $i < strlen($signature); $i++) {
102
- $result |= ord($built{$i}) ^ ord($signature{$i});
103
- }
104
-
105
- return $result == 0;
106
  }
107
  }
108
 
92
  return false;
93
  }
94
 
95
+ return $built == $signature;
 
 
 
 
 
 
 
 
 
 
96
  }
97
  }
98
 
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/list-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