From 3de41a8e3e8b51aec020eaf074f3ebd12076df61 Mon Sep 17 00:00:00 2001 From: michelvaldrighi Date: Thu, 16 Sep 2004 17:08:56 +0000 Subject: [PATCH] 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 --- wp-includes/functions.php | 39 +++++++++------------------------------ 1 file changed, 9 insertions(+), 30 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index f249ede4e..41a7b4774 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -488,40 +488,19 @@ function timer_stop($display = 0, $precision = 3) { //if called like timer_stop( } 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', - array(new xmlrpcval(get_settings('blogname'), 'string'), - new xmlrpcval(get_settings('home') ,'string'))); - $c = new xmlrpc_client($path, $server, 80); - $r = $c->send($f); + global $wp_version; + include_once (ABSPATH . WPINC . '/class-IXR.php'); - if ('0' != $r) { - if ($debug) { - echo "

Response Object Dump:

-
\n";
-			print_r($r);
-			echo "
\n"; - } + // using a timeout of 3 seconds should be enough to cover slow servers + $client = new IXR_Client($server, (($path == '') ? false : $path)); + $client->timeout = 3; + $client->useragent .= ' / WordPress '.$wp_version; - $v = @phpxmlrpc_decode($r->value()); - if (!$r->faultCode()) { - $result['message'] = "

"; - $result['message'] = $result['message'] . $v["message"] . "
\n"; - $result['message'] = $result['message'] . "

"; - } else { - $result['err'] = $r->faultCode(); - $result['message'] = "\n"; - } + // when set to true, this outputs debug messages by itself + $client->debug = false; + $client->query('weblogUpdates.ping', get_settings('blogname'), get_settings('home')); - if ($debug) print '
' . $result['message'] . '
'; - } } function generic_ping($post_id = 0) {