Ticket #24449: 24449.7.diff
| File 24449.7.diff, 4.2 KB (added by , 13 years ago) |
|---|
-
wp-includes/js/media-editor.js
97 97 }, 98 98 99 99 audio: function( props, attachment ) { 100 return wp.media.string._audioVideo( 'audio', props, attachment ); 100 var shortcode, html, extension; 101 102 props = wp.media.string.props( props, attachment ); 103 if ( props.link !== 'embed' ) 104 return wp.media.string.link( props ); 105 106 shortcode = {}; 107 extension = attachment.filename.split('.').pop(); 108 109 // Render unsupported audio files as links. 110 if ( _.contains( wp.media.view.settings.audioExts, extension ) ) 111 shortcode[extension] = attachment.url; 112 else 113 return wp.media.string.link( props ); 114 115 html = wp.shortcode.string({ 116 tag: 'audio', 117 attrs: shortcode 118 }); 119 120 return html; 101 121 }, 102 122 103 123 video: function( props, attachment ) { 104 return wp.media.string._audioVideo( 'video', props, attachment );105 },106 107 _audioVideo: function( type, props, attachment ) {108 124 var shortcode, html, extension; 109 125 110 126 props = wp.media.string.props( props, attachment ); … … 113 129 114 130 shortcode = {}; 115 131 116 if ( 'video' === type ) { 117 if ( attachment.width ) 118 shortcode.width = attachment.width; 132 if ( attachment.width ) 133 shortcode.width = attachment.width; 119 134 120 if ( attachment.height ) 121 shortcode.height = attachment.height; 122 } 135 if ( attachment.height ) 136 shortcode.height = attachment.height; 123 137 124 138 extension = attachment.filename.split('.').pop(); 125 139 126 if ( _.contains( wp.media.view.settings.embedExts, extension ) ) { 140 // Render unsupported video files as links. 141 if ( _.contains( wp.media.view.settings.videoExts, extension ) ) 127 142 shortcode[extension] = attachment.url; 128 } else { 129 // Render unsupported audio and video files as links. 143 else 130 144 return wp.media.string.link( props ); 131 }132 145 133 146 html = wp.shortcode.string({ 134 tag: type,147 tag: 'video', 135 148 attrs: shortcode 136 149 }); 137 150 -
wp-includes/js/media-views.js
462 462 }, 463 463 464 464 canEmbed: function( attachment ) { 465 var type = attachment.get('type'); 466 if ( type !== 'audio' && type !== 'video' ) 467 return false; 465 var type, ext; 466 // If uploading, we know the filename but not the mime type. 467 if ( ! attachment.get('uploading') ) { 468 type = attachment.get('type'); 469 if ( type !== 'audio' && type !== 'video' ) 470 return false; 471 } 468 472 469 return _.contains( media.view.settings.embedExts, attachment.get('filename').split('.').pop() ); 473 ext = attachment.get('filename').split('.').pop(); 474 if ( _.contains( media.view.settings.audioExts, ext ) ) 475 return 'audio'; 476 if ( _.contains( media.view.settings.videoExts, ext ) ) 477 return 'video'; 478 return false; 470 479 }, 471 480 472 481 syncSelection: function() { -
wp-includes/media-template.php
297 297 data-user-setting="urlbutton" 298 298 <# } #>> 299 299 300 <# if ( data.model.canEmbed && 'audio' === data.type) { #>300 <# if ( data.model.canEmbed === 'audio' ) { #> 301 301 <option value="embed" selected> 302 302 <?php esc_attr_e('Embed Audio Player'); ?> 303 303 </option> 304 304 <option value="file"> 305 <# } else if ( data.model.canEmbed && 'video' === data.type) { #>305 <# } else if ( data.model.canEmbed === 'video' ) { #> 306 306 <option value="embed" selected> 307 307 <?php esc_attr_e('Embed Video Player'); ?> 308 308 </option> -
wp-includes/media.php
1758 1758 'id' => 0, 1759 1759 ), 1760 1760 'defaultProps' => $props, 1761 'embedExts' => array_merge( wp_get_audio_extensions(), wp_get_video_extensions() ), 1761 'audioExts' => wp_get_audio_extensions(), 1762 'videoExts' => wp_get_video_extensions(), 1762 1763 ); 1763 1764 1764 1765 $post = null;