From e1556ecd1fbd5baf3be94502bf46eb522a3a71b8 Mon Sep 17 00:00:00 2001 From: Jacob Dunn <88040916+jacobd91@users.noreply.github.com> Date: Thu, 16 Jan 2025 15:33:12 -0500 Subject: [PATCH] WebP Pro Upgrade Notice (#1033) * Add a notice to the WebP widget indicating that upgrading to Pro offers additional limits * Fix limit gauges so they yellow/red show properly * Fixed Pro hourly limit widget showing the wrong limit --- Extension_ImageService_Widget.js | 18 +++++++++--------- Extension_ImageService_Widget.php | 7 ++++++- Extension_ImageService_Widget_View.php | 6 ++++++ 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Extension_ImageService_Widget.js b/Extension_ImageService_Widget.js index 073fdc343..287fb758d 100644 --- a/Extension_ImageService_Widget.js +++ b/Extension_ImageService_Widget.js @@ -97,18 +97,18 @@ jQuery( document ).ready( 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; + if ( data[key]['limit'] > 10 && data[key]['limit'] <= 100 ) { + yellow_from = data[key]['limit'] - 40; + yellow_to = data[key]['limit'] - 10; + red_from = data[key]['limit'] - 10; + } else if ( data[key]['limit'] > 100 ) { + yellow_from = data[key]['limit'] - 4000; 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; + yellow_from = data[key]['limit'] - 4; + yellow_to = data[key]['limit'] - 1; + red_from = data[key]['limit'] - 1; } var chart_options = { diff --git a/Extension_ImageService_Widget.php b/Extension_ImageService_Widget.php index f21d2cc00..1c4fcb198 100644 --- a/Extension_ImageService_Widget.php +++ b/Extension_ImageService_Widget.php @@ -52,7 +52,12 @@ public static function admin_init_w3tc_dashboard() { // 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 ); + + if ( $is_pro ) { + $usage['limit_hourly'] = 'Unknown' !== $usage['limit_hourly_licensed'] ? $usage['limit_hourly_licensed'] : 10000; + } else { + $usage['limit_hourly'] = 'Unknown' !== $usage['limit_hourly'] ? $usage['limit_hourly'] : 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. diff --git a/Extension_ImageService_Widget_View.php b/Extension_ImageService_Widget_View.php index 071a0edf2..b2234c45b 100644 --- a/Extension_ImageService_Widget_View.php +++ b/Extension_ImageService_Widget_View.php @@ -22,6 +22,12 @@
+ +