<?php
class WinkDecoBridge extends FeedExpander {

	const MAINTAINER = 'Yan';
	const NAME = 'Wink Deco Bridge';
	const URI = 'http://winkdeco.fr/';
	const DESCRIPTION = 'Returns the newest articles.';

	protected function parseItem($item){
		$item = parent::parseItem($item);

		$article_html = getSimpleHTMLDOMCached($item['uri']);
		if(!$article_html) {
			$item['content'] = 'Could not request Wink Deco : ' . $item['uri'];
			return $item;
		}

		$article_content = '';

		$article_content .= str_replace(
			'src="/', 'src="' . self::URI,
			$article_html->find('div#wtr-content', 0)->innertext
		);
		
		$article_content = stripWithDelimiters($article_content, '<script', '</script>');


		$item['content'] = $article_content;

		return $item;
	}

	public function collectData(){
		$feedUrl = self::URI . '/feed/';
		$this->collectExpandableDatas($feedUrl);
	}
}
