2004-05-23 06:02:53 +02:00
|
|
|
<?php
|
2008-05-25 17:50:15 +02:00
|
|
|
/**
|
|
|
|
* XML-RPC protocol support for WordPress
|
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether this is a XMLRPC Request
|
|
|
|
*
|
|
|
|
* @var bool
|
|
|
|
*/
|
2006-01-13 20:19:09 +01:00
|
|
|
define('XMLRPC_REQUEST', true);
|
2010-10-26 16:37:50 +02:00
|
|
|
define('WP_SHOW_ADMIN_BAR' , false);
|
2006-01-13 20:19:09 +01:00
|
|
|
|
|
|
|
// Some browser-embedded clients send cookies. We don't want them.
|
|
|
|
$_COOKIE = array();
|
|
|
|
|
2007-09-04 01:32:58 +02:00
|
|
|
// A bug in PHP < 5.2.2 makes $HTTP_RAW_POST_DATA not set by default,
|
2007-05-11 05:21:06 +02:00
|
|
|
// but we can do it ourself.
|
|
|
|
if ( !isset( $HTTP_RAW_POST_DATA ) ) {
|
|
|
|
$HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );
|
|
|
|
}
|
|
|
|
|
2008-05-25 17:50:15 +02:00
|
|
|
// fix for mozBlog and other cases where '<?xml' isn't on the very first line
|
2006-01-30 22:19:44 +01:00
|
|
|
if ( isset($HTTP_RAW_POST_DATA) )
|
|
|
|
$HTTP_RAW_POST_DATA = trim($HTTP_RAW_POST_DATA);
|
2004-05-23 06:02:53 +02:00
|
|
|
|
2008-05-25 17:50:15 +02:00
|
|
|
/** Include the bootstrap for setting up WordPress environment */
|
2008-05-21 07:59:27 +02:00
|
|
|
include('./wp-load.php');
|
2005-11-07 10:47:51 +01:00
|
|
|
|
2007-09-04 01:32:58 +02:00
|
|
|
if ( isset( $_GET['rsd'] ) ) { // http://archipelago.phrasewise.com/rsd
|
2007-06-02 07:21:18 +02:00
|
|
|
header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
|
2005-11-07 10:47:51 +01:00
|
|
|
?>
|
2006-08-30 23:46:31 +02:00
|
|
|
<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
|
2005-11-07 10:47:51 +01:00
|
|
|
<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
|
|
|
|
<service>
|
|
|
|
<engineName>WordPress</engineName>
|
|
|
|
<engineLink>http://wordpress.org/</engineLink>
|
|
|
|
<homePageLink><?php bloginfo_rss('url') ?></homePageLink>
|
|
|
|
<apis>
|
2009-07-04 04:48:22 +02:00
|
|
|
<api name="WordPress" blogID="1" preferred="true" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
|
|
|
|
<api name="Movable Type" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
|
|
|
|
<api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
|
|
|
|
<api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc') ?>" />
|
|
|
|
<api name="Atom" blogID="" preferred="false" apiLink="<?php echo apply_filters('atom_service_url', site_url('wp-app.php/service', 'rpc') ) ?>" />
|
2005-11-07 10:47:51 +01:00
|
|
|
</apis>
|
|
|
|
</service>
|
|
|
|
</rsd>
|
|
|
|
<?php
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2007-05-25 09:16:21 +02:00
|
|
|
include_once(ABSPATH . 'wp-admin/includes/admin.php');
|
2004-09-17 22:53:18 +02:00
|
|
|
include_once(ABSPATH . WPINC . '/class-IXR.php');
|
2010-11-02 09:29:07 +01:00
|
|
|
include_once(ABSPATH . WPINC . '/class-wp-xmlrpc-server.php');
|
2004-05-23 06:02:53 +02:00
|
|
|
|
|
|
|
// Turn off all warnings and errors.
|
2004-09-17 22:53:18 +02:00
|
|
|
// error_reporting(0);
|
2004-05-23 06:02:53 +02:00
|
|
|
|
2008-05-25 17:50:15 +02:00
|
|
|
/**
|
|
|
|
* Posts submitted via the xmlrpc interface get that title
|
|
|
|
* @name post_default_title
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
$post_default_title = "";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether to enable XMLRPC Logging.
|
|
|
|
*
|
|
|
|
* @name xmlrpc_logging
|
|
|
|
* @var int|bool
|
|
|
|
*/
|
2004-09-14 19:20:22 +02:00
|
|
|
$xmlrpc_logging = 0;
|
2004-05-23 06:02:53 +02:00
|
|
|
|
2008-05-25 17:50:15 +02:00
|
|
|
/**
|
|
|
|
* logIO() - Writes logging info to a file.
|
|
|
|
*
|
|
|
|
* @uses $xmlrpc_logging
|
|
|
|
* @package WordPress
|
|
|
|
* @subpackage Logging
|
|
|
|
*
|
|
|
|
* @param string $io Whether input or output
|
|
|
|
* @param string $msg Information describing logging reason.
|
|
|
|
* @return bool Always return true
|
|
|
|
*/
|
2004-05-23 06:02:53 +02:00
|
|
|
function logIO($io,$msg) {
|
|
|
|
global $xmlrpc_logging;
|
|
|
|
if ($xmlrpc_logging) {
|
2004-09-17 22:53:18 +02:00
|
|
|
$fp = fopen("../xmlrpc.log","a+");
|
2004-05-23 06:02:53 +02:00
|
|
|
$date = gmdate("Y-m-d H:i:s ");
|
|
|
|
$iot = ($io == "I") ? " Input: " : " Output: ";
|
|
|
|
fwrite($fp, "\n\n".$date.$iot.$msg);
|
|
|
|
fclose($fp);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2006-10-04 07:23:10 +02:00
|
|
|
if ( isset($HTTP_RAW_POST_DATA) )
|
2008-05-25 17:50:15 +02:00
|
|
|
logIO("I", $HTTP_RAW_POST_DATA);
|
|
|
|
|
2010-09-23 23:38:28 +02:00
|
|
|
// Allow for a plugin to insert a different class to handle requests.
|
|
|
|
$wp_xmlrpc_server_class = apply_filters('wp_xmlrpc_server_class', 'wp_xmlrpc_server');
|
|
|
|
$wp_xmlrpc_server = new $wp_xmlrpc_server_class;
|
2010-01-26 21:15:43 +01:00
|
|
|
|
2010-09-23 23:38:28 +02:00
|
|
|
// Fire off the request
|
2009-08-08 10:38:20 +02:00
|
|
|
$wp_xmlrpc_server->serve_request();
|
2010-09-23 23:38:28 +02:00
|
|
|
?>
|