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
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2013-03-04 05:23:00 +01:00
|
|
|
* Whether this is an XML-RPC Request
|
2008-05-25 17:50:15 +02:00
|
|
|
*
|
|
|
|
* @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
|
|
|
|
2013-09-06 18:56:09 +02:00
|
|
|
if ( isset( $_GET['rsd'] ) ) { // http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html
|
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') ?>" />
|
2013-10-25 00:53:14 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2013-09-06 18:56:09 +02:00
|
|
|
* Add additional APIs to the Really Simple Discovery (RSD) endpoint.
|
|
|
|
*
|
|
|
|
* @see http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html
|
|
|
|
* @since 3.5.0
|
2013-10-25 00:53:14 +02:00
|
|
|
*/
|
|
|
|
do_action( 'xmlrpc_rsd_apis' );
|
2013-09-06 18:56:09 +02:00
|
|
|
?>
|
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
|
|
|
/**
|
2013-03-04 05:23:00 +01:00
|
|
|
* Posts submitted via the XML-RPC interface get that title
|
2008-05-25 17:50:15 +02:00
|
|
|
* @name post_default_title
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
$post_default_title = "";
|
|
|
|
|
2013-10-25 00:53:14 +02:00
|
|
|
/**
|
2013-09-06 18:56:09 +02:00
|
|
|
* Filter the class used for handling XML-RPC requests.
|
2013-10-25 00:53:14 +02:00
|
|
|
*
|
2013-09-06 18:56:09 +02:00
|
|
|
* @since 3.1.0
|
|
|
|
* @param string The name of the XML-RPC server class.
|
2013-10-25 00:53:14 +02:00
|
|
|
*/
|
2013-09-06 18:56:09 +02:00
|
|
|
$wp_xmlrpc_server_class = apply_filters( 'wp_xmlrpc_server_class', 'wp_xmlrpc_server' );
|
2012-02-17 01:02:42 +01:00
|
|
|
$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 );
|
|
|
|
}
|