Make WordPress Core

Changeset 1674


Ignore:
Timestamp:
09/16/2004 05:08:56 PM (20 years ago)
Author:
michelvaldrighi
Message:

replaced old weblog_ping with new IXR-based weblog_ping

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r1664 r1674  
    489489
    490490function weblog_ping($server = '', $path = '') {
    491     $debug = false;
    492     include_once (ABSPATH . WPINC . '/class-xmlrpc.php');
    493     include_once (ABSPATH . WPINC . '/class-xmlrpcs.php');
    494 
    495     $f = new xmlrpcmsg('weblogUpdates.ping',
    496         array(new xmlrpcval(get_settings('blogname'), 'string'),
    497             new xmlrpcval(get_settings('home') ,'string')));
    498     $c = new xmlrpc_client($path, $server, 80);
    499     $r = $c->send($f);
    500 
    501     if ('0' != $r) {   
    502         if ($debug) {
    503             echo "<h3>Response Object Dump:</h3>
    504                 <pre>\n";
    505             print_r($r);
    506             echo "</pre>\n";
    507         }
    508 
    509         $v = @phpxmlrpc_decode($r->value());
    510         if (!$r->faultCode()) {
    511             $result['message'] =  "<p class=\"rpcmsg\">";
    512             $result['message'] = $result['message'] .  $v["message"] . "<br />\n";
    513             $result['message'] = $result['message'] . "</p>";
    514         } else {
    515             $result['err'] = $r->faultCode();
    516             $result['message'] =  "<!--\n";
    517             $result['message'] = $result['message'] . "Fault: ";
    518             $result['message'] = $result['message'] . "Code: " . $r->faultCode();
    519             $result['message'] = $result['message'] . " Reason '" .$r->faultString()."'<BR>";
    520             $result['message'] = $result['message'] . "-->\n";
    521         }
    522 
    523         if ($debug) print '<blockquote>' . $result['message'] . '</blockquote>';
    524     }
     491
     492    global $wp_version;
     493    include_once (ABSPATH . WPINC . '/class-IXR.php');
     494
     495    // using a timeout of 3 seconds should be enough to cover slow servers
     496    $client = new IXR_Client($server, (($path == '') ? false : $path));
     497    $client->timeout = 3;
     498    $client->useragent .= ' / WordPress '.$wp_version;
     499
     500    // when set to true, this outputs debug messages by itself
     501    $client->debug = false;
     502    $client->query('weblogUpdates.ping', get_settings('blogname'), get_settings('home'));
     503
    525504}
    526505
Note: See TracChangeset for help on using the changeset viewer.