Updated sup

This commit is contained in:
Evan Prodromou 2009-01-23 00:36:24 +01:00
parent cc5808cc28
commit c0d7ce8a3c

View File

@ -21,10 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
class SupAction extends Action class SupAction extends Action
{ {
function handle($args) function handle($args)
{ {
parent::handle($args); parent::handle($args);
$seconds = $this->trimmed('seconds'); $seconds = $this->trimmed('seconds');
@ -33,18 +31,18 @@ class SupAction extends Action
$seconds = 15; $seconds = 15;
} }
$updates = $this->get_updates($seconds); $updates = $this->getUpdates($seconds);
header('Content-Type: application/json; charset=utf-8'); header('Content-Type: application/json; charset=utf-8');
print json_encode(array('updated_time' => date('c'), print json_encode(array('updated_time' => date('c'),
'since_time' => date('c', time() - $seconds), 'since_time' => date('c', time() - $seconds),
'available_periods' => $this->available_periods(), 'available_periods' => $this->availablePeriods(),
'period' => $seconds, 'period' => $seconds,
'updates' => $updates)); 'updates' => $updates));
} }
function available_periods() function availablePeriods()
{ {
static $periods = array(86400, 43200, 21600, 7200, static $periods = array(86400, 43200, 21600, 7200,
3600, 1800, 600, 300, 120, 3600, 1800, 600, 300, 120,
@ -58,7 +56,7 @@ class SupAction extends Action
return $available; return $available;
} }
function get_updates($seconds) function getUpdates($seconds)
{ {
$notice = new Notice(); $notice = new Notice();