mirror of
https://github.com/YunoHost-Apps/hubzilla_ynh.git
synced 2024-09-03 19:26:21 +02:00
44 lines
No EOL
1 KiB
PHP
44 lines
No EOL
1 KiB
PHP
<?php
|
|
/**
|
|
* Name: Fortunate
|
|
* Description: Add a random fortune cookie at the bottom of every pages. [Requires manual confguration.]
|
|
* Version: 1.0
|
|
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
|
* Maintainer: none
|
|
*/
|
|
|
|
|
|
function fortunate_load() {
|
|
register_hook('page_end', 'addon/fortunate/fortunate.php', 'fortunate_fetch');
|
|
|
|
}
|
|
|
|
function fortunate_unload() {
|
|
unregister_hook('page_end', 'addon/fortunate/fortunate.php', 'fortunate_fetch');
|
|
}
|
|
|
|
function fortunate_module(){}
|
|
|
|
|
|
function fortunate_fetch(&$a,&$b) {
|
|
|
|
$fort_server = get_config('fortunate','server');
|
|
if(! $fort_server)
|
|
return;
|
|
|
|
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'
|
|
. $a->get_baseurl() . '/addon/fortunate/fortunate.css' . '" media="all" />' . "\r\n";
|
|
|
|
$s = z_fetch_url('http://' . $fort_server . '/cookie.php?numlines=4&equal=1&rand=' . mt_rand());
|
|
if($s['success'])
|
|
$b .= '<div class="fortunate">' . $s['body'] . '</div>';
|
|
|
|
}
|
|
|
|
function fortunate_content(&$a) {
|
|
|
|
// $o = '';
|
|
// fortunate_fetch($a,$o);
|
|
// return $o;
|
|
|
|
} |