WordPress 4.0.1
[autoinstalls/wordpress.git] / wp-includes / media.php
index b49e324f67f7bb8720214057d967190bea5d75d4..5e94cfeb3659a3708f6e74e857a0062439e9b63d 100644 (file)
@@ -1247,6 +1247,10 @@ function wp_playlist_shortcode( $attr ) {
                $atts['orderby'] = 'none';
        }
 
+       if ( $atts['type'] !== 'audio' ) {
+               $atts['type'] = 'video';
+       }
+
        $args = array(
                'post_status' => 'inherit',
                'post_type' => 'attachment',
@@ -1596,8 +1600,8 @@ function wp_audio_shortcode( $attr, $content = '' ) {
        $html_atts = array(
                'class'    => apply_filters( 'wp_audio_shortcode_class', 'wp-audio-shortcode' ),
                'id'       => sprintf( 'audio-%d-%d', $post_id, $instances ),
-               'loop'     => $atts['loop'],
-               'autoplay' => $atts['autoplay'],
+               'loop'     => wp_validate_boolean( $atts['loop'] ),
+               'autoplay' => wp_validate_boolean( $atts['autoplay'] ),
                'preload'  => $atts['preload'],
                'style'    => 'width: 100%; visibility: hidden;',
        );
@@ -1822,8 +1826,8 @@ function wp_video_shortcode( $attr, $content = '' ) {
                'width'    => absint( $atts['width'] ),
                'height'   => absint( $atts['height'] ),
                'poster'   => esc_url( $atts['poster'] ),
-               'loop'     => $atts['loop'],
-               'autoplay' => $atts['autoplay'],
+               'loop'     => wp_validate_boolean( $atts['loop'] ),
+               'autoplay' => wp_validate_boolean( $atts['autoplay'] ),
                'preload'  => $atts['preload'],
        );
 
@@ -2643,6 +2647,11 @@ function wp_prepare_attachment_for_js( $attachment ) {
 
        if ( $attachment->post_parent ) {
                $post_parent = get_post( $attachment->post_parent );
+       } else {
+               $post_parent = false;
+       }
+
+       if ( $post_parent ) {
                $parent_type = get_post_type_object( $post_parent->post_type );
                if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $attachment->post_parent ) ) {
                        $response['uploadedToLink'] = get_edit_post_link( $attachment->post_parent, 'raw' );