Skip to content

Commit

Permalink
Automatically fix some basic CS issues using phpcbf
Browse files Browse the repository at this point in the history
  • Loading branch information
carstingaxion committed Feb 9, 2024
1 parent 843c9f2 commit 003d317
Show file tree
Hide file tree
Showing 9 changed files with 190 additions and 163 deletions.
2 changes: 1 addition & 1 deletion inc/sharing-image/admin-ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function bootstrap(): void {
*
* @return void
*/
function remove_menu() : void {
function remove_menu(): void {

if ( is_super_admin() && true === constant( 'WP_DEBUG' ) ) {
return;
Expand Down
25 changes: 14 additions & 11 deletions inc/sharing-image/frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@ function bootstrap(): void {
add_filter( 'sharing_image_hide_meta', '__return_true' );

/**
* Because 'wpseo_opengraph_image_size' FILTER IS BUGGY
* Add the generated image to yoasts opengraph output.
*
* we can not use the already working
* @see https://wpset.org/sharing-image/#faq
* The docs suggest an alternative approach
* using the 'wpseo_add_opengraph_images' action to add og:images.
*
* Because 'wpseo_opengraph_image_size' FILTER IS BUGGY,
* we can not use the already working:
* - 'wpseo_opengraph_image' and
* - 'wpseo_twitter_image' filters.
*
Expand All @@ -54,20 +59,19 @@ function bootstrap(): void {
*
* @return Indexable_Presentation
*/
function add_image_to_yoast_opengraph( Indexable_Presentation $presentation ) :Indexable_Presentation {
function add_image_to_yoast_opengraph( Indexable_Presentation $presentation ): Indexable_Presentation {
$generated_image_url = esc_url( sharing_image_poster() );
if ( $generated_image_url ) {

$si_options = get_option( Options\OPTION_NAME );
$si_config = get_option( 'sharing_image_config' );

if (
! \is_array( $si_options )
|| ! \is_array( $si_options[0] )
|| ! \is_array( $si_config )
|| ! isset( $si_options[0]['width'] )
|| ! isset( $si_options[0]['height'] )
|| ! isset( $si_config['format'] )
if ( ! \is_array( $si_options )
|| ! \is_array( $si_options[0] )
|| ! \is_array( $si_config )
|| ! isset( $si_options[0]['width'] )
|| ! isset( $si_options[0]['height'] )
|| ! isset( $si_config['format'] )
) {
return $presentation;
}
Expand All @@ -84,4 +88,3 @@ function add_image_to_yoast_opengraph( Indexable_Presentation $presentation ) :I

return $presentation;
}

Loading

0 comments on commit 003d317

Please sign in to comment.