Changeset 829

Show
Ignore:
Timestamp:
05/26/06 15:34:10
Author:
miyagawa
Message:

Update Filter::FeedBurnerPermalink? to work with Atom 1.0 permalink (feedburner:origLink)
Fixes #261

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/Filter/FeedBurnerPermalink.pm

    r400 r829  
    1515    my($self, $context, $args) = @_; 
    1616 
     17    my $fbns = 'http://rssnamespace.org/feedburner/ext/1.0'; 
     18 
    1719    # RSS 1.0 & 2.0 
    18     if (my $orig_link = $args->{orig_entry}->{entry}->{'http://rssnamespace.org/feedburner/ext/1.0'}->{origLink}) { 
    19         $args->{entry}->permalink($orig_link); 
    20         $context->log(info => "Permalink rewritten to $orig_link"); 
     20    if ($args->{orig_entry}->isa('XML::Feed::Entry::RSS')) { 
     21        if (my $orig_link = $args->{orig_entry}->{entry}->{$fbns}->{origLink}) { 
     22            $args->{entry}->permalink($orig_link); 
     23            $context->log(info => "Permalink rewritten to $orig_link"); 
     24        } 
     25    } 
     26    # Atom 1.0 
     27    elsif ($args->{orig_entry}->isa('XML::Feed::Entry::Atom')) { 
     28        my $ns = XML::Atom::Namespace->new(feedburner => $fbns); 
     29        if (my $orig_link = $args->{orig_entry}->{entry}->get($ns, 'origLink')) { 
     30            $args->{entry}->permalink($orig_link); 
     31            $context->log(info => "Permalink rewritten to $orig_link"); 
     32        } 
    2133    } 
    2234}