とりあえず作っといた。del.icio.usのロゴと並ぶとなぜかちょと嬉しい…。
package Plagger::Plugin::Widget::Extractor;
use strict;
use base qw( Plagger::Plugin );
use Encode;
use HTML::Entities;
use URI;
sub register {
my($self, $context) = @_;
$context->register_hook(
$self,
'publish.entry.fixup' => \&add,
);
}
sub add {
my($self, $context, $args) = @_;
$args->{entry}->add_widget($self);
}
sub html {
my($self, $entry) = @_;
my $uri = URI->new('http://extractor.47objects.com/url');
$uri->query_form(
url => $entry->permalink,
);
my $url = HTML::Entities::encode($uri->as_string);
return qq(<a href="$url"><img src="http://extractor.47objects.com/static/images/favicon.gif" alt="extract it!" style="border:0;vertical-align:middle" /></a>);
}
1;