diff options
Diffstat (limited to 'plugins/jetpack/modules/shortcodes/archiveorg-book.php')
-rw-r--r-- | plugins/jetpack/modules/shortcodes/archiveorg-book.php | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/plugins/jetpack/modules/shortcodes/archiveorg-book.php b/plugins/jetpack/modules/shortcodes/archiveorg-book.php index 4a70b057..8eb73173 100644 --- a/plugins/jetpack/modules/shortcodes/archiveorg-book.php +++ b/plugins/jetpack/modules/shortcodes/archiveorg-book.php @@ -7,7 +7,7 @@ * [archiveorg-book http://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> */ /** @@ -21,7 +21,7 @@ */ function jetpack_shortcode_get_archiveorg_book_id( $atts ) { if ( isset( $atts[0] ) ) { - $atts[0] = trim( $atts[0] , '=' ); + $atts[0] = trim( $atts[0], '=' ); if ( preg_match( '#archive.org/stream/(.+)/?$#i', $atts[0], $match ) ) { $id = $match[1]; } else { @@ -47,11 +47,14 @@ function jetpack_archiveorg_book_shortcode( $atts ) { $atts['id'] = jetpack_shortcode_get_archiveorg_book_id( $atts ); } - $atts = shortcode_atts( array( - 'id' => '', - 'width' => 480, - 'height' => 430, - ), $atts ); + $atts = shortcode_atts( + array( + 'id' => '', + 'width' => 480, + 'height' => 430, + ), + $atts + ); if ( ! $atts['id'] ) { return '<!-- error: missing archive.org book ID -->'; @@ -101,13 +104,13 @@ function jetpack_archiveorg_book_embed_to_shortcode( $content ) { foreach ( $matches as $match ) { $url = explode( '?', $match[3] ); - $id = $url[0]; + $id = $url[0]; $params = $match[4]; $params = wp_kses_hair( $params, array( 'http' ) ); - $width = isset( $params['width'] ) ? absint( $params['width']['value'] ) : 0; + $width = isset( $params['width'] ) ? absint( $params['width']['value'] ) : 0; $height = isset( $params['height'] ) ? absint( $params['height']['value'] ) : 0; $wh = ''; @@ -116,10 +119,10 @@ function jetpack_archiveorg_book_embed_to_shortcode( $content ) { } $shortcode = '[archiveorg-book ' . $id . $wh . ']'; - $content = str_replace( $match[0], $shortcode, $content ); + $content = str_replace( $match[0], $shortcode, $content ); } return $content; } -add_filter( 'pre_kses', 'jetpack_archiveorg_book_embed_to_shortcode' );
\ No newline at end of file +add_filter( 'pre_kses', 'jetpack_archiveorg_book_embed_to_shortcode' ); |