<? /** * This plugin can be used to insert a random line of text on your page. * * History: * v1.0: initial plugin * v1.1: support for multiple random files */ class NP_RandomFeed extends NucleusPlugin { /** * Plugin data to be shown on the plugin list */ function getName() { return 'RandomFeed'; } function getURL() { return 'http://www.xiffy.nl/weblog/'; } function getVersion() { return '0.91'; } function getDescription() { return 'Displays a random rssfeed from a text file by using <%RandomFeed(feeds.txt)%>. After that you can do a parsedinclude from $DIR_MEDIA/cache/randfeed.inc).'; } function doSkinVar($skinType) { global $manager, $blog, $CONF, $DIR_MEDIA; $params = func_get_args(); $filename = random.txt; // defaults to the file random.txt if ($params[1]){ $filename = $params[1]; $b =& $blog; } else if ($blog) $b =& $blog; else $b =& $manager->getBlog($CONF['DefaultBlog']); // randomize srand((double)microtime()*1000000); $lines = file("$filename") ; $feed = $lines[array_rand($lines)]; $feed = "<%Newsfeed(". trim($feed) .")%>"; $incfile = $DIR_MEDIA. "/cache/random.inc"; $writer = @fopen($incfile, "w"); if ($writer) { fwrite($writer, $feed); fclose($writer);%0 GPS } } } ?>
:: Plugins ::