Archived
Wordpress++
This commit is contained in:
1 parent
b3ac616fe8
commit
6e249f4820
1175 files changed
+305248
-54197
No files matched your search
+68
-22
@@ -30,7 +30,7 @@
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @package IXR
|
||||
* @since 1.5
|
||||
* @since 1.5.0
|
||||
*
|
||||
* @copyright Incutio Ltd 2010 (http://www.incutio.com)
|
||||
* @version 1.7.4 7th September 2010
|
||||
@@ -43,7 +43,7 @@
|
||||
* IXR_Value
|
||||
*
|
||||
* @package IXR
|
||||
* @since 1.5
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class IXR_Value {
|
||||
var $data;
|
||||
@@ -151,7 +151,7 @@ class IXR_Value {
|
||||
/**
|
||||
* Checks whether or not the supplied array is a struct or not
|
||||
*
|
||||
* @param unknown_type $array
|
||||
* @param array $array
|
||||
* @return boolean
|
||||
*/
|
||||
function isStruct($array)
|
||||
@@ -171,7 +171,7 @@ class IXR_Value {
|
||||
* IXR_MESSAGE
|
||||
*
|
||||
* @package IXR
|
||||
* @since 1.5
|
||||
* @since 1.5.0
|
||||
*
|
||||
*/
|
||||
class IXR_Message
|
||||
@@ -203,11 +203,44 @@ class IXR_Message
|
||||
{
|
||||
// first remove the XML declaration
|
||||
// merged from WP #10698 - this method avoids the RAM usage of preg_replace on very large messages
|
||||
$header = preg_replace( '/<\?xml.*?\?'.'>/', '', substr($this->message, 0, 100), 1);
|
||||
$this->message = substr_replace($this->message, $header, 0, 100);
|
||||
if (trim($this->message) == '') {
|
||||
$header = preg_replace( '/<\?xml.*?\?'.'>/s', '', substr( $this->message, 0, 100 ), 1 );
|
||||
$this->message = trim( substr_replace( $this->message, $header, 0, 100 ) );
|
||||
if ( '' == $this->message ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Then remove the DOCTYPE
|
||||
$header = preg_replace( '/^<!DOCTYPE[^>]*+>/i', '', substr( $this->message, 0, 200 ), 1 );
|
||||
$this->message = trim( substr_replace( $this->message, $header, 0, 200 ) );
|
||||
if ( '' == $this->message ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check that the root tag is valid
|
||||
$root_tag = substr( $this->message, 0, strcspn( substr( $this->message, 0, 20 ), "> \t\r\n" ) );
|
||||
if ( '<!DOCTYPE' === strtoupper( $root_tag ) ) {
|
||||
return false;
|
||||
}
|
||||
if ( ! in_array( $root_tag, array( '<methodCall', '<methodResponse', '<fault' ) ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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, '<' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->_parser = xml_parser_create();
|
||||
// Set XML parser to take the case of tags in to account
|
||||
xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, false);
|
||||
@@ -332,7 +365,7 @@ class IXR_Message
|
||||
$this->_arraystructs[count($this->_arraystructs)-1][] = $value;
|
||||
}
|
||||
} else {
|
||||
// Just add as a paramater
|
||||
// Just add as a parameter
|
||||
$this->params[] = $value;
|
||||
}
|
||||
}
|
||||
@@ -344,7 +377,7 @@ class IXR_Message
|
||||
* IXR_Server
|
||||
*
|
||||
* @package IXR
|
||||
* @since 1.5
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class IXR_Server
|
||||
{
|
||||
@@ -369,7 +402,11 @@ class IXR_Server
|
||||
{
|
||||
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.');
|
||||
}
|
||||
|
||||
@@ -425,7 +462,7 @@ EOD;
|
||||
|
||||
// Perform the callback and send the response
|
||||
if (count($args) == 1) {
|
||||
// If only one paramater just send that instead of the whole array
|
||||
// If only one parameter just send that instead of the whole array
|
||||
$args = $args[0];
|
||||
}
|
||||
|
||||
@@ -466,11 +503,18 @@ EOD;
|
||||
|
||||
function output($xml)
|
||||
{
|
||||
$xml = '<?xml version="1.0"?>'."\n".$xml;
|
||||
$charset = function_exists('get_option') ? get_option('blog_charset') : '';
|
||||
if ($charset)
|
||||
$xml = '<?xml version="1.0" encoding="'.$charset.'"?>'."\n".$xml;
|
||||
else
|
||||
$xml = '<?xml version="1.0"?>'."\n".$xml;
|
||||
$length = strlen($xml);
|
||||
header('Connection: close');
|
||||
header('Content-Length: '.$length);
|
||||
header('Content-Type: text/xml');
|
||||
if ($charset)
|
||||
header('Content-Type: text/xml; charset='.$charset);
|
||||
else
|
||||
header('Content-Type: text/xml');
|
||||
header('Date: '.date('r'));
|
||||
echo $xml;
|
||||
exit;
|
||||
@@ -548,7 +592,7 @@ EOD;
|
||||
* IXR_Request
|
||||
*
|
||||
* @package IXR
|
||||
* @since 1.5
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class IXR_Request
|
||||
{
|
||||
@@ -591,7 +635,7 @@ EOD;
|
||||
* IXR_Client
|
||||
*
|
||||
* @package IXR
|
||||
* @since 1.5
|
||||
* @since 1.5.0
|
||||
*
|
||||
*/
|
||||
class IXR_Client
|
||||
@@ -622,6 +666,10 @@ class IXR_Client
|
||||
if (!$this->path) {
|
||||
$this->path = '/';
|
||||
}
|
||||
|
||||
if ( ! empty( $bits['query'] ) ) {
|
||||
$this->path .= '?' . $bits['query'];
|
||||
}
|
||||
} else {
|
||||
$this->server = $server;
|
||||
$this->path = $path;
|
||||
@@ -743,7 +791,7 @@ class IXR_Client
|
||||
* IXR_Error
|
||||
*
|
||||
* @package IXR
|
||||
* @since 1.5
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class IXR_Error
|
||||
{
|
||||
@@ -785,7 +833,7 @@ EOD;
|
||||
* IXR_Date
|
||||
*
|
||||
* @package IXR
|
||||
* @since 1.5
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class IXR_Date {
|
||||
var $year;
|
||||
@@ -848,7 +896,7 @@ class IXR_Date {
|
||||
* IXR_Base64
|
||||
*
|
||||
* @package IXR
|
||||
* @since 1.5
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class IXR_Base64
|
||||
{
|
||||
@@ -869,7 +917,7 @@ class IXR_Base64
|
||||
* IXR_IntrospectionServer
|
||||
*
|
||||
* @package IXR
|
||||
* @since 1.5
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class IXR_IntrospectionServer extends IXR_Server
|
||||
{
|
||||
@@ -1032,7 +1080,7 @@ class IXR_IntrospectionServer extends IXR_Server
|
||||
* IXR_ClientMulticall
|
||||
*
|
||||
* @package IXR
|
||||
* @since 1.5
|
||||
* @since 1.5.0
|
||||
*/
|
||||
class IXR_ClientMulticall extends IXR_Client
|
||||
{
|
||||
@@ -1061,5 +1109,3 @@ class IXR_ClientMulticall extends IXR_Client
|
||||
return parent::query('system.multicall', $this->calls);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user