diff --git wp-includes/functions.php wp-includes/functions.php
index b09ed84..4f7f19d 100644
|
|
function wp_check_filetype( $filename, $mimes = null ) { |
2074 | 2074 | } |
2075 | 2075 | |
2076 | 2076 | /** |
| 2077 | * Retrieve the file type from the URL. |
| 2078 | * |
| 2079 | * You can optionally define the mime array, if needed. |
| 2080 | * |
| 2081 | * @since 4.3 |
| 2082 | * |
| 2083 | * @param string $url URL of file. |
| 2084 | * @param array $mimes Optional. Key is the file extension with value as the mime type. |
| 2085 | * @return array Values with extension first and mime type. |
| 2086 | */ |
| 2087 | function wp_check_url_filetype( $url, $mimes = null ) { |
| 2088 | $filename = parse_url( $url, PHP_URL_PATH ); |
| 2089 | return wp_check_filetype( $filename, $mimes ); |
| 2090 | } |
| 2091 | |
| 2092 | /** |
2077 | 2093 | * Attempt to determine the real file type of a file. |
2078 | 2094 | * |
2079 | 2095 | * If unable to, the file name extension will be used to determine type. |
diff --git wp-includes/media.php wp-includes/media.php
index 4007fec..fc16baa 100644
|
|
function wp_playlist_shortcode( $attr ) { |
1344 | 1344 | $tracks = array(); |
1345 | 1345 | foreach ( $attachments as $attachment ) { |
1346 | 1346 | $url = wp_get_attachment_url( $attachment->ID ); |
1347 | | $ftype = wp_check_filetype( $url, wp_get_mime_types() ); |
| 1347 | $ftype = wp_check_url_filetype( $url, wp_get_mime_types() ); |
1348 | 1348 | $track = array( |
1349 | 1349 | 'src' => $url, |
1350 | 1350 | 'type' => $ftype['type'], |
… |
… |
function wp_audio_shortcode( $attr, $content = '' ) { |
1584 | 1584 | |
1585 | 1585 | $primary = false; |
1586 | 1586 | if ( ! empty( $atts['src'] ) ) { |
1587 | | $type = wp_check_filetype( $atts['src'], wp_get_mime_types() ); |
| 1587 | $type = wp_check_url_filetype( $atts['src'], wp_get_mime_types() ); |
1588 | 1588 | if ( ! in_array( strtolower( $type['ext'] ), $default_types ) ) { |
1589 | 1589 | return sprintf( '<a class="wp-embedded-audio" href="%s">%s</a>', esc_url( $atts['src'] ), esc_html( $atts['src'] ) ); |
1590 | 1590 | } |
… |
… |
function wp_audio_shortcode( $attr, $content = '' ) { |
1593 | 1593 | } else { |
1594 | 1594 | foreach ( $default_types as $ext ) { |
1595 | 1595 | if ( ! empty( $atts[ $ext ] ) ) { |
1596 | | $type = wp_check_filetype( $atts[ $ext ], wp_get_mime_types() ); |
| 1596 | $type = wp_check_url_filetype( $atts[ $ext ], wp_get_mime_types() ); |
1597 | 1597 | if ( strtolower( $type['ext'] ) === $ext ) { |
1598 | 1598 | $primary = true; |
1599 | 1599 | } |
… |
… |
function wp_audio_shortcode( $attr, $content = '' ) { |
1670 | 1670 | if ( empty( $fileurl ) ) { |
1671 | 1671 | $fileurl = $atts[ $fallback ]; |
1672 | 1672 | } |
1673 | | $type = wp_check_filetype( $atts[ $fallback ], wp_get_mime_types() ); |
| 1673 | $type = wp_check_url_filetype( $atts[ $fallback ], wp_get_mime_types() ); |
1674 | 1674 | $url = add_query_arg( '_', $instance, $atts[ $fallback ] ); |
1675 | 1675 | $html .= sprintf( $source, $type['type'], esc_url( $url ) ); |
1676 | 1676 | } |
… |
… |
function wp_video_shortcode( $attr, $content = '' ) { |
1814 | 1814 | $is_vimeo = ( preg_match( $vimeo_pattern, $atts['src'] ) ); |
1815 | 1815 | $is_youtube = ( preg_match( $yt_pattern, $atts['src'] ) ); |
1816 | 1816 | if ( ! $is_youtube && ! $is_vimeo ) { |
1817 | | $type = wp_check_filetype( $atts['src'], wp_get_mime_types() ); |
| 1817 | $type = wp_check_url_filetype( $atts['src'], wp_get_mime_types() ); |
1818 | 1818 | if ( ! in_array( strtolower( $type['ext'] ), $default_types ) ) { |
1819 | 1819 | return sprintf( '<a class="wp-embedded-video" href="%s">%s</a>', esc_url( $atts['src'] ), esc_html( $atts['src'] ) ); |
1820 | 1820 | } |
… |
… |
function wp_video_shortcode( $attr, $content = '' ) { |
1829 | 1829 | } else { |
1830 | 1830 | foreach ( $default_types as $ext ) { |
1831 | 1831 | if ( ! empty( $atts[ $ext ] ) ) { |
1832 | | $type = wp_check_filetype( $atts[ $ext ], wp_get_mime_types() ); |
| 1832 | $type = wp_check_url_filetype( $atts[ $ext ], wp_get_mime_types() ); |
1833 | 1833 | if ( strtolower( $type['ext'] ) === $ext ) { |
1834 | 1834 | $primary = true; |
1835 | 1835 | } |
… |
… |
function wp_video_shortcode( $attr, $content = '' ) { |
1913 | 1913 | } elseif ( 'src' === $fallback && $is_vimeo ) { |
1914 | 1914 | $type = array( 'type' => 'video/vimeo' ); |
1915 | 1915 | } else { |
1916 | | $type = wp_check_filetype( $atts[ $fallback ], wp_get_mime_types() ); |
| 1916 | $type = wp_check_url_filetype( $atts[ $fallback ], wp_get_mime_types() ); |
1917 | 1917 | } |
1918 | 1918 | $url = add_query_arg( '_', $instance, $atts[ $fallback ] ); |
1919 | 1919 | $html .= sprintf( $source, $type['type'], esc_url( $url ) ); |