diff options
Diffstat (limited to 'plugins/jetpack/modules/shortcodes/archiveorg.php')
-rw-r--r-- | plugins/jetpack/modules/shortcodes/archiveorg.php | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/plugins/jetpack/modules/shortcodes/archiveorg.php b/plugins/jetpack/modules/shortcodes/archiveorg.php index 86357343..c8e95567 100644 --- a/plugins/jetpack/modules/shortcodes/archiveorg.php +++ b/plugins/jetpack/modules/shortcodes/archiveorg.php @@ -8,7 +8,7 @@ * [archiveorg id=Experime1940 width=640 height=480 autoplay=1] * <iframe src="http://archive.org/embed/Experime1940&autoplay=1&poster=http://archive.org/images/map.png" width="640" height="480" frameborder="0" webkitallowfullscreen="true" mozallowfullscreen="true" allowfullscreen></iframe> -*/ + */ /** * Get ID of requested archive.org embed. @@ -21,7 +21,7 @@ */ function jetpack_shortcode_get_archiveorg_id( $atts ) { if ( isset( $atts[0] ) ) { - $atts[0] = trim( $atts[0] , '=' ); + $atts[0] = trim( $atts[0], '=' ); if ( preg_match( '#archive.org/(details|embed)/(.+)/?$#i', $atts[0], $match ) ) { $id = $match[2]; } else { @@ -47,13 +47,16 @@ function jetpack_archiveorg_shortcode( $atts ) { $atts['id'] = jetpack_shortcode_get_archiveorg_id( $atts ); } - $atts = shortcode_atts( array( - 'id' => '', - 'width' => 640, - 'height' => 480, - 'autoplay' => 0, - 'poster' => '' - ), $atts ); + $atts = shortcode_atts( + array( + 'id' => '', + 'width' => 640, + 'height' => 480, + 'autoplay' => 0, + 'poster' => '', + ), + $atts + ); if ( ! $atts['id'] ) { return '<!-- error: missing archive.org ID -->'; @@ -116,17 +119,17 @@ function jetpack_archiveorg_embed_to_shortcode( $content ) { foreach ( $matches as $match ) { $url = explode( '&', $match[1] ); - $id = 'id=' . $url[0]; + $id = 'id=' . $url[0]; $autoplay = ''; - $poster = ''; + $poster = ''; for ( $ii = 1; $ii < count( $url ); $ii++ ) { - if ( 'autoplay=1' === $url[$ii] ) { + if ( 'autoplay=1' === $url[ $ii ] ) { $autoplay = ' autoplay="1"'; } $map_matches = array(); - if ( preg_match( '/^poster=(.+)$/', $url[$ii], $map_matches ) ) { + if ( preg_match( '/^poster=(.+)$/', $url[ $ii ], $map_matches ) ) { $poster = " poster=\"{$map_matches[1]}\""; } } @@ -135,7 +138,7 @@ function jetpack_archiveorg_embed_to_shortcode( $content ) { $params = wp_kses_hair( $params, array( 'http' ) ); - $width = isset( $params['width'] ) ? (int) $params['width']['value'] : 0; + $width = isset( $params['width'] ) ? (int) $params['width']['value'] : 0; $height = isset( $params['height'] ) ? (int) $params['height']['value'] : 0; $wh = ''; @@ -144,7 +147,7 @@ function jetpack_archiveorg_embed_to_shortcode( $content ) { } $shortcode = '[archiveorg ' . $id . $wh . $autoplay . $poster . ']'; - $content = str_replace( $match[0], $shortcode, $content ); + $content = str_replace( $match[0], $shortcode, $content ); } return $content; |