Changeset 22764 for trunk/wp-admin/media-new.php
- Timestamp:
- 11/21/2012 03:10:17 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/media-new.php
r22755 r22764 17 17 18 18 wp_enqueue_script('plupload-handlers'); 19 wp_enqueue_script('image-edit');20 wp_enqueue_script('set-post-thumbnail' );21 wp_enqueue_style('imgareaselect');22 wp_enqueue_script( 'media-gallery' );23 24 $errors = array();25 19 26 20 unset( $_REQUEST['post_id'] ); 27 21 28 22 if ( $_POST ) { 23 $location = 'upload.php'; 29 24 if ( isset($_POST['html-upload']) && !empty($_FILES) ) { 30 25 check_admin_referer('media-form'); 31 26 // Upload File button was clicked 32 27 $id = media_handle_upload('async-upload', $_REQUEST['post_id']); 33 unset($_FILES); 34 if ( is_wp_error($id) ) { 35 $errors['upload_error'] = $id; 36 $id = false; 37 } 28 if ( is_wp_error( $id ) ) 29 $location .= '?message=3'; 38 30 } 39 40 $errors = array_merge($errors, (array) media_upload_form_handler()); 41 42 $location = 'upload.php'; 43 if ( $errors ) 44 $location .= '?message=3'; 45 46 wp_redirect( admin_url($location) ); 31 wp_redirect( admin_url( $location ) ); 47 32 exit; 48 33 } 49 34 50 $title = __('Upload New Media'); 51 $parent_file = 'upload.php'; 52 get_current_screen()->add_help_tab( array( 53 'id' => 'overview', 54 'title' => __('Overview'), 55 'content' => 56 '<p>' . __('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:') . '</p>' . 57 '<ul>' . 58 '<li>' . __('<strong>Drag and drop</strong> your files into the area below. Multiple files are allowed.') . '</li>' . 59 '<li>' . __('Clicking <strong>Select Files</strong> opens a navigation window showing you files in your operating system. Selecting <strong>Open</strong> after clicking on the file you want activates a progress bar on the uploader screen.') . '</li>' . 60 '<li>' . __('Revert to the <strong>Browser Uploader</strong> by clicking the link below the drag and drop box.') . '</li>' . 61 '</ul>' . 62 '<p>' . __('Basic image editing is available after upload is complete. Make sure you click Save before leaving this screen.') . '</p>' 63 ) ); 64 get_current_screen()->set_help_sidebar( 65 '<p><strong>' . __('For more information:') . '</strong></p>' . 66 '<p>' . __('<a href="http://codex.wordpress.org/Media_Add_New_Screen" target="_blank">Documentation on Uploading Media Files</a>') . '</p>' . 67 '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' 68 ); 35 $title = __('Upload New Media'); 36 $parent_file = 'upload.php'; 69 37 70 require_once('./admin-header.php'); 38 get_current_screen()->add_help_tab( array( 39 'id' => 'overview', 40 'title' => __('Overview'), 41 'content' => 42 '<p>' . __('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:') . '</p>' . 43 '<ul>' . 44 '<li>' . __('<strong>Drag and drop</strong> your files into the area below. Multiple files are allowed.') . '</li>' . 45 '<li>' . __('Clicking <strong>Select Files</strong> opens a navigation window showing you files in your operating system. Selecting <strong>Open</strong> after clicking on the file you want activates a progress bar on the uploader screen.') . '</li>' . 46 '<li>' . __('Revert to the <strong>Browser Uploader</strong> by clicking the link below the drag and drop box.') . '</li>' . 47 '</ul>' 48 ) ); 49 get_current_screen()->set_help_sidebar( 50 '<p><strong>' . __('For more information:') . '</strong></p>' . 51 '<p>' . __('<a href="http://codex.wordpress.org/Media_Add_New_Screen" target="_blank">Documentation on Uploading Media Files</a>') . '</p>' . 52 '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' 53 ); 71 54 72 $form_class = 'media-upload-form wp-upload-form type-form validate';55 require_once( ABSPATH . 'wp-admin/admin-header.php' ); 73 56 74 if ( get_user_setting('uploader') ) 75 $form_class .= ' html-uploader'; 76 ?> 77 <div class="wrap"> 57 $form_class = 'media-upload-form wp-upload-form type-form validate'; 58 59 if ( get_user_setting('uploader') || isset( $_GET['browser-uploader'] ) ) 60 $form_class .= ' html-uploader'; 61 ?> 62 <div class="wrap"> 78 63 <?php screen_icon(); ?> 79 64 <h2><?php echo esc_html( $title ); ?></h2> … … 84 69 85 70 <script type="text/javascript"> 86 jQuery(function($){ 87 var preloaded = $(".media-item.preloaded"); 88 if ( preloaded.length > 0 ) { 89 preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');}); 90 } 91 updateMediaForm(); 92 post_id = 0; 93 shortform = 3; 94 }); 71 var post_id = 0, shortform = 3; 95 72 </script> 96 73 <input type="hidden" name="post_id" id="post_id" value="0" /> 97 74 <?php wp_nonce_field('media-form'); ?> 98 75 <div id="media-items" class="hide-if-no-js"></div> 99 <?php submit_button( __( 'Save all changes' ), 'button savebutton hidden', 'save' ); ?>100 76 </form> 101 77 </div> 102 78 103 79 <?php 104 include('./admin-footer.php');80 include( ABSPATH . 'wp-admin/admin-footer.php' );
Note: See TracChangeset
for help on using the changeset viewer.