WordPress.org

Make WordPress Core


Ignore:
Timestamp:
06/10/2008 04:13:06 PM (14 years ago)
Author:
ryan
Message:

Press This improvements from noel. fixes #7117

File:
1 edited

Legend:

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

    r8048 r8067  
    117117
    118118
    119 function media_sideload_image($file, $post_id) {
     119function media_sideload_image($file, $post_id, $desc = null) {
    120120
    121121    if (!empty($file) ) {
     
    124124        $file_array['name'] = basename($file);
    125125        $file_array['tmp_name'] = download_url($file);
     126        $desc = @$desc;
    126127       
    127         $sideload = media_handle_sideload($file_array, $post_id);
     128        $sideload = media_handle_sideload($file_array, $post_id, $desc);
    128129
    129130        $id = $sideload['id'];
     
    142143       
    143144        $src = "http://$src";
    144         /*$alt = attribute_escape($_POST['insertonly']['alt']);
    145         if ( isset($_POST['insertonly']['align']) ) {
    146             $align = attribute_escape($_POST['insertonly']['align']);
    147             $class = " class='align$align'";
    148         } */
     145        $alt = @$desc;
     146       
    149147        if ( !empty($src) )
    150             $html = "<img src='$src' alt='$alt'$class />";
     148            $html = "<img src='$src' alt='$alt' />";
    151149            return $html;
    152150   
    153151}
    154152
    155 function media_handle_sideload($file_array, $post_id, $post_data = array()) {
     153function media_handle_sideload($file_array, $post_id, $desc = null, $post_data = array()) {
    156154    $overrides = array('test_form'=>false);
    157155    $file = wp_handle_sideload($file_array, $overrides);
     
    173171            $content = $image_meta['caption'];
    174172    }
     173   
     174    $title = @$desc;
    175175
    176176    // Construct the attachment array
Note: See TracChangeset for help on using the changeset viewer.