I finally managed to upload the next release of Services_Trackback (which is a generic class for sending and receiving trackbacks). The most important new feature for this version is integrated spam checking. Services_Trackback now implements a flexible API to add spam detection modules to a trackback using
Spam checks in Services_Trackback are simple classes which implement the API of Services_Trackback_SpamCheck (abstract class). This allows you to simply define custom spam checkings and use them in combination with predefined ones. The following example creates 3 (predefined) spam checks and runs them in the order Wordlist, SURBL, DNSBL (priority). If one spam check determies spam, the process stops and $trackback->checkSpam() returns true, else false is returned:
// Add SURBL spamcheck with a priority of 1 (0 is the highest)
$trackback->createSpamCheck('SURBL', array(), 1);
// Add Wordlist spamcheck with option minmatches set to 2 and priority 0 (default)
$trackback->createSpamCheck('Wordlist', array('minmatches' => 2));
// Manually create a DNSBL spamcheck and add it with priority 3
$dnsbl = Services_Trackback_SpamCheck::create('DNSBL');
$trackback->addSpamCheck($dnsbl, 3);
// Finally check for spam
if (true === $trackback->checkSpam()) {
// spam discovered
}
The following (built-in) spam checks are available so far:
Wordlist: Checks different elements of a trackback using a list of words (predefined "bad word" list from PEARWeb).
Regex: Checks different elements of a trackback against a list of PCREs.
DNSBL: Checks the host the trackback was sent from against 1 or more DNS blacklists.
SURBL: Extracts the links from different trackback elements and checks them against 1 or more SURBLs.
To install and try Services_Trackback simply do a
pear install Services_Trackback-0.5.0
The actual PEAR package is packaged with a package.xml and a package2.xml, which allows you to utilize the amazing new features of PEAR 1.4. If you installed the package using 1.4 you can install packages needed for autodiscovery features (automatically discover the trackback URI of a blog entry) by typing
I beg everyone out there for feedback regarding the package (especially the developers of well-known weblog applications like Serendipity), it's facilities and it's API. Please comment on this blog entry! My wish would be to have Services_Trackback adopted by those applications to generate a single point of development for the trackback feature (which would be a benefit for all user, of course).
For a complete list of features and a list of interessting links please refer to the extended version of this entry.