Make WordPress Core


Ignore:
Timestamp:
02/24/2008 04:34:40 AM (18 years ago)
Author:
ryan
Message:

disregard nonexistant attachments. Props andy. fixes #5967

File:
1 edited

Legend:

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

    r6997 r7002  
    237237        return '';
    238238
    239     foreach ( $attachments as $id => $attachment ) {
    240         $output .= "\n<div id='multimedia-item-$id' class='multimedia-item preloaded'><div id='media-upload-error-$id'></div><span class='filename'></span><div class='progress'><div class='bar'></div></div>";
    241         $output .= get_multimedia_item($id, isset($errors[$id]) ? $errors[$id] : null);
    242         $output .= "    <div class='progress clickmask'></div>\n</div>";
    243     }
     239    foreach ( $attachments as $id => $attachment )
     240        if ( $item = get_multimedia_item($id, isset($errors[$id]) ? $errors[$id] : null) )
     241            $output .= "\n<div id='multimedia-item-$id' class='multimedia-item preloaded'><div id='media-upload-error-$id'></div><span class='filename'></span><div class='progress'><div class='bar'></div></div>$item<div class='progress clickmask'></div>\n</div>";
    244242
    245243    return $output;
     
    419417
    420418function get_multimedia_item( $attachment_id, $errors = null, $send = true ) {
    421     $thumb_url = array_shift(get_attachment_icon_src( $attachment_id ));
     419    if ( ( $attachment_id = intval($attachment_id) ) && $thumb_url = get_attachment_icon_src( $attachment_id ) )
     420        $thumb_url = $thumb_url[1];
     421    else
     422        return false;
    422423
    423424    $title_label = __('Title');
Note: See TracChangeset for help on using the changeset viewer.