author | ymh <ymh.work@gmail.com> |
Mon, 08 Sep 2025 19:44:41 +0200 | |
changeset 23 | 417f20492bf7 |
parent 22 | 8c2e4d02f4ef |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
3 |
* XML-RPC protocol support for WordPress |
|
4 |
* |
|
5 |
* @package WordPress |
|
6 |
*/ |
|
7 |
||
8 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
16
diff
changeset
|
9 |
* Whether this is an XML-RPC Request. |
0 | 10 |
* |
11 |
* @var bool |
|
12 |
*/ |
|
9 | 13 |
define( 'XMLRPC_REQUEST', true ); |
0 | 14 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
16
diff
changeset
|
15 |
// Discard unneeded cookies sent by some browser-embedded clients. |
0 | 16 |
$_COOKIE = array(); |
17 |
||
16 | 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 |
|
9 | 20 |
if ( ! isset( $HTTP_RAW_POST_DATA ) ) { |
0 | 21 |
$HTTP_RAW_POST_DATA = file_get_contents( 'php://input' ); |
22 |
} |
|
23 |
||
16 | 24 |
// Fix for mozBlog and other cases where '<?xml' isn't on the very first line. |
22
8c2e4d02f4ef
Update WordPress to latest version (6.7)
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
25 |
$HTTP_RAW_POST_DATA = trim( $HTTP_RAW_POST_DATA ); |
16 | 26 |
// phpcs:enable |
0 | 27 |
|
28 |
/** Include the bootstrap for setting up WordPress environment */ |
|
16 | 29 |
require_once __DIR__ . '/wp-load.php'; |
0 | 30 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
16
diff
changeset
|
31 |
if ( isset( $_GET['rsd'] ) ) { // https://cyber.harvard.edu/blogs/gems/tech/rsd.html |
9 | 32 |
header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true ); |
33 |
echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?' . '>'; |
|
34 |
?> |
|
0 | 35 |
<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd"> |
9 | 36 |
<service> |
37 |
<engineName>WordPress</engineName> |
|
38 |
<engineLink>https://wordpress.org/</engineLink> |
|
39 |
<homePageLink><?php bloginfo_rss( 'url' ); ?></homePageLink> |
|
40 |
<apis> |
|
41 |
<api name="WordPress" blogID="1" preferred="true" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" /> |
|
42 |
<api name="Movable Type" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" /> |
|
43 |
<api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" /> |
|
44 |
<api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" /> |
|
45 |
<?php |
|
46 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
16
diff
changeset
|
47 |
* Fires when adding APIs to the Really Simple Discovery (RSD) endpoint. |
9 | 48 |
* |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
16
diff
changeset
|
49 |
* @link https://cyber.harvard.edu/blogs/gems/tech/rsd.html |
9 | 50 |
* |
51 |
* @since 3.5.0 |
|
52 |
*/ |
|
53 |
do_action( 'xmlrpc_rsd_apis' ); |
|
54 |
?> |
|
55 |
</apis> |
|
56 |
</service> |
|
0 | 57 |
</rsd> |
9 | 58 |
<?php |
59 |
exit; |
|
0 | 60 |
} |
61 |
||
16 | 62 |
require_once ABSPATH . 'wp-admin/includes/admin.php'; |
63 |
require_once ABSPATH . WPINC . '/class-IXR.php'; |
|
64 |
require_once ABSPATH . WPINC . '/class-wp-xmlrpc-server.php'; |
|
0 | 65 |
|
66 |
/** |
|
67 |
* Posts submitted via the XML-RPC interface get that title |
|
9 | 68 |
* |
0 | 69 |
* @name post_default_title |
70 |
* @var string |
|
71 |
*/ |
|
9 | 72 |
$post_default_title = ''; |
0 | 73 |
|
74 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
75 |
* Filters the class used for handling XML-RPC requests. |
0 | 76 |
* |
77 |
* @since 3.1.0 |
|
5 | 78 |
* |
79 |
* @param string $class The name of the XML-RPC server class. |
|
0 | 80 |
*/ |
81 |
$wp_xmlrpc_server_class = apply_filters( 'wp_xmlrpc_server_class', 'wp_xmlrpc_server' ); |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
16
diff
changeset
|
82 |
$wp_xmlrpc_server = new $wp_xmlrpc_server_class(); |
0 | 83 |
|
16 | 84 |
// Fire off the request. |
0 | 85 |
$wp_xmlrpc_server->serve_request(); |
86 |
||
87 |
exit; |
|
88 |
||
89 |
/** |
|
90 |
* logIO() - Writes logging info to a file. |
|
91 |
* |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
16
diff
changeset
|
92 |
* @since 1.2.0 |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
93 |
* @deprecated 3.4.0 Use error_log() |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
94 |
* @see error_log() |
0 | 95 |
* |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
16
diff
changeset
|
96 |
* @global int|bool $xmlrpc_logging Whether to enable XML-RPC logging. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
16
diff
changeset
|
97 |
* |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
16
diff
changeset
|
98 |
* @param string $io Whether input or output. |
0 | 99 |
* @param string $msg Information describing logging reason. |
100 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
16
diff
changeset
|
101 |
function logIO( $io, $msg ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
102 |
_deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' ); |
9 | 103 |
if ( ! empty( $GLOBALS['xmlrpc_logging'] ) ) { |
0 | 104 |
error_log( $io . ' - ' . $msg ); |
9 | 105 |
} |
106 |
} |