<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[18831] trunk/wp-admin: Merge the four media buttons into one.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/18831">18831</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2011-09-30 06:22:29 +0000 (Fri, 30 Sep 2011)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge the four media buttons into one.
* Lots of red.
* Removes the type_url_form_\$type filter, where \$type is audio, video, file, or image.
* Replacement filter is a generic type_url_form_media filter for the new unified form.
* Some functions have gone missing; they'll be restored and deprecated in a later pass.
see <a href="http://core.trac.wordpress.org/ticket/17578">#17578</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmincssmediadevcss">trunk/wp-admin/css/media.dev.css</a></li>
<li><a href="#trunkwpadminincludesmediaphp">trunk/wp-admin/includes/media.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincssmediadevcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/media.dev.css (18830 => 18831)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/media.dev.css        2011-09-30 05:26:40 UTC (rev 18830)
+++ trunk/wp-admin/css/media.dev.css        2011-09-30 06:22:29 UTC (rev 18831)
</span><span class="lines">@@ -362,3 +362,18 @@
</span><span class="cx">         margin-right: 25px;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+p.media-types {
+        margin: 1em;
+}
+
+tr.not-image {
+        display: none;
+}
+
+table.not-image tr.not-image {
+        display: table-row;
+}
+
+table.not-image tr.image-only {
+        display: none;
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/media.php (18830 => 18831)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/media.php        2011-09-30 05:26:40 UTC (rev 18830)
+++ trunk/wp-admin/includes/media.php        2011-09-30 06:22:29 UTC (rev 18831)
</span><span class="lines">@@ -374,22 +374,8 @@
</span><span class="cx"> * @since 2.5.0
</span><span class="cx"> */
</span><span class="cx"> function media_buttons($editor_id = 'content') {
</span><del>-        $out = '';
</del><ins>+        $out = _media_button(__('Add Media'), 'images/media-button-video.gif?ver=20100531', 'media', $editor_id);
</ins><span class="cx">
</span><del>-        if ( is_multisite() )
-                $_buttons = get_site_option('mu_media_buttons');
-        else
-                $_buttons = array( 'image' => true, 'video' => true, 'audio' => true );
-
-        if ( !empty($_buttons['image']) )
-                $out .= _media_button(__('Add an Image'), 'images/media-button-image.gif?ver=20100531', 'image', $editor_id);
-        if ( !empty($_buttons['video']) )
-                $out .= _media_button(__('Add Video'), 'images/media-button-video.gif?ver=20100531', 'video', $editor_id);
-        if ( !empty($_buttons['audio']) )
-                $out .= _media_button(__('Add Audio'), 'images/media-button-music.gif?ver=20100531', 'audio', $editor_id);
-
-        $out .= _media_button(__('Add Media'), 'images/media-button-other.gif?ver=20100531', 'media', $editor_id);
-
</del><span class="cx">         $context = apply_filters('media_buttons_context', __('Upload/Insert %s'));
</span><span class="cx">
</span><span class="cx">         printf($context, $out);
</span><span class="lines">@@ -529,20 +515,37 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         if ( !empty($_POST['insertonlybutton']) ) {
</span><del>-                $alt = $align = '';
-
</del><span class="cx">                 $src = $_POST['insertonly']['src'];
</span><span class="cx">                 if ( !empty($src) && !strpos($src, '://') )
</span><span class="cx">                         $src = "http://$src";
</span><del>-                $alt = esc_attr($_POST['insertonly']['alt']);
-                if ( isset($_POST['insertonly']['align']) ) {
-                        $align = esc_attr($_POST['insertonly']['align']);
-                        $class = " class='align$align'";
</del><ins>+
+                if ( isset( $_POST['media_type'] ) && 'image' != $_POST['media_type'] ) {
+                        $title = esc_attr($_POST['insertonly']['title']);
+                        if ( empty($title) )
+                                $title = esc_attr( basename($src) );
+
+                        if ( !empty($title) && !empty($src) )
+                                $html = "<a href='" . esc_url($src) . "' >$title</a>";
+
+                        $type = 'file';
+                        if ( $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ) && $ext_type = wp_ext2type( $ext )
+                                && ( 'audio' == $ext_type || 'video' == $ext_type ) )
+                                        $type = $ext_type;
+
+                        $html = apply_filters( $type . '_send_to_editor_url', $html, esc_url_raw( $src ), $title );
+                } else {
+                        $align = '';
+                        $alt = esc_attr($_POST['insertonly']['alt']);
+                        if ( isset($_POST['insertonly']['align']) ) {
+                                $align = esc_attr($_POST['insertonly']['align']);
+                                $class = " class='align$align'";
+                        }
+                        if ( !empty($src) )
+                                $html = "<img src='" . esc_url($src) . "' alt='$alt'$class />";
+
+                        $html = apply_filters( 'image_send_to_editor_url', $html, esc_url_raw( $src ), $alt, $align );
</ins><span class="cx">                 }
</span><del>-                if ( !empty($src) )
-                        $html = "<img src='" . esc_url($src) . "' alt='$alt'$class />";
</del><span class="cx">
</span><del>-                $html = apply_filters('image_send_to_editor_url', $html, esc_url_raw($src), $alt, $align);
</del><span class="cx">                 return media_send_to_editor($html);
</span><span class="cx">         }
</span><span class="cx">
</span><span class="lines">@@ -560,8 +563,12 @@
</span><span class="cx">                 return media_upload_gallery();
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' )
-                return wp_iframe( 'media_upload_type_url_form', 'image', $errors, $id );
</del><ins>+        if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' ) {
+                $type = 'image';
+                if ( isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'video', 'audio', 'file' ) ) )
+                        $type = $_GET['type'];
+                return wp_iframe( 'media_upload_type_url_form', $type, $errors, $id );
+        }
</ins><span class="cx">
</span><span class="cx">         return wp_iframe( 'media_upload_type_form', 'image', $errors, $id );
</span><span class="cx"> }
</span><span class="lines">@@ -619,180 +626,6 @@
</span><span class="cx"> *
</span><span class="cx"> * @return unknown
</span><span class="cx"> */
</span><del>-function media_upload_audio() {
-        $errors = array();
-        $id = 0;
-
-        if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
-                check_admin_referer('media-form');
-                // Upload File button was clicked
-                $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
-                unset($_FILES);
-                if ( is_wp_error($id) ) {
-                        $errors['upload_error'] = $id;
-                        $id = false;
-                }
-        }
-
-        if ( !empty($_POST['insertonlybutton']) ) {
-                $href = $_POST['insertonly']['href'];
-                if ( !empty($href) && !strpos($href, '://') )
-                        $href = "http://$href";
-
-                $title = esc_attr($_POST['insertonly']['title']);
-                if ( empty($title) )
- $title = esc_attr( basename($href) );
-
-                if ( !empty($title) && !empty($href) )
- $html = "<a href='" . esc_url($href) . "' >$title</a>";
-
-                $html = apply_filters('audio_send_to_editor_url', $html, $href, $title);
-
-                return media_send_to_editor($html);
-        }
-
-        if ( !empty($_POST) ) {
-                $return = media_upload_form_handler();
-
-                if ( is_string($return) )
-                        return $return;
-                if ( is_array($return) )
-                        $errors = $return;
-        }
-
-        if ( isset($_POST['save']) ) {
-                $errors['upload_notice'] = __('Saved.');
-                return media_upload_gallery();
-        }
-
-        if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' )
-                return wp_iframe( 'media_upload_type_url_form', 'audio', $errors, $id );
-
-        return wp_iframe( 'media_upload_type_form', 'audio', $errors, $id );
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since 2.5.0
- *
- * @return unknown
- */
-function media_upload_video() {
-        $errors = array();
-        $id = 0;
-
-        if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
-                check_admin_referer('media-form');
-                // Upload File button was clicked
-                $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
-                unset($_FILES);
-                if ( is_wp_error($id) ) {
-                        $errors['upload_error'] = $id;
-                        $id = false;
-                }
-        }
-
-        if ( !empty($_POST['insertonlybutton']) ) {
-                $href = $_POST['insertonly']['href'];
-                if ( !empty($href) && !strpos($href, '://') )
-                        $href = "http://$href";
-
-                $title = esc_attr($_POST['insertonly']['title']);
- if ( empty($title) )
- $title = esc_attr( basename($href) );
-
-                if ( !empty($title) && !empty($href) )
- $html = "<a href='" . esc_url($href) . "' >$title</a>";
-
-                $html = apply_filters('video_send_to_editor_url', $html, $href, $title);
-
-                return media_send_to_editor($html);
-        }
-
-        if ( !empty($_POST) ) {
-                $return = media_upload_form_handler();
-
-                if ( is_string($return) )
-                        return $return;
-                if ( is_array($return) )
-                        $errors = $return;
-        }
-
-        if ( isset($_POST['save']) ) {
-                $errors['upload_notice'] = __('Saved.');
-                return media_upload_gallery();
-        }
-
-        if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' )
-                return wp_iframe( 'media_upload_type_url_form', 'video', $errors, $id );
-
-        return wp_iframe( 'media_upload_type_form', 'video', $errors, $id );
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since 2.5.0
- *
- * @return unknown
- */
-function media_upload_file() {
-        $errors = array();
-        $id = 0;
-
-        if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
-                check_admin_referer('media-form');
-                // Upload File button was clicked
-                $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
-                unset($_FILES);
-                if ( is_wp_error($id) ) {
-                        $errors['upload_error'] = $id;
-                        $id = false;
-                }
-        }
-
-        if ( !empty($_POST['insertonlybutton']) ) {
-                $href = $_POST['insertonly']['href'];
-                if ( !empty($href) && !strpos($href, '://') )
-                        $href = "http://$href";
-
-                $title = esc_attr($_POST['insertonly']['title']);
-                if ( empty($title) )
-                        $title = basename($href);
-                if ( !empty($title) && !empty($href) )
-                        $html = "<a href='" . esc_url($href) . "' >$title</a>";
-                $html = apply_filters('file_send_to_editor_url', $html, esc_url_raw($href), $title);
-                return media_send_to_editor($html);
-        }
-
-        if ( !empty($_POST) ) {
-                $return = media_upload_form_handler();
-
-                if ( is_string($return) )
-                        return $return;
-                if ( is_array($return) )
-                        $errors = $return;
-        }
-
-        if ( isset($_POST['save']) ) {
-                $errors['upload_notice'] = __('Saved.');
-                return media_upload_gallery();
-        }
-
-        if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' )
-                return wp_iframe( 'media_upload_type_url_form', 'file', $errors, $id );
-
-        return wp_iframe( 'media_upload_type_form', 'file', $errors, $id );
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since 2.5.0
- *
- * @return unknown
- */
</del><span class="cx"> function media_upload_gallery() {
</span><span class="cx">         $errors = array();
</span><span class="cx">
</span><span class="lines">@@ -1607,23 +1440,22 @@
</span><span class="cx"> * @param unknown_type $errors
</span><span class="cx"> * @param unknown_type $id
</span><span class="cx"> */
</span><del>-function media_upload_type_url_form($type = 'file', $errors = null, $id = null) {
</del><ins>+function media_upload_type_url_form($type = null, $errors = null, $id = null) {
+        if ( null === $type )
+                $type = 'image';
+
</ins><span class="cx">         media_upload_header();
</span><span class="cx">
</span><span class="cx">         $post_id = intval($_REQUEST['post_id']);
</span><span class="cx">
</span><span class="cx">         $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
</span><span class="cx">         $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
</span><del>-
-        $callback = "type_url_form_$type";
</del><span class="cx"> ?>
</span><span class="cx">
</span><span class="cx"> <form enctype="multipart/form-data" method="post" action="<?php echo esc_attr($form_action_url); ?>" class="media-upload-form type-form validate" id="<?php echo $type; ?>-form">
</span><span class="cx"> <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
</span><span class="cx"> <?php wp_nonce_field('media-form'); ?>
</span><span class="cx">
</span><del>-<?php if ( is_callable($callback) ) { ?>
-
</del><span class="cx"> <h3 class="media-title"><?php _e('Add media file from URL'); ?></h3>
</span><span class="cx">
</span><span class="cx"> <script type="text/javascript">
</span><span class="lines">@@ -1690,10 +1522,11 @@
</span><span class="cx">         getImageData : function() {
</span><span class="cx">                 var t = addExtImage, src = document.forms[0].src.value;
</span><span class="cx">
</span><del>-                if ( ! src ) {
</del><ins>+                if ( ! src || jQuery('table.describe').hasClass('not-image') ) {
</ins><span class="cx">                         t.resetImageData();
</span><span class="cx">                         return false;
</span><span class="cx">                 }
</span><ins>+
</ins><span class="cx">                 document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />';
</span><span class="cx">                 t.preloadImg = new Image();
</span><span class="cx">                 t.preloadImg.onload = t.updateImageData;
</span><span class="lines">@@ -1701,19 +1534,23 @@
</span><span class="cx">                 t.preloadImg.src = src;
</span><span class="cx">         }
</span><span class="cx"> }
</span><ins>+
+jQuery(document).ready( function($) {
+        $('.media-types input').click( function() {
+                $('table.describe').toggleClass('not-image', $('#not-image').prop('checked') );
+        });
+});
+
</ins><span class="cx"> //]]>
</span><span class="cx"> </script>
</span><span class="cx">
</span><span class="cx"> <div id="media-items">
</span><span class="cx"> <div class="media-item media-blank">
</span><del>-<?php echo apply_filters($callback, call_user_func($callback)); ?>
</del><ins>+<?php echo apply_filters( 'type_url_form_media', type_url_form_image( $type ) ); ?>
</ins><span class="cx"> </div>
</span><span class="cx"> </div>
</span><span class="cx"> </form>
</span><span class="cx"> <?php
</span><del>-        } else {
-                wp_die( __('Unknown action.') );
-        }
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -2027,10 +1864,10 @@
</span><span class="cx"> *
</span><span class="cx"> * @return unknown
</span><span class="cx"> */
</span><del>-function type_url_form_image() {
</del><ins>+function type_url_form_image( $default_view = 'image' ) {
</ins><span class="cx">         if ( !apply_filters( 'disable_captions', '' ) ) {
</span><span class="cx">                 $caption = '
</span><del>-                <tr>
</del><ins>+                <tr class="image-only">
</ins><span class="cx">                         <th valign="top" scope="row" class="label">
</span><span class="cx">                                 <span class="alignleft"><label for="caption">' . __('Image Caption') . '</label></span>
</span><span class="cx">                         </th>
</span><span class="lines">@@ -2045,12 +1882,20 @@
</span><span class="cx">         if ( empty($default_align) )
</span><span class="cx">                 $default_align = 'none';
</span><span class="cx">
</span><ins>+        if ( 'image' == $default_view ) {
+                $view = 'image-only';
+                $table_class = '';
+        } else {
+                $view = $table_class = 'not-image';
+        }
+
</ins><span class="cx">         return '
</span><del>-        <h4 class="media-sub-title">' . __('Insert an image from another web site') . '</h4>
-        <table class="describe"><tbody>
</del><ins>+        <h4 class="media-sub-title">' . __('Insert media from another web site') . '</h4>
+        <p class="media-types"><label><input type="radio" name="media_type" value="image" id="image-only"' . checked( 'image-only', $view, false ) . ' /> ' . __( 'Images' ) . '</label> &nbsp; &nbsp; <label><input type="radio" name="media_type" value="generic" id="not-image"' . checked( 'not-image', $view, false ) . ' /> ' . __( 'Audio, Video, or Files' ) . '</label></p>
+        <table class="describe ' . $table_class . '"><tbody>
</ins><span class="cx">                 <tr>
</span><span class="cx">                         <th valign="top" scope="row" class="label" style="width:130px;">
</span><del>-                                <span class="alignleft"><label for="src">' . __('Image URL') . '</label></span>
</del><ins>+                                <span class="alignleft"><label for="src">' . __('URL') . '</label></span>
</ins><span class="cx">                                 <span class="alignright"><abbr id="status_img" title="required" class="required">*</abbr></span>
</span><span class="cx">                         </th>
</span><span class="cx">                         <td class="field"><input id="src" name="src" value="" type="text" aria-required="true" onblur="addExtImage.getImageData()" /></td>
</span><span class="lines">@@ -2058,13 +1903,15 @@
</span><span class="cx">
</span><span class="cx">                 <tr>
</span><span class="cx">                         <th valign="top" scope="row" class="label">
</span><del>-                                <span class="alignleft"><label for="title">' . __('Image Title') . '</label></span>
</del><ins>+                                <span class="alignleft"><label for="title">' . __('Title') . '</label></span>
</ins><span class="cx">                                 <span class="alignright"><abbr title="required" class="required">*</abbr></span>
</span><span class="cx">                         </th>
</span><span class="cx">                         <td class="field"><input id="title" name="title" value="" type="text" aria-required="true" /></td>
</span><span class="cx">                 </tr>
</span><span class="cx">
</span><del>-                <tr>
</del><ins>+                <tr class="not-image"><td></td><td><p class="help">' . __('Link text, e.g. &#8220;Ransom Demands (PDF)&#8221;') . '</p></td></tr>
+
+                <tr class="image-only">
</ins><span class="cx">                         <th valign="top" scope="row" class="label">
</span><span class="cx">                                 <span class="alignleft"><label for="alt">' . __('Alternate Text') . '</label></span>
</span><span class="cx">                         </th>
</span><span class="lines">@@ -2072,7 +1919,7 @@
</span><span class="cx">                         <p class="help">' . __('Alt text for the image, e.g. &#8220;The Mona Lisa&#8221;') . '</p></td>
</span><span class="cx">                 </tr>
</span><span class="cx">                 ' . $caption . '
</span><del>-                <tr class="align">
</del><ins>+                <tr class="align image-only">
</ins><span class="cx">                         <th valign="top" scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th>
</span><span class="cx">                         <td class="field">
</span><span class="cx">                                 <input name="align" id="align-none" value="none" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'none' ? ' checked="checked"' : '').' />
</span><span class="lines">@@ -2086,7 +1933,7 @@
</span><span class="cx">                         </td>
</span><span class="cx">                 </tr>
</span><span class="cx">
</span><del>-                <tr>
</del><ins>+                <tr class="image-only">
</ins><span class="cx">                         <th valign="top" scope="row" class="label">
</span><span class="cx">                                 <span class="alignleft"><label for="url">' . __('Link Image To:') . '</label></span>
</span><span class="cx">                         </th>
</span><span class="lines">@@ -2096,103 +1943,23 @@
</span><span class="cx">                         <button type="button" class="button" value="" onclick="document.forms[0].url.value=document.forms[0].src.value">' . __('Link to image') . '</button>
</span><span class="cx">                         <p class="help">' . __('Enter a link URL or click above for presets.') . '</p></td>
</span><span class="cx">                 </tr>
</span><del>-        ' . _insert_into_post_button('image') . '
-        </tbody></table>
-';
-
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since 2.7.0
- *
- * @return unknown
- */
-function type_url_form_audio() {
-        return '
-        <table class="describe"><tbody>
-                <tr>
-                        <th valign="top" scope="row" class="label">
-                                <span class="alignleft"><label for="insertonly[href]">' . __('Audio File URL') . '</label></span>
-                                <span class="alignright"><abbr title="required" class="required">*</abbr></span>
-                        </th>
-                        <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
</del><ins>+                <tr class="image-only">
+                        <td></td>
+                        <td>
+                                <input type="button" class="button" id="go_button" style="color:#bbb;" onclick="addExtImage.insert()" value="' . esc_attr__('Insert into Post') . '" />
+                        </td>
</ins><span class="cx">                 </tr>
</span><del>-                <tr>
-                        <th valign="top" scope="row" class="label">
-                                <span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
-                                <span class="alignright"><abbr title="required" class="required">*</abbr></span>
-                        </th>
-                        <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
</del><ins>+                <tr class="not-image">
+                        <td></td>
+                        <td>
+                                ' . get_submit_button( __( 'Insert into Post' ), 'button', 'insertonlybutton', false ) . '
+                        </td>
</ins><span class="cx">                 </tr>
</span><del>-                <tr><td></td><td class="help">' . __('Link text, e.g. &#8220;Still Alive by Jonathan Coulton&#8221;') . '</td></tr>
-        ' . _insert_into_post_button('audio') . '
</del><span class="cx">         </tbody></table>
</span><span class="cx"> ';
</span><del>-}
</del><span class="cx">
</span><del>-/**
- * {@internal Missing Short Description}}
- *
- * @since 2.7.0
- *
- * @return unknown
- */
-function type_url_form_video() {
-        return '
-        <table class="describe"><tbody>
-                <tr>
-                        <th valign="top" scope="row" class="label">
-                                <span class="alignleft"><label for="insertonly[href]">' . __('Video URL') . '</label></span>
-                                <span class="alignright"><abbr title="required" class="required">*</abbr></span>
-                        </th>
-                        <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
-                </tr>
-                <tr>
-                        <th valign="top" scope="row" class="label">
-                                <span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
-                                <span class="alignright"><abbr title="required" class="required">*</abbr></span>
-                        </th>
-                        <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
-                </tr>
-                <tr><td></td><td class="help">' . __('Link text, e.g. &#8220;Lucy on YouTube&#8221;') . '</td></tr>
-        ' . _insert_into_post_button('video') . '
-        </tbody></table>
-';
</del><span class="cx"> }
</span><span class="cx">
</span><del>-/**
- * {@internal Missing Short Description}}
- *
- * @since 2.7.0
- *
- * @return unknown
- */
-function type_url_form_file() {
-        return '
-        <table class="describe"><tbody>
-                <tr>
-                        <th valign="top" scope="row" class="label">
-                                <span class="alignleft"><label for="insertonly[href]">' . __('URL') . '</label></span>
-                                <span class="alignright"><abbr title="required" class="required">*</abbr></span>
-                        </th>
-                        <td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
-                </tr>
-                <tr>
-                        <th valign="top" scope="row" class="label">
-                                <span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
-                                <span class="alignright"><abbr title="required" class="required">*</abbr></span>
-                        </th>
-                        <td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
-                </tr>
-                <tr><td></td><td class="help">' . __('Link text, e.g. &#8220;Ransom Demands (PDF)&#8221;') . '</td></tr>
-        ' . _insert_into_post_button('file') . '
-        </tbody></table>
-';
-}
-
-
</del><span class="cx"> function _insert_into_post_button($type) {
</span><span class="cx">         if ( !post_type_supports(get_post_type($_GET['post_id']), 'editor') )
</span><span class="cx">                 return '';
</span><span class="lines">@@ -2240,9 +2007,9 @@
</span><span class="cx"> add_filter('async_upload_file', 'get_media_item', 10, 2);
</span><span class="cx">
</span><span class="cx"> add_action('media_upload_image', 'media_upload_image');
</span><del>-add_action('media_upload_audio', 'media_upload_audio');
-add_action('media_upload_video', 'media_upload_video');
-add_action('media_upload_file', 'media_upload_file');
</del><ins>+add_action('media_upload_audio', 'media_upload_image');
+add_action('media_upload_video', 'media_upload_image');
+add_action('media_upload_file', 'media_upload_image');
</ins><span class="cx">
</span><span class="cx"> add_filter('media_upload_gallery', 'media_upload_gallery');
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>