<!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' =&gt; true, 'video' =&gt; true, 'audio' =&gt; 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) &amp;&amp; !strpos($src, '://') )
</span><span class="cx">                         $src = &quot;http://$src&quot;;
</span><del>-                $alt = esc_attr($_POST['insertonly']['alt']);
-                if ( isset($_POST['insertonly']['align']) ) {
-                        $align = esc_attr($_POST['insertonly']['align']);
-                        $class = &quot; class='align$align'&quot;;
</del><ins>+
+                if ( isset( $_POST['media_type'] ) &amp;&amp; 'image' != $_POST['media_type'] ) {
+                        $title = esc_attr($_POST['insertonly']['title']);
+                        if ( empty($title) )
+                                $title = esc_attr( basename($src) );
+
+                        if ( !empty($title) &amp;&amp; !empty($src) )
+                                $html = &quot;&lt;a href='&quot; . esc_url($src) . &quot;' &gt;$title&lt;/a&gt;&quot;;
+
+                        $type = 'file';
+                        if ( $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ) &amp;&amp; $ext_type = wp_ext2type( $ext )
+                                &amp;&amp; ( '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 = &quot; class='align$align'&quot;;
+                        }
+                        if ( !empty($src) )
+                                $html = &quot;&lt;img src='&quot; . esc_url($src) . &quot;' alt='$alt'$class /&gt;&quot;;
+
+                        $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 = &quot;&lt;img src='&quot; . esc_url($src) . &quot;' alt='$alt'$class /&gt;&quot;;
</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']) &amp;&amp; $_GET['tab'] == 'type_url' )
-                return wp_iframe( 'media_upload_type_url_form', 'image', $errors, $id );
</del><ins>+        if ( isset($_GET['tab']) &amp;&amp; $_GET['tab'] == 'type_url' ) {
+                $type = 'image';
+                if ( isset( $_GET['type'] ) &amp;&amp; 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']) &amp;&amp; !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) &amp;&amp; !strpos($href, '://') )
-                        $href = &quot;http://$href&quot;;
-
-                $title = esc_attr($_POST['insertonly']['title']);
-                if ( empty($title) )
-            $title = esc_attr( basename($href) );
-
-                if ( !empty($title) &amp;&amp; !empty($href) )
-            $html = &quot;&lt;a href='&quot; . esc_url($href) . &quot;' &gt;$title&lt;/a&gt;&quot;;
-
-                $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']) &amp;&amp; $_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']) &amp;&amp; !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) &amp;&amp; !strpos($href, '://') )
-                        $href = &quot;http://$href&quot;;
-
-                $title = esc_attr($_POST['insertonly']['title']);
-        if ( empty($title) )
-            $title = esc_attr( basename($href) );
-
-                if ( !empty($title) &amp;&amp; !empty($href) )
-            $html = &quot;&lt;a href='&quot; . esc_url($href) . &quot;' &gt;$title&lt;/a&gt;&quot;;
-
-                $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']) &amp;&amp; $_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']) &amp;&amp; !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) &amp;&amp; !strpos($href, '://') )
-                        $href = &quot;http://$href&quot;;
-
-                $title = esc_attr($_POST['insertonly']['title']);
-                if ( empty($title) )
-                        $title = basename($href);
-                if ( !empty($title) &amp;&amp; !empty($href) )
-                        $html = &quot;&lt;a href='&quot; . esc_url($href) . &quot;' &gt;$title&lt;/a&gt;&quot;;
-                $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']) &amp;&amp; $_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(&quot;media-upload.php?type=$type&amp;tab=type&amp;post_id=$post_id&quot;);
</span><span class="cx">         $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
</span><del>-
-        $callback = &quot;type_url_form_$type&quot;;
</del><span class="cx"> ?&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;form enctype=&quot;multipart/form-data&quot; method=&quot;post&quot; action=&quot;&lt;?php echo esc_attr($form_action_url); ?&gt;&quot; class=&quot;media-upload-form type-form validate&quot; id=&quot;&lt;?php echo $type; ?&gt;-form&quot;&gt;
</span><span class="cx"> &lt;input type=&quot;hidden&quot; name=&quot;post_id&quot; id=&quot;post_id&quot; value=&quot;&lt;?php echo (int) $post_id; ?&gt;&quot; /&gt;
</span><span class="cx"> &lt;?php wp_nonce_field('media-form'); ?&gt;
</span><span class="cx"> 
</span><del>-&lt;?php if ( is_callable($callback) ) { ?&gt;
-
</del><span class="cx"> &lt;h3 class=&quot;media-title&quot;&gt;&lt;?php _e('Add media file from URL'); ?&gt;&lt;/h3&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;script type=&quot;text/javascript&quot;&gt;
</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 = '&lt;img src=&quot;&lt;?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?&gt;&quot; alt=&quot;&quot; /&gt;';
</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"> //]]&gt;
</span><span class="cx"> &lt;/script&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;div id=&quot;media-items&quot;&gt;
</span><span class="cx"> &lt;div class=&quot;media-item media-blank&quot;&gt;
</span><del>-&lt;?php echo apply_filters($callback, call_user_func($callback)); ?&gt;
</del><ins>+&lt;?php echo apply_filters( 'type_url_form_media', type_url_form_image( $type ) ); ?&gt;
</ins><span class="cx"> &lt;/div&gt;
</span><span class="cx"> &lt;/div&gt;
</span><span class="cx"> &lt;/form&gt;
</span><span class="cx"> &lt;?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>-                &lt;tr&gt;
</del><ins>+                &lt;tr class=&quot;image-only&quot;&gt;
</ins><span class="cx">                         &lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;
</span><span class="cx">                                 &lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;caption&quot;&gt;' . __('Image Caption') . '&lt;/label&gt;&lt;/span&gt;
</span><span class="cx">                         &lt;/th&gt;
</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>-        &lt;h4 class=&quot;media-sub-title&quot;&gt;' . __('Insert an image from another web site') . '&lt;/h4&gt;
-        &lt;table class=&quot;describe&quot;&gt;&lt;tbody&gt;
</del><ins>+        &lt;h4 class=&quot;media-sub-title&quot;&gt;' . __('Insert media from another web site') . '&lt;/h4&gt;
+        &lt;p class=&quot;media-types&quot;&gt;&lt;label&gt;&lt;input type=&quot;radio&quot; name=&quot;media_type&quot; value=&quot;image&quot; id=&quot;image-only&quot;' . checked( 'image-only', $view, false ) . ' /&gt; ' . __( 'Images' ) . '&lt;/label&gt; &amp;nbsp; &amp;nbsp; &lt;label&gt;&lt;input type=&quot;radio&quot; name=&quot;media_type&quot; value=&quot;generic&quot; id=&quot;not-image&quot;' . checked( 'not-image', $view, false ) . ' /&gt; ' . __( 'Audio, Video, or Files' ) . '&lt;/label&gt;&lt;/p&gt;
+        &lt;table class=&quot;describe ' . $table_class . '&quot;&gt;&lt;tbody&gt;
</ins><span class="cx">                 &lt;tr&gt;
</span><span class="cx">                         &lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot; style=&quot;width:130px;&quot;&gt;
</span><del>-                                &lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;src&quot;&gt;' . __('Image URL') . '&lt;/label&gt;&lt;/span&gt;
</del><ins>+                                &lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;src&quot;&gt;' . __('URL') . '&lt;/label&gt;&lt;/span&gt;
</ins><span class="cx">                                 &lt;span class=&quot;alignright&quot;&gt;&lt;abbr id=&quot;status_img&quot; title=&quot;required&quot; class=&quot;required&quot;&gt;*&lt;/abbr&gt;&lt;/span&gt;
</span><span class="cx">                         &lt;/th&gt;
</span><span class="cx">                         &lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;src&quot; name=&quot;src&quot; value=&quot;&quot; type=&quot;text&quot; aria-required=&quot;true&quot; onblur=&quot;addExtImage.getImageData()&quot; /&gt;&lt;/td&gt;
</span><span class="lines">@@ -2058,13 +1903,15 @@
</span><span class="cx"> 
</span><span class="cx">                 &lt;tr&gt;
</span><span class="cx">                         &lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;
</span><del>-                                &lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;title&quot;&gt;' . __('Image Title') . '&lt;/label&gt;&lt;/span&gt;
</del><ins>+                                &lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;title&quot;&gt;' . __('Title') . '&lt;/label&gt;&lt;/span&gt;
</ins><span class="cx">                                 &lt;span class=&quot;alignright&quot;&gt;&lt;abbr title=&quot;required&quot; class=&quot;required&quot;&gt;*&lt;/abbr&gt;&lt;/span&gt;
</span><span class="cx">                         &lt;/th&gt;
</span><span class="cx">                         &lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;title&quot; name=&quot;title&quot; value=&quot;&quot; type=&quot;text&quot; aria-required=&quot;true&quot; /&gt;&lt;/td&gt;
</span><span class="cx">                 &lt;/tr&gt;
</span><span class="cx"> 
</span><del>-                &lt;tr&gt;
</del><ins>+                &lt;tr class=&quot;not-image&quot;&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;p class=&quot;help&quot;&gt;' . __('Link text, e.g. &amp;#8220;Ransom Demands (PDF)&amp;#8221;') . '&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;
+
+                &lt;tr class=&quot;image-only&quot;&gt;
</ins><span class="cx">                         &lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;
</span><span class="cx">                                 &lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;alt&quot;&gt;' . __('Alternate Text') . '&lt;/label&gt;&lt;/span&gt;
</span><span class="cx">                         &lt;/th&gt;
</span><span class="lines">@@ -2072,7 +1919,7 @@
</span><span class="cx">                         &lt;p class=&quot;help&quot;&gt;' . __('Alt text for the image, e.g. &amp;#8220;The Mona Lisa&amp;#8221;') . '&lt;/p&gt;&lt;/td&gt;
</span><span class="cx">                 &lt;/tr&gt;
</span><span class="cx">                 ' . $caption . '
</span><del>-                &lt;tr class=&quot;align&quot;&gt;
</del><ins>+                &lt;tr class=&quot;align image-only&quot;&gt;
</ins><span class="cx">                         &lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;&lt;p&gt;&lt;label for=&quot;align&quot;&gt;' . __('Alignment') . '&lt;/label&gt;&lt;/p&gt;&lt;/th&gt;
</span><span class="cx">                         &lt;td class=&quot;field&quot;&gt;
</span><span class="cx">                                 &lt;input name=&quot;align&quot; id=&quot;align-none&quot; value=&quot;none&quot; onclick=&quot;addExtImage.align=\'align\'+this.value&quot; type=&quot;radio&quot;' . ($default_align == 'none' ? ' checked=&quot;checked&quot;' : '').' /&gt;
</span><span class="lines">@@ -2086,7 +1933,7 @@
</span><span class="cx">                         &lt;/td&gt;
</span><span class="cx">                 &lt;/tr&gt;
</span><span class="cx"> 
</span><del>-                &lt;tr&gt;
</del><ins>+                &lt;tr class=&quot;image-only&quot;&gt;
</ins><span class="cx">                         &lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;
</span><span class="cx">                                 &lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;url&quot;&gt;' . __('Link Image To:') . '&lt;/label&gt;&lt;/span&gt;
</span><span class="cx">                         &lt;/th&gt;
</span><span class="lines">@@ -2096,103 +1943,23 @@
</span><span class="cx">                         &lt;button type=&quot;button&quot; class=&quot;button&quot; value=&quot;&quot; onclick=&quot;document.forms[0].url.value=document.forms[0].src.value&quot;&gt;' . __('Link to image') . '&lt;/button&gt;
</span><span class="cx">                         &lt;p class=&quot;help&quot;&gt;' . __('Enter a link URL or click above for presets.') . '&lt;/p&gt;&lt;/td&gt;
</span><span class="cx">                 &lt;/tr&gt;
</span><del>-        ' . _insert_into_post_button('image') . '
-        &lt;/tbody&gt;&lt;/table&gt;
-';
-
-}
-
-/**
- * {@internal Missing Short Description}}
- *
- * @since 2.7.0
- *
- * @return unknown
- */
-function type_url_form_audio() {
-        return '
-        &lt;table class=&quot;describe&quot;&gt;&lt;tbody&gt;
-                &lt;tr&gt;
-                        &lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;
-                                &lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;insertonly[href]&quot;&gt;' . __('Audio File URL') . '&lt;/label&gt;&lt;/span&gt;
-                                &lt;span class=&quot;alignright&quot;&gt;&lt;abbr title=&quot;required&quot; class=&quot;required&quot;&gt;*&lt;/abbr&gt;&lt;/span&gt;
-                        &lt;/th&gt;
-                        &lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;insertonly[href]&quot; name=&quot;insertonly[href]&quot; value=&quot;&quot; type=&quot;text&quot; aria-required=&quot;true&quot;&gt;&lt;/td&gt;
</del><ins>+                &lt;tr class=&quot;image-only&quot;&gt;
+                        &lt;td&gt;&lt;/td&gt;
+                        &lt;td&gt;
+                                &lt;input type=&quot;button&quot; class=&quot;button&quot; id=&quot;go_button&quot; style=&quot;color:#bbb;&quot; onclick=&quot;addExtImage.insert()&quot; value=&quot;' . esc_attr__('Insert into Post') . '&quot; /&gt;
+                        &lt;/td&gt;
</ins><span class="cx">                 &lt;/tr&gt;
</span><del>-                &lt;tr&gt;
-                        &lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;
-                                &lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;insertonly[title]&quot;&gt;' . __('Title') . '&lt;/label&gt;&lt;/span&gt;
-                                &lt;span class=&quot;alignright&quot;&gt;&lt;abbr title=&quot;required&quot; class=&quot;required&quot;&gt;*&lt;/abbr&gt;&lt;/span&gt;
-                        &lt;/th&gt;
-                        &lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;insertonly[title]&quot; name=&quot;insertonly[title]&quot; value=&quot;&quot; type=&quot;text&quot; aria-required=&quot;true&quot;&gt;&lt;/td&gt;
</del><ins>+                &lt;tr class=&quot;not-image&quot;&gt;
+                        &lt;td&gt;&lt;/td&gt;
+                        &lt;td&gt;
+                                ' . get_submit_button( __( 'Insert into Post' ), 'button', 'insertonlybutton', false ) . '
+                        &lt;/td&gt;
</ins><span class="cx">                 &lt;/tr&gt;
</span><del>-                &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td class=&quot;help&quot;&gt;' . __('Link text, e.g. &amp;#8220;Still Alive by Jonathan Coulton&amp;#8221;') . '&lt;/td&gt;&lt;/tr&gt;
-        ' . _insert_into_post_button('audio') . '
</del><span class="cx">         &lt;/tbody&gt;&lt;/table&gt;
</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 '
-        &lt;table class=&quot;describe&quot;&gt;&lt;tbody&gt;
-                &lt;tr&gt;
-                        &lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;
-                                &lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;insertonly[href]&quot;&gt;' . __('Video URL') . '&lt;/label&gt;&lt;/span&gt;
-                                &lt;span class=&quot;alignright&quot;&gt;&lt;abbr title=&quot;required&quot; class=&quot;required&quot;&gt;*&lt;/abbr&gt;&lt;/span&gt;
-                        &lt;/th&gt;
-                        &lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;insertonly[href]&quot; name=&quot;insertonly[href]&quot; value=&quot;&quot; type=&quot;text&quot; aria-required=&quot;true&quot;&gt;&lt;/td&gt;
-                &lt;/tr&gt;
-                &lt;tr&gt;
-                        &lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;
-                                &lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;insertonly[title]&quot;&gt;' . __('Title') . '&lt;/label&gt;&lt;/span&gt;
-                                &lt;span class=&quot;alignright&quot;&gt;&lt;abbr title=&quot;required&quot; class=&quot;required&quot;&gt;*&lt;/abbr&gt;&lt;/span&gt;
-                        &lt;/th&gt;
-                        &lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;insertonly[title]&quot; name=&quot;insertonly[title]&quot; value=&quot;&quot; type=&quot;text&quot; aria-required=&quot;true&quot;&gt;&lt;/td&gt;
-                &lt;/tr&gt;
-                &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td class=&quot;help&quot;&gt;' . __('Link text, e.g. &amp;#8220;Lucy on YouTube&amp;#8221;') . '&lt;/td&gt;&lt;/tr&gt;
-        ' . _insert_into_post_button('video') . '
-        &lt;/tbody&gt;&lt;/table&gt;
-';
</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 '
-        &lt;table class=&quot;describe&quot;&gt;&lt;tbody&gt;
-                &lt;tr&gt;
-                        &lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;
-                                &lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;insertonly[href]&quot;&gt;' . __('URL') . '&lt;/label&gt;&lt;/span&gt;
-                                &lt;span class=&quot;alignright&quot;&gt;&lt;abbr title=&quot;required&quot; class=&quot;required&quot;&gt;*&lt;/abbr&gt;&lt;/span&gt;
-                        &lt;/th&gt;
-                        &lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;insertonly[href]&quot; name=&quot;insertonly[href]&quot; value=&quot;&quot; type=&quot;text&quot; aria-required=&quot;true&quot;&gt;&lt;/td&gt;
-                &lt;/tr&gt;
-                &lt;tr&gt;
-                        &lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;
-                                &lt;span class=&quot;alignleft&quot;&gt;&lt;label for=&quot;insertonly[title]&quot;&gt;' . __('Title') . '&lt;/label&gt;&lt;/span&gt;
-                                &lt;span class=&quot;alignright&quot;&gt;&lt;abbr title=&quot;required&quot; class=&quot;required&quot;&gt;*&lt;/abbr&gt;&lt;/span&gt;
-                        &lt;/th&gt;
-                        &lt;td class=&quot;field&quot;&gt;&lt;input id=&quot;insertonly[title]&quot; name=&quot;insertonly[title]&quot; value=&quot;&quot; type=&quot;text&quot; aria-required=&quot;true&quot;&gt;&lt;/td&gt;
-                &lt;/tr&gt;
-                &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td class=&quot;help&quot;&gt;' . __('Link text, e.g. &amp;#8220;Ransom Demands (PDF)&amp;#8221;') . '&lt;/td&gt;&lt;/tr&gt;
-        ' . _insert_into_post_button('file') . '
-        &lt;/tbody&gt;&lt;/table&gt;
-';
-}
-
-
</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>