$apicall = "user.validate"; $output = notify_go('ping.fm', $apicall, $postdata, NULL); if (preg_match('/<rsp status="OK">/', $output)) { // Okay, app key validated, now we can continue $postdata = array('api_key' => $apikey, 'user_app_key' => $appkey, 'post_method' => 'status', 'body' => $message); $apicall = "user.post"; $output = notify_go('ping.fm', $apicall, $postdata, NULL); $success = preg_match('/<rsp status="OK">/', $output); return $success; } } /** * Twitter notification function */ function notify_twitter($post, $dbdata) { // Message to be sent $message = $post['title'] . " ~ " . $post['link']; // Put username and password into an array for easier passing $ident = array("user" => $dbdata->username, "pass" => $dbdata->password); // Choose update format (update.xml or update.json) $type = "statuses/update.xml"; $success = notify_go('twitter', $type, $message, $ident); return $success; } add_action('admin_menu', array('NotifyAdmin', 'addNotifyMenu')); if ($wp_notify == 1) { add_action('publish_post', 'prep_notify'); } NotifyAdmin::install();
function request_check() { $notify = new NotifyAdmin(); if (isset($_GET['page']) && isset($_POST['action']) && $_GET['page'] == basename(__FILE__)) { if ('add' == $_POST['action']) { $notify->add($_REQUEST); } elseif ('delete' == $_POST['action']) { $notify->burninate($_REQUEST['id']); } elseif ('toggle' == $_POST['action']) { $notify->toggle(); } elseif ('install' == $_POST['action']) { $notify->install(); } } unset($notify); }