channel->item ?: $feed->entry; $items = []; foreach ($feedItems as $item) { $items[] = $item->asXML(); } return $items; } protected function _mapItems($content) { $items = []; foreach ($content as $contentString) { $itemString = str_replace(['content:encoded>', '', '<', 'ID = strval($item->id ?: $item->guid) ?: ltrim(parse_url(strval($item->link))['path'], '/'); $itemObject->Title = strval($item->title); $itemObject->Time = strval($item->published ?: $item->pubDate ?: $item->updated); $itemObject->Text = strval($item->summary ?: $item->description ?: $item->content) ?: ($item->description ?: $item->content)->children()->asXML(); $itemObject->Link = strval(isset($item->link['href']) ? $item->link->attributes()['href'] : $item->link); $itemObject->Author = strval($item->creator ? $item->creator : (is_string($item->author) ? $item->author : $item->author->name)); $items[] = $itemObject; } return $items; } public function title() { $cacheFile = sprintf($this->_getCachePath() . '.title', $this->_feed); if (!file_exists($cacheFile)) { $this->_fetchItems(); } if ($this->_feedXml) { $title = strval($this->_feedXml->title ?: $this->_feedXml->channel->title); file_put_contents($cacheFile, $title); return $title; } else { return file_get_contents($cacheFile); } } } ?>