Make WordPress Core


Ignore:
Timestamp:
10/05/2011 09:07:04 PM (13 years ago)
Author:
nacin
Message:

UI touches for the single media button. see #17578.

File:
1 edited

Legend:

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

    r18831 r18890  
    375375 */
    376376function media_buttons($editor_id = 'content') {
    377     $out = _media_button(__('Add Media'), 'images/media-button-video.gif?ver=20100531', 'media', $editor_id);
    378 
    379377    $context = apply_filters('media_buttons_context', __('Upload/Insert %s'));
    380378
    381     printf($context, $out);
     379    $img = '<img src="' . esc_url( admin_url( 'images/media-button.png?ver=20111005' ) ) . '" width="15" height="15" />';
     380
     381    echo '<a href="' . esc_url( get_upload_iframe_src() ) . '" class="thickbox add_media" id="$editor_id-add_media" title="' . esc_attr__( 'Add Media' ) . '" onclick="return false;">' . sprintf( $context, $img ) . '</a>';
    382382}
    383383add_action( 'media_buttons', 'media_buttons' );
    384384
    385385function _media_button($title, $icon, $type, $id) {
    386     return "<a href='" . esc_url( get_upload_iframe_src($type) ) . "' id='{$id}-add_{$type}' class='thickbox add_$type' title='$title'><img src='" . esc_url( admin_url( $icon ) ) . "' alt='$title' onclick='return false;' /></a>";
    387 }
    388 
    389 function get_upload_iframe_src($type) {
     386    return "<a href='" . esc_url( get_upload_iframe_src($type) ) . "' id='{$id}-add_{$type}' class='thickbox add_$type' title='" . esc_attr( $title ) . "'><img src='" . esc_url( admin_url( $icon ) ) . "' alt='$title' onclick='return false;' /></a>";
     387}
     388
     389function get_upload_iframe_src( $type = null ) {
    390390    global $post_ID;
    391391
     
    393393    $upload_iframe_src = add_query_arg( 'post_id', $uploading_iframe_ID, admin_url('media-upload.php') );
    394394
    395     if ( 'media' != $type )
     395    if ( $type && 'media' != $type )
    396396        $upload_iframe_src = add_query_arg('type', $type, $upload_iframe_src);
    397397
     
    14571457<?php wp_nonce_field('media-form'); ?>
    14581458
    1459 <h3 class="media-title"><?php _e('Add media file from URL'); ?></h3>
     1459<h3 class="media-title"><?php _e('Insert media from another website'); ?></h3>
    14601460
    14611461<script type="text/javascript">
     
    18911891
    18921892    return '
    1893     <h4 class="media-sub-title">' . __('Insert media from another web site') . '</h4>
    1894     <p class="media-types"><label><input type="radio" name="media_type" value="image" id="image-only"' . checked( 'image-only', $view, false ) . ' /> ' . __( 'Images' ) . '</label> &nbsp; &nbsp; <label><input type="radio" name="media_type" value="generic" id="not-image"' . checked( 'not-image', $view, false ) . ' /> ' . __( 'Audio, Video, or Files' ) . '</label></p>
     1893    <p class="media-types"><label><input type="radio" name="media_type" value="image" id="image-only"' . checked( 'image-only', $view, false ) . ' /> ' . __( 'Image' ) . '</label> &nbsp; &nbsp; <label><input type="radio" name="media_type" value="generic" id="not-image"' . checked( 'not-image', $view, false ) . ' /> ' . __( 'Audio, Video, or Other File' ) . '</label></p>
    18951894    <table class="describe ' . $table_class . '"><tbody>
    18961895        <tr>
Note: See TracChangeset for help on using the changeset viewer.