wp/xmlrpc.php
author ymh <ymh.work@gmail.com>
Fri, 05 Sep 2025 18:40:08 +0200
changeset 21 48c4eec2b7e6
parent 16 a86126ab1dd4
child 22 8c2e4d02f4ef
permissions -rw-r--r--
Add CLAUDE.md documentation and sync WordPress core files - Add comprehensive CLAUDE.md documentation file with project architecture, development setup, database operations, WordPress CLI usage, file sync procedures, and Mercurial commands - Update WordPress core files from wordpress/ to wp/ directory - Sync latest WordPress admin interface, includes, and core functionality - Update plugins: portfolio plugin with latest BWS framework and fancybox integration - Maintain custom configuration and theme files 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
 * XML-RPC protocol support for WordPress
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
 * @package WordPress
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     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
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
 * @var bool
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
 */
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    13
define( 'XMLRPC_REQUEST', true );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    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
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
$_COOKIE = array();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    18
// $HTTP_RAW_POST_DATA was deprecated in PHP 5.6 and removed in PHP 7.0.
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    19
// phpcs:disable PHPCompatibility.Variables.RemovedPredefinedGlobalVariables.http_raw_post_dataDeprecatedRemoved
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    20
if ( ! isset( $HTTP_RAW_POST_DATA ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
	$HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    24
// Fix for mozBlog and other cases where '<?xml' isn't on the very first line.
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    25
if ( isset( $HTTP_RAW_POST_DATA ) ) {
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    26
	$HTTP_RAW_POST_DATA = trim( $HTTP_RAW_POST_DATA );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    27
}
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    28
// phpcs:enable
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
/** Include the bootstrap for setting up WordPress environment */
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    31
require_once __DIR__ . '/wp-load.php';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    33
if ( isset( $_GET['rsd'] ) ) { // https://cyber.harvard.edu/blogs/gems/tech/rsd.html
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    34
	header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    35
	echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?' . '>';
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    36
	?>
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
<rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    38
	<service>
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    39
		<engineName>WordPress</engineName>
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    40
		<engineLink>https://wordpress.org/</engineLink>
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    41
		<homePageLink><?php bloginfo_rss( 'url' ); ?></homePageLink>
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    42
		<apis>
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    43
			<api name="WordPress" blogID="1" preferred="true" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" />
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    44
			<api name="Movable Type" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" />
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    45
			<api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" />
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    46
			<api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" />
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    47
			<?php
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    48
			/**
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    49
			 * Fires when adding APIs to the Really Simple Discovery (RSD) endpoint.
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    50
			 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    51
			 * @link https://cyber.harvard.edu/blogs/gems/tech/rsd.html
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    52
			 *
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    53
			 * @since 3.5.0
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    54
			 */
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    55
			do_action( 'xmlrpc_rsd_apis' );
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    56
			?>
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    57
		</apis>
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    58
	</service>
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
</rsd>
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    60
	<?php
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    61
	exit;
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    64
require_once ABSPATH . 'wp-admin/includes/admin.php';
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    65
require_once ABSPATH . WPINC . '/class-IXR.php';
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    66
require_once ABSPATH . WPINC . '/class-wp-xmlrpc-server.php';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
 * Posts submitted via the XML-RPC interface get that title
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    70
 *
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
 * @name post_default_title
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
 * @var string
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
 */
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
    74
$post_default_title = '';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
/**
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    77
 * Filters the class used for handling XML-RPC requests.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
 *
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
 * @since 3.1.0
5
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    80
 *
5e2f62d02dcd upgrade wordpress + plugins
ymh <ymh.work@gmail.com>
parents: 0
diff changeset
    81
 * @param string $class The name of the XML-RPC server class.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
$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
    84
$wp_xmlrpc_server       = new $wp_xmlrpc_server_class();
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    85
16
a86126ab1dd4 update enmi-conf
ymh <ymh.work@gmail.com>
parents: 9
diff changeset
    86
// Fire off the request.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    87
$wp_xmlrpc_server->serve_request();
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    89
exit;
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
/**
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
 * logIO() - Writes logging info to a file.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    94
 * @since 1.2.0
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    95
 * @deprecated 3.4.0 Use error_log()
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    96
 * @see error_log()
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
 *
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
    98
 * @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
    99
 *
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   100
 * @param string $io  Whether input or output.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   101
 * @param string $msg Information describing logging reason.
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   102
 */
21
48c4eec2b7e6 Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents: 16
diff changeset
   103
function logIO( $io, $msg ) {
7
cf61fcea0001 resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   104
	_deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' );
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   105
	if ( ! empty( $GLOBALS['xmlrpc_logging'] ) ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   106
		error_log( $io . ' - ' . $msg );
9
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   107
	}
177826044cd9 upgrade wordpress to 5.2.3
ymh <ymh.work@gmail.com>
parents: 7
diff changeset
   108
}