4 * Description: Add a random fortune cookie at the bottom of every pages. [Requires manual confguration.]
6 * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
9 // IMPORTANT: SET THIS to your fortunate server
11 define ('FORTUNATE_SERVER', 'hostname.com');
13 function fortunate_install() {
14 register_hook('page_end', 'addon/fortunate/fortunate.php', 'fortunate_fetch');
15 if(FORTUNATE_SERVER == 'hostname.com' && is_site_admin()) {
16 notice('Fortunate plugin requires configuration. See README');
20 function fortunate_uninstall() {
21 unregister_hook('page_end', 'addon/fortunate/fortunate.php', 'fortunate_fetch');
25 function fortunate_fetch(&$a,&$b) {
27 $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'
28 . $a->get_baseurl() . '/addon/fortunate/fortunate.css' . '" media="all" />' . "\r\n";
30 if(FORTUNATE_SERVER != 'hostname.com') {
31 $s = fetch_url('http://' . FORTUNATE_SERVER . '/cookie.php?numlines=2&equal=1&rand=' . mt_rand());
32 $b .= '<div class="fortunate">' . $s . '</div>';