Generic update pinging. Needs review.

git-svn-id: http://svn.automattic.com/wordpress/trunk@982 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2004-03-21 07:36:07 +00:00
parent 277179d9a4
commit a7cdf5c0d4
2 changed files with 44 additions and 3 deletions

View File

@ -161,14 +161,12 @@ switch($action) {
if((get_settings('use_geo_positions')) && ($post_latf != null) && ($post_lonf != null)) { if((get_settings('use_geo_positions')) && ($post_latf != null) && ($post_lonf != null)) {
pingGeoUrl($post_ID); pingGeoUrl($post_ID);
} }
pingWeblogs($blog_ID);
pingBlogs($blog_ID);
if ($post_pingback) { if ($post_pingback) {
pingback($content, $post_ID); pingback($content, $post_ID);
} }
apply_filters('action_publish_post', $post_ID); do_action('publish_post', $post_ID);
// Time for trackbacks // Time for trackbacks
$to_ping = $wpdb->get_var("SELECT to_ping FROM $tableposts WHERE ID = $post_ID"); $to_ping = $wpdb->get_var("SELECT to_ping FROM $tableposts WHERE ID = $post_ID");

View File

@ -561,6 +561,49 @@ function timer_stop($display=0,$precision=3) { //if called like timer_stop(1), w
return $timetotal; return $timetotal;
} }
function weblog_ping($server = '', $path = '') {
$f = new xmlrpcmsg('weblogUpdates.ping',
array(new xmlrpcval(get_settings('blog_name'), 'string'),
new xmlrpcval(get_settings('blog_url') ,'string')));
$c = new xmlrpc_client($path, $server, 80);
$r = $c->send($f);
if (!$r) { die("send failed"); }
if ($debug) {
print "<h3>Response Object Dump:</h3>\n";
print "<pre>\n";
print_r($r);
print "</pre>\n";
}
$v=@xmlrpc_decode($r->value());
if (!$r->faultCode()) {
$result['message'] = "<p class=\"rpcmsg\">";
$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";
}
print '<blockquote>' . $result['message'] . '</blockquote>';
}
function generic_ping($post_id = 0) {
$services = get_settings('ping_sites');
$services = preg_replace("|(\s)+|", '$1', $serivces); // Kill dupe lines
$services = explode("\n", trim($services));
foreach ($services as $service) {
$uri = parse_url($service);
weblog_ping($uri['host'], $uri['path']);
}
}
add_action('publish_post', 'generic_ping');
// pings Weblogs.com // pings Weblogs.com
function pingWeblogs($blog_ID = 1) { function pingWeblogs($blog_ID = 1) {