Prevent notices when post_id is not passed to the old media upload forms. props ldebrouwer. fixes #22465.

git-svn-id: https://develop.svn.wordpress.org/trunk@22628 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2012-11-17 06:42:14 +00:00
parent 436f8a519e
commit 2fb495eba6
1 changed files with 4 additions and 3 deletions

View File

@ -1377,7 +1377,8 @@ function get_compat_media_markup( $attachment_id, $args = null ) {
* @since 2.5.0
*/
function media_upload_header() {
echo '<script type="text/javascript">post_id = ' . intval( $_REQUEST['post_id'] ) . ";</script>\n";
$post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
echo '<script type="text/javascript">post_id = ' . $post_id . ";</script>\n";
if ( empty( $_GET['chromeless'] ) ) {
echo '<div id="media-upload-header">';
the_media_upload_tabs();
@ -1596,7 +1597,7 @@ function media_upload_type_url_form($type = null, $errors = null, $id = null) {
media_upload_header();
$post_id = intval($_REQUEST['post_id']);
$post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
$form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
$form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
@ -1871,7 +1872,7 @@ function media_upload_library_form($errors) {
media_upload_header();
$post_id = intval($_REQUEST['post_id']);
$post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
$form_action_url = admin_url("media-upload.php?type=$type&tab=library&post_id=$post_id");
$form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);