| 1 | diff --git a/wp-includes/class.wp-xmlrpc-server.php b/wp-includes/class.wp-xmlrpc-server.php |
|---|
| 2 | index fac23ea..decec33 100644 |
|---|
| 3 | --- a/wp-includes/class.wp-xmlrpc-server.php |
|---|
| 4 | +++ b/wp-includes/class.wp-xmlrpc-server.php |
|---|
| 5 | @@ -1484,13 +1484,24 @@ class wp_xmlrpc_server extends IXR_Server { |
|---|
| 6 | } |
|---|
| 7 | |
|---|
| 8 | /** |
|---|
| 9 | - * Retrieve media item. |
|---|
| 10 | + * Retrieve a media item by ID |
|---|
| 11 | * |
|---|
| 12 | * @since 3.1.0 |
|---|
| 13 | - * @todo Docment this! |
|---|
| 14 | * |
|---|
| 15 | - * @param array $args Method parameters. |
|---|
| 16 | - * @return array |
|---|
| 17 | + * @param array $args Method parameters. Contains: |
|---|
| 18 | + * - blog_id |
|---|
| 19 | + * - username |
|---|
| 20 | + * - password |
|---|
| 21 | + * - attachment_id |
|---|
| 22 | + * @return array. Assocciative array containing: |
|---|
| 23 | + * - 'date_created_gmt' |
|---|
| 24 | + * - 'parent' |
|---|
| 25 | + * - 'link' |
|---|
| 26 | + * - 'thumbnail' |
|---|
| 27 | + * - 'title' |
|---|
| 28 | + * - 'caption' |
|---|
| 29 | + * - 'description' |
|---|
| 30 | + * - 'metadata' |
|---|
| 31 | */ |
|---|
| 32 | function wp_getMediaItem($args) { |
|---|
| 33 | $this->escape($args); |
|---|
| 34 | @@ -1533,13 +1544,27 @@ class wp_xmlrpc_server extends IXR_Server { |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | /** |
|---|
| 38 | - * Retrieve media library items. |
|---|
| 39 | - * |
|---|
| 40 | + * Retrieves a collection of media library items (or attachments) |
|---|
| 41 | + * |
|---|
| 42 | + * Besides the common blog_id, username, and password arguments, it takes a filter |
|---|
| 43 | + * array as last argument. |
|---|
| 44 | + * |
|---|
| 45 | + * Accepted 'filter' keys are 'parent_id', 'mime_type', 'offset', and 'number'. |
|---|
| 46 | + * |
|---|
| 47 | + * The defaults are as follows: |
|---|
| 48 | + * - 'number' - Default is 5. Total number of media items to retrieve. |
|---|
| 49 | + * - 'offset' - Default is 0. See {@link WP_Query::query()} for more. |
|---|
| 50 | + * - 'parent_id' - Default is ''. The post where the media item is attached. Empty string shows all media items. 0 shows unattached media items. |
|---|
| 51 | + * - 'mime_type' - Default is ''. Filter by mime type (e.g., 'image/jpeg', 'application/pdf') |
|---|
| 52 | + * |
|---|
| 53 | * @since 3.1.0 |
|---|
| 54 | - * @todo Document this. |
|---|
| 55 | * |
|---|
| 56 | - * @param array $args Method parameters. |
|---|
| 57 | - * @return array |
|---|
| 58 | + * @param array $args Method parameters. Contains: |
|---|
| 59 | + * - blog_id |
|---|
| 60 | + * - username |
|---|
| 61 | + * - password |
|---|
| 62 | + * - filter |
|---|
| 63 | + * @return array. Contains a collection of media items. See {@link wp_xmlrpc_server::wp_getMediaItem()} for a description of each item contents |
|---|
| 64 | */ |
|---|
| 65 | function wp_getMediaLibrary($args) { |
|---|
| 66 | $raw_args = $args; |
|---|
| 67 | @@ -1558,8 +1583,8 @@ class wp_xmlrpc_server extends IXR_Server { |
|---|
| 68 | |
|---|
| 69 | do_action('xmlrpc_call', 'wp.getMediaLibrary'); |
|---|
| 70 | |
|---|
| 71 | - $parent_id = ( isset($struct['parent_id']) ) ? absint($struct['parent_id']) : 0 ; |
|---|
| 72 | - $mime_type = ( isset($struct['mime_type']) ) ? absint($struct['mime_type']) : '' ; |
|---|
| 73 | + $parent_id = ( isset($struct['parent_id']) ) ? absint($struct['parent_id']) : '' ; |
|---|
| 74 | + $mime_type = ( isset($struct['mime_type']) ) ? $struct['mime_type'] : '' ; |
|---|
| 75 | $offset = ( isset($struct['offset']) ) ? absint($struct['offset']) : 0 ; |
|---|
| 76 | $number = ( isset($struct['number']) ) ? absint($struct['number']) : -1 ; |
|---|
| 77 | |
|---|