diff --git a/bridges/OneFortuneADayBridge.php b/bridges/OneFortuneADayBridge.php index ed0b5ec6..31296041 100644 --- a/bridges/OneFortuneADayBridge.php +++ b/bridges/OneFortuneADayBridge.php @@ -35,25 +35,33 @@ class OneFortuneADayBridge extends BridgeAbstract { '23:00' => 23, ), 'defaultValue' => 5 + ), + 'lucky' => array( + 'name' => 'Lucky number (optional)', + 'type' => 'text' ) )); const LIMIT_ITEMS = 7; const DAY_SECS = 86400; + public function getDescription(){ + return self::DESCRIPTION . '
Set a lucky number to get your personal quotes, like ' . mt_rand(); + } + public function collectData() { $time = gmmktime((int)$this->getInput('time'), 0, 0); if ($time > time()) $time -= self::DAY_SECS; for ($i = self::LIMIT_ITEMS; $i > 0; --$i) { - $seed = date('Ymd', $time); + $seed = date('Ymd', $time) . $this->getInput('lucky'); $quote = $this->getQuote($seed); $item['title'] = strftime('%A, %x', $time); $item['content'] = htmlentities($quote, ENT_QUOTES, 'UTF-8'); $item['timestamp'] = $time; - $item['uri'] = 'urn:sha1:' . hash('sha1', $seed); + $item['uid'] = hash('sha1', $seed); $this->items[] = $item;