function Validate($trackback) { // Get the page $url = TextFilter::htmlDecode($trackback->_url); $page = $this->fetchPage($url); // Get the trackback client $tbClient = new TrackbackClient(); // get the trackback url $tbLinks = $tbClient->getTrackbackLinks($page, $url); if (empty($tbLinks)) { // there were no trackback links in the page // error_log( "Found no trackback urls" ); // Delete this trackback $trackbacks = new Trackbacks(); $trackbacks->deletePostTrackback($trackback->_id, $trackback->_articleId); //print("Error: trackback unavailable<br/>"); } }
function perform() { // we need to have the post $articles = new Articles(); $post = $articles->getBlogArticle($this->_postId, $this->_blogInfo->getId()); // now check the results and give the user the possiblity to retry again with the // ones that had some problem. $errors = false; // and now start sending the trackback pings $tbClient = new TrackbackClient(); $postLinks = array(); $trackbackLinks = array(); if (count($this->_postLinks) != 0) { $autoDiscoverResults = $tbClient->sendTrackbacks($this->_postLinks, $post, $this->_blogInfo); foreach ($autoDiscoverResults as $result) { if ($autoDiscoverResults["status"] == TRACKBACK_FAILED) { // add them again to the list of hosts $errors = true; array_push($postLinks, $result["url"]); } else { if ($result["status"] == TRACKBACK_SUCCESS) { if ($message == "") { $message = $this->_locale->tr("trackbacks_sent_ok") . "<br/><br/>"; } $message .= "<a href=\"" . $result["url"] . "\">" . $result["url"] . "</a><br/>"; } else { if ($result["status"] == TRACKBACK_UNAVAILABLE) { $message .= $this->_locale->tr("trackbacks_no_trackback") . "<a href=\"" . $result["url"] . "\">" . $result["url"] . "</a><br/>"; } } } } } if (count($this->_trackbackLinks) != 0) { $directPingResults = $tbClient->sendDirectTrackbacks($this->_trackbackLinks, $post, $this->_blogInfo); foreach ($directPingResults as $result) { if ($result["status"] == TRACKBACK_FAILED) { // add them again to the list of hosts $errors = true; array_push($trackbackLinks, $result["url"]); } else { if ($result["status"] == TRACKBACK_SUCCESS) { if ($message == "") { $message = $this->_locale->tr("trackbacks_sent_ok") . "<br/><br/>"; } $message .= "<a href=\"" . $result["url"] . "\">" . $result["url"] . "</a><br/>"; } } } } // if there were errors, we let the user try again if ($errors) { if ($message != "") { $message .= "<br/>"; } $message .= $this->_locale->tr("error_sending_trackbacks"); $this->_view = new AdminTemplatedView($this->_blogInfo, "sendtrackbacks"); $this->_view->setErrorMessage($message); $this->_view->setValue("post", $post); $this->_view->setValue("postLinks", $postLinks); $this->_view->setValue("trackbackLinks", $trackbackLinks); $this->setCommonData(); } else { $this->_view = new AdminPostsListView($this->_blogInfo); $this->_view->setSuccessMessage($message); $this->setCommonData(); } }