Ticket #24449: 24449.diff
| File 24449.diff, 3.7 KB (added by , 13 years ago) |
|---|
-
wp-includes/js/media-editor.js
44 44 45 45 props.title = props.title || attachment.title; 46 46 47 link = props. link || defaultProps.link || getUserSetting( 'urlbutton', 'file' );47 link = props.embed || props.link || defaultProps.link || getUserSetting( 'urlbutton', 'file' ); 48 48 if ( 'file' === link ) 49 49 linkUrl = attachment.url; 50 50 else if ( 'post' === link ) … … 102 102 props = wp.media.string.props( props, attachment ); 103 103 shortcode = {}; 104 104 105 if ( props.embed !== 'embed' ) 106 return wp.media.string.link( props ); 107 105 108 if ( props.mime ) { 106 109 switch ( props.mime ) { 107 110 case 'audio/mpeg': 108 if ( attachment. url.indexOf( 'mp3' ) )111 if ( attachment.filename.indexOf( 'mp3' ) ) 109 112 shortcode.mp3 = attachment.url; 110 else if ( attachment. url.indexOf( 'm4a' ) )113 else if ( attachment.filename.indexOf( 'm4a' ) ) 111 114 shortcode.m4a = attachment.url; 112 115 break; 113 116 case 'audio/mp3': -
wp-includes/js/media-views.js
441 441 this._defaultDisplaySettings = { 442 442 align: defaultProps.align || getUserSetting( 'align', 'none' ), 443 443 size: defaultProps.size || getUserSetting( 'imgsize', 'medium' ), 444 link: defaultProps.link || getUserSetting( 'urlbutton', 'file' ) 444 link: defaultProps.link || getUserSetting( 'urlbutton', 'file' ), 445 embed: 'embed' 445 446 }; 446 447 }, 447 448 … … 3652 3653 if ( attachment ) { 3653 3654 _.extend( this.options, { 3654 3655 sizes: attachment.get('sizes'), 3655 type: attachment.get('type') 3656 type: attachment.get('type'), 3657 canEmbed: this.canEmbed( attachment ) 3656 3658 }); 3657 3659 } 3658 3660 … … 3661 3663 return this; 3662 3664 }, 3663 3665 3666 canEmbed: function( attachment ) { 3667 var subtype, type = attachment.get('type'); 3668 if ( type !== 'audio' && type !== 'video' ) 3669 return false; 3670 3671 subtype = attachment.get('subtype'); 3672 if ( 'audio' === type ) 3673 return _.contains( [ 'mpeg', 'mp3', 'm4a', 'wav', 'ogg', 'x-ms-wma', 'wma' ], subtype ); 3674 else 3675 return _.contains( [ 'mp4', 'm4v', 'webm', 'ogg', 'x-ms-wmv', 'wmv', 'asf', 'flv', 'x-flv' ], subtype ); 3676 }, 3677 3664 3678 updateLinkTo: function() { 3665 3679 var linkTo = this.model.get('link'), 3666 3680 $input = this.$('.link-to-custom'), -
wp-includes/media-template.php
279 279 </label> 280 280 <# } #> 281 281 282 <# if ( data.canEmbed ) { #> 283 <label class="setting"> 284 <span><?php _e('Embed or Link'); ?></span> 285 <select class="embed-or-link" 286 data-setting="embed"> 287 <# if ( 'audio' === data.type ) { #> 288 <option value="embed" selected> 289 <?php esc_attr_e('Embed Audio Player'); ?> 290 </option> 291 <# } else { #> 292 <option value="embed" selected> 293 <?php esc_attr_e('Embed as Video Player'); ?> 294 </option> 295 <# } #> 296 <option value="file"> 297 <?php esc_attr_e('Link to Media File'); ?> 298 </option> 299 <option value="post"> 300 <?php esc_attr_e('Link to Attachment Page'); ?> 301 </option> 302 </select> 303 </label> 304 <# } else { #> 305 282 306 <div class="setting"> 283 307 <label> 284 308 <span><?php _e('Link To'); ?></span> … … 305 329 <input type="text" class="link-to-custom" data-setting="linkUrl" /> 306 330 </div> 307 331 332 <# } #> 333 308 334 <# if ( 'undefined' !== typeof data.sizes ) { #> 309 335 <label class="setting"> 310 336 <span><?php _e('Size'); ?></span>