WordPress.org

Make WordPress Core

Ticket #9393: 9393-media-fixes.diff

File 9393-media-fixes.diff, 1.9 KB (added by sivel, 6 years ago)

Misc media fixes, viewing and editing an image in the image library

  • wp-admin/includes/media.php

     
    430430                return media_send_to_editor($html); 
    431431        } 
    432432 
    433         return $errors; 
     433        return isset($errors) ? $errors : ''; 
    434434} 
    435435 
    436436/** 
     
    988988                        'label'      => __('File URL'), 
    989989                        'input'      => 'html', 
    990990                        'html'       => "<input type='text' class='urlfield' readonly='readonly' name='attachments[$post->ID][url]' value='" . attribute_escape($image_url) . "' /><br />", 
    991                         'value'      => $edit_post->post_url, 
     991                        'value'      => isset($edit_post->post_url) ? $edit_post->post_url : '', 
    992992                        'helps'      => __('Location of the uploaded file.'), 
    993993                ) 
    994994        ); 
     
    12231223        foreach ( $hidden_fields as $name => $value ) 
    12241224                $item .= "\t<input type='hidden' name='$name' id='$name' value='" . attribute_escape( $value ) . "' />\n"; 
    12251225 
    1226         if ( $post->post_parent < 1 && (int) $_REQUEST['post_id'] ) { 
     1226        if ( $post->post_parent < 1 && isset( $_REQUEST['post_id'] ) ) { 
    12271227                $parent = (int) $_REQUEST['post_id']; 
    12281228                $parent_name = "attachments[$attachment_id][post_parent]"; 
    12291229 
  • wp-admin/media.php

     
    9494 
    9595<p class="submit"> 
    9696<input type="submit" class="button-primary" name="save" value="<?php _e('Update Media'); ?>" /> 
    97 <input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" /> 
     97<input type="hidden" name="post_id" id="post_id" value="<?php echo isset($post_id) ? $post_id : ''; ?>" /> 
    9898<input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo $att_id; ?>" /> 
    9999<input type="hidden" name="action" value="editattachment" /> 
    100100<?php wp_original_referer_field(true, 'previous'); ?>