advogato. You have to edit this file to set your advogato cookie. Author: Andy Wingo Author URI: http://wingolog.org/ */ /* 1.3: Fixed a bug I don't know how it ever worked, added regex */ /* 1.2: Updated to work with wordpress 1.5. */ /* GPL. */ $advogato_user = "your-user"; $advogato_cookie = "your-cookie"; require_once (ABSPATH . WPINC . "/class-IXR.php"); function advogato_crosspost ($post_ID) { global $advogato_cookie; global $advogato_user; $postdata = get_postdata ($post_ID); $content = apply_filters ('the_content', $postdata['Content']); $content = preg_replace(',]+>([^<]+),', '$2', $content); $content .= "

#

"; $client = new IXR_Client ("http://advogato.org/XMLRPC"); $advo_entry = get_post_meta($post_ID, 'advogato_diary_entry', true); if ($advo_entry === '') { $client->query("diary.len", $advogato_user); $advo_entry = $client->getResponse(); if (!is_int($advo_entry)) die; echo $advo_entry; add_post_meta($post_ID, 'advogato_diary_entry', $advo_entry, true); } else { $advo_entry = (int)$advo_entry; } $client->query ("diary.set", $advogato_cookie, $advo_entry, $content); return $post_ID; } add_action ('publish_post', 'advogato_crosspost', 8); ?>