replaced old weblog_ping with new IXR-based weblog_ping

git-svn-id: http://svn.automattic.com/wordpress/trunk@1674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
michelvaldrighi 2004-09-16 17:08:56 +00:00
parent e7d60415cf
commit 3de41a8e3e
1 changed files with 9 additions and 30 deletions

View File

@ -488,40 +488,19 @@ function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(
} }
function weblog_ping($server = '', $path = '') { function weblog_ping($server = '', $path = '') {
$debug = false;
include_once (ABSPATH . WPINC . '/class-xmlrpc.php');
include_once (ABSPATH . WPINC . '/class-xmlrpcs.php');
$f = new xmlrpcmsg('weblogUpdates.ping', global $wp_version;
array(new xmlrpcval(get_settings('blogname'), 'string'), include_once (ABSPATH . WPINC . '/class-IXR.php');
new xmlrpcval(get_settings('home') ,'string')));
$c = new xmlrpc_client($path, $server, 80);
$r = $c->send($f);
if ('0' != $r) { // using a timeout of 3 seconds should be enough to cover slow servers
if ($debug) { $client = new IXR_Client($server, (($path == '') ? false : $path));
echo "<h3>Response Object Dump:</h3> $client->timeout = 3;
<pre>\n"; $client->useragent .= ' / WordPress '.$wp_version;
print_r($r);
echo "</pre>\n";
}
$v = @phpxmlrpc_decode($r->value()); // when set to true, this outputs debug messages by itself
if (!$r->faultCode()) { $client->debug = false;
$result['message'] = "<p class=\"rpcmsg\">"; $client->query('weblogUpdates.ping', get_settings('blogname'), get_settings('home'));
$result['message'] = $result['message'] . $v["message"] . "<br />\n";
$result['message'] = $result['message'] . "</p>";
} else {
$result['err'] = $r->faultCode();
$result['message'] = "<!--\n";
$result['message'] = $result['message'] . "Fault: ";
$result['message'] = $result['message'] . "Code: " . $r->faultCode();
$result['message'] = $result['message'] . " Reason '" .$r->faultString()."'<BR>";
$result['message'] = $result['message'] . "-->\n";
}
if ($debug) print '<blockquote>' . $result['message'] . '</blockquote>';
}
} }
function generic_ping($post_id = 0) { function generic_ping($post_id = 0) {