package MT::Plugin::AddTarget; use strict; use MT; use MT::Template::Context; use MT::Plugin; eval("use Storable;"); if (!$@ && MT->can('add_plugin')) { my $plugin = MT::Plugin->new; $plugin->name('Add Target'); $plugin->version('1.00'); $plugin->author_name('Hajime Fujimoto'); $plugin->author_link('http://www.h-fj.com/blog/'); $plugin->description('Add target to anchor element'); MT->add_plugin($plugin); } MT::Template::Context->add_global_filter(add_target => \&add_target); sub add_target { my ($text, $arg) = @_; if ($text =~ // && $text !~ //) { $text =~ s/// } $text; } 1;