From 218272bbcbba3e25602ef3dc93aa258b10cd5fe8 Mon Sep 17 00:00:00 2001 From: Lai Power Date: Thu, 28 Mar 2024 09:40:06 +0000 Subject: [PATCH] updated plugin `W3 Total Cache` version 2.7.0 --- .../BrowserCache_ConfigLabels.php | 4 +- .../BrowserCache_Environment_Nginx.php | 4 +- .../w3-total-cache/CacheFlush_Locally.php | 5 +- .../CacheGroups_Plugin_Admin.php | 34 +- .../w3-total-cache/Cache_Memcached.php | 2 +- .../w3-total-cache/Cdn_BunnyCdn_Page_View.js | 1 - .../w3-total-cache/Cdn_BunnyCdn_Widget.php | 2 +- .../Cdn_GoogleDrive_Page_View.js | 3 + .../w3-total-cache/Cdn_Highwinds_Page_View.js | 1 - .../w3-total-cache/Cdn_Highwinds_Widget.php | 105 ---- .../Cdn_Highwinds_Widget_View.css | 15 - .../Cdn_Highwinds_Widget_View.js | 45 -- .../Cdn_Highwinds_Widget_View.php | 60 --- ...dn_Highwinds_Widget_View_NotConfigured.php | 28 - .../w3-total-cache/Cdn_LimeLight_Page_View.js | 1 - .../w3-total-cache/Cdn_LimeLight_Popup.php | 2 +- .../w3-total-cache/Cdn_Plugin_Admin.php | 11 +- .../Cdn_RackSpaceCdn_Page_View.js | 1 - .../Cdn_RackSpaceCloudFiles_Page_View.js | 1 - .../Cdn_StackPath2_Page_View.js | 1 - .../w3-total-cache/Cdn_StackPath2_Widget.php | 125 ----- .../Cdn_StackPath2_Widget_View.css | 78 --- .../Cdn_StackPath2_Widget_View.js | 46 -- .../Cdn_StackPath2_Widget_View_Authorized.php | 59 -- ...dn_StackPath2_Widget_View_Unauthorized.php | 65 --- .../w3-total-cache/Cdn_StackPath_Page_View.js | 1 - .../w3-total-cache/Cdn_StackPath_Widget.php | 141 ----- .../Cdn_StackPath_Widget_View.css | 98 ---- .../Cdn_StackPath_Widget_View.js | 62 --- .../Cdn_StackPath_Widget_View_Authorized.php | 93 ---- ...Cdn_StackPath_Widget_View_Unauthorized.php | 42 -- .../Cdnfsd_BunnyCdn_Page_View.js | 1 - .../Cdnfsd_CloudFront_Page_View.js | 1 - .../plugins/w3-total-cache/Cdnfsd_Core.php | 2 +- .../Cdnfsd_LimeLight_Page_View.js | 1 - .../Cdnfsd_StackPath2_Page_View.js | 1 - .../Cdnfsd_StackPath_Page_View.js | 1 - .../plugins/w3-total-cache/ConfigKeys.php | 4 - .../Extension_CloudFlare_Page_View.js | 1 - .../Extension_CloudFlare_Widget.php | 2 +- .../Extension_ImageService_Widget.js | 185 +++++++ .../Extension_ImageService_Widget.php | 118 ++++ .../Extension_ImageService_Widget_View.php | 52 ++ .../Extension_NewRelic_Popup_View.js | 3 + .../Extension_NewRelic_Widget.php | 5 +- .../Extension_Swarmify_Plugin_Admin.php | 4 - .../Extension_Swarmify_Widget.php | 237 -------- .../Extension_Swarmify_Widget_View.css | 33 -- ...ion_Swarmify_Widget_View_NotConfigured.php | 17 - .../w3-total-cache/Extensions_Page.php | 37 +- .../FeatureShowcase_Plugin_Admin.php | 18 + .../FeatureShowcase_Plugin_Admin_View.php | 5 +- .../Generic_GeneralPage_View_ShowEdge.js | 5 +- .../Generic_GeneralPage_View_ShowSupportUs.js | 1 + .../Generic_Page_Dashboard_View.css | 335 ++++++++---- .../w3-total-cache/Generic_Page_Install.php | 1 + .../plugins/w3-total-cache/Generic_Plugin.php | 1 + .../w3-total-cache/Generic_Plugin_Admin.php | 31 +- .../Generic_Plugin_WidgetForum.php | 151 ------ .../Generic_Plugin_WidgetNews.php | 155 ------ .../w3-total-cache/Generic_WidgetAccount.php | 58 ++ .../Generic_WidgetAccount_View.php | 77 +++ .../w3-total-cache/Generic_WidgetBoldGrid.php | 2 +- .../Generic_WidgetCommunity.php | 53 -- .../Generic_WidgetCommunity_View.php | 40 -- .../w3-total-cache/Generic_WidgetPartners.php | 58 ++ .../Generic_WidgetPartners_View.php | 37 ++ .../w3-total-cache/Generic_WidgetServices.php | 6 +- .../w3-total-cache/Generic_WidgetSettings.php | 56 ++ .../Generic_WidgetSettings_View.php | 98 ++++ .../Generic_WidgetSpreadTheWord_Plugin.php | 12 +- .../w3-total-cache/Generic_WidgetStats.js | 110 ++++ .../w3-total-cache/Generic_WidgetStats.php | 170 ++++++ .../plugins/w3-total-cache/Minify_Core.php | 51 +- .../Minify_GeneralPage_View_ShowHelp.js | 27 +- .../Minify_MinifiedFileRequestHandler.php | 22 +- .../w3-total-cache/Minify_Plugin_Admin.php | 8 +- .../plugins/w3-total-cache/PageSpeed_Data.php | 504 +++++++++--------- .../w3-total-cache/PageSpeed_Instructions.php | 25 +- .../plugins/w3-total-cache/PageSpeed_Page.php | 2 +- .../w3-total-cache/PageSpeed_Widget.php | 26 +- .../w3-total-cache/PageSpeed_Widget_View.css | 30 +- .../w3-total-cache/PageSpeed_Widget_View.js | 1 - .../PageSpeed_Widget_View_FromApi.php | 12 +- .../plugins/w3-total-cache/Root_Loader.php | 7 +- .../w3-total-cache/UsageStatistics_Page.php | 7 +- .../UsageStatistics_Plugin_Admin.php | 8 - .../w3-total-cache/UsageStatistics_Widget.php | 55 -- .../UsageStatistics_Widget_View.js | 208 -------- .../UsageStatistics_Widget_View.php | 55 -- .../UsageStatistics_Widget_View_Disabled.php | 37 -- .../UserExperience_DeferScripts_Extension.php | 4 +- .../UserExperience_DeferScripts_Page_View.php | 2 +- .../UserExperience_GeneralPage_View.php | 35 +- .../UserExperience_LazyLoad_Mutator.php | 2 +- ...rExperience_LazyLoad_Mutator_Unmutable.php | 2 +- .../UserExperience_Plugin_Admin.php | 26 +- ...rExperience_Preload_Requests_Extension.php | 8 +- ...rExperience_Preload_Requests_Page_View.php | 81 +-- .../UserExperience_Remove_CssJs_Extension.php | 254 +++++++++ .../UserExperience_Remove_CssJs_Mutator.php | 167 ++++++ .../UserExperience_Remove_CssJs_Page_View.js | 83 +++ .../UserExperience_Remove_CssJs_Page_View.php | 89 ++++ .../plugins/w3-total-cache/Util_Installed.php | 29 +- .../plugins/w3-total-cache/Util_PageSpeed.php | 56 +- .../plugins/w3-total-cache/Util_PageUrls.php | 10 +- wp-content/plugins/w3-total-cache/Util_Ui.php | 17 +- .../w3-total-cache/inc/lightbox/purchase.php | 4 +- .../w3-total-cache/inc/lightbox/upgrade.php | 33 +- .../inc/options/browsercache.php | 93 +++- .../w3-total-cache/inc/options/cdn.php | 10 +- .../inc/options/common/footer.php | 6 + .../w3-total-cache/inc/options/dashboard.php | 75 +-- .../inc/options/extensions/list.php | 14 +- .../w3-total-cache/inc/options/general.php | 10 - .../w3-total-cache/inc/options/pgcache.php | 12 +- .../lib/Minify/Minify/CSS/Compressor.php | 3 + .../lib/Minify/Minify/Cache/File.php | 12 +- .../w3-total-cache/lib/Minify/Minify/HTML.php | 5 + .../w3-total-cache/pub/css/lightbox.css | 62 ++- .../w3-total-cache/pub/css/options.css | 54 +- .../plugins/w3-total-cache/pub/css/widget.css | 51 +- .../plugins/w3-total-cache/pub/img/a2.png | Bin 0 -> 22741 bytes .../w3-total-cache/pub/img/convesio.png | Bin 0 -> 490854 bytes .../w3-total-cache/pub/img/dreamhost.png | Bin 0 -> 124889 bytes .../plugins/w3-total-cache/pub/img/imh.png | Bin 0 -> 3734 bytes .../pub/img/w3tc-stats-database-cache.png | Bin 0 -> 12246 bytes .../pub/img/w3tc-stats-object-cache.png | Bin 0 -> 13601 bytes .../pub/img/w3tc-stats-page-cache.png | Bin 0 -> 12492 bytes .../pub/img/w3tc-webp-converter.png | Bin 0 -> 24418 bytes .../w3-total-cache/pub/js/google-charts.js | 160 ++++++ .../pub/js/jquery.masonry.min.js | 17 +- .../plugins/w3-total-cache/pub/js/lightbox.js | 111 ++-- .../plugins/w3-total-cache/pub/js/options.js | 10 +- wp-content/plugins/w3-total-cache/readme.txt | 22 +- .../w3-total-cache/vendor/autoload.php | 2 +- .../vendor/composer/autoload_real.php | 14 +- .../vendor/composer/autoload_static.php | 8 +- .../w3-total-cache/w3-total-cache-api.php | 6 +- .../plugins/w3-total-cache/w3-total-cache.php | 2 +- 140 files changed, 3054 insertions(+), 3013 deletions(-) delete mode 100644 wp-content/plugins/w3-total-cache/Cdn_Highwinds_Widget.php delete mode 100644 wp-content/plugins/w3-total-cache/Cdn_Highwinds_Widget_View.css delete mode 100644 wp-content/plugins/w3-total-cache/Cdn_Highwinds_Widget_View.js delete mode 100644 wp-content/plugins/w3-total-cache/Cdn_Highwinds_Widget_View.php delete mode 100644 wp-content/plugins/w3-total-cache/Cdn_Highwinds_Widget_View_NotConfigured.php delete mode 100644 wp-content/plugins/w3-total-cache/Cdn_StackPath2_Widget.php delete mode 100644 wp-content/plugins/w3-total-cache/Cdn_StackPath2_Widget_View.css delete mode 100644 wp-content/plugins/w3-total-cache/Cdn_StackPath2_Widget_View.js delete mode 100644 wp-content/plugins/w3-total-cache/Cdn_StackPath2_Widget_View_Authorized.php delete mode 100644 wp-content/plugins/w3-total-cache/Cdn_StackPath2_Widget_View_Unauthorized.php delete mode 100644 wp-content/plugins/w3-total-cache/Cdn_StackPath_Widget.php delete mode 100644 wp-content/plugins/w3-total-cache/Cdn_StackPath_Widget_View.css delete mode 100644 wp-content/plugins/w3-total-cache/Cdn_StackPath_Widget_View.js delete mode 100644 wp-content/plugins/w3-total-cache/Cdn_StackPath_Widget_View_Authorized.php delete mode 100644 wp-content/plugins/w3-total-cache/Cdn_StackPath_Widget_View_Unauthorized.php create mode 100644 wp-content/plugins/w3-total-cache/Extension_ImageService_Widget.js create mode 100644 wp-content/plugins/w3-total-cache/Extension_ImageService_Widget.php create mode 100644 wp-content/plugins/w3-total-cache/Extension_ImageService_Widget_View.php delete mode 100644 wp-content/plugins/w3-total-cache/Extension_Swarmify_Widget.php delete mode 100644 wp-content/plugins/w3-total-cache/Extension_Swarmify_Widget_View.css delete mode 100644 wp-content/plugins/w3-total-cache/Extension_Swarmify_Widget_View_NotConfigured.php delete mode 100644 wp-content/plugins/w3-total-cache/Generic_Plugin_WidgetForum.php delete mode 100644 wp-content/plugins/w3-total-cache/Generic_Plugin_WidgetNews.php create mode 100644 wp-content/plugins/w3-total-cache/Generic_WidgetAccount.php create mode 100644 wp-content/plugins/w3-total-cache/Generic_WidgetAccount_View.php delete mode 100644 wp-content/plugins/w3-total-cache/Generic_WidgetCommunity.php delete mode 100644 wp-content/plugins/w3-total-cache/Generic_WidgetCommunity_View.php create mode 100644 wp-content/plugins/w3-total-cache/Generic_WidgetPartners.php create mode 100644 wp-content/plugins/w3-total-cache/Generic_WidgetPartners_View.php create mode 100644 wp-content/plugins/w3-total-cache/Generic_WidgetSettings.php create mode 100644 wp-content/plugins/w3-total-cache/Generic_WidgetSettings_View.php create mode 100644 wp-content/plugins/w3-total-cache/Generic_WidgetStats.js create mode 100644 wp-content/plugins/w3-total-cache/Generic_WidgetStats.php delete mode 100644 wp-content/plugins/w3-total-cache/UsageStatistics_Widget.php delete mode 100644 wp-content/plugins/w3-total-cache/UsageStatistics_Widget_View.js delete mode 100644 wp-content/plugins/w3-total-cache/UsageStatistics_Widget_View.php delete mode 100644 wp-content/plugins/w3-total-cache/UsageStatistics_Widget_View_Disabled.php create mode 100644 wp-content/plugins/w3-total-cache/UserExperience_Remove_CssJs_Extension.php create mode 100644 wp-content/plugins/w3-total-cache/UserExperience_Remove_CssJs_Mutator.php create mode 100644 wp-content/plugins/w3-total-cache/UserExperience_Remove_CssJs_Page_View.js create mode 100644 wp-content/plugins/w3-total-cache/UserExperience_Remove_CssJs_Page_View.php create mode 100644 wp-content/plugins/w3-total-cache/pub/img/a2.png create mode 100644 wp-content/plugins/w3-total-cache/pub/img/convesio.png create mode 100644 wp-content/plugins/w3-total-cache/pub/img/dreamhost.png create mode 100644 wp-content/plugins/w3-total-cache/pub/img/imh.png create mode 100644 wp-content/plugins/w3-total-cache/pub/img/w3tc-stats-database-cache.png create mode 100644 wp-content/plugins/w3-total-cache/pub/img/w3tc-stats-object-cache.png create mode 100644 wp-content/plugins/w3-total-cache/pub/img/w3tc-stats-page-cache.png create mode 100644 wp-content/plugins/w3-total-cache/pub/img/w3tc-webp-converter.png create mode 100644 wp-content/plugins/w3-total-cache/pub/js/google-charts.js diff --git a/wp-content/plugins/w3-total-cache/BrowserCache_ConfigLabels.php b/wp-content/plugins/w3-total-cache/BrowserCache_ConfigLabels.php index b47de148..1ff90916 100644 --- a/wp-content/plugins/w3-total-cache/BrowserCache_ConfigLabels.php +++ b/wp-content/plugins/w3-total-cache/BrowserCache_ConfigLabels.php @@ -35,8 +35,8 @@ class BrowserCache_ConfigLabels { 'browsercache.other.cache.policy' => __( 'Cache Control policy:', 'w3-total-cache' ), 'browsercache.other.etag' => __( 'Set entity tag (ETag)', 'w3-total-cache' ), 'browsercache.other.w3tc' => __( 'Set W3 Total Cache header', 'w3-total-cache' ), - 'browsercache.other.compression' => __( 'Enable HTTP (gzip) compression', 'w3-total-cache' ), - 'browsercache.other.brotli' => __( 'Enable HTTP (brotli) compression', 'w3-total-cache' ), + 'browsercache.other.compression' => __( 'Enable HTTP (gzip) compression', 'w3-total-cache' ), + 'browsercache.other.brotli' => __( 'Enable HTTP (brotli) compression', 'w3-total-cache' ), 'browsercache.other.replace' => __( 'Prevent caching of objects after settings change', 'w3-total-cache' ), 'browsercache.other.nocookies' => __( 'Disable cookies for static files', 'w3-total-cache' ), 'browsercache.security.session.cookie_httponly' => __( 'Access session cookies through the HTTP only:', 'w3-total-cache' ), diff --git a/wp-content/plugins/w3-total-cache/BrowserCache_Environment_Nginx.php b/wp-content/plugins/w3-total-cache/BrowserCache_Environment_Nginx.php index 90b9b566..9a92136b 100644 --- a/wp-content/plugins/w3-total-cache/BrowserCache_Environment_Nginx.php +++ b/wp-content/plugins/w3-total-cache/BrowserCache_Environment_Nginx.php @@ -344,11 +344,11 @@ class BrowserCache_Environment_Nginx { } if ( ! empty( $feature_v ) ) { - $rules[] = ' Header set Feature-Policy "' . implode( ';', $feature_v ) . "\"\n"; + $rules[] = 'add_header Feature-Policy "' . implode( ';', $feature_v ) . "\"\n"; } if ( ! empty( $permission_v ) ) { - $rules[] = ' Header set Permissions-Policy "' . implode( ',', $permission_v ) . "\"\n"; + $rules[] = 'add_header Permissions-Policy "' . implode( ',', $permission_v ) . "\"\n"; } } } diff --git a/wp-content/plugins/w3-total-cache/CacheFlush_Locally.php b/wp-content/plugins/w3-total-cache/CacheFlush_Locally.php index 37e22ab0..bfd8d7eb 100644 --- a/wp-content/plugins/w3-total-cache/CacheFlush_Locally.php +++ b/wp-content/plugins/w3-total-cache/CacheFlush_Locally.php @@ -74,16 +74,13 @@ class CacheFlush_Locally { do_action( 'w3tc_flush_minify' ); $minifycache = Dispatcher::component( 'Minify_MinifiedFileRequestHandler' ); - $v = $minifycache->flush(); + $v = $minifycache->flush( $extras ); do_action( 'w3tc_flush_after_minify' ); return $v; } function minifycache_flush_all( $extras = array() ) { - if ( isset( $extras['minify'] ) && $extras['minify'] == 'purge_map' ) - delete_option( 'w3tc_minify' ); - $this->minifycache_flush( $extras ); } diff --git a/wp-content/plugins/w3-total-cache/CacheGroups_Plugin_Admin.php b/wp-content/plugins/w3-total-cache/CacheGroups_Plugin_Admin.php index 63e9a4c4..a815c4a5 100644 --- a/wp-content/plugins/w3-total-cache/CacheGroups_Plugin_Admin.php +++ b/wp-content/plugins/w3-total-cache/CacheGroups_Plugin_Admin.php @@ -148,12 +148,8 @@ class CacheGroups_Plugin_Admin extends Base_Page_Settings { $group_config ); - $mobile_groups[ $group ]['agents'] = array_unique( - array_map( - 'strtolower', - $mobile_groups[ $group ]['agents'] - ) - ); + $mobile_groups[ $group ]['agents'] = self::clean_values( $mobile_groups[ $group ]['agents'] ); + sort( $mobile_groups[ $group ]['agents'] ); } @@ -209,12 +205,8 @@ class CacheGroups_Plugin_Admin extends Base_Page_Settings { $group_config ); - $referrer_groups[ $group ]['referrers'] = array_unique( - array_map( - 'strtolower', - $referrer_groups[ $group ]['referrers'] - ) - ); + $referrer_groups[ $group ]['referrers'] = self::clean_values( $referrer_groups[ $group ]['referrers'] ); + sort( $referrer_groups[ $group ]['referrers'] ); } @@ -268,4 +260,22 @@ class CacheGroups_Plugin_Admin extends Base_Page_Settings { $config->set( 'pgcache.cookiegroups.enabled', $enabled ); $config->set( 'pgcache.cookiegroups.groups', $cookiegroups ); } + + /** + * Clean entries. + * + * @static + * + * @param array $values Values. + */ + public static function clean_values( $values ) { + return array_unique( + array_map( + function ( $value ) { + return preg_replace( '/(?_memcache->getStats(); - if ( count( $a ) > 0 ) { + if ( ! empty( $a ) && count( $a ) > 0 ) { $keys = array_keys( $a ); $key = $keys[0]; return $a[$key]; diff --git a/wp-content/plugins/w3-total-cache/Cdn_BunnyCdn_Page_View.js b/wp-content/plugins/w3-total-cache/Cdn_BunnyCdn_Page_View.js index 4dde97aa..7c1275af 100644 --- a/wp-content/plugins/w3-total-cache/Cdn_BunnyCdn_Page_View.js +++ b/wp-content/plugins/w3-total-cache/Cdn_BunnyCdn_Page_View.js @@ -14,7 +14,6 @@ jQuery(function($) { * @param object o W3tc_Lightbox object. */ function w3tc_bunnycdn_resize(o) { - o.options.height = $('.w3tc_cdn_bunnycdn_form').height(); o.resize(); } diff --git a/wp-content/plugins/w3-total-cache/Cdn_BunnyCdn_Widget.php b/wp-content/plugins/w3-total-cache/Cdn_BunnyCdn_Widget.php index b8fe80bb..a2d50a4c 100644 --- a/wp-content/plugins/w3-total-cache/Cdn_BunnyCdn_Widget.php +++ b/wp-content/plugins/w3-total-cache/Cdn_BunnyCdn_Widget.php @@ -28,7 +28,7 @@ class Cdn_BunnyCdn_Widget { Util_Widget::add2( 'w3tc_bunnycdn', - 2000, + 400, '', array( $o, 'widget_form' ), Util_Ui::admin_url( 'admin.php?page=w3tc_cdn' ), diff --git a/wp-content/plugins/w3-total-cache/Cdn_GoogleDrive_Page_View.js b/wp-content/plugins/w3-total-cache/Cdn_GoogleDrive_Page_View.js index 9d7ae318..7ae38c5f 100644 --- a/wp-content/plugins/w3-total-cache/Cdn_GoogleDrive_Page_View.js +++ b/wp-content/plugins/w3-total-cache/Cdn_GoogleDrive_Page_View.js @@ -10,6 +10,9 @@ jQuery(function($) { width: 800, height: 500, url: w3tc_cdn_google_drive_popup_url[0], + callback: function(lightbox) { + lightbox.resize(); + }, onClose: function() { } }); diff --git a/wp-content/plugins/w3-total-cache/Cdn_Highwinds_Page_View.js b/wp-content/plugins/w3-total-cache/Cdn_Highwinds_Page_View.js index 316e08bf..b565501d 100644 --- a/wp-content/plugins/w3-total-cache/Cdn_Highwinds_Page_View.js +++ b/wp-content/plugins/w3-total-cache/Cdn_Highwinds_Page_View.js @@ -1,6 +1,5 @@ jQuery(function($) { function w3tchw_resize(o) { - o.options.height = jQuery('.w3tc_cdn_highwinds_form').height() + 30; o.resize(); } diff --git a/wp-content/plugins/w3-total-cache/Cdn_Highwinds_Widget.php b/wp-content/plugins/w3-total-cache/Cdn_Highwinds_Widget.php deleted file mode 100644 index 5302b200..00000000 --- a/wp-content/plugins/w3-total-cache/Cdn_Highwinds_Widget.php +++ /dev/null @@ -1,105 +0,0 @@ -', - array( $this, 'widget_form' ), - Util_Ui::admin_url( 'admin.php?page=w3tc_cdn' ), - 'normal' ); - } - - - - public function widget_form() { - $c = Dispatcher::config(); - $account_hash = $c->get_string( 'cdn.highwinds.account_hash' ); - if ( empty( $account_hash ) ) { - include W3TC_DIR . '/Cdn_Highwinds_Widget_View_NotConfigured.php'; - return; - } - - $url_manage = 'https://striketracker3.highwinds.com/accounts/' . - $account_hash . '/configure/hosts'; - $url_analyze = 'https://striketracker3.highwinds.com/accounts/' . - $account_hash . '/analyze/overview'; - $url_purge = Util_Ui::url( array( - 'page' => 'w3tc_cdn', - 'w3tc_cdn_purge' => 'y' - ) ); - - include W3TC_DIR . '/Cdn_Highwinds_Widget_View.php'; - } - - - - - public function admin_print_styles() { - wp_enqueue_style( 'w3tc-widget' ); - wp_enqueue_style( 'w3tc-highwinds-widget', - plugins_url( 'Cdn_Highwinds_Widget_View.css', W3TC_FILE ), - array(), W3TC_VERSION ); - } - - - - public function admin_print_scripts() { - wp_enqueue_script( 'google-jsapi', 'https://www.google.com/jsapi' ); - wp_enqueue_script( 'w3tc-highwinds-widget', - plugins_url( 'Cdn_Highwinds_Widget_View.js', W3TC_FILE ), - array(), W3TC_VERSION ); - } - - - - static public function w3tc_ajax_cdn_highwinds_widgetdata() { - try { - $core = Dispatcher::component( 'Cdn_Core' ); - $cdn = $core->get_cdn(); - - $analytics = $cdn->service_analytics_transfer(); - - $sum_mbytes = 0; - $sum_mbps = 0; - $sum_rps = 0; - $graph = array( array( 'Date', 'Requests' ) ); - $count = count( $analytics ); - - foreach ( $analytics as $item ) { - $sum_mbytes += $item['xferUsedTotalMB']; - $sum_mbps += $item['xferRateMeanMbps']; - $sum_rps += $item['rpsMean']; - $graph[] = array( - gmdate( 'd M', $item['usageTime'] / 1000 ), - $item['requestsCountTotal'] - ); - } - - $response = array( - 'transferred_size' => Util_Ui::format_mbytes( $sum_mbytes / $count ), - 'average_mbps' => sprintf( '%.2f', $sum_mbps / $count ), - 'average_rps' => sprintf( '%.2f', $sum_rps / $count ), - 'graph' => $graph - ); - - echo json_encode( $response ); - } catch ( \Exception $e ) { - echo json_encode( array( - 'error' => $e->getMessage() - ) ); - } - } -} diff --git a/wp-content/plugins/w3-total-cache/Cdn_Highwinds_Widget_View.css b/wp-content/plugins/w3-total-cache/Cdn_Highwinds_Widget_View.css deleted file mode 100644 index fe22a8ea..00000000 --- a/wp-content/plugins/w3-total-cache/Cdn_Highwinds_Widget_View.css +++ /dev/null @@ -1,15 +0,0 @@ -.w3tc-widget-highwinds-logo { - float: left; - width: 65px; - height: 35px; - background: url("pub/img/cdn-highwinds-logo.png") 0 0 no-repeat; -} - -.w3tchw_tools li { - display: inline-block; - margin-right: 10px; -} - -#w3tchw_report li { - margin-bottom: 0; -} \ No newline at end of file diff --git a/wp-content/plugins/w3-total-cache/Cdn_Highwinds_Widget_View.js b/wp-content/plugins/w3-total-cache/Cdn_Highwinds_Widget_View.js deleted file mode 100644 index d331d00d..00000000 --- a/wp-content/plugins/w3-total-cache/Cdn_Highwinds_Widget_View.js +++ /dev/null @@ -1,45 +0,0 @@ -var w3tchw_graph_data; - -function w3tchw_load() { - jQuery('.w3tchw_loading').removeClass('w3tc_hidden'); - jQuery('.w3tchw_content').addClass('w3tc_hidden'); - jQuery('.w3tchw_error').addClass('w3tc_none'); - - jQuery.getJSON(ajaxurl + '?action=w3tc_ajax&_wpnonce=' + w3tc_nonce + - '&w3tc_action=cdn_highwinds_widgetdata', - function(data) { - if (data && data.error) { - jQuery('.w3tchw_error').removeClass('w3tc_none'); - jQuery('.w3tchw_error_details').html(data.error); - jQuery('.w3tchw_loading').addClass('w3tc_hidden'); - return; - } - - for (p in data) { - var v = data[p]; - jQuery('.w3tchw_' + p).html(v); - } - - var data = google.visualization.arrayToDataTable(data.graph); - var options = { - legend: { position: "none" }, - bars: 'horizontal' - }; - - var chart = new google.charts.Bar(document.getElementById('w3tchw_chart')); - chart.draw(data, options); - - jQuery('.w3tchw_content').removeClass('w3tc_hidden'); - jQuery('.w3tchw_loading').addClass('w3tc_hidden'); - } - ).fail(function() { - jQuery('.w3tchw_error').removeClass('w3tc_none'); - jQuery('.w3tchw_content').addClass('w3tc_hidden'); - jQuery('.w3tchw_loading').addClass('w3tc_hidden'); - }); -} - - - -google.load("visualization", "1.1", {packages:["bar"]}); -google.setOnLoadCallback(w3tchw_load); diff --git a/wp-content/plugins/w3-total-cache/Cdn_Highwinds_Widget_View.php b/wp-content/plugins/w3-total-cache/Cdn_Highwinds_Widget_View.php deleted file mode 100644 index 04168836..00000000 --- a/wp-content/plugins/w3-total-cache/Cdn_Highwinds_Widget_View.php +++ /dev/null @@ -1,60 +0,0 @@ - -

-

-

- -

-
-

-
-
-
    -
  • -
  • -
  • -
  • -
  • -
  • -
-
-
Loading...
-
- An error occurred -
-
- -
-
-

-
    -
  • Transferred:
  • -
  • Average rate Mb/s:
  • -
  • Average requests/s:
  • -
-
-
-

-
-
-
-
diff --git a/wp-content/plugins/w3-total-cache/Cdn_Highwinds_Widget_View_NotConfigured.php b/wp-content/plugins/w3-total-cache/Cdn_Highwinds_Widget_View_NotConfigured.php deleted file mode 100644 index f04fbe9b..00000000 --- a/wp-content/plugins/w3-total-cache/Cdn_Highwinds_Widget_View_NotConfigured.php +++ /dev/null @@ -1,28 +0,0 @@ - -

-

-

- -

-
-

-
- Not configured -
diff --git a/wp-content/plugins/w3-total-cache/Cdn_LimeLight_Page_View.js b/wp-content/plugins/w3-total-cache/Cdn_LimeLight_Page_View.js index 2ea809b8..130df457 100644 --- a/wp-content/plugins/w3-total-cache/Cdn_LimeLight_Page_View.js +++ b/wp-content/plugins/w3-total-cache/Cdn_LimeLight_Page_View.js @@ -1,6 +1,5 @@ jQuery(function($) { function w3tc_popup_resize(o) { - o.options.height = jQuery('.w3tc_popup_form').height() + 30; o.resize(); } diff --git a/wp-content/plugins/w3-total-cache/Cdn_LimeLight_Popup.php b/wp-content/plugins/w3-total-cache/Cdn_LimeLight_Popup.php index dfc314bf..87a0c989 100644 --- a/wp-content/plugins/w3-total-cache/Cdn_LimeLight_Popup.php +++ b/wp-content/plugins/w3-total-cache/Cdn_LimeLight_Popup.php @@ -3,7 +3,7 @@ namespace W3TC; -class Cdnfsd_LimeLight_Popup { +class Cdn_LimeLight_Popup { static public function w3tc_ajax() { $o = new Cdnfsd_LimeLight_Popup(); diff --git a/wp-content/plugins/w3-total-cache/Cdn_Plugin_Admin.php b/wp-content/plugins/w3-total-cache/Cdn_Plugin_Admin.php index 03f789f2..457278dd 100644 --- a/wp-content/plugins/w3-total-cache/Cdn_Plugin_Admin.php +++ b/wp-content/plugins/w3-total-cache/Cdn_Plugin_Admin.php @@ -36,6 +36,9 @@ class Cdn_Plugin_Admin { } } + // Always show the Bunny CDN widget on dashboard. + \add_action( 'admin_init_w3tc_dashboard', array( '\W3TC\Cdn_BunnyCdn_Widget', 'admin_init_w3tc_dashboard' ) ); + // Attach to actions without firing class loading at all without need. switch ( $cdn_engine ) { case 'google_drive': @@ -43,8 +46,6 @@ class Cdn_Plugin_Admin { break; case 'highwinds': \add_action( 'w3tc_ajax', array( '\W3TC\Cdn_Highwinds_Popup', 'w3tc_ajax' ) ); - \add_action( 'admin_init_w3tc_dashboard', array( '\W3TC\Cdn_Highwinds_Widget', 'admin_init_w3tc_dashboard' ) ); - \add_action( 'w3tc_ajax_cdn_highwinds_widgetdata', array( '\W3TC\Cdn_Highwinds_Widget', 'w3tc_ajax_cdn_highwinds_widgetdata' ) ); \add_action( 'w3tc_settings_cdn_boxarea_configuration', array( '\W3TC\Cdn_Highwinds_Page', 'w3tc_settings_cdn_boxarea_configuration' ) ); break; case 'limelight': @@ -63,23 +64,17 @@ class Cdn_Plugin_Admin { case 'stackpath': \add_action( 'w3tc_ajax', array( '\W3TC\Cdn_StackPath_Popup', 'w3tc_ajax' ) ); \add_action( 'w3tc_settings_cdn_boxarea_configuration', array( '\W3TC\Cdn_StackPath_Page', 'w3tc_settings_cdn_boxarea_configuration' ) ); - \add_action( 'admin_init_w3tc_dashboard', array( '\W3TC\Cdn_StackPath_Widget', 'admin_init_w3tc_dashboard' ) ); - \add_action( 'w3tc_ajax_cdn_stackpath_widgetdata', array( '\W3TC\Cdn_StackPath_Widget', 'w3tc_ajax_cdn_stackpath_widgetdata' ) ); break; case 'stackpath2': \add_action( 'w3tc_ajax', array( '\W3TC\Cdn_StackPath2_Popup', 'w3tc_ajax' ) ); \add_action( 'w3tc_settings_cdn_boxarea_configuration', array( '\W3TC\Cdn_StackPath2_Page', 'w3tc_settings_cdn_boxarea_configuration' ) ); - \add_action( 'admin_init_w3tc_dashboard', array( '\W3TC\Cdn_StackPath2_Widget', 'admin_init_w3tc_dashboard' ) ); - \add_action( 'w3tc_ajax_cdn_stackpath2_widgetdata', array( '\W3TC\Cdn_StackPath2_Widget', 'w3tc_ajax_cdn_stackpath2_widgetdata' ) ); break; case 'bunnycdn': \add_action( 'w3tc_ajax', array( '\W3TC\Cdn_BunnyCdn_Page', 'w3tc_ajax' ) ); \add_action( 'w3tc_ajax', array( '\W3TC\Cdn_BunnyCdn_Popup', 'w3tc_ajax' ) ); \add_action( 'w3tc_settings_cdn_boxarea_configuration', array( '\W3TC\Cdn_BunnyCdn_Page', 'w3tc_settings_cdn_boxarea_configuration' ) ); - \add_action( 'admin_init_w3tc_dashboard', array( '\W3TC\Cdn_BunnyCdn_Widget', 'admin_init_w3tc_dashboard' ) ); \add_action( 'w3tc_ajax_cdn_bunnycdn_widgetdata', array( '\W3TC\Cdn_BunnyCdn_Widget', 'w3tc_ajax_cdn_bunnycdn_widgetdata' ) ); \add_action( 'w3tc_purge_urls_box', array( '\W3TC\Cdn_BunnyCdn_Page', 'w3tc_purge_urls_box' ) ); - // \add_filter( 'w3tc_dashboard_actions', array( '\W3TC\Cdn_BunnyCdn_Page', 'w3tc_dashboard_actions' ) ); // @todo Revisit this item. break; default: \add_action( 'admin_init_w3tc_dashboard', array( '\W3TC\Cdn_BunnyCdn_Widget', 'admin_init_w3tc_dashboard' ) ); diff --git a/wp-content/plugins/w3-total-cache/Cdn_RackSpaceCdn_Page_View.js b/wp-content/plugins/w3-total-cache/Cdn_RackSpaceCdn_Page_View.js index 0aa715e2..26e3e2f7 100644 --- a/wp-content/plugins/w3-total-cache/Cdn_RackSpaceCdn_Page_View.js +++ b/wp-content/plugins/w3-total-cache/Cdn_RackSpaceCdn_Page_View.js @@ -1,6 +1,5 @@ jQuery(function($) { function w3tc_rackspace_resize(o) { - o.options.height = jQuery('.w3tc_cdn_rackspace_form').height() + 30; o.resize(); } diff --git a/wp-content/plugins/w3-total-cache/Cdn_RackSpaceCloudFiles_Page_View.js b/wp-content/plugins/w3-total-cache/Cdn_RackSpaceCloudFiles_Page_View.js index 1fa25a90..b9ce0589 100644 --- a/wp-content/plugins/w3-total-cache/Cdn_RackSpaceCloudFiles_Page_View.js +++ b/wp-content/plugins/w3-total-cache/Cdn_RackSpaceCloudFiles_Page_View.js @@ -1,6 +1,5 @@ jQuery(function($) { function w3tc_rackspace_resize(o) { - o.options.height = jQuery('.w3tc_cdn_rackspace_form').height() + 30; o.resize(); } diff --git a/wp-content/plugins/w3-total-cache/Cdn_StackPath2_Page_View.js b/wp-content/plugins/w3-total-cache/Cdn_StackPath2_Page_View.js index 1c369aca..7f1b5f17 100644 --- a/wp-content/plugins/w3-total-cache/Cdn_StackPath2_Page_View.js +++ b/wp-content/plugins/w3-total-cache/Cdn_StackPath2_Page_View.js @@ -1,6 +1,5 @@ jQuery(function($) { function w3tc_stackpath_resize(o) { - o.options.height = jQuery('.w3tc_cdn_stackpath2_form').height(); o.resize(); } diff --git a/wp-content/plugins/w3-total-cache/Cdn_StackPath2_Widget.php b/wp-content/plugins/w3-total-cache/Cdn_StackPath2_Widget.php deleted file mode 100644 index df583de9..00000000 --- a/wp-content/plugins/w3-total-cache/Cdn_StackPath2_Widget.php +++ /dev/null @@ -1,125 +0,0 @@ -', - array( $o, 'widget_form' ), - Util_Ui::admin_url( 'admin.php?page=w3tc_cdn' ), - 'normal' ); - } - - /** - * Runs plugin - */ - function widget_form() { - $c = Dispatcher::config(); - - // Configure authorize and have_zone - $authorized = $c->get_string( 'cdn.stackpath2.client_id' ) != '' && - $c->get_string( 'cdn.engine' ) == 'stackpath2'; - - if ( $authorized ) { - include dirname( __FILE__ ) . DIRECTORY_SEPARATOR . - 'Cdn_StackPath2_Widget_View_Authorized.php'; - } else { - include dirname( __FILE__ ) . DIRECTORY_SEPARATOR . - 'Cdn_StackPath2_Widget_View_Unauthorized.php'; - } - } - - - - static function w3tc_ajax_cdn_stackpath2_widgetdata() { - $c = Dispatcher::config(); - $cs = Dispatcher::config_state(); - - $api = new Cdn_StackPath2_Api( array( - 'client_id' => $c->get_string( 'cdn.stackpath2.client_id' ), - 'client_secret' => $c->get_string( 'cdn.stackpath2.client_secret' ), - 'stack_id' => $c->get_string( 'cdn.stackpath2.stack_id' ), - 'access_token' => $cs->get_string( 'cdn.stackpath2.access_token' ) - ) ); - - $stack_id = $c->get_string( 'cdn.stackpath2.stack_id' ); - $site_id = $c->get_string( 'cdn.stackpath2.site_id' ); - $response = array(); - - try { - $r = $api->site_metrics( $site_id, 7 ); - $series = $r['series'][0]; - - $keys = $series['metrics']; - $stats = array(); - foreach ($series['samples'] as $sample) { - $row = array(); - for ( $n = 0; $n < count( $keys ); $n++ ) { - $row[$keys[$n]] = $sample['values'][$n]; - } - - $stats[] = $row; - } - - $total_mb = 0; - $total_requests = 0; - $chart_mb = array( array('Date', 'MB', 'Requests' ) ); - - $dd = new \DateTime(); - - foreach ($stats as $r) { - $total_mb += $r['xferUsedTotalMB']; - $total_requests += $r['requestsCountTotal']; - $d = $dd->setTimestamp( (int)$r['usageTime'] ); - $chart_mb[] = array( - $d->format( 'M/d' ), - $r['xferUsedTotalMB'], - $r['requestsCountTotal'] - ); - } - - $response['summary_mb'] = sprintf( '%.2f MB', $total_mb ); - $response['summary_requests'] = $total_requests; - $response['chart_mb'] = $chart_mb; - - $response['url_manage'] = - "https://control.stackpath.com/stacks/$stack_id/cdn/sites/$site_id/cache"; - $response['url_reports'] = - "https://control.stackpath.com/stacks/$stack_id/cdn/sites/$site_id/overview"; - } catch ( \Exception $ex ) { - $response['error'] = $ex->getMessage(); - } - - echo json_encode( $response ); - } - - - - - - public function admin_print_styles() { - wp_enqueue_style( 'w3tc-widget' ); - wp_enqueue_style( 'w3tc-stackpath-widget', - plugins_url( 'Cdn_StackPath2_Widget_View.css', W3TC_FILE ), - array(), W3TC_VERSION ); - } - - - - public function admin_print_scripts() { - wp_enqueue_style( 'w3tc-widget' ); - wp_enqueue_script( 'google-jsapi', 'https://www.google.com/jsapi'); - wp_enqueue_script( 'w3tc-stackpath-widget', - plugins_url( 'Cdn_StackPath2_Widget_View.js', W3TC_FILE ), - array( 'google-jsapi' ), W3TC_VERSION ); - wp_enqueue_script( 'w3tc-metadata' ); - wp_enqueue_script( 'w3tc-widget' ); - } - -} diff --git a/wp-content/plugins/w3-total-cache/Cdn_StackPath2_Widget_View.css b/wp-content/plugins/w3-total-cache/Cdn_StackPath2_Widget_View.css deleted file mode 100644 index 360e8067..00000000 --- a/wp-content/plugins/w3-total-cache/Cdn_StackPath2_Widget_View.css +++ /dev/null @@ -1,78 +0,0 @@ -.w3tc-widget-stackpath2-logo { - width: 150px; - height: 35px; - background: url("pub/img/w3tc_stackpath_logo.svg") 0 8px no-repeat; - float: left; -} - -.w3tcstackpath2_h4 { - text-align: center; -} -.w3tcstackpath2_summary_h4 { - text-align: center; - color: #8F8F8F; - text-align: left; - margin: 0; -} -.w3tcstackpath2_summary { - border-bottom: 1px solid #d2d2d2; - padding-left: 10px; - padding-right: 10px; -} -.w3tcstackpath2_wrapper { - margin-left: -10px; - margin-right: -10px; -} -.w3tcstackpath2_ul li { - margin-bottom: 3px; - padding: 0; -} -.w3tcstackpath2_summary_col1 { - display: block; - font-weight: bold; - width: 90px; - float:left; -} -.w3tcstackpath2_summary_col2 { - display: block; - font-weight: bold; - width: 80px; - float:left; -} -.w3tcstackpath2_tools { - margin-top:15px; - padding-left: 10px; - padding-right: 10px; -} -.w3tcstackpath2_tools li { - display:inline-block; - margin-right:10px; -} -.w3tcstackpath2_chart { - clear: both; - padding-left: 10px; - padding-right: 10px; -} -.w3tcstackpath2_chart p { - color:#8F8F8F; - margin:0; -} - -.w3tcstackpath2_wrapper .button-secondary{ - margin-bottom: 3px; -} - -.w3tcstackpath2_signup_h4 { - text-align: left; - margin-bottom: 0; - padding-bottom: 0; -} - -.w3tcstackpath2_signup p{ - margin-top: 4px; - padding-top: 0; - -} -.w3tcstackpath2_signup p span.desc { - color:#8F8F8F; -} diff --git a/wp-content/plugins/w3-total-cache/Cdn_StackPath2_Widget_View.js b/wp-content/plugins/w3-total-cache/Cdn_StackPath2_Widget_View.js deleted file mode 100644 index dd365e3e..00000000 --- a/wp-content/plugins/w3-total-cache/Cdn_StackPath2_Widget_View.js +++ /dev/null @@ -1,46 +0,0 @@ -var w3tcstackpath2_graph_data; - -function w3tcstackpath2_load() { - jQuery('.w3tcstackpath2_loading').removeClass('w3tc_hidden'); - jQuery('.w3tcstackpath2_content').addClass('w3tc_hidden'); - jQuery('.w3tcstackpath2_error').addClass('w3tc_none'); - - jQuery.getJSON(ajaxurl + '?action=w3tc_ajax&_wpnonce=' + w3tc_nonce + - '&w3tc_action=cdn_stackpath2_widgetdata', - function(data) { - if (data && data.error) { - jQuery('.w3tcstackpath2_error').removeClass('w3tc_none'); - jQuery('.w3tcstackpath2_error_details').html(data.error); - jQuery('.w3tcstackpath2_loading').addClass('w3tc_hidden'); - return; - } - - for (p in data) { - var v = data[p]; - if (p.substr(0, 4) == 'url_') - jQuery('.w3tcstackpath2_href_' + p.substr(4)).attr('href', v); - else - jQuery('.w3tcstackpath2_' + p).html(v); - } - - var chart_data = google.visualization.arrayToDataTable(data.chart_mb); - - var chart = new google.visualization.ColumnChart( - document.getElementById('chart_div')); - var options = {};//colors: 'blue,red'}; - chart.draw(chart_data, options); - - jQuery('.w3tcstackpath2_content').removeClass('w3tc_hidden'); - jQuery('.w3tcstackpath2_loading').addClass('w3tc_hidden'); - } - ).fail(function() { - jQuery('.w3tcstackpath2_error').removeClass('w3tc_none'); - jQuery('.w3tcstackpath2_content').addClass('w3tc_hidden'); - jQuery('.w3tcstackpath2_loading').addClass('w3tc_hidden'); - }); -} - - - -google.load("visualization", "1", {packages:["corechart"]}); -google.setOnLoadCallback(w3tcstackpath2_load); diff --git a/wp-content/plugins/w3-total-cache/Cdn_StackPath2_Widget_View_Authorized.php b/wp-content/plugins/w3-total-cache/Cdn_StackPath2_Widget_View_Authorized.php deleted file mode 100644 index 679f25ec..00000000 --- a/wp-content/plugins/w3-total-cache/Cdn_StackPath2_Widget_View_Authorized.php +++ /dev/null @@ -1,59 +0,0 @@ - -

-

-

- -

-
-

-
Loading...
-
- An error occurred -
-
- -
-
-
-
    -
  • -
  • -
  • -
-
-
-

-
-
    -
  • - : - -
  • -
  • - : - -
  • -
-
-

-
-
-
-
diff --git a/wp-content/plugins/w3-total-cache/Cdn_StackPath2_Widget_View_Unauthorized.php b/wp-content/plugins/w3-total-cache/Cdn_StackPath2_Widget_View_Unauthorized.php deleted file mode 100644 index ba9ca413..00000000 --- a/wp-content/plugins/w3-total-cache/Cdn_StackPath2_Widget_View_Unauthorized.php +++ /dev/null @@ -1,65 +0,0 @@ - -

-

-

- -

-
-

-
- get_boolean( 'cdn.enabled' ) ) : ?> -

- ' . __( 'CDN', 'w3-total-cache' ) . '' - ) - ); - ?> -

- -

-

-

- ' . __( 'CDN', 'w3-total-cache' ) . '' - ) - ); - ?> -

- - - - - - -
diff --git a/wp-content/plugins/w3-total-cache/Cdn_StackPath_Page_View.js b/wp-content/plugins/w3-total-cache/Cdn_StackPath_Page_View.js index 40aa0e97..30a7293c 100644 --- a/wp-content/plugins/w3-total-cache/Cdn_StackPath_Page_View.js +++ b/wp-content/plugins/w3-total-cache/Cdn_StackPath_Page_View.js @@ -1,6 +1,5 @@ jQuery(function($) { function w3tc_stackpath_resize(o) { - o.options.height = jQuery('.w3tc_cdn_stackpath_form').height(); o.resize(); } diff --git a/wp-content/plugins/w3-total-cache/Cdn_StackPath_Widget.php b/wp-content/plugins/w3-total-cache/Cdn_StackPath_Widget.php deleted file mode 100644 index ec2c758a..00000000 --- a/wp-content/plugins/w3-total-cache/Cdn_StackPath_Widget.php +++ /dev/null @@ -1,141 +0,0 @@ -', - array( $this, 'widget_form' ), - Util_Ui::admin_url( 'admin.php?page=w3tc_cdn' ), - 'normal' ); - } - - /** - * Runs plugin - */ - function widget_form() { - $c = Dispatcher::config(); - - // Configure authorize and have_zone - $authorized = $c->get_string( 'cdn.stackpath.authorization_key' ) != '' && - $c->get_string( 'cdn.engine' ) == 'stackpath'; - $keys = explode( '+', $c->get_string( 'cdn.stackpath.authorization_key' ) ); - $authorized = $authorized && sizeof( $keys ) == 3; - $have_zone = $c->get_string( 'cdn.stackpath.zone_id' ) != 0; - - if ( $authorized && $have_zone ) { - include dirname( __FILE__ ) . DIRECTORY_SEPARATOR . - 'Cdn_StackPath_Widget_View_Authorized.php'; - } else { - include dirname( __FILE__ ) . DIRECTORY_SEPARATOR . - 'Cdn_StackPath_Widget_View_Unauthorized.php'; - } - } - - - - function w3tc_ajax_cdn_stackpath_widgetdata() { - $c = Dispatcher::config(); - - require_once W3TC_LIB_NETDNA_DIR . '/NetDNAPresentation.php'; - $api = Cdn_StackPath_Api::create( - $c->get_string( 'cdn.stackpath.authorization_key' ) ); - - $zone_id = $c->get_string( 'cdn.stackpath.zone_id' ); - $response = array(); - - try { - $zone_info = $api->get_site( $zone_id ); - if ( !$zone_info ) - throw new \Exception("Zone not found"); - $filetypes = $api->get_list_of_file_types_per_zone( $zone_id ); - - if ( !isset( $filetypes['filetypes'] ) ) - $filetypes['filetypes'] = array(); - - $group_hits = \NetDNAPresentation::group_hits_per_filetype_group( - $filetypes['filetypes'] ); - - $graph = array( array('Filetype', 'Hits' ) ); - $colors = array(); - foreach ( $group_hits as $group => $hits ) { - $graph[] = array( $group, $hits ); - $colors[] = \NetDNAPresentation::get_file_group_color( $group ); - } - - $response['graph'] = $graph; - $response['colors'] = $colors; - - $summary = $api->get_stats_per_zone( $zone_id ); - - $response['zone_name'] = $zone_info['name']; - $response['summary'] = $summary; - $response['summary_size'] = Util_Ui::format_bytes( $summary['size'] ); - $response['summary_cache_hit'] = $summary['cache_hit']; - $response['summary_cache_hit_percentage'] = $summary['hit'] ? - ( $summary['cache_hit'] / $summary['hit'] ) * 100 : - $summary['hit']; - $response['summary_noncache_hit'] = $summary['noncache_hit']; - $response['summary_noncache_hit_percentage'] = $summary['hit'] ? - ( $summary['noncache_hit'] / $summary['hit'] ) * 100 : - $summary['hit']; - - $response['filetypes'] = $filetypes; - $popular_files = $api->get_list_of_popularfiles_per_zone( $zone_id ); - $popular_files = \NetDNAPresentation::format_popular( $popular_files ); - $response['popular_files'] = array_slice( $popular_files, 0 , 5 ); - for ($n = 0; $n < count( $response['popular_files'] ); $n++) { - $response['popular_files'][$n]['color'] = - \NetDNAPresentation::get_file_group_color( - $response['popular_files'][$n]['group'] ); - } - - $account = $api->get_account(); - $response['account_status'] = \NetDNAPresentation::get_account_status( $account['status'] ); - $response['url_manage'] = 'https://app.stackpath.com/sites/' . - $zone_id . '/settings'; - $response['url_reports'] = 'https://app.stackpath.com/reporting/files?zone_id=' . - $zone_id; - } catch ( \Exception $ex ) { - $response['error'] = $ex->getMessage(); - } - - echo json_encode( $response ); - } - - - - - - public function admin_print_styles() { - wp_enqueue_style( 'w3tc-widget' ); - wp_enqueue_style( 'w3tc-stackpath-widget', - plugins_url( 'Cdn_StackPath_Widget_View.css', W3TC_FILE ), - array(), W3TC_VERSION ); - } - - - - public function admin_print_scripts() { - wp_enqueue_style( 'w3tc-widget' ); - wp_enqueue_script( 'google-jsapi', 'https://www.google.com/jsapi'); - wp_enqueue_script( 'w3tc-stackpath-widget', - plugins_url( 'Cdn_StackPath_Widget_View.js', W3TC_FILE ), - array( 'google-jsapi' ), W3TC_VERSION ); - wp_enqueue_script( 'w3tc-metadata' ); - wp_enqueue_script( 'w3tc-widget' ); - } - -} diff --git a/wp-content/plugins/w3-total-cache/Cdn_StackPath_Widget_View.css b/wp-content/plugins/w3-total-cache/Cdn_StackPath_Widget_View.css deleted file mode 100644 index fcd54571..00000000 --- a/wp-content/plugins/w3-total-cache/Cdn_StackPath_Widget_View.css +++ /dev/null @@ -1,98 +0,0 @@ -.w3tc-widget-stackpath-logo { - width: 150px; - height: 35px; - background: url("pub/img/w3tc_stackpath_logo.svg") 0 8px no-repeat; - float: left; -} - -.w3tcstackpath_h4 { - text-align: center; -} -.w3tcstackpath_summary_h4 { - text-align: center; - color: #8F8F8F; - text-align: left; - margin: 0; -} -.w3tcstackpath_status, -.w3tcstackpath_summary { - border-bottom: 1px solid #d2d2d2; - padding-left: 10px; - padding-right: 10px; -} -.w3tcstackpath_wrapper { - margin-left: -10px; - margin-right: -10px; -} -.w3tcstackpath_ul li { - margin-bottom: 3px; - padding: 0; -} -.w3tcstackpath_summary_col1 { - display: block; - font-weight: bold; - width: 90px; - float:left; -} -.w3tcstackpath_summary_col2 { - display: block; - font-weight: bold; - width: 80px; - float:left; -} -.w3tcstackpath_tools { - margin-top:15px; - padding-left: 10px; - padding-right: 10px; -} -.w3tcstackpath_tools li { - display:inline-block; - margin-right:10px; -} -ul.w3tcstackpath_file_hits li { - line-height: 12px; - font-size:10px; -} -ul.w3tcstackpath_file_hits li span { - color: #fff; - padding-top: 2px; - padding-left: 5px; -} -.w3tcstackpath_chart { - clear: both; - padding-left: 10px; - padding-right: 10px; -} -.w3tcstackpath_status p, .w3tcstackpath_chart p { - color:#8F8F8F; - margin:0; -} - -.w3tcstackpath_account_status { - font-weight: bold; - color: #000; -} -.w3tcstackpath_zone_name { - color: #c0d9e4 -} - - - -.w3tcstackpath_wrapper .button-secondary{ - margin-bottom: 3px; -} - -.w3tcstackpath_signup_h4 { - text-align: left; - margin-bottom: 0; - padding-bottom: 0; -} - -.w3tcstackpath_signup p{ - margin-top: 4px; - padding-top: 0; - -} -.w3tcstackpath_signup p span.desc { - color:#8F8F8F; -} diff --git a/wp-content/plugins/w3-total-cache/Cdn_StackPath_Widget_View.js b/wp-content/plugins/w3-total-cache/Cdn_StackPath_Widget_View.js deleted file mode 100644 index b665a461..00000000 --- a/wp-content/plugins/w3-total-cache/Cdn_StackPath_Widget_View.js +++ /dev/null @@ -1,62 +0,0 @@ -var w3tcstackpath_graph_data; - -function w3tcstackpath_load() { - jQuery('.w3tcstackpath_loading').removeClass('w3tc_hidden'); - jQuery('.w3tcstackpath_content').addClass('w3tc_hidden'); - jQuery('.w3tcstackpath_error').addClass('w3tc_none'); - - jQuery.getJSON(ajaxurl + '?action=w3tc_ajax&_wpnonce=' + w3tc_nonce + - '&w3tc_action=cdn_stackpath_widgetdata', - function(data) { - if (data && data.error) { - jQuery('.w3tcstackpath_error').removeClass('w3tc_none'); - jQuery('.w3tcstackpath_error_details').html(data.error); - jQuery('.w3tcstackpath_loading').addClass('w3tc_hidden'); - return; - } - - for (p in data) { - var v = data[p]; - if (p.substr(0, 4) == 'url_') - jQuery('.w3tcstackpath_href_' + p.substr(4)).attr('href', v); - else - jQuery('.w3tcstackpath_' + p).html(v); - } - - var chart_data = google.visualization.arrayToDataTable(data.graph); - - var chart = new google.visualization.PieChart( - document.getElementById('chart_div')); - var options = {colors: data.colors}; - chart.draw(chart_data, options); - - var popuplar_html = ''; - if ( data.popular_files && data.popular_files.length > 0 ) { - var compare = data.popular_files[0]['hit']; - for ( var n = 0; n < data.popular_files.length; n++) { - var file = data.popular_files[n]; - popuplar_html += '
  • ' + - '' + - ' ' + file.hit + - '
  • '; - } - jQuery('.w3tcstackpath_file_hits').html(popuplar_html); - } - - jQuery('.w3tcstackpath_content').removeClass('w3tc_hidden'); - jQuery('.w3tcstackpath_loading').addClass('w3tc_hidden'); - } - ).fail(function() { - jQuery('.w3tcstackpath_error').removeClass('w3tc_none'); - jQuery('.w3tcstackpath_content').addClass('w3tc_hidden'); - jQuery('.w3tcstackpath_loading').addClass('w3tc_hidden'); - }); -} - - - -google.load("visualization", "1", {packages:["corechart"]}); -google.setOnLoadCallback(w3tcstackpath_load); diff --git a/wp-content/plugins/w3-total-cache/Cdn_StackPath_Widget_View_Authorized.php b/wp-content/plugins/w3-total-cache/Cdn_StackPath_Widget_View_Authorized.php deleted file mode 100644 index 998ea1b3..00000000 --- a/wp-content/plugins/w3-total-cache/Cdn_StackPath_Widget_View_Authorized.php +++ /dev/null @@ -1,93 +0,0 @@ - -

    -

    -

    - -

    -
    -

    -
    Loading...
    -
    - An error occurred -
    -
    - -
    -
    -
    -

    - - - - - - - - -

    -
    -
    -
      -
    • -
    • -
    • -
    -
    -
    -

    -
    -
      -
    • - : - -
    • -
    • - : - - - () - -
    • -
    • - : - - - () - -
    • -
    -
    -

    -
    -

    -

    - - -

    -
      -
    • A
    • -
    • A
    • -
    • A
    • -
    • A
    • -
    • A
    • -
    -
    -
    -
    diff --git a/wp-content/plugins/w3-total-cache/Cdn_StackPath_Widget_View_Unauthorized.php b/wp-content/plugins/w3-total-cache/Cdn_StackPath_Widget_View_Unauthorized.php deleted file mode 100644 index 45ca7b42..00000000 --- a/wp-content/plugins/w3-total-cache/Cdn_StackPath_Widget_View_Unauthorized.php +++ /dev/null @@ -1,42 +0,0 @@ - -

    -

    -

    - -

    -
    -

    -
    -

    -

    -

    - ' . __( 'CDN', 'w3-total-cache' ) . '' - ) - ); - ?> -

    - -
    diff --git a/wp-content/plugins/w3-total-cache/Cdnfsd_BunnyCdn_Page_View.js b/wp-content/plugins/w3-total-cache/Cdnfsd_BunnyCdn_Page_View.js index 22f70900..72c0e746 100644 --- a/wp-content/plugins/w3-total-cache/Cdnfsd_BunnyCdn_Page_View.js +++ b/wp-content/plugins/w3-total-cache/Cdnfsd_BunnyCdn_Page_View.js @@ -12,7 +12,6 @@ jQuery(function($) { * @param object o W3tc_Lightbox object. */ function w3tc_bunnycdn_resize(o) { - o.options.height = $('.w3tc_cdn_bunnycdn_fsd_form').height(); o.resize(); } diff --git a/wp-content/plugins/w3-total-cache/Cdnfsd_CloudFront_Page_View.js b/wp-content/plugins/w3-total-cache/Cdnfsd_CloudFront_Page_View.js index 954ea7c0..147aec04 100644 --- a/wp-content/plugins/w3-total-cache/Cdnfsd_CloudFront_Page_View.js +++ b/wp-content/plugins/w3-total-cache/Cdnfsd_CloudFront_Page_View.js @@ -1,6 +1,5 @@ jQuery(function($) { function w3tc_popup_resize(o) { - o.options.height = jQuery('.w3tc_popup_form').height() + 30; o.resize(); } diff --git a/wp-content/plugins/w3-total-cache/Cdnfsd_Core.php b/wp-content/plugins/w3-total-cache/Cdnfsd_Core.php index 5063524c..00aefe37 100644 --- a/wp-content/plugins/w3-total-cache/Cdnfsd_Core.php +++ b/wp-content/plugins/w3-total-cache/Cdnfsd_Core.php @@ -91,7 +91,7 @@ class Cdnfsd_Core { array( 'account_api_key' => $c->get_string( 'cdn.bunnycdn.account_api_key' ), 'pull_zone_id' => $c->get_integer( 'cdnfsd.bunnycdn.pull_zone_id' ), - ), + ) ); break; diff --git a/wp-content/plugins/w3-total-cache/Cdnfsd_LimeLight_Page_View.js b/wp-content/plugins/w3-total-cache/Cdnfsd_LimeLight_Page_View.js index 4bd60c26..9c89f5c1 100644 --- a/wp-content/plugins/w3-total-cache/Cdnfsd_LimeLight_Page_View.js +++ b/wp-content/plugins/w3-total-cache/Cdnfsd_LimeLight_Page_View.js @@ -1,6 +1,5 @@ jQuery(function($) { function w3tc_popup_resize(o) { - o.options.height = jQuery('.w3tc_popup_form').height() + 30; o.resize(); } diff --git a/wp-content/plugins/w3-total-cache/Cdnfsd_StackPath2_Page_View.js b/wp-content/plugins/w3-total-cache/Cdnfsd_StackPath2_Page_View.js index 7fd77c27..cbf5c043 100644 --- a/wp-content/plugins/w3-total-cache/Cdnfsd_StackPath2_Page_View.js +++ b/wp-content/plugins/w3-total-cache/Cdnfsd_StackPath2_Page_View.js @@ -1,6 +1,5 @@ jQuery(function($) { function w3tc_stackpath_resize(o) { - o.options.height = jQuery('.w3tc_cdn_stackpath2_fsd_form').height(); o.resize(); } diff --git a/wp-content/plugins/w3-total-cache/Cdnfsd_StackPath_Page_View.js b/wp-content/plugins/w3-total-cache/Cdnfsd_StackPath_Page_View.js index 03651c18..a34dc6ae 100644 --- a/wp-content/plugins/w3-total-cache/Cdnfsd_StackPath_Page_View.js +++ b/wp-content/plugins/w3-total-cache/Cdnfsd_StackPath_Page_View.js @@ -1,6 +1,5 @@ jQuery(function($) { function w3tc_stackpath_fsd_resize(o) { - o.options.height = jQuery('.w3tc_popup_form').height() + 30; o.resize(); } diff --git a/wp-content/plugins/w3-total-cache/ConfigKeys.php b/wp-content/plugins/w3-total-cache/ConfigKeys.php index 1ab04378..aea781b2 100644 --- a/wp-content/plugins/w3-total-cache/ConfigKeys.php +++ b/wp-content/plugins/w3-total-cache/ConfigKeys.php @@ -2532,10 +2532,6 @@ $keys = array( 'type' => 'integer', 'default' => 5 ), - 'widget.pagespeed.enabled' => array( - 'type' => 'boolean', - 'default' => false - ), 'widget.pagespeed.access_token' => array( 'type' => 'string', 'default' => '' diff --git a/wp-content/plugins/w3-total-cache/Extension_CloudFlare_Page_View.js b/wp-content/plugins/w3-total-cache/Extension_CloudFlare_Page_View.js index f11a16ad..ff3c3ac0 100644 --- a/wp-content/plugins/w3-total-cache/Extension_CloudFlare_Page_View.js +++ b/wp-content/plugins/w3-total-cache/Extension_CloudFlare_Page_View.js @@ -1,6 +1,5 @@ jQuery(function($) { function w3tc_extension_cloudflare_resize(o) { - o.options.height = jQuery('.w3tc_extension_cloudflare_form').height() + 30; o.resize(); } diff --git a/wp-content/plugins/w3-total-cache/Extension_CloudFlare_Widget.php b/wp-content/plugins/w3-total-cache/Extension_CloudFlare_Widget.php index bfcac127..e0fa9af5 100644 --- a/wp-content/plugins/w3-total-cache/Extension_CloudFlare_Widget.php +++ b/wp-content/plugins/w3-total-cache/Extension_CloudFlare_Widget.php @@ -11,7 +11,7 @@ class Extension_CloudFlare_Widget { add_action( 'admin_print_scripts-toplevel_page_w3tc_dashboard', array( $this, 'admin_print_scripts_w3tc_dashboard' ) ); - Util_Widget::add2( 'w3tc_cloudflare', 10000, + Util_Widget::add2( 'w3tc_cloudflare', 600, '', array( $this, 'widget_form' ), Util_Ui::admin_url( 'admin.php?page=w3tc_general#cloudflare' ), diff --git a/wp-content/plugins/w3-total-cache/Extension_ImageService_Widget.js b/wp-content/plugins/w3-total-cache/Extension_ImageService_Widget.js new file mode 100644 index 00000000..5487f0c1 --- /dev/null +++ b/wp-content/plugins/w3-total-cache/Extension_ImageService_Widget.js @@ -0,0 +1,185 @@ +/** + * W3TC image service widgets Google Charts driver. + * + * @file Google Charts driver for W3TC dashboard image service widget. + * @author W3TC. + * @version 1.0 + * @since X.X.X + */ + +jQuery( document ).ready( + function() { + google.charts.load( 'current', { packages: ['corechart', 'gauge'] } ); + google.charts.setOnLoadCallback( load ); + + setInterval(load, 60000); // Refresh charts every 60 seconds + + jQuery(window).resize(load); // Redraw charts after resize + + // Load method for image service charts. Fires on document ready, window resize, and on 60 second interval. + function load() { + processed_data = preprocess_data( w3tc_webp_data ); + draw_charts( processed_data ); + } + + // Preprocesses statistics data for chart use. + /** + * @param {array} data Image Service data. + * @returns {array} Image Service data in format required for Google charts. + */ + function preprocess_data( data ) { + var processed_data = { + 'counts': { + 'data': [ + [ 'Converted', Number(data.counts.data['converted']),data.counts.data['convertedbytes'] ], + [ 'Not Converted', Number(data.counts.data['notconverted']),data.counts.data['notconvertedbytes'] ], + [ 'Processing', Number(data.counts.data['processing']),data.counts.data['processingbytes'] ], + [ 'Sending', Number(data.counts.data['sending']),data.counts.data['sendingbytes'] ], + [ 'Unconverted', Number(data.counts.data['unconverted']),data.counts.data['unconvertedbytes'] ] + ], + 'type': data.counts.type + }, + 'apihourly': { + 'data': [ + [ 'Hourly', Number( data.api.data['usage_hourly'] ) ] + ], + 'limit': Number( data.api.data['limit_hourly'] ), + 'type': data.api.type + } + }; + + // Monthly data is only present for free users as pro is unlimited monthly usage. + if( 'limit_monthly' in data.api.data ) { + processed_data['apimonthly'] = { + 'data': [ + [ 'Monthly', Number( data.api.data['usage_monthly'] ) ] + ], + 'limit': Number( data.api.data['limit_monthly'] ), + 'type': data.api.type + }; + } + + return processed_data; + } + + // Draws the stats charts. + /** + * @param {array} data - Preprocessed Image Service data. + */ + function draw_charts( data ) { + for ( var key in data ) { + if ( data[key]['type'] === 'pie' && document.getElementById( key + '_chart' ) ) { + var chart_data = new google.visualization.DataTable(); + + // Add columns for the chart data + chart_data.addColumn( 'string', 'Status' ); + chart_data.addColumn( 'number', 'Count' ); + chart_data.addColumn( { type: 'string', role: 'tooltip', 'p': { 'html': true } } ); + chart_data.addColumn( 'number', 'Bytes' ); + + // Add rows for the chart data + data[key]['data'].forEach( function ( row ) { + chart_data.addRow( [ row[0], row[1], generateTooltip( row[0], row[1], row[2]), row[2] ] ); + }); + + var chart_options = { + chartArea: { width: '100%', height: '100%', top: 8, bottom: 40 }, + legend: { position: 'bottom' }, + tooltip: { isHtml: true } + }; + + var chart = new google.visualization.PieChart( document.getElementById( key + '_chart' ) ); + } else if( data[key]['type'] === 'gauge' ) { + if( document.getElementById( key + '_chart' ) === null ) { + jQuery( '#api_charts' ).append( '
    ' ); + } + + var chart_data = google.visualization.arrayToDataTable( data[key]['data'], true ); + var yellow_from, yellow_to, red_from; + + if ( data[key]['limit'] > 100 && data[key]['limit'] <= 1000 ) { + yellow_from = data[key]['limit'] - 200; + yellow_to = data[key]['limit'] - 100; + red_from = data[key]['limit'] - 100; + } else if ( data[key]['limit'] > 1000 ) { + yellow_from = data[key]['limit'] - 2000; + yellow_to = data[key]['limit'] - 1000; + red_from = data[key]['limit'] - 1000; + } else { + yellow_from = data[key]['limit'] - 20; + yellow_to = data[key]['limit'] - 10; + red_from = data[key]['limit'] - 10; + } + + var chart_options = { + legend: { position: 'bottom' }, + max: data[key]['limit'], + yellowFrom: yellow_from, + yellowTo: yellow_to, + redFrom: red_from, + redTo: data[key]['limit'], + minorTicks: 5 + }; + + var chart = new google.visualization.Gauge( document.getElementById( key + '_chart' ) ); + } + chart.draw( chart_data, chart_options ); + }; + } + + // Function to generate custom tooltip with count and bytes + function generateTooltip( dataType, count, bytes ) { + return `
    Type: ${dataType}
    Count: ${count}
    Bytes: ${formatBytes(bytes)}
    `; + } + + // Formats a timestamp into a human readable string. + /** + * @param {Object} d Timestamp. + * @returns {string} Human readable date/time string. + */ + function dateFormat( d ){ + return ( "0" + d.getUTCHours() ).slice( -2 ) + ":" + ( "0" + d.getUTCMinutes() ).slice( -2 ); + } + + // Formats bytes into a human readable string. + /** + * @param {Number} x Bytes. + * @returns {string} Human readable string. + */ + function formatBytes( x ){ + const units = [ 'bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' ]; + let l = 0, n = parseInt(x, 10) || 0; + + while( n >= 1000 && ++l ){ + n = n/1000; + } + + return( n.toFixed( n < 10 && l > 0 ? 1 : 0 ) + ' ' + units[l] ); + } + + // Time since last refresh. + var seconds_timer_id; + + // Interval for the image service data refresh. + /** + * @param {Number} new_seconds_till_refresh Interval to trigger refresh. + */ + function setRefresh( new_seconds_till_refresh ) { + clearTimeout( seconds_timer_id ); + var seconds_till_refresh = new_seconds_till_refresh; + seconds_timer_id = setInterval( + function () { + seconds_till_refresh--; + if ( seconds_till_refresh <= 0 ) { + clearInterval( seconds_timer_id ); // Change clearTimeout to clearInterval here + seconds_timer_id = null; + load(); + setRefresh( new_seconds_till_refresh ); // Restart the timer after calling load() + return; + } + }, + 1000 + ); + } + } +); diff --git a/wp-content/plugins/w3-total-cache/Extension_ImageService_Widget.php b/wp-content/plugins/w3-total-cache/Extension_ImageService_Widget.php new file mode 100644 index 00000000..fa57061b --- /dev/null +++ b/wp-content/plugins/w3-total-cache/Extension_ImageService_Widget.php @@ -0,0 +1,118 @@ +is_extension_active( 'imageservice' ) ) { + // If extension is inactive don't load data or chart.js. This will show instead show an "enable" button with sample background. + return; + } + + wp_enqueue_script( 'w3tc-dashboard', plugins_url( 'pub/js/google-charts.js', W3TC_FILE ), array(), W3TC_VERSION, true ); + + $ipa = new Extension_ImageService_Plugin_Admin(); + // Get WebP count data. + $counts = $ipa->get_counts(); + // Strip total data that won't be used in pie chart. + $counts = array_diff_key( $counts, array_flip( array( 'total', 'totalbytes' ) ) ); + + // Get WebP API Usage data. + $usage = get_transient( 'w3tc_imageservice_usage' ); + // Get data via API if no transient exists. + $usage = empty( $usage ) ? Extension_ImageService_Plugin::get_api()->get_usage() : $usage; + // Strip timestamp. + unset( $usage['updated_at'] ); + + // Validate hourly data. If no data then set usage to 0 and appropriate limits. + $usage['usage_hourly'] = 'Unknown' !== $usage['usage_hourly'] ? $usage['usage_hourly'] : 0; + $usage['limit_hourly'] = 'Unknown' !== $usage['limit_hourly'] ? $usage['limit_hourly'] : ( $is_pro ? 10000 : 100 ); + + // Validate monthly data. If no data then set usage to 0 and appropriate limits. + // Remove if pro as we don't show a gauge for pro usage. + if ( $is_pro ) { + unset( $usage['usage_monthly'] ); + unset( $usage['limit_monthly'] ); + } else { + $usage['usage_monthly'] = 'Unknown' !== $usage['usage_monthly'] ? $usage['usage_monthly'] : 0; + $usage['limit_monthly'] = 'Unknown' !== $usage['limit_monthly'] ? $usage['limit_monthly'] : 1000; + } + + wp_register_script( + 'w3tc-webp-widget', + esc_url( plugins_url( 'Extension_ImageService_Widget.js', W3TC_FILE ) ), + array(), + W3TC_VERSION, + 'true' + ); + wp_localize_script( + 'w3tc-webp-widget', + 'w3tc_webp_data', + array( + 'counts' => array( + 'data' => $counts, + 'type' => 'pie', + ), + 'api' => array( + 'data' => $usage, + 'type' => 'gauge', + ), + ) + ); + wp_enqueue_script( 'w3tc-webp-widget' ); + } + + /** + * W3TC dashboard Premium Services widget. + * + * @since X.X.X + * + * @return void + */ + public function wp_dashboard_setup() { + Util_Widget::add( + 'w3tc_imageservice', + '
    ' . __( 'Image Optimization Summary', 'w3-total-cache' ) . '
    ', + array( $this, 'widget_form' ), + null, + 'normal' + ); + } + + /** + * Premium Services widget content. + * + * @since X.X.X + * + * @return void + */ + public function widget_form() { + include W3TC_DIR . '/Extension_ImageService_Widget_View.php'; + } +} diff --git a/wp-content/plugins/w3-total-cache/Extension_ImageService_Widget_View.php b/wp-content/plugins/w3-total-cache/Extension_ImageService_Widget_View.php new file mode 100644 index 00000000..c3ad2d80 --- /dev/null +++ b/wp-content/plugins/w3-total-cache/Extension_ImageService_Widget_View.php @@ -0,0 +1,52 @@ +is_extension_active( 'imageservice' ) ) { + ?> +
    +

    +
    +

    +
    +
    + +
    + array( + 'type' => array(), + 'name' => array(), + 'class' => array(), + 'value' => array(), + 'onclick' => array(), + 'data-src' => array(), + ), + ) + ); + ?> +
    + _config = Dispatcher::config(); - add_action( 'w3tc_widget_setup', array( $o, 'wp_dashboard_setup' ), 9000 ); - add_action( 'w3tc_network_dashboard_setup', - array( $o, 'wp_dashboard_setup' ), 9000 ); + add_action( 'w3tc_widget_setup', array( $o, 'wp_dashboard_setup' ), 1000 ); + add_action( 'w3tc_network_dashboard_setup', array( $o, 'wp_dashboard_setup' ), 1000 ); $nerser = Dispatcher::component( 'Extension_NewRelic_Service' ); $view_application = $nerser->get_effective_application_id(); diff --git a/wp-content/plugins/w3-total-cache/Extension_Swarmify_Plugin_Admin.php b/wp-content/plugins/w3-total-cache/Extension_Swarmify_Plugin_Admin.php index 226c8bc3..0c9aa231 100644 --- a/wp-content/plugins/w3-total-cache/Extension_Swarmify_Plugin_Admin.php +++ b/wp-content/plugins/w3-total-cache/Extension_Swarmify_Plugin_Admin.php @@ -33,10 +33,6 @@ class Extension_Swarmify_Plugin_Admin { function run() { add_action( 'w3tc_config_save', array( $this, 'w3tc_config_save' ), 10, 1 ); - add_action( 'admin_init_w3tc_dashboard', array( - '\W3TC\Extension_Swarmify_Widget', - 'admin_init_w3tc_dashboard' ) ); - add_action( 'w3tc_extension_page_swarmify', array( $this, 'w3tc_extension_page_swarmify' ) ); diff --git a/wp-content/plugins/w3-total-cache/Extension_Swarmify_Widget.php b/wp-content/plugins/w3-total-cache/Extension_Swarmify_Widget.php deleted file mode 100644 index c79af398..00000000 --- a/wp-content/plugins/w3-total-cache/Extension_Swarmify_Widget.php +++ /dev/null @@ -1,237 +0,0 @@ -_config = Dispatcher::config(); - - add_action( 'w3tc_widget_setup', - array( $o, 'wp_dashboard_setup' ), 9000 ); - add_action( 'w3tc_network_dashboard_setup', - array( $o, 'wp_dashboard_setup' ), 9500 ); - - wp_enqueue_style( 'w3tc-widget-swarmify', - plugins_url( 'Extension_Swarmify_Widget_View.css', W3TC_FILE ), - array(), W3TC_VERSION ); - } - - /** - * Dashboard setup action - */ - function wp_dashboard_setup() { - Util_Widget::add( 'w3tc_swarmify', - '', - array( $this, 'widget_swarmify' ), - Util_Ui::admin_url( 'admin.php?page=w3tc_extensions&extension=swarmify&action=view' ), - 'normal' ); - } - - - - /** - * Loads and configured New Relic widget to be used in WP Dashboards. - * - * @param unknown $widget_id - * @param array $form_inputs - */ - function widget_swarmify( $widget_id, $form_inputs = array() ) { - $api_key = $this->_config->get_string( array( 'swarmify', 'api_key' ) ); - $configured = !empty( $api_key ); - - $swarmify_signup_url = 'https://www.swarmify.com/landing/w3tc?return=' . - urlencode( wp_nonce_url( Util_Ui::admin_url( 'admin.php' ), 'w3tc' ) . - '&page=w3tc_extensions&w3tc_swarmify_set_key=set' ); - - if ( $configured ) { - include W3TC_DIR . '/Extension_Swarmify_Widget_View_NotConfigured.php'; - return; - } else { - include W3TC_DIR . '/Extension_Swarmify_Widget_View_NotConfigured.php'; - } - } - - - - /** - * Gives data for widget content - */ - public function w3tc_ajax_newrelic_widgetdata_basic() { - // cache status for some small time - $response = get_transient( 'w3tc_nr_widgetdata_basic' ); - $response = @json_decode( $response, true ); - if ( is_array( $response ) && isset( $response['time'] ) && - $response['time'] >= time() - 60 ) { - echo json_encode( $response ); - return; - } - - $service = Dispatcher::component( 'Extension_NewRelic_Service' ); - $verify_running = $service->verify_running(); - - $response = array( - 'time' => time() - ); - - if ( !is_array( $verify_running ) ) - $response['php_agent'] = 'enabled'; - else - $response['php_agent'] = 'disabled'; - - try { - $subscription = $service->get_subscription(); - $response['subscription_level'] = $subscription['product-name']; - - $summary = $service->get_application_summary(); - $this->_fill( $response, 'apdex', $summary, 'Apdex' ); - $this->_fill( $response, 'application_busy', $summary, - 'Application Busy' ); - $this->_fill( $response, 'error_rate', $summary, 'Error Rate' ); - $this->_fill( $response, 'throughput', $summary, 'Throughput' ); - $this->_fill( $response, 'errors', $summary, 'Errors' ); - $this->_fill( $response, 'response_time', $summary, 'Response Time' ); - $this->_fill( $response, 'db', $summary, 'DB' ); - $this->_fill( $response, 'cpu', $summary, 'CPU' ); - $this->_fill( $response, 'memory', $summary, 'Memory' ); - - $can_use_metrics = $service->can_get_metrics(); - if ( $can_use_metrics ) { - $dashboard_metrics = $service->get_dashboard_metrics(); - $this->_fill_avg( $response, 'enduser', $dashboard_metrics, - 'EndUser' ); - $this->_fill_avg( $response, 'webtransaction', $dashboard_metrics, - 'WebTransaction' ); - $this->_fill_avg( $response, 'database', $dashboard_metrics, - 'Database' ); - } - - // load data for notification here too - $pl = $service->get_frontend_response_time(); - update_option( 'w3tc_nr_frontend_response_time', $pl ); - } catch ( \Exception $ex ) { - } - - set_transient( 'w3tc_nr_widgetdata_basic', json_encode( $response ), 60 ); - echo json_encode( $response ); - } - - - - public function w3tc_ajax_newrelic_widgetdata_pageloads() { - $response = array( - 'content' => '
    No data available
    ' - ); - - try { - $service = Dispatcher::component( 'Extension_NewRelic_Service' ); - $can_use_metrics = $service->can_get_metrics(); - if ( $can_use_metrics ) { - $metric_slow_pages = $service->get_slowest_page_load(); - if ( count( $metric_slow_pages ) > 0 ) { - $s = ''; - - foreach ( $metric_slow_pages as $transaction => $time ) { - $s .= ''; - } - - $s .= '
    ' . $transaction . - '' . Util_Ui::secs_to_time( $time ) . - '
    '; - $response['content'] = $s; - } - } - } catch ( \Exception $e ) { - $response['content'] = '
    Error occurred
    '; - } - - echo json_encode( $response ); - } - - - - public function w3tc_ajax_newrelic_widgetdata_webtransactions() { - $response = array( - 'content' => '
    No data available
    ' - ); - - try { - $service = Dispatcher::component( 'Extension_NewRelic_Service' ); - $can_use_metrics = $service->can_get_metrics(); - if ( $can_use_metrics ) { - $metric_slow = $service->get_slowest_webtransactions(); - if ( count( $metric_slow ) > 0 ) { - $s = ''; - - foreach ( $metric_slow as $transaction => $time ) { - $s .= ''; - } - - $s .= '
    ' . $transaction . - '' . Util_Ui::secs_to_time( $time ) . - '
    '; - $response['content'] = $s; - } - } - } catch ( \Exception $e ) { - $response['content'] = '
    Error occurred
    '; - } - - echo json_encode( $response ); - } - - - - - public function w3tc_ajax_newrelic_widgetdata_dbtimes() { - $response = array( - 'content' => '
    No data available
    ' - ); - - try { - $service = Dispatcher::component( 'Extension_NewRelic_Service' ); - $can_use_metrics = $service->can_get_metrics(); - if ( $can_use_metrics ) { - $metric_slow = $service->get_slowest_database(); - if ( count( $metric_slow ) > 0 ) { - $s = ''; - - foreach ( $metric_slow as $transaction => $time ) { - $s .= ''; - } - - $s .= '
    ' . $transaction . - '' . Util_Ui::secs_to_time( $time ) . - '
    '; - $response['content'] = $s; - } - } - } catch ( \Exception $e ) { - $response['content'] = '
    Error occurred
    '; - } - - echo json_encode( $response ); - } - - - - private function _fill( &$response, $response_key, $summary, $summary_key ) { - if ( isset( $summary[$summary_key] ) ) - $response[$response_key] = $summary[$summary_key]; - } - - - - private function _fill_avg( &$response, $response_key, $metrics, $metric_key ) { - if ( !isset( $metrics[$metric_key] ) ) - return; - - $data = $metrics[$metric_key]; - $response[$response_key] = Util_Ui::secs_to_time( - array_shift( $data[0] )->average_response_time - ); - } -} diff --git a/wp-content/plugins/w3-total-cache/Extension_Swarmify_Widget_View.css b/wp-content/plugins/w3-total-cache/Extension_Swarmify_Widget_View.css deleted file mode 100644 index f9c4d6f1..00000000 --- a/wp-content/plugins/w3-total-cache/Extension_Swarmify_Widget_View.css +++ /dev/null @@ -1,33 +0,0 @@ -.w3tc-widget-swarmify-base.sign-up h4 { - text-align: left; - margin-bottom: 0; - padding-bottom: 0; -} -.w3tc-widget-swarmify-base.sign-up p { - margin-top: 4px; - padding-top: 0; -} -.w3tc-widget-swarmify-base.sign-up p span.desc { - color:#8F8F8F; -} - -.w3tc-widget-swarmify-logo { - width: 170px; - height: 35px; - background: url("pub/img/w3tc_swarmify-logo.png") 0 5px no-repeat; - float: left; -} - -/* -@media -(-webkit-min-device-pixel-ratio: 2), -(min-resolution: 192dpi) { - .w3tc-widget-swarmify-logo{ - float: left; - width: 180px; - height: 90px; - background-image: url("pub/img/w3tc_swarmify-logo-retina.png"); - background-size: 589px 90px; - } -} -*/ diff --git a/wp-content/plugins/w3-total-cache/Extension_Swarmify_Widget_View_NotConfigured.php b/wp-content/plugins/w3-total-cache/Extension_Swarmify_Widget_View_NotConfigured.php deleted file mode 100644 index d50ef0c5..00000000 --- a/wp-content/plugins/w3-total-cache/Extension_Swarmify_Widget_View_NotConfigured.php +++ /dev/null @@ -1,17 +0,0 @@ - -
    -

    -

    -

    - -

    -

    -

    - -
    diff --git a/wp-content/plugins/w3-total-cache/Extensions_Page.php b/wp-content/plugins/w3-total-cache/Extensions_Page.php index 29f3076e..752dafb8 100644 --- a/wp-content/plugins/w3-total-cache/Extensions_Page.php +++ b/wp-content/plugins/w3-total-cache/Extensions_Page.php @@ -38,34 +38,47 @@ class Extensions_Page extends Base_Page_Settings { } } - $extension = ''; $extension_val = Util_Request::get_string( 'extension' ); - if ( ! empty( $extension_val ) ) { - $extension = esc_attr( $extension_val ); - } + $extension = ( ! empty( $extension_val ) ? esc_attr( $extension_val ) : '' ); $action_val = Util_Request::get_string( 'action' ); $view = ( ! empty( $action_val ) && 'view' === $action_val ); $extensions_active = Extensions_Util::get_active_extensions( $this->_config ); + foreach ( $extensions_active as $key => $ext ) { + if ( isset( $ext['public'] ) && false === $ext['public'] ) { + unset( $extensions_active[ $key ] ); + } + } if ( $extension && $view ) { $all_settings = $this->_config->get_array( 'extensions.settings' ); - $meta = $extensions_active[$extension]; - $sub_view = 'settings'; + $meta = $extensions_active[ $extension ]; + $sub_view = 'settings'; } else { $extensions_all = Extensions_Util::get_extensions( $this->_config ); + foreach ( $extensions_all as $key => $ext ) { + if ( isset( $ext['public'] ) && false === $ext['public'] ) { + unset( $extensions_all[ $key ] ); + } + } + $extensions_inactive = Extensions_Util::get_inactive_extensions( $this->_config ); - $var = "extensions_{$extension_status}"; - $extensions = $$var; - $extension_keys = array_keys($extensions); - sort($extension_keys); + foreach ( $extensions_inactive as $key => $ext ) { + if ( isset( $ext['public'] ) && false === $ext['public'] ) { + unset( $extensions_inactive[ $key ] ); + } + } + + $var = "extensions_{$extension_status}"; + $extensions = $$var; + $extension_keys = array_keys( $extensions ); + sort( $extension_keys ); $sub_view = 'list'; - $page = 1; + $page = 1; } - $config = Dispatcher::config(); include W3TC_INC_OPTIONS_DIR . '/extensions.php'; } diff --git a/wp-content/plugins/w3-total-cache/FeatureShowcase_Plugin_Admin.php b/wp-content/plugins/w3-total-cache/FeatureShowcase_Plugin_Admin.php index 9b4b3579..5176d5f2 100644 --- a/wp-content/plugins/w3-total-cache/FeatureShowcase_Plugin_Admin.php +++ b/wp-content/plugins/w3-total-cache/FeatureShowcase_Plugin_Admin.php @@ -240,6 +240,22 @@ class FeatureShowcase_Plugin_Admin { return array( 'new' => array( + 'remove-cssjs' => array( + 'title' => esc_html__( 'Remove Unused CSS/JS', 'w3-total-cache' ), + 'icon' => 'dashicons-editor-strikethrough', + 'text' => esc_html__( 'Removes specfied CSS/JS tags from the homepage or on a per page basis. Can be used to eliminate unused CSS/JS on pages that do not require them.', 'w3-total-cache' ), + 'button' => '', + 'link' => '' . __( 'More info', 'w3-total-cache' ) . '', + 'is_premium' => true, + 'is_new' => true, + 'version' => '2.7.0', + ), 'preload-requests' => array( 'title' => esc_html__( 'Preload Requests', 'w3-total-cache' ), 'icon' => 'dashicons-controls-repeat', @@ -254,6 +270,7 @@ class FeatureShowcase_Plugin_Admin { '">' . __( 'More info', 'w3-total-cache' ) . '', 'is_premium' => true, 'is_new' => true, + 'version' => '2.6.1', ), 'defer-scripts' => array( 'title' => esc_html__( 'Delay Scripts', 'w3-total-cache' ), @@ -269,6 +286,7 @@ class FeatureShowcase_Plugin_Admin { '">' . __( 'More info', 'w3-total-cache' ) . '', 'is_premium' => true, 'is_new' => true, + 'version' => '2.6.1', ), ), 'old' => array( diff --git a/wp-content/plugins/w3-total-cache/FeatureShowcase_Plugin_Admin_View.php b/wp-content/plugins/w3-total-cache/FeatureShowcase_Plugin_Admin_View.php index 6d66ded7..6b2f3b29 100644 --- a/wp-content/plugins/w3-total-cache/FeatureShowcase_Plugin_Admin_View.php +++ b/wp-content/plugins/w3-total-cache/FeatureShowcase_Plugin_Admin_View.php @@ -44,7 +44,6 @@ foreach ( $cards_data as $card_type => $cards ) { $card_classes = 'w3tc-card'; $title_classes = 'w3tc-card-title'; $is_premium = ! empty( $card['is_premium'] ); - $is_new = ! empty( $card['is_new'] ); if ( $is_premium ) { $card_classes .= ' w3tc-card-premium'; @@ -80,13 +79,13 @@ foreach ( $cards_data as $card_type => $cards ) {
    - W3 Total Cache Pro ! + W3 Total Cache !
    div > div, +#api_charts #apimonthly_chart table tr td > div > div { + width: 100%; + margin: 0 auto; +} + +svg > g:last-child > g:last-child { pointer-events: none } +div.google-visualization-tooltip { pointer-events: none } + +#w3tc_imageservice .w3tc-webp-widget-stats-inactive { + display: flex; + align-items: center; + justify-content: center; + background-size: contain; + background-repeat: no-repeat; + background-position: center; + width: 100%; + height: 100%; +} + +#w3tc_imageservice .w3tc-webp-widget-stats-inactive { + background-image: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.2)), url("pub/img/w3tc-webp-converter.png"); +} + +#w3tc_partners #partner-list li { + display: flex; + align-items: center; + margin-bottom: 5px; +} + +#w3tc_partners #partner-list li .partner-logo { + margin-right: 10px; + display: flex; + align-items: center; +} + +#w3tc_partners #partner-list li .partner-logo img { + display: block; + height: auto; +} + +#w3tc_partners #partner-bottom { + text-align: right; +} + +@media only screen and (max-width: 1200px) { + .general-settings-container { + column-gap: 35px; + } + + .general-settings-container .general-setting { + width: calc(50% - 18px); + } +} + +@media only screen and (max-width: 980px) { + .general-settings-container .general-setting { + width: 100%; + } +} + +@media only screen and (max-width: 782px) { + .general-settings-container { + column-gap: 35px; + } + + .general-settings-container .general-setting { + width: calc(50% - 18px); + } } @media only screen and (max-device-width: 480px) { - #w3tc-dashboard-widgets #postbox-container-left { - margin-right: 0px; - } - #w3tc-dashboard-widgets { - min-width: auto; - flex-wrap: wrap; - } - #postbox-container-right { - width: 100%; - white-space: nowrap; - float: left; - margin-left: 0px; - } - #w3tc-dashboard-widgets { - background: none; - } - #w3tc-dashboard-widgets #normal-sortables .postbox { - width: 100%; - } - #w3tc-dashboard-widgets #side-sortables .postbox .postbox-header .w3tc-widget-text { - float: none; - } - #w3tc-dashboard-widgets #side-sortables .postbox .postbox-header, - #w3tc-dashboard-widgets #side-sortables .postbox .inside { - text-align: center; - } .w3tc_generic_widgetservice_label { display: inline; } + + .general-settings-container .general-setting { + width: 100%; + } + #api_charts #apihourly_chart, + #api_charts #apimonthly_chart { + width: 100%; + } } - -/** - * HiDPI Displays - */ -/* doesnt work -@media print, -only screen and (-webkit-min-device-pixel-ratio: 2), -only screen and ( min--moz-device-pixel-ratio: 2), -only screen and ( -o-min-device-pixel-ratio: 2/1), -only screen and ( min-device-pixel-ratio: 2), -only screen and ( min-resolution: 192dpi), -only screen and ( min-resolution: 2dppx) { - #w3tc h2.logo { - background-image: url("pub/img/W3TC_dashboard_logo_title-retina.png"); - background-size: 224px 44px; - } - - .w3tc-widget-w3tc-logo { - float: left; - width: 50px; - height: 90px; - background-image: url("pub/img/w3tc_w3tc-logo-retina.png"); - background-size: 41px 34px; - } - - .w3tc-widget-services-logo { - float: left; - width: 50px; - height: 90px; - background-image: url("pub/img/w3tc_w3edge-logo-retina.png"); - background-size: 37px 35px; - } - - .w3tc-widget-pagespeed-logo { - float: left; - width: 110px; - height: 90px; - background-image: url("pub/img/w3tc_google-logo-retina.png"); - background-size: 97px 33px; - } -} -*/ diff --git a/wp-content/plugins/w3-total-cache/Generic_Page_Install.php b/wp-content/plugins/w3-total-cache/Generic_Page_Install.php index 372893b5..f20058bc 100644 --- a/wp-content/plugins/w3-total-cache/Generic_Page_Install.php +++ b/wp-content/plugins/w3-total-cache/Generic_Page_Install.php @@ -18,6 +18,7 @@ class Generic_Page_Install extends Base_Page_Settings { */ function view() { $rewrite_rules_descriptors = array(); + $other_areas = array(); if ( Util_Rule::can_check_rules() ) { $e = Dispatcher::component( 'Root_Environment' ); diff --git a/wp-content/plugins/w3-total-cache/Generic_Plugin.php b/wp-content/plugins/w3-total-cache/Generic_Plugin.php index ca1b54e6..c5b1cfe2 100644 --- a/wp-content/plugins/w3-total-cache/Generic_Plugin.php +++ b/wp-content/plugins/w3-total-cache/Generic_Plugin.php @@ -545,6 +545,7 @@ class Generic_Plugin { array( 'swarmify', 'lazyload', + 'removecssjs', 'deferscripts', 'minify', 'newrelic', diff --git a/wp-content/plugins/w3-total-cache/Generic_Plugin_Admin.php b/wp-content/plugins/w3-total-cache/Generic_Plugin_Admin.php index 1a03d4ab..a2ab7656 100644 --- a/wp-content/plugins/w3-total-cache/Generic_Plugin_Admin.php +++ b/wp-content/plugins/w3-total-cache/Generic_Plugin_Admin.php @@ -56,9 +56,13 @@ class Generic_Plugin_Admin { $this->is_w3tc_page = Util_Admin::is_w3tc_admin_page(); add_action( 'admin_init', array( $this, 'admin_init' ) ); + add_action( 'admin_init_w3tc_dashboard', array( '\W3TC\Generic_WidgetAccount', 'admin_init_w3tc_dashboard' ) ); + add_action( 'admin_init_w3tc_dashboard', array( '\W3TC\Generic_WidgetSettings', 'admin_init_w3tc_dashboard' ) ); + add_action( 'admin_init_w3tc_dashboard', array( '\W3TC\Generic_WidgetPartners', 'admin_init_w3tc_dashboard' ) ); add_action( 'admin_init_w3tc_dashboard', array( '\W3TC\Generic_WidgetServices', 'admin_init_w3tc_dashboard' ) ); - add_action( 'admin_init_w3tc_dashboard', array( '\W3TC\Generic_WidgetCommunity', 'admin_init_w3tc_dashboard' ) ); add_action( 'admin_init_w3tc_dashboard', array( '\W3TC\Generic_WidgetBoldGrid', 'admin_init_w3tc_dashboard' ) ); + add_action( 'admin_init_w3tc_dashboard', array( '\W3TC\Generic_WidgetStats', 'admin_init_w3tc_dashboard' ) ); + add_action( 'admin_init_w3tc_dashboard', array( '\W3TC\Extension_ImageService_Widget', 'admin_init_w3tc_dashboard' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); add_action( 'admin_print_styles-toplevel_page_w3tc_dashboard', array( '\W3TC\Generic_Page_Dashboard', 'admin_print_styles_w3tc_dashboard' ) ); @@ -384,18 +388,6 @@ class Generic_Plugin_Admin { } } - if ( 'w3tc_dashboard' === $page ) { - ?> - - _config->get_boolean( 'common.track_usage' ) && $this->is_w3tc_page ) { $current_user = wp_get_current_user(); @@ -632,6 +624,19 @@ class Generic_Plugin_Admin { true ); // No break. + case 'w3tc_userexperience': + if ( UserExperience_Remove_CssJs_Extension::is_enabled() ) { + wp_enqueue_script( + 'w3tc_remove_cssjs', + plugins_url( 'UserExperience_Remove_CssJs_Page_View.js', W3TC_FILE ), + array( + 'jquery', + ), + W3TC_VERSION, + true + ); + } + // No break. case 'w3tc_cdn': wp_enqueue_script( 'jquery-ui-sortable' ); break; diff --git a/wp-content/plugins/w3-total-cache/Generic_Plugin_WidgetForum.php b/wp-content/plugins/w3-total-cache/Generic_Plugin_WidgetForum.php deleted file mode 100644 index 271d0a80..00000000 --- a/wp-content/plugins/w3-total-cache/Generic_Plugin_WidgetForum.php +++ /dev/null @@ -1,151 +0,0 @@ -_config = Dispatcher::config(); - } - - /** - * Runs plugin. - */ - public function run() { - if ( Util_Admin::get_current_wp_page() == 'w3tc_dashboard' ) { - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) ); - } - - add_action( - 'w3tc_widget_setup', - array( $this, 'wp_dashboard_setup' ) - ); - - add_action( - 'w3tc_network_dashboard_setup', - array( $this, 'wp_dashboard_setup' ) - ); - - if ( is_admin() ) { - add_action( 'wp_ajax_w3tc_widget_latest_ajax', array( $this, 'action_widget_latest_ajax' ) ); - } - } - - /** - * Dashboard setup action. - */ - public function wp_dashboard_setup() { - Util_Widget::add( - 'w3tc_latest', - __( 'Discussions', 'w3-total-cache' ), - array( $this, 'widget_latest' ), - array( $this, 'widget_latest_control' ), - 'side' - ); - } - - /** - * Returns key for transient cache of "widget latest". - */ - public function _widget_latest_cache_key() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore - return 'dash_' . md5( 'w3tc_latest' ); - } - - /** - * Prints latest widget contents. - */ - public function widget_latest() { - $output = get_transient( $this->_widget_latest_cache_key() ); - - if ( false !== $output ) { - echo wp_kses( - $output, - array( - 'a' => array( - 'href' => array(), - 'target' => array(), - ), - 'h4' => array(), - 'p' => array( - 'style' => array(), - ), - ) - ); - } else { - include W3TC_INC_DIR . '/widget/latest.php'; - } - } - - /** - * Prints latest widget contents. - */ - public function action_widget_latest_ajax() { - // Load content of feed. - global $wp_version; - - $items = array(); - $items_count = $this->_config->get_integer( 'widget.latest.items' ); - - include_once ABSPATH . WPINC . '/feed.php'; - $feed = fetch_feed( W3TC_FEED_URL ); - - if ( ! is_wp_error( $feed ) ) { - $feed_items = $feed->get_items( 0, $items_count ); - - foreach ( $feed_items as $feed_item ) { - $items[] = array( - 'link' => $feed_item->get_link(), - 'title' => htmlspecialchars_decode( $feed_item->get_title() ), - ); - } - } - - ob_start(); - include W3TC_INC_DIR . '/widget/latest_ajax.php'; - - // Default lifetime in cache of 12 hours (same as the feeds). - set_transient( $this->_widget_latest_cache_key(), ob_get_flush(), 43200 ); - die(); - } - - /** - * Latest widget control - * - * @param integer $widget_id Widget id. - * @param array $form_inputs Form inputs. - */ - public function widget_latest_control( $widget_id, $form_inputs = array() ) { - if ( 'POST' === ( isset( $_SERVER['REQUEST_METHOD'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_METHOD'] ) ) : '' ) ) { - $this->_config->set( 'widget.latest.items', Util_Request::get_integer( 'w3tc_widget_latest_items', 3 ) ); - $this->_config->save(); - delete_transient( $this->_widget_latest_cache_key() ); - } - include W3TC_INC_DIR . '/widget/latest_control.php'; - } - - /** - * Enqueue scripts and styles. - */ - public function enqueue() { - wp_enqueue_style( 'w3tc-widget' ); - wp_enqueue_script( 'w3tc-metadata' ); - wp_enqueue_script( 'w3tc-widget' ); - } -} diff --git a/wp-content/plugins/w3-total-cache/Generic_Plugin_WidgetNews.php b/wp-content/plugins/w3-total-cache/Generic_Plugin_WidgetNews.php deleted file mode 100644 index 8942c1db..00000000 --- a/wp-content/plugins/w3-total-cache/Generic_Plugin_WidgetNews.php +++ /dev/null @@ -1,155 +0,0 @@ -_config = Dispatcher::config(); - } - - /** - * Runs plugin. - */ - public function run() { - if ( Util_Admin::get_current_wp_page() === 'w3tc_dashboard' ) { - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) ); - } - - add_action( 'w3tc_widget_setup', array( $this, 'wp_dashboard_setup' ) ); - add_action( 'w3tc_network_dashboard_setup', array( $this, 'wp_dashboard_setup' ) ); - - if ( is_admin() ) { - add_action( 'wp_ajax_w3tc_widget_latest_news_ajax', array( $this, 'action_widget_latest_news_ajax' ) ); - } - } - - /** - * Dashboard setup action. - */ - public function wp_dashboard_setup() { - Util_Widget::add( - 'w3tc_latest_news', - __( 'News', 'w3-total-cache' ), - array( - $this, - 'widget_latest', - ), - array( - $this, - 'widget_latest_control', - ), - 'side' - ); - } - - /** - * Returns key for transient cache of "widget latest" - * - * @return string - */ - public function _widget_latest_cache_key() { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore - return 'dash_' . md5( 'w3tc_latest_news' ); - } - - /** - * Prints latest widget contents - * - * @return void - */ - public function widget_latest() { - $output = get_transient( $this->_widget_latest_cache_key() ); - - if ( false !== $output ) { - echo wp_kses( - $output, - array( - 'a' => array( - 'href' => array(), - 'target' => array(), - ), - 'h4' => array(), - 'p' => array( - 'style' => array(), - ), - ) - ); - } else { - include W3TC_INC_DIR . '/widget/latest_news.php'; - } - } - - /** - * Prints latest widget contents. - */ - public function action_widget_latest_news_ajax() { - // load content of feed. - global $wp_version; - - $items = array(); - $items_count = $this->_config->get_integer( 'widget.latest_news.items' ); - - include_once ABSPATH . WPINC . '/feed.php'; - - $feed = fetch_feed( W3TC_NEWS_FEED_URL ); - - if ( ! is_wp_error( $feed ) ) { - $feed_items = $feed->get_items( 0, $items_count ); - - foreach ( $feed_items as $feed_item ) { - $items[] = array( - 'link' => $feed_item->get_link(), - 'title' => htmlspecialchars_decode( $feed_item->get_title() ), - ); - } - } - - ob_start(); - include W3TC_INC_DIR . '/widget/latest_news_ajax.php'; - - // Default lifetime in cache of 12 hours (same as the feeds). - set_transient( $this->_widget_latest_cache_key(), ob_get_flush(), 43200 ); - die(); - } - - /** - * Latest widget control. - * - * @param integer $widget_id Widget id. - * @param array $form_inputs Form inputs. - */ - public function widget_latest_control( $widget_id, $form_inputs = array() ) { - if ( 'POST' === ( isset( $_SERVER['REQUEST_METHOD'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_METHOD'] ) ) : '' ) ) { - $this->_config->set( 'widget.latest_news.items', Util_Request::get_integer( 'w3tc_widget_latest_news_items', 3 ) ); - $this->_config->save(); - delete_transient( $this->_widget_latest_cache_key() ); - } - include W3TC_INC_DIR . '/widget/latest_news_control.php'; - } - - /** - * Enqueue scripts and styles. - */ - public function enqueue() { - wp_enqueue_style( 'w3tc-widget' ); - wp_enqueue_script( 'w3tc-metadata' ); - wp_enqueue_script( 'w3tc-widget' ); - } -} diff --git a/wp-content/plugins/w3-total-cache/Generic_WidgetAccount.php b/wp-content/plugins/w3-total-cache/Generic_WidgetAccount.php new file mode 100644 index 00000000..e8ec654c --- /dev/null +++ b/wp-content/plugins/w3-total-cache/Generic_WidgetAccount.php @@ -0,0 +1,58 @@ +
    ' . __( 'Account', 'w3-total-cache' ) . '
    ', + array( $this, 'widget_form' ), + null, + 'normal' + ); + } + + /** + * Premium Services widget content. + * + * @since X.X.X + * + * @return void + */ + public function widget_form() { + include W3TC_DIR . '/Generic_WidgetAccount_View.php'; + } +} diff --git a/wp-content/plugins/w3-total-cache/Generic_WidgetAccount_View.php b/wp-content/plugins/w3-total-cache/Generic_WidgetAccount_View.php new file mode 100644 index 00000000..47f25a9b --- /dev/null +++ b/wp-content/plugins/w3-total-cache/Generic_WidgetAccount_View.php @@ -0,0 +1,77 @@ +get_license_key(); +$license = Licensing_Core::check_license( $license_key, W3TC_VERSION ); +?> + + + + + + + + + + +
    license_status === 'active.by_rooturi' ? __( 'Pro', 'w3-total-cache' ) : __( 'Free', 'w3-total-cache' ); ?>
    + license_status: + esc_html_e( 'Active', 'w3-total-cache' ); + break; + case 'inactive.expired' === $license->license_status: + esc_html_e( 'Expired', 'w3-total-cache' ); + break; + case 'invalid.not_present' === $license->license_status: + esc_html_e( 'Free license, no expiration', 'w3-total-cache' ); + break; + default: + esc_html_e( 'Unknown', 'w3-total-cache' ); + } + } else { + esc_html_e( 'Free license, no expiration', 'w3-total-cache' ); + } + ?> +
    +license_status === 'invalid.not_present' ) ) { + ?> +

    + ', + '' + ), + array( 'strong' => array() ) + ); + ?> +

    +

    + +

    + diff --git a/wp-content/plugins/w3-total-cache/Generic_WidgetBoldGrid.php b/wp-content/plugins/w3-total-cache/Generic_WidgetBoldGrid.php index 6b8b956e..d55bf229 100644 --- a/wp-content/plugins/w3-total-cache/Generic_WidgetBoldGrid.php +++ b/wp-content/plugins/w3-total-cache/Generic_WidgetBoldGrid.php @@ -10,7 +10,7 @@ class Generic_WidgetBoldGrid { $o = new Generic_WidgetBoldGrid(); - Util_Widget::add2( 'w3tc_boldgrid', 5000, + Util_Widget::add2( 'w3tc_boldgrid', 800, '', array( $o, 'widget_form' ), self_admin_url( diff --git a/wp-content/plugins/w3-total-cache/Generic_WidgetCommunity.php b/wp-content/plugins/w3-total-cache/Generic_WidgetCommunity.php deleted file mode 100644 index 7812443d..00000000 --- a/wp-content/plugins/w3-total-cache/Generic_WidgetCommunity.php +++ /dev/null @@ -1,53 +0,0 @@ -' . - '
    ' . - __( 'W3TC Community Edition', 'w3-total-cache' ) . - '
    ', - array( $this, 'widget_form' ), - null, - 'normal' - ); - } - - /** - * Render the content of our widget. - * - * @since 0.14.3 - */ - public function widget_form() { - include W3TC_DIR . '/Generic_WidgetCommunity_View.php'; - } -} diff --git a/wp-content/plugins/w3-total-cache/Generic_WidgetCommunity_View.php b/wp-content/plugins/w3-total-cache/Generic_WidgetCommunity_View.php deleted file mode 100644 index e7ad0167..00000000 --- a/wp-content/plugins/w3-total-cache/Generic_WidgetCommunity_View.php +++ /dev/null @@ -1,40 +0,0 @@ - - -

    - ', - '' - ), - array( 'strong' => array() ) - ); ?> -

    - - - -

    - ', - '' - ), - array( 'strong' => array() ) - ); ?> -

    - -

    - -

    diff --git a/wp-content/plugins/w3-total-cache/Generic_WidgetPartners.php b/wp-content/plugins/w3-total-cache/Generic_WidgetPartners.php new file mode 100644 index 00000000..42a83078 --- /dev/null +++ b/wp-content/plugins/w3-total-cache/Generic_WidgetPartners.php @@ -0,0 +1,58 @@ +
    ' . __( 'Setup Guides from Partner Hosts', 'w3-total-cache' ) . '
    ', + array( $this, 'widget_form' ), + null, + 'normal' + ); + } + + /** + * Premium Services widget content. + * + * @since X.X.X + * + * @return void + */ + public function widget_form() { + include W3TC_DIR . '/Generic_WidgetPartners_View.php'; + } +} diff --git a/wp-content/plugins/w3-total-cache/Generic_WidgetPartners_View.php b/wp-content/plugins/w3-total-cache/Generic_WidgetPartners_View.php new file mode 100644 index 00000000..bc45af7d --- /dev/null +++ b/wp-content/plugins/w3-total-cache/Generic_WidgetPartners_View.php @@ -0,0 +1,37 @@ + +

    + +

    +
    +

    ?

    diff --git a/wp-content/plugins/w3-total-cache/Generic_WidgetServices.php b/wp-content/plugins/w3-total-cache/Generic_WidgetServices.php index 2133539c..a55030d9 100644 --- a/wp-content/plugins/w3-total-cache/Generic_WidgetServices.php +++ b/wp-content/plugins/w3-total-cache/Generic_WidgetServices.php @@ -8,7 +8,7 @@ namespace W3TC; /** - * Class Generic_Plugin_WidgetServices + * Class Generic_WidgetServices */ class Generic_WidgetServices { /** @@ -24,8 +24,8 @@ class Generic_WidgetServices { */ public static function admin_init_w3tc_dashboard() { $o = new Generic_WidgetServices(); - add_action( 'w3tc_widget_setup', array( $o, 'wp_dashboard_setup' ), 5000 ); - add_action( 'w3tc_network_dashboard_setup', array( $o, 'wp_dashboard_setup' ), 5000 ); + add_action( 'w3tc_widget_setup', array( $o, 'wp_dashboard_setup' ), 600 ); + add_action( 'w3tc_network_dashboard_setup', array( $o, 'wp_dashboard_setup' ), 600 ); } /** diff --git a/wp-content/plugins/w3-total-cache/Generic_WidgetSettings.php b/wp-content/plugins/w3-total-cache/Generic_WidgetSettings.php new file mode 100644 index 00000000..7f58668c --- /dev/null +++ b/wp-content/plugins/w3-total-cache/Generic_WidgetSettings.php @@ -0,0 +1,56 @@ +
    ' . __( 'General Settings', 'w3-total-cache' ) . '
    ', + array( $this, 'widget_form' ), + null, + 'normal' + ); + } + + /** + * Premium Services widget content. + * + * @since X.X.X + * + * @return void + */ + public function widget_form() { + include W3TC_DIR . '/Generic_WidgetSettings_View.php'; + } +} diff --git a/wp-content/plugins/w3-total-cache/Generic_WidgetSettings_View.php b/wp-content/plugins/w3-total-cache/Generic_WidgetSettings_View.php new file mode 100644 index 00000000..be51f912 --- /dev/null +++ b/wp-content/plugins/w3-total-cache/Generic_WidgetSettings_View.php @@ -0,0 +1,98 @@ + array( + 'label' => esc_html__( 'Preview Mode', 'w3-total-cache' ), + 'enabled' => Util_Environment::is_preview_mode(), + ), + 'pgcache' => array( + 'label' => esc_html__( 'Page Cache', 'w3-total-cache' ), + 'enabled' => $config->get_boolean( 'pgcache.enabled' ), + ), + 'minify' => array( + 'label' => esc_html__( 'Minify', 'w3-total-cache' ), + 'enabled' => $config->get_boolean( 'minify.enabled' ), + ), + 'opcode' => array( + 'label' => esc_html__( 'Opcode Cache', 'w3-total-cache' ), + 'enabled' => Util_Installed::opcache() || Util_Installed::apc_opcache(), + ), + 'dbcache' => array( + 'label' => esc_html__( 'Database Cache', 'w3-total-cache' ), + 'enabled' => $config->get_boolean( 'dbcache.enabled' ), + ), + 'objectcache' => array( + 'label' => esc_html__( 'Object Cache', 'w3-total-cache' ), + 'enabled' => $config->getf_boolean( 'objectcache.enabled' ), + ), + 'browsercache' => array( + 'label' => esc_html__( 'Browser Cache', 'w3-total-cache' ), + 'enabled' => $config->getf_boolean( 'browsercache.enabled' ), + ), + 'cdn' => array( + 'label' => esc_html__( 'CDN', 'w3-total-cache' ), + 'enabled' => $config->get_boolean( 'cdn.enabled' ) || $config->get_boolean( 'cdnfsd.enabled' ), + ), + 'varnish' => array( + 'label' => esc_html__( 'Reverse Proxy', 'w3-total-cache' ), + 'enabled' => $config->get_boolean( 'varnish.enabled' ), + ), + 'stats' => array( + 'label' => esc_html__( 'Statistics', 'w3-total-cache' ), + 'enabled' => $config->get_boolean( 'stats.enabled' ), + ), + 'fragmentcache' => array( + 'label' => esc_html__( 'Fragment Cache', 'w3-total-cache' ), + 'enabled' => $config->is_extension_active_frontend( 'fragmentcache' ) && Util_Environment::is_w3tc_pro( $config ), + ), + 'debug' => array( + 'label' => esc_html__( 'Debug', 'w3-total-cache' ), + 'enabled' => $config->get_boolean( 'pgcache.debug' ) + || $config->get_boolean( 'pgcache.debug_purge' ) + || $config->get_boolean( 'minify.debug' ) + || $config->get_boolean( 'dbcache.debug' ) + || $config->get_boolean( 'dbcache.debug_purge' ) + || $config->get_boolean( 'objectcache.debug' ) + || $config->get_boolean( 'objectcache.debug_purge' ) + || $config->get_boolean( array( 'fragmentcache', 'debug' ) ) + || $config->get_boolean( 'cdn.debug' ) + || $config->get_boolean( 'cdnfsd.debug' ) + || $config->get_boolean( 'varnish.debug' ) + || $config->get_boolean( 'cluster.messagebus.debug' ), + ), +); +?> +
    + +
    + + + + +
    + +
    +

    + +

    diff --git a/wp-content/plugins/w3-total-cache/Generic_WidgetSpreadTheWord_Plugin.php b/wp-content/plugins/w3-total-cache/Generic_WidgetSpreadTheWord_Plugin.php index 5f9a7fde..6b69b2b2 100644 --- a/wp-content/plugins/w3-total-cache/Generic_WidgetSpreadTheWord_Plugin.php +++ b/wp-content/plugins/w3-total-cache/Generic_WidgetSpreadTheWord_Plugin.php @@ -22,14 +22,8 @@ class Generic_WidgetSpreadTheWord_Plugin { if ( Util_Admin::get_current_wp_page() == 'w3tc_dashboard' ) add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) ); - add_action( 'w3tc_widget_setup', array( - $this, - 'wp_dashboard_setup' - ), 4000 ); - add_action( 'w3tc_network_dashboard_setup', array( - $this, - 'wp_dashboard_setup' - ), 4000 ); + add_action( 'w3tc_widget_setup', array( $this, 'wp_dashboard_setup' ), 900 ); + add_action( 'w3tc_network_dashboard_setup', array( $this, 'wp_dashboard_setup' ), 900 ); } /** @@ -45,7 +39,7 @@ class Generic_WidgetSpreadTheWord_Plugin { '', array( $this, 'widget_form' ), null, - 'normal' ); + 'bottom' ); } function widget_form() { diff --git a/wp-content/plugins/w3-total-cache/Generic_WidgetStats.js b/wp-content/plugins/w3-total-cache/Generic_WidgetStats.js new file mode 100644 index 00000000..46983999 --- /dev/null +++ b/wp-content/plugins/w3-total-cache/Generic_WidgetStats.js @@ -0,0 +1,110 @@ +/** + * W3TC stats widgets Google Charts driver. + * + * @file Google Charts driver for W3TC dashboard stats widgets. + * @author W3TC. + * @version 1.0 + * @since X.X.X + */ + +jQuery(document).ready(function($) { + google.charts.load('current', {packages: ['corechart', 'line']}); + google.charts.setOnLoadCallback(load); + + // Interval to refresh stats widgets every 60 seconds. + setInterval(function () { + load(); + }, 60000); + + // Refresh charts on resize. + jQuery(window).resize(function(){ + load(); + }); + + // Load method for stat charts. Fires on document ready, window resize, and on 60 second interval. + function load() { + $.getJSON( + ajaxurl + '?action=w3tc_ajax&_wpnonce=' + w3tc_nonce + '&w3tc_action=ustats_get', + function(data) { + if(! data.period.seconds){ + $('#w3tc_page_cache').addClass('w3tc_none'); + $('#w3tc_object_cache').addClass('w3tc_none'); + $('#w3tc_database_cache').addClass('w3tc_none'); + return; + } + processed_data = preprocess_data(data); + draw_charts(processed_data); + } + ); + } + + // Preprocesses statistics data for chart use. + /** + * @param {array} data Statistics data. + * @returns {array} Statistics data in format required for Google charts. + */ + function preprocess_data(data){ + var processed_data = { + 'page_cache':{'data':[],'color':'#6f9654'}, + 'object_cache':{'data':[],'color':'#e2431e'}, + 'database_cache':{'data':[],'color':'#43459d'} + }; + for( var i=40; i
    ' . __( 'Page Cache: Hits', 'w3-total-cache' ) . '
    ', + array( $this, 'page_cache_widget_form' ), + null, + 'normal' + ); + + Util_Widget::add( + 'w3tc_object_cache', + '
    ' . __( 'Object Cache: Hits', 'w3-total-cache' ) . '
    ', + array( $this, 'object_cache_widget_form' ), + null, + 'normal' + ); + + Util_Widget::add( + 'w3tc_database_cache', + '
    ' . __( 'Database Cache: Hits', 'w3-total-cache' ) . '
    ', + array( $this, 'database_cache_widget_form' ), + null, + 'normal' + ); + } + + /** + * Web Requests widget content. + * + * @since X.X.X + * + * @return void + */ + public function page_cache_widget_form() { + $chart = self::get_chart_content( + array( + 'chart_id' => 'page_cache_chart', + 'setting_key' => 'pgcache.enabled', + 'cache_enable_label' => __( 'Enable PageCache', 'w3-total-cache' ), + 'cache_enable_url' => Util_Ui::admin_url( 'admin.php?page=w3tc_general#page_cache' ), + ) + ); + echo wp_kses( $chart, self::get_allowed_tags() ); + } + + /** + * Object Cache widget content. + * + * @since X.X.X + * + * @return void + */ + public function object_cache_widget_form() { + $chart = self::get_chart_content( + array( + 'chart_id' => 'object_cache_chart', + 'setting_key' => 'objectcache.enabled', + 'cache_enable_label' => __( 'Enable ObjectCache', 'w3-total-cache' ), + 'cache_enable_url' => Util_Ui::admin_url( 'admin.php?page=w3tc_general#object_cache' ), + ) + ); + echo wp_kses( $chart, self::get_allowed_tags() ); + } + + /** + * Database widget content. + * + * @since X.X.X + * + * @return void + */ + public function database_cache_widget_form() { + $chart = self::get_chart_content( + array( + 'chart_id' => 'database_cache_chart', + 'setting_key' => 'dbcache.enabled', + 'cache_enable_label' => __( 'Enable DBCache', 'w3-total-cache' ), + 'cache_enable_url' => Util_Ui::admin_url( 'admin.php?page=w3tc_general#database_cache' ), + ) + ); + echo wp_kses( $chart, self::get_allowed_tags() ); + } + + /** + * Get button link allowed tags. + * + * @since X.X.X + * + * @param array $chart_config Chart configuration array. + * + * @return string + */ + public static function get_chart_content( $chart_config ) { + $config = Dispatcher::config(); + $chart_id = $chart_config['chart_id']; + $chart_content = ''; + if ( ! Util_Environment::is_w3tc_pro( $config ) ) { + $chart_id .= '_ad'; + $chart_content = ''; + } elseif ( ! $config->get_boolean( 'stats.enabled' ) ) { + $chart_id .= '_enable'; + $chart_content = Util_Ui::button_link( __( 'Enable Statistics', 'w3-total-cache' ), Util_Ui::admin_url( 'admin.php?page=w3tc_general#stats' ), false, 'button-primary' ); + } elseif ( ! $config->get_boolean( $chart_config['setting_key'] ) ) { + $chart_id .= '_subenable'; + $chart_content = Util_Ui::button_link( $chart_config['cache_enable_label'], $chart_config['cache_enable_url'], false, 'button-primary' ); + } + return '
    ' . $chart_content . '
    '; + } + + /** + * Get button link allowed tags. + * + * @since X.X.X + * + * @return array + */ + public static function get_allowed_tags() { + return array( + 'div' => array( + 'id' => array(), + ), + 'input' => array( + 'type' => array(), + 'name' => array(), + 'class' => array(), + 'value' => array(), + 'onclick' => array(), + 'data-src' => array(), + ), + ); + } +} diff --git a/wp-content/plugins/w3-total-cache/Minify_Core.php b/wp-content/plugins/w3-total-cache/Minify_Core.php index 45bcc44a..9dab8513 100644 --- a/wp-content/plugins/w3-total-cache/Minify_Core.php +++ b/wp-content/plugins/w3-total-cache/Minify_Core.php @@ -9,19 +9,17 @@ class Minify_Core { * Encode an array of files into a filename containing all files. */ static public function urls_for_minification_to_minify_filename( $files, $type ) { - $v = get_option( 'w3tc_minify' ); - $minify_filenames = @json_decode( $v, true ); - if ( !is_array( $minify_filenames ) ) - $minify_filenames = array(); - $files_string = json_encode( $files ); - $key = substr( md5( $files_string ), 0, 5 ); - // collision protection - if ( isset( $minify_filenames[$key] ) ) { - $files_stored = $minify_filenames[$key]; - if ( json_encode( $files_stored ) != $files_string ) { - $key = md5( $files_string ); + $key = self::urls_for_minification_to_minify_key( $files_string, + substr( md5( $files_string ), 0, 5 ) ); + if ( is_null( $key ) ) { + // key collision (rare case), try full md5 + $key = self::urls_for_minification_to_minify_key( $files_string, + md5( $files_string ) ); + if ( is_null( $key ) ) { + // collision of full md5 - unprobable + return null; } } @@ -30,13 +28,26 @@ class Minify_Core { 'w3tc_minify_urls_for_minification_to_minify_filename', $minify_filename, $files, $type ); - $minify_filenames[$minify_filename] = $files; - update_option( 'w3tc_minify', json_encode( $minify_filenames ), false ); - return $minify_filename; } + /** + * Tries key for minified array of files + */ + static private function urls_for_minification_to_minify_key( $files_string, $key ) { + $v = get_option( 'w3tc_minify_' . $key ); + $minify_filenames = @json_decode( $v, true ); + if ( empty( $minify_filenames ) || !is_array( $minify_filenames ) ) { + update_option( 'w3tc_minify_' . $key, $files_string, false ); + return $key; + } + if ( $v === $files_string ) { + return $key; + } + + return null; + } /** * Decode a minify auto filename into an array of files. @@ -46,16 +57,12 @@ class Minify_Core { * @return array */ static public function minify_filename_to_urls_for_minification( $filename, $type ) { - $v = get_option( 'w3tc_minify' ); - $minify_filenames = @json_decode( $v, true ); - if ( !is_array( $minify_filenames ) ) - $minify_filenames = array(); - - $minify_filename = $filename . '.' . $type; - if ( !isset( $minify_filenames[$minify_filename] ) ) + $v = get_option( 'w3tc_minify_' . $filename ); + $urls_unverified = @json_decode( $v, true ); + if ( !is_array( $urls_unverified ) ) { return array(); + } - $urls_unverified = $minify_filenames[$minify_filename]; $urls = array(); foreach ( $urls_unverified as $file ) { diff --git a/wp-content/plugins/w3-total-cache/Minify_GeneralPage_View_ShowHelp.js b/wp-content/plugins/w3-total-cache/Minify_GeneralPage_View_ShowHelp.js index cf0a0d55..321d6f1e 100644 --- a/wp-content/plugins/w3-total-cache/Minify_GeneralPage_View_ShowHelp.js +++ b/wp-content/plugins/w3-total-cache/Minify_GeneralPage_View_ShowHelp.js @@ -1,17 +1,18 @@ function w3tc_show_minify_help() { - W3tc_Lightbox.open({ - id: 'w3tc-overlay', - close: '', - width: 800, - height: 610, - url: ajaxurl + '?action=w3tc_ajax&_wpnonce=' + w3tc_nonce + - '&w3tc_action=minify_help', - callback: function(lightbox) { - jQuery('.btn-primary', lightbox.container).click(function() { - lightbox.close(); - }); - } - }); + W3tc_Lightbox.open({ + id: 'w3tc-overlay', + close: '', + width: 800, + height: 610, + url: ajaxurl + '?action=w3tc_ajax&_wpnonce=' + w3tc_nonce + + '&w3tc_action=minify_help', + callback: function(lightbox) { + jQuery('.btn-primary', lightbox.container).click(function() { + lightbox.close(); + }); + lightbox.resize(); + } + }); } diff --git a/wp-content/plugins/w3-total-cache/Minify_MinifiedFileRequestHandler.php b/wp-content/plugins/w3-total-cache/Minify_MinifiedFileRequestHandler.php index e90da9dd..1f6eb288 100644 --- a/wp-content/plugins/w3-total-cache/Minify_MinifiedFileRequestHandler.php +++ b/wp-content/plugins/w3-total-cache/Minify_MinifiedFileRequestHandler.php @@ -289,17 +289,25 @@ class Minify_MinifiedFileRequestHandler { /** - * Flushes cache + * Flushes cache. * - * @return boolean + * @return bool */ - function flush() { + public function flush( $extras = array() ) { $cache = $this->_get_cache(); - // used to debug - which plugin calls flush all the time and breaks - // performance + // Used to debug - which plugin calls flush all the time and breaks performance. if ( $this->_config->get_boolean( 'minify.debug' ) ) { Minify_Core::log( 'Minify flush called from' ); - Minify_Core::log( json_encode( debug_backtrace () ) ); + Minify_Core::log( wp_json_encode( debug_backtrace() ) ); + } + + /* + * Cleanup of map too often is risky since breaks all old minify urls. + * Particularly minified urls in browsercached/cdn cached html becomes invalid. + */ + if ( isset( $extras['ui_action'] ) && 'flush_button' === $extras['ui_action'] ) { + global $wpdb; + $wpdb->query( "DELETE FROM $wpdb->options WHERE `option_name` = 'w3tc_minify' OR `option_name` LIKE 'w3tc_minify_%'" ); } return $cache->flush(); @@ -543,6 +551,8 @@ class Minify_MinifiedFileRequestHandler { Minify_Core::debug_error( sprintf( 'Unable to fetch custom files list: "%s.%s"', $hash, $type ), false, 404 ); } + Minify_Core::log( implode("\n", $files ) ); + return $result; } diff --git a/wp-content/plugins/w3-total-cache/Minify_Plugin_Admin.php b/wp-content/plugins/w3-total-cache/Minify_Plugin_Admin.php index 85a988be..5668c479 100644 --- a/wp-content/plugins/w3-total-cache/Minify_Plugin_Admin.php +++ b/wp-content/plugins/w3-total-cache/Minify_Plugin_Admin.php @@ -263,10 +263,10 @@ class Minify_Plugin_Admin { } if ( isset( $v['size_used'] ) ) { - $a['size_used'] = $v['size_used']; - $a['size_items'] = $v['size_items']; - $a['size_compression_css'] = $v['size_compression_css']; - $a['size_compression_js'] = $v['size_compression_js']; + $a['size_used'] = $v['size_used']; + $a['size_items'] = empty( $v['size_items'] ) ? null : $v['size_items']; + $a['size_compression_css'] = empty( $v['size_compression_css'] ) ? null : $v['size_compression_css']; + $a['size_compression_js'] = empty( $v['size_compression_js'] ) ? null : $v['size_compression_js']; } } diff --git a/wp-content/plugins/w3-total-cache/PageSpeed_Data.php b/wp-content/plugins/w3-total-cache/PageSpeed_Data.php index 434a5a7f..940aa8a1 100644 --- a/wp-content/plugins/w3-total-cache/PageSpeed_Data.php +++ b/wp-content/plugins/w3-total-cache/PageSpeed_Data.php @@ -31,28 +31,34 @@ class PageSpeed_Data { return array( 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'categories', 'performance', 'score' ) ) * 100, 'first-contentful-paint' => array( - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'first-contentful-paint', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'first-contentful-paint', 'displayValue' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'first-contentful-paint', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'first-contentful-paint', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'first-contentful-paint', 'displayValue' ) ), ), 'largest-contentful-paint' => array( - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'largest-contentful-paint', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'largest-contentful-paint', 'displayValue' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'largest-contentful-paint', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'largest-contentful-paint', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'largest-contentful-paint', 'displayValue' ) ), ), 'interactive' => array( - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'interactive', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'interactive', 'displayValue' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'interactive', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'interactive', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'interactive', 'displayValue' ) ), ), 'cumulative-layout-shift' => array( - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'cumulative-layout-shift', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'cumulative-layout-shift', 'displayValue' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'cumulative-layout-shift', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'cumalative-layout-shift', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'cumulative-layout-shift', 'displayValue' ) ), ), 'total-blocking-time' => array( - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'total-blocking-time', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'total-blocking-time', 'displayValue' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'total-blocking-time', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'total-blocking-time', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'total-blocking-time', 'displayValue' ) ), ), 'speed-index' => array( - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'speed-index', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'speed-index', 'displayValue' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'speed-index', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'speed-index', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'speed-index', 'displayValue' ) ), ), 'screenshots' => array( 'final' => array( @@ -66,372 +72,384 @@ class PageSpeed_Data { ), 'opportunities' => array( 'render-blocking-resources' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'render-blocking-resources', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'render-blocking-resources', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'render-blocking-resources', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'render-blocking-resources', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'render-blocking-resources', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'render-blocking-resources', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'render-blocking-resources', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'render-blocking-resources', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'render-blocking-resources', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'render-blocking-resources', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'render-blocking-resources', 'details', 'items' ) ), + 'type' => array( 'FCP', 'LCP', ), ), 'unused-css-rules' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-css-rules', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-css-rules', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-css-rules', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-css-rules', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-css-rules', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-css-rules', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-css-rules', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-css-rules', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-css-rules', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-css-rules', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-css-rules', 'details', 'items' ) ), + 'type' => array( 'FCP', 'LCP', ), ), 'unminified-css' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-css', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-css', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-css', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-css', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-css', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-css', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-css', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-css', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-css', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-css', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-css', 'details', 'items' ) ), + 'type' => array( 'FCP', 'LCP', ), ), 'unminified-javascript' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-javascript', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-javascript', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-javascript', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-javascript', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-javascript', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-javascript', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-javascript', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-javascript', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-javascript', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-javascript', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unminified-javascript', 'details', 'items' ) ), + 'type' => array( 'FCP', 'LCP', ), ), 'unused-javascript' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-javascript', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-javascript', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-javascript', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-javascript', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-javascript', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-javascript', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-javascript', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-javascript', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-javascript', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-javascript', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unused-javascript', 'details', 'items' ) ), + 'type' => array( 'LCP', ), ), 'uses-responsive-images' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-responsive-images', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-responsive-images', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-responsive-images', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-responsive-images', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-responsive-images', 'details', 'items' ) ), + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-responsive-images', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-responsive-images', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-responsive-images', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-responsive-images', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-responsive-images', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-responsive-images', 'details', 'items' ) ), ), 'offscreen-images' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'offscreen-images', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'offscreen-images', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'offscreen-images', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'offscreen-images', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'offscreen-images', 'details', 'items' ) ), + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'offscreen-images', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'offscreen-images', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'offscreen-images', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'offscreen-images', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'offscreen-images', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'offscreen-images', 'details', 'items' ) ), ), 'uses-optimized-images' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-optimized-images', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-optimized-images', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-optimized-images', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-optimized-images', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-optimized-images', 'details', 'items' ) ), + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-optimized-images', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-optimized-images', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-optimized-images', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-optimized-images', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-optimized-images', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-optimized-images', 'details', 'items' ) ), ), 'modern-image-formats' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'modern-image-formats', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'modern-image-formats', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'modern-image-formats', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'modern-image-formats', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'modern-image-formats', 'details', 'items' ) ), + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'modern-image-formats', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'modern-image-formats', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'modern-image-formats', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'modern-image-formats', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'modern-image-formats', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'modern-image-formats', 'details', 'items' ) ), ), 'uses-text-compression' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-text-compression', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-text-compression', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-text-compression', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-text-compression', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-text-compression', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-text-compression', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-text-compression', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-text-compression', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-text-compression', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-text-compression', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-text-compression', 'details', 'items' ) ), + 'type' => array( 'FCP', 'LCP', ), ), 'uses-rel-preconnect' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preconnect', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preconnect', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preconnect', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preconnect', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preconnect', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preconnect', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preconnect', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preconnect', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preconnect', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preconnect', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preconnect', 'details', 'items' ) ), + 'type' => array( 'FCP', 'LCP', ), ), 'server-response-time' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'server-response-time', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'server-response-time', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'server-response-time', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'server-response-time', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'server-response-time', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'server-response-time', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'server-response-time', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'server-response-time', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'server-response-time', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'server-response-time', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'server-response-time', 'details', 'items' ) ), + 'type' => array( 'FCP', 'LCP', ), ), 'redirects' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'redirects', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'redirects', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'redirects', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'redirects', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'redirects', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'redirects', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'redirects', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'redirects', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'redirects', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'redirects', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'redirects', 'details', 'items' ) ), + 'type' => array( 'FCP', 'LCP', ), ), 'uses-rel-preload' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preload', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preload', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preload', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preload', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preload', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preload', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preload', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preload', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preload', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preload', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-rel-preload', 'details', 'items' ) ), + 'type' => array( 'FCP', 'LCP', ), ), 'efficient-animated-content' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'efficient-animated-content', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'efficient-animated-content', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'efficient-animated-content', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'efficient-animated-content', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'efficient-animated-content', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'efficient-animated-content', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'efficient-animated-content', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'efficient-animated-content', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'efficient-animated-content', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'efficient-animated-content', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'efficient-animated-content', 'details', 'items' ) ), + 'type' => array( 'LCP', ), ), 'duplicated-javascript' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'duplicated-javascript', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'duplicated-javascript', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'duplicated-javascript', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'duplicated-javascript', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'duplicated-javascript', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'duplicated-javascript', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'duplicated-javascript', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'duplicated-javascript', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'duplicated-javascript', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'duplicated-javascript', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'duplicated-javascript', 'details', 'items' ) ), + 'type' => array( 'TBT', ), ), 'legacy-javascript' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'legacy-javascript', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'legacy-javascript', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'legacy-javascript', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'legacy-javascript', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'legacy-javascript', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'legacy-javascript', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'legacy-javascript', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'legacy-javascript', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'legacy-javascript', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'legacy-javascript', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'legacy-javascript', 'details', 'items' ) ), + 'type' => array( 'TBT', ), ), - 'preload-lcp-image' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'preload-lcp-image', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'preload-lcp-image', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'preload-lcp-image', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'preload-lcp-image', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'preload-lcp-image', 'details', 'items' ) ), - 'type' => array( - 'LCP', - ), - ), 'total-byte-weight' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'total-byte-weight', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'total-byte-weight', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'total-byte-weight', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'total-byte-weight', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'total-byte-weight', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'total-byte-weight', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'total-byte-weight', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'total-byte-weight', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'total-byte-weight', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'total-byte-weight', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'total-byte-weight', 'details', 'items' ) ), + 'type' => array( 'LCP', ), ), 'dom-size' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'dom-size', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'dom-size', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'dom-size', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'dom-size', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'dom-size', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'dom-size', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'dom-size', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'dom-size', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'dom-size', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'dom-size', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'dom-size', 'details', 'items' ) ), + 'type' => array( 'TBT', ), ), 'user-timings' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'user-timings', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'user-timings', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'user-timings', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'user-timings', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'user-timings', 'details', 'items' ) ), + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'user-timings', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'user-timings', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'user-timings', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'user-timings', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'user-timings', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'user-timings', 'details', 'items' ) ), ), 'bootup-time' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'bootup-time', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'bootup-time', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'bootup-time', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'bootup-time', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'bootup-time', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'bootup-time', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'bootup-time', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'bootup-time', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'bootup-time', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'bootup-time', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'bootup-time', 'details', 'items' ) ), + 'type' => array( 'TBT', ), ), 'mainthread-work-breakdown' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'mainthread-work-breakdown', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'mainthread-work-breakdown', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'mainthread-work-breakdown', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'mainthread-work-breakdown', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'mainthread-work-breakdown', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'mainthread-work-breakdown', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'mainthread-work-breakdown', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'mainthread-work-breakdown', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'mainthread-work-breakdown', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'mainthread-work-breakdown', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'mainthread-work-breakdown', 'details', 'items' ) ), + 'type' => array( 'TBT', ), ), 'third-party-summary' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-summary', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-summary', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-summary', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-summary', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-summary', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-summary', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-summary', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-summary', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-summary', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-summary', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-summary', 'details', 'items' ) ), + 'type' => array( 'TBT', ), ), 'third-party-facades' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-facades', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-facades', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-facades', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-facades', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-facades', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-facades', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-facades', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-facades', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-facades', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-facades', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'third-party-facades', 'details', 'items' ) ), + 'type' => array( 'TBT', ), ), 'lcp-lazy-loaded' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'lcp-lazy-loaded', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'lcp-lazy-loaded', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'lcp-lazy-loaded', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'lcp-lazy-loaded', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'lcp-lazy-loaded', 'details', 'items' ) ), + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'lcp-lazy-loaded', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'lcp-lazy-loaded', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'lcp-lazy-loaded', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'lcp-lazy-loaded', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'lcp-lazy-loaded', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'lcp-lazy-loaded', 'details', 'items' ) ), ), 'uses-passive-event-listeners' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-passive-event-listeners', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-passive-event-listeners', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-passive-event-listeners', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-passive-event-listeners', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-passive-event-listeners', 'details', 'items' ) ), + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-passive-event-listeners', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-passive-event-listeners', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-passive-event-listeners', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-passive-event-listeners', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-passive-event-listeners', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-passive-event-listeners', 'details', 'items' ) ), ), 'no-document-write' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'no-document-write', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'no-document-write', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'no-document-write', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'no-document-write', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'no-document-write', 'details', 'items' ) ), + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'no-document-write', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'no-document-write', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'no-document-write', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'no-document-write', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'no-document-write', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'no-document-write', 'details', 'items' ) ), ), 'non-composited-animations' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'non-composited-animations', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'non-composited-animations', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'non-composited-animations', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'non-composited-animations', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'non-composited-animations', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'non-composited-animations', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'non-composited-animations', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'non-composited-animations', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'non-composited-animations', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'non-composited-animations', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'non-composited-animations', 'details', 'items' ) ), + 'type' => array( 'CLS', ), ), 'unsized-images' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unsized-images', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unsized-images', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unsized-images', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unsized-images', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unsized-images', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unsized-images', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unsized-images', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unsized-images', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unsized-images', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unsized-images', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'unsized-images', 'details', 'items' ) ), + 'type' => array( 'CLS', ), ), 'viewport' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'viewport', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'viewport', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'viewport', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'viewport', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'viewport', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'viewport', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'viewport', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'viewport', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'viewport', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'viewport', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'viewport', 'details', 'items' ) ), + 'type' => array( 'TBT', ), ), ), 'diagnostics' => array( 'font-display' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'font-display', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'font-display', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'font-display', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'font-display', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'font-display', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'font-display', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'font-display', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'font-display', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'font-display', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'font-display', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'font-display', 'details', 'items' ) ), + 'type' => array( 'FCP', 'LCP', ), ), - 'first-contentful-paint-3g' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'first-contentful-paint-3g', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'first-contentful-paint-3g', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'first-contentful-paint-3g', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'first-contentful-paint-3g', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'first-contentful-paint-3g', 'details', 'items' ) ), - ), 'uses-long-cache-ttl' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-long-cache-ttl', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-long-cache-ttl', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-long-cache-ttl', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-long-cache-ttl', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-long-cache-ttl', 'details', 'items' ) ), + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-long-cache-ttl', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-long-cache-ttl', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-long-cache-ttl', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-long-cache-ttl', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-long-cache-ttl', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'uses-long-cache-ttl', 'details', 'items' ) ), ), 'critical-request-chains' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'critical-request-chains', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'critical-request-chains', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'critical-request-chains', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'critical-request-chains', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'critical-request-chains', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'critical-request-chains', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'critical-request-chains', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'critical-request-chains', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'critical-request-chains', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'critical-request-chains', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'critical-request-chains', 'details', 'items' ) ), + 'type' => array( 'FCP', 'LCP', ), ), - 'resource-summary' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'resource-summary', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'resource-summary', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'resource-summary', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'resource-summary', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'resource-summary', 'details', 'items' ) ), - ), 'largest-contentful-paint-element' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'largest-contentful-paint-element', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'largest-contentful-paint-element', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'largest-contentful-paint-element', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'largest-contentful-paint-element', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'largest-contentful-paint-element', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'largest-contentful-paint-element', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'largest-contentful-paint-element', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'largest-contentful-paint-element', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'largest-contentful-paint-element', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'largest-contentful-paint-element', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'largest-contentful-paint-element', 'details', 'items' ) ), + 'type' => array( 'LCP', ), ), 'layout-shift-elements' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'layout-shift-elements', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'layout-shift-elements', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'layout-shift-elements', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'layout-shift-elements', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'layout-shift-elements', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'layout-shift-elements', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'layout-shift-elements', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'layout-shift-elements', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'layout-shift-elements', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'layout-shift-elements', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'layout-shift-elements', 'details', 'items' ) ), + 'type' => array( 'CLS', ), ), 'long-tasks' => array( - 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'long-tasks', 'title' ) ), - 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'long-tasks', 'description' ) ), - 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'long-tasks', 'score' ) ), - 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'long-tasks', 'displayValue' ) ), - 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'long-tasks', 'details', 'items' ) ), - 'type' => array( + 'title' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'long-tasks', 'title' ) ), + 'description' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'long-tasks', 'description' ) ), + 'score' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'long-tasks', 'score' ) ), + 'scoreDisplayMode' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'long-tasks', 'scoreDisplayMode' ) ), + 'displayValue' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'long-tasks', 'displayValue' ) ), + 'details' => Util_PageSpeed::get_value_recursive( $data, array( 'lighthouseResult', 'audits', 'long-tasks', 'details', 'items' ) ), + 'type' => array( 'TBT', ), ), diff --git a/wp-content/plugins/w3-total-cache/PageSpeed_Instructions.php b/wp-content/plugins/w3-total-cache/PageSpeed_Instructions.php index b2478a34..46434b11 100644 --- a/wp-content/plugins/w3-total-cache/PageSpeed_Instructions.php +++ b/wp-content/plugins/w3-total-cache/PageSpeed_Instructions.php @@ -271,9 +271,6 @@ class PageSpeed_Instructions { $allowed_tags ) . '

    ', ), - 'preload-lcp-image' => array( - 'instructions' => '

    ' . esc_html__( 'Enable lazy load for images.', 'w3-total-cache' ) . '

    ', - ), 'total-byte-weight' => array( 'instructions' => '

    ' . sprintf( @@ -507,16 +504,6 @@ class PageSpeed_Instructions {

    ' . esc_html__( 'Use font-display atribute: The font-display attribute determines how the font is displayed during your page load, based on whether it has been downloaded and is ready for use.', 'w3-total-cache' ) . '

    ', ), - 'first-contentful-paint-3g' => array( - 'instructions' => - '

    ' . esc_html__( 'Enable Page Cache using the fastest engine.', 'w3-total-cache' ) . '

    -

    ' . esc_html__( 'What it represents: How much is visible at a time during load.', 'w3-total-cache' ) . '

    -

    ' . esc_html__( 'Lighthouse Performance score weighting: 10%', 'w3-total-cache' ) . '

    -

    ' . esc_html__( 'What it measures: The Speed Index is the average time at which visible parts of the page are displayed.', 'w3-total-cache' ) . '

    -

    ' . esc_html__( 'How it\'s measured: Lighthouse\'s Speed Index measurement comes from a node module called Speedline.', 'w3-total-cache' ) . '

    -

    ' . esc_html__( 'In order for content to be displayed to the user, the browser must first download, parse, and process all external stylesheets it encounters before it can display or render any content to a user\'s screen.', 'w3-total-cache' ) . '

    -

    ' . esc_html__( 'The fastest way to bypass the delay of external resources is to use in-line styles for above-the-fold content.', 'w3-total-cache' ) . '

    ', - ), 'uses-long-cache-ttl' => array( 'instructions' => '

    ' . sprintf( @@ -534,16 +521,6 @@ class PageSpeed_Instructions { 'critical-request-chains' => array( 'instructions' => '

    ' . esc_html__( 'Eliminate Render Blocking CSS and apply asynchronous loading where applicable. Additionally, image optimization by way of resizing, lazy loaidng, and webp conversion can impact this metric as well.', 'w3-total-cache' ) . '

    ', ), - 'resource-summary' => array( - 'instructions' => - '

    Actions that can help:

    - ', - ), 'largest-contentful-paint-element' => array( 'instructions' => '

    ' . esc_html__( 'How To Fix Poor LCP', 'w3-total-cache' ) . '

    @@ -571,6 +548,7 @@ class PageSpeed_Instructions { ', ), 'layout-shift-elements' => array( diff --git a/wp-content/plugins/w3-total-cache/PageSpeed_Page.php b/wp-content/plugins/w3-total-cache/PageSpeed_Page.php index 72ce897f..282e707a 100644 --- a/wp-content/plugins/w3-total-cache/PageSpeed_Page.php +++ b/wp-content/plugins/w3-total-cache/PageSpeed_Page.php @@ -155,7 +155,7 @@ class PageSpeed_Page { } else { $api_response['time'] = time(); $api_response['display_time'] = \current_time( 'M jS, Y g:ia', false ); - update_option( 'w3tc_pagespeed_data_' . $encoded_url, wp_json_encode( $api_response ), 'yes' ); + update_option( 'w3tc_pagespeed_data_' . $encoded_url, wp_json_encode( $api_response ), 'no' ); } } diff --git a/wp-content/plugins/w3-total-cache/PageSpeed_Widget.php b/wp-content/plugins/w3-total-cache/PageSpeed_Widget.php index eda71b59..bf59bbab 100644 --- a/wp-content/plugins/w3-total-cache/PageSpeed_Widget.php +++ b/wp-content/plugins/w3-total-cache/PageSpeed_Widget.php @@ -25,8 +25,8 @@ class PageSpeed_Widget { * @return void */ public function run() { - add_action( 'w3tc_widget_setup', array( $this, 'wp_dashboard_setup' ), 3000 ); - add_action( 'w3tc_network_dashboard_setup', array( $this, 'wp_dashboard_setup' ), 3000 ); + add_action( 'w3tc_widget_setup', array( $this, 'wp_dashboard_setup' ), 500 ); + add_action( 'w3tc_network_dashboard_setup', array( $this, 'wp_dashboard_setup' ), 500 ); add_action( 'w3tc_ajax_pagespeed_widgetdata', array( $this, 'w3tc_ajax_pagespeed_widgetdata' ) ); } @@ -93,6 +93,26 @@ class PageSpeed_Widget { $config = Dispatcher::config(); $access_token = $config->get_string( 'widget.pagespeed.access_token' ); + if ( empty( $access_token ) ) { + echo wp_kses( + sprintf( + // translators: 1 HTML a tag to W3TC settings page Google PageSpeed meta box. + __( + 'Before you can get started using the Google PageSpeed tool, you’ll first need to authorize access. Please click %1$s.', + 'w3-total-cache' + ), + '' . esc_html__( 'here', 'w3-total-cache' ) . '' + ), + array( + 'a' => array( + 'href' => array(), + 'target' => array(), + ), + ) + ); + return; + } + include W3TC_DIR . '/PageSpeed_Widget_View.php'; } @@ -174,7 +194,7 @@ class PageSpeed_Widget { } else { $api_response['time'] = time(); $api_response['display_time'] = \current_time( 'M jS, Y g:ia', false ); - update_option( 'w3tc_pagespeed_data_' . $home_url, wp_json_encode( $api_response ), 'yes' ); + update_option( 'w3tc_pagespeed_data_' . $home_url, wp_json_encode( $api_response ), 'no' ); } } diff --git a/wp-content/plugins/w3-total-cache/PageSpeed_Widget_View.css b/wp-content/plugins/w3-total-cache/PageSpeed_Widget_View.css index e9b5c14f..0ccc5e5d 100644 --- a/wp-content/plugins/w3-total-cache/PageSpeed_Widget_View.css +++ b/wp-content/plugins/w3-total-cache/PageSpeed_Widget_View.css @@ -4,7 +4,7 @@ .w3tcps_loading .spinner { margin-top: 5px; - float: left; + float: unset; } .w3tcps_timestamp_container { @@ -33,13 +33,23 @@ margin: 5px !important; } +.w3tcps_widget_metrics { + display: flex; + flex-wrap: wrap; +} + +.w3tcps_metric { + flex-grow: 1; + width: 33%; +} + .w3tcps_metric_title { font-size: 14px; } .w3tcps_metric_title, .w3tcps_metric_stats { - padding: 8px 12px; + padding: 8px 5px; margin: 0; text-align: left; } @@ -142,3 +152,19 @@ width:100%; text-align: center; } + +@media only screen and (max-width: 1200px) { + .w3tcps_metric { + width: 50%; + } +} + +@media only screen and (max-width: 782px) { + .w3tcps_metric { + width: 50%; + } + + .w3tcps_metric > * { + text-align: center; + } +} \ No newline at end of file diff --git a/wp-content/plugins/w3-total-cache/PageSpeed_Widget_View.js b/wp-content/plugins/w3-total-cache/PageSpeed_Widget_View.js index a1fda7a7..d7f4e1dd 100644 --- a/wp-content/plugins/w3-total-cache/PageSpeed_Widget_View.js +++ b/wp-content/plugins/w3-total-cache/PageSpeed_Widget_View.js @@ -42,7 +42,6 @@ jQuery(document).ready(function ($) { $('.w3tcps_buttons').removeClass('w3tc_none'); $('.w3tc-gps-widget').html(data.w3tcps_widget); $('.w3tc-gps-widget').removeClass('w3tc_none').fadeIn('slow'); - $('#normal-sortables').masonry(); } ).fail(function (jqXHR, textStatus, errorThrown) { $('.w3tcps_error').html(w3tcData.lang.pagespeed_widget_data_error + jqXHR.responseText); diff --git a/wp-content/plugins/w3-total-cache/PageSpeed_Widget_View_FromApi.php b/wp-content/plugins/w3-total-cache/PageSpeed_Widget_View_FromApi.php index 08673bf2..0c083ccb 100644 --- a/wp-content/plugins/w3-total-cache/PageSpeed_Widget_View_FromApi.php +++ b/wp-content/plugins/w3-total-cache/PageSpeed_Widget_View_FromApi.php @@ -75,12 +75,12 @@ if ( ! defined( 'W3TC' ) ) {
    - - - - - - + + + + + +
    get_boolean( 'widget.pagespeed.enabled' ) ) { - $plugins[] = new PageSpeed_Widget(); - } + $plugins[] = new PageSpeed_Widget(); $plugins[] = new Generic_Plugin_AdminCompatibility(); $plugins[] = new Licensing_Plugin_Admin(); diff --git a/wp-content/plugins/w3-total-cache/UsageStatistics_Page.php b/wp-content/plugins/w3-total-cache/UsageStatistics_Page.php index 49bb0195..ab51bb6d 100644 --- a/wp-content/plugins/w3-total-cache/UsageStatistics_Page.php +++ b/wp-content/plugins/w3-total-cache/UsageStatistics_Page.php @@ -159,7 +159,7 @@ class UsageStatistics_Page { public function summary_item( $id, $name, $checked = false, $extra_class = '', $column_background = '', $link_key = '' ) { - echo '
    \n'; + echo '

    '; echo ''; echo '
    '; diff --git a/wp-content/plugins/w3-total-cache/UsageStatistics_Plugin_Admin.php b/wp-content/plugins/w3-total-cache/UsageStatistics_Plugin_Admin.php index 727653ed..f606b921 100644 --- a/wp-content/plugins/w3-total-cache/UsageStatistics_Plugin_Admin.php +++ b/wp-content/plugins/w3-total-cache/UsageStatistics_Plugin_Admin.php @@ -15,14 +15,6 @@ class UsageStatistics_Plugin_Admin { 'w3tc_usage_statistics_summary_from_history' ), 5, 2 ); - $widget = new UsageStatistics_Widget(); - $widget->init(); - - add_action( 'admin_init_w3tc_dashboard', array( - '\W3TC\UsageStatistics_Widget', - 'admin_init_w3tc_dashboard' - ) ); - add_action( 'admin_init_w3tc_general', array( '\W3TC\UsageStatistics_GeneralPage', 'admin_init_w3tc_general' diff --git a/wp-content/plugins/w3-total-cache/UsageStatistics_Widget.php b/wp-content/plugins/w3-total-cache/UsageStatistics_Widget.php deleted file mode 100644 index 1abcaa63..00000000 --- a/wp-content/plugins/w3-total-cache/UsageStatistics_Widget.php +++ /dev/null @@ -1,55 +0,0 @@ -get_boolean( 'stats.enabled' ) && - Util_Environment::is_w3tc_pro( $c ) ); - } - - return $_enabled; - } - - - - public function init() { - Util_Widget::add2( 'w3tc_usage_statistics', 1000, - '' . - '
    ' . - __( 'Caching Statistics', 'w3-total-cache' ) . - '
    ', - array( $this, 'widget_form' ), - Util_Ui::admin_url( 'admin.php?page=w3tc_stats' ), - 'normal', - 'Detailed' ); - } - - - - static public function admin_init_w3tc_dashboard() { - if ( self::enabled() ) { - wp_enqueue_script( 'w3tc-canvasjs', - plugins_url( 'pub/js/chartjs.min.js', W3TC_FILE ), - array(), W3TC_VERSION ); - wp_enqueue_script( 'w3tc-widget-usagestatistics', - plugins_url( 'UsageStatistics_Widget_View.js', W3TC_FILE ), - array(), W3TC_VERSION ); - } - } - - - - public function widget_form() { - if ( self::enabled() ) { - include W3TC_DIR . '/UsageStatistics_Widget_View.php'; - } else { - include W3TC_DIR . '/UsageStatistics_Widget_View_Disabled.php'; - } - } -} diff --git a/wp-content/plugins/w3-total-cache/UsageStatistics_Widget_View.js b/wp-content/plugins/w3-total-cache/UsageStatistics_Widget_View.js deleted file mode 100644 index c0b042d9..00000000 --- a/wp-content/plugins/w3-total-cache/UsageStatistics_Widget_View.js +++ /dev/null @@ -1,208 +0,0 @@ -jQuery(document).ready(function($) { - var lastData; - - - - function load() { - $.getJSON(ajaxurl + '?action=w3tc_ajax&_wpnonce=' + w3tc_nonce + - '&w3tc_action=ustats_get', - function(data) { - lastData = data; - - setValues(data, 'w3tcuw_'); - setChart(data); - } - ).fail(function() { - console.log('failed to load widget data'); - }); - } - - - - // - // chart commons - // - var chartOptions = { - //aspectRatio: 4, - maintainAspectRatio: false, - height: '200px', - legend: false, - scales: { - yAxes: [{ - ticks: { - beginAtZero: true - } - }] - } - }; - - - - var chartDateLabels = []; - var chartGraphValues = {}; - var chartObject; - - - - function setChart(data) { - var ctx = $('#w3tcuw_chart'); - chartObject = new Chart(ctx, { - type: 'line', - data: { - labels: chartDateLabels, - }, - options: chartOptions - }); - - // collect functors that prepare data for their own chart - var datasetTemplates = []; - datasetTemplates.push(setChartsDbCache()); - datasetTemplates.push(setChartsObjectCache()); - datasetTemplates.push(setChartsPageCache()); - - // prepare collections - var datasets = []; - - for (var i = 0; i < datasetTemplates.length; i++) { - var datasetTemplate = datasetTemplates[i]; - var datasetName = datasetTemplate.name; - - chartGraphValues[datasetName] = []; - datasets.push({ - label: datasetTemplate.label, - data: chartGraphValues[datasetName], - borderColor: datasetTemplate.borderColor, - fill: false - }); - } - - chartObject.data.datasets = datasets; - - // collect data for charts - var history = data.history; - chartDateLabels.length = 0; - var averagesToCollect = Math.floor(history.length / 10); - if (averagesToCollect <= 1) { - averagesToCollect = 1; - } - - var averages = {}; - var averagesCollected = 0; - - for (var i = 0; i < history.length; i++) { - var historyItem = history[i]; - - // collect metrics for graphs - for (var i2 = 0; i2 < datasetTemplates.length; i2++) { - var c = datasetTemplates[i2]; - var v = c.valueFunctor(historyItem) * 100; - averages[i2] = (!averages[i2] ? 0 : averages[i2]) + v; - } - - averagesCollected++; - if (averagesCollected >= averagesToCollect) { - var dateFormatted = ''; - if (history[i].timestamp_start) { - var d = new Date(parseInt(history[i].timestamp_start) * 1000); - dateFormatted = dateFormat(d); - } - - chartDateLabels.push(dateFormatted); - - for (var i2 = 0; i2 < datasetTemplates.length; i2++) { - var c = datasetTemplates[i2]; - var v = (averages[i2] / averagesCollected).toFixed(2); - chartGraphValues[c.name].push(v); - } - - averages = {}; - averagesCollected = 0; - } - } - - // visualize - chartObject.update(); - } - - - - // - // chart data - // - function setChartsDbCache() { - return { - label: 'Database cache', - name: 'dbcache_hit_rate', - valueFunctor: function(i) { - return i.dbcache_calls_total == 0 ? 0 : - i.dbcache_calls_hits / i.dbcache_calls_total; - }, - borderColor: '#0073aa' - }; - } - - - - function setChartsObjectCache() { - return { - label: 'Object cache', - name: 'objectcache_hit_rate', - valueFunctor: function(i) { - return i.objectcache_get_total == 0 ? 0 : - i.objectcache_get_hits / i.objectcache_get_total; - }, - borderColor: 'green' - }; - } - - - - function setChartsPageCache() { - return { - label: 'Page cache', - name: 'pagecache_hit_rate', - valueFunctor: function(i) { - return i.php_requests == 0 ? 0 : - i.php_requests_pagecache_hit / i.php_requests; - }, - borderColor: 'blue' - }; - } - - - - // - // Utils - // - function startsWith(s, prefix) { - return s.substr(0, prefix.length) == prefix; - } - - - - function dateFormat(d) { - return ("0" + d.getUTCHours()).slice(-2) + ":" + - ("0" + d.getUTCMinutes()).slice(-2); - } - - - - function setValues(data, css_class_prefix) { - for (p in data) { - var v = data[p]; - if (typeof(v) != 'string' && typeof(v) != 'number') - setValues(v, css_class_prefix + p + '_'); - else { - jQuery('.' + css_class_prefix + p + ' .w3tcuw_value').html(v); - jQuery('.' + css_class_prefix + p).css('display', 'block'); - } - } - } - - - - // - // Main entry - // - load(); -}); diff --git a/wp-content/plugins/w3-total-cache/UsageStatistics_Widget_View.php b/wp-content/plugins/w3-total-cache/UsageStatistics_Widget_View.php deleted file mode 100644 index 4fdc3898..00000000 --- a/wp-content/plugins/w3-total-cache/UsageStatistics_Widget_View.php +++ /dev/null @@ -1,55 +0,0 @@ - - -
    - -
    - -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    diff --git a/wp-content/plugins/w3-total-cache/UsageStatistics_Widget_View_Disabled.php b/wp-content/plugins/w3-total-cache/UsageStatistics_Widget_View_Disabled.php deleted file mode 100644 index 9ad4392b..00000000 --- a/wp-content/plugins/w3-total-cache/UsageStatistics_Widget_View_Disabled.php +++ /dev/null @@ -1,37 +0,0 @@ - - -

    - - - - Enable - -

    diff --git a/wp-content/plugins/w3-total-cache/UserExperience_DeferScripts_Extension.php b/wp-content/plugins/w3-total-cache/UserExperience_DeferScripts_Extension.php index 3de33557..e5cd2987 100644 --- a/wp-content/plugins/w3-total-cache/UserExperience_DeferScripts_Extension.php +++ b/wp-content/plugins/w3-total-cache/UserExperience_DeferScripts_Extension.php @@ -58,7 +58,7 @@ class UserExperience_DeferScripts_Extension { add_filter( 'w3tc_minify_js_script_tags', array( $this, 'w3tc_minify_js_script_tags' ) ); add_filter( 'w3tc_save_options', array( $this, 'w3tc_save_options' ) ); - add_action( 'w3tc_userexperience_page', array( $this, 'w3tc_userexperience_page' ) ); + add_action( 'w3tc_userexperience_page', array( $this, 'w3tc_userexperience_page' ), 11 ); /** * This filter is documented in Generic_AdminActions_Default.php under the read_request method. @@ -233,7 +233,7 @@ class UserExperience_DeferScripts_Extension { * @return void */ public function w3tc_userexperience_page() { - if ( Util_Environment::is_w3tc_pro( $this->config ) ) { + if ( self::is_enabled() ) { include __DIR__ . '/UserExperience_DeferScripts_Page_View.php'; } } diff --git a/wp-content/plugins/w3-total-cache/UserExperience_DeferScripts_Page_View.php b/wp-content/plugins/w3-total-cache/UserExperience_DeferScripts_Page_View.php index dab7e12f..9c6168a7 100644 --- a/wp-content/plugins/w3-total-cache/UserExperience_DeferScripts_Page_View.php +++ b/wp-content/plugins/w3-total-cache/UserExperience_DeferScripts_Page_View.php @@ -22,7 +22,7 @@ if ( is_null( $c->get( array( 'user-experience-defer-scripts', 'timeout' ) ) ) ) } ?> - +

    'lazyload.configuration_over ' Settings can be found on the %1$sUser Experience page%2$s.', 'w3-total-cache' ), - '', + '', + '' + ), + array( + 'a' => array( + 'href' => array(), + ), + ) + ) + : '' + ), + 'label_class' => 'w3tc_single_column', + 'pro' => true, + 'disabled' => ! Util_Environment::is_w3tc_pro( $config ) ? true : false, + ) + ); + + Util_Ui::config_item_extension_enabled( + array( + 'extension_id' => 'user-experience-remove-cssjs', + 'checkbox_label' => esc_html__( 'Remove Unwanted/Unused CSS/JS', 'w3-total-cache' ), + 'description' => __( + 'Removes specfied CSS/JS tags from the homepage or on a per page basis.', + 'w3-total-cache' + ) . ( + UserExperience_Remove_CssJs_Extension::is_enabled() + ? wp_kses( + sprintf( + // translators: 1 opening HTML a tag to W3TC User Experience page, 2 closing HTML a tag. + __( + ' Settings can be found on the %1$sUser Experience page%2$s.', + 'w3-total-cache' + ), + '', '' ), array( diff --git a/wp-content/plugins/w3-total-cache/UserExperience_LazyLoad_Mutator.php b/wp-content/plugins/w3-total-cache/UserExperience_LazyLoad_Mutator.php index cacf6be2..586d44ca 100644 --- a/wp-content/plugins/w3-total-cache/UserExperience_LazyLoad_Mutator.php +++ b/wp-content/plugins/w3-total-cache/UserExperience_LazyLoad_Mutator.php @@ -200,7 +200,7 @@ class UserExperience_LazyLoad_Mutator { preg_match( '~background(-image)?:\s*(url\([^>]+\))~is', $v, $url_match ); $v = preg_replace( '~background(-image)?:\s*url\([^>]+\)[;]?\s*~is', '', $v ); - return $v1 . $v2 . $v . $quote . ' data-bg=' . $quote . $url_match[2] . $quote; + return $v1 . $v2 . $v . $quote . ' data-bg=' . $quote . ( isset( $url_match[2] ) ? $url_match[2] : '' ) . $quote; } diff --git a/wp-content/plugins/w3-total-cache/UserExperience_LazyLoad_Mutator_Unmutable.php b/wp-content/plugins/w3-total-cache/UserExperience_LazyLoad_Mutator_Unmutable.php index 8fda42dc..b51c0166 100644 --- a/wp-content/plugins/w3-total-cache/UserExperience_LazyLoad_Mutator_Unmutable.php +++ b/wp-content/plugins/w3-total-cache/UserExperience_LazyLoad_Mutator_Unmutable.php @@ -3,7 +3,7 @@ namespace W3TC; class UserExperience_LazyLoad_Mutator_Unmutable { private $placeholders = array(); - + private $placeholder_base = ''; public function __construct() { diff --git a/wp-content/plugins/w3-total-cache/UserExperience_Plugin_Admin.php b/wp-content/plugins/w3-total-cache/UserExperience_Plugin_Admin.php index 2eb3e5b6..5bbc1e85 100644 --- a/wp-content/plugins/w3-total-cache/UserExperience_Plugin_Admin.php +++ b/wp-content/plugins/w3-total-cache/UserExperience_Plugin_Admin.php @@ -1,6 +1,15 @@ false, 'extension_id' => 'user-experience-defer-scripts', 'path' => 'w3-total-cache/UserExperience_DeferScripts_Extension.php', @@ -51,12 +60,17 @@ class UserExperience_Plugin_Admin { 'extension_id' => 'user-experience-preload-requests', 'path' => 'w3-total-cache/UserExperience_Preload_Requests_Extension.php', ); - $extensions['user-experience-emoji'] = array( + $extensions['user-experience-remove-cssjs'] = array( + 'public' => false, + 'extension_id' => 'user-experience-remove-cssjs', + 'path' => 'w3-total-cache/UserExperience_Remove_CssJs_Extension.php', + ); + $extensions['user-experience-emoji'] = array( 'public' => false, 'extension_id' => 'user-experience-emoji', 'path' => 'w3-total-cache/UserExperience_Emoji_Extension.php', ); - $extensions['user-experience-oembed'] = array( + $extensions['user-experience-oembed'] = array( 'public' => false, 'extension_id' => 'user-experience-oembed', 'path' => 'w3-total-cache/UserExperience_OEmbed_Extension.php', diff --git a/wp-content/plugins/w3-total-cache/UserExperience_Preload_Requests_Extension.php b/wp-content/plugins/w3-total-cache/UserExperience_Preload_Requests_Extension.php index 200efee4..d2a891f3 100644 --- a/wp-content/plugins/w3-total-cache/UserExperience_Preload_Requests_Extension.php +++ b/wp-content/plugins/w3-total-cache/UserExperience_Preload_Requests_Extension.php @@ -50,7 +50,7 @@ class UserExperience_Preload_Requests_Extension { add_filter( 'w3tc_save_options', array( $this, 'w3tc_save_options' ) ); // Renders the Preload Reqeusts settings metabox on the User Expereince advanced setting page. - add_action( 'w3tc_userexperience_page', array( $this, 'w3tc_userexperience_page' ) ); + add_action( 'w3tc_userexperience_page', array( $this, 'w3tc_userexperience_page' ), 20 ); // This filter is documented in Generic_AdminActions_Default.php under the read_request method. add_filter( 'w3tc_config_key_descriptor', array( $this, 'w3tc_config_key_descriptor' ), 10, 2 ); @@ -68,7 +68,9 @@ class UserExperience_Preload_Requests_Extension { * @return void */ public function w3tc_userexperience_page() { - include __DIR__ . '/UserExperience_Preload_Requests_Page_View.php'; + if ( self::is_enabled() ) { + include __DIR__ . '/UserExperience_Preload_Requests_Page_View.php'; + } } /** @@ -143,7 +145,7 @@ class UserExperience_Preload_Requests_Extension { foreach ( $preconnect as $url ) { echo ''; } - + $dns_prefetch = $this->config->get_array( array( 'user-experience-preload-requests', 'dns-prefetch' ) ); foreach ( $dns_prefetch as $url ) { echo ''; diff --git a/wp-content/plugins/w3-total-cache/UserExperience_Preload_Requests_Page_View.php b/wp-content/plugins/w3-total-cache/UserExperience_Preload_Requests_Page_View.php index a3e70154..c531e6f6 100644 --- a/wp-content/plugins/w3-total-cache/UserExperience_Preload_Requests_Page_View.php +++ b/wp-content/plugins/w3-total-cache/UserExperience_Preload_Requests_Page_View.php @@ -24,77 +24,86 @@ if ( ! defined( 'W3TC' ) ) { array( 'user-experience-preload-requests', 'dns-prefetch' ), - 'label' => esc_html__( 'DNS Prefetch Domains:', 'w3-total-cache' ), - 'control' => 'textarea', - 'description' => esc_html__( 'Specify domains whose DNS should be prefetched by browsers. Include one entry per line, e.g. (https://cdn.domain.com, https://fonts.googleapis.com, https://www.google-ananlytics.com, etc.)', 'w3-total-cache' ), + 'key' => array( 'user-experience-preload-requests', 'dns-prefetch' ), + 'label' => esc_html__( 'DNS Prefetch Domains:', 'w3-total-cache' ), + 'control' => 'textarea', + 'control_after' => '' . esc_html__( 'Learn more', 'w3-total-cache' ) . '', + 'description' => esc_html__( 'Specify domains whose DNS should be prefetched by browsers. Include one entry per line, e.g. (https://cdn.domain.com, https://fonts.googleapis.com, https://www.google-ananlytics.com, etc.)', 'w3-total-cache' ), ) ); Util_Ui::config_item( array( - 'key' => array( 'user-experience-preload-requests', 'preconnect' ), - 'label' => esc_html__( 'Preconnect Domains:', 'w3-total-cache' ), - 'control' => 'textarea', - 'description' => esc_html__( 'Specify domains that browsers should preconnect to. Include one entry per line, e.g. (https://cdn.domain.com, https://fonts.googleapis.com, https://www.google-ananlytics.com, etc.)', 'w3-total-cache' ), + 'key' => array( 'user-experience-preload-requests', 'preconnect' ), + 'label' => esc_html__( 'Preconnect Domains:', 'w3-total-cache' ), + 'control' => 'textarea', + 'control_after' => '' . esc_html__( 'Learn more', 'w3-total-cache' ) . '', + 'description' => esc_html__( 'Specify domains that browsers should preconnect to. Include one entry per line, e.g. (https://cdn.domain.com, https://fonts.googleapis.com, https://www.google-ananlytics.com, etc.)', 'w3-total-cache' ), ) ); Util_Ui::config_item( array( - 'key' => array( 'user-experience-preload-requests', 'preload-css' ), - 'label' => esc_html__( 'Preload CSS:', 'w3-total-cache' ), - 'control' => 'textarea', - 'description' => esc_html__( 'Specify key CSS URLs that should be preloaded by browsers. Include one entry per line, e.g. (https://example.com/example.css, etc.)', 'w3-total-cache' ), + 'key' => array( 'user-experience-preload-requests', 'preload-css' ), + 'label' => esc_html__( 'Preload CSS:', 'w3-total-cache' ), + 'control' => 'textarea', + 'control_after' => '' . esc_html__( 'Learn more', 'w3-total-cache' ) . '', + 'description' => esc_html__( 'Specify key CSS URLs that should be preloaded by browsers. Include one entry per line, e.g. (https://example.com/example.css, etc.)', 'w3-total-cache' ), ) ); Util_Ui::config_item( array( - 'key' => array( 'user-experience-preload-requests', 'preload-js' ), - 'label' => esc_html__( 'Preload JavaScript:', 'w3-total-cache' ), - 'control' => 'textarea', - 'description' => esc_html__( 'Specify key JavaScript URLs that should be preloaded by browsers. Include one entry per line, e.g. (https://example.com/example.js, etc.)', 'w3-total-cache' ), + 'key' => array( 'user-experience-preload-requests', 'preload-js' ), + 'label' => esc_html__( 'Preload JavaScript:', 'w3-total-cache' ), + 'control' => 'textarea', + 'control_after' => '' . esc_html__( 'Learn more', 'w3-total-cache' ) . '', + 'description' => esc_html__( 'Specify key JavaScript URLs that should be preloaded by browsers. Include one entry per line, e.g. (https://example.com/example.js, etc.)', 'w3-total-cache' ), ) ); Util_Ui::config_item( array( - 'key' => array( 'user-experience-preload-requests', 'preload-fonts' ), - 'label' => esc_html__( 'Preload Fonts:', 'w3-total-cache' ), - 'control' => 'textarea', - 'description' => esc_html__( 'Specify key Font URLs that should be preloaded by browsers. Include one entry per line, e.g. (https://example.com/example.woff, etc.)', 'w3-total-cache' ), + 'key' => array( 'user-experience-preload-requests', 'preload-fonts' ), + 'label' => esc_html__( 'Preload Fonts:', 'w3-total-cache' ), + 'control' => 'textarea', + 'control_after' => '' . esc_html__( 'Learn more', 'w3-total-cache' ) . '', + 'description' => esc_html__( 'Specify key Font URLs that should be preloaded by browsers. Include one entry per line, e.g. (https://example.com/example.woff, etc.)', 'w3-total-cache' ), ) ); Util_Ui::config_item( array( - 'key' => array( 'user-experience-preload-requests', 'preload-images' ), - 'label' => esc_html__( 'Preload Images:', 'w3-total-cache' ), - 'control' => 'textarea', - 'description' => esc_html__( 'Specify key Image URLs that should be preloaded by browsers. Include one entry per line, e.g. (https://example.com/example.png, etc.)', 'w3-total-cache' ), + 'key' => array( 'user-experience-preload-requests', 'preload-images' ), + 'label' => esc_html__( 'Preload Images:', 'w3-total-cache' ), + 'control' => 'textarea', + 'control_after' => '' . esc_html__( 'Learn more', 'w3-total-cache' ) . '', + 'description' => esc_html__( 'Specify key Image URLs that should be preloaded by browsers. Include one entry per line, e.g. (https://example.com/example.png, etc.)', 'w3-total-cache' ), ) ); Util_Ui::config_item( array( - 'key' => array( 'user-experience-preload-requests', 'preload-videos' ), - 'label' => esc_html__( 'Preload Videos:', 'w3-total-cache' ), - 'control' => 'textarea', - 'description' => esc_html__( 'Specify key Video URLs that should be preloaded by browsers. Include one entry per line, e.g. (https://example.com/example.mp4, etc.)', 'w3-total-cache' ), + 'key' => array( 'user-experience-preload-requests', 'preload-videos' ), + 'label' => esc_html__( 'Preload Videos:', 'w3-total-cache' ), + 'control' => 'textarea', + 'control_after' => '' . esc_html__( 'Learn more', 'w3-total-cache' ) . '', + 'description' => esc_html__( 'Specify key Video URLs that should be preloaded by browsers. Include one entry per line, e.g. (https://example.com/example.mp4, etc.)', 'w3-total-cache' ), ) ); Util_Ui::config_item( array( - 'key' => array( 'user-experience-preload-requests', 'preload-audio' ), - 'label' => esc_html__( 'Prelaod Audio:', 'w3-total-cache' ), - 'control' => 'textarea', - 'description' => esc_html__( 'Specify key Audio URLs that should be preloaded by browsers. Include one entry per line, e.g. (https://example.com/example.mp3, etc.)', 'w3-total-cache' ), + 'key' => array( 'user-experience-preload-requests', 'preload-audio' ), + 'label' => esc_html__( 'Prelaod Audio:', 'w3-total-cache' ), + 'control' => 'textarea', + 'control_after' => '' . esc_html__( 'Learn more', 'w3-total-cache' ) . '', + 'description' => esc_html__( 'Specify key Audio URLs that should be preloaded by browsers. Include one entry per line, e.g. (https://example.com/example.mp3, etc.)', 'w3-total-cache' ), ) ); Util_Ui::config_item( array( - 'key' => array( 'user-experience-preload-requests', 'preload-documents' ), - 'label' => esc_html__( 'Preload Documents:', 'w3-total-cache' ), - 'control' => 'textarea', - 'description' => esc_html__( 'Specify key Document URLs that should be preloaded by browsers. Include one entry per line, e.g. (https://example.com/example.pdf, etc.)', 'w3-total-cache' ), + 'key' => array( 'user-experience-preload-requests', 'preload-documents' ), + 'label' => esc_html__( 'Preload Documents:', 'w3-total-cache' ), + 'control' => 'textarea', + 'control_after' => '' . esc_html__( 'Learn more', 'w3-total-cache' ) . '', + 'description' => esc_html__( 'Specify key Document URLs that should be preloaded by browsers. Include one entry per line, e.g. (https://example.com/example.pdf, etc.)', 'w3-total-cache' ), ) ); ?> diff --git a/wp-content/plugins/w3-total-cache/UserExperience_Remove_CssJs_Extension.php b/wp-content/plugins/w3-total-cache/UserExperience_Remove_CssJs_Extension.php new file mode 100644 index 00000000..f1ea0331 --- /dev/null +++ b/wp-content/plugins/w3-total-cache/UserExperience_Remove_CssJs_Extension.php @@ -0,0 +1,254 @@ +config = Dispatcher::config(); + } + + /** + * Runs User Experience Remove Css/Js feature. + * + * @since 2.7.0 + * + * @return void + */ + public function run() { + if ( ! Util_Environment::is_w3tc_pro( $this->config ) ) { + $this->config->set_extension_active_frontend( 'user-experience-remove-cssjs', false ); + return; + } + + Util_Bus::add_ob_callback( 'removecssjs', array( $this, 'ob_callback' ) ); + + add_filter( 'w3tc_save_options', array( $this, 'w3tc_save_options' ) ); + + add_action( 'w3tc_userexperience_page', array( $this, 'w3tc_userexperience_page' ), 12 ); + + /** + * This filter is documented in Generic_AdminActions_Default.php under the read_request method. + */ + add_filter( 'w3tc_config_key_descriptor', array( $this, 'w3tc_config_key_descriptor' ), 10, 2 ); + } + + /** + * Processes the page content buffer to remove target CSS/JS. + * + * @since 2.7.0 + * + * @param string $buffer page content buffer. + * + * @return string + */ + public function ob_callback( $buffer ) { + if ( '' === $buffer || ! \W3TC\Util_Content::is_html_xml( $buffer ) ) { + return $buffer; + } + + $can_process = array( + 'enabled' => true, + 'buffer' => $buffer, + 'reason' => null, + ); + + $can_process = $this->can_process( $can_process ); + $can_process = apply_filters( 'w3tc_remove_cssjs_can_process', $can_process ); + + // set reject reason in comment. + if ( $can_process['enabled'] ) { + $reject_reason = ''; + } else { + $reject_reason = empty( $can_process['reason'] ) ? ' (not specified)' : ' (' . $can_process['reason'] . ')'; + } + + $buffer = str_replace( + '{w3tc_remove_cssjs_reject_reason}', + $reject_reason, + $buffer + ); + + // processing. + if ( ! $can_process['enabled'] ) { + return $buffer; + } + + $this->mutator = new UserExperience_Remove_CssJs_Mutator( $this->config ); + + $buffer = $this->mutator->run( $buffer ); + + return $buffer; + } + + /** + * Checks if the request can be processed for remove CSS/JS. + * + * @since 2.7.0 + * + * @param boolean $can_process flag representing if remove CSS/JS can be executed. + * + * @return boolean + */ + private function can_process( $can_process ) { + if ( defined( 'WP_ADMIN' ) ) { + $can_process['enabled'] = false; + $can_process['reason'] = 'WP_ADMIN'; + + return $can_process; + } + + if ( defined( 'SHORTINIT' ) && SHORTINIT ) { + $can_process['enabled'] = false; + $can_process['reason'] = 'SHORTINIT'; + + return $can_process; + } + + if ( function_exists( 'is_feed' ) && is_feed() ) { + $can_process['enabled'] = false; + $can_process['reason'] = 'feed'; + + return $can_process; + } + + return $can_process; + } + + /** + * Adds remove CSS/JS message to W3TC footer comment. + * + * @since 2.7.0 + * + * @param array $strings array of W3TC footer comments. + * + * @return array + */ + public function w3tc_footer_comment( $strings ) { + $strings[] = __( 'Remove CSS/JS', 'w3-total-cache' ) . '{w3tc_remove_cssjs_reject_reason}'; + return $strings; + } + + /** + * Renders the user experience remove CSS/JS settings page. + * + * @since 2.7.0 + * + * @return void + */ + public function w3tc_userexperience_page() { + if ( self::is_enabled() ) { + include __DIR__ . '/UserExperience_Remove_CssJs_Page_View.php'; + } + } + + /** + * Specify config key typing for fields that need it. + * + * @since 2.7.0 + * + * @param mixed $descriptor Descriptor. + * @param mixed $key Compound key array. + * + * @return array + */ + public function w3tc_config_key_descriptor( $descriptor, $key ) { + if ( is_array( $key ) && 'user-experience-remove-cssjs.includes' === implode( '.', $key ) ) { + $descriptor = array( 'type' => 'array' ); + } + + return $descriptor; + } + + /** + * Performs actions on save. + * + * @since 2.7.0 + * + * @param array $data Array of save data. + * + * @return array + */ + public function w3tc_save_options( $data ) { + $new_config = $data['new_config']; + $old_config = $data['old_config']; + + $old_cssjs_includes = $old_config->get_array( array( 'user-experience-remove-cssjs', 'includes' ) ); + $old_cssjs_singles = $old_config->get_array( 'user-experience-remove-cssjs-singles' ); + $new_cssjs_includes = $new_config->get_array( array( 'user-experience-remove-cssjs', 'includes' ) ); + $new_cssjs_singles = $new_config->get_array( 'user-experience-remove-cssjs-singles' ); + + foreach ( $new_cssjs_singles as $url => $pages ) { + if ( is_string( $pages['includes'] ) ) { + $new_cssjs_singles[ $url ]['includes'] = Util_Environment::textarea_to_array( $pages['includes'] ); + } + } + + $new_config->set( 'user-experience-remove-cssjs-singles', $new_cssjs_singles ); + + if ( $new_cssjs_includes !== $old_cssjs_includes || $new_cssjs_singles !== $old_cssjs_singles ) { + $minify_enabled = $this->config->get_boolean( 'minify.enabled' ); + $pgcache_enabled = $this->config->get_boolean( 'pgcache.enabled' ); + if ( $minify_enabled || $pgcache_enabled ) { + $state = Dispatcher::config_state(); + if ( $minify_enabled ) { + $state->set( 'minify.show_note.need_flush', true ); + } + if ( $pgcache_enabled ) { + $state->set( 'common.show_note.flush_posts_needed', true ); + } + $state->save(); + } + } + + return $data; + } + + /** + * Gets the enabled status of the extension. + * + * @since 2.5.1 + * + * @return bool + */ + public static function is_enabled() { + $config = Dispatcher::config(); + $extensions_active = $config->get_array( 'extensions.active' ); + return Util_Environment::is_w3tc_pro( $config ) && array_key_exists( 'user-experience-remove-cssjs', $extensions_active ); + } +} + +$o = new UserExperience_Remove_CssJs_Extension(); +$o->run(); diff --git a/wp-content/plugins/w3-total-cache/UserExperience_Remove_CssJs_Mutator.php b/wp-content/plugins/w3-total-cache/UserExperience_Remove_CssJs_Mutator.php new file mode 100644 index 00000000..d543cb45 --- /dev/null +++ b/wp-content/plugins/w3-total-cache/UserExperience_Remove_CssJs_Mutator.php @@ -0,0 +1,167 @@ +config = $config; + } + + /** + * Runs User Experience Remove CSS/JS Mutator. + * + * @since 2.7.0 + * + * @param string $buffer Buffer string containing browser output. + * + * @return string + */ + public function run( $buffer ) { + $r = apply_filters( + 'w3tc_remove_cssjs_mutator_before', + array( + 'buffer' => $buffer, + ) + ); + + $buffer = $r['buffer']; + + // Sets includes whose matches will be stripped site-wide. + $this->includes = $this->config->get_array( + array( + 'user-experience-remove-cssjs', + 'includes', + ) + ); + + // Sets singles includes data whose matches will be removed on mated pages. + $this->singles_includes = $this->config->get_array( 'user-experience-remove-cssjs-singles' ); + + $buffer = preg_replace_callback( + '~()|()~is', + array( $this, 'remove_content' ), + $buffer + ); + + return $buffer; + } + + /** + * Removes matched link/script tag from HTML content. + * + * @since 2.7.0 + * + * @param array $matches array of matched CSS/JS entries. + * + * @return string + */ + public function remove_content( $matches ) { + $content = $matches[0]; + + if ( is_main_query() && $this->is_content_included( $content ) ) { + return ''; + } + + return $content; + } + + /** + * Checks if content has already been removed. + * + * @since 2.7.0 + * + * @param string $content script tag string. + * + * @return boolean + */ + private function is_content_included( $content ) { + global $wp; + + // Always removes matched CSS/JS for home page. + if ( is_front_page() ) { + foreach ( $this->includes as $include ) { + if ( ! empty( $include ) ) { + if ( strpos( $content, $include ) !== false ) { + return true; + } + } + } + } + + // Build array of possible current page relative/absolute URLs. + $current_pages = array( + $wp->request, + trailingslashit( $wp->request ), + home_url( $wp->request ), + trailingslashit( home_url( $wp->request ) ), + ); + + // Only removes matched CSS/JS on matching pages. + foreach ( $this->singles_includes as $include => $pages ) { + if ( + ! empty( $pages ) + // Check if the given single CSS/JS remove rule URL is present in HTML content. + && strpos( $content, $include ) !== false + // Check if current page matches defined pages for given single CSS/JS remove rule. + && array_intersect( + $current_pages, + // Remove leading / value from included page value(s) as the $wp->request excludes them. + array_map( + function ( $value ) { + return ltrim( $value, '/' ); + }, + $pages['includes'] + ) + ) + ) { + return true; + } + } + + return false; + } +} diff --git a/wp-content/plugins/w3-total-cache/UserExperience_Remove_CssJs_Page_View.js b/wp-content/plugins/w3-total-cache/UserExperience_Remove_CssJs_Page_View.js new file mode 100644 index 00000000..bfb2a791 --- /dev/null +++ b/wp-content/plugins/w3-total-cache/UserExperience_Remove_CssJs_Page_View.js @@ -0,0 +1,83 @@ +/** + * File: UserExperience_Remove_CssJs_Page_View.js + * + * @since 2.7.0 + * + * @package W3TC + */ + +jQuery(function() { + jQuery(document).on( + 'click', + '#w3tc_remove_cssjs_singles_add', + function() { + var single = prompt('Enter CSS/JS URL.'); + + if (single !== null) { + var exists = false; + + jQuery('.remove_cssjs_singles_path').each( + function() { + if (jQuery(this).html() == single) { + alert('Entry already exists!'); + exists = true; + return false; + } + } + ); + + if (!exists) { + var li = jQuery( + '

  • ' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
    CSS/JS path to remove:' + + '' + single + ' ' + + '' + + '
    ' + + '' + + '

    Specify relative/absolute page URLs that the above CSS/JS should be removed from. Include one entry per line.

    ' + + '
    ' + + '
  • ' + ); + + jQuery('#remove_cssjs_singles').append(li); + w3tc_remove_cssjs_singles_clear(); + window.location.hash = '#remove_cssjs_singles_' + single; + li.find('textarea').focus(); + } + } else { + alert('Empty CSS/JS URL!'); + } + } + ); + + jQuery(document).on( + 'click', + '.w3tc_remove_cssjs_singles_delete', + function () { + if (confirm('Are you sure want to delete this entry?')) { + jQuery(this).parents('#remove_cssjs_singles li').remove(); + w3tc_remove_cssjs_singles_clear(); + w3tc_beforeupload_bind(); + } + } + ); + + w3tc_remove_cssjs_singles_clear(); +}); + +function w3tc_remove_cssjs_singles_clear() { + if (!jQuery('#remove_cssjs_singles li').length) { + jQuery('#remove_cssjs_singles_empty').show(); + } else { + jQuery('#remove_cssjs_singles_empty').hide(); + } +} \ No newline at end of file diff --git a/wp-content/plugins/w3-total-cache/UserExperience_Remove_CssJs_Page_View.php b/wp-content/plugins/w3-total-cache/UserExperience_Remove_CssJs_Page_View.php new file mode 100644 index 00000000..1e985641 --- /dev/null +++ b/wp-content/plugins/w3-total-cache/UserExperience_Remove_CssJs_Page_View.php @@ -0,0 +1,89 @@ + $c->get_array( 'user-experience-remove-cssjs-singles' ), +); + +Util_Ui::postbox_header( esc_html__( 'Remove CSS/JS On Homepage', 'w3-total-cache' ), '', 'remove-cssjs' ); +?> +

    + +

    + + array( 'user-experience-remove-cssjs', 'includes' ), + 'label' => esc_html__( 'Remove list:', 'w3-total-cache' ), + 'control' => 'textarea', + 'description' => esc_html__( 'Specify URLs that should be removed. Include one entry per line, e.g. (googletagmanager.com, gtag/js, myscript.js, and name="myscript")', 'w3-total-cache' ), + ) + ); + + ?> +
    + +

    + +

    +

    + +

    +
      + $single_config ) { + ?> +
    • + + + + + + + + + +
      + + + + +
      + + + +

      + +

      +
      +
    • + +
    + + $servers, - 'persistent' => false, + $memcached = Cache::instance( + 'memcached', + array( + 'servers' => $servers, + 'persistent' => false, 'binary_protocol' => $binary_protocol, - 'username' => $username, - 'password' => $password - ) ); - if ( is_null( $memcached ) ) + 'username' => $username, + 'password' => $password + ) + ); + + if ( is_null( $memcached ) ) { return false; + } $test_string = sprintf( 'test_' . md5( time() ) ); - $test_value = array( 'content' => $test_string ); + $test_value = array( 'content' => $test_string ); + $memcached->set( $test_string, $test_value, 60 ); - $test_value = $memcached->get( $test_string ); - $results[$key] = ( $test_value['content'] == $test_string ); + + $test_value = $memcached->get( $test_string ); + $results[ $key ] = ( ! empty( $test_value['content'] ) && $test_value['content'] === $test_string ); } - return $results[$key]; + return $results[ $key ]; } } diff --git a/wp-content/plugins/w3-total-cache/Util_PageSpeed.php b/wp-content/plugins/w3-total-cache/Util_PageSpeed.php index 635630a4..a0c0049f 100644 --- a/wp-content/plugins/w3-total-cache/Util_PageSpeed.php +++ b/wp-content/plugins/w3-total-cache/Util_PageSpeed.php @@ -115,20 +115,24 @@ class Util_PageSpeed { * @param array $data PageSpeed data. * @param string $metric Metric key. * @param string $name Metric name. + * @param bool $widget Widget flag to add line break between desktop/mobile metric. * * @return void */ - public static function print_bar_combined_with_icon( $data, $metric, $name ) { + public static function print_bar_combined_with_icon( $data, $metric, $name, $widget = false ) { if ( ! isset( $data ) || empty( $metric ) || empty( $name ) ) { return; } + $widget_break = $widget ? '
    ' : ''; + ?>

    +
    @@ -163,18 +167,19 @@ class Util_PageSpeed { /** * Get PageSpeed metric notice BG. * - * @param int $score PageSpeed desktop/mobile score. + * @param int $score PageSpeed desktop/mobile score. + * @param string $display_mode PageSpeed desktop/mobile score display mode. * * @return string */ - public static function get_breakdown_bg( $score ) { + public static function get_breakdown_bg( $score, $display_mode ) { $notice = 'notice notice-info inline'; - if ( isset( $score ) && is_numeric( $score ) ) { + if ( isset( $display_mode ) && in_array( $display_mode, array( 'metric', 'metricSavings' ), true ) && isset( $score ) && is_numeric( $score ) ) { if ( $score >= 90 ) { $notice = 'notice notice-success inline'; } elseif ( $score >= 50 && $score < 90 ) { $noitce = 'notice notice-warning inline'; - } elseif ( $score > 0 && $score < 50 ) { + } elseif ( $score >= 0 && $score < 50 ) { $notice = 'notice notice-error inline'; } } @@ -184,18 +189,19 @@ class Util_PageSpeed { /** * Get PageSpeed metric grade. * - * @param int $score PageSpeed desktop/mobile score. + * @param int $score PageSpeed desktop/mobile score. + * @param string $display_mode PageSpeed desktop/mobile score display mode. * * @return string */ - public static function get_breakdown_grade( $score ) { + public static function get_breakdown_grade( $score, $display_mode ) { $grade = 'w3tcps_blank'; - if ( isset( $score ) && is_numeric( $score ) ) { + if ( isset( $display_mode ) && in_array( $display_mode, array( 'metric', 'metricSavings' ), true ) && isset( $score ) && is_numeric( $score ) ) { if ( $score >= 90 ) { $grade = 'w3tcps_pass'; } elseif ( $score >= 50 && $score < 90 ) { $grade = 'w3tcps_average'; - } elseif ( $score > 0 && $score < 50 ) { + } elseif ( $score >= 0 && $score < 50 ) { $grade = 'w3tcps_fail'; } } @@ -247,17 +253,13 @@ class Util_PageSpeed { $passed_audits = ''; foreach ( $data['opportunities'] as $opportunity ) { - if ( empty( $opportunity['details'] ) ) { - continue; - } - $opportunity['score'] *= 100; $notice = 'notice notice-info inline'; $grade = 'w3tcps_blank'; if ( isset( $opportunity['score'] ) ) { - $notice = self::get_breakdown_bg( $opportunity['score'] ); - $grade = self::get_breakdown_grade( $opportunity['score'] ); + $notice = self::get_breakdown_bg( $opportunity['score'], $opportunity['scoreDisplayMode'] ); + $grade = self::get_breakdown_grade( $opportunity['score'], $opportunity['scoreDisplayMode'] ); } $audit_classes = ''; @@ -272,6 +274,7 @@ class Util_PageSpeed { $headers = ''; $items = ''; + $opportunity['details'] = $opportunity['details'] ?? array(); foreach ( $opportunity['details'] as $item ) { $headers = ''; $items .= ''; @@ -279,7 +282,7 @@ class Util_PageSpeed { $headers .= '' . esc_html__( 'URL', 'w3-total-cache' ) . ''; if ( filter_var( $item['url'], FILTER_VALIDATE_URL ) !== false ) { // The value is confirmed as a valid URL. We create a HTML link with the full URL value but display it with a trucated value. - $items .= ' ...' . esc_url( wp_parse_url( $item['url'] )['path'] ) . ''; + $items .= ' ' . esc_url( $item['url'] ) . ''; } else { // For certain metrics Google uses the 'url' field for non-URL values. These are often HTML/CSS that shouldn't be escaped and will be displayed as plain text. $items .= '' . esc_html( $item['url'] ) . ''; @@ -289,7 +292,7 @@ class Util_PageSpeed { $headers .= '' . esc_html__( 'URL', 'w3-total-cache' ) . ''; if ( filter_var( $item['source']['url'], FILTER_VALIDATE_URL ) !== false ) { // The value is confirmed as a valid URL. We create a HTML link with the full URL value but display it with a trucated value. - $items .= ' ...' . esc_url( wp_parse_url( $item['source']['url'] )['path'] ) . ''; + $items .= ' ' . esc_url( $item['url'] ) . ''; } else { // For certain metrics Google uses the 'url' field for non-URL values. These are often HTML/CSS that shouldn't be escaped and will be displayed as plain text. $items .= '' . esc_html( $item['source']['url'] ) . ''; @@ -407,8 +410,7 @@ class Util_PageSpeed { } $items = ( isset( $items ) ? $items : '

    ' . esc_html__( 'No identified items were provided by Google PageSpeed Insights API for this metric', 'w3-total-cache' ) . '

    ' ); - - if ( $opportunity['score'] >= 90 ) { + if ( $opportunity['score'] >= 90 || in_array( $opportunity['scoreDisplayMode'], array( 'notApplicable' ), true ) ) { $passed_audits .= '
    ' . esc_html( $opportunity['title'] ) . ( isset( $opportunity['displayValue'] ) ? ' - ' . esc_html( $opportunity['displayValue'] ) : '' ) . ' @@ -460,17 +462,13 @@ class Util_PageSpeed { } foreach ( $data['diagnostics'] as $diagnostic ) { - if ( empty( $diagnostic['details'] ) ) { - continue; - } - $diagnostic['score'] *= 100; $notice = 'notice notice-info inline'; $grade = 'w3tcps_blank'; if ( isset( $diagnostic['score'] ) ) { - $notice = self::get_breakdown_bg( $diagnostic['score'] ); - $grade = self::get_breakdown_grade( $diagnostic['score'] ); + $notice = self::get_breakdown_bg( $diagnostic['score'], $diagnostic['scoreDisplayMode'] ); + $grade = self::get_breakdown_grade( $diagnostic['score'], $diagnostic['scoreDisplayMode'] ); } $audit_classes = ''; @@ -482,6 +480,8 @@ class Util_PageSpeed { $headers = ''; $items = ''; + + $diagnostic['details'] = $diagnostic['details'] ?? array(); foreach ( $diagnostic['details'] as $item ) { $headers = ''; $items .= ''; @@ -489,7 +489,7 @@ class Util_PageSpeed { $headers .= '' . esc_html__( 'URL', 'w3-total-cache' ) . ''; if ( filter_var( $item['url'], FILTER_VALIDATE_URL ) !== false ) { // The value is confirmed as a valid URL. We create a HTML link with the full URL value but display it with a trucated value. - $items .= ' ...' . esc_url( wp_parse_url( $item['url'] )['path'] ) . ''; + $items .= '' . esc_url( $item['url'] ) . ''; } else { // For certain metrics Google uses the 'url' field for non-URL values. These are often HTML/CSS that shouldn't be escaped and will be displayed as plain text. $items .= '' . esc_html( $item['url'] ) . ''; @@ -499,7 +499,7 @@ class Util_PageSpeed { $headers .= '' . esc_html__( 'URL', 'w3-total-cache' ) . ''; if ( filter_var( $item['source']['url'], FILTER_VALIDATE_URL ) !== false ) { // The value is confirmed as a valid URL. We create a HTML link with the full URL value but display it with a trucated value. - $items .= ' ...' . esc_url( wp_parse_url( $item['source']['url'] )['path'] ) . ''; + $items .= '' . esc_url( $item['url'] ) . ''; } else { // For certain metrics Google uses the 'url' field for non-URL values. These are often HTML/CSS that shouldn't be escaped and will be displayed as plain text. $items .= '' . esc_html( $item['source']['url'] ) . ''; @@ -618,7 +618,7 @@ class Util_PageSpeed { $items = ( isset( $items ) ? $items : '

    ' . esc_html__( 'No identified items were provided by Google PageSpeed Insights API for this metric', 'w3-total-cache' ) . '

    ' ); - if ( $diagnostic['score'] >= 90 ) { + if ( $diagnostic['score'] >= 90 || in_array( $diagnostic['scoreDisplayMode'], array( 'notApplicable' ), true ) ) { $passed_audits .= '
    ' . esc_html( $diagnostic['title'] ) . ( isset( $diagnostic['displayValue'] ) ? ' - ' . esc_html( $diagnostic['displayValue'] ) : '' ) . ' diff --git a/wp-content/plugins/w3-total-cache/Util_PageUrls.php b/wp-content/plugins/w3-total-cache/Util_PageUrls.php index 2caa249c..fb595934 100644 --- a/wp-content/plugins/w3-total-cache/Util_PageUrls.php +++ b/wp-content/plugins/w3-total-cache/Util_PageUrls.php @@ -873,10 +873,12 @@ class Util_PageUrls { } /** - * Gets page title based on key + * Gets page title based on key. + * + * @since 2.4.0 * * @param string $id Page ID. - * @return string + * @return array */ public static function get_page_mapping( $id ) { $map = array( @@ -982,6 +984,8 @@ class Util_PageUrls { ), ); - return ! empty( $map[ $id ] ) ? $map[ $id ] : ''; + $map = apply_filters( 'w3tc_page_mapping', $map ); + + return ! empty( $map[ $id ] ) ? $map[ $id ] : array(); } } diff --git a/wp-content/plugins/w3-total-cache/Util_Ui.php b/wp-content/plugins/w3-total-cache/Util_Ui.php index 4d56aa34..824bde19 100644 --- a/wp-content/plugins/w3-total-cache/Util_Ui.php +++ b/wp-content/plugins/w3-total-cache/Util_Ui.php @@ -302,7 +302,7 @@ class Util_Ui { - + @@ -1503,8 +1503,10 @@ class Util_Ui { public static function print_breadcrumb() { $page = ! empty( Util_Admin::get_current_extension() ) ? Util_Admin::get_current_extension() : Util_Admin::get_current_page(); $page_mapping = Util_PageUrls::get_page_mapping( $page ); - $parent = isset( $page_mapping['parent_name'] ) ? '' . esc_html( $page_mapping['parent_name'] ) . '' : ''; - $current = '' . esc_html( $page_mapping['page_name'] ) . ''; + $parent = isset( $page_mapping['parent_name'] ) ? + '' . esc_html( $page_mapping['parent_name'] ) . '' : ''; + $current = isset( $page_mapping['page_name'] ) ? + '' . esc_html( $page_mapping['page_name'] ) . '' : ''; ?>

    @@ -1857,11 +1859,16 @@ class Util_Ui { $subnav_links = array( '' . esc_html__( 'Lazy Loading', 'w3-total-cache' ) . '' ); if ( UserExperience_DeferScripts_Extension::is_enabled() ) { - $subnav_links[] = '' . esc_html__( 'Delay Scripts', 'w3-total-cache' ) . ''; + $subnav_links[] = '' . esc_html__( 'Delay Scripts', 'w3-total-cache' ) . ''; + } + + if ( UserExperience_Remove_CssJs_Extension::is_enabled() ) { + $subnav_links[] = '' . esc_html__( 'Remove CSS/JS - Homepage', 'w3-total-cache' ) . ''; + $subnav_links[] = '' . esc_html__( 'Remove CSS/JS - Singles', 'w3-total-cache' ) . ''; } if ( UserExperience_Preload_Requests_Extension::is_enabled() ) { - $subnav_links[] = '' . esc_html__( 'Preload Requests', 'w3-total-cache' ) . ''; + $subnav_links[] = '' . esc_html__( 'Preload Requests', 'w3-total-cache' ) . ''; } // If there's only 1 meta box on the page, no need for nav links. diff --git a/wp-content/plugins/w3-total-cache/inc/lightbox/purchase.php b/wp-content/plugins/w3-total-cache/inc/lightbox/purchase.php index 879d54c9..51be2db6 100644 --- a/wp-content/plugins/w3-total-cache/inc/lightbox/purchase.php +++ b/wp-content/plugins/w3-total-cache/inc/lightbox/purchase.php @@ -1,4 +1,4 @@ -

    -
    diff --git a/wp-content/plugins/w3-total-cache/inc/lightbox/upgrade.php b/wp-content/plugins/w3-total-cache/inc/lightbox/upgrade.php index bc465e4b..c6f3c4a5 100644 --- a/wp-content/plugins/w3-total-cache/inc/lightbox/upgrade.php +++ b/wp-content/plugins/w3-total-cache/inc/lightbox/upgrade.php @@ -6,7 +6,6 @@ if ( ! defined( 'W3TC' ) ) { } ?>
    -
    @@ -15,26 +14,22 @@ if ( ! defined( 'W3TC' ) ) {
    - -
    - - - - - - - -
    -
    -
    - +
    diff --git a/wp-content/plugins/w3-total-cache/inc/options/browsercache.php b/wp-content/plugins/w3-total-cache/inc/options/browsercache.php index 7fb6e988..04986ff6 100644 --- a/wp-content/plugins/w3-total-cache/inc/options/browsercache.php +++ b/wp-content/plugins/w3-total-cache/inc/options/browsercache.php @@ -88,6 +88,7 @@ $security_session_values = array( value="1" /> +

    @@ -96,14 +97,18 @@ $security_session_values = array( + value="1" /> + +

    + name="cache_control" value="1" /> + +

    @@ -111,14 +116,18 @@ $security_session_values = array( + name="etag" value="1" /> + +

    + value="1" /> + +

    @@ -146,6 +155,7 @@ $security_session_values = array( ); ?> +

    @@ -174,6 +184,7 @@ $security_session_values = array( ); ?> +

    @@ -181,7 +192,9 @@ $security_session_values = array( + name="replace" value="1" /> + +

    @@ -189,7 +202,9 @@ $security_session_values = array( + name="querystring" value="1" /> + +

    - + + + +