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