Plugin Updates

This commit is contained in:
Tony Volpe
2024-03-19 15:33:31 +00:00
parent ff5b56dc44
commit 3a70a6e4bf
317 changed files with 8178 additions and 2933 deletions

View File

@@ -122,7 +122,7 @@ class Main extends \Imagify_AS3CF_Deprecated {
* WebP images to display with a <picture> tag.
*
* @since 1.9
* @see \Imagify\Webp\Picture\Display->process_image()
* @see \Imagify\Picture\Display->process_image()
* @author Grégory Viguier
*
* @param array $data An array of data for this image.
@@ -443,7 +443,7 @@ class Main extends \Imagify_AS3CF_Deprecated {
}
foreach ( $paths as $size_name => $file_path ) {
if ( 'thumb' === $size_name || 'backup' === $size_name || $process->is_size_webp( $size_name ) ) {
if ( 'thumb' === $size_name || 'backup' === $size_name || $process->is_size_next_gen( $size_name ) ) {
continue;
}

View File

@@ -100,10 +100,11 @@ class NGG extends AbstractBulk {
}
/**
* Get ids of all optimized media without WebP versions.
* Get ids of all optimized media without next-gen versions.
*
* @since 1.9
* @since 1.9.5 The method doesn't return the IDs directly anymore.
* @since 2.2
*
* @param string $format Format we are looking for. (webp|avif).
*
* @return array {
* @type array $ids A list of media IDs.
@@ -113,7 +114,7 @@ class NGG extends AbstractBulk {
* }
* }
*/
public function get_optimized_media_ids_without_webp() {
public function get_optimized_media_ids_without_format( $format ) {
global $wpdb;
$this->set_no_time_limit();
@@ -121,7 +122,12 @@ class NGG extends AbstractBulk {
$storage = C_Gallery_Storage::get_instance();
$ngg_table = $wpdb->prefix . 'ngg_pictures';
$data_table = DB::get_instance()->get_table_name();
$webp_suffix = constant( imagify_get_optimization_process_class_name( 'ngg' ) . '::WEBP_SUFFIX' );
$suffix = constant( imagify_get_optimization_process_class_name( 'ngg' ) . '::WEBP_SUFFIX' );
if ( get_imagify_option( 'convert_to_avif' ) ) {
$suffix = constant( imagify_get_optimization_process_class_name( 'ngg' ) . '::AVIF_SUFFIX' );
}
$files = $wpdb->get_col( $wpdb->prepare( // WPCS: unprepared SQL ok.
"
SELECT ngg.pid
@@ -132,7 +138,7 @@ class NGG extends AbstractBulk {
( data.status = 'success' OR data.status = 'already_optimized' )
AND data.data NOT LIKE %s
ORDER BY ngg.pid DESC",
'%' . $wpdb->esc_like( $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
'%' . $wpdb->esc_like( $suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
) );
$wpdb->flush();
@@ -175,18 +181,22 @@ class NGG extends AbstractBulk {
}
/**
* Tell if there are optimized media without WebP versions.
* Tell if there are optimized media without next-gen versions.
*
* @since 1.9
* @since 2.2
*
* @return int The number of media.
*/
public function has_optimized_media_without_webp() {
public function has_optimized_media_without_nextgen() {
global $wpdb;
$ngg_table = $wpdb->prefix . 'ngg_pictures';
$data_table = DB::get_instance()->get_table_name();
$webp_suffix = constant( imagify_get_optimization_process_class_name( 'ngg' ) . '::WEBP_SUFFIX' );
$suffix = constant( imagify_get_optimization_process_class_name( 'ngg' ) . '::WEBP_SUFFIX' );
if ( get_imagify_option( 'convert_to_avif' ) ) {
$suffix = constant( imagify_get_optimization_process_class_name( 'ngg' ) . '::AVIF_SUFFIX' );
}
return (int) $wpdb->get_var( $wpdb->prepare( // WPCS: unprepared SQL ok.
"
@@ -197,7 +207,7 @@ class NGG extends AbstractBulk {
WHERE
( data.status = 'success' OR data.status = 'already_optimized' )
AND data.data NOT LIKE %s",
'%' . $wpdb->esc_like( $webp_suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
'%' . $wpdb->esc_like( $suffix . '";a:4:{s:7:"success";b:1;' ) . '%'
) );
}

View File

@@ -284,7 +284,8 @@ function imagify_ngg_cleanup_after_media_deletion( $image_id, $image ) {
* The backup file has already been deleted by NGG.
* Delete the WebP versions and the optimization data.
*/
$process->delete_webp_files();
$process->delete_nextgen_files();
$process->get_data()->delete_optimization_data();
}

View File

@@ -164,7 +164,7 @@ class Main extends \Imagify_Regenerate_Thumbnails_Deprecated {
if ( ! empty( $optimization_data['sizes'] ) ) {
foreach ( $optimization_data['sizes'] as $size_name => $size_data ) {
$non_webp_size_name = $process->is_size_webp( $size_name );
$non_webp_size_name = $process->is_size_next_gen( $size_name );
if ( ! $non_webp_size_name || ! isset( $sizes[ $non_webp_size_name ] ) ) {
continue;