1 | *** xmlrpc.php.orig 2008-03-15 04:08:09.000000000 +0900 |
---|
2 | --- xmlrpc.php 2008-04-01 16:35:48.000000000 +0900 |
---|
3 | *************** |
---|
4 | *** 1886,1891 **** |
---|
5 | --- 1886,1894 ---- |
---|
6 | logIO('O', '(MW) ' . $errorString); |
---|
7 | return new IXR_Error(500, $errorString); |
---|
8 | } |
---|
9 | + |
---|
10 | + $file = apply_filters( 'wp_handle_upload', array( 'file' => $upload[ 'file' ], 'url' => $upload[ 'url' ], 'type' => $type ) ); |
---|
11 | + |
---|
12 | // Construct the attachment array |
---|
13 | // attach to post_id -1 |
---|
14 | $post_id = -1; |
---|
15 | *************** |
---|
16 | *** 1894,1908 **** |
---|
17 | 'post_content' => '', |
---|
18 | 'post_type' => 'attachment', |
---|
19 | 'post_parent' => $post_id, |
---|
20 | ! 'post_mime_type' => $type, |
---|
21 | ! 'guid' => $upload[ 'url' ] |
---|
22 | ); |
---|
23 | |
---|
24 | // Save the data |
---|
25 | ! $id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id ); |
---|
26 | ! wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) ); |
---|
27 | |
---|
28 | ! return apply_filters( 'wp_handle_upload', array( 'file' => $name, 'url' => $upload[ 'url' ], 'type' => $type ) ); |
---|
29 | } |
---|
30 | |
---|
31 | |
---|
32 | --- 1897,1911 ---- |
---|
33 | 'post_content' => '', |
---|
34 | 'post_type' => 'attachment', |
---|
35 | 'post_parent' => $post_id, |
---|
36 | ! 'post_mime_type' => $file[ 'type' ], |
---|
37 | ! 'guid' => $file[ 'url' ] |
---|
38 | ); |
---|
39 | |
---|
40 | // Save the data |
---|
41 | ! $id = wp_insert_attachment( $attachment, $file[ 'file' ], $post_id ); |
---|
42 | ! wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file['file'] ) ); |
---|
43 | |
---|
44 | ! return $file; |
---|
45 | } |
---|
46 | |
---|
47 | |
---|