2004-05-23 00:02:53 -04:00
|
|
|
<?php
|
2008-05-25 11:50:15 -04:00
|
|
|
/**
|
|
|
|
* XML-RPC protocol support for WordPress
|
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether this is a XMLRPC Request
|
|
|
|
*
|
|
|
|
* @var bool
|
|
|
|
*/
|
2006-01-13 14:19:09 -05:00
|
|
|
define('XMLRPC_REQUEST', true);
|
2010-10-26 10:37:50 -04:00
|
|
|
define('WP_SHOW_ADMIN_BAR' , false);
|
2006-01-13 14:19:09 -05:00
|
|
|
|
|
|
|
// Some browser-embedded clients send cookies. We don't want them.
|
|
|
|
$_COOKIE = array();
|
|
|
|
|
2007-09-03 19:32:58 -04:00
|
|
|
// A bug in PHP < 5.2.2 makes $HTTP_RAW_POST_DATA not set by default,
|
2007-05-10 23:21:06 -04: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 11:50:15 -04:00
|
|
|
// fix for mozBlog and other cases where '<?xml' isn't on the very first line
|
2006-01-30 16:19:44 -05:00
|
|
|
if ( isset($HTTP_RAW_POST_DATA) )
|
|
|
|
$HTTP_RAW_POST_DATA = trim($HTTP_RAW_POST_DATA);
|
2004-05-23 00:02:53 -04:00
|
|
|
|
2008-05-25 11:50:15 -04:00
|
|
|
/** Include the bootstrap for setting up WordPress environment */
|
2008-05-21 01:59:27 -04:00
|
|
|
include('./wp-load.php');
|
2005-11-07 04:47:51 -05:00
|
|
|
|
2007-09-03 19:32:58 -04:00
|
|
|
if ( isset( $_GET['rsd'] ) ) { // http://archipelago.phrasewise.com/rsd
|
2007-06-02 01:21:18 -04:00
|
|
|
header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
|
2005-11-07 04:47:51 -05:00
|
|
|
?>
|
2006-08-30 17:46:31 -04:00
|
|
|
<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
|
2005-11-07 04:47:51 -05: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-03 22:48:22 -04: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 04:47:51 -05:00
|
|
|
</apis>
|
|
|
|
</service>
|
|
|
|
</rsd>
|
|
|
|
<?php
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2007-05-25 03:16:21 -04:00
|
|
|
include_once(ABSPATH . 'wp-admin/includes/admin.php');
|
2004-09-17 16:53:18 -04:00
|
|
|
include_once(ABSPATH . WPINC . '/class-IXR.php');
|
2010-11-02 04:29:07 -04:00
|
|
|
include_once(ABSPATH . WPINC . '/class-wp-xmlrpc-server.php');
|
2004-05-23 00:02:53 -04:00
|
|
|
|
|
|
|
// Turn off all warnings and errors.
|
2004-09-17 16:53:18 -04:00
|
|
|
// error_reporting(0);
|
2004-05-23 00:02:53 -04:00
|
|
|
|
2008-05-25 11:50:15 -04: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 13:20:22 -04:00
|
|
|
$xmlrpc_logging = 0;
|
2004-05-23 00:02:53 -04:00
|
|
|
|
2008-05-25 11:50:15 -04: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 00:02:53 -04:00
|
|
|
function logIO($io,$msg) {
|
|
|
|
global $xmlrpc_logging;
|
|
|
|
if ($xmlrpc_logging) {
|
2004-09-17 16:53:18 -04:00
|
|
|
$fp = fopen("../xmlrpc.log","a+");
|
2004-05-23 00:02:53 -04: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 01:23:10 -04:00
|
|
|
if ( isset($HTTP_RAW_POST_DATA) )
|
2008-05-25 11:50:15 -04:00
|
|
|
logIO("I", $HTTP_RAW_POST_DATA);
|
|
|
|
|
2010-09-23 17:38:28 -04: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 15:15:43 -05:00
|
|
|
|
2010-09-23 17:38:28 -04:00
|
|
|
// Fire off the request
|
2009-08-08 04:38:20 -04:00
|
|
|
$wp_xmlrpc_server->serve_request();
|
2010-09-23 17:38:28 -04:00
|
|
|
?>
|