function WriteGeneratorComment(FeedGenerator $gen, $indent) { $name = $gen->Name(); if ($version = $gen->Version()) { $name === '' or $name .= ' '; $name .= sprintf('%1.1f', $version); } $url = $gen->URL(); $url and $name .= " | {$url}"; return $this->Indent($indent) . "<!-- Generated by {$name} -->\n"; }
* Website: http://mybb.com * License: http://mybb.com/about/license * * $Id$ */ define("IN_MYBB", 1); define("IGNORE_CLEAN_VARS", "fid"); define("NO_ONLINE", 1); define('THIS_SCRIPT', 'syndication.php'); $templatelist = "postbit_attachments_attachment"; require_once "./global.php"; // Load global language phrases $lang->load("syndication"); // Load syndication class. require_once MYBB_ROOT . "inc/class_feedgeneration.php"; $feedgenerator = new FeedGenerator(); // Load the post parser require_once MYBB_ROOT . "inc/class_parser.php"; $parser = new postParser(); // Find out the thread limit. $thread_limit = intval($mybb->input['limit']); if ($thread_limit > 50) { $thread_limit = 50; } else { if (!$thread_limit || $thread_limit < 0) { $thread_limit = 20; } } // Syndicate a specific forum or all viewable? if (isset($mybb->input['fid'])) { $forumlist = $mybb->input['fid'];
<?php try { include 'FeedGenerator.php'; $feeds = new FeedGenerator(); $feeds->setGenerator(new RSSGenerator()); # or AtomGenerator $feeds->setAuthor('*****@*****.**'); $feeds->setTitle('Example Site'); $feeds->setChannelLink('http://example.com/rss/'); $feeds->setLink('http://example.com'); $feeds->setDescription('Description of channel'); $feeds->setID('http://example.com/rss/'); $feeds->addItem(new FeedItem('http://example.com/news/1', 'Example news', 'http://example.com/news/1', '<p>Description of news</p>')); $feeds->addItem(new FeedItem('http://example.com/news/2', 'Example news', 'http://example.com/news/2', '<p>Description of news</p>')); $feeds->display(); } catch (FeedGeneratorException $e) { echo 'Error: ' . $e->getMessage(); }
foreach ($filearray as $file) { if (preg_match('/\\.pspl$/', $file)) { $stat = stat($file); $pl = preg_replace("/{$d}\\//", '', $file); $o[$pl] = $stat[9]; } } } arsort($o); $latest = array_slice($o, 0, 10, true); $mydir = preg_replace('/(.*)\\/.*/', '$1/', $_SERVER['PHP_SELF']); $self = $prot . $_SERVER['HTTP_HOST'] . $mydir; //var_dump( $latest ); try { include 'feed/FeedGenerator.php'; $feeds = new FeedGenerator(); $feeds->setGenerator(new AtomGenerator()); $feeds->setAuthor('Jart'); $feeds->setTitle('New and Updated Jart Playlists'); $feeds->setChanneLink($self); $feeds->setLink($self); $feeds->setDescription('New and Updated Jart Playlists'); $feeds->setID($self); foreach ($latest as $playlist => $pldate) { $shortpl = preg_replace('/.pspl$/', '', $playlist); $name = preg_replace('/.*\\/(.*)/', '$1', $shortpl); $author = preg_replace('|([^/]*)/.*|', '$1', $playlist); $item = new FeedItem("{$self}?pl={$shortpl}", $name, "{$self}?pl={$shortpl}", "<a href=\"{$self}?pl={$shortpl}\">{$name}</a>", date3339($pldate)); $item->author = $author; $feeds->addItem($item); }