[ Index ]
 

Code source de Joomla 1.0.13

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/includes/domit/ -> dom_xmlrpc_methodcall.php (source)

   1  <?php
   2  /**
   3  * dom_xmlrpc_methodcall is a representation of an XML-RPC method call
   4  * @package dom-xmlrpc
   5  * @copyright (C) 2004 John Heinstein. All rights reserved
   6  * @license http://www.gnu.org/copyleft/lesser.html LGPL License
   7  * @author John Heinstein <johnkarl@nbnet.nb.ca>
   8  * @link http://www.engageinteractive.com/dom_xmlrpc/ DOM XML-RPC Home Page
   9  * DOM XML-RPC is Free Software
  10  **/
  11  
  12  if (!defined('DOM_XMLRPC_INCLUDE_PATH')) {
  13      define('DOM_XMLRPC_INCLUDE_PATH', (dirname(__FILE__) . "/"));
  14  }
  15  
  16  require_once (DOM_XMLRPC_INCLUDE_PATH . 'dom_xmlrpc_builder.php');
  17  
  18  /**
  19  * A representation of an XML-RPC method call
  20  *
  21  * @package dom-xmlrpc
  22  * @author John Heinstein <johnkarl@nbnet.nb.ca>
  23  */
  24  class dom_xmlrpc_methodcall extends dom_xmlrpc_builder {
  25      /** @var string The method name */
  26      var $methodName;
  27      /** @var boolean True if multiple method calls are to be made in a single request */
  28      var $multicall = array();
  29  
  30      /**
  31      * Constructor: Instantiates a new method call
  32      * @param string The method name
  33      */
  34  	function dom_xmlrpc_methodcall($methodName = '') {
  35          require_once (DOM_XMLRPC_INCLUDE_PATH . 'dom_xmlrpc_constants.php');
  36          require_once (DOM_XMLRPC_INCLUDE_PATH . 'dom_xmlrpc_utilities.php');
  37  
  38          $this->methodType = DOM_XMLRPC_TYPE_METHODCALL;
  39          $this->methodName = $methodName;
  40  
  41          $total = func_num_args();
  42  
  43          for ($i = 1; $i < $total; $i++) {
  44              $this->add(func_get_arg($i));
  45          }
  46      } //dom_xmlrpc_methodcall
  47  
  48      /**
  49      * Sets the method name
  50      * @param string The method name
  51      */
  52  	function setMethodName($name = '') {
  53          $this->methodName = $name;
  54      } //setMethodName
  55  
  56      /**
  57      * Appends multiple method calls to the request
  58      * @param string The method name
  59      */
  60  	function addMultiCall($methodName) {
  61          $total = func_num_args();
  62          $paramsArray = array();
  63  
  64          for ($i = 1; $i < $total; $i++) {
  65              $paramsArray[] = func_get_arg($i);
  66          }
  67  
  68          $this->addMultiCallByRef($methodName, $paramsArray);
  69      } //addMultiCall
  70  
  71      /**
  72      * Appends multiple method calls to the request
  73      * @param string The method name
  74      * @param array A reference to an array of method parameters
  75      */
  76  	function addMultiCallByRef($methodName, &$paramsArray) {
  77          $myCall = array(DOM_XMLRPC_TYPE_METHODNAME => $methodName,
  78                          DOM_XMLRPC_TYPE_PARAMS => $paramsArray);
  79          $this->multicall[] =& $myCall;
  80      } //addMultiCallByRef
  81  
  82      /**
  83      * Returns a string representation of the method call
  84      * @return string A string representation of the method call
  85      */
  86  	function toString() {
  87          if ($this->methodName == "system.multicall") {
  88              $this->addArrayByRef($this->multicall);
  89          }
  90  
  91          $data = <<<METHODCALL
  92  <?xml version='1.0'?>
  93  <methodCall>
  94      <methodName>$this->methodName</methodName>
  95      <params>$this->params
  96      </params>
  97  </methodCall>
  98  METHODCALL;
  99  
 100          return $data;
 101      } //toString
 102  
 103      /**
 104      * Alias of toString
 105      * @return string A string representation of the method call
 106      */
 107  	function toXML() {
 108          return $this->toString();
 109      } //toXML
 110  } //dom_xmlrpc_methodcall
 111  ?>


Généré le : Wed Nov 21 14:43:32 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics