Skip to content

Commit

Permalink
Fix a few more PHP 7+ things in the main plugin file so our PHP requi…
Browse files Browse the repository at this point in the history
…rement check always works
  • Loading branch information
dkotter committed Oct 18, 2023
1 parent 3046671 commit 426d985
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions retro-webamp-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ function ( $block_content, $block, $instance ) {
if ( 'core/audio' !== $block['blockName'] ) {
return $block_content;
}
$attributes = $block['attrs'] ?? array();
$attachment_id = $attributes['id'] ?? 0;
$attributes = isset( $block['attrs'] ) ? $block['attrs'] : array();
$attachment_id = isset( $attributes['id'] ) ? $attributes['id'] : 0;
$attachment = get_post( $attachment_id );

// Stop here if $attachment can't be found.
Expand All @@ -120,8 +120,8 @@ function ( $block_content, $block, $instance ) {
}

$metadata = wp_get_attachment_metadata( $attachment_id );
$artist = $metadata['artist'] ?? '';
$title = $metadata['title'] ?? '';
$artist = isset( $metadata['artist'] ) ? $metadata['artist'] : '';
$title = isset( $metadata['title'] ) ? $metadata['title'] : '';
$new_props = array(
'artist' => $artist,
'title' => $title,
Expand Down

0 comments on commit 426d985

Please sign in to comment.