wp/wp-includes/IXR/class-IXR-request.php
changeset 7 cf61fcea0001
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
       
     1 <?php
       
     2 
       
     3 /**
       
     4  * IXR_Request
       
     5  *
       
     6  * @package IXR
       
     7  * @since 1.5.0
       
     8  */
       
     9 class IXR_Request
       
    10 {
       
    11     var $method;
       
    12     var $args;
       
    13     var $xml;
       
    14 
       
    15 	/**
       
    16 	 * PHP5 constructor.
       
    17 	 */
       
    18     function __construct($method, $args)
       
    19     {
       
    20         $this->method = $method;
       
    21         $this->args = $args;
       
    22         $this->xml = <<<EOD
       
    23 <?xml version="1.0"?>
       
    24 <methodCall>
       
    25 <methodName>{$this->method}</methodName>
       
    26 <params>
       
    27 
       
    28 EOD;
       
    29         foreach ($this->args as $arg) {
       
    30             $this->xml .= '<param><value>';
       
    31             $v = new IXR_Value($arg);
       
    32             $this->xml .= $v->getXml();
       
    33             $this->xml .= "</value></param>\n";
       
    34         }
       
    35         $this->xml .= '</params></methodCall>';
       
    36     }
       
    37 
       
    38 	/**
       
    39 	 * PHP4 constructor.
       
    40 	 */
       
    41 	public function IXR_Request( $method, $args ) {
       
    42 		self::__construct( $method, $args );
       
    43 	}
       
    44 
       
    45     function getLength()
       
    46     {
       
    47         return strlen($this->xml);
       
    48     }
       
    49 
       
    50     function getXml()
       
    51     {
       
    52         return $this->xml;
       
    53     }
       
    54 }