class-IXR-request.php 927 B

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