Merged in feature/MAW-855-import-code-into-aws (pull request #2)

code import from pantheon

* code import from pantheon
This commit is contained in:
Tony Volpe
2023-12-04 23:08:14 +00:00
parent 8c9b1312bc
commit 8f4b5efda6
4766 changed files with 185592 additions and 239967 deletions

View File

@@ -33,7 +33,10 @@ function imagify_count_attachments() {
$mime_types = Imagify_DB::get_mime_types();
$statuses = Imagify_DB::get_post_statuses();
$nodata_join = Imagify_DB::get_required_wp_metadata_join_clause();
$nodata_join = Imagify_DB::get_required_wp_metadata_join_clause('p.ID', true, true,
"AND p.post_mime_type IN ( $mime_types )
AND p.post_type = 'attachment'
AND p.post_status IN ( $statuses )");
$nodata_where = Imagify_DB::get_required_wp_metadata_where_clause();
$count = (int) $wpdb->get_var( // WPCS: unprepared SQL ok.
"

View File

@@ -42,6 +42,7 @@ function get_imagify_attachment_optimization_text( $process ) {
}
$data = $process->get_data();
$optimized_data = $data->get_optimization_data();
$attachment_id = $media->get_id();
$optimization_level = imagify_get_optimization_level_label( $data->get_optimization_level() );
@@ -49,6 +50,10 @@ function get_imagify_attachment_optimization_text( $process ) {
$output .= $output_before . '<span class="data">' . __( 'New Filesize:', 'imagify' ) . '</span> <strong class="big">' . $data->get_optimized_size() . '</strong>' . $output_after;
}
if ( key_exists( 'message', $optimized_data ) && $optimized_data['message'] ) {
$output .= $output_before . '<span class="data">' . __( 'Convert:', 'imagify' ) . '</span> <strong class="big">' . $optimized_data['message'] . '</strong>' . $output_after;
}
$chart = '';
if ( ! $is_media_page ) {
@@ -90,6 +95,10 @@ function get_imagify_attachment_optimization_text( $process ) {
if ( $media->is_image() ) {
$has_webp = $process->has_webp() ? __( 'Yes', 'imagify' ) : __( 'No', 'imagify' );
if ( $process->has_webp() ) {
$has_webp = $process->is_full_webp() ? __( 'Yes', 'imagify' ) : __( 'Partially', 'imagify' );
}
$output .= $output_before . '<span class="data">' . __( 'WebP generated:', 'imagify' ) . '</span> <strong class="big">' . esc_html( $has_webp ) . '</strong>' . $output_after;
$total_optimized_thumbnails = $data->get_optimized_sizes_count();

View File

@@ -1,5 +1,6 @@
<?php
use Imagify\Notices\Notices;
use Imagify\User\User;
defined( 'ABSPATH' ) || die( 'Cheatin uh?' );
@@ -400,7 +401,7 @@ function imagify_cache_user() {
return false;
}
$user = new Imagify_User();
$user = new User();
$data = (object) get_object_vars( $user );
$methods = get_class_methods( $user );

View File

@@ -164,7 +164,7 @@ function get_imagify_max_image_size() {
*/
function imagify_translate_api_message( $message ) {
if ( ! $message ) {
return imagify_translate_api_message( 'Unknown error occurred' );
$message = 'Unknown error occurred';
}
if ( is_wp_error( $message ) ) {
@@ -199,6 +199,7 @@ function imagify_translate_api_message( $message ) {
'</a>'
),
'Your image is too big to be uploaded on our server' => __( 'Your file is too big to be uploaded on our server.', 'imagify' ),
'Webp is less performant than original' => __( 'WebP file is larger than the original image', 'imagify' ),
'Our server returned an invalid response' => __( 'Our server returned an invalid response.', 'imagify' ),
'cURL isn\'t installed on the server' => __( 'cURL is not available on the server.', 'imagify' ),
// API messages.

View File

@@ -115,7 +115,14 @@ function imagify_has_attachments_without_required_metadata() {
$mime_types = Imagify_DB::get_mime_types();
$statuses = Imagify_DB::get_post_statuses();
$nodata_join = Imagify_DB::get_required_wp_metadata_join_clause( 'p.ID', false, false );
$nodata_join = Imagify_DB::get_required_wp_metadata_join_clause(
'p.ID',
false,
false,
"AND p.post_mime_type IN ( $mime_types )
AND p.post_type = 'attachment'
AND p.post_status IN ( $statuses )"
);
$nodata_where = Imagify_DB::get_required_wp_metadata_where_clause( array(
'matching' => false,
'test' => false,