Changeset 31016 for trunk/src/wp-includes/media.php
- Timestamp:
- 12/31/2014 08:40:05 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/media.php
r30982 r31016 1755 1755 } 1756 1756 1757 $is_vimeo = $is_youtube = false; 1757 1758 $yt_pattern = '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#'; 1759 $vimeo_pattern = '#^https?://(.+\.)?vimeo\.com/.*#'; 1758 1760 1759 1761 $primary = false; 1760 1762 if ( ! empty( $atts['src'] ) ) { 1761 if ( ! preg_match( $yt_pattern, $atts['src'] ) ) { 1763 $is_vimeo = ( preg_match( $vimeo_pattern, $atts['src'] ) ); 1764 $is_youtube = ( preg_match( $yt_pattern, $atts['src'] ) ); 1765 if ( ! $is_youtube && ! $is_vimeo ) { 1762 1766 $type = wp_check_filetype( $atts['src'], wp_get_mime_types() ); 1763 1767 if ( ! in_array( strtolower( $type['ext'] ), $default_types ) ) { … … 1765 1769 } 1766 1770 } 1771 1772 if ( $is_vimeo ) { 1773 wp_enqueue_script( 'froogaloop' ); 1774 } 1775 1767 1776 $primary = true; 1768 1777 array_unshift( $default_types, 'src' ); … … 1849 1858 $fileurl = $atts[ $fallback ]; 1850 1859 } 1851 if ( 'src' === $fallback && preg_match( $yt_pattern, $atts['src'] )) {1860 if ( 'src' === $fallback && $is_youtube ) { 1852 1861 $type = array( 'type' => 'video/youtube' ); 1862 } elseif ( 'src' === $fallback && $is_vimeo ) { 1863 $type = array( 'type' => 'video/vimeo' ); 1853 1864 } else { 1854 1865 $type = wp_check_filetype( $atts[ $fallback ], wp_get_mime_types() );
Note: See TracChangeset
for help on using the changeset viewer.