Exemple #1
0
 public function __construct(Player $p)
 {
     $cache = new Cache();
     $feed = sprintf(self::FeedUrl, $p->name);
     $xml = $cache->get(CacheType::AdventureLogCache, $feed);
     $domdoc = new DOMDocument();
     $domdoc->loadXML($xml);
     foreach ($domdoc->getElementsByTagName('item') as $item) {
         $be = new LogEntry();
         foreach ($item->childNodes as $childNode) {
             if ($childNode->nodeName == 'title') {
                 $be->title = $childNode->textContent;
             } else {
                 if ($childNode->nodeName == 'description') {
                     $be->description = $childNode->textContent;
                 } else {
                     if ($childNode->nodeName == 'pubDate') {
                         $be->date = $childNode->textContent;
                     }
                 }
             }
         }
         $this->history[] = $be;
     }
 }
 public function indexAction()
 {
     // Set cache control - in our case /data will refresh the cache
     Cache::$alwaysUseCache = true;
     $sm = $this->dataAction();
     $sm->setTerminal(false);
     return $sm;
 }