Skip to content

Commit

Permalink
Merge branch 'release/v1.3.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
wpmark committed May 28, 2024
2 parents 79b1442 + 24eee47 commit 4f1d5b7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
28 changes: 12 additions & 16 deletions better-core-video-embeds.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Description: A plugin which enhances the core video embeds for Youtube and Vimeo videos by not loading unnecessary scripts until they are needed.
Requires at least: 6.0
Requires PHP: 7.0
Version: 1.3.4
Version: 1.3.5
Author: Highrise Digital
Author URI: https://highrise.digital/
License: GPL-2.0-or-later
Expand All @@ -15,7 +15,7 @@
// define variable for path to this plugin file.
define( 'HD_BCVE_LOCATION', dirname( __FILE__ ) );
define( 'HD_BCVE_LOCATION_URL', plugins_url( '', __FILE__ ) );
define( 'HD_BCVE_VERSION', '1.3.4' );
define( 'HD_BCVE_VERSION', '1.3.5' );

/**
* Function to run on plugins load.
Expand Down Expand Up @@ -576,8 +576,13 @@ function hd_bcve_add_video_play_button( $block, $video_id, $thumbnail_url, $wrap
*/
function hd_bcve_add_video_thumbnail_markup( $block, $video_id, $thumbnail_url, $wrapper_classes ) {

// get the image ID from the URL.
$imageid = attachment_url_to_postid( $thumbnail_url );

// if we have an image ID, therefore the image is a local image.
if ( ! empty( $imageid ) ) {

// output the image.
echo wp_get_attachment_image(
$imageid,
'full',
Expand All @@ -587,21 +592,10 @@ function hd_bcve_add_video_thumbnail_markup( $block, $video_id, $thumbnail_url,
'loading' => 'lazy',
]
);

} else {
?>
<img
loading="lazy"
class="hd-bcve-thumbnail"
alt=""
src="<?php echo esc_url( $thumbnail_url ); ?>"
<?php
$sizes = getimagesize( $thumbnail_url );
if ( ! empty( $sizes ) && array_key_exists( 3, $sizes ) ) {
echo 'width="' . esc_attr( $sizes[0] ) . '"';
echo 'height="' . esc_attr( $sizes[1] ) . '"';
}
?>
/>
<img loading="lazy" class="hd-bcve-thumbnail" alt="" src="<?php echo esc_url( $thumbnail_url ); ?>" />
<?php
}

Expand All @@ -626,7 +620,9 @@ function hd_bcve_add_video_caption_markup( $block, $video_id, $thumbnail_url, $w
}

?>
<?php echo wp_kses( $video_caption, hd_bcve_allowed_innerblock_html() ); ?>
<figcaption class="wp-element-caption">
<?php echo wp_kses( $video_caption, hd_bcve_allowed_innerblock_html() ); ?>
</figcaption>
<?php

}
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://example.com/
Tags: embed, oembed, youtube, vimeo, performance, blocks
Requires at least: 6.0
Tested up to: 6.4.2
Stable tag: 1.3.4
Stable tag: 1.3.5
Requires PHP: 8.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -49,6 +49,9 @@ Yes! As of version 1.3, you can set a custom thumbnail on the embed block and th

== Changelog ==

= 1.3.5 (28/05/2024) =
* Ensure the caption markup matches that of the original embed when the page loads.

= 1.3.4 (02/04/2024) =
* Translation of the "Play video" button text.
* A responsive video poster image if a custom (locally-hosted) image is chosen.
Expand Down

0 comments on commit 4f1d5b7

Please sign in to comment.