filesystem = \Imagify_Filesystem::get_instance(); } /** * Format context data (stats). * * @since 1.9 * @access protected * @author Grégory Viguier * * @param array $data { * The data to format. * * @type int $count-optimized Number of media optimized. * @type int $count-errors Number of media having an optimization error. * @type int $optimized-size Optimized filesize. * @type int $original-size Original filesize. * @type string $errors_url URL to the page listing the optimization errors. * } * @return array { * The formated data. * * @type string $count-optimized Number of media optimized. * @type string $count-errors Number of media having an optimization error, with a link to the page listing the optimization errors. * @type string $optimized-size Optimized filesize. * @type string $original-size Original filesize. * } */ protected function format_context_data( $data ) { /* translators: %s is a formatted number, dont use %d. */ $data['count-optimized'] = sprintf( _n( '%s Media File Optimized', '%s Media Files Optimized', $data['count-optimized'], 'imagify' ), '' . number_format_i18n( $data['count-optimized'] ) . '' ); if ( $data['count-errors'] ) { /* translators: %s is a formatted number, dont use %d. */ $data['count-errors'] = sprintf( _n( '%s Error', '%s Errors', $data['count-errors'], 'imagify' ), '' . number_format_i18n( $data['count-errors'] ) . '' ); $data['count-errors'] .= ' ' . __( 'View Errors', 'imagify' ) . ''; } else { $data['count-errors'] = ''; } if ( $data['optimized-size'] ) { $data['optimized-size'] = '' . __( 'Optimized Filesize', 'imagify' ) . ' ' . imagify_size_format( $data['optimized-size'], 2 ); } else { $data['optimized'] = ''; } if ( $data['original-size'] ) { $data['original-size'] = '' . __( 'Original Filesize', 'imagify' ) . ' ' . imagify_size_format( $data['original-size'], 2 ); } else { $data['original-size'] = ''; } unset( $data['errors_url'] ); return $data; } }