* * Blog-like Atom & RSS feeds * * Developed and tested using PmWiki 2.2.x * * To install, add the following to your configuration file: include_once("$FarmD/cookbook/bloge-feeds.php"); * Usage: http://example.com/?action=[atom|rss]&[trail|group|link|name]= * * This is a part of the Bloge bundle of recipes, but may be used by itself. * For more information, please see the online documentation at * http://www.pmwiki.org/wiki/Cookbook/Bloge-Feeds and at * http://www.pmwiki.org/wiki/Cookbook/Bloge * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ $RecipeInfo['Bloge-Feeds']['Version'] = '2009-08-11'; $FmtPV['$CreateISOTime'] = 'gmstrftime($GLOBALS["TimeISOZFmt"], @$page["ctime"])'; $FmtPV['$UpdatedISOTime'] = 'gmstrftime($GLOBALS["TimeISOZFmt"], max(@$page["ctime"], $page["time"]))'; $FmtPV['$UpdatedRSSTime'] = 'gmdate($GLOBALS["RSSTimeFmt"], max(@$page["ctime"], $page["time"]))'; function BlogeFeedItemText($pagename, &$page, $tag) { global $BlogeFeedJump; $fullpage = RetrieveAuthPage($pagename, 'read', FALSE, READPAGE_CURRENT); if (!$fullpage) return ''; $text = $fullpage['text']; SDV($BlogeFeedJump, 'jump'); if (!empty($BlogeFeedJump)) $text = preg_replace( "/\n[^\n]*\\[\\[#$BlogeFeedJump\\]\\].*$/s", "\n\n[[{\$FullName}|$[Continue reading]...]]", $text, 1); $content = trim(preg_replace( array( "! class='(?:vspace|urllink|)'!", "!\n\n?!", "!\b((?:href|src)=['\"])/!" ), array( '', "\n", "$1http://{$_SERVER['SERVER_NAME']}/" ), MarkupToHTML($pagename, $text) )); return ($tag=='content') ? "\n" : "<$tag>\n"; } SDVA($FeedFmt['atom']['feed'], array( 'subtitle' => '{$Description}', 'link' => "\n", 'id' => '{$PageUrl}', 'logo' => '')); SDVA($FeedFmt['atom']['item'], array( 'published' => '{$CreateISOTime}', 'updated' => '{$UpdatedISOTime}', 'content' => 'BlogeFeedItemText')); SDVA($FeedFmt['rss']['feed'], array( '_start' => " \n", 'title' => '$WikiTitle', 'link' => '{$PageUrl}', 'atom:link' => "\n", 'description' => '{$Description}')); SDVA($FeedFmt['rss']['item'], array( 'guid' => '{$PageUrl}', 'title' => '{$Title}', 'link' => '{$PageUrl}', 'description' => 'BlogeFeedItemText', 'dc:date' => '{$UpdatedISOTime}', 'pubDate' => '{$UpdatedRSSTime}')); include_once("$FarmD/scripts/feeds.php");