From a12587214f11c036874f4c47819867cd848785be Mon Sep 17 00:00:00 2001 From: azaozz Date: Wed, 22 Apr 2009 12:24:45 +0000 Subject: [PATCH] Notice fixes, props sivel, see #9393 git-svn-id: http://svn.automattic.com/wordpress/trunk@11052 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin.php | 3 ++- wp-admin/includes/media.php | 19 +++++++++++++------ wp-admin/media.php | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/wp-admin/admin.php b/wp-admin/admin.php index 503e4ed2df..ac7f08b197 100644 --- a/wp-admin/admin.php +++ b/wp-admin/admin.php @@ -11,7 +11,8 @@ * * @since unknown */ -define('WP_ADMIN', TRUE); +if ( !defined('WP_ADMIN') ) + define('WP_ADMIN', TRUE); if ( defined('ABSPATH') ) require_once(ABSPATH . 'wp-load.php'); diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 0f427271ad..1202b3291e 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -396,6 +396,8 @@ function media_upload_form_handler() { if ( isset($post['errors']) ) { $errors[$attachment_id] = $post['errors']; unset($post['errors']); + } else { + $errors = array(); } if ( $post != $_post ) @@ -429,7 +431,7 @@ function media_upload_form_handler() { return media_send_to_editor($html); } - return $errors; + return isset($errors) ? $errors : ''; } /** @@ -987,7 +989,7 @@ function get_attachment_fields_to_edit($post, $errors = null) { 'label' => __('File URL'), 'input' => 'html', 'html' => "
", - 'value' => $edit_post->post_url, + 'value' => isset($edit_post->post_url) ? $edit_post->post_url : '', 'helps' => __('Location of the uploaded file.'), ) ); @@ -1222,7 +1224,7 @@ function get_media_item( $attachment_id, $args = null ) { foreach ( $hidden_fields as $name => $value ) $item .= "\t\n"; - if ( $post->post_parent < 1 && (int) $_REQUEST['post_id'] ) { + if ( $post->post_parent < 1 && isset($_REQUEST['post_id']) ) { $parent = (int) $_REQUEST['post_id']; $parent_name = "attachments[$attachment_id][post_parent]"; @@ -1700,7 +1702,7 @@ function media_upload_library_form($errors) { - +
  • 'all', 'paged'=>false, 'm'=>false))) . "'$class>".__('All Types').""; foreach ( $post_mime_types as $mime_type => $label ) { $class = ''; @@ -1730,7 +1737,7 @@ foreach ( $post_mime_types as $mime_type => $label ) { if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) ) continue; - if ( wp_match_mime_types($mime_type, $_GET['post_mime_type']) ) + if ( isset($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']) ) $class = ' class="current"'; $type_links[] = "
  • $mime_type, 'paged'=>false))) . "'$class>" . sprintf(_n($label[2][0], $label[2][1], $num_posts[$mime_type]), "" . number_format_i18n( $num_posts[$mime_type] ) . '') . ''; diff --git a/wp-admin/media.php b/wp-admin/media.php index 906238f7d0..a22da8a4d2 100644 --- a/wp-admin/media.php +++ b/wp-admin/media.php @@ -94,7 +94,7 @@ case 'edit' :

    - +