function wfNotifyTwitterOnNAB($aid) { $t = Title::newfromID($aid); if (!$t) { // could have been deleted return true; } $r = Revision::newFromTitle($t); if (!$r) { return true; } $text = $r->getText(); if (MyTwitter::hasBadTemplate($text)) { return true; } // find new cats - like kittens! $newcats = array(); preg_match_all("@\\[\\[Category:[^\\]]*\\]\\]@", $text, $matches); $newcats = array(); if (sizeof($matches[0]) > 0) { $newcats = $matches[0]; } foreach ($newcats as $cat) { // make it a title object $cat = str_replace("[[Category:", "", $cat); $cat = str_replace("]]", "", $cat); $cat = Title::makeTitle(NS_CATEGORY, $cat); wfNotifyTwitter($cat, $t); } $cat = Title::MakeTitle(NS_CATEGORY, "New Article Boost"); wfNotifyTwitter($cat, $t); return true; }