[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/ -> class-wp-xmlrpc-server.php (summary)

XML-RPC protocol support for WordPress

File Size: 7123 lines (213 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

wp_xmlrpc_server:: (106 methods):
  __construct()
  set_is_enabled()
  __call()
  serve_request()
  sayHello()
  addTwoNumbers()
  login()
  login_pass_ok()
  escape()
  error()
  get_custom_fields()
  set_custom_fields()
  get_term_custom_fields()
  set_term_custom_fields()
  initialise_blog_option_info()
  wp_getUsersBlogs()
  minimum_args()
  _prepare_taxonomy()
  _prepare_term()
  _convert_date()
  _convert_date_gmt()
  _prepare_post()
  _prepare_post_type()
  _prepare_media_item()
  _prepare_page()
  _prepare_comment()
  _prepare_user()
  wp_newPost()
  _is_greater_than_one()
  _toggle_sticky()
  _insert_post()
  wp_editPost()
  wp_deletePost()
  wp_getPost()
  wp_getPosts()
  wp_newTerm()
  wp_editTerm()
  wp_deleteTerm()
  wp_getTerm()
  wp_getTerms()
  wp_getTaxonomy()
  wp_getTaxonomies()
  wp_getUser()
  wp_getUsers()
  wp_getProfile()
  wp_editProfile()
  wp_getPage()
  wp_getPages()
  wp_newPage()
  wp_deletePage()
  wp_editPage()
  wp_getPageList()
  wp_getAuthors()
  wp_getTags()
  wp_newCategory()
  wp_deleteCategory()
  wp_suggestCategories()
  wp_getComment()
  wp_getComments()
  wp_deleteComment()
  wp_editComment()
  wp_newComment()
  wp_getCommentStatusList()
  wp_getCommentCount()
  wp_getPostStatusList()
  wp_getPageStatusList()
  wp_getPageTemplates()
  wp_getOptions()
  _getOptions()
  wp_setOptions()
  wp_getMediaItem()
  wp_getMediaLibrary()
  wp_getPostFormats()
  wp_getPostType()
  wp_getPostTypes()
  wp_getRevisions()
  wp_restoreRevision()
  blogger_getUsersBlogs()
  _multisite_getUsersBlogs()
  blogger_getUserInfo()
  blogger_getPost()
  blogger_getRecentPosts()
  blogger_getTemplate()
  blogger_setTemplate()
  blogger_newPost()
  blogger_editPost()
  blogger_deletePost()
  mw_newPost()
  add_enclosure_if_new()
  attach_uploads()
  mw_editPost()
  mw_getPost()
  mw_getRecentPosts()
  mw_getCategories()
  mw_newMediaObject()
  mt_getRecentPostTitles()
  mt_getCategoryList()
  mt_getPostCategories()
  mt_setPostCategories()
  mt_supportedMethods()
  mt_supportedTextFilters()
  mt_getTrackbackPings()
  mt_publishPost()
  pingback_ping()
  pingback_extensions_getPingbacks()
  pingback_error()


Class: wp_xmlrpc_server  - X-Ref

WordPress XMLRPC server implementation.

Implements compatibility for Blogger API, MetaWeblog API, MovableType, and
pingback. Additional WordPress API for managing comments, pages, posts,
options, etc.

As of WordPress 3.5.0, XML-RPC is enabled by default. It can be disabled
via the {@see 'xmlrpc_enabled'} filter found in wp_xmlrpc_server::set_is_enabled().

__construct()   X-Ref
Registers all of the XMLRPC methods that XMLRPC server understands.

Sets up server and method property. Passes XMLRPC
methods through the {@see 'xmlrpc_methods'} filter to allow plugins to extend
or replace XML-RPC methods.

since: 1.5.0

set_is_enabled()   X-Ref
Set wp_xmlrpc_server::$is_enabled property.

Determine whether the xmlrpc server is enabled on this WordPress install
and set the is_enabled property accordingly.

since: 5.7.3

__call( $name, $arguments )   X-Ref
Make private/protected methods readable for backward compatibility.

return: array|IXR_Error|false Return value of the callback, false otherwise.
param: string $name      Method to call.
param: array  $arguments Arguments to pass when calling.
since: 4.0.0

serve_request()   X-Ref
Serves the XML-RPC request.

since: 2.9.0

sayHello()   X-Ref
Test XMLRPC API by saying, "Hello!" to client.

return: string Hello string response.
since: 1.5.0

addTwoNumbers( $args )   X-Ref
Test XMLRPC API by adding two numbers for client.

return: int Sum of the two given numbers.
param: array $args {
since: 1.5.0

login( $username, $password )   X-Ref
Log user in.

return: WP_User|false WP_User object if authentication passed, false otherwise
param: string $username User's username.
param: string $password User's password.
since: 2.8.0

login_pass_ok( $username, $password )   X-Ref
Check user's credentials. Deprecated.

return: bool Whether authentication passed.
param: string $username User's username.
param: string $password User's password.
since: 1.5.0

escape( &$data )   X-Ref
Escape string or array of strings for database.

return: string|void Returns with string is passed, alters by-reference
param: string|array $data Escape single string or array of strings.
since: 1.5.2

error( $error, $message = false )   X-Ref
Send error response to client.

Send an XML error response to the client. If the endpoint is enabled
an HTTP 200 response is always sent per the XML-RPC specification.

param: IXR_Error|string $error   Error code or an error object.
param: false            $message Error message. Optional.
since: 5.7.3

get_custom_fields( $post_id )   X-Ref
Retrieve custom fields for post.

return: array Custom fields, if exist.
param: int $post_id Post ID.
since: 2.5.0

set_custom_fields( $post_id, $fields )   X-Ref
Set custom fields for post.

param: int   $post_id Post ID.
param: array $fields  Custom fields.
since: 2.5.0

get_term_custom_fields( $term_id )   X-Ref
Retrieve custom fields for a term.

return: array Array of custom fields, if they exist.
param: int $term_id Term ID.
since: 4.9.0

set_term_custom_fields( $term_id, $fields )   X-Ref
Set custom fields for a term.

param: int   $term_id Term ID.
param: array $fields  Custom fields.
since: 4.9.0

initialise_blog_option_info()   X-Ref
Set up blog options property.

Passes property through {@see 'xmlrpc_blog_options'} filter.

since: 2.6.0

wp_getUsersBlogs( $args )   X-Ref
Retrieve the blogs of the user.

return: array|IXR_Error Array contains:
param: array $args {
since: 2.6.0

minimum_args( $args, $count )   X-Ref
Checks if the method received at least the minimum number of arguments.

return: bool True if `$args` contains at least `$count` arguments, false otherwise.
param: array $args  An array of arguments to check.
param: int   $count Minimum number of arguments.
since: 3.4.0

_prepare_taxonomy( $taxonomy, $fields )   X-Ref
Prepares taxonomy data for return in an XML-RPC object.

return: array The prepared taxonomy data.
param: WP_Taxonomy $taxonomy The unprepared taxonomy data.
param: array       $fields   The subset of taxonomy fields to return.

_prepare_term( $term )   X-Ref
Prepares term data for return in an XML-RPC object.

return: array The prepared term data.
param: array|object $term The unprepared term data.

_convert_date( $date )   X-Ref
Convert a WordPress date string to an IXR_Date object.

return: IXR_Date IXR_Date object.
param: string $date Date string to convert.

_convert_date_gmt( $date_gmt, $date )   X-Ref
Convert a WordPress GMT date string to an IXR_Date object.

return: IXR_Date IXR_Date object.
param: string $date_gmt WordPress GMT date string.
param: string $date     Date string.

_prepare_post( $post, $fields )   X-Ref
Prepares post data for return in an XML-RPC object.

return: array The prepared post data.
param: array $post   The unprepared post data.
param: array $fields The subset of post type fields to return.

_prepare_post_type( $post_type, $fields )   X-Ref
Prepares post data for return in an XML-RPC object.

return: array The prepared post type data.
param: WP_Post_Type $post_type Post type object.
param: array        $fields    The subset of post fields to return.
since: 3.4.0
since: 4.6.0 Converted the `$post_type` parameter to accept a WP_Post_Type object.

_prepare_media_item( $media_item, $thumbnail_size = 'thumbnail' )   X-Ref
Prepares media item data for return in an XML-RPC object.

return: array The prepared media item data.
param: WP_Post $media_item     The unprepared media item data.
param: string  $thumbnail_size The image size to use for the thumbnail URL.

_prepare_page( $page )   X-Ref
Prepares page data for return in an XML-RPC object.

return: array The prepared page data.
param: WP_Post $page The unprepared page data.

_prepare_comment( $comment )   X-Ref
Prepares comment data for return in an XML-RPC object.

return: array The prepared comment data.
param: WP_Comment $comment The unprepared comment data.

_prepare_user( $user, $fields )   X-Ref
Prepares user data for return in an XML-RPC object.

return: array The prepared user data.
param: WP_User $user   The unprepared user object.
param: array   $fields The subset of user fields to return.

wp_newPost( $args )   X-Ref
Create a new post for any registered post type.

return: int|IXR_Error Post ID on success, IXR_Error instance otherwise.
param: array $args {
since: 3.4.0

_is_greater_than_one( $count )   X-Ref
Helper method for filtering out elements from an array.

return: bool True if the number is greater than one, false otherwise.
param: int $count Number to compare to one.
since: 3.4.0

_toggle_sticky( $post_data, $update = false )   X-Ref
Encapsulate the logic for sticking a post
and determining if the user has permission to do so

return: void|IXR_Error
param: array $post_data
param: bool  $update
since: 4.3.0

_insert_post( $user, $content_struct )   X-Ref
Helper method for wp_newPost() and wp_editPost(), containing shared logic.

return: IXR_Error|string
param: WP_User         $user           The post author if post_author isn't set in $content_struct.
param: array|IXR_Error $content_struct Post data to insert.
since: 3.4.0

wp_editPost( $args )   X-Ref
Edit a post for any registered post type.

The $content_struct parameter only needs to contain fields that
should be changed. All other fields will retain their existing values.

return: true|IXR_Error True on success, IXR_Error on failure.
param: array $args {
since: 3.4.0

wp_deletePost( $args )   X-Ref
Delete a post for any registered post type.

return: true|IXR_Error True on success, IXR_Error instance on failure.
param: array $args {
since: 3.4.0

wp_getPost( $args )   X-Ref
Retrieve a post.

return: array|IXR_Error Array contains (based on $fields parameter):
param: array $args {
since: 3.4.0

wp_getPosts( $args )   X-Ref
Retrieve posts.

return: array|IXR_Error Array contains a collection of posts.
param: array $args {
since: 3.4.0

wp_newTerm( $args )   X-Ref
Create a new term.

return: int|IXR_Error The term ID on success, or an IXR_Error object on failure.
param: array $args {
since: 3.4.0

wp_editTerm( $args )   X-Ref
Edit a term.

return: true|IXR_Error True on success, IXR_Error instance on failure.
param: array $args {
since: 3.4.0

wp_deleteTerm( $args )   X-Ref
Delete a term.

return: true|IXR_Error True on success, IXR_Error instance on failure.
param: array $args {
since: 3.4.0

wp_getTerm( $args )   X-Ref
Retrieve a term.

return: array|IXR_Error IXR_Error on failure, array on success, containing:
param: array $args {
since: 3.4.0

wp_getTerms( $args )   X-Ref
Retrieve all terms for a taxonomy.

return: array|IXR_Error An associative array of terms data on success, IXR_Error instance otherwise.
param: array $args {
since: 3.4.0

wp_getTaxonomy( $args )   X-Ref
Retrieve a taxonomy.

return: array|IXR_Error An array of taxonomy data on success, IXR_Error instance otherwise.
param: array $args {
since: 3.4.0

wp_getTaxonomies( $args )   X-Ref
Retrieve all taxonomies.

return: array|IXR_Error An associative array of taxonomy data with returned fields determined
param: array $args {
since: 3.4.0

wp_getUser( $args )   X-Ref
Retrieve a user.

The optional $fields parameter specifies what fields will be included
in the response array. This should be a list of field names. 'user_id' will
always be included in the response regardless of the value of $fields.

Instead of, or in addition to, individual field names, conceptual group
names can be used to specify multiple fields. The available conceptual
groups are 'basic' and 'all'.

return: array|IXR_Error Array contains (based on $fields parameter):
param: array $args {

wp_getUsers( $args )   X-Ref
Retrieve users.

The optional $filter parameter modifies the query used to retrieve users.
Accepted keys are 'number' (default: 50), 'offset' (default: 0), 'role',
'who', 'orderby', and 'order'.

The optional $fields parameter specifies what fields will be included
in the response array.

return: array|IXR_Error users data
param: array $args {

wp_getProfile( $args )   X-Ref
Retrieve information about the requesting user.

return: array|IXR_Error (@see wp_getUser)
param: array $args {

wp_editProfile( $args )   X-Ref
Edit user's profile.

return: true|IXR_Error True, on success.
param: array $args {

wp_getPage( $args )   X-Ref
Retrieve page.

return: array|IXR_Error
param: array $args {
since: 2.2.0

wp_getPages( $args )   X-Ref
Retrieve Pages.

return: array|IXR_Error
param: array $args {
since: 2.2.0

wp_newPage( $args )   X-Ref
Create new page.

return: int|IXR_Error
param: array $args {
since: 2.2.0

wp_deletePage( $args )   X-Ref
Delete page.

return: true|IXR_Error True, if success.
param: array $args {
since: 2.2.0

wp_editPage( $args )   X-Ref
Edit page.

return: array|IXR_Error
param: array $args {
since: 2.2.0

wp_getPageList( $args )   X-Ref
Retrieve page list.

return: array|IXR_Error
param: array $args {
since: 2.2.0

wp_getAuthors( $args )   X-Ref
Retrieve authors list.

return: array|IXR_Error
param: array $args {
since: 2.2.0

wp_getTags( $args )   X-Ref
Get list of all tags

return: array|IXR_Error
param: array $args {
since: 2.7.0

wp_newCategory( $args )   X-Ref
Create new category.

return: int|IXR_Error Category ID.
param: array $args {
since: 2.2.0

wp_deleteCategory( $args )   X-Ref
Remove category.

return: bool|IXR_Error See wp_delete_term() for return info.
param: array $args {
since: 2.5.0

wp_suggestCategories( $args )   X-Ref
Retrieve category list.

return: array|IXR_Error
param: array $args {
since: 2.2.0

wp_getComment( $args )   X-Ref
Retrieve comment.

return: array|IXR_Error
param: array $args {
since: 2.7.0

wp_getComments( $args )   X-Ref
Retrieve comments.

Besides the common blog_id (unused), username, and password arguments, it takes a filter
array as last argument.

Accepted 'filter' keys are 'status', 'post_id', 'offset', and 'number'.

The defaults are as follows:
- 'status' - Default is ''. Filter by status (e.g., 'approve', 'hold')
- 'post_id' - Default is ''. The post where the comment is posted. Empty string shows all comments.
- 'number' - Default is 10. Total number of media items to retrieve.
- 'offset' - Default is 0. See WP_Query::query() for more.

return: array|IXR_Error Contains a collection of comments. See wp_xmlrpc_server::wp_getComment() for a description of each item contents
param: array $args {
since: 2.7.0

wp_deleteComment( $args )   X-Ref
Delete a comment.

By default, the comment will be moved to the Trash instead of deleted.
See wp_delete_comment() for more information on this behavior.

return: bool|IXR_Error See wp_delete_comment().
param: array $args {
since: 2.7.0

wp_editComment( $args )   X-Ref
Edit comment.

Besides the common blog_id (unused), username, and password arguments, it takes a
comment_id integer and a content_struct array as last argument.

The allowed keys in the content_struct array are:
- 'author'
- 'author_url'
- 'author_email'
- 'content'
- 'date_created_gmt'
- 'status'. Common statuses are 'approve', 'hold', 'spam'. See get_comment_statuses() for more details

return: true|IXR_Error True, on success.
param: array $args {
since: 2.7.0

wp_newComment( $args )   X-Ref
Create new comment.

return: int|IXR_Error See wp_new_comment().
param: array $args {
since: 2.7.0

wp_getCommentStatusList( $args )   X-Ref
Retrieve all of the comment status.

return: array|IXR_Error
param: array $args {
since: 2.7.0

wp_getCommentCount( $args )   X-Ref
Retrieve comment count.

return: array|IXR_Error
param: array $args {
since: 2.5.0

wp_getPostStatusList( $args )   X-Ref
Retrieve post statuses.

return: array|IXR_Error
param: array $args {
since: 2.5.0

wp_getPageStatusList( $args )   X-Ref
Retrieve page statuses.

return: array|IXR_Error
param: array $args {
since: 2.5.0

wp_getPageTemplates( $args )   X-Ref
Retrieve page templates.

return: array|IXR_Error
param: array $args {
since: 2.6.0

wp_getOptions( $args )   X-Ref
Retrieve blog options.

return: array|IXR_Error
param: array $args {
since: 2.6.0

_getOptions( $options )   X-Ref
Retrieve blog options value from list.

return: array
param: array $options Options to retrieve.
since: 2.6.0

wp_setOptions( $args )   X-Ref
Update blog options.

return: array|IXR_Error
param: array $args {
since: 2.6.0

wp_getMediaItem( $args )   X-Ref
Retrieve a media item by ID

return: array|IXR_Error Associative array contains:
param: array $args {
since: 3.1.0

wp_getMediaLibrary( $args )   X-Ref
Retrieves a collection of media library items (or attachments)

Besides the common blog_id (unused), username, and password arguments, it takes a filter
array as last argument.

Accepted 'filter' keys are 'parent_id', 'mime_type', 'offset', and 'number'.

The defaults are as follows:
- 'number' - Default is 5. Total number of media items to retrieve.
- 'offset' - Default is 0. See WP_Query::query() for more.
- 'parent_id' - Default is ''. The post where the media item is attached. Empty string shows all media items. 0 shows unattached media items.
- 'mime_type' - Default is ''. Filter by mime type (e.g., 'image/jpeg', 'application/pdf')

return: array|IXR_Error Contains a collection of media items. See wp_xmlrpc_server::wp_getMediaItem() for a description of each item contents
param: array $args {
since: 3.1.0

wp_getPostFormats( $args )   X-Ref
Retrieves a list of post formats used by the site.

return: array|IXR_Error List of post formats, otherwise IXR_Error object.
param: array $args {
since: 3.1.0

wp_getPostType( $args )   X-Ref
Retrieves a post type

return: array|IXR_Error Array contains:
param: array $args {
since: 3.4.0

wp_getPostTypes( $args )   X-Ref
Retrieves a post types

return: array|IXR_Error
param: array $args {
since: 3.4.0

wp_getRevisions( $args )   X-Ref
Retrieve revisions for a specific post.

return: array|IXR_Error contains a collection of posts.
param: array $args {
since: 3.5.0

wp_restoreRevision( $args )   X-Ref
Restore a post revision

return: bool|IXR_Error false if there was an error restoring, true if success.
param: array $args {
since: 3.5.0

blogger_getUsersBlogs( $args )   X-Ref
Retrieve blogs that user owns.

Will make more sense once we support multiple blogs.

return: array|IXR_Error
param: array $args {
since: 1.5.0

_multisite_getUsersBlogs( $args )   X-Ref
Private function for retrieving a users blogs for multisite setups

return: array|IXR_Error
param: array $args {
since: 3.0.0

blogger_getUserInfo( $args )   X-Ref
Retrieve user's data.

Gives your client some info about you, so you don't have to.

return: array|IXR_Error
param: array $args {
since: 1.5.0

blogger_getPost( $args )   X-Ref
Retrieve post.

return: array|IXR_Error
param: array $args {
since: 1.5.0

blogger_getRecentPosts( $args )   X-Ref
Retrieve list of recent posts.

return: array|IXR_Error
param: array $args {
since: 1.5.0

blogger_getTemplate( $args )   X-Ref
Deprecated.

return: IXR_Error Error object.
param: array $args Unused.
since: 1.5.0

blogger_setTemplate( $args )   X-Ref
Deprecated.

return: IXR_Error Error object.
param: array $args Unused.
since: 1.5.0

blogger_newPost( $args )   X-Ref
Creates new post.

return: int|IXR_Error
param: array $args {
since: 1.5.0

blogger_editPost( $args )   X-Ref
Edit a post.

return: true|IXR_Error true when done.
param: array $args {
since: 1.5.0

blogger_deletePost( $args )   X-Ref
Remove a post.

return: true|IXR_Error True when post is deleted.
param: array $args {
since: 1.5.0

mw_newPost( $args )   X-Ref
Create a new post.

The 'content_struct' argument must contain:
- title
- description
- mt_excerpt
- mt_text_more
- mt_keywords
- mt_tb_ping_urls
- categories

Also, it can optionally contain:
- wp_slug
- wp_password
- wp_page_parent_id
- wp_page_order
- wp_author_id
- post_status | page_status - can be 'draft', 'private', 'publish', or 'pending'
- mt_allow_comments - can be 'open' or 'closed'
- mt_allow_pings - can be 'open' or 'closed'
- date_created_gmt
- dateCreated
- wp_post_thumbnail

return: int|IXR_Error
param: array $args {
since: 1.5.0

add_enclosure_if_new( $post_ID, $enclosure )   X-Ref
Adds an enclosure to a post if it's new.

param: int   $post_ID   Post ID.
param: array $enclosure Enclosure data.
since: 2.8.0

attach_uploads( $post_ID, $post_content )   X-Ref
Attach upload to a post.

param: int    $post_ID      Post ID.
param: string $post_content Post Content for attachment.
since: 2.1.0

mw_editPost( $args )   X-Ref
Edit a post.

return: true|IXR_Error True on success.
param: array $args {
since: 1.5.0

mw_getPost( $args )   X-Ref
Retrieve post.

return: array|IXR_Error
param: array $args {
since: 1.5.0

mw_getRecentPosts( $args )   X-Ref
Retrieve list of recent posts.

return: array|IXR_Error
param: array $args {
since: 1.5.0

mw_getCategories( $args )   X-Ref
Retrieve the list of categories on a given blog.

return: array|IXR_Error
param: array $args {
since: 1.5.0

mw_newMediaObject( $args )   X-Ref
Uploads a file, following your settings.

Adapted from a patch by Johann Richard.

return: array|IXR_Error
param: array $args {
since: 1.5.0

mt_getRecentPostTitles( $args )   X-Ref
Retrieve the post titles of recent posts.

return: array|IXR_Error
param: array $args {
since: 1.5.0

mt_getCategoryList( $args )   X-Ref
Retrieve list of all categories on blog.

return: array|IXR_Error
param: array $args {
since: 1.5.0

mt_getPostCategories( $args )   X-Ref
Retrieve post categories.

return: array|IXR_Error
param: array $args {
since: 1.5.0

mt_setPostCategories( $args )   X-Ref
Sets categories for a post.

return: true|IXR_Error True on success.
param: array $args {
since: 1.5.0

mt_supportedMethods()   X-Ref
Retrieve an array of methods supported by this server.

return: array
since: 1.5.0

mt_supportedTextFilters()   X-Ref
Retrieve an empty array because we don't support per-post text filters.

since: 1.5.0

mt_getTrackbackPings( $post_ID )   X-Ref
Retrieve trackbacks sent to a given post.

return: array|IXR_Error
param: int $post_ID
since: 1.5.0

mt_publishPost( $args )   X-Ref
Sets a post's publish status to 'publish'.

return: int|IXR_Error
param: array $args {
since: 1.5.0

pingback_ping( $args )   X-Ref
Retrieves a pingback and registers it.

return: string|IXR_Error
param: array $args {
since: 1.5.0

pingback_extensions_getPingbacks( $url )   X-Ref
Retrieve array of URLs that pingbacked the given URL.

Specs on http://www.aquarionics.com/misc/archives/blogite/0198.html

return: array|IXR_Error
param: string $url
since: 1.5.0

pingback_error( $code, $message )   X-Ref
Sends a pingback error based on the given error code and message.

return: IXR_Error Error object.
param: int    $code    Error code.
param: string $message Error message.
since: 3.6.0



Generated: Thu Nov 21 01:00:03 2024 Cross-referenced by PHPXref 0.7.1