Make WordPress Core

Changeset 28515


Ignore:
Timestamp:
05/19/2014 06:08:04 AM (11 years ago)
Author:
wonderboymusic
Message:

Add missing access modifiers to methods in wp_xmlrpc_server. Add a magic __call() method for BC.

See #27881, #22234.

File:
1 edited

Legend:

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

    r28453 r28515  
    3434     * @return wp_xmlrpc_server
    3535     */
    36     function __construct() {
     36    public function __construct() {
    3737        $this->methods = array(
    3838            // WordPress API
     
    141141    }
    142142
    143     function serve_request() {
     143    /**
     144     * Make private/protected methods readable for backwards compatibility
     145     *
     146     * @since 4.0.0
     147     * @param string $name
     148     * @param array $arguments
     149     * @return mixed
     150     */
     151    public function __call( $name, $arguments ) {
     152        return call_user_func_array( array( $this, $name ), $arguments );
     153    }
     154
     155    public function serve_request() {
    144156        $this->IXR_Server($this->methods);
    145157    }
     
    153165     * @return string
    154166     */
    155     function sayHello($args) {
     167    public function sayHello($args) {
    156168        return 'Hello!';
    157169    }
     
    165177     * @return int
    166178     */
    167     function addTwoNumbers($args) {
     179    public function addTwoNumbers($args) {
    168180        $number1 = $args[0];
    169181        $number2 = $args[1];
     
    180192     * @return mixed WP_User object if authentication passed, false otherwise
    181193     */
    182     function login( $username, $password ) {
     194    public function login( $username, $password ) {
    183195        /*
    184196         * Respect old get_option() filters left for back-compat when the 'enable_xmlrpc'
     
    239251     * @return bool Whether authentication passed.
    240252     */
    241     function login_pass_ok( $username, $password ) {
     253    public function login_pass_ok( $username, $password ) {
    242254        return (bool) $this->login( $username, $password );
    243255    }
     
    251263     * @return string|array Type matches $data and sanitized for the database.
    252264     */
    253     function escape( &$data ) {
     265    public function escape( &$data ) {
    254266        if ( ! is_array( $data ) )
    255267            return wp_slash( $data );
     
    271283     * @return array Custom fields, if exist.
    272284     */
    273     function get_custom_fields($post_id) {
     285    public function get_custom_fields($post_id) {
    274286        $post_id = (int) $post_id;
    275287
     
    299311     * @param array $fields Custom fields.
    300312     */
    301     function set_custom_fields($post_id, $fields) {
     313    public function set_custom_fields($post_id, $fields) {
    302314        $post_id = (int) $post_id;
    303315
     
    329341     * @since 2.6.0
    330342     */
    331     function initialise_blog_option_info() {
     343    public function initialise_blog_option_info() {
    332344        global $wp_version;
    333345
     
    498510     *  - 'xmlrpc' - url of xmlrpc endpoint
    499511     */
    500     function wp_getUsersBlogs( $args ) {
     512    public function wp_getUsersBlogs( $args ) {
    501513        // If this isn't on WPMU then just use blogger_getUsersBlogs
    502514        if ( !is_multisite() ) {
     
    10761088     * @return string post_id
    10771089     */
    1078     function wp_newPost( $args ) {
     1090    public function wp_newPost( $args ) {
    10791091        if ( ! $this->minimum_args( $args, 4 ) )
    10801092            return $this->error;
     
    13701382     * @return true on success
    13711383     */
    1372     function wp_editPost( $args ) {
     1384    public function wp_editPost( $args ) {
    13731385        if ( ! $this->minimum_args( $args, 5 ) )
    13741386            return $this->error;
     
    14331445     * @return true on success
    14341446     */
    1435     function wp_deletePost( $args ) {
     1447    public function wp_deletePost( $args ) {
    14361448        if ( ! $this->minimum_args( $args, 4 ) )
    14371449            return $this->error;
     
    15091521     *  - 'enclosure'
    15101522     */
    1511     function wp_getPost( $args ) {
     1523    public function wp_getPost( $args ) {
    15121524        if ( ! $this->minimum_args( $args, 4 ) )
    15131525            return $this->error;
     
    15751587     * @return array contains a collection of posts.
    15761588     */
    1577     function wp_getPosts( $args ) {
     1589    public function wp_getPosts( $args ) {
    15781590        if ( ! $this->minimum_args( $args, 3 ) )
    15791591            return $this->error;
     
    16721684     * @return string term_id
    16731685     */
    1674     function wp_newTerm( $args ) {
     1686    public function wp_newTerm( $args ) {
    16751687        if ( ! $this->minimum_args( $args, 4 ) )
    16761688            return $this->error;
     
    17601772     * @return bool True, on success.
    17611773     */
    1762     function wp_editTerm( $args ) {
     1774    public function wp_editTerm( $args ) {
    17631775        if ( ! $this->minimum_args( $args, 5 ) )
    17641776            return $this->error;
     
    18531865     * @return boolean|IXR_Error If it suceeded true else a reason why not
    18541866     */
    1855     function wp_deleteTerm( $args ) {
     1867    public function wp_deleteTerm( $args ) {
    18561868        if ( ! $this->minimum_args( $args, 5 ) )
    18571869            return $this->error;
     
    19211933     *  - 'count'
    19221934     */
    1923     function wp_getTerm( $args ) {
     1935    public function wp_getTerm( $args ) {
    19241936        if ( ! $this->minimum_args( $args, 5 ) )
    19251937            return $this->error;
     
    19751987     * @return array terms
    19761988     */
    1977     function wp_getTerms( $args ) {
     1989    public function wp_getTerms( $args ) {
    19781990        if ( ! $this->minimum_args( $args, 4 ) )
    19791991            return $this->error;
     
    20512063     * @return array (@see get_taxonomy())
    20522064     */
    2053     function wp_getTaxonomy( $args ) {
     2065    public function wp_getTaxonomy( $args ) {
    20542066        if ( ! $this->minimum_args( $args, 4 ) )
    20552067            return $this->error;
     
    21052117     * @return array taxonomies
    21062118     */
    2107     function wp_getTaxonomies( $args ) {
     2119    public function wp_getTaxonomies( $args ) {
    21082120        if ( ! $this->minimum_args( $args, 3 ) )
    21092121            return $this->error;
     
    21772189     *  - 'roles'
    21782190     */
    2179     function wp_getUser( $args ) {
     2191    public function wp_getUser( $args ) {
    21802192        if ( ! $this->minimum_args( $args, 4 ) )
    21812193            return $this->error;
     
    22402252     * @return array users data
    22412253     */
    2242     function wp_getUsers( $args ) {
     2254    public function wp_getUsers( $args ) {
    22432255        if ( ! $this->minimum_args( $args, 3 ) )
    22442256            return $this->error;
     
    23112323     * @return array (@see wp_getUser)
    23122324     */
    2313     function wp_getProfile( $args ) {
     2325    public function wp_getProfile( $args ) {
    23142326        if ( ! $this->minimum_args( $args, 3 ) )
    23152327            return $this->error;
     
    23612373     * @return bool True, on success.
    23622374     */
    2363     function wp_editProfile( $args ) {
     2375    public function wp_editProfile( $args ) {
    23642376        if ( ! $this->minimum_args( $args, 4 ) )
    23652377            return $this->error;
     
    24302442     * @return array
    24312443     */
    2432     function wp_getPage($args) {
     2444    public function wp_getPage($args) {
    24332445        $this->escape($args);
    24342446
     
    24742486     * @return array
    24752487     */
    2476     function wp_getPages($args) {
     2488    public function wp_getPages($args) {
    24772489        $this->escape($args);
    24782490
     
    25192531     * @return unknown
    25202532     */
    2521     function wp_newPage($args) {
     2533    public function wp_newPage($args) {
    25222534        // Items not escaped here will be escaped in newPost.
    25232535        $username   = $this->escape($args[1]);
     
    25472559     * @return bool True, if success.
    25482560     */
    2549     function wp_deletePage($args) {
     2561    public function wp_deletePage($args) {
    25502562        $this->escape($args);
    25512563
     
    25972609     * @return unknown
    25982610     */
    2599     function wp_editPage($args) {
     2611    public function wp_editPage($args) {
    26002612        // Items not escaped here will be escaped in editPost.
    26012613        $blog_id    = (int) $args[0];
     
    26452657     * @return unknown
    26462658     */
    2647     function wp_getPageList($args) {
     2659    public function wp_getPageList($args) {
    26482660        global $wpdb;
    26492661
     
    26982710     * @return array
    26992711     */
    2700     function wp_getAuthors($args) {
     2712    public function wp_getAuthors($args) {
    27012713
    27022714        $this->escape($args);
     
    27352747     * @return array
    27362748     */
    2737     function wp_getTags( $args ) {
     2749    public function wp_getTags( $args ) {
    27382750        $this->escape( $args );
    27392751
     
    27772789     * @return int Category ID.
    27782790     */
    2779     function wp_newCategory($args) {
     2791    public function wp_newCategory($args) {
    27802792        $this->escape($args);
    27812793
     
    28472859     * @return mixed See {@link wp_delete_term()} for return info.
    28482860     */
    2849     function wp_deleteCategory($args) {
     2861    public function wp_deleteCategory($args) {
    28502862        $this->escape($args);
    28512863
     
    28892901     * @return array
    28902902     */
    2891     function wp_suggestCategories($args) {
     2903    public function wp_suggestCategories($args) {
    28922904        $this->escape($args);
    28932905
     
    29272939     * @return array
    29282940     */
    2929     function wp_getComment($args) {
     2941    public function wp_getComment($args) {
    29302942        $this->escape($args);
    29312943
     
    29692981     * @return array. Contains a collection of comments. See {@link wp_xmlrpc_server::wp_getComment()} for a description of each item contents
    29702982     */
    2971     function wp_getComments($args) {
     2983    public function wp_getComments($args) {
    29722984        $this->escape($args);
    29732985
     
    30303042     * @return mixed {@link wp_delete_comment()}
    30313043     */
    3032     function wp_deleteComment($args) {
     3044    public function wp_deleteComment($args) {
    30333045        $this->escape($args);
    30343046
     
    30943106     * @return bool True, on success.
    30953107     */
    3096     function wp_editComment($args) {
     3108    public function wp_editComment($args) {
    30973109        $this->escape($args);
    30983110
     
    31783190     * @return mixed {@link wp_new_comment()}
    31793191     */
    3180     function wp_newComment($args) {
     3192    public function wp_newComment($args) {
    31813193        global $wpdb;
    31823194
     
    32823294     * @return array
    32833295     */
    3284     function wp_getCommentStatusList($args) {
     3296    public function wp_getCommentStatusList($args) {
    32853297        $this->escape( $args );
    32863298
     
    33093321     * @return array
    33103322     */
    3311     function wp_getCommentCount( $args ) {
     3323    public function wp_getCommentCount( $args ) {
    33123324        $this->escape($args);
    33133325
     
    33433355     * @return array
    33443356     */
    3345     function wp_getPostStatusList( $args ) {
     3357    public function wp_getPostStatusList( $args ) {
    33463358        $this->escape( $args );
    33473359
     
    33703382     * @return array
    33713383     */
    3372     function wp_getPageStatusList( $args ) {
     3384    public function wp_getPageStatusList( $args ) {
    33733385        $this->escape( $args );
    33743386
     
    33973409     * @return array
    33983410     */
    3399     function wp_getPageTemplates( $args ) {
     3411    public function wp_getPageTemplates( $args ) {
    34003412        $this->escape( $args );
    34013413
     
    34243436     * @return array
    34253437     */
    3426     function wp_getOptions( $args ) {
     3438    public function wp_getOptions( $args ) {
    34273439        $this->escape( $args );
    34283440
     
    34503462     * @return array
    34513463     */
    3452     function _getOptions($options) {
     3464    public function _getOptions($options) {
    34533465        $data = array();
    34543466        $can_manage = current_user_can( 'manage_options' );
     
    34783490     * @return unknown
    34793491     */
    3480     function wp_setOptions( $args ) {
     3492    public function wp_setOptions( $args ) {
    34813493        $this->escape( $args );
    34823494
     
    35273539     *  - 'metadata'
    35283540     */
    3529     function wp_getMediaItem($args) {
     3541    public function wp_getMediaItem($args) {
    35303542        $this->escape($args);
    35313543
     
    35733585     * @return array. Contains a collection of media items. See {@link wp_xmlrpc_server::wp_getMediaItem()} for a description of each item contents
    35743586     */
    3575     function wp_getMediaLibrary($args) {
     3587    public function wp_getMediaLibrary($args) {
    35763588        $this->escape($args);
    35773589
     
    36163628      * @return array
    36173629      */
    3618     function wp_getPostFormats( $args ) {
     3630    public function wp_getPostFormats( $args ) {
    36193631        $this->escape( $args );
    36203632
     
    36743686     *  - 'supports'
    36753687     */
    3676     function wp_getPostType( $args ) {
     3688    public function wp_getPostType( $args ) {
    36773689        if ( ! $this->minimum_args( $args, 4 ) )
    36783690            return $this->error;
     
    37303742     * @return array
    37313743     */
    3732     function wp_getPostTypes( $args ) {
     3744    public function wp_getPostTypes( $args ) {
    37333745        if ( ! $this->minimum_args( $args, 3 ) )
    37343746            return $this->error;
     
    37873799     * @return array contains a collection of posts.
    37883800     */
    3789     function wp_getRevisions( $args ) {
     3801    public function wp_getRevisions( $args ) {
    37903802        if ( ! $this->minimum_args( $args, 4 ) )
    37913803            return $this->error;
     
    38633875     * @return bool false if there was an error restoring, true if success.
    38643876     */
    3865     function wp_restoreRevision( $args ) {
     3877    public function wp_restoreRevision( $args ) {
    38663878        if ( ! $this->minimum_args( $args, 3 ) )
    38673879            return $this->error;
     
    39153927     * @return array
    39163928     */
    3917     function blogger_getUsersBlogs($args) {
     3929    public function blogger_getUsersBlogs($args) {
    39183930        if ( is_multisite() )
    39193931            return $this->_multisite_getUsersBlogs($args);
     
    39483960     * @access protected
    39493961     */
    3950     function _multisite_getUsersBlogs($args) {
     3962    protected function _multisite_getUsersBlogs($args) {
    39513963        $current_blog = get_blog_details();
    39523964
     
    39823994     * @return array
    39833995     */
    3984     function blogger_getUserInfo($args) {
     3996    public function blogger_getUserInfo($args) {
    39853997
    39863998        $this->escape($args);
     
    40174029     * @return array
    40184030     */
    4019     function blogger_getPost($args) {
     4031    public function blogger_getPost($args) {
    40204032
    40214033        $this->escape($args);
     
    40624074     * @return array
    40634075     */
    4064     function blogger_getRecentPosts($args) {
     4076    public function blogger_getRecentPosts($args) {
    40654077
    40664078        $this->escape($args);
     
    41254137     * @deprecated 3.5.0
    41264138     */
    4127     function blogger_getTemplate($args) {
     4139    public function blogger_getTemplate($args) {
    41284140        return new IXR_Error( 403, __('Sorry, that file cannot be edited.' ) );
    41294141    }
     
    41354147     * @deprecated 3.5.0
    41364148     */
    4137     function blogger_setTemplate($args) {
     4149    public function blogger_setTemplate($args) {
    41384150        return new IXR_Error( 403, __('Sorry, that file cannot be edited.' ) );
    41394151    }
     
    41474159     * @return int
    41484160     */
    4149     function blogger_newPost($args) {
     4161    public function blogger_newPost($args) {
    41504162
    41514163        $this->escape($args);
     
    42104222     * @return bool true when done.
    42114223     */
    4212     function blogger_editPost( $args ) {
     4224    public function blogger_editPost( $args ) {
    42134225
    42144226        $this->escape($args);
     
    42784290     * @return bool True when post is deleted.
    42794291     */
    4280     function blogger_deletePost($args) {
     4292    public function blogger_deletePost($args) {
    42814293        $this->escape($args);
    42824294
     
    43574369     * @return int
    43584370     */
    4359     function mw_newPost($args) {
     4371    public function mw_newPost($args) {
    43604372        $this->escape($args);
    43614373
     
    46374649    }
    46384650
    4639     function add_enclosure_if_new( $post_ID, $enclosure ) {
     4651    public function add_enclosure_if_new( $post_ID, $enclosure ) {
    46404652        if ( is_array( $enclosure ) && isset( $enclosure['url'] ) && isset( $enclosure['length'] ) && isset( $enclosure['type'] ) ) {
    46414653            $encstring = $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'] . "\n";
     
    46634675     * @param string $post_content Post Content for attachment.
    46644676     */
    4665     function attach_uploads( $post_ID, $post_content ) {
     4677    public function attach_uploads( $post_ID, $post_content ) {
    46664678        global $wpdb;
    46674679
     
    46844696     * @return bool True on success.
    46854697     */
    4686     function mw_editPost($args) {
     4698    public function mw_editPost($args) {
    46874699
    46884700        $this->escape($args);
     
    49714983     * @return array
    49724984     */
    4973     function mw_getPost($args) {
     4985    public function mw_getPost($args) {
    49744986
    49754987        $this->escape($args);
     
    50965108     * @return array
    50975109     */
    5098     function mw_getRecentPosts($args) {
     5110    public function mw_getRecentPosts($args) {
    50995111
    51005112        $this->escape($args);
     
    52165228     * @return array
    52175229     */
    5218     function mw_getCategories($args) {
     5230    public function mw_getCategories($args) {
    52195231
    52205232        $this->escape($args);
     
    52645276     * @return array
    52655277     */
    5266     function mw_newMediaObject($args) {
     5278    public function mw_newMediaObject($args) {
    52675279        global $wpdb;
    52685280
     
    53785390     * @return array
    53795391     */
    5380     function mt_getRecentPostTitles($args) {
     5392    public function mt_getRecentPostTitles($args) {
    53815393
    53825394        $this->escape($args);
     
    54395451     * @return array
    54405452     */
    5441     function mt_getCategoryList($args) {
     5453    public function mt_getCategoryList($args) {
    54425454
    54435455        $this->escape($args);
     
    54785490     * @return array
    54795491     */
    5480     function mt_getPostCategories($args) {
     5492    public function mt_getPostCategories($args) {
    54815493
    54825494        $this->escape($args);
     
    55225534     * @return bool True on success.
    55235535     */
    5524     function mt_setPostCategories($args) {
     5536    public function mt_setPostCategories($args) {
    55255537
    55265538        $this->escape($args);
     
    55615573     * @return array
    55625574     */
    5563     function mt_supportedMethods($args) {
     5575    public function mt_supportedMethods($args) {
    55645576
    55655577        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
     
    55815593     * @param array $args Method parameters.
    55825594     */
    5583     function mt_supportedTextFilters($args) {
     5595    public function mt_supportedTextFilters($args) {
    55845596        /** This action is documented in wp-includes/class-wp-xmlrpc-server.php */
    55855597        do_action( 'xmlrpc_call', 'mt.supportedTextFilters' );
     
    56035615     * @return mixed
    56045616     */
    5605     function mt_getTrackbackPings($args) {
     5617    public function mt_getTrackbackPings($args) {
    56065618
    56075619        global $wpdb;
     
    56465658     * @return int
    56475659     */
    5648     function mt_publishPost($args) {
     5660    public function mt_publishPost($args) {
    56495661
    56505662        $this->escape($args);
     
    56915703     * @return array
    56925704     */
    5693     function pingback_ping($args) {
     5705    public function pingback_ping($args) {
    56945706        global $wpdb;
    56955707
     
    59045916     * @return array
    59055917     */
    5906     function pingback_extensions_getPingbacks($args) {
     5918    public function pingback_extensions_getPingbacks($args) {
    59075919
    59085920        global $wpdb;
Note: See TracChangeset for help on using the changeset viewer.