Beispiel #1
0
 /**
  * loads content for given source
  * I supress all Warnings of SimplePie for ensuring
  * working plugin in PHP Strict mode
  *
  * @return void
  * @param mixed $params the params of this source
  */
 public function load($params)
 {
     // initialize simplepie feed loader
     $this->feed = @new \SimplePie();
     @$this->feed->set_cache_location(\F3::get('cache'));
     @$this->feed->set_cache_duration(1800);
     @$this->feed->set_feed_url(htmlspecialchars_decode($params['url']));
     @$this->feed->set_autodiscovery_level(SIMPLEPIE_LOCATOR_AUTODISCOVERY | SIMPLEPIE_LOCATOR_LOCAL_EXTENSION | SIMPLEPIE_LOCATOR_LOCAL_BODY);
     $this->feed->set_useragent(\helpers\WebClient::getUserAgent(array('SimplePie/' . SIMPLEPIE_VERSION)));
     // fetch items
     @$this->feed->init();
     // on error retry with force_feed
     if (@$this->feed->error()) {
         @$this->feed->set_autodiscovery_level(SIMPLEPIE_LOCATOR_NONE);
         @$this->feed->force_feed(true);
         @$this->feed->init();
     }
     // check for error
     if (@$this->feed->error()) {
         throw new \exception($this->feed->error());
     } else {
         // save fetched items
         $this->items = @$this->feed->get_items();
     }
     // return html url
     $this->htmlUrl = @$this->feed->get_link();
 }