[ 新規 | 編集 | 差分 ] [ 検索 | 一覧 | FrontPage ] [ 履歴 (RSS) | 差分履歴 (RSS) ] [ ログイン ]
【PR】Amazon | SL-C3000 | SL-C1000(3/18発売!) | SL-C860 | SL-6000W | SL-6000L | SL-6000N

WalWiki/カスタマイズ/一覧RSS

編集

ページ一覧をRSSで提供します。

[index rss]

編集

グローバル変数追加

編集
my $IndexRss = 'IndexRss';                                 # yakty add [index rss]

%page_commandへの追加

編集
my %page_command = (
    $IndexPage => 'index',
    $SearchPage => 'searchform',
    $CreatePage => 'create',
    $RssPage => 'rss',
    $AdminChangePassword => 'adminchangepasswordform',
    $FrontPage => 'FrontPage',
    $IndexRss => 'indexrss',                                # yakty add [index rss]
);

%command_doへの追加

編集
my %command_do = (
    read => \&do_read,
    edit => \&do_edit,
    adminedit => \&do_adminedit,
    adminchangepasswordform => \&do_adminchangepasswordform,
    adminchangepassword => \&do_adminchangepassword,
    write => \&do_write,
    index => \&do_index,
    indexrss => \&do_indexrss,                              # yakty add [index rss]

do_indexrss()追加

編集
# yakty add [index rss] start
sub do_indexrss {
    my $rss = new Yuki::RSS(
        version => '1.0',
        encoding => $charset,
    );
    $rss->channel(
        title => $modifier_rss_title,
        link  => $modifier_rss_link,
        description => $modifier_rss_description,
    );

    my %month = (
        Jan => 1,   Feb => 2,   Mar => 3,   Apr => 4,
        May => 5,   Jun => 6,   Jul => 7,   Aug => 8,
        Sep => 9,   Oct => 10,  Nov => 11,  Dec => 12,
    );

    foreach my $page (sort keys %database){
        next if(not &is_editable($page));
        # yakty add [secret page] start
        # my $frozen = &is_frozen($page);
        # next if($frozen == $frozen_secret);
        # yakty add [secret page] end
        my $title = &escape($page);
        my $description = &escape(&get_subjectline($page, delimiter => ''));
        my $link = $modifier_rss_link . '?' . &encode($page);
        my $lastmodified =  &get_info($page, $info_LastModified);
        my $dc_date = '';

        if($lastmodified =~ /(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) +(\d+) +(\d+):(\d+):(\d+) +(\d+)/){
            my ($year,$month,$day,$hour,$second,$minute) =
                ($6,$month{$1},$2,$3,$4,$5);
            $month = "0$month" if(length($month) < 2);
            $day = "0$day" if(length($day) < 2);
            $hour = "0$hour" if(length($hour) < 2);
            $second = "0$second" if(length($second) < 2);
            $minute = "0$minute" if(length($minute) < 2);
            $dc_date = "${year}-${month}-${day}T${hour}:${second}:${minute}+09:00";
        }

        $rss->add_item(
            title => $title,
            link => $link,
            description => $description,
            dc_date => $dc_date,
        );
    }
    print <<"EOD";
Content-type: text/xml

@{[$rss->as_string]}
EOD
}
# yakty add [index rss] end

01887