1 <?php
2 /*
3 Plugin Name: Random Item
4 Plugin URI: http://guff.szub.net/random-item
5 Description: This simple plugin outputs from a text file random quotes, links, or whatever you decide.
6 Version: R1.1
7 Author: Kaf Oseo
8 Author URI: http://szub.net
9
10 Copyright (c) 2004, 2005 Kaf Oseo (http://szub.net)
11 Random Item is released under the GNU General Public License
12 (GPL) http://www.gnu.org/licenses/gpl.txt
13
14 This is a WordPress plugin (http://wordpress.org).
15 */
16
17 function random_item ($file = '', $before = '', $after = '') {
18
19 $random_file = "wp-quotes.txt";
20
21 if ($file) {
22 $random_file = $file;
23 }
24 $items = file("$random_file");
25 $item = rand(0, sizeof($items) - 1);
26 echo $before . wptexturize(trim($items[$item])) . $after;
27 }
28 ?>