friendica-addons/fortunate/fortunate.php

28 lines
763 B
PHP
Raw Normal View History

2011-09-25 04:56:03 -04:00
<?php
/**
* Name: Fortunate
* Description: Add a random fortune cookie at the bottom of every pages.
* Version: 1.0
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
*/
function fortunate_install() {
register_hook('page_end', 'addon/fortunate/fortunate.php', 'fortunate_fetch');
}
function fortunate_uninstall() {
unregister_hook('page_end', 'addon/fortunate/fortunate.php', 'fortunate_fetch');
}
2012-01-11 20:36:20 -05:00
function fortunate_fetch(&$a,&$b) {
2011-09-25 04:56:03 -04:00
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'
. $a->get_baseurl() . '/addon/fortunate/fortunate.css' . '" media="all" />' . "\r\n";
$s = fetch_url('http://fortunemod.com/cookie.php?numlines=2&equal=1&rand=' . mt_rand());
$b .= '<div class="fortunate">' . $s . '</div>';
}