diff options
Diffstat (limited to 'plugins/jetpack/modules/shortcodes/archiveorg-book.php')
-rw-r--r-- | plugins/jetpack/modules/shortcodes/archiveorg-book.php | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/plugins/jetpack/modules/shortcodes/archiveorg-book.php b/plugins/jetpack/modules/shortcodes/archiveorg-book.php index 013e7924..f2592f1b 100644 --- a/plugins/jetpack/modules/shortcodes/archiveorg-book.php +++ b/plugins/jetpack/modules/shortcodes/archiveorg-book.php @@ -7,9 +7,9 @@ * [archiveorg-book https://www.archive.org/stream/goodytwoshoes00newyiala] * [archiveorg id=goodytwoshoes00newyiala width=480 height=430] - * <iframe src='https://www.archive.org/stream/goodytwoshoes00newyiala?ui=embed#mode/1up' width='480px' height='430px' frameborder='0' ></iframe> + * <iframe src="https://www.archive.org/stream/goodytwoshoes00newyiala?ui=embed#mode/1up" width="480px" height="430px" frameborder="0" ></iframe> * - * @package Jetpack + * @package automattic/jetpack */ /** @@ -67,21 +67,22 @@ function jetpack_archiveorg_book_shortcode( $atts ) { if ( ! $atts['width'] ) { $width = absint( $content_width ); } else { - $width = intval( $atts['width'] ); + $width = (int) $atts['width']; } if ( ! $atts['height'] ) { $height = round( ( $width / 640 ) * 360 ); } else { - $height = intval( $atts['height'] ); + $height = (int) $atts['height']; } - $url = esc_url( "https://archive.org/stream/{$id}?ui=embed#mode/1up" ); - - $title = esc_html__( 'Archive.org Book', 'jetpack' ); - - $html = "<div class='embed-archiveorg-book' style='text-align:center;'><iframe title='$title' src='$url' width='$width' height='$height' style='border:0;' webkitallowfullscreen='true' mozallowfullscreen='true' allowfullscreen></iframe></div>"; - return $html; + return sprintf( + '<div class="embed-archiveorg-book" style="text-align:center;"><iframe title="%s" src="%s" width="%s" height="%s" style="border:0;" webkitallowfullscreen="true" mozallowfullscreen="true" allowfullscreen></iframe></div>', + esc_attr__( 'Archive.org Book', 'jetpack' ), + esc_url( "https://archive.org/stream/{$id}?ui=embed#mode/1up" ), + esc_attr( $width ), + esc_attr( $height ) + ); } add_shortcode( 'archiveorg-book', 'jetpack_archiveorg_book_shortcode' ); |