# A TBPings Filter plugin by Hirotaka Ogawa (http://as-is.net/blog/) # This is a simple example of Application-level Callback using MT3.1 # # Release 0.01 (Aug 20, 2004) # # This software is provided as-is. You may use it for commercial or # personal use. If you distribute it, please keep this notice intact. # # Copyright (c) 2004 Hirotaka Ogawa use strict; if (MT->can('add_plugin')) { require MT::Plugin; my $plugin = new MT::Plugin(); $plugin->name("TBPingfilter Plugin, v.0.01"); $plugin->description("Reject exploitative trackback pings (An example of Application-level Callback)"); $plugin->doc_link("http://as-is.net/blog/archives/000902.html"); MT->add_plugin($plugin); } MT->add_callback('TBPingThrottleFilter', 10, 'Reject exploitative trackback pings', sub { my ($eh, $app, $tb) = @_; ($app->get_header('Referer') or ($app->get_header('User-Agent') || '') =~ m!^Mozilla/!) ? 0 : 1; }); 1;