<!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>[22751] trunk/wp-admin: Split media-new.php and media-upload.php into distinct files.</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/22751">22751</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2012-11-21 12:19:40 +0000 (Wed, 21 Nov 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>Split media-new.php and media-upload.php into distinct files.
 * media-new.php will remain the entry point for uploading isolated files, and for using the browser-based uploader (versus Plupload).
 * media-upload.php is the legacy (pre-3.5) media uploader.
see <a href="http://core.trac.wordpress.org/ticket/22083">#22083</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminmediauploadphp">trunk/wp-admin/media-upload.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkwpadminmedianewphp">trunk/wp-admin/media-new.php</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkwpadminmedianewphp">trunk/wp-admin/media-new.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminmedianewphp"></a>
<div class="delfile"><h4>Deleted: trunk/wp-admin/media-new.php (22750 => 22751)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/media-new.php        2012-11-21 12:11:38 UTC (rev 22750)
+++ trunk/wp-admin/media-new.php        2012-11-21 12:19:40 UTC (rev 22751)
</span><span class="lines">@@ -1,12 +0,0 @@
</span><del>-&lt;?php
-/**
- * Upload new media Administration Screen.
- *
- * @package WordPress
- * @subpackage Administration
- */
-
-$_GET['inline'] = 'true';
-/** Administration bootstrap */
-require_once('./admin.php');
-require_once('./media-upload.php');
</del></span></pre></div>
<a id="trunkwpadminmedianewphpfromrev22746trunkwpadminmediauploadphp"></a>
<div class="copfile"><h4>Copied: trunk/wp-admin/media-new.php (from rev 22746, trunk/wp-admin/media-upload.php) (0 => 22751)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/media-new.php                                (rev 0)
+++ trunk/wp-admin/media-new.php        2012-11-21 12:19:40 UTC (rev 22751)
</span><span class="lines">@@ -0,0 +1,117 @@
</span><ins>+&lt;?php
+/**
+ * Manage media uploaded file.
+ *
+ * There are many filters in here for media. Plugins can extend functionality
+ * by hooking into the filters.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Administration Bootstrap */
+require_once('./admin.php');
+
+if (!current_user_can('upload_files'))
+        wp_die(__('You do not have permission to upload files.'));
+
+wp_enqueue_script('plupload-handlers');
+wp_enqueue_script('image-edit');
+wp_enqueue_script('set-post-thumbnail' );
+wp_enqueue_style('imgareaselect');
+wp_enqueue_script( 'media-gallery' );
+
+
+// IDs should be integers
+$ID = isset($ID) ? (int) $ID : 0;
+$post_id = isset($post_id)? (int) $post_id : 0;
+
+// Require an ID for the edit screen
+if ( isset($action) &amp;&amp; $action == 'edit' &amp;&amp; !$ID )
+        wp_die( __( 'Cheatin&amp;#8217; uh?' ) );
+
+        $errors = array();
+
+        if ( ! empty( $_REQUEST['post_id'] ) &amp;&amp; ! current_user_can( 'edit_post' , $_REQUEST['post_id'] ) )
+                wp_die( __( 'Cheatin&amp;#8217; uh?' ) );
+
+        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 ( isset($_GET['upload-page-form']) ) {
+                $errors = array_merge($errors, (array) media_upload_form_handler());
+
+                $location = 'upload.php';
+                if ( $errors )
+                        $location .= '?message=3';
+
+                wp_redirect( admin_url($location) );
+                exit;
+        }
+
+        if ( isset( $_REQUEST['post_id'] ) )
+                wp_die( __( 'Cheatin&amp;#8217; uh?' ) );
+
+        $title = __('Upload New Media');
+        $parent_file = 'upload.php';
+        get_current_screen()-&gt;add_help_tab( array(
+        'id'                =&gt; 'overview',
+        'title'                =&gt; __('Overview'),
+        'content'        =&gt;
+                '&lt;p&gt;' . __('You can upload media files here without creating a post first. This allows you to upload files to use with posts and pages later and/or to get a web link for a particular file that you can share. There are three options for uploading files:') . '&lt;/p&gt;' .
+                '&lt;ul&gt;' .
+                        '&lt;li&gt;' . __('&lt;strong&gt;Drag and drop&lt;/strong&gt; your files into the area below. Multiple files are allowed.') . '&lt;/li&gt;' .
+                        '&lt;li&gt;' . __('Clicking &lt;strong&gt;Select Files&lt;/strong&gt; opens a navigation window showing you files in your operating system. Selecting &lt;strong&gt;Open&lt;/strong&gt; after clicking on the file you want activates a progress bar on the uploader screen.') . '&lt;/li&gt;' .
+                        '&lt;li&gt;' . __('Revert to the &lt;strong&gt;Browser Uploader&lt;/strong&gt; by clicking the link below the drag and drop box.') . '&lt;/li&gt;' .
+                '&lt;/ul&gt;' .
+                '&lt;p&gt;' . __('Basic image editing is available after upload is complete. Make sure you click Save before leaving this screen.') . '&lt;/p&gt;'
+        ) );
+        get_current_screen()-&gt;set_help_sidebar(
+                '&lt;p&gt;&lt;strong&gt;' . __('For more information:') . '&lt;/strong&gt;&lt;/p&gt;' .
+                '&lt;p&gt;' . __('&lt;a href=&quot;http://codex.wordpress.org/Media_Add_New_Screen&quot; target=&quot;_blank&quot;&gt;Documentation on Uploading Media Files&lt;/a&gt;') . '&lt;/p&gt;' .
+                '&lt;p&gt;' . __('&lt;a href=&quot;http://wordpress.org/support/&quot; target=&quot;_blank&quot;&gt;Support Forums&lt;/a&gt;') . '&lt;/p&gt;'
+        );
+
+        require_once('./admin-header.php');
+
+        $form_class = 'media-upload-form wp-upload-form type-form validate';
+
+        if ( get_user_setting('uploader') )
+                $form_class .= ' html-uploader';
+        ?&gt;
+        &lt;div class=&quot;wrap&quot;&gt;
+        &lt;?php screen_icon(); ?&gt;
+        &lt;h2&gt;&lt;?php echo esc_html( $title ); ?&gt;&lt;/h2&gt;
+
+        &lt;form enctype=&quot;multipart/form-data&quot; method=&quot;post&quot; action=&quot;&lt;?php echo admin_url('media-new.php?inline=&amp;amp;upload-page-form='); ?&gt;&quot; class=&quot;&lt;?php echo $form_class; ?&gt;&quot; id=&quot;file-form&quot;&gt;
+
+        &lt;?php media_upload_form(); ?&gt;
+
+        &lt;script type=&quot;text/javascript&quot;&gt;
+        jQuery(function($){
+                var preloaded = $(&quot;.media-item.preloaded&quot;);
+                if ( preloaded.length &gt; 0 ) {
+                        preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
+                }
+                updateMediaForm();
+                post_id = 0;
+                shortform = 1;
+        });
+        &lt;/script&gt;
+        &lt;input type=&quot;hidden&quot; name=&quot;post_id&quot; id=&quot;post_id&quot; value=&quot;0&quot; /&gt;
+        &lt;?php wp_nonce_field('media-form'); ?&gt;
+        &lt;div id=&quot;media-items&quot; class=&quot;hide-if-no-js&quot;&gt;&lt;/div&gt;
+        &lt;?php submit_button( __( 'Save all changes' ), 'button savebutton hidden', 'save' ); ?&gt;
+        &lt;/form&gt;
+        &lt;/div&gt;
+
+&lt;?php
+        include('./admin-footer.php');
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminmediauploadphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/media-upload.php (22750 => 22751)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/media-upload.php        2012-11-21 12:11:38 UTC (rev 22750)
+++ trunk/wp-admin/media-upload.php        2012-11-21 12:19:40 UTC (rev 22751)
</span><span class="lines">@@ -34,97 +34,9 @@
</span><span class="cx"> if ( isset($action) &amp;&amp; $action == 'edit' &amp;&amp; !$ID )
</span><span class="cx">         wp_die( __( 'Cheatin&amp;#8217; uh?' ) );
</span><span class="cx"> 
</span><del>-if ( isset($_GET['inline']) ) {
-        $errors = array();
-
</del><span class="cx">         if ( ! empty( $_REQUEST['post_id'] ) &amp;&amp; ! current_user_can( 'edit_post' , $_REQUEST['post_id'] ) )
</span><span class="cx">                 wp_die( __( 'Cheatin&amp;#8217; uh?' ) );
</span><span class="cx"> 
</span><del>-        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 ( isset($_GET['upload-page-form']) ) {
-                $errors = array_merge($errors, (array) media_upload_form_handler());
-
-                $location = 'upload.php';
-                if ( $errors )
-                        $location .= '?message=3';
-
-                wp_redirect( admin_url($location) );
-                exit;
-        }
-
-        if ( isset( $_REQUEST['post_id'] ) )
-                wp_die( __( 'Cheatin&amp;#8217; uh?' ) );
-
-        $title = __('Upload New Media');
-        $parent_file = 'upload.php';
-        get_current_screen()-&gt;add_help_tab( array(
-        'id'                =&gt; 'overview',
-        'title'                =&gt; __('Overview'),
-        'content'        =&gt;
-                '&lt;p&gt;' . __('You can upload media files here without creating a post first. This allows you to upload files to use with posts and pages later and/or to get a web link for a particular file that you can share. There are three options for uploading files:') . '&lt;/p&gt;' .
-                '&lt;ul&gt;' .
-                        '&lt;li&gt;' . __('&lt;strong&gt;Drag and drop&lt;/strong&gt; your files into the area below. Multiple files are allowed.') . '&lt;/li&gt;' .
-                        '&lt;li&gt;' . __('Clicking &lt;strong&gt;Select Files&lt;/strong&gt; opens a navigation window showing you files in your operating system. Selecting &lt;strong&gt;Open&lt;/strong&gt; after clicking on the file you want activates a progress bar on the uploader screen.') . '&lt;/li&gt;' .
-                        '&lt;li&gt;' . __('Revert to the &lt;strong&gt;Browser Uploader&lt;/strong&gt; by clicking the link below the drag and drop box.') . '&lt;/li&gt;' .
-                '&lt;/ul&gt;' .
-                '&lt;p&gt;' . __('Basic image editing is available after upload is complete. Make sure you click Save before leaving this screen.') . '&lt;/p&gt;'
-        ) );
-        get_current_screen()-&gt;set_help_sidebar(
-                '&lt;p&gt;&lt;strong&gt;' . __('For more information:') . '&lt;/strong&gt;&lt;/p&gt;' .
-                '&lt;p&gt;' . __('&lt;a href=&quot;http://codex.wordpress.org/Media_Add_New_Screen&quot; target=&quot;_blank&quot;&gt;Documentation on Uploading Media Files&lt;/a&gt;') . '&lt;/p&gt;' .
-                '&lt;p&gt;' . __('&lt;a href=&quot;http://wordpress.org/support/&quot; target=&quot;_blank&quot;&gt;Support Forums&lt;/a&gt;') . '&lt;/p&gt;'
-        );
-
-        require_once('./admin-header.php');
-
-        $form_class = 'media-upload-form wp-upload-form type-form validate';
-
-        if ( get_user_setting('uploader') )
-                $form_class .= ' html-uploader';
-        ?&gt;
-        &lt;div class=&quot;wrap&quot;&gt;
-        &lt;?php screen_icon(); ?&gt;
-        &lt;h2&gt;&lt;?php echo esc_html( $title ); ?&gt;&lt;/h2&gt;
-
-        &lt;form enctype=&quot;multipart/form-data&quot; method=&quot;post&quot; action=&quot;&lt;?php echo admin_url('media-upload.php?inline=&amp;amp;upload-page-form='); ?&gt;&quot; class=&quot;&lt;?php echo $form_class; ?&gt;&quot; id=&quot;file-form&quot;&gt;
-
-        &lt;?php media_upload_form(); ?&gt;
-
-        &lt;script type=&quot;text/javascript&quot;&gt;
-        jQuery(function($){
-                var preloaded = $(&quot;.media-item.preloaded&quot;);
-                if ( preloaded.length &gt; 0 ) {
-                        preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
-                }
-                updateMediaForm();
-                post_id = 0;
-                shortform = 1;
-        });
-        &lt;/script&gt;
-        &lt;input type=&quot;hidden&quot; name=&quot;post_id&quot; id=&quot;post_id&quot; value=&quot;0&quot; /&gt;
-        &lt;?php wp_nonce_field('media-form'); ?&gt;
-        &lt;div id=&quot;media-items&quot; class=&quot;hide-if-no-js&quot;&gt;&lt;/div&gt;
-        &lt;?php submit_button( __( 'Save all changes' ), 'button savebutton hidden', 'save' ); ?&gt;
-        &lt;/form&gt;
-        &lt;/div&gt;
-
-&lt;?php
-        include('./admin-footer.php');
-
-} else {
-        if ( ! empty( $_REQUEST['post_id'] ) &amp;&amp; ! current_user_can( 'edit_post' , $_REQUEST['post_id'] ) )
-                wp_die( __( 'Cheatin&amp;#8217; uh?' ) );
-
</del><span class="cx">         // upload type: image, video, file, ..?
</span><span class="cx">         if ( isset($_GET['type']) )
</span><span class="cx">                 $type = strval($_GET['type']);
</span><span class="lines">@@ -144,4 +56,3 @@
</span><span class="cx">                 do_action(&quot;media_upload_$type&quot;);
</span><span class="cx">         else
</span><span class="cx">                 do_action(&quot;media_upload_$tab&quot;);
</span><del>-}
</del></span></pre>
</div>
</div>

</body>
</html>