Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boost: Fix image autofixer warning #37230

Merged
merged 4 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ public static function is_fixed( $post_id, $image_url ) {
// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
public static function fix_image_attachments( $sources, $size_array, $image_url, $image_meta, $attachment_id ) {

$post = get_post();
$post = get_post();
// If we're not in a post context, skip.
if ( $post === null ) {
return $sources;
}
$post_id = $post->ID;

$fixes = self::get_fixes( $post_id );
Expand Down Expand Up @@ -128,7 +132,11 @@ public static function fix_image_attachments( $sources, $size_array, $image_url,
// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
public static function fix_image_sizes( $sizes, $size, $image_url, $image_meta, $attachment_id ) {

$post = get_post();
$post = get_post();
// If we're not in a post context, skip as there won't be any fixes.
if ( $post === null ) {
return $sizes;
}
$post_id = $post->ID;

$fixes = self::get_fixes( $post_id );
Expand All @@ -148,7 +156,10 @@ public static function fix_image_sizes( $sizes, $size, $image_url, $image_meta,
}

public static function fix_content( $content ) {
$post = get_post();
$post = get_post();
if ( $post === null ) {
return $content;
}
$fixes = self::get_fixes( $post->ID );
if ( ! $fixes ) {
return $content;
Expand Down
5 changes: 5 additions & 0 deletions projects/plugins/boost/changelog/fix-image-autofixer-warning
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Fixed a warning in image autofixer which is under feature flag