Make WordPress Core

Ticket #1476: 1476-xmlrpcserver-example.patch

File 1476-xmlrpcserver-example.patch, 1.0 KB (added by pishmishy, 17 years ago)

XML RPC server (as a modification to WordPress XML RPC, example for testing only)

  • xmlrpc.php

     
    7575        function wp_xmlrpc_server() {
    7676                $this->methods = array(
    7777                        // WordPress API
     78                        'wp.getVersion'                 => 'this:wp_getVersion',
    7879                        'wp.getPage'                    => 'this:wp_getPage',
    7980                        'wp.getPages'                   => 'this:wp_getPages',
    8081                        'wp.newPage'                    => 'this:wp_newPage',
     
    171172                }
    172173        }
    173174
     175        function wp_getVersion($args){
     176                $this->escape($args);
     177                $branch = (string) $args;
     178                if ($branch == "2.0"){
     179                        // Return the latest version in this branch
     180                        return "2.0.11";
     181                } elseif ($branch == "2.1") {
     182                        // If the branch is unsupported return 0
     183                        return "0";
     184                } elseif ($branch == "2.2") {
     185                        return "2.2.2";
     186                } elseif ($branch == "0"){
     187                        // Client is actually asking for the very latest version
     188                        return "2.2.2";
     189                } else {
     190                        // Client asked about a branch we know nothing about
     191                        // report as unsupported.
     192                        return "0";
     193                }
     194        }
     195
    174196        /**
    175197         * WordPress XML-RPC API
    176198         * wp_getPage