Changeset 15688 for trunk/wp-includes/media.php
- Timestamp:
- 10/03/2010 02:58:59 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/media.php
r15590 r15688 1396 1396 $oembed->providers[$format] = array( $provider, $regex ); 1397 1397 } 1398 1399 /** 1400 * 1401 * 1402 * 1403 */ 1404 function get_media_buttons(){ 1405 $do_image = $do_audio = $do_video = true; 1406 if ( is_multisite() ) { 1407 $media_buttons = get_site_option( 'mu_media_buttons' ); 1408 if ( empty($media_buttons['image']) ) 1409 $do_image = false; 1410 if ( empty($media_buttons['audio']) ) 1411 $do_audio = false; 1412 if ( empty($media_buttons['video']) ) 1413 $do_video = false; 1414 } 1415 $out = ''; 1416 1417 if ( $do_image ) 1418 $out .= _media_button(__('Add an Image'), 'images/media-button-image.gif?ver=20100531', 'image'); 1419 if ( $do_video ) 1420 $out .= _media_button(__('Add Video'), 'images/media-button-video.gif?ver=20100531', 'video'); 1421 if ( $do_audio ) 1422 $out .= _media_button(__('Add Audio'), 'images/media-button-music.gif?ver=20100531', 'audio'); 1423 1424 $out .= _media_button(__('Add Media'), 'images/media-button-other.gif?ver=20100531', 'media'); 1425 1426 $context = apply_filters('media_buttons_context', __('Upload/Insert %s')); 1427 1428 return sprintf($context, $out); 1429 1430 1431 } 1432 1433 /** 1434 * {@internal Missing Short Description}} 1435 * 1436 * @since unknown 1437 */ 1438 function media_buttons() { 1439 echo get_media_buttons(); 1440 } 1441 add_action( 'media_buttons', 'media_buttons' ); 1442 1443 function _media_button($title, $icon, $type) { 1444 return "<a href='" . esc_url( get_upload_iframe_src($type) ) . "' id='add_$type' class='thickbox' title='$title'><img src='" . esc_url( admin_url( $icon ) ) . "' alt='$title' /></a>"; 1445 } 1446 1447 function get_upload_iframe_src($type) { 1448 global $post_ID, $temp_ID; 1449 $uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID); 1450 $upload_iframe_src = add_query_arg('post_id', $uploading_iframe_ID, 'media-upload.php'); 1451 1452 if ( 'media' != $type ) 1453 $upload_iframe_src = add_query_arg('type', $type, $upload_iframe_src); 1454 $upload_iframe_src = apply_filters($type . '_upload_iframe_src', $upload_iframe_src); 1455 1456 return add_query_arg('TB_iframe', true, $upload_iframe_src); 1457 }
Note: See TracChangeset
for help on using the changeset viewer.