Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
834e12c
Init onboarding
tijmenbruggeman Aug 25, 2026
858e248
onboarding scaffolding
tijmenbruggeman Aug 27, 2026
57eda31
format
tijmenbruggeman Aug 27, 2026
20e0221
use onboarding flag
tijmenbruggeman Aug 27, 2026
fccfe39
transport to step 2 on api key registration
tijmenbruggeman Aug 27, 2026
c0860e0
onboarding
tijmenbruggeman Sep 1, 2026
873a844
simplify menu registration
tijmenbruggeman Sep 8, 2026
e7cdf57
update dashboard widget
tijmenbruggeman Sep 23, 2026
07a033d
refactor ui for dashboard widget
tijmenbruggeman Sep 23, 2026
90b3175
fix tests
tijmenbruggeman Sep 23, 2026
a612785
Use plugin version
tijmenbruggeman Sep 23, 2026
5a64197
fix empty label
tijmenbruggeman Sep 23, 2026
db7470b
simplify pay state
tijmenbruggeman Sep 23, 2026
4bf80a7
resolve e2e tests
tijmenbruggeman Sep 23, 2026
eb3edbc
format
tijmenbruggeman Sep 23, 2026
41d6570
feat: update texts
tijmenbruggeman Sep 29, 2026
2210523
set guard to only allow dashboard widget for users that can upload
tijmenbruggeman Oct 6, 2026
33fdc86
convert to private funcs
tijmenbruggeman Oct 6, 2026
5d3035a
use settings get pay state
tijmenbruggeman Oct 6, 2026
3a4846a
remove unused action and method
tijmenbruggeman Oct 6, 2026
c63df81
remove default valeus
tijmenbruggeman Oct 6, 2026
da29255
format and tests
tijmenbruggeman Oct 6, 2026
1b50e80
read credits and api key from settings in widget data
tijmenbruggeman Oct 6, 2026
da613b8
formatting
tijmenbruggeman Oct 6, 2026
a58f8a4
add doc
tijmenbruggeman Oct 6, 2026
f14c406
Merge branch 'master' of github.com:wcreateweb/wordpress-plugin into …
tijmenbruggeman Oct 6, 2026
eef72c8
add media assets
tijmenbruggeman Oct 12, 2026
c2b2694
UI for onboarding
tijmenbruggeman Oct 12, 2026
4b470d1
phpcs
tijmenbruggeman Oct 12, 2026
6a53d2f
use css variables
tijmenbruggeman Oct 12, 2026
c32287c
do not redirect on admin_init
tijmenbruggeman Oct 13, 2026
aeafc66
reuse rendering for modern formats
tijmenbruggeman Oct 13, 2026
1b2ec35
Merge branch 'master' of github.com:wcreateweb/wordpress-plugin into …
tijmenbruggeman Oct 19, 2026
90595ef
feat: refresh pending api key status in settings
tijmenbruggeman Oct 19, 2026
f500f6f
feat: store when a bulk run started
tijmenbruggeman Oct 19, 2026
e52ab1a
feat: redesign dashboard widget
tijmenbruggeman Oct 19, 2026
d2efee3
style: lighten the widget badge
tijmenbruggeman Oct 19, 2026
2b7091d
refactor: remove dashboard widget polling
tijmenbruggeman Oct 19, 2026
99c77e7
test: allow 15s for the background run
tijmenbruggeman Oct 19, 2026
bcaa6a1
style: slide between the widget views
tijmenbruggeman Oct 19, 2026
38258fb
simplify timeleft calculation
tijmenbruggeman Oct 20, 2026
7a34a89
css tuning
tijmenbruggeman Oct 20, 2026
8cec312
show auto compress when option is enabled
tijmenbruggeman Oct 20, 2026
9b52a85
PR fixes
tijmenbruggeman Oct 20, 2026
5cf9781
translation
tijmenbruggeman Oct 20, 2026
745e330
time_left to seconds_left
tijmenbruggeman Oct 20, 2026
c847cc1
fix: require a nonce to start the bulk run from the widget
tijmenbruggeman Oct 20, 2026
0a02b15
load widget async
tijmenbruggeman Oct 20, 2026
72014b6
show buttons conditionally
tijmenbruggeman Oct 20, 2026
77d56b1
remove unused state
tijmenbruggeman Oct 20, 2026
c211b55
cleanup
tijmenbruggeman Oct 20, 2026
718c377
hide notice when autostart
tijmenbruggeman Oct 20, 2026
f0695b7
hide trigger when autostart
tijmenbruggeman Oct 20, 2026
bb309d7
speed up tests
tijmenbruggeman Oct 20, 2026
d7d0894
Settings Page UI
tijmenbruggeman Oct 23, 2026
337bc19
refactor step rendering
tijmenbruggeman Oct 23, 2026
071c11b
convert arrow func to plain func
tijmenbruggeman Oct 23, 2026
b776b56
redirect after activation
tijmenbruggeman Oct 23, 2026
4cc6f5f
show 2 steps when connecting with an api key
tijmenbruggeman Oct 23, 2026
9b5d071
is_api_key_pending will show when key is actually valid
tijmenbruggeman Oct 23, 2026
adb9fbd
keep the three compression timing options
tijmenbruggeman Oct 23, 2026
69386ad
Move tinify link to account card
tijmenbruggeman Oct 26, 2026
8120dc1
Merge branch 'tiny-onboarding' into feat/bulk-page-redesign
tijmenbruggeman Oct 26, 2026
ffbf374
Merge branch 'feat/dashboard-widget' into feat/bulk-page-redesign
tijmenbruggeman Oct 26, 2026
82871e8
bulk optimization UI
tijmenbruggeman Oct 27, 2026
fe44417
Merge branch 'master' of github.com:wcreateweb/wordpress-plugin into …
tijmenbruggeman Nov 6, 2026
5da248d
divide by zero fix
tijmenbruggeman Nov 6, 2026
6d93798
simplify rendering
tijmenbruggeman Nov 6, 2026
828a430
fix translations
tijmenbruggeman Nov 6, 2026
c02d2c5
refactor
tijmenbruggeman Nov 7, 2026
66439cb
stop polling on 5 consecutive failures
tijmenbruggeman Nov 7, 2026
64bb2f0
remove unused strong and stats
tijmenbruggeman Nov 7, 2026
0e8e855
cleanup unused stats
tijmenbruggeman Nov 7, 2026
fe522ca
render bulk rows in php
tijmenbruggeman Nov 9, 2026
da83bce
leave out thumbnails
tijmenbruggeman Nov 10, 2026
7326a49
share state badges and pandas between widget and bulk page
tijmenbruggeman Nov 10, 2026
45ee6ba
look up the badge and panda per state
tijmenbruggeman Nov 10, 2026
6a8d29d
keep the average saving dash without a library size
tijmenbruggeman Nov 10, 2026
ac8fd56
write the average saving dash with a ternary
tijmenbruggeman Nov 10, 2026
bee5f84
aria attributes
tijmenbruggeman Nov 10, 2026
cbced07
typos
tijmenbruggeman Nov 10, 2026
f586754
resolve rtl issues
tijmenbruggeman Nov 10, 2026
45eafeb
count partly failed savings and skip images outside the run
tijmenbruggeman Nov 10, 2026
dd524a4
fix mock issue
tijmenbruggeman Nov 10, 2026
fda71f7
format bulk page numbers in the user's admin language
tijmenbruggeman Nov 11, 2026
7725710
bool to show change api key
tijmenbruggeman Nov 13, 2026
40e9764
footercard not bold
tijmenbruggeman Nov 13, 2026
18d0026
show upgrade options in bulk page
tijmenbruggeman Nov 13, 2026
64cff2a
Merge branch 'master' of github.com:wcreateweb/wordpress-plugin into …
tijmenbruggeman Nov 13, 2026
e43007b
adjust jxl test
tijmenbruggeman Nov 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 25 additions & 13 deletions src/class-tiny-bulk-optimization.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@ class Tiny_Bulk_Optimization {
const PAGING_SIZE = 25000;

public static function get_optimization_statistics( $settings, $result = null ) {
$stats = array();
$stats['uploaded-images'] = 0;
$stats['optimized-image-sizes'] = 0;
$stats['available-unoptimized-sizes'] = 0;
$stats['optimized-library-size'] = 0;
$stats['unoptimized-library-size'] = 0;
$stats['estimated_credit_use'] = 0;
$stats['available-for-optimization'] = array();
$stats = array();
$stats['uploaded-images'] = 0;
$stats['optimized-library-size'] = 0;
$stats['unoptimized-library-size'] = 0;
$stats['estimated_credit_use'] = 0;
$stats['available-for-optimization'] = array();

if ( is_null( $result ) ) {
$last_image_id = null;
Expand Down Expand Up @@ -127,11 +125,9 @@ private static function populate_optimization_statistics( $settings, $result, $s
$image_stats = $tiny_image->get_statistics( $active_sizes, $active_tinify_sizes );

++$stats['uploaded-images'];
$stats['estimated_credit_use'] += $image_stats['available_uncompressed_sizes'];
$stats['available-unoptimized-sizes'] += $image_stats['available_unoptimized_sizes'];
$stats['optimized-image-sizes'] += $image_stats['image_sizes_optimized'];
$stats['optimized-library-size'] += $image_stats['compressed_total_size'];
$stats['unoptimized-library-size'] += $image_stats['initial_total_size'];
$stats['estimated_credit_use'] += $image_stats['available_uncompressed_sizes'];
$stats['optimized-library-size'] += $image_stats['compressed_total_size'];
$stats['unoptimized-library-size'] += $image_stats['initial_total_size'];

if ( $conversion_enabled ) {
$stats['estimated_credit_use'] += $image_stats['available_unconverted_sizes'];
Expand All @@ -146,10 +142,26 @@ private static function populate_optimization_statistics( $settings, $result, $s
$stats['available-for-optimization'][] = array(
'ID' => $result[ $i ]['ID'],
'post_title' => $result[ $i ]['post_title'],
'file' => self::get_file_name( $wp_metadata ),
'sizes' => $image_stats['available_unoptimized_sizes'],
'bytes' => $image_stats['compressed_total_size'],
);
}
}// End for().

return $stats;
}

/**
* The name of the file that was uploaded, also when WordPress scaled it down.
*/
private static function get_file_name( $wp_metadata ) {
if ( isset( $wp_metadata['original_image'] ) ) {
return wp_basename( $wp_metadata['original_image'] );
}
if ( isset( $wp_metadata['file'] ) ) {
return wp_basename( $wp_metadata['file'] );
}
return '';
}
}
27 changes: 0 additions & 27 deletions src/class-tiny-compress.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,6 @@ public static function create( $api_key, $after_compress_callback = null ) {
return new $class( $api_key, $after_compress_callback );
}

/* Based on pricing April 2016. */
public static function estimate_cost( $compressions, $compressions_used ) {
return round(
self::compression_cost( $compressions + $compressions_used ) -
self::compression_cost( $compressions_used ),
2
);
}

protected function __construct( $after_compress_callback ) {
$this->after_compress_callback = $after_compress_callback;
}
Expand Down Expand Up @@ -202,22 +193,4 @@ private static function needs_resize( $file, $resize_options ) {

return $should_resize_width || $should_resize_height;
}

private static function compression_cost( $total ) {
$cost = 0;

if ( $total > 10000 ) {
$compressions = $total - 10000;
$cost += $compressions * 0.002;
$total -= $compressions;
}

if ( $total > Tiny_Config::MONTHLY_FREE_COMPRESSIONS ) {
$compressions = $total - Tiny_Config::MONTHLY_FREE_COMPRESSIONS;
$cost += $compressions * 0.009;
$total -= $compressions;
}

return $cost;
}
}
59 changes: 59 additions & 0 deletions src/class-tiny-dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,63 @@ public function get_widget_data( $optimization_stats ) {
'auto_compress' => $this->settings->auto_compress_enabled(),
);
}

/**
* The badge and panda of a state, shared by the dashboard widget and the
* bulk optimization page. Only the bulk optimization page has the
* no_sizes state. The panda is a file name in images/widget.
*
* @param string $state A state from get_widget_data(), or no_sizes.
* @return array{badge_colour: string, badge_text: string, panda: string}
*/
public static function get_state_badge_and_panda( $state ) {
$badges_and_pandas = array(
'not_connected' => array(
'badge_colour' => 'red',
'badge_text' => __( 'Not connected', 'tiny-compress-images' ),
'panda' => 'panda-juggle',
),
'pending' => array(
'badge_colour' => 'amber',
'badge_text' => __( 'Waiting for activation', 'tiny-compress-images' ),
'panda' => 'panda-unbox',
),
'empty' => array(
'badge_colour' => 'amber',
'badge_text' => __( 'Nothing to compress', 'tiny-compress-images' ),
'panda' => 'panda-astronaut',
),
'no_sizes' => array(
'badge_colour' => 'amber',
'badge_text' => __( 'Nothing to compress', 'tiny-compress-images' ),
'panda' => 'panda-astronaut',
),
'ready' => array(
'badge_colour' => 'green',
'badge_text' => __( 'Ready to compress', 'tiny-compress-images' ),
'panda' => 'panda-skate',
),
'compressing' => array(
'badge_colour' => 'green',
'badge_text' => __( 'Compressing', 'tiny-compress-images' ),
'panda' => 'panda-rocket',
),
'done' => array(
'badge_colour' => 'green',
'badge_text' => __( 'All done', 'tiny-compress-images' ),
'panda' => 'panda-duck',
),
'credits_short' => array(
'badge_colour' => 'amber',
'badge_text' => __( 'Not enough credits', 'tiny-compress-images' ),
'panda' => 'panda-coffee',
),
'out_of_credits' => array(
'badge_colour' => 'red',
'badge_text' => __( 'Out of credits', 'tiny-compress-images' ),
'panda' => 'panda-coffee',
),
);
return $badges_and_pandas[ $state ];
}
}
Loading
Loading