X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/9e77185fafaf4e60e2b73821e0e4b9b1a11fb85f..53f4633144ed68c8b8fb5861f992b5489894a940:/wp-includes/class-IXR.php diff --git a/wp-includes/class-IXR.php b/wp-includes/class-IXR.php index b0a0f28d..ec3f70ca 100644 --- a/wp-includes/class-IXR.php +++ b/wp-includes/class-IXR.php @@ -49,7 +49,10 @@ class IXR_Value { var $data; var $type; - function IXR_Value($data, $type = false) + /** + * PHP5 constructor. + */ + function __construct( $data, $type = false ) { $this->data = $data; if (!$type) { @@ -69,6 +72,13 @@ class IXR_Value { } } + /** + * PHP4 constructor. + */ + public function IXR_Value( $data, $type = false ) { + self::__construct( $data, $type ); + } + function calculateType() { if ($this->data === true || $this->data === false) { @@ -151,8 +161,8 @@ class IXR_Value { /** * Checks whether or not the supplied array is a struct or not * - * @param unknown_type $array - * @return boolean + * @param array $array + * @return bool */ function isStruct($array) { @@ -194,11 +204,21 @@ class IXR_Message // The XML parser var $_parser; - function IXR_Message($message) + /** + * PHP5 constructor. + */ + function __construct( $message ) { $this->message =& $message; } + /** + * PHP4 constructor. + */ + public function IXR_Message( $message ) { + self::__construct( $message ); + } + function parse() { // first remove the XML declaration @@ -228,6 +248,13 @@ class IXR_Message // Bail if there are too many elements to parse $element_limit = 30000; if ( function_exists( 'apply_filters' ) ) { + /** + * Filter the number of elements to parse in an XML-RPC response. + * + * @since 4.0.0 + * + * @param int $element_limit Default elements limit. + */ $element_limit = apply_filters( 'xmlrpc_element_limit', $element_limit ); } if ( $element_limit && 2 * $element_limit < substr_count( $this->message, '<' ) ) { @@ -379,7 +406,10 @@ class IXR_Server var $message; var $capabilities; - function IXR_Server($callbacks = false, $data = false, $wait = false) + /** + * PHP5 constructor. + */ + function __construct( $callbacks = false, $data = false, $wait = false ) { $this->setCapabilities(); if ($callbacks) { @@ -391,11 +421,22 @@ class IXR_Server } } + /** + * PHP4 constructor. + */ + public function IXR_Server( $callbacks = false, $data = false, $wait = false ) { + self::__construct( $callbacks, $data, $wait ); + } + function serve($data = false) { if (!$data) { if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] !== 'POST') { - header('Content-Type: text/plain'); // merged from WP #9093 + if ( function_exists( 'status_header' ) ) { + status_header( 405 ); // WP #20986 + header( 'Allow: POST' ); + } + header('Content-Type: text/plain'); // merged from WP #9093 die('XML-RPC server accepts POST requests only.'); } @@ -589,7 +630,10 @@ class IXR_Request var $args; var $xml; - function IXR_Request($method, $args) + /** + * PHP5 constructor. + */ + function __construct($method, $args) { $this->method = $method; $this->args = $args; @@ -609,6 +653,13 @@ EOD; $this->xml .= ''; } + /** + * PHP4 constructor. + */ + public function IXR_Request( $method, $args ) { + self::__construct( $method, $args ); + } + function getLength() { return strlen($this->xml); @@ -642,7 +693,10 @@ class IXR_Client // Storage place for an error message var $error = false; - function IXR_Client($server, $path = false, $port = 80, $timeout = 15) + /** + * PHP5 constructor. + */ + function __construct( $server, $path = false, $port = 80, $timeout = 15 ) { if (!$path) { // Assume we have been given a URL instead @@ -668,6 +722,13 @@ class IXR_Client $this->timeout = $timeout; } + /** + * PHP4 constructor. + */ + public function IXR_Client( $server, $path = false, $port = 80, $timeout = 15 ) { + self::__construct( $server, $path, $port, $timeout ); + } + function query() { $args = func_get_args(); @@ -787,12 +848,22 @@ class IXR_Error var $code; var $message; - function IXR_Error($code, $message) + /** + * PHP5 constructor. + */ + function __construct( $code, $message ) { $this->code = $code; $this->message = htmlspecialchars($message); } + /** + * PHP4 constructor. + */ + public function IXR_Error( $code, $message ) { + self::__construct( $code, $message ); + } + function getXml() { $xml = <<year = date('Y', $timestamp); @@ -891,11 +972,21 @@ class IXR_Base64 { var $data; - function IXR_Base64($data) + /** + * PHP5 constructor. + */ + function __construct( $data ) { $this->data = $data; } + /** + * PHP4 constructor. + */ + public function IXR_Base64( $data ) { + self::__construct( $data ); + } + function getXml() { return ''.base64_encode($this->data).''; @@ -913,7 +1004,10 @@ class IXR_IntrospectionServer extends IXR_Server var $signatures; var $help; - function IXR_IntrospectionServer() + /** + * PHP5 constructor. + */ + function __construct() { $this->setCallbacks(); $this->setCapabilities(); @@ -947,6 +1041,13 @@ class IXR_IntrospectionServer extends IXR_Server ); } + /** + * PHP4 constructor. + */ + public function IXR_IntrospectionServer() { + self::__construct(); + } + function addCallback($method, $callback, $args, $help) { $this->callbacks[$method] = $callback; @@ -1075,12 +1176,22 @@ class IXR_ClientMulticall extends IXR_Client { var $calls = array(); - function IXR_ClientMulticall($server, $path = false, $port = 80) + /** + * PHP5 constructor. + */ + function __construct( $server, $path = false, $port = 80 ) { parent::IXR_Client($server, $path, $port); $this->useragent = 'The Incutio XML-RPC PHP Library (multicall client)'; } + /** + * PHP4 constructor. + */ + public function IXR_ClientMulticall( $server, $path = false, $port = 80 ) { + self::__construct( $server, $path, $port ); + } + function addCall() { $args = func_get_args();