updated plugin `W3 Total Cache` version 2.7.0

This commit is contained in:
KawaiiPunk 2024-03-28 09:40:06 +00:00 committed by Gitium
parent 60de585044
commit 218272bbcb
140 changed files with 3054 additions and 3013 deletions

View File

@ -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 <acronym title="Hypertext Transfer Protocol">HTTP</acronym> (gzip) compression</label>', 'w3-total-cache' ),
'browsercache.other.brotli' => __( 'Enable <acronym title="Hypertext Transfer Protocol">HTTP</acronym> (brotli) compression</label>', 'w3-total-cache' ),
'browsercache.other.compression' => __( 'Enable <acronym title="Hypertext Transfer Protocol">HTTP</acronym> (gzip) compression', 'w3-total-cache' ),
'browsercache.other.brotli' => __( 'Enable <acronym title="Hypertext Transfer Protocol">HTTP</acronym> (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 <acronym title="Hypertext Transfer Protocol">HTTP</acronym> only:', 'w3-total-cache' ),

View File

@ -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";
}
}
}

View File

@ -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 );
}

View File

@ -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( '/(?<!\\\\)' . wp_spaces_regexp() . '/', '\ ', strtolower( $value ) );
},
$values
)
);
}
}

View File

@ -247,7 +247,7 @@ class Cache_Memcached extends Cache_Base {
public function get_statistics() {
$a = $this->_memcache->getStats();
if ( count( $a ) > 0 ) {
if ( ! empty( $a ) && count( $a ) > 0 ) {
$keys = array_keys( $a );
$key = $keys[0];
return $a[$key];

View File

@ -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();
}

View File

@ -28,7 +28,7 @@ class Cdn_BunnyCdn_Widget {
Util_Widget::add2(
'w3tc_bunnycdn',
2000,
400,
'<div class="w3tc-widget-bunnycdn-logo"></div>',
array( $o, 'widget_form' ),
Util_Ui::admin_url( 'admin.php?page=w3tc_cdn' ),

View File

@ -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() {
}
});

View File

@ -1,6 +1,5 @@
jQuery(function($) {
function w3tchw_resize(o) {
o.options.height = jQuery('.w3tc_cdn_highwinds_form').height() + 30;
o.resize();
}

View File

@ -1,105 +0,0 @@
<?php
namespace W3TC;
class Cdn_Highwinds_Widget {
static public function admin_init_w3tc_dashboard() {
$o = new Cdn_Highwinds_Widget();
add_action( 'admin_print_styles',
array( $o, 'admin_print_styles' ) );
add_action( 'admin_print_scripts',
array( $o, 'admin_print_scripts' ) );
add_action( 'w3tc_widget_setup',
array( $o, 'w3tc_widget_setup' ), 2000 );
}
public function w3tc_widget_setup() {
Util_Widget::add( 'w3tc_highwinds',
'<div class="w3tc-widget-highwinds-logo"></div>',
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()
) );
}
}
}

View File

@ -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;
}

View File

@ -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);

View File

@ -1,60 +0,0 @@
<?php
namespace W3TC;
if ( ! defined( 'W3TC' ) ) {
die();
}
?>
<p>
<div class="notice notice-warning inline">
<p>
<?php
// HighWinds sunset is 12:00 am Central (UTC-6:00) on November, 22, 2023 (1700629200).
$date_time_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
printf(
// translators: 1 HighWinds sunset datetime.
__(
'HighWinds will cease operations at %1$s.',
'w3-total-cache'
),
wp_date( $date_time_format, '1700629200' )
);
?>
</p>
</div>
</p>
<div class="wrapper">
<div class="tools area">
<ul class="w3tchw_tools">
<li><a class="button"
href="<?php echo esc_url( $url_manage ); ?>"><?php esc_html_e( 'Manage', 'w3-total-cache' ); ?></a>
</li>
<li><a class="button"
href="<?php echo esc_url( $url_analyze ); ?>"><?php esc_html_e( 'Reports', 'w3-total-cache' ); ?></a>
</li>
<li><a class="button" href="<?php echo esc_url( $url_purge ); ?>"
onclick="w3tc_popupadmin_bar(this.href); return false"><?php esc_html_e( 'Purge', 'w3-total-cache' ); ?></a>
</li>
</ul>
</div>
<div class="w3tchw_loading w3tc_loading w3tc_hidden">Loading...</div>
<div class="w3tchw_error w3tc_none">
An error occurred
<div class="w3tchw_error_details"></div>
</div>
<div class="w3tchw_content w3tc_hidden">
<div class="summary area">
<h4><?php esc_html_e( 'Report - 30 days', 'w3-total-cache' ); ?></h4>
<ul id="w3tchw_report">
<li>Transferred: <span class="w3tchw_transferred_size"></span></li>
<li>Average rate Mb/s: <span class="w3tchw_average_mbps"></span></li>
<li>Average requests/s: <span class="w3tchw_average_rps"></span></li>
</ul>
</div>
<div class="charts area">
<h4><?php esc_html_e( 'Requests', 'w3-total-cache' ); ?></h4>
<div id="w3tchw_chart" style="width: 320px; height: 220px;margin-left: auto; margin-right: auto;"></div>
</div>
</div>
</div>

View File

@ -1,28 +0,0 @@
<?php
namespace W3TC;
if ( !defined( 'W3TC' ) )
die();
?>
<p>
<div class="notice notice-warning inline">
<p>
<?php
// HighWinds sunset is 12:00 am Central (UTC-6:00) on November, 22, 2023 (1700629200).
$date_time_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
printf(
// translators: 1 HighWinds sunset datetime.
__(
'HighWinds will cease operations at %1$s.',
'w3-total-cache'
),
wp_date( $date_time_format, '1700629200' )
);
?>
</p>
</div>
</p>
<div class="wrapper">
Not configured
</div>

View File

@ -1,6 +1,5 @@
jQuery(function($) {
function w3tc_popup_resize(o) {
o.options.height = jQuery('.w3tc_popup_form').height() + 30;
o.resize();
}

View File

@ -3,7 +3,7 @@ namespace W3TC;
class Cdnfsd_LimeLight_Popup {
class Cdn_LimeLight_Popup {
static public function w3tc_ajax() {
$o = new Cdnfsd_LimeLight_Popup();

View File

@ -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' ) );

View File

@ -1,6 +1,5 @@
jQuery(function($) {
function w3tc_rackspace_resize(o) {
o.options.height = jQuery('.w3tc_cdn_rackspace_form').height() + 30;
o.resize();
}

View File

@ -1,6 +1,5 @@
jQuery(function($) {
function w3tc_rackspace_resize(o) {
o.options.height = jQuery('.w3tc_cdn_rackspace_form').height() + 30;
o.resize();
}

View File

@ -1,6 +1,5 @@
jQuery(function($) {
function w3tc_stackpath_resize(o) {
o.options.height = jQuery('.w3tc_cdn_stackpath2_form').height();
o.resize();
}

View File

@ -1,125 +0,0 @@
<?php
namespace W3TC;
class Cdn_StackPath2_Widget {
static public function admin_init_w3tc_dashboard() {
$o = new Cdn_StackPath2_Widget();
add_action( 'admin_print_styles',
array( $o, 'admin_print_styles' ) );
add_action( 'admin_print_scripts',
array( $o, 'admin_print_scripts' ) );
Util_Widget::add2( 'w3tc_stackpath', 2000,
'<div class="w3tc-widget-stackpath2-logo"></div>',
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' );
}
}

View File

@ -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;
}

View File

@ -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);

View File

@ -1,59 +0,0 @@
<?php
namespace W3TC;
if ( ! defined( 'W3TC' ) ) {
die();
}
?>
<p>
<div class="notice notice-warning inline">
<p>
<?php
// StackPath sunset is 12:00 am Central (UTC-6:00) on November, 22, 2023 (1700629200).
$date_time_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
printf(
// translators: 1 StackPath sunset datetime.
__(
'StackPath will cease operations at %1$s.',
'w3-total-cache'
),
wp_date( $date_time_format, '1700629200' )
);
?>
</p>
</div>
</p>
<div class="w3tcstackpath2_loading w3tc_loading w3tc_hidden">Loading...</div>
<div class="w3tcstackpath2_error w3tc_none">
An error occurred
<div class="w3tcstackpath2_error_details"></div>
</div>
<div id="stackpath-widget" class="stackpath-widget-base w3tcstackpath2_content w3tc_hidden">
<div class="w3tcstackpath2_wrapper">
<div class="w3tcstackpath2_tools">
<ul class="w3tcstackpath2_ul">
<li><a class="button w3tcstackpath2_href_manage" href=""><?php esc_html_e( 'Manage', 'w3-total-cache' ); ?></a></li>
<li><a class="button w3tcstackpath2_href_reports" href=""><?php esc_html_e( 'Reports', 'w3-total-cache' ); ?></a></li>
<li><a class="button" href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin.php?page=w3tc_cdn&amp;w3tc_cdn_purge' ) ) ); ?>" onclick="w3tc_popupadmin_bar( this.href ); return false;"><?php esc_html_e( 'Purge', 'w3-total-cache' ); ?></a></li>
</ul>
</div>
<div class="w3tcstackpath2_summary">
<h4 class="w3tcstackpath2_summary_h4"><?php esc_html_e( 'Report - 7 days', 'w3-total-cache' ); ?></h4>
</div>
<ul class="w3tcstackpath2_ul">
<li>
<span class="w3tcstackpath2_summary_col1"><?php esc_html_e( 'Transferred', 'w3-total-cache' ); ?>:</span>
<span class="w3tcstackpath2_summary_col2 w3tcstackpath2_summary_mb"></span>
</li>
<li>
<span class="w3tcstackpath2_summary_col1"><?php esc_html_e( 'Requests', 'w3-total-cache' ); ?>:</span>
<span class="w3tcstackpath2_summary_col2 w3tcstackpath2_summary_requests"></span>
</li>
</ul>
<div class="w3tcstackpath2_chart charts w3tcstackpath2_area">
<h4 class="w3tcstackpath2_h4"><?php esc_html_e( 'Requests', 'w3-total-cache' ); ?></h4>
<div id="chart_div" style="width: 320px; height: 220px;margin-left: auto ; margin-right: auto ;"></div>
</div>
</div>
</div>

View File

@ -1,65 +0,0 @@
<?php
namespace W3TC;
if ( ! defined( 'W3TC' ) ) {
die();
}
?>
<p>
<div class="notice notice-warning inline">
<p>
<?php
// StackPath sunset is 12:00 am Central (UTC-6:00) on November, 22, 2023 (1700629200).
$date_time_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
printf(
// translators: 1 StackPath sunset datetime.
__(
'StackPath will cease operations at %1$s.',
'w3-total-cache'
),
wp_date( $date_time_format, '1700629200' )
);
?>
</p>
</div>
</p>
<div id="stackpath-widget" class="w3tcstackpath_signup">
<?php if ( ! $c->get_boolean( 'cdn.enabled' ) ) : ?>
<p class="notice notice-error">
<?php
w3tc_e(
'cdn.stackpath.widget.v2.no_cdn',
sprintf(
// translators: 1 HTML acronym for Content Delivery Network (CDN).
__( 'W3 Total Cache has detected that you do not have a %1$s configured', 'w3-total-cache' ),
'<acronym title="' . __( 'Content Delivery Network', 'w3-total-cache' ) . '">' . __( 'CDN', 'w3-total-cache' ) . '</acronym>'
)
);
?>
</p>
<?php endif ?>
<p>
<h4 class="w3tcstackpath_signup_h4"><?php esc_html_e( 'Current customers', 'w3-total-cache' ); ?></h4>
<p>
<?php
w3tc_e(
'cdn.stackpath2.widget.v2.existing',
sprintf(
// translators: 1 HTML acronym for Content Delivery Network (CDN).
__(
'If you\'re an existing StackPath customer, enable %1$s and Authorize. If you need help configuring
your %1$s, we also offer Premium Services to assist you.',
'w3-total-cache'
),
'<acronym title="' . __( 'Content Delivery Network', 'w3-total-cache' ) . '">' . __( 'CDN', 'w3-total-cache' ) . '</acronym>'
)
);
?>
</p>
<a class="button-primary" href="<?php echo esc_url( wp_nonce_url( Util_Ui::admin_url( 'admin.php?page=w3tc_cdn' ), 'w3tc' ) ); ?>" target="_blank">
<?php esc_html_e( 'Authorize', 'w3-total-cache' ); ?>
</a>
<a class="button" href="<?php echo esc_url( wp_nonce_url( Util_Ui::admin_url( 'admin.php?page=w3tc_support' ), 'w3tc' ) ); ?>">
<?php esc_html_e( 'Premium Services', 'w3-total-cache' ); ?>
</a>
</div>

View File

@ -1,6 +1,5 @@
jQuery(function($) {
function w3tc_stackpath_resize(o) {
o.options.height = jQuery('.w3tc_cdn_stackpath_form').height();
o.resize();
}

View File

@ -1,141 +0,0 @@
<?php
namespace W3TC;
class Cdn_StackPath_Widget {
static public function admin_init_w3tc_dashboard() {
$o = new Cdn_StackPath_Widget();
add_action( 'admin_print_styles',
array( $o, 'admin_print_styles' ) );
add_action( 'admin_print_scripts',
array( $o, 'admin_print_scripts' ) );
add_action( 'w3tc_widget_setup',
array( $o, 'w3tc_widget_setup' ), 2000 );
}
public function w3tc_widget_setup() {
Util_Widget::add( 'w3tc_stackpath',
'<div class="w3tc-widget-stackpath-logo"></div>',
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' );
}
}

View File

@ -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;
}

View File

@ -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 += '<li>' +
'<span style="display:inline-block; background-color: ' + file.color +
';width: ' + (file.hit / compare * 100 * 0.9) + '%; ' +
'min-width:60%" title="' +
file.title + ' / ' + file.group + ' / ' + file.file + '">' +
'</span> <span style="color:#000">' + file.hit +
'</span></li>';
}
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);

View File

@ -1,93 +0,0 @@
<?php
namespace W3TC;
if ( ! defined( 'W3TC' ) ) {
die();
}
?>
<p>
<div class="notice notice-warning inline">
<p>
<?php
$date_time_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
$sunset_timestamp = wp_date( $date_time_format, '1700629200' );
printf(
// translators: 1 sunset unix timestamp.
__(
'StackPath will cease operations at %1$s.',
'w3-total-cache'
),
$sunset_timestamp
);
?>
</p>
</div>
</p>
<div class="w3tcstackpath_loading w3tc_loading w3tc_hidden">Loading...</div>
<div class="w3tcstackpath_error w3tc_none">
An error occurred
<div class="w3tcstackpath_error_details"></div>
</div>
<div id="stackpath-widget" class="stackpath-widget-base w3tcstackpath_content w3tc_hidden">
<div class="w3tcstackpath_wrapper">
<div class="w3tcstackpath_status">
<p>
<span>
<?php esc_html_e( 'Status', 'w3-total-cache' ); ?>
<span class="w3tcstackpath_account_status"></span>
</span>
<span style="display:inline-block;float:right">
<?php esc_html_e( 'Content Zone:', 'w3-total-cache' ); ?>
<span class="w3tcstackpath_zone_name"></span>
</span>
</p>
</div>
<div class="w3tcstackpath_tools">
<ul class="w3tcstackpath_ul">
<li><a class="button w3tcstackpath_href_manage" href=""><?php esc_html_e( 'Manage', 'w3-total-cache' ); ?></a></li>
<li><a class="button w3tcstackpath_href_reports" href=""><?php esc_html_e( 'Reports', 'w3-total-cache' ); ?></a></li>
<li><a class="button" href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin.php?page=w3tc_cdn&amp;w3tc_cdn_purge' ) ) ); ?>" onclick="w3tc_popupadmin_bar(this.href); return false;"><?php esc_html_e( 'Purge', 'w3-total-cache' ); ?></a></li>
</ul>
</div>
<div class="w3tcstackpath_summary">
<h4 class="w3tcstackpath_summary_h4"><?php esc_html_e( 'Report - 30 days', 'w3-total-cache' ); ?></h4>
</div>
<ul class="w3tcstackpath_ul">
<li>
<span class="w3tcstackpath_summary_col1"><?php esc_html_e( 'Transferred', 'w3-total-cache' ); ?>:</span>
<span class="w3tcstackpath_summary_col2 w3tcstackpath_summary_size"></span>
</li>
<li>
<span class="w3tcstackpath_summary_col1"><?php esc_html_e( 'Cache Hits', 'w3-total-cache' ); ?>:</span>
<span class="w3tcstackpath_summary_col2">
<span class="w3tcstackpath_summary_cache_hit"></span>
(<span class="w3tcstackpath_summary_cache_hit_percentage"></span>)
</span>
</li>
<li>
<span class="w3tcstackpath_summary_col1"><?php esc_html_e( 'Cache Misses', 'w3-total-cache' ); ?>:</span>
<span class="w3tcstackpath_summary_col2">
<span class="w3tcstackpath_summary_noncache_hit">
(<span class="w3tcstackpath_summary_noncache_hit_percentage"></span>)
</span>
</li>
</ul>
<div class="w3tcstackpath_chart charts w3tcstackpath_area">
<h4 class="w3tcstackpath_h4"><?php esc_html_e( 'Requests', 'w3-total-cache' ); ?></h4>
<div id="chart_div" style="width: 320px; height: 220px;margin-left: auto ; margin-right: auto ;"></div>
<h4 class="w3tcstackpath_h4"><?php esc_html_e( 'Content Breakdown', 'w3-total-cache' ); ?></h4>
<p>
<span><?php esc_html_e( 'File', 'w3-total-cache' ); ?></span>
<span style="display:inline-block;float:right"><?php esc_html_e( 'Hits', 'w3-total-cache' ); ?></span>
</p>
<ul class="w3tcstackpath_file_hits">
<li>A</li>
<li>A</li>
<li>A</li>
<li>A</li>
<li>A</li>
</ul>
</div>
</div>
</div>

View File

@ -1,42 +0,0 @@
<?php
namespace W3TC;
if ( ! defined( 'W3TC' ) ) {
die();
}
?>
<p>
<div class="notice notice-warning inline">
<p>
<?php
// StackPath sunset is 12:00 am Central (UTC-6:00) on November, 22, 2023 (1700629200).
$date_time_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
printf(
// translators: 1 StackPath sunset datetime.
__(
'StackPath will cease operations at %1$s.',
'w3-total-cache'
),
wp_date( $date_time_format, '1700629200' )
);
?>
</p>
</div>
</p>
<div id="stackpath-widget" class="w3tcstackpath_signup">
<p>
<h4 class="w3tcstackpath_signup_h4"><?php esc_html_e( 'Current customers', 'w3-total-cache' ); ?></h4>
<p>
<?php
w3tc_e(
'cdn.stackpath.widget.existing',
sprintf(
// translators: 1 HTML acronym for Content Delivery Network (CDN).
__( 'If you\'re an existing StackPath customer, enable %1$s and:', 'w3-total-cache' ),
'<acronym title="' . __( 'Content Delivery Network', 'w3-total-cache' ) . '">' . __( 'CDN', 'w3-total-cache' ) . '</acronym>'
)
);
?>
</p>
<a class="button-primary" href="<?php echo esc_url( wp_nonce_url( Util_Ui::admin_url( 'admin.php?page=w3tc_cdn' ), 'w3tc' ) ); ?>" target="_blank"><?php esc_html_e( 'Authorize', 'w3-total-cache' ); ?></a>
</div>

View File

@ -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();
}

View File

@ -1,6 +1,5 @@
jQuery(function($) {
function w3tc_popup_resize(o) {
o.options.height = jQuery('.w3tc_popup_form').height() + 30;
o.resize();
}

View File

@ -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;

View File

@ -1,6 +1,5 @@
jQuery(function($) {
function w3tc_popup_resize(o) {
o.options.height = jQuery('.w3tc_popup_form').height() + 30;
o.resize();
}

View File

@ -1,6 +1,5 @@
jQuery(function($) {
function w3tc_stackpath_resize(o) {
o.options.height = jQuery('.w3tc_cdn_stackpath2_fsd_form').height();
o.resize();
}

View File

@ -1,6 +1,5 @@
jQuery(function($) {
function w3tc_stackpath_fsd_resize(o) {
o.options.height = jQuery('.w3tc_popup_form').height() + 30;
o.resize();
}

View File

@ -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' => ''

View File

@ -1,6 +1,5 @@
jQuery(function($) {
function w3tc_extension_cloudflare_resize(o) {
o.options.height = jQuery('.w3tc_extension_cloudflare_form').height() + 30;
o.resize();
}

View File

@ -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,
'<div class="w3tc_cloudflare_widget_logo"></div>',
array( $this, 'widget_form' ),
Util_Ui::admin_url( 'admin.php?page=w3tc_general#cloudflare' ),

View File

@ -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( '<div id="' + key + '_chart"></div>' );
}
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 `<div style="padding:10px;"><span><strong>Type:</strong> ${dataType}</span><br/><span><strong>Count:</strong> ${count}</span><br/><span><strong>Bytes:</strong> ${formatBytes(bytes)}</span></div>`;
}
// 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
);
}
}
);

View File

@ -0,0 +1,118 @@
<?php
/**
* File: Extension_ImageService_Widget.php
*
* @package W3TC
*
* @since X.X.X
*/
namespace W3TC;
/**
* Class Extension_ImageService_Widget
*
* @since X.X.X
*/
class Extension_ImageService_Widget {
/**
* Dashboard setup action
*
* @since X.X.X
*
* @return void
*/
public static function admin_init_w3tc_dashboard() {
$config = Dispatcher::config();
$is_pro = Util_Environment::is_w3tc_pro( $config );
$o = new Extension_ImageService_Widget();
add_action( 'w3tc_widget_setup', array( $o, 'wp_dashboard_setup' ), 300 );
add_action( 'w3tc_network_dashboard_setup', array( $o, 'wp_dashboard_setup' ), 300 );
if ( ! $config->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',
'<div class="w3tc-widget-w3tc-logo"></div><div class="w3tc-widget-text">' . __( 'Image Optimization Summary', 'w3-total-cache' ) . '</div>',
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';
}
}

View File

@ -0,0 +1,52 @@
<?php
/**
* File: Extension_ImageService_Widget_View.php
*
* @package W3TC
*
* @since X.X.X
*/
namespace W3TC;
if ( ! defined( 'W3TC' ) ) {
die();
}
$config = Dispatcher::config();
if ( $config->is_extension_active( 'imageservice' ) ) {
?>
<div id="w3tc-webp-widget-stats-container">
<h3 class="w3tc-webp-widget-stats-title"><?php esc_html_e( 'Status', 'w3-total-cache' ); ?></h3>
<div id="counts_chart"></div>
<h3 class="w3tc-webp-widget-stats-title"><?php esc_html_e( 'API Use Limits', 'w3-total-cache' ); ?></h3>
<div id="api_charts"></div>
</div>
<?php
} else {
?>
<div id="w3tc-webp-widget-stats-container" class="w3tc-webp-widget-stats-inactive">
<?php
echo wp_kses(
Util_Ui::button_link(
__( 'Enable WebP Converter', 'w3-total-cache' ),
Util_Ui::admin_url( 'admin.php?page=w3tc_general&w3tc_message=65b942a33d66c#image_service' ),
false,
'button-primary'
),
array(
'input' => array(
'type' => array(),
'name' => array(),
'class' => array(),
'value' => array(),
'onclick' => array(),
'data-src' => array(),
),
)
);
?>
</div>
<?php
}

View File

@ -8,6 +8,9 @@ jQuery(function($) {
height: 400,
url: ajaxurl + '?action=w3tc_ajax&_wpnonce=' + w3tc_nonce +
'&w3tc_action=newrelic_popup',
callback: function(lightbox) {
lightbox.resize();
}
});
})

View File

@ -27,9 +27,8 @@ class Extension_NewRelic_Widget {
$o = new Extension_NewRelic_Widget();
$o->_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();

View File

@ -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' ) );

View File

@ -1,237 +0,0 @@
<?php
namespace W3TC;
class Extension_Swarmify_Widget {
private $_config;
static public function admin_init_w3tc_dashboard() {
$o = new Extension_Swarmify_Widget();
$o->_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',
'<div class="w3tc-widget-swarmify-logo"></div>',
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'] = '<span class="w3tc-enabled">enabled</span>';
else
$response['php_agent'] = '<span class="w3tc-disabled">disabled</span>';
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' => '<div class="w3tcnr_topfive_message">No data available</div>'
);
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 = '<table class="w3tcnr_slowest">';
foreach ( $metric_slow_pages as $transaction => $time ) {
$s .= '<tr><td><span>' . $transaction .
'</span></td><td>' . Util_Ui::secs_to_time( $time ) .
'</td></tr>';
}
$s .= '</table>';
$response['content'] = $s;
}
}
} catch ( \Exception $e ) {
$response['content'] = '<div class="w3tcnr_topfive_message">Error occurred</div>';
}
echo json_encode( $response );
}
public function w3tc_ajax_newrelic_widgetdata_webtransactions() {
$response = array(
'content' => '<div class="w3tcnr_topfive_message">No data available</div>'
);
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 = '<table class="w3tcnr_slowest">';
foreach ( $metric_slow as $transaction => $time ) {
$s .= '<tr><td><span>' . $transaction .
'</span></td><td>' . Util_Ui::secs_to_time( $time ) .
'</td></tr>';
}
$s .= '</table>';
$response['content'] = $s;
}
}
} catch ( \Exception $e ) {
$response['content'] = '<div class="w3tcnr_topfive_message">Error occurred</div>';
}
echo json_encode( $response );
}
public function w3tc_ajax_newrelic_widgetdata_dbtimes() {
$response = array(
'content' => '<div class="w3tcnr_topfive_message">No data available</div>'
);
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 = '<table class="w3tcnr_slowest">';
foreach ( $metric_slow as $transaction => $time ) {
$s .= '<tr><td><span>' . $transaction .
'</span></td><td>' . Util_Ui::secs_to_time( $time ) .
'</td></tr>';
}
$s .= '</table>';
$response['content'] = $s;
}
}
} catch ( \Exception $e ) {
$response['content'] = '<div class="w3tcnr_topfive_message">Error occurred</div>';
}
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
);
}
}

View File

@ -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;
}
}
*/

View File

@ -1,17 +0,0 @@
<?php
namespace W3TC;
if ( ! defined( 'W3TC' ) ) {
die();
}
?>
<div class="sign-up w3tc-widget-swarmify-base">
<p><?php esc_html_e( 'Just as the load time and overall performance of your website impacts user satisfaction, so does the performance of your online videos. Optimize your video performance by enabling the Swarmify SmartVideo&#8482 solution.', 'w3-total-cache' ); ?></p>
<h4><?php esc_html_e( 'New customers', 'w3-total-cache' ); ?></h4>
<p><?php esc_html_e( 'Swarmify is a service that lets you speed up your site even more with W3 Total Cache.', 'w3-total-cache' ); ?></p>
<a class="button-primary" href="<?php echo esc_url( $swarmify_signup_url ); ?>" target="_blank"><?php esc_html_e( 'Sign Up Now and Save 25%', 'w3-total-cache' ); ?></a>
<p><span class="desc"><?php esc_html_e( 'Free 14 day limited trial', 'w3-total-cache' ); ?></span></p>
<h4><?php esc_html_e( 'Current customers', 'w3-total-cache' ); ?></h4>
<p><?php esc_html_e( 'If you already have a Swarmify configuration key, or need to update your existing key, click here:', 'w3-total-cache' ); ?></p>
<a class="button-primary" href="admin.php?page=w3tc_extensions&amp;extension=swarmify&amp;action=view"><?php esc_html_e( 'Configure', 'w3-total-cache' ); ?></a>
</div>

View File

@ -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';
}

View File

@ -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' => '<button class="button" onclick="window.location=\'' . (
UserExperience_Remove_CssJs_Extension::is_enabled() ?
esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_userexperience#remove-cssjs' ) ) :
esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_general#userexperience' ) )
) . '\'">' .
__( 'Settings', 'w3-total-cache' ) . '</button>',
'link' => '<a target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/remove-cssjs/?utm_source=w3tc&utm_medium=feature_showcase&utm_campaign=remove-cssjs' ) .
'">' . __( 'More info', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
'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' ) . '<span class="dashicons dashicons-external"></span></a>',
'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' ) . '<span class="dashicons dashicons-external"></span></a>',
'is_premium' => true,
'is_new' => true,
'version' => '2.6.1',
),
),
'old' => array(

View File

@ -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 ) {
</div><div class="w3tc-card-links"><?php echo $card['link']; ?></div>
</div>
<?php
if ( $is_new ) {
if ( ! empty( $card['is_new'] ) && ! empty( $card['version'] ) ) {
?>
<div class="w3tc-card-ribbon-new">
<span class="dashicons dashicons-awards"></span>
<b><?php esc_html_e( 'New', 'w3-total-cache' ); ?></b>
<span>
<?php esc_html_e( 'in', 'w3-total-cache' ); ?> W3 Total Cache Pro <?php echo W3TC_VERSION; ?>!
<?php esc_html_e( 'in', 'w3-total-cache' ); ?> W3 Total Cache <?php echo $card['version']; ?> !
</span>
</div>
<?php

View File

@ -6,6 +6,9 @@ jQuery(function() {
width: 800,
height: 240,
url: ajaxurl + '?action=w3tc_ajax&_wpnonce=' + w3tc_nonce +
'&w3tc_action=generic_edge'
'&w3tc_action=generic_edge',
callback: function(lightbox) {
lightbox.resize();
},
});
});

View File

@ -8,6 +8,7 @@ jQuery(function() {
'&w3tc_action=generic_support_us',
callback: function(lightbox) {
jQuery(".palette-twitter").click(function() {jQuery("#tweeted").val("1");});
lightbox.resize();
}
});
});

View File

@ -1,17 +1,19 @@
#w3tc-dashboard-widgets.metabox-holder {
background-color: #FFF;
margin:0;padding:0;
display: flex;
margin:0;
padding:0;
}
#w3tc-dashboard-widgets .hndle {
height: 36px;
line-height: 36px;
}
#w3tc-dashboard-widgets .hndle,
#w3tc-dashboard-widgets .hndle .w3tc-widget-w3tc-logo,
#w3tc-dashboard-widgets .hndle .w3tc-widget-text {
cursor: default;
}
#w3tc-dashboard-widgets .hndle, #w3tc-dashboard-widgets .hndle span {
font-family: Arial, sans-serif;
font-weight: bold;
@ -19,53 +21,14 @@
-webkit-box-shadow: none;
box-shadow: none;
}
#w3tc-dashboard-widgets #postbox-container-left {
padding: 10px;
margin-right: 200px;
#w3tc-dashboard-widgets #postbox-container {
border: none;
background-color: #fff;
flex-grow: 1;
}
#w3tc-dashboard-widgets #postbox-container-right {
float: none;
}
#w3tc-dashboard-widgets .handlediv {
display: none;
}
#w3tc-dashboard-widgets #postbox-container-3 .postbox .inside,
#w3tc-dashboard-widgets #postbox-container-3 .postbox {
min-width: 165px;
}
#w3tc-dashboard-widgets div.postbox,
#w3tc-dashboard-widgets #postbox-container-3 .hndle,
#w3tc-dashboard-widgets #postbox-container-3 .inside,
#w3tc-dashboard-widgets #postbox-container-3 .meta-box-sortables,
#w3tc-dashboard-widgets #postbox-container-3 .widefat {
background: none;
}
#w3tc-dashboard-widgets #postbox-container-3 .postbox,
#w3tc-dashboard-widgets #postbox-container-3 .hndle,
#w3tc-dashboard-widgets #postbox-container-3 .inside,
#w3tc-dashboard-widgets #postbox-container-3 .meta-box-sortables,
#w3tc-dashboard-widgets #postbox-container-3 .widefat {
border:none;
}
#w3tc-dashboard-widgets {
border-color: #c7c9c8;
background: url(pub/img/sidebar-background.png) repeat-y right;
min-width: 600px;
}
#w3tc-dashboard-widgets #postbox-container-right h3.hndle {
border-bottom:1px solid #d5d2d2;
margin: 5px 10px 0 10px;
padding: 0;
height: 34px;
text-shadow: white 0 1px 0;
-webkit-box-shadow: 0 1px 0 white;
box-shadow: 0 1px 0 white;
}
.w3tc-widget-newrelic-logo {
float: left;
@ -73,9 +36,11 @@
height: 35px;
background: url("pub/img/w3tc_newrelic-logo.png") 0 3px no-repeat;
}
.w3tc-widget-configure {
float: left;
}
.w3tc-widget-text {
float: left;
padding-right: 10px;
@ -110,81 +75,221 @@
margin-right: 10px;
}
#normal-sortables .postbox {
float:left;
margin-right:10px;
.general-settings-container {
padding: 8px 10px;
display: flex;
flex-direction: row;
flex-wrap: wrap;
column-gap: 70px;
row-gap: 10px;
}
.general-settings-container .general-setting {
width: calc(33% - 45px);
border-bottom: 2px solid #F0F0F0;
}
.general-settings-container .general-setting .general-setting-enabled {
float: right;
color: #B9C6CB;
}
.general-settings-container .general-setting .general-setting-enabled.setting-enabled {
color: #006D4B;
}
.general-settings-description {
text-align: center;
}
#w3tc-webp-widget-stats-container,
#w3tc-webp-widget-stats-container table {
width: 100%;
}
#w3tc-webp-widget-stats-container table tr th {
padding: 0 0 18px 0;
}
#w3tc-webp-widget-stats-container table tr td {
padding: 0;
}
.w3tc-webp-widget-stats-title {
text-align: center;
}
.w3tc-webp-widget-stats-stat {
margin: 5px;
}
.w3tc-webp-widget-stats-stat-total,
.w3tc-webp-widget-stats-stat-totalbytes {
max-width: 120px;
text-align: right;
}
#w3tc_page_cache,
#w3tc_object_cache,
#w3tc_database_cache,
#w3tc_imageservice {
display: flex;
flex-direction: column;
justify-content: center;
}
#w3tc_page_cache #page_cache_chart,
#w3tc_object_cache #object_cache_chart,
#w3tc_database_cache #database_cache_chart {
width: 100%;
}
#w3tc_page_cache #page_cache_chart_ad,
#w3tc_page_cache #page_cache_chart_enable,
#w3tc_page_cache #page_cache_chart_subenable,
#w3tc_object_cache #object_cache_chart_ad,
#w3tc_object_cache #object_cache_chart_enable,
#w3tc_object_cache #object_cache_chart_subenable,
#w3tc_database_cache #database_cache_chart_ad,
#w3tc_database_cache #database_cache_chart_enable,
#w3tc_database_cache #database_cache_chart_subenable {
display: flex;
align-items: center;
justify-content: center;
background-size: contain;
background-repeat: no-repeat;
background-position: right;
width: 100%;
height: 100%;
}
#w3tc_page_cache #page_cache_chart_ad,
#w3tc_page_cache #page_cache_chart_enable,
#w3tc_page_cache #page_cache_chart_subenable {
background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)), url("pub/img/w3tc-stats-page-cache.png");
}
#w3tc_object_cache #object_cache_chart_ad,
#w3tc_object_cache #object_cache_chart_enable,
#w3tc_object_cache #object_cache_chart_subenable {
background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)), url("pub/img/w3tc-stats-object-cache.png");
}
#w3tc_database_cache #database_cache_chart_ad,
#w3tc_database_cache #database_cache_chart_enable,
#w3tc_database_cache #database_cache_chart_subenable {
background-image: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)), url("pub/img/w3tc-stats-database-cache.png");
}
#w3tc_page_cache .postbox-header,
#w3tc_object_cache .postbox-header,
#w3tc_database_cache .postbox-header,
#w3tc_imageservice .postbox-header {
flex: 0 0 auto;
}
#w3tc_page_cache .inside,
#w3tc_object_cache .inside,
#w3tc_database_cache .inside,
#w3tc_imageservice .inside {
flex: 1 1 auto;
display: flex;
align-items: center;
justify-content: center;
}
#api_charts {
display: flex;
justify-content: center;
flex-wrap: wrap;
}
#api_charts #apihourly_chart,
#api_charts #apimonthly_chart {
width: 50%;
}
#api_charts #apihourly_chart table tr td > 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;
}
}
*/

View File

@ -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' );

View File

@ -545,6 +545,7 @@ class Generic_Plugin {
array(
'swarmify',
'lazyload',
'removecssjs',
'deferscripts',
'minify',
'newrelic',

View File

@ -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 ) {
?>
<script type="text/javascript">
jQuery( function() {
jQuery('#normal-sortables').masonry( {
itemSelector: '.postbox'
} );
} );
</script>
<?php
}
if ( $this->_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;

View File

@ -1,151 +0,0 @@
<?php
/**
* File: Generic_Plugin_WidgetForumn.php
*
* @package W3TC
*/
namespace W3TC;
/**
* Class: Generic_Plugin_WidgetForum
*/
class Generic_Plugin_WidgetForum {
/**
* Config.
*
* @var Config
*/
private $_config = null; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
/**
* Constructor.
*/
public function __construct() {
$this->_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' );
}
}

View File

@ -1,155 +0,0 @@
<?php
/**
* File: Generic_Plugin_WidgetNews.php
*
* @package W3TC
*/
namespace W3TC;
/**
* Class: Generic_Plugin_WidgetNews
*/
class Generic_Plugin_WidgetNews {
/**
* Config.
*
* @var Config
*/
private $_config = null; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
/**
* Constructor.
*/
public function __construct() {
$this->_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' );
}
}

View File

@ -0,0 +1,58 @@
<?php
/**
* File: Generic_WidgetAccount.php
*
* @package W3TC
*
* @since X.X.X
*/
namespace W3TC;
/**
* Class Generic_WidgetAccount
*
* @since X.X.X
*/
class Generic_WidgetAccount {
/**
* Dashboard setup action
*
* @since X.X.X
*
* @return void
*/
public static function admin_init_w3tc_dashboard() {
$o = new Generic_WidgetAccount();
add_action( 'w3tc_widget_setup', array( $o, 'wp_dashboard_setup' ), 100 );
add_action( 'w3tc_network_dashboard_setup', array( $o, 'wp_dashboard_setup' ), 100 );
}
/**
* W3TC dashboard Premium Services widget.
*
* @since X.X.X
*
* @return void
*/
public function wp_dashboard_setup() {
Util_Widget::add(
'w3tc_account',
'<div class="w3tc-widget-w3tc-logo"></div><div class="w3tc-widget-text">' . __( 'Account', 'w3-total-cache' ) . '</div>',
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';
}
}

View File

@ -0,0 +1,77 @@
<?php
/**
* File: Generic_WidgetAccount_View.php
*
* @package W3TC
*
* @since X.X.X
*/
namespace W3TC;
if ( ! defined( 'W3TC' ) ) {
die();
}
$licensing = new Licensing_Plugin_Admin();
$license_key = $licensing->get_license_key();
$license = Licensing_Core::check_license( $license_key, W3TC_VERSION );
?>
<table>
<tr>
<td><b><?php esc_html_e( 'License:', 'w3-total-cache' ); ?></b></td>
<td><?php echo ! empty( $license ) && $license->license_status === 'active.by_rooturi' ? __( 'Pro', 'w3-total-cache' ) : __( 'Free', 'w3-total-cache' ); ?></td>
</tr>
<tr>
<td><b><?php esc_html_e( 'Status:', 'w3-total-cache' ); ?></b></td>
<td>
<?php
if ( ! empty( $license ) ) {
switch ( $license ) {
case 'active.by_rooturi' === $license->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' );
}
?>
</td>
</tr>
<!--
<tr>
<td><b><?php esc_html_e( 'Renewal Date:', 'w3-total-cache' ); ?></b></td>
<td>TBD</td>
</tr>
-->
</table>
<?php
if ( empty( $license ) || ( ! empty( $license ) && $license->license_status === 'invalid.not_present' ) ) {
?>
<p>
<?php
echo wp_kses(
sprintf(
// Translators: 1 opening HTML strong tag, 2 closing HTML strong tag.
__( 'Upgrade to %1$sW3 Total Cache Pro%2$s now to unlock additional settings and features that can further improve your site\'s performance and Google PageSpeed ratings.', 'w3-total-cache' ),
'<strong>',
'</strong>'
),
array( 'strong' => array() )
);
?>
</p>
<p>
<input type="button" class="button-primary button-buy-plugin" data-src="account_widget" value="<?php esc_attr_e( 'Learn more about Pro', 'w3-total-cache' ); ?>" />
</p>
<?php
}
?>

View File

@ -10,7 +10,7 @@ class Generic_WidgetBoldGrid {
$o = new Generic_WidgetBoldGrid();
Util_Widget::add2( 'w3tc_boldgrid', 5000,
Util_Widget::add2( 'w3tc_boldgrid', 800,
'<div class="w3tc-widget-boldgrid-logo"></div>',
array( $o, 'widget_form' ),
self_admin_url(

View File

@ -1,53 +0,0 @@
<?php
namespace W3TC;
/**
* Class Generic_Plugin_WidgetCommunity.
*
* @since 0.14.3
*/
class Generic_WidgetCommunity {
/**
* Dashboard setup action.
*
* @since 0.14.3
*/
static public function admin_init_w3tc_dashboard() {
// If we're on pro, abort.
if ( Util_Environment::is_w3tc_pro( Dispatcher::config() ) ) {
return;
}
$o = new Generic_WidgetCommunity();
add_action( 'w3tc_widget_setup', array( $o, 'wp_dashboard_setup' ), 1000 );
add_action( 'w3tc_network_dashboard_setup', array( $o, 'wp_dashboard_setup' ), 1000 );
}
/**
* Add our community widget to the dashboard.
*
* @since 0.14.3
*/
function wp_dashboard_setup() {
Util_Widget::add(
'w3tc_community',
'<div class="w3tc-widget-w3tc-logo"></div>' .
'<div class="w3tc-widget-text">' .
__( 'W3TC Community Edition', 'w3-total-cache' ) .
'</div>',
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';
}
}

View File

@ -1,40 +0,0 @@
<?php
namespace W3TC;
if ( !defined( 'W3TC' ) )
die();
?>
<p>
<?php echo wp_kses(
sprintf(
__( 'You\'re using the Community Edition of W3 Total Cache. Maximize your website\'s speed even more by upgrading to %1$sW3 Total Cache Pro%2$s to unlock:', 'w3-total-cache' ),
'<strong>',
'</strong>'
),
array( 'strong' => array() )
); ?>
</p>
<ul class="w3tc-visible-ul">
<li><?php esc_html_e( 'Advanced Analytics', 'w3-total-cache' ); ?></li>
<li><?php esc_html_e( 'Fragment Caching', 'w3-total-cache' ); ?></li>
<li><?php esc_html_e( 'Full Site Delivery', 'w3-total-cache' ); ?></li>
<li><?php esc_html_e( 'Extension Support', 'w3-total-cache' ); ?></li>
</ul>
<p>
<?php echo wp_kses(
sprintf(
__( 'Plus, there\'s even more that allow you to completely fine tune your website\'s performance.', 'w3-total-cache' ),
'<strong>',
'</strong>'
),
array( 'strong' => array() )
); ?>
</p>
<p>
<input type="button" class="button-primary button-buy-plugin" data-src="community_widget"
value="<?php esc_attr_e( 'Learn more about Pro', 'w3-total-cache' ); ?>" />
</p>

View File

@ -0,0 +1,58 @@
<?php
/**
* File: Generic_WidgetPartners.php
*
* @since X.X.X
*
* @package W3TC
*/
namespace W3TC;
/**
* Class Generic_WidgetServices
*
* @since X.X.X
*/
class Generic_WidgetPartners {
/**
* Dashboard setup action
*
* @since X.X.X
*
* @return void
*/
public static function admin_init_w3tc_dashboard() {
$o = new Generic_WidgetPartners();
add_action( 'w3tc_widget_setup', array( $o, 'wp_dashboard_setup' ), 290 );
add_action( 'w3tc_network_dashboard_setup', array( $o, 'wp_dashboard_setup' ), 290 );
}
/**
* W3TC dashboard Premium Services widget.
*
* @since X.X.X
*
* @return void
*/
public function wp_dashboard_setup() {
Util_Widget::add(
'w3tc_partners',
'<div class="w3tc-widget-w3tc-logo"></div><div class="w3tc-widget-text">' . __( 'Setup Guides from Partner Hosts', 'w3-total-cache' ) . '</div>',
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';
}
}

View File

@ -0,0 +1,37 @@
<?php
/**
* File: Generic_WidgetPartners_View.php
*
* @since X.X.X
*
* @package W3TC
*/
namespace W3TC;
if ( ! defined( 'W3TC' ) ) {
die();
}
?>
<p><?php esc_html_e( 'Our Partner Hosts have supplied rich tutorials that can help you run faster on ', 'w3-total-cache' ) . 'W3 Total Cache:'; ?></p>
<ul id="partner-list">
<li>
<span class="partner-logo"><img src="<?php echo esc_url( plugins_url( 'w3-total-cache/pub/img/imh.png' ) ); ?>" width="25"></span>
<a href="<?php echo esc_url( W3TC_PARTNER_IMH ); ?>" target="_blank">InMotion Hosting</a>
</li>
<li>
<span class="partner-logo"><img src="<?php echo esc_url( plugins_url( 'w3-total-cache/pub/img/a2.png' ) ); ?>" width="25"></span>
<a href="<?php echo esc_url( W3TC_PARTNER_A2 ); ?>" target="_blank">A2 Hosting</a>
</li>
<li>
<span class="partner-logo"><img src="<?php echo esc_url( plugins_url( 'w3-total-cache/pub/img/convesio.png' ) ); ?>" width="25"></span>
<a href="<?php echo esc_url( W3TC_PARTNER_CONVESIO ); ?>" target="_blank">Convesio</a>
</li>
<li>
<span class="partner-logo"><img src="<?php echo esc_url( plugins_url( 'w3-total-cache/pub/img/dreamhost.png' ) ); ?>" width="25"></span>
<a href="<?php echo esc_url( W3TC_PARTNER_DREAMHOST ); ?>" target="_blank">Dreamhost</a>
</li>
</ul>
<p><?php esc_html_e( 'Shopping around for better hosting? Checkout our', 'w3-total-cache' ); ?> <a href="<?php echo esc_url( 'https://www.boldgrid.com/wordpress-hosting/' ); ?>" target="_blank"><?php esc_html_e( 'WordPress Hosting Recommendations', 'w3-total-cache' ); ?></a></p>
<hr>
<p id="partner-bottom"><a href="mailto: partners@boldgrid.com"><?php esc_html_e( 'Are you a host', 'w3-total-cache' ); ?>?</a></p>

View File

@ -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 );
}
/**

View File

@ -0,0 +1,56 @@
<?php
/**
* File: Generic_WidgetSettings.php
*
* @package W3TC
*
* @since X.X.X
*/
namespace W3TC;
/**
* Class Generic_WidgetSettings
*/
class Generic_WidgetSettings {
/**
* Dashboard setup action
*
* @since X.X.X
*
* @return void
*/
public static function admin_init_w3tc_dashboard() {
$o = new Generic_WidgetSettings();
add_action( 'w3tc_widget_setup', array( $o, 'wp_dashboard_setup' ), 200 );
add_action( 'w3tc_network_dashboard_setup', array( $o, 'wp_dashboard_setup' ), 200 );
}
/**
* W3TC dashboard Premium Services widget.
*
* @since X.X.X
*
* @return void
*/
public function wp_dashboard_setup() {
Util_Widget::add(
'w3tc_settings',
'<div class="w3tc-widget-w3tc-logo"></div><div class="w3tc-widget-text">' . __( 'General Settings', 'w3-total-cache' ) . '</div>',
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';
}
}

View File

@ -0,0 +1,98 @@
<?php
/**
* File: Generic_WidgetSettings_View.php
*
* @package W3TC
*
* @since X.X.X
*/
namespace W3TC;
if ( ! defined( 'W3TC' ) ) {
die();
}
$config = Dispatcher::config();
$settings = array(
'preview_mode' => 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' ),
),
);
?>
<div class="general-settings-container">
<?php
$enabled = esc_html__( 'enabled', 'w3-total-cache' );
$disabled = esc_html__( 'disabled', 'w3-total-cache' );
foreach ( $settings as $setting ) {
?>
<div class="general-setting">
<span><b><?php echo $setting['label']; ?></b></span>
<span class="general-setting-enabled<?php echo $setting['enabled'] ? ' setting-enabled' : ''; ?>">
<?php echo $setting['enabled'] ? $enabled : $disabled; ?>
</span>
</div>
<?php
}
?>
</div>
<p class="general-settings-description">
<?php esc_html_e( 'Settings can be modified by visiting ', 'w3-total-cache' ); ?><a href="<?php echo esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_general' ) ); ?>" alt="General Settings"><?php esc_html_e( 'General Settings', 'w3-total-cache' ); ?></a>
</p>

View File

@ -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 {
'</div>',
array( $this, 'widget_form' ),
null,
'normal' );
'bottom' );
}
function widget_form() {

View File

@ -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<data.history.length; i++){
var entry = data.history[i];
var timestamp = dateFormat(new Date(parseInt(entry.timestamp_start) * 1000));
processed_data['page_cache']['data'].push([timestamp,Number(entry.php_requests_pagecache_hit)]);
processed_data['object_cache']['data'].push([timestamp,Number(entry.objectcache_get_hits)]);
processed_data['database_cache']['data'].push([timestamp,Number(entry.dbcache_calls_hits)]);
}
return processed_data;
}
// Draws the stats charts.
/**
* @param {array} data - Preprocessed statistics data.
*/
function draw_charts(data){
for ( var key in data ) {
var chart_data = google.visualization.arrayToDataTable(data[key]['data'],true);
var chart_options = {
series:{0:{color:data[key]['color']}},
legend:{position:'none'},
};
if(document.getElementById(key + '_chart')){
var chart = new google.charts.Line(document.getElementById(key + '_chart'));
chart.draw(chart_data, chart_options);
}
};
}
// 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);
}
// Time since last refresh.
var seconds_timer_id;
// Interval for the stats 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);
}
});

View File

@ -0,0 +1,170 @@
<?php
/**
* File: Generic_WidgetStats.php
*
* @since X.X.X
*
* @package W3TC
*/
namespace W3TC;
/**
* Class Generic_WidgetStats
*/
class Generic_WidgetStats {
/**
* Dashboard setup action
*
* @since X.X.X
*
* @return void
*/
public static function admin_init_w3tc_dashboard() {
$o = new Generic_WidgetStats();
add_action( 'w3tc_widget_setup', array( $o, 'wp_dashboard_setup' ), 700 );
add_action( 'w3tc_network_dashboard_setup', array( $o, 'wp_dashboard_setup' ), 700 );
wp_enqueue_script( 'w3tc-dashboard', plugins_url( 'pub/js/google-charts.js', W3TC_FILE ), array(), W3TC_VERSION, true );
wp_enqueue_script( 'w3tc-stats-widget', plugins_url( 'Generic_WidgetStats.js', W3TC_FILE ), array(), W3TC_VERSION, true );
}
/**
* W3TC dashboard Stats widgets.
*
* @since X.X.X
*
* @return void
*/
public function wp_dashboard_setup() {
Util_Widget::add(
'w3tc_page_cache',
'<div class="w3tc-widget-w3tc-logo"></div><div class="w3tc-widget-text">' . __( 'Page Cache: Hits', 'w3-total-cache' ) . '</div>',
array( $this, 'page_cache_widget_form' ),
null,
'normal'
);
Util_Widget::add(
'w3tc_object_cache',
'<div class="w3tc-widget-w3tc-logo"></div><div class="w3tc-widget-text">' . __( 'Object Cache: Hits', 'w3-total-cache' ) . '</div>',
array( $this, 'object_cache_widget_form' ),
null,
'normal'
);
Util_Widget::add(
'w3tc_database_cache',
'<div class="w3tc-widget-w3tc-logo"></div><div class="w3tc-widget-text">' . __( 'Database Cache: Hits', 'w3-total-cache' ) . '</div>',
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 = '<input type="button" class="button-primary button-buy-plugin {nonce: \'' . esc_attr( wp_create_nonce( 'w3tc' ) ) . '\'}" data-src="' . $chart_id . '_cache_chart" value="' . esc_html__( 'Unlock Feature', 'w3-total-cache' ) . '" />';
} 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 '<div id="' . $chart_id . '">' . $chart_content . '</div>';
}
/**
* 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(),
),
);
}
}

View File

@ -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 ) {

View File

@ -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();
}
});
}

View File

@ -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;
}

View File

@ -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'];
}
}

View File

@ -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',
),
),

View File

@ -271,9 +271,6 @@ class PageSpeed_Instructions {
$allowed_tags
) . '</p>',
),
'preload-lcp-image' => array(
'instructions' => '<p>' . esc_html__( 'Enable lazy load for images.', 'w3-total-cache' ) . '</p>',
),
'total-byte-weight' => array(
'instructions' =>
'<p>' . sprintf(
@ -507,16 +504,6 @@ class PageSpeed_Instructions {
<br/>
<p>' . 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' ) . '</p>',
),
'first-contentful-paint-3g' => array(
'instructions' =>
'<p>' . esc_html__( 'Enable Page Cache using the fastest engine.', 'w3-total-cache' ) . '</p>
<p>' . esc_html__( 'What it represents: How much is visible at a time during load.', 'w3-total-cache' ) . '</p>
<p>' . esc_html__( 'Lighthouse Performance score weighting: 10%', 'w3-total-cache' ) . '</p>
<p>' . esc_html__( 'What it measures: The Speed Index is the average time at which visible parts of the page are displayed.', 'w3-total-cache' ) . '</p>
<p>' . esc_html__( 'How it\'s measured: Lighthouse\'s Speed Index measurement comes from a node module called Speedline.', 'w3-total-cache' ) . '</p>
<p>' . 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' ) . '</p>
<p>' . 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' ) . '</p>',
),
'uses-long-cache-ttl' => array(
'instructions' =>
'<p>' . sprintf(
@ -534,16 +521,6 @@ class PageSpeed_Instructions {
'critical-request-chains' => array(
'instructions' => '<p>' . 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' ) . '</p>',
),
'resource-summary' => array(
'instructions' =>
'<p>Actions that can help:</p>
<ul>
<li>' . esc_html__( 'Avoid multiple page redirects.', 'w3-total-cache' ) . '</li>
<li>' . esc_html__( 'Combine images using CSS sprites.', 'w3-total-cache' ) . '</li>
<li>' . esc_html__( 'Remove unnecessary third-party scripts.', 'w3-total-cache' ) . '</li>
<li>' . esc_html__( 'Compress your text resources.', 'w3-total-cache' ) . '</li>
</ul>',
),
'largest-contentful-paint-element' => array(
'instructions' =>
'<p>' . esc_html__( 'How To Fix Poor LCP', 'w3-total-cache' ) . '</p>
@ -571,6 +548,7 @@ class PageSpeed_Instructions {
<ul>
<li>' . esc_html__( 'Optimize and compress images.', 'w3-total-cache' ) . '</li>
<li>' . esc_html__( 'Preload important resources.', 'w3-total-cache' ) . '</li>
<li>' . esc_html__( 'Disable "lazy loading" for assets immediately visible on page load.', 'w3-total-cache' ) . '</li>
<li>' . esc_html__( 'Compress text files.', 'w3-total-cache' ) . '</li>
<li>' . esc_html__( 'Deliver different assets based on the network connection (adaptive serving).', 'w3-total-cache' ) . '</li>
<li>' . esc_html__( 'Cache assets using a service worker.', 'w3-total-cache' ) . '</li>
@ -588,6 +566,7 @@ class PageSpeed_Instructions {
<li><a target="_blank" href="' . esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_general#page_cache' ) ) . '" alt="' . esc_attr__( 'Page Cache', 'w3-total-cache' ) . '">' . esc_html__( 'Page Cache', 'w3-total-cache' ) . '</a></li>
<li><a target="_blank" href="' . esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_general#browser_cache' ) ) . '" alt="' . esc_attr__( 'Browser Cache', 'w3-total-cache' ) . '">' . esc_html__( 'Browser Cache', 'w3-total-cache' ) . '</a></li>
<li><a target="_blank" href="' . esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_general#cdn' ) ) . '" alt="' . esc_attr__( 'CDN', 'w3-total-cache' ) . '">' . esc_html__( 'CDN', 'w3-total-cache' ) . '</a></li>
<li><a target="_blank" href="' . esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_general#userexperience' ) ) . '" alt="' . esc_attr__( 'Preload Requests', 'w3-total-cache' ) . '">' . esc_html__( 'Preload Requests', 'w3-total-cache' ) . '</a></li>
</ul>',
),
'layout-shift-elements' => array(

View File

@ -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' );
}
}

View File

@ -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, youll first need to authorize access. Please click %1$s.',
'w3-total-cache'
),
'<a href="' . esc_url( Util_Ui::admin_url( 'admin.php?page=w3tc_general#google_pagespeed' ) ) . '" target="_blank">' . esc_html__( 'here', 'w3-total-cache' ) . '</a>'
),
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' );
}
}

View File

@ -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;
}
}

View File

@ -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);

View File

@ -75,12 +75,12 @@ if ( ! defined( 'W3TC' ) ) {
</div>
<div id="w3tcps_widget_metrics_container" class="tab-content w3tcps_content">
<div class="w3tcps_widget_metrics">
<?php Util_PageSpeed::print_bar_combined_with_icon( $api_response, 'first-contentful-paint', 'First Contentful Paint' ); ?>
<?php Util_PageSpeed::print_bar_combined_with_icon( $api_response, 'speed-index', 'Speed Index' ); ?>
<?php Util_PageSpeed::print_bar_combined_with_icon( $api_response, 'largest-contentful-paint', 'Largest Contentful Paint' ); ?>
<?php Util_PageSpeed::print_bar_combined_with_icon( $api_response, 'interactive', 'Time to Interactive' ); ?>
<?php Util_PageSpeed::print_bar_combined_with_icon( $api_response, 'total-blocking-time', 'Total Blocking Time' ); ?>
<?php Util_PageSpeed::print_bar_combined_with_icon( $api_response, 'cumulative-layout-shift', 'Cumulative Layout Shift' ); ?>
<?php Util_PageSpeed::print_bar_combined_with_icon( $api_response, 'first-contentful-paint', 'First Contentful Paint', true ); ?>
<?php Util_PageSpeed::print_bar_combined_with_icon( $api_response, 'speed-index', 'Speed Index', true ); ?>
<?php Util_PageSpeed::print_bar_combined_with_icon( $api_response, 'largest-contentful-paint', 'Largest Contentful Paint', true ); ?>
<?php Util_PageSpeed::print_bar_combined_with_icon( $api_response, 'interactive', 'Time to Interactive', true ); ?>
<?php Util_PageSpeed::print_bar_combined_with_icon( $api_response, 'total-blocking-time', 'Total Blocking Time', true ); ?>
<?php Util_PageSpeed::print_bar_combined_with_icon( $api_response, 'cumulative-layout-shift', 'Cumulative Layout Shift', true ); ?>
</div>
</div>
<?php

View File

@ -85,8 +85,6 @@ class Root_Loader {
$plugins[] = new PgCache_Plugin_Admin();
$plugins[] = new Minify_Plugin_Admin();
$plugins[] = new Generic_WidgetSpreadTheWord_Plugin();
$plugins[] = new Generic_Plugin_WidgetNews();
$plugins[] = new Generic_Plugin_WidgetForum();
$plugins[] = new SystemOpCache_Plugin_Admin();
$plugins[] = new Cdn_Plugin_Admin();
@ -96,10 +94,7 @@ class Root_Loader {
$plugins[] = new PageSpeed_Api();
$plugins[] = new PageSpeed_Page();
if ( $c->get_boolean( 'widget.pagespeed.enabled' ) ) {
$plugins[] = new PageSpeed_Widget();
}
$plugins[] = new PageSpeed_Widget();
$plugins[] = new Generic_Plugin_AdminCompatibility();
$plugins[] = new Licensing_Plugin_Admin();

View File

@ -159,7 +159,7 @@ class UsageStatistics_Page {
public function summary_item( $id, $name, $checked = false, $extra_class = '', $column_background = '', $link_key = '' ) {
echo '<div class="ustats_' . esc_attr( $id ) . ' ' . esc_attr( $extra_class ) . '">\n';
echo '<div class="ustats_' . esc_attr( $id ) . ' ' . esc_attr( $extra_class ) . '"><br />';
echo '<label>';
echo '<input type="checkbox" name="' . esc_attr( 'w3tcus_chart_check_' . $id ) . '" data-name="' .
esc_attr( $name ) . '" data-column="' . esc_attr( $id ) . '" ';
@ -172,11 +172,12 @@ class UsageStatistics_Page {
checked( $checked );
echo ' />';
if ( ! empty( $link_key ) ) {
echo '<a href="' . esc_url( 'admin.php?page=w3tc_stats&view=pagecache_requests&status=' . rawurlencode( $link_key ) . '&status_name=' . rawurlencode( $name ) ) . '">$name</a>';
echo '<a href="' . esc_url( 'admin.php?page=w3tc_stats&view=pagecache_requests&status=' . rawurlencode( $link_key ) .
'&status_name=' . rawurlencode( $name ) ) . '">' . esc_html( $name ) . '</a>';
} else {
echo esc_html( $name );
}
echo ": <span></span>\n";
echo ': <span></span><br />';
echo '</label>';
echo '</div>';

View File

@ -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'

View File

@ -1,55 +0,0 @@
<?php
namespace W3TC;
/**
* widget with stats
*/
class UsageStatistics_Widget {
static private function enabled() {
static $_enabled = null;
if ( is_null( $_enabled ) ) {
$c = Dispatcher::config();
$_enabled = ( $c->get_boolean( 'stats.enabled' ) &&
Util_Environment::is_w3tc_pro( $c ) );
}
return $_enabled;
}
public function init() {
Util_Widget::add2( 'w3tc_usage_statistics', 1000,
'<div class="w3tc-widget-w3tc-logo"></div>' .
'<div class="w3tc-widget-text">' .
__( 'Caching Statistics', 'w3-total-cache' ) .
'</div>',
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';
}
}
}

View File

@ -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();
});

View File

@ -1,55 +0,0 @@
<?php
/**
* File: UsageStatistics_Widget_View.php
*
* @package W3TC
*/
namespace W3TC;
if ( ! defined( 'W3TC' ) ) {
die();
}
?>
<style>
#w3tc_usage_statistics:hover .edit-box {
opacity: 1;
}
.w3tcuw_sizes {
display: flex;
width: 100%;
padding-bottom: 10px;
}
.w3tcuw_name {
font-weight: bold;
}
.w3tcuw_size_item {
flex: 1;
text-align: center;
display: none;
}
</style>
<div>
<?php esc_html_e( 'Hit rate', 'w3-total-cache' ); ?>
<div style="width: 100%; height: 200px">
<canvas id="w3tcuw_chart"></canvas>
</div>
</div>
<div class="w3tcuw_sizes">
<div class="w3tcuw_size_item w3tcuw_memcached_size_percent">
<div class="w3tcuw_name"><?php esc_html_e( 'Memcached Usage', 'w3-total-cache' ); ?></div>
<div class="w3tcuw_value"></div>
</div>
<div class="w3tcuw_size_item w3tcuw_redis_size_percent">
<div class="w3tcuw_name"><?php esc_html_e( 'Redis Usage', 'w3-total-cache' ); ?></div>
<div class="w3tcuw_value"></div>
</div>
<div class="w3tcuw_size_item w3tcuw_apc_size_percent">
<div class="w3tcuw_name"><?php esc_html_e( 'APC Usage', 'w3-total-cache' ); ?></div>
<div class="w3tcuw_value"></div>
</div>
</div>

View File

@ -1,37 +0,0 @@
<?php
namespace W3TC;
if ( ! defined( 'W3TC' ) ) {
die();
}
?>
<style>
.w3tcuw_inactive {
height: 242px;
background: url("<?php echo esc_url( plugins_url( 'pub/img/usage-statistics-widget.png', W3TC_FILE ) ); ?>");
background-repeat: no-repeat;
background-size: cover;
}
.w3tcuw_inactive input, .w3tcuw_inactive a {
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.w3tcuw_inactive input, .w3tcuw_inactive span {
background: #fff;
}
</style>
<p class="w3tcuw_inactive">
<?php if ( ! Util_Environment::is_w3tc_pro( Dispatcher::config() ) ) : ?>
<input type="button" class="button-primary button-buy-plugin {nonce: '<?php echo esc_attr( wp_create_nonce( 'w3tc' ) ); ?>'}"
data-src="usagestatistics_widget" value="<?php esc_html_e( 'Upgrade to Pro', 'w3-total-cache' ); ?>" />
<?php else : ?>
<a href="admin.php?page=w3tc_general#stats" class="button-primary">Enable</a>
<?php endif ?>
</p>

View File

@ -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';
}
}

View File

@ -22,7 +22,7 @@ if ( is_null( $c->get( array( 'user-experience-defer-scripts', 'timeout' ) ) ) )
}
?>
<?php Util_Ui::postbox_header( esc_html__( 'Delay Scripts', 'w3-total-cache' ), '', 'application' ); ?>
<?php Util_Ui::postbox_header( esc_html__( 'Delay Scripts', 'w3-total-cache' ), '', 'defer-scripts' ); ?>
<p><?php esc_html_e( 'For best results it is recommended to enable the Minify feature to optimize internal sources and to then use this feature to handle external sources and/or any internal sources excluded from Minify.', 'w3-total-cache' ); ?></p>
<p>
<?php

View File

@ -101,7 +101,40 @@ Util_Ui::config_overloading_button( array( 'key' => 'lazyload.configuration_over
' Settings can be found on the %1$sUser Experience page%2$s.',
'w3-total-cache'
),
'<a href="' . Util_Ui::admin_url( 'admin.php?page=w3tc_userexperience#application' ) . '">',
'<a href="' . Util_Ui::admin_url( 'admin.php?page=w3tc_userexperience#defer-scripts' ) . '">',
'</a>'
),
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'
),
'<a href="' . Util_Ui::admin_url( 'admin.php?page=w3tc_userexperience#remove-cssjs' ) . '">',
'</a>'
),
array(

View File

@ -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;
}

View File

@ -3,7 +3,7 @@ namespace W3TC;
class UserExperience_LazyLoad_Mutator_Unmutable {
private $placeholders = array();
private $placeholder_base = '';
public function __construct() {

View File

@ -1,6 +1,15 @@
<?php
/**
* File: UserExperience_Plugin_Admin.php
*
* @package W3TC
*/
namespace W3TC;
/**
* UserExperience Plugin Admin.
*/
class UserExperience_Plugin_Admin {
/**
* Runs the user experience feature.
@ -17,7 +26,7 @@ class UserExperience_Plugin_Admin {
/**
* Set user experience admin menu item.
*
* @param array $menu
* @param array $menu Menu array.
*
* @return array
*/
@ -35,13 +44,13 @@ class UserExperience_Plugin_Admin {
/**
* Configures extensions for user experience.
*
* @param array $extensions
* @param object $config
* @param array $extensions Extensions array.
* @param object $config Config object.
*
* @return array
*/
public static function w3tc_extensions( $extensions, $config ) {
$extensions['user-experience-defer-scripts'] = array(
$extensions['user-experience-defer-scripts'] = array(
'public' => 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',

View File

@ -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 '<link rel="preconnect" href="' . esc_url( $url ) . '" crossorigin>';
}
$dns_prefetch = $this->config->get_array( array( 'user-experience-preload-requests', 'dns-prefetch' ) );
foreach ( $dns_prefetch as $url ) {
echo '<link rel="dns-prefetch" href="' . esc_url( $url ) . '">';

View File

@ -24,77 +24,86 @@ if ( ! defined( 'W3TC' ) ) {
<?php
Util_Ui::config_item(
array(
'key' => 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' => '<a class="w3tc-control-after" target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/preload-requests#dns-prefetch-domains' ) . '">' . esc_html__( 'Learn more', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
'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' => '<a class="w3tc-control-after" target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/preload-requests#preconnect-domains' ) . '">' . esc_html__( 'Learn more', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
'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' => '<a class="w3tc-control-after" target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/preload-requests#preload' ) . '">' . esc_html__( 'Learn more', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
'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' => '<a class="w3tc-control-after" target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/preload-requests#preload' ) . '">' . esc_html__( 'Learn more', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
'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' => '<a class="w3tc-control-after" target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/preload-requests#preload' ) . '">' . esc_html__( 'Learn more', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
'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' => '<a class="w3tc-control-after" target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/preload-requests#preload' ) . '">' . esc_html__( 'Learn more', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
'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' => '<a class="w3tc-control-after" target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/preload-requests#preload' ) . '">' . esc_html__( 'Learn more', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
'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' => '<a class="w3tc-control-after" target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/preload-requests#preload' ) . '">' . esc_html__( 'Learn more', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
'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' => '<a class="w3tc-control-after" target="_blank" href="' . esc_url( 'https://www.boldgrid.com/support/w3-total-cache/preload-requests#preload' ) . '">' . esc_html__( 'Learn more', 'w3-total-cache' ) . '<span class="dashicons dashicons-external"></span></a>',
'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' ),
)
);
?>

View File

@ -0,0 +1,254 @@
<?php
/**
* File: UserExperience_Remove_CssJs_Extension.php
*
* Controls the Remove CSS/JS feature.
*
* @since 2.7.0
*
* @package W3TC
*/
namespace W3TC;
/**
* UserExperience Remove Css/Js Extension.
*
* @since 2.7.0
*/
class UserExperience_Remove_CssJs_Extension {
/**
* Config.
*
* @var object
*/
private $config;
/**
* Mutator.
*
* @var object
*/
private $mutator;
/**
* User Experience Remove Css/Js constructor.
*
* @since 2.7.0
*/
public function __construct() {
$this->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();

Some files were not shown because too many files have changed in this diff Show More