Ticket #39667: 39667-2.diff
File 39667-2.diff, 4.0 KB (added by , 8 years ago) |
---|
-
src/wp-includes/functions.php
diff --git src/wp-includes/functions.php src/wp-includes/functions.php index ee214e9..e78275b 100644
function size_format( $bytes, $decimals = 0 ) { 274 274 } 275 275 276 276 /** 277 * Function will return duration/ file length in human readable format. 278 * This will be used for making readable string from duration. 279 * @since 4.8 280 * @param string $filelength duration will be in string format (HH:ii:ss) OR (ii:ss). 281 * @return boolean | string return human readable string, false otherwise. 282 */ 283 function duration_format( $filelength='' ){ 284 // return false if filelenght is enmpty 285 if( empty( $filelength ) ){ 286 287 return false; 288 } 289 290 $human_readable_duration=false; 291 292 // extract hour minutes and seconds 293 list ($second, $minute, $hour) = array_reverse ( explode ( ':', $filelength ) ); 294 295 if( !empty( $hour ) ){ 296 /* translators: Time duration in hour or hours*/ 297 $human_readable_duration .= sprintf( _n( '%s hour', '%s hours', $hour ), $hour ).' '; 298 } 299 300 if( !empty( $minute) ){ 301 /* translators: Time duration in minute or minutes*/ 302 $human_readable_duration .= sprintf( _n( '%s minute', '%s minutes', $minute ), $minute ).' '; 303 } 304 305 if( !empty( $second ) ){ 306 /* translators: Time duration in second or seconds*/ 307 $human_readable_duration .= sprintf( _n( '%s second', '%s seconds', $second ), $second ); 308 } 309 // return human readable duration 310 return $human_readable_duration; 311 312 } 313 314 /** 277 315 * Get the week start and end from the datetime or date string from MySQL. 278 316 * 279 317 * @since 0.71 -
src/wp-includes/media-template.php
diff --git src/wp-includes/media-template.php src/wp-includes/media-template.php index 7f59935..aa3f2b4 100644
function wp_print_media_templates() { 344 344 <div class="file-size"><strong><?php _e( 'File size:' ); ?></strong> {{ data.filesizeHumanReadable }}</div> 345 345 <# if ( 'image' === data.type && ! data.uploading ) { #> 346 346 <# if ( data.width && data.height ) { #> 347 <div class="dimensions"><strong><?php _e( 'Dimensions:' ); ?></strong> {{ data.width }} × {{ data.height }}</div> 347 <div class="dimensions"><strong><?php _e( 'Dimensions:' ); ?></strong> 348 <?php 349 /* translators: 1: a number of pixels wide, 2: a number of pixels tall */ 350 printf( __( '%1$s by %2$s pixels' ),'{{ data.width }}', '{{ data.height }}' ); 351 ?> 352 </div> 348 353 <# } #> 349 354 <# } #> 350 355 351 356 <# if ( data.fileLength ) { #> 352 <div class="file-length"><strong><?php _e( 'Length:' ); ?></strong> {{ data.fileLength }}</div> 357 <div class="file-length"><strong><?php _e( 'Length:' ); ?></strong> 358 <span aria-label="{{ data.fileLengthHumanReadable }}">{{ data.fileLength }}</span> 359 </div> 353 360 <# } #> 354 361 355 362 <# if ( 'audio' === data.type && data.meta.bitrate ) { #> -
src/wp-includes/media.php
diff --git src/wp-includes/media.php src/wp-includes/media.php index 0c83725..71e94e3 100644
function wp_prepare_attachment_for_js( $attachment ) { 3219 3219 } 3220 3220 3221 3221 if ( $meta && ( 'audio' === $type || 'video' === $type ) ) { 3222 if ( isset( $meta['length_formatted'] ) ) 3223 $response['fileLength'] = $meta['length_formatted']; 3222 if ( isset( $meta['length_formatted'] ) ){ 3223 $response['fileLength'] = $meta['length_formatted']; 3224 $response['fileLengthHumanReadable'] = duration_format( $meta['length_formatted'] ); 3225 } 3224 3226 3225 3227 $response['meta'] = array(); 3226 3228 foreach ( wp_get_attachment_id3_keys( $attachment, 'js' ) as $key => $label ) {