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);
|
|
|
|
|
|
|
|
// 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') ?>" />
|
2011-04-17 09:48:34 +02:00
|
|
|
<api name="Atom" blogID="" preferred="false" apiLink="<?php echo 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
|
|
|
|
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 = "";
|
|
|
|
|
2012-02-17 01:02:42 +01: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;
|
|
|
|
|
|
|
|
// Fire off the request
|
|
|
|
$wp_xmlrpc_server->serve_request();
|
|
|
|
|
|
|
|
exit;
|
2004-05-23 06:02:53 +02:00
|
|
|
|
2008-05-25 17:50:15 +02:00
|
|
|
/**
|
|
|
|
* logIO() - Writes logging info to a file.
|
|
|
|
*
|
2012-02-17 01:02:42 +01:00
|
|
|
* @deprecated 3.4.0
|
|
|
|
* @deprecated Use error_log()
|
2008-05-25 17:50:15 +02:00
|
|
|
*
|
|
|
|
* @param string $io Whether input or output
|
|
|
|
* @param string $msg Information describing logging reason.
|
|
|
|
*/
|
2012-02-17 01:02:42 +01:00
|
|
|
function logIO( $io, $msg ) {
|
|
|
|
_deprecated_function( __FUNCTION__, '3.4', 'error_log()' );
|
|
|
|
if ( ! empty( $GLOBALS['xmlrpc_logging'] ) )
|
|
|
|
error_log( $io . ' - ' . $msg );
|
|
|
|
}
|