Changeset 24777
- Timestamp:
- 07/23/2013 05:39:08 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
wp-admin/includes/media.php (modified) (1 diff)
-
wp-includes/js/media-editor.js (modified) (2 diffs)
-
wp-includes/js/media-views.js (modified) (2 diffs)
-
wp-includes/media-template.php (modified) (2 diffs)
-
wp-includes/media.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/media.php
r24696 r24777 2471 2471 <div class="misc-pub-section"> 2472 2472 <?php _e( 'Bitrate:' ); ?> <strong><?php 2473 echo $meta['bitrate'] / 1000, 'kb/s';2473 echo round( $meta['bitrate'] / 1000 ), 'kb/s'; 2474 2474 2475 2475 if ( ! empty( $meta['bitrate_mode'] ) ) -
trunk/wp-includes/js/media-editor.js
r24519 r24777 46 46 47 47 link = props.link || defaultProps.link || getUserSetting( 'urlbutton', 'file' ); 48 if ( 'file' === link )48 if ( 'file' === link || 'embed' === link ) 49 49 linkUrl = attachment.url; 50 50 else if ( 'post' === link ) … … 98 98 99 99 audio: function( props, attachment ) { 100 var shortcode, html; 100 return wp.media.string._audioVideo( 'audio', props, attachment ); 101 }, 102 103 video: function( props, attachment ) { 104 return wp.media.string._audioVideo( 'video', props, attachment ); 105 }, 106 107 _audioVideo: function( type, props, attachment ) { 108 var shortcode, html, extension; 101 109 102 110 props = wp.media.string.props( props, attachment ); 111 if ( props.link !== 'embed' ) 112 return wp.media.string.link( props ); 113 103 114 shortcode = {}; 104 115 105 if ( props.mime ) { 106 switch ( props.mime ) { 107 case 'audio/mpeg': 108 if ( attachment.url.indexOf( 'mp3' ) ) 109 shortcode.mp3 = attachment.url; 110 else if ( attachment.url.indexOf( 'm4a' ) ) 111 shortcode.m4a = attachment.url; 112 break; 113 case 'audio/mp3': 114 shortcode.mp3 = attachment.url; 115 break; 116 case 'audio/m4a': 117 shortcode.m4a = attachment.url; 118 break; 119 case 'audio/wav': 120 shortcode.wav = attachment.url; 121 break; 122 case 'audio/ogg': 123 shortcode.ogg = attachment.url; 124 break; 125 case 'audio/x-ms-wma': 126 case 'audio/wma': 127 shortcode.wma = attachment.url; 128 break; 129 default: 130 // Render unsupported audio files as links. 131 return wp.media.string.link( props ); 132 } 116 if ( 'video' === type ) { 117 if ( attachment.width ) 118 shortcode.width = attachment.width; 119 120 if ( attachment.height ) 121 shortcode.height = attachment.height; 122 } 123 124 extension = attachment.filename.split('.').pop(); 125 126 if ( _.contains( wp.media.view.settings.embedExts, extension ) ) { 127 shortcode[extension] = attachment.url; 128 } else { 129 // Render unsupported audio and video files as links. 130 return wp.media.string.link( props ); 133 131 } 134 132 135 133 html = wp.shortcode.string({ 136 tag: 'audio', 137 attrs: shortcode 138 }); 139 140 return html; 141 }, 142 143 video: function( props, attachment ) { 144 var shortcode, html; 145 146 props = wp.media.string.props( props, attachment ); 147 148 shortcode = {}; 149 150 if ( attachment.width ) 151 shortcode.width = attachment.width; 152 153 if ( attachment.height ) 154 shortcode.height = attachment.height; 155 156 if ( props.mime ) { 157 switch ( props.mime ) { 158 case 'video/mp4': 159 shortcode.mp4 = attachment.url; 160 break; 161 case 'video/m4v': 162 shortcode.m4v = attachment.url; 163 break; 164 case 'video/webm': 165 shortcode.webm = attachment.url; 166 break; 167 case 'video/ogg': 168 shortcode.ogv = attachment.url; 169 break; 170 case 'video/x-ms-wmv': 171 case 'video/wmv': 172 case 'video/asf': 173 shortcode.wmv = attachment.url; 174 break; 175 case 'video/flv': 176 case 'video/x-flv': 177 shortcode.flv = attachment.url; 178 break; 179 } 180 } 181 182 html = wp.shortcode.string({ 183 tag: 'video', 134 tag: type, 184 135 attrs: shortcode 185 136 }); -
trunk/wp-includes/js/media-views.js
r24367 r24777 450 450 451 451 if ( ! displays[ attachment.cid ] ) 452 displays[ attachment.cid ] = new Backbone.Model( this. _defaultDisplaySettings);452 displays[ attachment.cid ] = new Backbone.Model( this.defaultDisplaySettings( attachment ) ); 453 453 454 454 return displays[ attachment.cid ]; 455 }, 456 457 defaultDisplaySettings: function( attachment ) { 458 settings = this._defaultDisplaySettings; 459 if ( settings.canEmbed = this.canEmbed( attachment ) ) 460 settings.link = 'embed'; 461 return settings; 462 }, 463 464 canEmbed: function( attachment ) { 465 var type = attachment.get('type'); 466 if ( type !== 'audio' && type !== 'video' ) 467 return false; 468 469 return _.contains( media.view.settings.embedExts, attachment.get('filename').split('.').pop() ); 455 470 }, 456 471 … … 3667 3682 attachment = this.options.attachment; 3668 3683 3669 if ( 'none' === linkTo || ( ! attachment && 'custom' !== linkTo ) ) {3684 if ( 'none' === linkTo || 'embed' === linkTo || ( ! attachment && 'custom' !== linkTo ) ) { 3670 3685 $input.hide(); 3671 3686 return; -
trunk/wp-includes/media-template.php
r24550 r24777 206 206 <# } #> 207 207 208 <# if ( data.fileLength ) { #> 209 <div class="file-length"><?php _e( 'Length:' ); ?> {{ data.fileLength }}</div> 210 <# } #> 211 208 212 <# if ( ! data.uploading && data.can.remove ) { #> 209 213 <a class="delete-attachment" href="#"><?php _e( 'Delete Permanently' ); ?></a> … … 282 286 <div class="setting"> 283 287 <label> 284 <span><?php _e('Link To'); ?></span> 288 <# if ( data.model.canEmbed ) { #> 289 <span><?php _e('Embed or Link'); ?></span> 290 <# } else { #> 291 <span><?php _e('Link To'); ?></span> 292 <# } #> 293 285 294 <select class="link-to" 286 295 data-setting="link" 287 <# if ( data.userSettings ) { #>296 <# if ( data.userSettings && ! data.model.canEmbed ) { #> 288 297 data-user-setting="urlbutton" 289 298 <# } #>> 290 299 300 <# if ( data.model.canEmbed && 'audio' === data.type ) { #> 301 <option value="embed" selected> 302 <?php esc_attr_e('Embed Audio Player'); ?> 303 </option> 304 <option value="file"> 305 <# } else if ( data.model.canEmbed && 'video' === data.type ) { #> 306 <option value="embed" selected> 307 <?php esc_attr_e('Embed Video Player'); ?> 308 </option> 309 <option value="file"> 310 <# } else { #> 311 <option value="file" selected> 312 <# } #> 313 <# if ( data.model.canEmbed ) { #> 314 <?php esc_attr_e('Link to Media File'); ?> 315 <# } else { #> 316 <?php esc_attr_e('Media File'); ?> 317 <# } #> 318 </option> 319 <option value="post"> 320 <# if ( data.model.canEmbed ) { #> 321 <?php esc_attr_e('Link to Attachment Page'); ?> 322 <# } else { #> 323 <?php esc_attr_e('Attachment Page'); ?> 324 <# } #> 325 </option> 326 <# if ( 'image' === data.type ) { #> 291 327 <option value="custom"> 292 328 <?php esc_attr_e('Custom URL'); ?> 293 329 </option> 294 <option value="file" selected>295 <?php esc_attr_e('Media File'); ?>296 </option>297 <option value="post">298 <?php esc_attr_e('Attachment Page'); ?>299 </option>300 330 <option value="none"> 301 331 <?php esc_attr_e('None'); ?> 302 332 </option> 333 <# } #> 303 334 </select> 304 335 </label> -
trunk/wp-includes/media.php
r24685 r24777 1700 1700 } 1701 1701 1702 if ( $meta && ( 'audio' === $type || 'video' === $type ) ) { 1703 if ( isset( $meta['length_formatted'] ) ) 1704 $response['fileLength'] = $meta['length_formatted']; 1705 } 1706 1702 1707 if ( function_exists('get_compat_media_markup') ) 1703 1708 $response['compat'] = get_compat_media_markup( $attachment->ID, array( 'in_modal' => true ) ); … … 1754 1759 ), 1755 1760 'defaultProps' => $props, 1761 'embedExts' => array_merge( wp_get_audio_extensions(), wp_get_video_extensions() ), 1756 1762 ); 1757 1763
Note: See TracChangeset
for help on using the changeset viewer.