Make WordPress Core


Ignore:
Timestamp:
10/03/2010 03:08:39 AM (14 years ago)
Author:
nacin
Message:

Docs and breathing room for get_media_buttons() and friends. see #14966.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/media.php

    r15688 r15689  
    13981398
    13991399/**
    1400  *
    1401  *
    1402  *
    1403  */
    1404 function get_media_buttons(){
     1400 * Generate HTML for the editor media buttons (image, video, audio).
     1401 *
     1402 * @since 3.1.0
     1403 *
     1404 * @return string HTML
     1405 */
     1406function get_media_buttons() {
    14051407    $do_image = $do_audio = $do_video = true;
    14061408    if ( is_multisite() ) {
    14071409        $media_buttons = get_site_option( 'mu_media_buttons' );
    1408         if ( empty($media_buttons['image']) )
     1410        if ( empty( $media_buttons['image'] ) )
    14091411            $do_image = false;
    1410         if ( empty($media_buttons['audio']) )
     1412        if ( empty( $media_buttons['audio'] ) )
    14111413            $do_audio = false;
    1412         if ( empty($media_buttons['video']) )
     1414        if ( empty( $media_buttons['video'] ) )
    14131415            $do_video = false;
    14141416    }
     
    14161418
    14171419    if ( $do_image )
    1418         $out .= _media_button(__('Add an Image'), 'images/media-button-image.gif?ver=20100531', 'image');
     1420        $out .= _media_button( __( 'Add an Image' ), 'images/media-button-image.gif?ver=20100531', 'image' );
    14191421    if ( $do_video )
    1420         $out .= _media_button(__('Add Video'), 'images/media-button-video.gif?ver=20100531', 'video');
     1422        $out .= _media_button( __( 'Add Video' ), 'images/media-button-video.gif?ver=20100531', 'video' );
    14211423    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'));
     1424        $out .= _media_button( __( 'Add Audio' ), 'images/media-button-music.gif?ver=20100531', 'audio' );
     1425
     1426    $out .= _media_button( __( 'Add Media' ), 'images/media-button-other.gif?ver=20100531', 'media' );
     1427
     1428    $context = apply_filters( 'media_buttons_context', __( 'Upload/Insert %s' ) );
    14271429
    14281430    return sprintf($context, $out);
     
    14411443add_action( 'media_buttons', 'media_buttons' );
    14421444
    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) {
     1445/**
     1446 * {@internal Missing Short Description}}
     1447 *
     1448 * @since unknown
     1449 * @access private
     1450 */
     1451function _media_button( $title, $icon, $type ) {
     1452    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>";
     1453}
     1454
     1455/**
     1456 * {@internal Missing Short Description}}
     1457 *
     1458 * @since unknown
     1459 */
     1460function get_upload_iframe_src( $type ) {
    14481461    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');
     1462    $uploading_iframe_ID = (int) ( 0 == $post_ID ? $temp_ID : $post_ID );
     1463    $upload_iframe_src = add_query_arg( 'post_id', $uploading_iframe_ID, 'media-upload.php' );
    14511464
    14521465    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 }
     1466        $upload_iframe_src = add_query_arg( 'type', $type, $upload_iframe_src );
     1467    $upload_iframe_src = apply_filters( $type . '_upload_iframe_src', $upload_iframe_src );
     1468
     1469    return add_query_arg( 'TB_iframe', true, $upload_iframe_src );
     1470}
Note: See TracChangeset for help on using the changeset viewer.