Finally: Services_Trackback 0.5.0 - Blog - Open Source - - php, photography and private stuff

Finally: Services_Trackback 0.5.0

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

$trackback->createSpamCheck(); $trackback->addSpamCheck(); $trackback->removeSpamCheck(); $trackback->checkSpam();

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

pear install --alldeps Services_Trackback-0.5.0#autodiscover

If you want to use DNSBL/SURBL spam check modules, you will have to install the neccessary features with

pear install --alldeps Services_Trackback-0.5.0#dnsbl

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.

Services_Trackback 0.5.0 features

  • Sending and receiving of trackbacks following the MT trackback specifications.

  • Generation of autodiscovery code for your websites (allowing weblog software to discover your trackback URI automatically).

  • Autodiscovering of trackback URIs (from URLs), supporting extended features like the following of HTTP redirects.

  • Generating valid trackback responses (success and failure reports).

  • Integrated spam checking using predefined and/or custom modules. Predefined modules are:

    • Wordlist: The wordlist filter checks elements of a trackback (configurable, by default title and excerpt) against a list of "bad words" (configurable, predefined one per default) and determines spam when a given number of hits (configurable, 1 per default) is reached. The comparison function is also configurable, by default a case-insensitive strpos() is used.

    • Regex: Give this spam check 1 or more Perl compatible regular expression(s) (PCRE) and it will check different elements (by default title, excerpt and blogname) against your regex list. The delimiters and modifier to use are configurable, a standard regex (containing the words from wordlist) is included by default.

    • DNSBL: This spam check utilizes Net_DNSBL to check the host which sent the trackback against 1 or more DNS black lists.

    • SURBL: SURBL (Spam URI realtime black list) is a fairly new technology of checking URL hosts from links inside trackbacks against a blacklist. The SURBL spam check extracts URLs from different elements of a trackback (by default title, excerpt and url) and checks them against 1 or more SURBL.

  • Configurable strictness regarding MT trackback specifications (e.g. URL match strictness).

  • Fully unit tested!


If you liked this blog post or learned something, please consider using flattr to contribute back: .



Add new comment

Fields with bold names are mandatory.