Skip to content

Commit d6e99f7

Browse files
committed
Trim attributes before using; cast poster to int if is numeric.
1 parent 660aa8d commit d6e99f7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/ableplayer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,8 @@ function ableplayer_shortcode( $atts, $content = null ) {
447447
$atts,
448448
'ableplayer'
449449
);
450+
// Globally remove white space on attributes.
451+
$all_atts = map_deep( $all_atts, 'trim' );
450452
// If vimeo ID is set, enqueue the vimeo player.
451453
if ( $all_atts['vimeo-id'] ) {
452454
$debug = ( SCRIPT_DEBUG || ABLEPLAYER_DEBUG ) ? true : false;
@@ -545,6 +547,7 @@ function ableplayer_shortcode( $atts, $content = null ) {
545547
// Allow passing an attachment ID as poster.
546548
$poster = $all_atts['poster'];
547549
if ( is_numeric( $poster ) ) {
550+
$poster = absint( $poster );
548551
$poster = wp_get_attachment_image_url( $poster, 'large' );
549552
}
550553
$o .= ' poster="' . esc_attr( $poster ) . '"';

0 commit comments

Comments
 (0)