Make WordPress Core

Ticket #27506: 27506.3.diff

File 27506.3.diff, 43.6 KB (added by kpdesign, 11 years ago)

Third pass

  • src/wp-includes/class-wp-xmlrpc-server.php

     
    127127                );
    128128
    129129                $this->initialise_blog_option_info();
    130                 $this->methods = apply_filters('xmlrpc_methods', $this->methods);
     130
     131                /**
     132                 * Filter the methods exposed by the XML-RPC server.
     133                 *
     134                 * This filter can be used to add new methods, and remove built-in methods.
     135                 *
     136                 * @since 1.5.0
     137                 *
     138                 * @param array $methods An array of XML-RPC methods.
     139                 */
     140                $this->methods = apply_filters( 'xmlrpc_methods', $this->methods );
    131141        }
    132142
    133143        function serve_request() {
     
    171181         */
    172182        function login( $username, $password ) {
    173183                // Respect any old filters against get_option() for 'enable_xmlrpc'.
    174                 $enabled = apply_filters( 'pre_option_enable_xmlrpc', false ); // Deprecated
     184
     185                /**
     186                 * Filter whether XML-RPC is enabled.
     187                 *
     188                 * @since 3.5.0
     189                 * @deprecated 3.5.0 Use 'xmlrpc_enabled' instead.
     190                 *
     191                 * @param bool $enable Whether to enable XML-RPC. Default false.
     192                 */
     193                $enabled = apply_filters( 'pre_option_enable_xmlrpc', false );
    175194                if ( false === $enabled )
    176                         $enabled = apply_filters( 'option_enable_xmlrpc', true ); // Deprecated
    177195
    178                 // Proper filter for turning off XML-RPC. It is on by default.
     196                        /**
     197                         * Filter whether XML-RPC is enabled.
     198                         *
     199                         * @since 3.5.0
     200                         * @deprecated 3.5.0 Use xmlrpc_enabled instead.
     201                         *
     202                         * @param bool $enable Whether to enable XML-RPC. Default true.
     203                         */
     204                        $enabled = apply_filters( 'option_enable_xmlrpc', true );
     205
     206                /**
     207                 * Filter whether XML-RPC is enabled.
     208                 *
     209                 * This is the proper filter for turning off XML-RPC.
     210                 *
     211                 * @since 3.5.0
     212                 *
     213                 * @param bool $enabled Whether XML-RPC is enabled. Default true.
     214                 */
    179215                $enabled = apply_filters( 'xmlrpc_enabled', $enabled );
    180216
    181217                if ( ! $enabled ) {
     
    187223
    188224                if (is_wp_error($user)) {
    189225                        $this->error = new IXR_Error( 403, __( 'Incorrect username or password.' ) );
     226
     227                        /**
     228                         * Filter the XML-RPC user login error message.
     229                         *
     230                         * @since 3.5.0
     231                         *
     232                         * @param string  $error The XML-RPC error message.
     233                         * @param WP_User $user  WP_User object.
     234                         */
    190235                        $this->error = apply_filters( 'xmlrpc_login_error', $this->error, $user );
    191236                        return false;
    192237                }
     
    441486                        )
    442487                );
    443488
     489                /**
     490                 * Filter the XML-RPC blog options property.
     491                 *
     492                 * @since 2.6.0
     493                 *
     494                 * @param array $blog_options An array of XML-RPC blog options.
     495                 */
    444496                $this->blog_options = apply_filters( 'xmlrpc_blog_options', $this->blog_options );
    445497        }
    446498
     
    474526                if ( !$user = $this->login($username, $password) )
    475527                        return $this->error;
    476528
     529                /**
     530                 * Fires after the XML-RPC user has been authenticated but before the rest of
     531                 * the method logic begins.
     532                 *
     533                 * All built-in XML-RPC methods use the action xmlrpc_call, with a parameter
     534                 * equal to the method's name, e.g., wp.getUsersBlogs, wp.newPost, etc.
     535                 *
     536                 * @since 2.5.0
     537                 *
     538                 * @param method $name The method name.
     539                 */
    477540                do_action( 'xmlrpc_call', 'wp.getUsersBlogs' );
    478541
    479542                $blogs = (array) get_blogs_of_user( $user->ID );
     
    553616                if ( in_array( 'object_type', $fields ) )
    554617                        $_taxonomy['object_type'] = array_unique( (array) $taxonomy->object_type );
    555618
     619                /**
     620                 * Filter XML-RPC-prepared data for the given taxonomy.
     621                 *
     622                 * @since 3.4.0
     623                 *
     624                 * @param array  $_taxonomy An array of taxonomy data.
     625                 * @param object $taxonomy  Taxonomy object.
     626                 * @param array  $fields    The subset of taxonomy fields to return.
     627                 */
    556628                return apply_filters( 'xmlrpc_prepare_taxonomy', $_taxonomy, $taxonomy, $fields );
    557629        }
    558630
     
    578650                // Count we are happy to return as an integer because people really shouldn't use terms that much.
    579651                $_term['count'] = intval( $_term['count'] );
    580652
     653                /**
     654                 * Filter XML-RPC-prepared data for the given term.
     655                 *
     656                 * @since 3.4.0
     657                 *
     658                 * @param array        $_term An array of term data.
     659                 * @param array|object $term  Term object or array.
     660                 */
    581661                return apply_filters( 'xmlrpc_prepare_term', $_term, $term );
    582662        }
    583663
     
    699779                        }
    700780                }
    701781
     782                /**
     783                 * Filter XML-RPC-prepared date for the given post.
     784                 *
     785                 * @since 3.4.0
     786                 *
     787                 * @param array $_post  An array of modified post data.
     788                 * @param array $post   An array of post data.
     789                 * @param array $fields An array of post fields.
     790                 */
    702791                return apply_filters( 'xmlrpc_prepare_post', $_post, $post, $fields );
    703792        }
    704793
     
    741830                if ( in_array( 'taxonomies', $fields ) )
    742831                        $_post_type['taxonomies'] = get_object_taxonomies( $post_type->name, 'names' );
    743832
     833                /**
     834                 * Filter XML-RPC-prepared date for the given post type.
     835                 *
     836                 * @since 3.4.0
     837                 *
     838                 * @param array  $_post_type An array of post type data.
     839                 * @param object $post_type  Post type object.
     840                 */
    744841                return apply_filters( 'xmlrpc_prepare_post_type', $_post_type, $post_type );
    745842        }
    746843
     
    771868                else
    772869                        $_media_item['thumbnail'] = $_media_item['link'];
    773870
     871                /**
     872                 * Filter XML-RPC-prepared data for the given media item.
     873                 *
     874                 * @since 3.4.0
     875                 *
     876                 * @param array  $_media_item    An array of media item data.
     877                 * @param object $media_item     Media item object.
     878                 * @param string $thumbnail_size Image size.
     879                 */
    774880                return apply_filters( 'xmlrpc_prepare_media_item', $_media_item, $media_item, $thumbnail_size );
    775881        }
    776882
     
    842948                        'wp_page_template'       => $page_template
    843949                );
    844950
     951                /**
     952                 * Filter XML-RPC-prepared data for the given page.
     953                 *
     954                 * @since 3.4.0
     955                 *
     956                 * @param array   $_page An array of page data.
     957                 * @param WP_Post $page  Page object.
     958                 */
    845959                return apply_filters( 'xmlrpc_prepare_page', $_page, $page );
    846960        }
    847961
     
    884998                        'type'             => $comment->comment_type,
    885999                );
    8861000
     1001                /**
     1002                 * Filter XML-RPC-prepared data for the given comment.
     1003                 *
     1004                 * @since 3.4.0
     1005                 *
     1006                 * @param array  $_comment An array of prepared comment data.
     1007                 * @param object $comment  Comment object.
     1008                 */
    8871009                return apply_filters( 'xmlrpc_prepare_comment', $_comment, $comment );
    8881010        }
    8891011
     
    9241046                        $_user = array_merge( $_user, $requested_fields );
    9251047                }
    9261048
     1049                /**
     1050                 * Filter XML-RPC-prepared data for the given user.
     1051                 *
     1052                 * @since 3.5.0
     1053                 *
     1054                 * @param array   $_user  An array of user data.
     1055                 * @param WP_User $user   User object.
     1056                 * @param array   $fields An array of user fields.
     1057                 */
    9271058                return apply_filters( 'xmlrpc_prepare_user', $_user, $user, $fields );
    9281059        }
    9291060
     
    9721103                if ( ! $user = $this->login( $username, $password ) )
    9731104                        return $this->error;
    9741105
     1106                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    9751107                do_action( 'xmlrpc_call', 'wp.newPost' );
    9761108
    9771109                unset( $content_struct['ID'] );
     
    12151347
    12161348                $this->attach_uploads( $post_ID, $post_data['post_content'] );
    12171349
     1350                /**
     1351                 * Filter post data array to be inserted via XML-RPC.
     1352                 *
     1353                 * @since 3.4.0
     1354                 *
     1355                 * @param array $post_data      Parsed array of post data.
     1356                 * @param array $content_struct Post data array.
     1357                 */
    12181358                $post_data = apply_filters( 'xmlrpc_wp_insert_post_data', $post_data, $content_struct );
    12191359
    12201360                $post_ID = $update ? wp_update_post( $post_data, true ) : wp_insert_post( $post_data, true );
     
    12581398                if ( ! $user = $this->login( $username, $password ) )
    12591399                        return $this->error;
    12601400
     1401                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    12611402                do_action( 'xmlrpc_call', 'wp.editPost' );
    12621403
    12631404                $post = get_post( $post_id, ARRAY_A );
     
    13191460                if ( ! $user = $this->login( $username, $password ) )
    13201461                        return $this->error;
    13211462
     1463                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    13221464                do_action( 'xmlrpc_call', 'wp.deletePost' );
    13231465
    13241466                $post = get_post( $post_id, ARRAY_A );
     
    13941536                if ( isset( $args[4] ) )
    13951537                        $fields = $args[4];
    13961538                else
     1539
     1540                        /**
     1541                         * Filter the conceptual XML-RPC groups used to retrieve a post.
     1542                         *
     1543                         * @since 3.4.0
     1544                         *
     1545                         * @param array $fields An array of conceptual groups. Default 'post',
     1546                         *                      'terms', 'custom_fields'.
     1547                         * @param string $method The method used to retrieve the post fields.
     1548                         *                       Default 'wp.getPost'.
     1549                         */
    13971550                        $fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPost' );
    13981551
    13991552                if ( ! $user = $this->login( $username, $password ) )
    14001553                        return $this->error;
    14011554
     1555                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    14021556                do_action( 'xmlrpc_call', 'wp.getPost' );
    14031557
    14041558                $post = get_post( $post_id, ARRAY_A );
     
    14471601                $password   = $args[2];
    14481602                $filter     = isset( $args[3] ) ? $args[3] : array();
    14491603
    1450                 if ( isset( $args[4] ) )
     1604                if ( isset( $args[4] ) ) {
    14511605                        $fields = $args[4];
    1452                 else
     1606                } else {
     1607                        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    14531608                        $fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPosts' );
     1609                }
    14541610
    14551611                if ( ! $user = $this->login( $username, $password ) )
    14561612                        return $this->error;
    14571613
     1614                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    14581615                do_action( 'xmlrpc_call', 'wp.getPosts' );
    14591616
    14601617                $query = array();
     
    15441701                if ( ! $user = $this->login( $username, $password ) )
    15451702                        return $this->error;
    15461703
     1704                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    15471705                do_action( 'xmlrpc_call', 'wp.newTerm' );
    15481706
    15491707                if ( ! taxonomy_exists( $content_struct['taxonomy'] ) )
     
    16321790                if ( ! $user = $this->login( $username, $password ) )
    16331791                        return $this->error;
    16341792
     1793                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    16351794                do_action( 'xmlrpc_call', 'wp.editTerm' );
    16361795
    16371796                if ( ! taxonomy_exists( $content_struct['taxonomy'] ) )
     
    17241883                if ( ! $user = $this->login( $username, $password ) )
    17251884                        return $this->error;
    17261885
     1886                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    17271887                do_action( 'xmlrpc_call', 'wp.deleteTerm' );
    17281888
    17291889                if ( ! taxonomy_exists( $taxonomy ) )
     
    17911951                if ( ! $user = $this->login( $username, $password ) )
    17921952                        return $this->error;
    17931953
     1954                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    17941955                do_action( 'xmlrpc_call', 'wp.getTerm' );
    17951956
    17961957                if ( ! taxonomy_exists( $taxonomy ) )
     
    18442005                if ( ! $user = $this->login( $username, $password ) )
    18452006                        return $this->error;
    18462007
     2008                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    18472009                do_action( 'xmlrpc_call', 'wp.getTerms' );
    18482010
    18492011                if ( ! taxonomy_exists( $taxonomy ) )
     
    19152077                $password       = $args[2];
    19162078                $taxonomy       = $args[3];
    19172079
    1918                 if ( isset( $args[4] ) )
     2080                if ( isset( $args[4] ) ) {
    19192081                        $fields = $args[4];
    1920                 else
     2082                } else {
     2083                        /**
     2084                         * Filter the taxonomy fields to query for the given XML-RPC method.
     2085                         *
     2086                         * @since 3.4.0
     2087                         *
     2088                         * @param array  $fields An array of taxonomy fields to retrieve.
     2089                         * @param string $method The method name.
     2090                         */
    19212091                        $fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomy' );
     2092                }
    19222093
    19232094                if ( ! $user = $this->login( $username, $password ) )
    19242095                        return $this->error;
    19252096
     2097                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    19262098                do_action( 'xmlrpc_call', 'wp.getTaxonomy' );
    19272099
    19282100                if ( ! taxonomy_exists( $taxonomy ) )
     
    19592131                $password           = $args[2];
    19602132                $filter             = isset( $args[3] ) ? $args[3] : array( 'public' => true );
    19612133
    1962                 if ( isset( $args[4] ) )
     2134                if ( isset( $args[4] ) ) {
    19632135                        $fields = $args[4];
    1964                 else
     2136                } else {
     2137                        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    19652138                        $fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomies' );
     2139                }
    19662140
    19672141                if ( ! $user = $this->login( $username, $password ) )
    19682142                        return $this->error;
    19692143
     2144                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    19702145                do_action( 'xmlrpc_call', 'wp.getTaxonomies' );
    19712146
    19722147                $taxonomies = get_taxonomies( $filter, 'objects' );
     
    20282203                $password   = $args[2];
    20292204                $user_id    = (int) $args[3];
    20302205
    2031                 if ( isset( $args[4] ) )
     2206                if ( isset( $args[4] ) ) {
    20322207                        $fields = $args[4];
    2033                 else
     2208                } else {
     2209                        /**
     2210                         * Filter the default user fields to query for the given XML-RPC method.
     2211                         *
     2212                         * @since 3.5.0
     2213                         *
     2214                         * @param array  $fields User fields to query for given method. Default 'all'.
     2215                         * @param string $method The method name.
     2216                         */
    20342217                        $fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getUser' );
     2218                }
    20352219
    20362220                if ( ! $user = $this->login( $username, $password ) )
    20372221                        return $this->error;
    20382222
     2223                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    20392224                do_action( 'xmlrpc_call', 'wp.getUser' );
    20402225
    20412226                if ( ! current_user_can( 'edit_user', $user_id ) )
     
    20812266                $password   = $args[2];
    20822267                $filter     = isset( $args[3] ) ? $args[3] : array();
    20832268
    2084                 if ( isset( $args[4] ) )
     2269                if ( isset( $args[4] ) ) {
    20852270                        $fields = $args[4];
    2086                 else
     2271                } else {
     2272                        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    20872273                        $fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getUsers' );
     2274                }
    20882275
    20892276                if ( ! $user = $this->login( $username, $password ) )
    20902277                        return $this->error;
    20912278
     2279                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    20922280                do_action( 'xmlrpc_call', 'wp.getUsers' );
    20932281
    20942282                if ( ! current_user_can( 'list_users' ) )
     
    21482336                $username   = $args[1];
    21492337                $password   = $args[2];
    21502338
    2151                 if ( isset( $args[3] ) )
     2339                if ( isset( $args[3] ) ) {
    21522340                        $fields = $args[3];
    2153                 else
     2341                } else {
     2342                        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    21542343                        $fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getProfile' );
     2344                }
    21552345
    21562346                if ( ! $user = $this->login( $username, $password ) )
    21572347                        return $this->error;
    21582348
     2349                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    21592350                do_action( 'xmlrpc_call', 'wp.getProfile' );
    21602351
    21612352                if ( ! current_user_can( 'edit_user', $user->ID ) )
     
    21992390                if ( ! $user = $this->login( $username, $password ) )
    22002391                        return $this->error;
    22012392
     2393                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    22022394                do_action( 'xmlrpc_call', 'wp.editProfile' );
    22032395
    22042396                if ( ! current_user_can( 'edit_user', $user->ID ) )
     
    22722464                if ( !current_user_can( 'edit_page', $page_id ) )
    22732465                        return new IXR_Error( 401, __( 'Sorry, you cannot edit this page.' ) );
    22742466
    2275                 do_action('xmlrpc_call', 'wp.getPage');
     2467                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2468                do_action( 'xmlrpc_call', 'wp.getPage' );
    22762469
    22772470                // If we found the page then format the data.
    22782471                if ( $page->ID && ($page->post_type == 'page') ) {
     
    23102503                if ( !current_user_can( 'edit_pages' ) )
    23112504                        return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
    23122505
    2313                 do_action('xmlrpc_call', 'wp.getPages');
     2506                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2507                do_action( 'xmlrpc_call', 'wp.getPages' );
    23142508
    23152509                $pages = get_posts( array('post_type' => 'page', 'post_status' => 'any', 'numberposts' => $num_pages) );
    23162510                $num_pages = count($pages);
     
    23502544                if ( !$user = $this->login($username, $password) )
    23512545                        return $this->error;
    23522546
    2353                 do_action('xmlrpc_call', 'wp.newPage');
     2547                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2548                do_action( 'xmlrpc_call', 'wp.newPage' );
    23542549
    23552550                // Mark this as content for a page.
    23562551                $args[3]["post_type"] = 'page';
     
    23782573                if ( !$user = $this->login($username, $password) )
    23792574                        return $this->error;
    23802575
    2381                 do_action('xmlrpc_call', 'wp.deletePage');
     2576                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2577                do_action( 'xmlrpc_call', 'wp.deletePage' );
    23822578
    23832579                // Get the current page based on the page_id and
    23842580                // make sure it is a page and not a post.
     
    23952591                if ( !$result )
    23962592                        return(new IXR_Error(500, __('Failed to delete the page.')));
    23972593
     2594                /**
     2595                 * Fires after a page has been successfully deleted via XML-RPC.
     2596                 *
     2597                 * @since 3.4.0
     2598                 *
     2599                 * @param int   $page_id ID of the deleted page.
     2600                 * @param array $args    An array of arguments to delete the page.
     2601                 */
    23982602                do_action( 'xmlrpc_call_success_wp_deletePage', $page_id, $args );
    23992603
    24002604                return(true);
     
    24202624                if ( !$user = $this->login($username, $password) )
    24212625                        return $this->error;
    24222626
    2423                 do_action('xmlrpc_call', 'wp.editPage');
     2627                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2628                do_action( 'xmlrpc_call', 'wp.editPage' );
    24242629
    24252630                // Get the page data and make sure it is a page.
    24262631                $actual_page = get_post($page_id, ARRAY_A);
     
    24702675                if ( !current_user_can( 'edit_pages' ) )
    24712676                        return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
    24722677
    2473                 do_action('xmlrpc_call', 'wp.getPageList');
     2678                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2679                do_action( 'xmlrpc_call', 'wp.getPageList' );
    24742680
    24752681                // Get list of pages ids and titles
    24762682                $page_list = $wpdb->get_results("
     
    25212727                if ( !current_user_can('edit_posts') )
    25222728                        return(new IXR_Error(401, __('Sorry, you cannot edit posts on this site.')));
    25232729
    2524                 do_action('xmlrpc_call', 'wp.getAuthors');
     2730                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2731                do_action( 'xmlrpc_call', 'wp.getAuthors' );
    25252732
    25262733                $authors = array();
    25272734                foreach ( get_users( array( 'fields' => array('ID','user_login','display_name') ) ) as $user ) {
     
    25562763                if ( !current_user_can( 'edit_posts' ) )
    25572764                        return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view tags.' ) );
    25582765
     2766                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    25592767                do_action( 'xmlrpc_call', 'wp.getKeywords' );
    25602768
    25612769                $tags = array();
     
    25952803                if ( !$user = $this->login($username, $password) )
    25962804                        return $this->error;
    25972805
    2598                 do_action('xmlrpc_call', 'wp.newCategory');
     2806                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2807                do_action( 'xmlrpc_call', 'wp.newCategory' );
    25992808
    26002809                // Make sure the user is allowed to add a category.
    26012810                if ( !current_user_can('manage_categories') )
     
    26322841                        return(new IXR_Error(500, __('Sorry, the new category failed.')));
    26332842                }
    26342843
     2844                /**
     2845                 * Fires after a new category has been successfully created via XML-RPC.
     2846                 *
     2847                 * @since 3.4.0
     2848                 *
     2849                 * @param int   $cat_id ID of the new category.
     2850                 * @param array $args   An array of new category arguments.
     2851                 */
    26352852                do_action( 'xmlrpc_call_success_wp_newCategory', $cat_id, $args );
    26362853
    26372854                return $cat_id;
     
    26562873                if ( !$user = $this->login($username, $password) )
    26572874                        return $this->error;
    26582875
    2659                 do_action('xmlrpc_call', 'wp.deleteCategory');
     2876                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2877                do_action( 'xmlrpc_call', 'wp.deleteCategory' );
    26602878
    26612879                if ( !current_user_can('manage_categories') )
    26622880                        return new IXR_Error( 401, __( 'Sorry, you do not have the right to delete a category.' ) );
     
    26632881
    26642882                $status = wp_delete_term( $category_id, 'category' );
    26652883
    2666                 if( true == $status )
     2884                if ( true == $status ) {
     2885                        /**
     2886                         * Fires after a category has been successfully deleted via XML-RPC.
     2887                         *
     2888                         * @since 3.4.0
     2889                         *
     2890                         * @param int   $category_id ID of the deleted category.
     2891                         * @param array $args        An array of arguments to delete the category.
     2892                         */
    26672893                        do_action( 'xmlrpc_call_success_wp_deleteCategory', $category_id, $args );
     2894                }
    26682895
    26692896                return $status;
    26702897        }
     
    26922919                if ( !current_user_can( 'edit_posts' ) )
    26932920                        return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts to this site in order to view categories.' ) );
    26942921
    2695                 do_action('xmlrpc_call', 'wp.suggestCategories');
     2922                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2923                do_action( 'xmlrpc_call', 'wp.suggestCategories' );
    26962924
    26972925                $category_suggestions = array();
    26982926                $args = array('get' => 'all', 'number' => $max_results, 'name__like' => $category);
     
    27282956                if ( !current_user_can( 'moderate_comments' ) )
    27292957                        return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
    27302958
    2731                 do_action('xmlrpc_call', 'wp.getComment');
     2959                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2960                do_action( 'xmlrpc_call', 'wp.getComment' );
    27322961
    27332962                if ( ! $comment = get_comment($comment_id) )
    27342963                        return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
     
    27692998                if ( !current_user_can( 'moderate_comments' ) )
    27702999                        return new IXR_Error( 401, __( 'Sorry, you cannot edit comments.' ) );
    27713000
    2772                 do_action('xmlrpc_call', 'wp.getComments');
     3001                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3002                do_action( 'xmlrpc_call', 'wp.getComments' );
    27733003
    27743004                if ( isset($struct['status']) )
    27753005                        $status = $struct['status'];
     
    28353065                if ( !current_user_can( 'edit_comment', $comment_ID ) )
    28363066                        return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
    28373067
    2838                 do_action('xmlrpc_call', 'wp.deleteComment');
     3068                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3069                do_action( 'xmlrpc_call', 'wp.deleteComment' );
    28393070
    28403071                $status = wp_delete_comment( $comment_ID );
    28413072
    2842                 if( true == $status )
     3073                if ( true == $status ) {
     3074                        /**
     3075                         * Fires after a comment has been successfully deleted via XML-RPC.
     3076                         *
     3077                         * @since 3.4.0
     3078                         *
     3079                         * @param int   $comment_ID ID of the deleted comment.
     3080                         * @param array $args       An array of arguments to delete the comment.
     3081                         */
    28433082                        do_action( 'xmlrpc_call_success_wp_deleteComment', $comment_ID, $args );
     3083                }
    28443084
    28453085                return $status;
    28463086        }
     
    28903130                if ( !current_user_can( 'edit_comment', $comment_ID ) )
    28913131                        return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
    28923132
    2893                 do_action('xmlrpc_call', 'wp.editComment');
     3133                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3134                do_action( 'xmlrpc_call', 'wp.editComment' );
    28943135
    28953136                if ( isset($content_struct['status']) ) {
    28963137                        $statuses = get_comment_statuses();
     
    29313172                if ( !$result )
    29323173                        return new IXR_Error(500, __('Sorry, the comment could not be edited. Something wrong happened.'));
    29333174
     3175                /**
     3176                 * Fires after a comment has been successfully updated via XML-RPC.
     3177                 *
     3178                 * @since 3.4.0
     3179                 *
     3180                 * @param int   $comment_ID ID of the updated comment.
     3181                 * @param array $args       An array of arguments to update the comment.
     3182                 */
    29343183                do_action( 'xmlrpc_call_success_wp_editComment', $comment_ID, $args );
    29353184
    29363185                return true;
     
    29553204                $post           = $args[3];
    29563205                $content_struct = $args[4];
    29573206
    2958                 $allow_anon = apply_filters('xmlrpc_allow_anonymous_comments', false);
     3207                /**
     3208                 * Filter whether to allow anonymous comments over XML-RPC.
     3209                 *
     3210                 * @since 2.7.0
     3211                 *
     3212                 * @param bool $allow Whether to allow anonymous commenting via XML-RPC.
     3213                 *                    Default false.
     3214                 */
     3215                $allow_anon = apply_filters( 'xmlrpc_allow_anonymous_comments', false );
    29593216
    29603217                $user = $this->login($username, $password);
    29613218
     
    30143271
    30153272                $comment['comment_content'] =  isset($content_struct['content']) ? $content_struct['content'] : null;
    30163273
    3017                 do_action('xmlrpc_call', 'wp.newComment');
     3274                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3275                do_action( 'xmlrpc_call', 'wp.newComment' );
    30183276
    30193277                $comment_ID = wp_new_comment( $comment );
    30203278
     3279                /**
     3280                 * Fires after a new comment has been successfully created via XML-RPC.
     3281                 *
     3282                 * @since 3.4.0
     3283                 *
     3284                 * @param int   $comment_ID ID of the new comment.
     3285                 * @param array $args       An array of new comment arguments.
     3286                 */
    30213287                do_action( 'xmlrpc_call_success_wp_newComment', $comment_ID, $args );
    30223288
    30233289                return $comment_ID;
     
    30443310                if ( !current_user_can( 'moderate_comments' ) )
    30453311                        return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
    30463312
    3047                 do_action('xmlrpc_call', 'wp.getCommentStatusList');
     3313                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3314                do_action( 'xmlrpc_call', 'wp.getCommentStatusList' );
    30483315
    30493316                return get_comment_statuses();
    30503317        }
     
    30713338                if ( !current_user_can( 'edit_posts' ) )
    30723339                        return new IXR_Error( 403, __( 'You are not allowed access to details about comments.' ) );
    30733340
    3074                 do_action('xmlrpc_call', 'wp.getCommentCount');
     3341                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3342                do_action( 'xmlrpc_call', 'wp.getCommentCount' );
    30753343
    30763344                $count = wp_count_comments( $post_id );
    30773345                return array(
     
    31033371                if ( !current_user_can( 'edit_posts' ) )
    31043372                        return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
    31053373
    3106                 do_action('xmlrpc_call', 'wp.getPostStatusList');
     3374                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3375                do_action( 'xmlrpc_call', 'wp.getPostStatusList' );
    31073376
    31083377                return get_post_statuses();
    31093378        }
     
    31293398                if ( !current_user_can( 'edit_pages' ) )
    31303399                        return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
    31313400
    3132                 do_action('xmlrpc_call', 'wp.getPageStatusList');
     3401                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3402                do_action( 'xmlrpc_call', 'wp.getPageStatusList' );
    31333403
    31343404                return get_page_statuses();
    31353405        }
     
    32863556                if ( !current_user_can( 'upload_files' ) )
    32873557                        return new IXR_Error( 403, __( 'You do not have permission to upload files.' ) );
    32883558
    3289                 do_action('xmlrpc_call', 'wp.getMediaItem');
     3559                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3560                do_action( 'xmlrpc_call', 'wp.getMediaItem' );
    32903561
    32913562                if ( ! $attachment = get_post($attachment_id) )
    32923563                        return new IXR_Error( 404, __( 'Invalid attachment ID.' ) );
     
    33313602                if ( !current_user_can( 'upload_files' ) )
    33323603                        return new IXR_Error( 401, __( 'You do not have permission to upload files.' ) );
    33333604
    3334                 do_action('xmlrpc_call', 'wp.getMediaLibrary');
     3605                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3606                do_action( 'xmlrpc_call', 'wp.getMediaLibrary' );
    33353607
    33363608                $parent_id = ( isset($struct['parent_id']) ) ? absint($struct['parent_id']) : '' ;
    33373609                $mime_type = ( isset($struct['mime_type']) ) ? $struct['mime_type'] : '' ;
     
    33723644                if ( !current_user_can( 'edit_posts' ) )
    33733645                        return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
    33743646
     3647                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    33753648                do_action( 'xmlrpc_call', 'wp.getPostFormats' );
    33763649
    33773650                $formats = get_post_format_strings();
     
    34273700                $password       = $args[2];
    34283701                $post_type_name = $args[3];
    34293702
    3430                 if ( isset( $args[4] ) )
     3703                if ( isset( $args[4] ) ) {
    34313704                        $fields = $args[4];
    3432                 else
     3705                } else {
     3706                        /**
     3707                         * Filter the default fields to query for the given XML-RPC method.
     3708                         *
     3709                         * @since 3.4.0
     3710                         *
     3711                         * @param array  $fields An array of post type fields to query for the given method.
     3712                         * @param string $method The method name.
     3713                         */
    34333714                        $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostType' );
     3715                }
    34343716
    34353717                if ( !$user = $this->login( $username, $password ) )
    34363718                        return $this->error;
    34373719
     3720                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    34383721                do_action( 'xmlrpc_call', 'wp.getPostType' );
    34393722
    34403723                if( ! post_type_exists( $post_type_name ) )
     
    34733756                $password           = $args[2];
    34743757                $filter             = isset( $args[3] ) ? $args[3] : array( 'public' => true );
    34753758
    3476                 if ( isset( $args[4] ) )
     3759                if ( isset( $args[4] ) ) {
    34773760                        $fields = $args[4];
    3478                 else
     3761                } else {
     3762                        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    34793763                        $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostTypes' );
     3764                }
    34803765
    34813766                if ( ! $user = $this->login( $username, $password ) )
    34823767                        return $this->error;
    34833768
     3769                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    34843770                do_action( 'xmlrpc_call', 'wp.getPostTypes' );
    34853771
    34863772                $post_types = get_post_types( $filter, 'objects' );
     
    35273813                $password   = $args[2];
    35283814                $post_id    = (int) $args[3];
    35293815
    3530                 if ( isset( $args[4] ) )
     3816                if ( isset( $args[4] ) ) {
    35313817                        $fields = $args[4];
    3532                 else
     3818                } else {
     3819                        /**
     3820                         * Filter the default revision fields to query for the given XML-RPC method.
     3821                         *
     3822                         * @since 3.5.0
     3823                         *
     3824                         * @param array  $field  An array of revision fields to query for the given method.
     3825                         * @param string $method The method name.
     3826                         */
    35333827                        $fields = apply_filters( 'xmlrpc_default_revision_fields', array( 'post_date', 'post_date_gmt' ), 'wp.getRevisions' );
     3828                }
    35343829
    35353830                if ( ! $user = $this->login( $username, $password ) )
    35363831                        return $this->error;
    35373832
     3833                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    35383834                do_action( 'xmlrpc_call', 'wp.getRevisions' );
    35393835
    35403836                if ( ! $post = get_post( $post_id ) )
     
    35963892                if ( ! $user = $this->login( $username, $password ) )
    35973893                        return $this->error;
    35983894
     3895                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    35993896                do_action( 'xmlrpc_call', 'wp.restoreRevision' );
    36003897
    36013898                if ( ! $revision = wp_get_post_revision( $revision_id ) )
     
    36453942                if ( !$user = $this->login($username, $password) )
    36463943                        return $this->error;
    36473944
    3648                 do_action('xmlrpc_call', 'blogger.getUsersBlogs');
     3945                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3946                do_action( 'xmlrpc_call', 'blogger.getUsersBlogs' );
    36493947
    36503948                $is_admin = current_user_can('manage_options');
    36513949
     
    37124010                if ( !current_user_can( 'edit_posts' ) )
    37134011                        return new IXR_Error( 401, __( 'Sorry, you do not have access to user data on this site.' ) );
    37144012
    3715                 do_action('xmlrpc_call', 'blogger.getUserInfo');
     4013                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     4014                do_action( 'xmlrpc_call', 'blogger.getUserInfo' );
    37164015
    37174016                $struct = array(
    37184017                        'nickname'  => $user->nickname,
     
    37514050                if ( !current_user_can( 'edit_post', $post_ID ) )
    37524051                        return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
    37534052
    3754                 do_action('xmlrpc_call', 'blogger.getPost');
     4053                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     4054                do_action( 'xmlrpc_call', 'blogger.getPost' );
    37554055
    37564056                $categories = implode(',', wp_get_post_categories($post_ID));
    37574057
     
    37964096                if ( ! current_user_can( 'edit_posts' ) )
    37974097                        return new IXR_Error( 401, __( 'Sorry, you cannot edit posts on this site.' ) );
    37984098
    3799                 do_action('xmlrpc_call', 'blogger.getRecentPosts');
     4099                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     4100                do_action( 'xmlrpc_call', 'blogger.getRecentPosts' );
    38004101
    38014102                $posts_list = wp_get_recent_posts( $query );
    38024103
     
    38744175                if ( !$user = $this->login($username, $password) )
    38754176                        return $this->error;
    38764177
    3877                 do_action('xmlrpc_call', 'blogger.newPost');
     4178                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     4179                do_action( 'xmlrpc_call', 'blogger.newPost' );
    38784180
    38794181                $cap = ($publish) ? 'publish_posts' : 'edit_posts';
    38804182                if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) || !current_user_can($cap) )
     
    39024204
    39034205                $this->attach_uploads( $post_ID, $post_content );
    39044206
     4207                /**
     4208                 * Fires after a new post has been successfully created via the XML-RPC Blogger API.
     4209                 *
     4210                 * @since 3.4.0
     4211                 *
     4212                 * @param int   $post_ID ID of the new post.
     4213                 * @param array $args    An array of new post arguments.
     4214                 */
    39054215                do_action( 'xmlrpc_call_success_blogger_newPost', $post_ID, $args );
    39064216
    39074217                return $post_ID;
     
    39284238                if ( !$user = $this->login($username, $password) )
    39294239                        return $this->error;
    39304240
    3931                 do_action('xmlrpc_call', 'blogger.editPost');
     4241                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     4242                do_action( 'xmlrpc_call', 'blogger.editPost' );
    39324243
    39334244                $actual_post = get_post($post_ID,ARRAY_A);
    39344245
     
    39584269
    39594270                $this->attach_uploads( $ID, $post_content );
    39604271
     4272                /**
     4273                 * Fires after a post has been successfully updated via the XML-RPC Blogger API.
     4274                 *
     4275                 * @since 3.4.0
     4276                 *
     4277                 * @param int   $post_ID ID of the updated post.
     4278                 * @param array $args    An array of arguments for the post to edit.
     4279                 */
    39614280                do_action( 'xmlrpc_call_success_blogger_editPost', $post_ID, $args );
    39624281
    39634282                return true;
     
    39824301                if ( !$user = $this->login($username, $password) )
    39834302                        return $this->error;
    39844303
    3985                 do_action('xmlrpc_call', 'blogger.deletePost');
     4304                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     4305                do_action( 'xmlrpc_call', 'blogger.deletePost' );
    39864306
    39874307                $actual_post = get_post($post_ID,ARRAY_A);
    39884308
     
    39974317                if ( !$result )
    39984318                        return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be deleted.'));
    39994319
     4320                /**
     4321                 * Fires after a post has been successfully deleted via the XML-RPC Blogger API.
     4322                 *
     4323                 * @since 3.4.0
     4324                 *
     4325                 * @param int   $post_ID ID of the deleted post.
     4326                 * @param array $args    An array of arguments to delete the post.
     4327                 */
    40004328                do_action( 'xmlrpc_call_success_blogger_deletePost', $post_ID, $args );
    40014329
    40024330                return true;
     
    40534381                if ( !$user = $this->login($username, $password) )
    40544382                        return $this->error;
    40554383
    4056                 do_action('xmlrpc_call', 'metaWeblog.newPost');
     4384                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     4385                do_action( 'xmlrpc_call', 'metaWeblog.newPost' );
    40574386
    40584387                $page_template = '';
    40594388                if ( !empty( $content_struct['post_type'] ) ) {
     
    43074636                if ( !$post_ID )
    43084637                        return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
    43094638
     4639                /**
     4640                 * Fires after a new post has been successfully created via the XML-RPC MovableType API.
     4641                 *
     4642                 * @since 3.4.0
     4643                 *
     4644                 * @param int   $post_ID ID of the new post.
     4645                 * @param array $args    An array of arguments to create the new post.
     4646                 */
    43104647                do_action( 'xmlrpc_call_success_mw_newPost', $post_ID, $args );
    43114648
    43124649                return strval($post_ID);
     
    43724709                if ( ! $user = $this->login($username, $password) )
    43734710                        return $this->error;
    43744711
    4375                 do_action('xmlrpc_call', 'metaWeblog.editPost');
     4712                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     4713                do_action( 'xmlrpc_call', 'metaWeblog.editPost' );
    43764714
    43774715                $postdata = get_post( $post_ID, ARRAY_A );
    43784716
     
    46154953                if ( isset( $content_struct['wp_post_format'] ) )
    46164954                        set_post_format( $post_ID, $content_struct['wp_post_format'] );
    46174955
     4956                /**
     4957                 * Fires after a post has been successfully updated via the XML-RPC MovableType API.
     4958                 *
     4959                 * @since 3.4.0
     4960                 *
     4961                 * @param int   $post_ID ID of the updated post.
     4962                 * @param array $args    An array of arguments to update the post.
     4963                 */
    46184964                do_action( 'xmlrpc_call_success_mw_editPost', $post_ID, $args );
    46194965
    46204966                return true;
     
    46464992                if ( !current_user_can( 'edit_post', $post_ID ) )
    46474993                        return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
    46484994
    4649                 do_action('xmlrpc_call', 'metaWeblog.getPost');
     4995                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     4996                do_action( 'xmlrpc_call', 'metaWeblog.getPost' );
    46504997
    46514998                if ($postdata['post_date'] != '') {
    46524999                        $post_date = $this->_convert_date( $postdata['post_date'] );
     
    47705117                if ( ! current_user_can( 'edit_posts' ) )
    47715118                        return new IXR_Error( 401, __( 'Sorry, you cannot edit posts on this site.' ) );
    47725119
    4773                 do_action('xmlrpc_call', 'metaWeblog.getRecentPosts');
     5120                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5121                do_action( 'xmlrpc_call', 'metaWeblog.getRecentPosts' );
    47745122
    47755123                $posts_list = wp_get_recent_posts( $query );
    47765124
     
    48855233                if ( !current_user_can( 'edit_posts' ) )
    48865234                        return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) );
    48875235
    4888                 do_action('xmlrpc_call', 'metaWeblog.getCategories');
     5236                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5237                do_action( 'xmlrpc_call', 'metaWeblog.getCategories' );
    48895238
    48905239                $categories_struct = array();
    48915240
     
    49335282                if ( !$user = $this->login($username, $password) )
    49345283                        return $this->error;
    49355284
    4936                 do_action('xmlrpc_call', 'metaWeblog.newMediaObject');
     5285                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5286                do_action( 'xmlrpc_call', 'metaWeblog.newMediaObject' );
    49375287
    49385288                if ( !current_user_can('upload_files') ) {
    49395289                        $this->error = new IXR_Error( 401, __( 'You do not have permission to upload files.' ) );
     
    49405290                        return $this->error;
    49415291                }
    49425292
    4943                 if ( $upload_err = apply_filters( 'pre_upload_error', false ) )
    4944                         return new IXR_Error(500, $upload_err);
     5293                /**
     5294                 * Filter whether to pre-empt the XML-RPC media upload.
     5295                 *
     5296                 * Passing a truthy value will effectively short-circuit the media upload,
     5297                 * returning that value as a 500 error instead.
     5298                 *
     5299                 * @since 2.1.0
     5300                 *
     5301                 * @param bool $error Whether to pre-empt the media upload. Default false.
     5302                 */
     5303                if ( $upload_err = apply_filters( 'pre_upload_error', false ) ) {
     5304                        return new IXR_Error( 500, $upload_err );
     5305                }
    49455306
    49465307                if ( !empty($data['overwrite']) && ($data['overwrite'] == true) ) {
    49475308                        // Get postmeta info on the object.
     
    49875348                $id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id );
    49885349                wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
    49895350
     5351                /**
     5352                 * Fires after a new attachment has been added via the XML-RPC MovableType API.
     5353                 *
     5354                 * @since 3.4.0
     5355                 *
     5356                 * @param int   $id   ID of the new attachment.
     5357                 * @param array $args An array of arguments to add the attachment.
     5358                 */
    49905359                do_action( 'xmlrpc_call_success_mw_newMediaObject', $id, $args );
    49915360
    49925361                $struct = array(
     
    50275396                if ( !$user = $this->login($username, $password) )
    50285397                        return $this->error;
    50295398
    5030                 do_action('xmlrpc_call', 'mt.getRecentPostTitles');
     5399                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5400                do_action( 'xmlrpc_call', 'mt.getRecentPostTitles' );
    50315401
    50325402                $posts_list = wp_get_recent_posts( $query );
    50335403
     
    50865456                if ( !current_user_can( 'edit_posts' ) )
    50875457                        return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) );
    50885458
    5089                 do_action('xmlrpc_call', 'mt.getCategoryList');
     5459                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5460                do_action( 'xmlrpc_call', 'mt.getCategoryList' );
    50905461
    50915462                $categories_struct = array();
    50925463
     
    51275498                if ( !current_user_can( 'edit_post', $post_ID ) )
    51285499                        return new IXR_Error( 401, __( 'Sorry, you can not edit this post.' ) );
    51295500
    5130                 do_action('xmlrpc_call', 'mt.getPostCategories');
     5501                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5502                do_action( 'xmlrpc_call', 'mt.getPostCategories' );
    51315503
    51325504                $categories = array();
    51335505                $catids = wp_get_post_categories(intval($post_ID));
     
    51655537                if ( !$user = $this->login($username, $password) )
    51665538                        return $this->error;
    51675539
    5168                 do_action('xmlrpc_call', 'mt.setPostCategories');
     5540                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5541                do_action( 'xmlrpc_call', 'mt.setPostCategories' );
    51695542
    51705543                if ( ! get_post( $post_ID ) )
    51715544                        return new IXR_Error( 404, __( 'Invalid post ID.' ) );
     
    51935566         */
    51945567        function mt_supportedMethods($args) {
    51955568
    5196                 do_action('xmlrpc_call', 'mt.supportedMethods');
     5569                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5570                do_action( 'xmlrpc_call', 'mt.supportedMethods' );
    51975571
    51985572                $supported_methods = array();
    51995573                foreach ( $this->methods as $key => $value ) {
     
    52115585         * @param array $args Method parameters.
    52125586         */
    52135587        function mt_supportedTextFilters($args) {
    5214                 do_action('xmlrpc_call', 'mt.supportedTextFilters');
    5215                 return apply_filters('xmlrpc_text_filters', array());
     5588                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5589                do_action( 'xmlrpc_call', 'mt.supportedTextFilters' );
     5590
     5591                /**
     5592                 * Filter the MoveableType text filters list for XML-RPC.
     5593                 *
     5594                 * @since 2.2.0
     5595                 *
     5596                 * @param array $filters An array of text filters.
     5597                 */
     5598                return apply_filters( 'xmlrpc_text_filters', array() );
    52165599        }
    52175600
    52185601        /**
     
    52295612
    52305613                $post_ID = intval($args);
    52315614
    5232                 do_action('xmlrpc_call', 'mt.getTrackbackPings');
     5615                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5616                do_action( 'xmlrpc_call', 'mt.getTrackbackPings' );
    52335617
    52345618                $actual_post = get_post($post_ID, ARRAY_A);
    52355619
     
    52765660                if ( !$user = $this->login($username, $password) )
    52775661                        return $this->error;
    52785662
    5279                 do_action('xmlrpc_call', 'mt.publishPost');
     5663                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5664                do_action( 'xmlrpc_call', 'mt.publishPost' );
    52805665
    52815666                $postdata = get_post($post_ID, ARRAY_A);
    52825667                if ( ! $postdata )
     
    53125697        function pingback_ping($args) {
    53135698                global $wpdb;
    53145699
    5315                 do_action('xmlrpc_call', 'pingback.ping');
     5700                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5701                do_action( 'xmlrpc_call', 'pingback.ping' );
    53165702
    53175703                $this->escape($args);
    53185704
     
    53255711                $pagelinkedto = str_replace('&', '&', $pagelinkedto);
    53265712                $pagelinkedto = str_replace('&', '&', $pagelinkedto);
    53275713
     5714                /**
     5715                 * Filter the pingback source URI.
     5716                 *
     5717                 * @since 3.6.0
     5718                 *
     5719                 * @param string $pagelinkedfrom URI of the page linked from.
     5720                 * @param string $pagelinkedto   URI of the page linked to.
     5721                 */
    53285722                $pagelinkedfrom = apply_filters( 'pingback_ping_source_uri', $pagelinkedfrom, $pagelinkedto );
     5723
    53295724                if ( ! $pagelinkedfrom )
    53305725                        return $this->pingback_error( 0, __( 'A valid URL was not provided.' ) );
    53315726
     
    54045799                $linea = wp_remote_retrieve_body( wp_safe_remote_get( $pagelinkedfrom, $http_api_args ) );
    54055800
    54065801                if ( !$linea )
    5407                         return $this->pingback_error( 16, __( 'The source URL does not exist.' ) );
     5802                        return $this->pingback_error( 16, __( 'The source URL does not exist.' ) );
    54085803
    5409                 $linea = apply_filters('pre_remote_source', $linea, $pagelinkedto);
     5804                /**
     5805                 * Filter the pingback remote source.
     5806                 *
     5807                 * @since 2.5.0
     5808                 *
     5809                 * @param string $linea        Response object for the page linked from.
     5810                 * @param string $pagelinkedto URL of the page linked to.
     5811                 */
     5812                $linea = apply_filters( 'pre_remote_source', $linea, $pagelinkedto );
    54105813
    54115814                // Work around bug in strip_tags():
    54125815                $linea = str_replace('<!DOC', '<DOC', $linea);
     
    54715874                $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_content', 'comment_type');
    54725875
    54735876                $comment_ID = wp_new_comment($commentdata);
    5474                 do_action('pingback_post', $comment_ID);
    54755877
     5878                /**
     5879                 * Fires after a post pingback has been sent.
     5880                 *
     5881                 * @since 0.71
     5882                 *
     5883                 * @param int $comment_ID Comment ID.
     5884                 */
     5885                do_action( 'pingback_post', $comment_ID );
     5886
    54765887                return sprintf(__('Pingback from %1$s to %2$s registered. Keep the web talking! :-)'), $pagelinkedfrom, $pagelinkedto);
    54775888        }
    54785889
     
    54905901
    54915902                global $wpdb;
    54925903
    5493                 do_action('xmlrpc_call', 'pingback.extensions.getPingbacks');
     5904                /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5905                do_action( 'xmlrpc_call', 'pingback.extensions.getPingbacks' );
    54945906
    54955907                $this->escape($args);
    54965908
     
    55245936        }
    55255937
    55265938        protected function pingback_error( $code, $message ) {
     5939                /**
     5940                 * Filter the XML-RPC pingback error return.
     5941                 *
     5942                 * @since 3.5.1
     5943                 *
     5944                 * @param IXR_Error $error An IXR_Error object containing the error code and message.
     5945                 */
    55275946                return apply_filters( 'xmlrpc_pingback_error', new IXR_Error( $code, $message ) );
    55285947        }
    55295948}