4 * |
4 * |
5 * @package WordPress |
5 * @package WordPress |
6 */ |
6 */ |
7 |
7 |
8 /** |
8 /** |
9 * Whether this is an XML-RPC Request |
9 * Whether this is an XML-RPC Request. |
10 * |
10 * |
11 * @var bool |
11 * @var bool |
12 */ |
12 */ |
13 define( 'XMLRPC_REQUEST', true ); |
13 define( 'XMLRPC_REQUEST', true ); |
14 |
14 |
15 // Some browser-embedded clients send cookies. We don't want them. |
15 // Discard unneeded cookies sent by some browser-embedded clients. |
16 $_COOKIE = array(); |
16 $_COOKIE = array(); |
17 |
17 |
18 // $HTTP_RAW_POST_DATA was deprecated in PHP 5.6 and removed in PHP 7.0. |
18 // $HTTP_RAW_POST_DATA was deprecated in PHP 5.6 and removed in PHP 7.0. |
19 // phpcs:disable PHPCompatibility.Variables.RemovedPredefinedGlobalVariables.http_raw_post_dataDeprecatedRemoved |
19 // phpcs:disable PHPCompatibility.Variables.RemovedPredefinedGlobalVariables.http_raw_post_dataDeprecatedRemoved |
20 if ( ! isset( $HTTP_RAW_POST_DATA ) ) { |
20 if ( ! isset( $HTTP_RAW_POST_DATA ) ) { |
28 // phpcs:enable |
28 // phpcs:enable |
29 |
29 |
30 /** Include the bootstrap for setting up WordPress environment */ |
30 /** Include the bootstrap for setting up WordPress environment */ |
31 require_once __DIR__ . '/wp-load.php'; |
31 require_once __DIR__ . '/wp-load.php'; |
32 |
32 |
33 if ( isset( $_GET['rsd'] ) ) { // http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html |
33 if ( isset( $_GET['rsd'] ) ) { // https://cyber.harvard.edu/blogs/gems/tech/rsd.html |
34 header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true ); |
34 header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true ); |
35 echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?' . '>'; |
35 echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?' . '>'; |
36 ?> |
36 ?> |
37 <rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd"> |
37 <rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd"> |
38 <service> |
38 <service> |
44 <api name="Movable Type" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" /> |
44 <api name="Movable Type" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" /> |
45 <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" /> |
45 <api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" /> |
46 <api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" /> |
46 <api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" /> |
47 <?php |
47 <?php |
48 /** |
48 /** |
49 * Add additional APIs to the Really Simple Discovery (RSD) endpoint. |
49 * Fires when adding APIs to the Really Simple Discovery (RSD) endpoint. |
50 * |
50 * |
51 * @link http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html |
51 * @link https://cyber.harvard.edu/blogs/gems/tech/rsd.html |
52 * |
52 * |
53 * @since 3.5.0 |
53 * @since 3.5.0 |
54 */ |
54 */ |
55 do_action( 'xmlrpc_rsd_apis' ); |
55 do_action( 'xmlrpc_rsd_apis' ); |
56 ?> |
56 ?> |
79 * @since 3.1.0 |
79 * @since 3.1.0 |
80 * |
80 * |
81 * @param string $class The name of the XML-RPC server class. |
81 * @param string $class The name of the XML-RPC server class. |
82 */ |
82 */ |
83 $wp_xmlrpc_server_class = apply_filters( 'wp_xmlrpc_server_class', 'wp_xmlrpc_server' ); |
83 $wp_xmlrpc_server_class = apply_filters( 'wp_xmlrpc_server_class', 'wp_xmlrpc_server' ); |
84 $wp_xmlrpc_server = new $wp_xmlrpc_server_class; |
84 $wp_xmlrpc_server = new $wp_xmlrpc_server_class(); |
85 |
85 |
86 // Fire off the request. |
86 // Fire off the request. |
87 $wp_xmlrpc_server->serve_request(); |
87 $wp_xmlrpc_server->serve_request(); |
88 |
88 |
89 exit; |
89 exit; |
90 |
90 |
91 /** |
91 /** |
92 * logIO() - Writes logging info to a file. |
92 * logIO() - Writes logging info to a file. |
93 * |
93 * |
|
94 * @since 1.2.0 |
94 * @deprecated 3.4.0 Use error_log() |
95 * @deprecated 3.4.0 Use error_log() |
95 * @see error_log() |
96 * @see error_log() |
96 * |
97 * |
97 * @param string $io Whether input or output |
98 * @global int|bool $xmlrpc_logging Whether to enable XML-RPC logging. |
|
99 * |
|
100 * @param string $io Whether input or output. |
98 * @param string $msg Information describing logging reason. |
101 * @param string $msg Information describing logging reason. |
99 */ |
102 */ |
100 function logIO( $io, $msg ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid |
103 function logIO( $io, $msg ) { |
101 _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); |
104 _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); |
102 if ( ! empty( $GLOBALS['xmlrpc_logging'] ) ) { |
105 if ( ! empty( $GLOBALS['xmlrpc_logging'] ) ) { |
103 error_log( $io . ' - ' . $msg ); |
106 error_log( $io . ' - ' . $msg ); |
104 } |
107 } |
105 } |
108 } |