Index: includes/xmlrpcs.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/xmlrpcs.inc,v retrieving revision 1.39 diff -u -r1.39 xmlrpcs.inc --- includes/xmlrpcs.inc 29 Apr 2010 05:35:21 -0000 1.39 +++ includes/xmlrpcs.inc 20 Jul 2010 18:19:08 -0000 @@ -7,9 +7,9 @@ */ /** - * The main entry point for XML-RPC requests. + * Performs XML-RPC requests. * - * @param $callbacks + * @param array $callbacks * Array of external XML-RPC method names with the callbacks they map to. */ function xmlrpc_server($callbacks) { @@ -99,12 +99,13 @@ } /** - * Throw an XML-RPC error. + * Throws an XML-RPC error. * * @param $error - * an error object OR integer error code - * @param $message - * description of error, used only if integer error code was passed + * An error object or integer error code. + * @param string $message + * The description of the error. Used only if an integer error code was + * passed in. */ function xmlrpc_server_error($error, $message = FALSE) { if ($message && !is_object($error)) { @@ -113,6 +114,12 @@ xmlrpc_server_output(xmlrpc_error_get_xml($error)); } +/** + * Sends XML-RPC output to the browser. + * + * @param string $xml + * XML to send to the browser. + */ function xmlrpc_server_output($xml) { $xml = '' . "\n" . $xml; drupal_add_http_header('Content-Length', strlen($xml)); @@ -122,10 +129,15 @@ } /** - * Store a copy of the request temporarily. + * Stores a copy of an XML-RPC request temporarily. * * @param $xmlrpc_server * Request object created by xmlrpc_server(). + * + * @return + * The latest stored request. + * + * @see xmlrpc_server_get() */ function xmlrpc_server_set($xmlrpc_server = NULL) { static $server; @@ -135,21 +147,31 @@ return $server; } -// Retrieve the stored request. +/** + * Retrieves the latest stored XML-RCP request. + * + * @return object + * The stored request. + * + * @see xmlrpc_server_set() + */ function xmlrpc_server_get() { return xmlrpc_server_set(); } /** - * Dispatch the request and any parameters to the appropriate handler. + * Dispatches an XML-RPC request and any parameters to the appropriate handler. * * @param $xmlrpc_server - * Contains information about this XML-RPC server, the methods it provides, - * their signatures, etc. + * Object containing information about this XML-RPC server, the methods it + * provides, their signatures, etc. * @param $methodname - * The external XML-RPC method name, e.g. 'system.methodHelp' + * The external XML-RPC method name; e.g., 'system.methodHelp'. * @param $args * Array containing any parameters that were sent along with the request. + * + * @return + * The results of the call. */ function xmlrpc_server_call($xmlrpc_server, $methodname, $args) { // Make sure parameters are in an array @@ -218,6 +240,20 @@ return call_user_func_array($method, $args); } +/** + * Dispatches multiple XML-RPC requests. + * + * @param array $methodcalls + * An array of XML-RPC requests to make. Each request is an array with the + * following elements: + * - methodName: Name of the method to invoke. + * - params: Parameters to pass to the method. + * + * @return + * An array of the results of each request. + * + * @see xmlrpc_server_call() + */ function xmlrpc_server_multicall($methodcalls) { // See http://www.xmlrpc.com/discuss/msgReader$1208 $return = array(); @@ -249,9 +285,13 @@ return $return; } - /** + * Lists methods available on this XML-RPC server. + * * XML-RPC method system.listMethods maps to this function. + * + * @return array + * Array of the names of methods available on this server. */ function xmlrpc_server_list_methods() { $xmlrpc_server = xmlrpc_server_get(); @@ -259,8 +299,13 @@ } /** + * Returns a list of the capabilities of this server. + * * XML-RPC method system.getCapabilities maps to this function. * + * @return array + * Array of server capabilities. + * * @see http://groups.yahoo.com/group/xml-rpc/message/2897 */ function xmlrpc_server_get_capabilities() { @@ -285,15 +330,20 @@ } /** - * XML-RPC method system.methodSignature maps to this function. + * Returns the method signature of a function. * - * @param $methodname - * Name of method for which we return a method signature. - * @return - * An array of types representing the method signature of the - * function that the methodname maps to. The methodSignature of - * this function is 'array', 'string' because it takes an array - * and returns a string. + * This is the function mapped to the XML-RPC method system.methodSignature. + * + * A method signature is an array of the input and output types of a method. For + * instance, the method signature of this function is array('array', 'string'), + * because it takes an array and returns a string. + * + * @param string $methodname + * Name of method to return a method signature for. + * + * @return array + * An array of types representing the method signature of the function that + * $methodname maps to. */ function xmlrpc_server_method_signature($methodname) { $xmlrpc_server = xmlrpc_server_get(); @@ -312,10 +362,15 @@ } /** + * Returns the help for an XML-RPC method. + * * XML-RPC method system.methodHelp maps to this function. * - * @param $method + * @param string $method * Name of method for which we return a help string. + * + * @return string + * Help text for $method. */ function xmlrpc_server_method_help($method) { $xmlrpc_server = xmlrpc_server_get();