Make WordPress Core

Changeset 982


Ignore:
Timestamp:
03/21/2004 07:36:07 AM (21 years ago)
Author:
saxmatt
Message:

Generic update pinging. Needs review.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/post.php

    r981 r982  
    162162                pingGeoUrl($post_ID);
    163163            }
    164             pingWeblogs($blog_ID);
    165             pingBlogs($blog_ID);
    166164
    167165            if ($post_pingback) {
     
    169167            }
    170168           
    171             apply_filters('action_publish_post', $post_ID);
     169            do_action('publish_post', $post_ID);
    172170
    173171            // Time for trackbacks
  • trunk/wp-includes/functions.php

    r965 r982  
    562562}
    563563
     564function weblog_ping($server = '', $path = '') {
     565  $f = new xmlrpcmsg('weblogUpdates.ping',
     566                array(new xmlrpcval(get_settings('blog_name'), 'string'),
     567                    new xmlrpcval(get_settings('blog_url') ,'string')));
     568  $c = new xmlrpc_client($path, $server, 80);
     569  $r = $c->send($f);
     570  if (!$r) { die("send failed"); }
     571
     572  if ($debug) {
     573    print "<h3>Response Object Dump:</h3>\n";
     574    print "<pre>\n";
     575    print_r($r);
     576    print "</pre>\n";
     577  }
     578
     579  $v=@xmlrpc_decode($r->value());
     580  if (!$r->faultCode()) {
     581    $result['message'] =  "<p class=\"rpcmsg\">";
     582    $result['message'] = $result['message'] .  $v["message"] . "<br />\n";
     583    $result['message'] = $result['message'] . "</p>";
     584  } else {
     585    $result['err'] = $r->faultCode();
     586    $result['message'] =  "<!--\n";
     587    $result['message'] = $result['message'] . "Fault: ";
     588    $result['message'] = $result['message'] . "Code: " . $r->faultCode();
     589    $result['message'] = $result['message'] . " Reason '" .$r->faultString()."'<BR>";
     590    $result['message'] = $result['message'] . "-->\n";
     591  }
     592
     593  print '<blockquote>' . $result['message'] . '</blockquote>';
     594}
     595
     596function generic_ping($post_id = 0) {
     597    $services = get_settings('ping_sites');
     598    $services = preg_replace("|(\s)+|", '$1', $serivces); // Kill dupe lines
     599    $services = explode("\n", trim($services));
     600    foreach ($services as $service) {
     601        $uri = parse_url($service);
     602        weblog_ping($uri['host'], $uri['path']);
     603    }
     604}
     605
     606add_action('publish_post', 'generic_ping');
    564607
    565608// pings Weblogs.com
Note: See TracChangeset for help on using the changeset viewer.