|
Revision 8618, 1.4 kB
(checked in by ryan, 3 weeks ago)
|
WP-Admin File Level Inline Documentation from santosj. see #7496
|
- Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
if ( defined('ABSPATH') ) |
|---|
| 10 |
require_once(ABSPATH . 'wp-load.php'); |
|---|
| 11 |
else |
|---|
| 12 |
require_once('../wp-load.php'); |
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
if ( is_ssl() && empty($_COOKIE[SECURE_AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) ) |
|---|
| 16 |
$_COOKIE[SECURE_AUTH_COOKIE] = $_REQUEST['auth_cookie']; |
|---|
| 17 |
elseif ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) ) |
|---|
| 18 |
$_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie']; |
|---|
| 19 |
unset($current_user); |
|---|
| 20 |
require_once('admin.php'); |
|---|
| 21 |
|
|---|
| 22 |
header('Content-Type: text/plain; charset=' . get_option('blog_charset')); |
|---|
| 23 |
|
|---|
| 24 |
if ( !current_user_can('upload_files') ) |
|---|
| 25 |
wp_die(__('You do not have permission to upload files.')); |
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
if ( ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) { |
|---|
| 29 |
echo get_media_item($id); |
|---|
| 30 |
exit; |
|---|
| 31 |
} |
|---|
| 32 |
|
|---|
| 33 |
check_admin_referer('media-form'); |
|---|
| 34 |
|
|---|
| 35 |
$id = media_handle_upload('async-upload', $_REQUEST['post_id']); |
|---|
| 36 |
if (is_wp_error($id)) { |
|---|
| 37 |
echo '<div id="media-upload-error">'.wp_specialchars($id->get_error_message()).'</div>'; |
|---|
| 38 |
exit; |
|---|
| 39 |
} |
|---|
| 40 |
|
|---|
| 41 |
if ( $_REQUEST['short'] ) { |
|---|
| 42 |
|
|---|
| 43 |
echo $id; |
|---|
| 44 |
} |
|---|
| 45 |
else { |
|---|
| 46 |
|
|---|
| 47 |
$type = $_REQUEST['type']; |
|---|
| 48 |
echo apply_filters("async_upload_{$type}", $id); |
|---|
| 49 |
} |
|---|
| 50 |
|
|---|
| 51 |
?> |
|---|