Make WordPress Core

Changeset 27730


Ignore:
Timestamp:
03/26/2014 05:43:05 AM (11 years ago)
Author:
DrewAPicture
Message:

Inline documentation for hooks in wp-includes/class-wp-xmlrpc-server.php.

Props kpdesign and DrewAPicture.
Fixes #27506.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r27672 r27730  
    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
     
    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
    177 
    178         // Proper filter for turning off XML-RPC. It is on by default.
     195
     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
     
    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;
     
    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    }
     
    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
     
    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    }
     
    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    }
     
    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    }
     
    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    }
     
    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    }
     
    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    }
     
    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    }
     
    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    }
     
    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
     
    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
     
    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
     
    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
     
    13951537            $fields = $args[4];
    13961538        else
     1539
     1540            /**
     1541             * Filter the list of post query fields used by the given XML-RPC method.
     1542             *
     1543             * @since 3.4.0
     1544             *
     1545             * @param array $fields  Array of post fields.
     1546             * @param string $method Method name.
     1547             */
    13971548            $fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPost' );
    13981549
     
    14001551            return $this->error;
    14011552
     1553        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    14021554        do_action( 'xmlrpc_call', 'wp.getPost' );
    14031555
     
    14481600        $filter     = isset( $args[3] ) ? $args[3] : array();
    14491601
    1450         if ( isset( $args[4] ) )
     1602        if ( isset( $args[4] ) ) {
    14511603            $fields = $args[4];
    1452         else
     1604        } else {
     1605            /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    14531606            $fields = apply_filters( 'xmlrpc_default_post_fields', array( 'post', 'terms', 'custom_fields' ), 'wp.getPosts' );
     1607        }
    14541608
    14551609        if ( ! $user = $this->login( $username, $password ) )
    14561610            return $this->error;
    14571611
     1612        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    14581613        do_action( 'xmlrpc_call', 'wp.getPosts' );
    14591614
     
    15451700            return $this->error;
    15461701
     1702        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    15471703        do_action( 'xmlrpc_call', 'wp.newTerm' );
    15481704
     
    16331789            return $this->error;
    16341790
     1791        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    16351792        do_action( 'xmlrpc_call', 'wp.editTerm' );
    16361793
     
    17251882            return $this->error;
    17261883
     1884        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    17271885        do_action( 'xmlrpc_call', 'wp.deleteTerm' );
    17281886
     
    17921950            return $this->error;
    17931951
     1952        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    17941953        do_action( 'xmlrpc_call', 'wp.getTerm' );
    17951954
     
    18452004            return $this->error;
    18462005
     2006        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    18472007        do_action( 'xmlrpc_call', 'wp.getTerms' );
    18482008
     
    19162076        $taxonomy       = $args[3];
    19172077
    1918         if ( isset( $args[4] ) )
     2078        if ( isset( $args[4] ) ) {
    19192079            $fields = $args[4];
    1920         else
     2080        } else {
     2081            /**
     2082             * Filter the taxonomy query fields used by the given XML-RPC method.
     2083             *
     2084             * @since 3.4.0
     2085             *
     2086             * @param array  $fields An array of taxonomy fields to retrieve.
     2087             * @param string $method The method name.
     2088             */
    19212089            $fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomy' );
     2090        }
    19222091
    19232092        if ( ! $user = $this->login( $username, $password ) )
    19242093            return $this->error;
    19252094
     2095        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    19262096        do_action( 'xmlrpc_call', 'wp.getTaxonomy' );
    19272097
     
    19602130        $filter             = isset( $args[3] ) ? $args[3] : array( 'public' => true );
    19612131
    1962         if ( isset( $args[4] ) )
     2132        if ( isset( $args[4] ) ) {
    19632133            $fields = $args[4];
    1964         else
     2134        } else {
     2135            /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    19652136            $fields = apply_filters( 'xmlrpc_default_taxonomy_fields', array( 'labels', 'cap', 'object_type' ), 'wp.getTaxonomies' );
     2137        }
    19662138
    19672139        if ( ! $user = $this->login( $username, $password ) )
    19682140            return $this->error;
    19692141
     2142        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    19702143        do_action( 'xmlrpc_call', 'wp.getTaxonomies' );
    19712144
     
    20292202        $user_id    = (int) $args[3];
    20302203
    2031         if ( isset( $args[4] ) )
     2204        if ( isset( $args[4] ) ) {
    20322205            $fields = $args[4];
    2033         else
     2206        } else {
     2207            /**
     2208             * Filter the default user query fields used by the given XML-RPC method.
     2209             *
     2210             * @since 3.5.0
     2211             *
     2212             * @param array  $fields User query fields for given method. Default 'all'.
     2213             * @param string $method The method name.
     2214             */
    20342215            $fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getUser' );
     2216        }
    20352217
    20362218        if ( ! $user = $this->login( $username, $password ) )
    20372219            return $this->error;
    20382220
     2221        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    20392222        do_action( 'xmlrpc_call', 'wp.getUser' );
    20402223
     
    20822265        $filter     = isset( $args[3] ) ? $args[3] : array();
    20832266
    2084         if ( isset( $args[4] ) )
     2267        if ( isset( $args[4] ) ) {
    20852268            $fields = $args[4];
    2086         else
     2269        } else {
     2270            /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    20872271            $fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getUsers' );
     2272        }
    20882273
    20892274        if ( ! $user = $this->login( $username, $password ) )
    20902275            return $this->error;
    20912276
     2277        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    20922278        do_action( 'xmlrpc_call', 'wp.getUsers' );
    20932279
     
    21492335        $password   = $args[2];
    21502336
    2151         if ( isset( $args[3] ) )
     2337        if ( isset( $args[3] ) ) {
    21522338            $fields = $args[3];
    2153         else
     2339        } else {
     2340            /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    21542341            $fields = apply_filters( 'xmlrpc_default_user_fields', array( 'all' ), 'wp.getProfile' );
     2342        }
    21552343
    21562344        if ( ! $user = $this->login( $username, $password ) )
    21572345            return $this->error;
    21582346
     2347        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    21592348        do_action( 'xmlrpc_call', 'wp.getProfile' );
    21602349
     
    22002389            return $this->error;
    22012390
     2391        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    22022392        do_action( 'xmlrpc_call', 'wp.editProfile' );
    22032393
     
    22732463            return new IXR_Error( 401, __( 'Sorry, you cannot edit this page.' ) );
    22742464
    2275         do_action('xmlrpc_call', 'wp.getPage');
     2465        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2466        do_action( 'xmlrpc_call', 'wp.getPage' );
    22762467
    22772468        // If we found the page then format the data.
     
    23112502            return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
    23122503
    2313         do_action('xmlrpc_call', 'wp.getPages');
     2504        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2505        do_action( 'xmlrpc_call', 'wp.getPages' );
    23142506
    23152507        $pages = get_posts( array('post_type' => 'page', 'post_status' => 'any', 'numberposts' => $num_pages) );
     
    23512543            return $this->error;
    23522544
    2353         do_action('xmlrpc_call', 'wp.newPage');
     2545        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2546        do_action( 'xmlrpc_call', 'wp.newPage' );
    23542547
    23552548        // Mark this as content for a page.
     
    23792572            return $this->error;
    23802573
    2381         do_action('xmlrpc_call', 'wp.deletePage');
     2574        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2575        do_action( 'xmlrpc_call', 'wp.deletePage' );
    23822576
    23832577        // Get the current page based on the page_id and
     
    23962590            return(new IXR_Error(500, __('Failed to delete the page.')));
    23972591
     2592        /**
     2593         * Fires after a page has been successfully deleted via XML-RPC.
     2594         *
     2595         * @since 3.4.0
     2596         *
     2597         * @param int   $page_id ID of the deleted page.
     2598         * @param array $args    An array of arguments to delete the page.
     2599         */
    23982600        do_action( 'xmlrpc_call_success_wp_deletePage', $page_id, $args );
    23992601
     
    24212623            return $this->error;
    24222624
    2423         do_action('xmlrpc_call', 'wp.editPage');
     2625        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2626        do_action( 'xmlrpc_call', 'wp.editPage' );
    24242627
    24252628        // Get the page data and make sure it is a page.
     
    24712674            return new IXR_Error( 401, __( 'Sorry, you cannot edit pages.' ) );
    24722675
    2473         do_action('xmlrpc_call', 'wp.getPageList');
     2676        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2677        do_action( 'xmlrpc_call', 'wp.getPageList' );
    24742678
    24752679        // Get list of pages ids and titles
     
    25222726            return(new IXR_Error(401, __('Sorry, you cannot edit posts on this site.')));
    25232727
    2524         do_action('xmlrpc_call', 'wp.getAuthors');
     2728        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2729        do_action( 'xmlrpc_call', 'wp.getAuthors' );
    25252730
    25262731        $authors = array();
     
    25572762            return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view tags.' ) );
    25582763
     2764        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    25592765        do_action( 'xmlrpc_call', 'wp.getKeywords' );
    25602766
     
    25962802            return $this->error;
    25972803
    2598         do_action('xmlrpc_call', 'wp.newCategory');
     2804        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2805        do_action( 'xmlrpc_call', 'wp.newCategory' );
    25992806
    26002807        // Make sure the user is allowed to add a category.
     
    26332840        }
    26342841
     2842        /**
     2843         * Fires after a new category has been successfully created via XML-RPC.
     2844         *
     2845         * @since 3.4.0
     2846         *
     2847         * @param int   $cat_id ID of the new category.
     2848         * @param array $args   An array of new category arguments.
     2849         */
    26352850        do_action( 'xmlrpc_call_success_wp_newCategory', $cat_id, $args );
    26362851
     
    26572872            return $this->error;
    26582873
    2659         do_action('xmlrpc_call', 'wp.deleteCategory');
     2874        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2875        do_action( 'xmlrpc_call', 'wp.deleteCategory' );
    26602876
    26612877        if ( !current_user_can('manage_categories') )
     
    26642880        $status = wp_delete_term( $category_id, 'category' );
    26652881
    2666         if( true == $status )
     2882        if ( true == $status ) {
     2883            /**
     2884             * Fires after a category has been successfully deleted via XML-RPC.
     2885             *
     2886             * @since 3.4.0
     2887             *
     2888             * @param int   $category_id ID of the deleted category.
     2889             * @param array $args        An array of arguments to delete the category.
     2890             */
    26672891            do_action( 'xmlrpc_call_success_wp_deleteCategory', $category_id, $args );
     2892        }
    26682893
    26692894        return $status;
     
    26932918            return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts to this site in order to view categories.' ) );
    26942919
    2695         do_action('xmlrpc_call', 'wp.suggestCategories');
     2920        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2921        do_action( 'xmlrpc_call', 'wp.suggestCategories' );
    26962922
    26972923        $category_suggestions = array();
     
    27292955            return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
    27302956
    2731         do_action('xmlrpc_call', 'wp.getComment');
     2957        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     2958        do_action( 'xmlrpc_call', 'wp.getComment' );
    27322959
    27332960        if ( ! $comment = get_comment($comment_id) )
     
    27702997            return new IXR_Error( 401, __( 'Sorry, you cannot edit comments.' ) );
    27712998
    2772         do_action('xmlrpc_call', 'wp.getComments');
     2999        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3000        do_action( 'xmlrpc_call', 'wp.getComments' );
    27733001
    27743002        if ( isset($struct['status']) )
     
    28363064            return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
    28373065
    2838         do_action('xmlrpc_call', 'wp.deleteComment');
     3066        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3067        do_action( 'xmlrpc_call', 'wp.deleteComment' );
    28393068
    28403069        $status = wp_delete_comment( $comment_ID );
    28413070
    2842         if( true == $status )
     3071        if ( true == $status ) {
     3072            /**
     3073             * Fires after a comment has been successfully deleted via XML-RPC.
     3074             *
     3075             * @since 3.4.0
     3076             *
     3077             * @param int   $comment_ID ID of the deleted comment.
     3078             * @param array $args       An array of arguments to delete the comment.
     3079             */
    28433080            do_action( 'xmlrpc_call_success_wp_deleteComment', $comment_ID, $args );
     3081        }
    28443082
    28453083        return $status;
     
    28913129            return new IXR_Error( 403, __( 'You are not allowed to moderate comments on this site.' ) );
    28923130
    2893         do_action('xmlrpc_call', 'wp.editComment');
     3131        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3132        do_action( 'xmlrpc_call', 'wp.editComment' );
    28943133
    28953134        if ( isset($content_struct['status']) ) {
     
    29323171            return new IXR_Error(500, __('Sorry, the comment could not be edited. Something wrong happened.'));
    29333172
     3173        /**
     3174         * Fires after a comment has been successfully updated via XML-RPC.
     3175         *
     3176         * @since 3.4.0
     3177         *
     3178         * @param int   $comment_ID ID of the updated comment.
     3179         * @param array $args       An array of arguments to update the comment.
     3180         */
    29343181        do_action( 'xmlrpc_call_success_wp_editComment', $comment_ID, $args );
    29353182
     
    29563203        $content_struct = $args[4];
    29573204
    2958         $allow_anon = apply_filters('xmlrpc_allow_anonymous_comments', false);
     3205        /**
     3206         * Filter whether to allow anonymous comments over XML-RPC.
     3207         *
     3208         * @since 2.7.0
     3209         *
     3210         * @param bool $allow Whether to allow anonymous commenting via XML-RPC.
     3211         *                    Default false.
     3212         */
     3213        $allow_anon = apply_filters( 'xmlrpc_allow_anonymous_comments', false );
    29593214
    29603215        $user = $this->login($username, $password);
     
    30153270        $comment['comment_content'] =  isset($content_struct['content']) ? $content_struct['content'] : null;
    30163271
    3017         do_action('xmlrpc_call', 'wp.newComment');
     3272        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3273        do_action( 'xmlrpc_call', 'wp.newComment' );
    30183274
    30193275        $comment_ID = wp_new_comment( $comment );
    30203276
     3277        /**
     3278         * Fires after a new comment has been successfully created via XML-RPC.
     3279         *
     3280         * @since 3.4.0
     3281         *
     3282         * @param int   $comment_ID ID of the new comment.
     3283         * @param array $args       An array of new comment arguments.
     3284         */
    30213285        do_action( 'xmlrpc_call_success_wp_newComment', $comment_ID, $args );
    30223286
     
    30453309            return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
    30463310
    3047         do_action('xmlrpc_call', 'wp.getCommentStatusList');
     3311        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3312        do_action( 'xmlrpc_call', 'wp.getCommentStatusList' );
    30483313
    30493314        return get_comment_statuses();
     
    30723337            return new IXR_Error( 403, __( 'You are not allowed access to details about comments.' ) );
    30733338
    3074         do_action('xmlrpc_call', 'wp.getCommentCount');
     3339        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3340        do_action( 'xmlrpc_call', 'wp.getCommentCount' );
    30753341
    30763342        $count = wp_count_comments( $post_id );
     
    31043370            return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
    31053371
    3106         do_action('xmlrpc_call', 'wp.getPostStatusList');
     3372        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3373        do_action( 'xmlrpc_call', 'wp.getPostStatusList' );
    31073374
    31083375        return get_post_statuses();
     
    31303397            return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
    31313398
    3132         do_action('xmlrpc_call', 'wp.getPageStatusList');
     3399        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3400        do_action( 'xmlrpc_call', 'wp.getPageStatusList' );
    31333401
    31343402        return get_page_statuses();
     
    32873555            return new IXR_Error( 403, __( 'You do not have permission to upload files.' ) );
    32883556
    3289         do_action('xmlrpc_call', 'wp.getMediaItem');
     3557        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3558        do_action( 'xmlrpc_call', 'wp.getMediaItem' );
    32903559
    32913560        if ( ! $attachment = get_post($attachment_id) )
     
    33323601            return new IXR_Error( 401, __( 'You do not have permission to upload files.' ) );
    33333602
    3334         do_action('xmlrpc_call', 'wp.getMediaLibrary');
     3603        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3604        do_action( 'xmlrpc_call', 'wp.getMediaLibrary' );
    33353605
    33363606        $parent_id = ( isset($struct['parent_id']) ) ? absint($struct['parent_id']) : '' ;
     
    33733643            return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) );
    33743644
     3645        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    33753646        do_action( 'xmlrpc_call', 'wp.getPostFormats' );
    33763647
     
    34283699        $post_type_name = $args[3];
    34293700
    3430         if ( isset( $args[4] ) )
     3701        if ( isset( $args[4] ) ) {
    34313702            $fields = $args[4];
    3432         else
     3703        } else {
     3704            /**
     3705             * Filter the default query fields used by the given XML-RPC method.
     3706             *
     3707             * @since 3.4.0
     3708             *
     3709             * @param array  $fields An array of post type query fields for the given method.
     3710             * @param string $method The method name.
     3711             */
    34333712            $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostType' );
     3713        }
    34343714
    34353715        if ( !$user = $this->login( $username, $password ) )
    34363716            return $this->error;
    34373717
     3718        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    34383719        do_action( 'xmlrpc_call', 'wp.getPostType' );
    34393720
     
    34743755        $filter             = isset( $args[3] ) ? $args[3] : array( 'public' => true );
    34753756
    3476         if ( isset( $args[4] ) )
     3757        if ( isset( $args[4] ) ) {
    34773758            $fields = $args[4];
    3478         else
     3759        } else {
     3760            /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    34793761            $fields = apply_filters( 'xmlrpc_default_posttype_fields', array( 'labels', 'cap', 'taxonomies' ), 'wp.getPostTypes' );
     3762        }
    34803763
    34813764        if ( ! $user = $this->login( $username, $password ) )
    34823765            return $this->error;
    34833766
     3767        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    34843768        do_action( 'xmlrpc_call', 'wp.getPostTypes' );
    34853769
     
    35283812        $post_id    = (int) $args[3];
    35293813
    3530         if ( isset( $args[4] ) )
     3814        if ( isset( $args[4] ) ) {
    35313815            $fields = $args[4];
    3532         else
     3816        } else {
     3817            /**
     3818             * Filter the default revision query fields used by the given XML-RPC method.
     3819             *
     3820             * @since 3.5.0
     3821             *
     3822             * @param array  $field  An array of revision query fields.
     3823             * @param string $method The method name.
     3824             */
    35333825            $fields = apply_filters( 'xmlrpc_default_revision_fields', array( 'post_date', 'post_date_gmt' ), 'wp.getRevisions' );
     3826        }
    35343827
    35353828        if ( ! $user = $this->login( $username, $password ) )
    35363829            return $this->error;
    35373830
     3831        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    35383832        do_action( 'xmlrpc_call', 'wp.getRevisions' );
    35393833
     
    35973891            return $this->error;
    35983892
     3893        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    35993894        do_action( 'xmlrpc_call', 'wp.restoreRevision' );
    36003895
     
    36463941            return $this->error;
    36473942
    3648         do_action('xmlrpc_call', 'blogger.getUsersBlogs');
     3943        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     3944        do_action( 'xmlrpc_call', 'blogger.getUsersBlogs' );
    36493945
    36503946        $is_admin = current_user_can('manage_options');
     
    37134009            return new IXR_Error( 401, __( 'Sorry, you do not have access to user data on this site.' ) );
    37144010
    3715         do_action('xmlrpc_call', 'blogger.getUserInfo');
     4011        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     4012        do_action( 'xmlrpc_call', 'blogger.getUserInfo' );
    37164013
    37174014        $struct = array(
     
    37524049            return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
    37534050
    3754         do_action('xmlrpc_call', 'blogger.getPost');
     4051        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     4052        do_action( 'xmlrpc_call', 'blogger.getPost' );
    37554053
    37564054        $categories = implode(',', wp_get_post_categories($post_ID));
     
    37974095            return new IXR_Error( 401, __( 'Sorry, you cannot edit posts on this site.' ) );
    37984096
    3799         do_action('xmlrpc_call', 'blogger.getRecentPosts');
     4097        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     4098        do_action( 'xmlrpc_call', 'blogger.getRecentPosts' );
    38004099
    38014100        $posts_list = wp_get_recent_posts( $query );
     
    38754174            return $this->error;
    38764175
    3877         do_action('xmlrpc_call', 'blogger.newPost');
     4176        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     4177        do_action( 'xmlrpc_call', 'blogger.newPost' );
    38784178
    38794179        $cap = ($publish) ? 'publish_posts' : 'edit_posts';
     
    39034203        $this->attach_uploads( $post_ID, $post_content );
    39044204
     4205        /**
     4206         * Fires after a new post has been successfully created via the XML-RPC Blogger API.
     4207         *
     4208         * @since 3.4.0
     4209         *
     4210         * @param int   $post_ID ID of the new post.
     4211         * @param array $args    An array of new post arguments.
     4212         */
    39054213        do_action( 'xmlrpc_call_success_blogger_newPost', $post_ID, $args );
    39064214
     
    39294237            return $this->error;
    39304238
    3931         do_action('xmlrpc_call', 'blogger.editPost');
     4239        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     4240        do_action( 'xmlrpc_call', 'blogger.editPost' );
    39324241
    39334242        $actual_post = get_post($post_ID,ARRAY_A);
     
    39594268        $this->attach_uploads( $ID, $post_content );
    39604269
     4270        /**
     4271         * Fires after a post has been successfully updated via the XML-RPC Blogger API.
     4272         *
     4273         * @since 3.4.0
     4274         *
     4275         * @param int   $post_ID ID of the updated post.
     4276         * @param array $args    An array of arguments for the post to edit.
     4277         */
    39614278        do_action( 'xmlrpc_call_success_blogger_editPost', $post_ID, $args );
    39624279
     
    39834300            return $this->error;
    39844301
    3985         do_action('xmlrpc_call', 'blogger.deletePost');
     4302        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     4303        do_action( 'xmlrpc_call', 'blogger.deletePost' );
    39864304
    39874305        $actual_post = get_post($post_ID,ARRAY_A);
     
    39984316            return new IXR_Error(500, __('For some strange yet very annoying reason, this post could not be deleted.'));
    39994317
     4318        /**
     4319         * Fires after a post has been successfully deleted via the XML-RPC Blogger API.
     4320         *
     4321         * @since 3.4.0
     4322         *
     4323         * @param int   $post_ID ID of the deleted post.
     4324         * @param array $args    An array of arguments to delete the post.
     4325         */
    40004326        do_action( 'xmlrpc_call_success_blogger_deletePost', $post_ID, $args );
    40014327
     
    40544380            return $this->error;
    40554381
    4056         do_action('xmlrpc_call', 'metaWeblog.newPost');
     4382        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     4383        do_action( 'xmlrpc_call', 'metaWeblog.newPost' );
    40574384
    40584385        $page_template = '';
     
    43084635            return new IXR_Error(500, __('Sorry, your entry could not be posted. Something wrong happened.'));
    43094636
     4637        /**
     4638         * Fires after a new post has been successfully created via the XML-RPC MovableType API.
     4639         *
     4640         * @since 3.4.0
     4641         *
     4642         * @param int   $post_ID ID of the new post.
     4643         * @param array $args    An array of arguments to create the new post.
     4644         */
    43104645        do_action( 'xmlrpc_call_success_mw_newPost', $post_ID, $args );
    43114646
     
    43734708            return $this->error;
    43744709
    4375         do_action('xmlrpc_call', 'metaWeblog.editPost');
     4710        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     4711        do_action( 'xmlrpc_call', 'metaWeblog.editPost' );
    43764712
    43774713        $postdata = get_post( $post_ID, ARRAY_A );
     
    46164952            set_post_format( $post_ID, $content_struct['wp_post_format'] );
    46174953
     4954        /**
     4955         * Fires after a post has been successfully updated via the XML-RPC MovableType API.
     4956         *
     4957         * @since 3.4.0
     4958         *
     4959         * @param int   $post_ID ID of the updated post.
     4960         * @param array $args    An array of arguments to update the post.
     4961         */
    46184962        do_action( 'xmlrpc_call_success_mw_editPost', $post_ID, $args );
    46194963
     
    46474991            return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
    46484992
    4649         do_action('xmlrpc_call', 'metaWeblog.getPost');
     4993        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     4994        do_action( 'xmlrpc_call', 'metaWeblog.getPost' );
    46504995
    46514996        if ($postdata['post_date'] != '') {
     
    47715116            return new IXR_Error( 401, __( 'Sorry, you cannot edit posts on this site.' ) );
    47725117
    4773         do_action('xmlrpc_call', 'metaWeblog.getRecentPosts');
     5118        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5119        do_action( 'xmlrpc_call', 'metaWeblog.getRecentPosts' );
    47745120
    47755121        $posts_list = wp_get_recent_posts( $query );
     
    48865232            return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) );
    48875233
    4888         do_action('xmlrpc_call', 'metaWeblog.getCategories');
     5234        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5235        do_action( 'xmlrpc_call', 'metaWeblog.getCategories' );
    48895236
    48905237        $categories_struct = array();
     
    49345281            return $this->error;
    49355282
    4936         do_action('xmlrpc_call', 'metaWeblog.newMediaObject');
     5283        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5284        do_action( 'xmlrpc_call', 'metaWeblog.newMediaObject' );
    49375285
    49385286        if ( !current_user_can('upload_files') ) {
     
    49415289        }
    49425290
    4943         if ( $upload_err = apply_filters( 'pre_upload_error', false ) )
    4944             return new IXR_Error(500, $upload_err);
     5291        /**
     5292         * Filter whether to preempt the XML-RPC media upload.
     5293         *
     5294         * Passing a truthy value will effectively short-circuit the media upload,
     5295         * returning that value as a 500 error instead.
     5296         *
     5297         * @since 2.1.0
     5298         *
     5299         * @param bool $error Whether to pre-empt the media upload. Default false.
     5300         */
     5301        if ( $upload_err = apply_filters( 'pre_upload_error', false ) ) {
     5302            return new IXR_Error( 500, $upload_err );
     5303        }
    49455304
    49465305        if ( !empty($data['overwrite']) && ($data['overwrite'] == true) ) {
     
    49885347        wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
    49895348
     5349        /**
     5350         * Fires after a new attachment has been added via the XML-RPC MovableType API.
     5351         *
     5352         * @since 3.4.0
     5353         *
     5354         * @param int   $id   ID of the new attachment.
     5355         * @param array $args An array of arguments to add the attachment.
     5356         */
    49905357        do_action( 'xmlrpc_call_success_mw_newMediaObject', $id, $args );
    49915358
     
    50285395            return $this->error;
    50295396
    5030         do_action('xmlrpc_call', 'mt.getRecentPostTitles');
     5397        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5398        do_action( 'xmlrpc_call', 'mt.getRecentPostTitles' );
    50315399
    50325400        $posts_list = wp_get_recent_posts( $query );
     
    50875455            return new IXR_Error( 401, __( 'Sorry, you must be able to edit posts on this site in order to view categories.' ) );
    50885456
    5089         do_action('xmlrpc_call', 'mt.getCategoryList');
     5457        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5458        do_action( 'xmlrpc_call', 'mt.getCategoryList' );
    50905459
    50915460        $categories_struct = array();
     
    51285497            return new IXR_Error( 401, __( 'Sorry, you can not edit this post.' ) );
    51295498
    5130         do_action('xmlrpc_call', 'mt.getPostCategories');
     5499        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5500        do_action( 'xmlrpc_call', 'mt.getPostCategories' );
    51315501
    51325502        $categories = array();
     
    51665536            return $this->error;
    51675537
    5168         do_action('xmlrpc_call', 'mt.setPostCategories');
     5538        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5539        do_action( 'xmlrpc_call', 'mt.setPostCategories' );
    51695540
    51705541        if ( ! get_post( $post_ID ) )
     
    51945565    function mt_supportedMethods($args) {
    51955566
    5196         do_action('xmlrpc_call', 'mt.supportedMethods');
     5567        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5568        do_action( 'xmlrpc_call', 'mt.supportedMethods' );
    51975569
    51985570        $supported_methods = array();
     
    52125584     */
    52135585    function mt_supportedTextFilters($args) {
    5214         do_action('xmlrpc_call', 'mt.supportedTextFilters');
    5215         return apply_filters('xmlrpc_text_filters', array());
     5586        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5587        do_action( 'xmlrpc_call', 'mt.supportedTextFilters' );
     5588
     5589        /**
     5590         * Filter the MoveableType text filters list for XML-RPC.
     5591         *
     5592         * @since 2.2.0
     5593         *
     5594         * @param array $filters An array of text filters.
     5595         */
     5596        return apply_filters( 'xmlrpc_text_filters', array() );
    52165597    }
    52175598
     
    52305611        $post_ID = intval($args);
    52315612
    5232         do_action('xmlrpc_call', 'mt.getTrackbackPings');
     5613        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5614        do_action( 'xmlrpc_call', 'mt.getTrackbackPings' );
    52335615
    52345616        $actual_post = get_post($post_ID, ARRAY_A);
     
    52775659            return $this->error;
    52785660
    5279         do_action('xmlrpc_call', 'mt.publishPost');
     5661        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5662        do_action( 'xmlrpc_call', 'mt.publishPost' );
    52805663
    52815664        $postdata = get_post($post_ID, ARRAY_A);
     
    53135696        global $wpdb;
    53145697
    5315         do_action('xmlrpc_call', 'pingback.ping');
     5698        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5699        do_action( 'xmlrpc_call', 'pingback.ping' );
    53165700
    53175701        $this->escape($args);
     
    53265710        $pagelinkedto = str_replace('&', '&', $pagelinkedto);
    53275711
     5712        /**
     5713         * Filter the pingback source URI.
     5714         *
     5715         * @since 3.6.0
     5716         *
     5717         * @param string $pagelinkedfrom URI of the page linked from.
     5718         * @param string $pagelinkedto   URI of the page linked to.
     5719         */
    53285720        $pagelinkedfrom = apply_filters( 'pingback_ping_source_uri', $pagelinkedfrom, $pagelinkedto );
     5721
    53295722        if ( ! $pagelinkedfrom )
    53305723            return $this->pingback_error( 0, __( 'A valid URL was not provided.' ) );
     
    54055798
    54065799        if ( !$linea )
    5407             return $this->pingback_error( 16, __( 'The source URL does not exist.' ) );
    5408 
    5409         $linea = apply_filters('pre_remote_source', $linea, $pagelinkedto);
     5800            return $this->pingback_error( 16, __( 'The source URL does not exist.' ) );
     5801
     5802        /**
     5803         * Filter the pingback remote source.
     5804         *
     5805         * @since 2.5.0
     5806         *
     5807         * @param string $linea        Response object for the page linked from.
     5808         * @param string $pagelinkedto URL of the page linked to.
     5809         */
     5810        $linea = apply_filters( 'pre_remote_source', $linea, $pagelinkedto );
    54105811
    54115812        // Work around bug in strip_tags():
     
    54725873
    54735874        $comment_ID = wp_new_comment($commentdata);
    5474         do_action('pingback_post', $comment_ID);
     5875
     5876        /**
     5877         * Fires after a post pingback has been sent.
     5878         *
     5879         * @since 0.71
     5880         *
     5881         * @param int $comment_ID Comment ID.
     5882         */
     5883        do_action( 'pingback_post', $comment_ID );
    54755884
    54765885        return sprintf(__('Pingback from %1$s to %2$s registered. Keep the web talking! :-)'), $pagelinkedfrom, $pagelinkedto);
     
    54915900        global $wpdb;
    54925901
    5493         do_action('xmlrpc_call', 'pingback.extensions.getPingbacks');
     5902        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     5903        do_action( 'xmlrpc_call', 'pingback.extensions.getPingbacks' );
    54945904
    54955905        $this->escape($args);
     
    55255935
    55265936    protected function pingback_error( $code, $message ) {
     5937        /**
     5938         * Filter the XML-RPC pingback error return.
     5939         *
     5940         * @since 3.5.1
     5941         *
     5942         * @param IXR_Error $error An IXR_Error object containing the error code and message.
     5943         */
    55275944        return apply_filters( 'xmlrpc_pingback_error', new IXR_Error( $code, $message ) );
    55285945    }
Note: See TracChangeset for help on using the changeset viewer.