2 require_once('admin.php');
3 wp_enqueue_script('swfupload');
4 wp_enqueue_script('swfupload-degrade');
5 wp_enqueue_script('swfupload-queue');
6 wp_enqueue_script('swfupload-handlers');
8 @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
10 if (!current_user_can('upload_files'))
11 wp_die(__('You do not have permission to upload files.'));
13 // IDs should be integers
14 $ID = isset($ID)? (int) $ID : 0;
15 $post_id = isset($post_id)? (int) $post_id : 0;
17 // Require an ID for the edit screen
18 if ( isset($action) && $action == 'edit' && !$ID )
19 wp_die(__("You are not allowed to be here"));
21 // upload type: image, video, file, ..?
22 if ( isset($_GET['type']) )
23 $type = strval($_GET['type']);
25 $type = apply_filters('media_upload_default_type', 'file');
27 // tab: gallery, library, or type-specific
28 if ( isset($_GET['tab']) )
29 $tab = strval($_GET['tab']);
31 $tab = apply_filters('media_upload_default_tab', 'type');
33 $body_id = 'media-upload';
35 // let the action code decide how to handle the request
37 do_action("media_upload_$type");
39 do_action("media_upload_$tab");