Make WordPress Core

Ticket #24202: 24202.10.diff

File 24202.10.diff, 1.0 KB (added by aaroncampbell, 13 years ago)
  • wp-includes/media.php

     
    18701870 *
    18711871 * @since 3.6.0
    18721872 *
    1873  * @param string $type Type of media: audio or video
    18741873 * @param string $content A string which might contain media data.
     1874 * @param array $types array of media types: 'audio', 'video', 'object', 'embed', or 'iframe'
    18751875 * @return array A list of found HTML media embeds
    18761876 */
    18771877function get_media_embedded_in_content( $content ) {
    18781878        $html = array();
     1879        $allowed_media_types = array( 'audio', 'video', 'object', 'embed', 'iframe' );
     1880        if ( ! empty( $types ) ) {
     1881                if ( ! is_array( $types ) )
     1882                        $types = array( $types );
     1883                $allowed_media_types = array_intersect( $allowed_media_types, $types );
     1884        }
    18791885
    1880         foreach ( array( 'audio', 'video', 'object', 'embed', 'iframe' ) as $tag ) {
     1886        foreach ( $allowed_media_types as $tag ) {
    18811887                if ( preg_match( '#' . get_tag_regex( $tag ) . '#', $content, $matches ) ) {
    18821888                        $html[] = $matches[0];
    18831889                }