Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r12190 r12308  
    483483    if ( !empty($_POST['insertonlybutton']) ) {
    484484        $alt = $align = '';
    485         if ( !empty($_POST['insertonly']['embed-src']) ) {
    486             $src = $_POST['insertonly']['embed-src'];
    487             if ( !strpos($src, '://') )
    488                 $src = "http://$src";
    489             $html = '[embed]' . $src . '[/embed]';
    490         } else {
    491             $src = $_POST['insertonly']['src'];
    492             if ( !empty($src) && !strpos($src, '://') )
    493                 $src = "http://$src";
    494             $alt = esc_attr($_POST['insertonly']['alt']);
    495             if ( isset($_POST['insertonly']['align']) ) {
    496                 $align = esc_attr($_POST['insertonly']['align']);
    497                 $class = " class='align$align'";
    498             }
    499             if ( !empty($src) )
    500                 $html = "<img src='$src' alt='$alt'$class />";
     485
     486        $src = $_POST['insertonly']['src'];
     487        if ( !empty($src) && !strpos($src, '://') )
     488            $src = "http://$src";
     489        $alt = esc_attr($_POST['insertonly']['alt']);
     490        if ( isset($_POST['insertonly']['align']) ) {
     491            $align = esc_attr($_POST['insertonly']['align']);
     492            $class = " class='align$align'";
    501493        }
    502 
    503         $html = apply_filters('image_send_to_editor_url', $html, $src, $alt, $align);
     494        if ( !empty($src) )
     495            $html = "<img src='" . esc_url($src) . "' alt='$alt'$class />";
     496
     497        $html = apply_filters('image_send_to_editor_url', $html, esc_url_raw($src), $alt, $align);
    504498        return media_send_to_editor($html);
    505499    }
     
    597591            $href = "http://$href";
    598592
    599         $html = '[embed]' . $href . '[/embed]';
    600         $html = apply_filters('audio_send_to_editor_url', $html, $href);
     593        $title = esc_attr($_POST['insertonly']['title']);
     594        if ( empty($title) )
     595            $title = esc_attr( basename($href) );
     596
     597        if ( !empty($title) && !empty($href) )
     598            $html = "<a href='" . esc_url($href) . "' >$title</a>";
     599
     600        $html = apply_filters('audio_send_to_editor_url', $html, $href, $title);
     601
    601602        return media_send_to_editor($html);
    602603    }
     
    648649            $href = "http://$href";
    649650
    650         $html = '[embed]' . $href . '[/embed]';
    651         $html = apply_filters('video_send_to_editor_url', $html, $href);
     651        $title = esc_attr($_POST['insertonly']['title']);
     652        if ( empty($title) )
     653            $title = esc_attr( basename($href) );
     654
     655        if ( !empty($title) && !empty($href) )
     656            $html = "<a href='" . esc_url($href) . "' >$title</a>";
     657
     658        $html = apply_filters('video_send_to_editor_url', $html, $href, $title);
     659
    652660        return media_send_to_editor($html);
    653661    }
     
    703711            $title = basename($href);
    704712        if ( !empty($title) && !empty($href) )
    705             $html = "<a href='$href' >$title</a>";
    706         $html = apply_filters('file_send_to_editor_url', $html, $href, $title);
     713            $html = "<a href='" . esc_url($href) . "' >$title</a>";
     714        $html = apply_filters('file_send_to_editor_url', $html, esc_url_raw($href), $title);
    707715        return media_send_to_editor($html);
    708716    }
     
    10411049            'input'      => 'html',
    10421050            'html'       => "<input type='text' class='text urlfield' readonly='readonly' name='attachments[$post->ID][url]' value='" . esc_attr($image_url) . "' /><br />",
    1043             'value'      => isset($edit_post->post_url) ? $edit_post->post_url : wp_get_attachment_url($post->ID),
     1051            'value'      => wp_get_attachment_url($post->ID),
    10441052            'helps'      => __('Location of the uploaded file.')
    10451053        )
     
    11651173
    11661174    $display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case
    1167     $display_title = $show_title ? "<div class='filename new'>" . wp_html_excerpt($display_title, 60) . "</div>" : '';
     1175    $display_title = $show_title ? "<div class='filename new'><span class='title'>" . wp_html_excerpt($display_title, 60) . "</span></div>" : '';
    11681176
    11691177    $gallery = ( (isset($_REQUEST['tab']) && 'gallery' == $_REQUEST['tab']) || (isset($redir_tab) && 'gallery' == $redir_tab) ) ? true : false;
     
    12021210        <tr>
    12031211            <td class='A1B1' id='thumbnail-head-$post->ID' rowspan='5'><img class='thumbnail' src='$thumb_url' alt='' /></td>
    1204             <td>$filename</td>
     1212            <td><strong>" . __('File name:') . "</strong> $filename</td>
    12051213        </tr>
    1206         <tr><td>$post->post_mime_type</td></tr>
    1207         <tr><td>" . mysql2date(get_option('time_format'), $post->post_date) . "</td></tr>
    1208         <tr><td>" . apply_filters('media_meta', $media_dims, $post) . "</td></tr>
     1214        <tr><td><strong>" . __('File type:') . "</strong> $post->post_mime_type</td></tr>
     1215        <tr><td><strong>" . __('Upload date:') . "</strong> " . mysql2date( get_option('date_format'), $post->post_date ) . "</td></tr>
     1216        <tr><td><strong>" . __('Dimensions:') . "</strong> " . apply_filters('media_meta', $media_dims, $post) . "</td></tr>
    12091217        <tr><td class='A1B1'>$image_edit_button</td></tr>
    12101218        </thead>
     
    12261234            $delete = "<a href=\"" . wp_nonce_url("post.php?action=delete&amp;post=$attachment_id", 'delete-post_' . $attachment_id) . "\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Delete Permanently') . "</a>";
    12271235        else
    1228             $delete = "<a href=\"" . wp_nonce_url("post.php?action=trash&amp;post=$attachment_id", 'trash-post_' . $attachment_id) . "\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Move to Trash') . "</a> <a href=\"" . wp_nonce_url("post.php?action=untrash&amp;post=$attachment_id", 'untrash-post_' . $attachment_id) . "\" id=\"undo[$attachment_id]\" class=\"undo hidden\">" . __('Undo?') . "</a>";
     1236            $delete = "<a href=\"" . wp_nonce_url("post.php?action=trash&amp;post=$attachment_id", 'trash-post_' . $attachment_id) . "\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Move to Trash') . "</a> <a href=\"" . wp_nonce_url("post.php?action=untrash&amp;post=$attachment_id", 'untrash-post_' . $attachment_id) . "\" id=\"undo[$attachment_id]\" class=\"undo hidden\">" . __('Undo') . "</a>";
    12291237    } else {
    12301238        $delete = '';
    12311239    }
    12321240
     1241    $thumbnail = '';
    12331242    if ( 'image' == $type && current_theme_supports( 'post-thumbnails' ) && get_post_image_id($_GET['post_id']) != $attachment_id )
    12341243        $thumbnail = "<a class='wp-post-thumbnail' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\");return false;'>" . esc_html__( "Use as thumbnail" ) . "</a>";
     
    14311440    <p id="async-upload-wrap">
    14321441    <label class="screen-reader-text" for="async-upload"><?php _e('Upload'); ?></label>
    1433     <input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" name="html-upload" value="<?php esc_attr_e('Upload'); ?>" /> <a href="#" onclick="return top.tb_remove();"><?php _e('Cancel'); ?></a>
     1442    <input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" name="html-upload" value="<?php esc_attr_e('Upload'); ?>" /> <a href="#" onclick="try{top.tb_remove();}catch(e){}; return false;"><?php _e('Cancel'); ?></a>
    14341443    </p>
    14351444    <div class="clear"></div>
     
    14621471
    14631472<form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form type-form validate" id="<?php echo $type; ?>-form">
     1473<input type="submit" class="hidden" name="save" value="" />
    14641474<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
    14651475<?php wp_nonce_field('media-form'); ?>
     
    15381548        var t = this, html, f = document.forms[0], cls, title = '', alt = '', caption = '';
    15391549
    1540         if ( '' != document.getElementById('embed-src').value )
    1541             return true;
    1542 
    15431550        if ( '' == f.src.value || '' == t.width )
    15441551            return false;
     
    16581665<a href="#" id="asc"><?php _e('Ascending'); ?></a> |
    16591666<a href="#" id="desc"><?php _e('Descending'); ?></a> |
    1660 <a href="#" id="clear"><?php _e('Clear'); ?></a>
     1667<a href="#" id="clear"><?php echo _x('Clear', 'verb'); ?></a>
    16611668</div>
    16621669<form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form validate" id="gallery-form">
     
    18731880    $arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );
    18741881
    1875     if ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] )
     1882    if ( isset($_GET['m']) && ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] ) )
    18761883        $default = ' selected="selected"';
    18771884    else
     
    19501957
    19511958    return '
    1952     <h4 class="media-sub-title">' . __('Embed a picture from a web site that supports oEmbed') . '</h4>
    1953     <table class="describe"><tbody>
    1954         <tr>
    1955             <th valign="top" scope="row" class="label" style="width:130px;">
    1956                 <span class="alignleft"><label for="embed-src">' . __('Embed image') . '</label></span>
    1957                 <span class="alignright"><abbr title="required" class="required">*</abbr></span>
    1958             </th>
    1959             <td class="field"><input id="embed-src" name="insertonly[embed-src]" value="" type="text" /></td>
    1960         </tr>
    1961 
    1962         <tr>
    1963             <td></td>
    1964             <td>
    1965                 <input type="submit" class="button" name="insertonlybutton" value="' . esc_attr__('Embed') . '" />
    1966             </td>
    1967         </tr>
    1968     </tbody></table>
    1969 
    19701959    <h4 class="media-sub-title">' . __('Insert an image from another web site') . '</h4>
    19711960    <table class="describe"><tbody>
     
    20472036            <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
    20482037        </tr>
    2049 
     2038        <tr>
     2039            <th valign="top" scope="row" class="label">
     2040                <span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
     2041                <span class="alignright"><abbr title="required" class="required">*</abbr></span>
     2042            </th>
     2043            <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
     2044        </tr>
     2045        <tr><td></td><td class="help">' . __('Link text, e.g. &#8220;Still Alive by Jonathan Coulton&#8221;') . '</td></tr>
    20502046        <tr>
    20512047            <td></td>
     
    20752071            <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
    20762072        </tr>
    2077 
     2073        <tr>
     2074            <th valign="top" scope="row" class="label">
     2075                <span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
     2076                <span class="alignright"><abbr title="required" class="required">*</abbr></span>
     2077            </th>
     2078            <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
     2079        </tr>
     2080        <tr><td></td><td class="help">' . __('Link text, e.g. &#8220;Lucy on YouTube&#8220;') . '</td></tr>
    20782081        <tr>
    20792082            <td></td>
Note: See TracChangeset for help on using the changeset viewer.