Ejemplo n.º 1
0
 /**
  * @return Feed
  */
 function parseMetadata()
 {
     $feed = new Feed();
     \phpQuery::newDocument($this->getText());
     $feed->setUrl($this->url);
     $feed->setTitle(pq('b.xcontrast_txt')->text());
     $feed->setAuthor(pq('a.xcontrast_txt:nth-child(5)')->text());
     $feed->setUpdatedDate(0);
     return $feed;
 }
Ejemplo n.º 2
0
    public static function init()
    {
        self::$generateFeedUrl = function ($id) {
            return 'example.com/invalid-url-function';
        };
    }
    /**
     * Returns the full feed URL for feed readers
     * 
     * @return string
     */
    public function getFeedUrl()
    {
        // PHP somehow doesn't accept self::$generateFeedUrl(...)
        $temp = self::$generateFeedUrl;
        return $temp($this->getId());
    }
    /**
     * Returns the currently available feed items.
     * Does not modify the database in any way.
     * 
     * @return Item[] The feed items
     */
    public function queryItems()
    {
        $parser = Parsers\ParserLoader::getParser($this->url);
        return $parser->parseItems();
    }
}
Feed::init();