Changeset 16535 for trunk/wp-includes/media.php
- Timestamp:
- 11/22/2010 05:17:26 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/media.php
r16358 r16535 1398 1398 $oembed->providers[$format] = array( $provider, $regex ); 1399 1399 } 1400 1401 /**1402 * Generate HTML for the editor media buttons (image, video, audio).1403 *1404 * @since 3.1.01405 *1406 * @return string HTML1407 */1408 function get_media_buttons() {1409 $do_image = $do_audio = $do_video = true;1410 if ( is_multisite() ) {1411 $media_buttons = get_site_option( 'mu_media_buttons' );1412 if ( empty( $media_buttons['image'] ) )1413 $do_image = false;1414 if ( empty( $media_buttons['audio'] ) )1415 $do_audio = false;1416 if ( empty( $media_buttons['video'] ) )1417 $do_video = false;1418 }1419 $out = '';1420 1421 if ( $do_image )1422 $out .= _media_button( __( 'Add an Image' ), 'images/media-button-image.gif?ver=20100531', 'image' );1423 if ( $do_video )1424 $out .= _media_button( __( 'Add Video' ), 'images/media-button-video.gif?ver=20100531', 'video' );1425 if ( $do_audio )1426 $out .= _media_button( __( 'Add Audio' ), 'images/media-button-music.gif?ver=20100531', 'audio' );1427 1428 $out .= _media_button( __( 'Add Media' ), 'images/media-button-other.gif?ver=20100531', 'media' );1429 1430 $context = apply_filters( 'media_buttons_context', __( 'Upload/Insert: %s' ) );1431 1432 return sprintf($context, $out);1433 1434 1435 }1436 1437 /**1438 * {@internal Missing Short Description}}1439 *1440 * @since unknown1441 */1442 function media_buttons() {1443 echo get_media_buttons();1444 }1445 add_action( 'media_buttons', 'media_buttons' );1446 1447 /**1448 * {@internal Missing Short Description}}1449 *1450 * @since unknown1451 * @access private1452 */1453 function _media_button( $title, $icon, $type ) {1454 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>";1455 }1456 1457 /**1458 * {@internal Missing Short Description}}1459 *1460 * @since unknown1461 */1462 function get_upload_iframe_src( $type ) {1463 global $post_ID, $temp_ID;1464 $uploading_iframe_ID = (int) ( 0 == $post_ID ? $temp_ID : $post_ID );1465 $upload_iframe_src = add_query_arg( 'post_id', $uploading_iframe_ID, 'media-upload.php' );1466 1467 if ( 'media' != $type )1468 $upload_iframe_src = add_query_arg( 'type', $type, $upload_iframe_src );1469 $upload_iframe_src = apply_filters( $type . '_upload_iframe_src', $upload_iframe_src );1470 1471 return add_query_arg( 'TB_iframe', true, $upload_iframe_src );1472 }
Note: See TracChangeset
for help on using the changeset viewer.