Skip to content

Commit

Permalink
Allow empty type/width/height via filters
Browse files Browse the repository at this point in the history
  • Loading branch information
GiovanniMounir authored Oct 30, 2024
1 parent 5ade049 commit 6bcc7cd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/presenters/open-graph/image-presenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ protected function filter( $image ) {
if ( ! empty( $image_type ) && \is_string( $image_type ) ) {
$image['type'] = \trim( $image_type );
}
else{

Check failure on line 118 in src/presenters/open-graph/image-presenter.php

View workflow job for this annotation

GitHub Actions / Check code style

Space after opening control structure is required

Check failure on line 118 in src/presenters/open-graph/image-presenter.php

View workflow job for this annotation

GitHub Actions / Check code style

No space before opening parenthesis is prohibited

Check failure on line 118 in src/presenters/open-graph/image-presenter.php

View workflow job for this annotation

GitHub Actions / Check code style

Expected 1 space after ELSE keyword; 0 found
$image['type'] = "";

Check failure on line 119 in src/presenters/open-graph/image-presenter.php

View workflow job for this annotation

GitHub Actions / Check code style

String "" does not require double quotes; use single quotes instead
}

$image_width = ( $image['width'] ?? '' );
/**
Expand All @@ -127,6 +130,9 @@ protected function filter( $image ) {
if ( ! empty( $image_width ) && $image_width > 0 ) {
$image['width'] = $image_width;
}
else{

Check failure on line 133 in src/presenters/open-graph/image-presenter.php

View workflow job for this annotation

GitHub Actions / Check code style

Space after opening control structure is required

Check failure on line 133 in src/presenters/open-graph/image-presenter.php

View workflow job for this annotation

GitHub Actions / Check code style

No space before opening parenthesis is prohibited

Check failure on line 133 in src/presenters/open-graph/image-presenter.php

View workflow job for this annotation

GitHub Actions / Check code style

Expected 1 space after ELSE keyword; 0 found
$image['width'] = "";

Check failure on line 134 in src/presenters/open-graph/image-presenter.php

View workflow job for this annotation

GitHub Actions / Check code style

String "" does not require double quotes; use single quotes instead
}

$image_height = ( $image['height'] ?? '' );
/**
Expand All @@ -139,6 +145,9 @@ protected function filter( $image ) {
if ( ! empty( $image_height ) && $image_height > 0 ) {
$image['height'] = $image_height;
}
else{

Check failure on line 148 in src/presenters/open-graph/image-presenter.php

View workflow job for this annotation

GitHub Actions / Check code style

Space after opening control structure is required

Check failure on line 148 in src/presenters/open-graph/image-presenter.php

View workflow job for this annotation

GitHub Actions / Check code style

No space before opening parenthesis is prohibited
$image['height'] = "";
}

return $image;
}
Expand Down

0 comments on commit 6bcc7cd

Please sign in to comment.