|
@@ 3218-3241 (lines=24) @@
|
| 3215 |
|
* } |
| 3216 |
|
* @return array|IXR_Error |
| 3217 |
|
*/ |
| 3218 |
|
public function wp_getComment($args) { |
| 3219 |
|
$this->escape($args); |
| 3220 |
|
|
| 3221 |
|
$username = $args[1]; |
| 3222 |
|
$password = $args[2]; |
| 3223 |
|
$comment_id = (int) $args[3]; |
| 3224 |
|
|
| 3225 |
|
if ( ! $user = $this->login( $username, $password ) ) { |
| 3226 |
|
return $this->error; |
| 3227 |
|
} |
| 3228 |
|
|
| 3229 |
|
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ |
| 3230 |
|
do_action( 'xmlrpc_call', 'wp.getComment' ); |
| 3231 |
|
|
| 3232 |
|
if ( ! $comment = get_comment( $comment_id ) ) { |
| 3233 |
|
return new IXR_Error( 404, __( 'Invalid comment ID.' ) ); |
| 3234 |
|
} |
| 3235 |
|
|
| 3236 |
|
if ( ! current_user_can( 'edit_comment', $comment_id ) ) { |
| 3237 |
|
return new IXR_Error( 403, __( 'Sorry, you are not allowed to moderate or edit this comment.' ) ); |
| 3238 |
|
} |
| 3239 |
|
|
| 3240 |
|
return $this->_prepare_comment( $comment ); |
| 3241 |
|
} |
| 3242 |
|
|
| 3243 |
|
/** |
| 3244 |
|
* Retrieve comments. |
|
@@ 3920-3940 (lines=21) @@
|
| 3917 |
|
* - 'description' |
| 3918 |
|
* - 'metadata' |
| 3919 |
|
*/ |
| 3920 |
|
public function wp_getMediaItem( $args ) { |
| 3921 |
|
$this->escape( $args ); |
| 3922 |
|
|
| 3923 |
|
$username = $args[1]; |
| 3924 |
|
$password = $args[2]; |
| 3925 |
|
$attachment_id = (int) $args[3]; |
| 3926 |
|
|
| 3927 |
|
if ( !$user = $this->login($username, $password) ) |
| 3928 |
|
return $this->error; |
| 3929 |
|
|
| 3930 |
|
if ( !current_user_can( 'upload_files' ) ) |
| 3931 |
|
return new IXR_Error( 403, __( 'Sorry, you are not allowed to upload files.' ) ); |
| 3932 |
|
|
| 3933 |
|
/** This action is documented in wp-includes/class-wp-xmlrpc-server.php */ |
| 3934 |
|
do_action( 'xmlrpc_call', 'wp.getMediaItem' ); |
| 3935 |
|
|
| 3936 |
|
if ( ! $attachment = get_post($attachment_id) ) |
| 3937 |
|
return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); |
| 3938 |
|
|
| 3939 |
|
return $this->_prepare_media_item( $attachment ); |
| 3940 |
|
} |
| 3941 |
|
|
| 3942 |
|
/** |
| 3943 |
|
* Retrieves a collection of media library items (or attachments) |