StripRecursiveHTMLSection($contents , 'div', $div_start);
- }
+ foreach (array(
+ '
stripRecursiveHTMLSection($contents , 'div', $div_start);
+ }
- $contents = $this->StripWithDelimiters($contents, '
');
- $contents = $this->StripWithDelimiters($contents, '
');
- $contents = $this->StripWithDelimiters($contents, 'fs:definition="', '"');
- $contents = $this->StripWithDelimiters($contents, 'fs:xt:clicktype="', '"');
- $contents = $this->StripWithDelimiters($contents, 'fs:xt:clickname="', '"');
- $contents = $this->StripWithDelimiters($contents, '');
- return $headline.trim($contents);
- }
+ return $headline . trim($contents);
+ }
- // Extracts the author from an article or element
- private function ExtractAuthor($article){
- $article_author = $article->find('h3.epsilon', 0);
- if($article_author){
- return trim(str_replace(', Futura-Sciences', '', $article_author->plaintext));
- }
- return '';
- }
+ // Extracts the author from an article or element
+ private function extractAuthor($article){
+ $article_author = $article->find('h3.epsilon', 0);
+ if($article_author){
+ return trim(str_replace(', Futura-Sciences', '', $article_author->plaintext));
+ }
+ return '';
+ }
}
diff --git a/bridges/GBAtempBridge.php b/bridges/GBAtempBridge.php
index cf0c8e0c..fc979aec 100644
--- a/bridges/GBAtempBridge.php
+++ b/bridges/GBAtempBridge.php
@@ -1,128 +1,157 @@
array(
- 'name'=>'Type',
- 'type'=>'list',
- 'required'=>true,
- 'values'=>array(
- 'News'=>'N',
- 'Reviews'=>'R',
- 'Tutorials'=>'T',
- 'Forum'=>'F'
- )
- )
- ));
+ const PARAMETERS = array( array(
+ 'type' => array(
+ 'name' => 'Type',
+ 'type' => 'list',
+ 'required' => true,
+ 'values' => array(
+ 'News' => 'N',
+ 'Reviews' => 'R',
+ 'Tutorials' => 'T',
+ 'Forum' => 'F'
+ )
+ )
+ ));
- private function ExtractFromDelimiters($string, $start, $end) {
- if (strpos($string, $start) !== false) {
- $section_retrieved = substr($string, strpos($string, $start) + strlen($start));
- $section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
- return $section_retrieved;
- } return false;
- }
+ private function extractFromDelimiters($string, $start, $end){
+ if(strpos($string, $start) !== false){
+ $section_retrieved = substr($string, strpos($string, $start) + strlen($start));
+ $section_retrieved = substr($section_retrieved, 0, strpos($section_retrieved, $end));
+ return $section_retrieved;
+ }
- private function StripWithDelimiters($string, $start, $end) {
- while (strpos($string, $start) !== false) {
- $section_to_remove = substr($string, strpos($string, $start));
- $section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
- $string = str_replace($section_to_remove, '', $string);
- } return $string;
- }
+ return false;
+ }
- private function build_item($uri, $title, $author, $timestamp, $content) {
- $item = array();
- $item['uri'] = $uri;
- $item['title'] = $title;
- $item['author'] = $author;
- $item['timestamp'] = $timestamp;
- $item['content'] = $content;
- return $item;
- }
+ private function stripWithDelimiters($string, $start, $end){
+ while(strpos($string, $start) !== false){
+ $section_to_remove = substr($string, strpos($string, $start));
+ $section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
+ $string = str_replace($section_to_remove, '', $string);
+ }
- private function cleanup_post_content($content, $site_url) {
- $content = str_replace(':arrow:', '➤', $content);
- $content = str_replace('href="attachments/', 'href="'.$site_url.'attachments/', $content);
- $content = $this->StripWithDelimiters($content, '');
+ return $content;
+ }
- public function collectData(){
+ private function fetchPostContent($uri, $site_url){
+ $html = getSimpleHTMLDOM($uri);
+ if(!$html){
+ return 'Could not request GBAtemp ' . $uri;
+ }
- $html = getSimpleHTMLDOM(self::URI)
- or returnServerError('Could not request GBAtemp.');
+ $content = $html->find('div.messageContent', 0)->innertext;
+ return $this->cleanupPostContent($content, $site_url);
+ }
- switch($this->getInput('type')){
- case 'N':
- foreach ($html->find('li[class=news_item full]') as $newsItem) {
- $url = self::URI.$newsItem->find('a', 0)->href;
- $time = intval($this->ExtractFromDelimiters($newsItem->find('abbr.DateTime', 0)->outertext, 'data-time="', '"'));
- $author = $newsItem->find('a.username', 0)->plaintext;
- $title = $newsItem->find('a', 1)->plaintext;
- $content = $this->fetch_post_content($url, self::URI);
- $this->items[] = $this->build_item($url, $title, $author, $time, $content);
- }
- case 'R':
- foreach ($html->find('li.portal_review') as $reviewItem) {
- $url = self::URI.$reviewItem->find('a', 0)->href;
- $title = $reviewItem->find('span.review_title', 0)->plaintext;
- $content = getSimpleHTMLDOM($url) or returnServerError('Could not request GBAtemp: '.$uri);
- $author = $content->find('a.username', 0)->plaintext;
- $time = intval($this->ExtractFromDelimiters($content->find('abbr.DateTime', 0)->outertext, 'data-time="', '"'));
- $intro = '
'.($content->find('div#review_intro', 0)->plaintext).'
';
- $review = $content->find('div#review_main', 0)->innertext;
- $subheader = '
'.$content->find('div.review_subheader', 0)->plaintext.'
';
- $procons = $content->find('table.review_procons', 0)->outertext;
- $scores = $content->find('table.reviewscores', 0)->outertext;
- $content = $this->cleanup_post_content($intro.$review.$subheader.$procons.$scores, self::URI);
- $this->items[] = $this->build_item($url, $title, $author, $time, $content);
- }
- case 'T':
- foreach ($html->find('li.portal-tutorial') as $tutorialItem) {
- $url = self::URI.$tutorialItem->find('a', 0)->href;
- $title = $tutorialItem->find('a', 0)->plaintext;
- $time = intval($this->ExtractFromDelimiters($tutorialItem->find('abbr.DateTime', 0)->outertext, 'data-time="', '"'));
- $author = $tutorialItem->find('a.username', 0)->plaintext;
- $content = $this->fetch_post_content($url, self::URI);
- $this->items[] = $this->build_item($url, $title, $author, $time, $content);
- }
- case 'F':
- foreach ($html->find('li.rc_item') as $postItem) {
- $url = self::URI.$postItem->find('a', 1)->href;
- $title = $postItem->find('a', 1)->plaintext;
- $time = intval($this->ExtractFromDelimiters($postItem->find('abbr.DateTime', 0)->outertext, 'data-time="', '"'));
- $author = $postItem->find('a.username', 0)->plaintext;
- $content = $this->fetch_post_content($url, self::URI);
- $this->items[] = $this->build_item($url, $title, $author, $time, $content);
- }
- }
- }
+ public function collectData(){
- public function getName() {
- if(!is_null($this->getInput('type'))){
- $type=array_search(
- $this->getInput('type'),
- self::PARAMETERS[$this->queriedContext]['type']['values']
- );
- return 'GBAtemp '.$type.' Bridge';
- }
+ $html = getSimpleHTMLDOM(self::URI)
+ or returnServerError('Could not request GBAtemp.');
- return parent::getName();
- }
+ switch($this->getInput('type')){
+ case 'N':
+ foreach($html->find('li[class=news_item full]') as $newsItem){
+ $url = self::URI . $newsItem->find('a', 0)->href;
+ $time = intval(
+ $this->extractFromDelimiters(
+ $newsItem->find('abbr.DateTime', 0)->outertext,
+ 'data-time="',
+ '"'
+ )
+ );
+ $author = $newsItem->find('a.username', 0)->plaintext;
+ $title = $newsItem->find('a', 1)->plaintext;
+ $content = $this->fetchPostContent($url, self::URI);
+ $this->items[] = $this->buildItem($url, $title, $author, $time, $content);
+ }
+ case 'R':
+ foreach($html->find('li.portal_review') as $reviewItem){
+ $url = self::URI . $reviewItem->find('a', 0)->href;
+ $title = $reviewItem->find('span.review_title', 0)->plaintext;
+ $content = getSimpleHTMLDOM($url)
+ or returnServerError('Could not request GBAtemp: ' . $uri);
+ $author = $content->find('a.username', 0)->plaintext;
+ $time = intval(
+ $this->extractFromDelimiters(
+ $content->find('abbr.DateTime', 0)->outertext,
+ 'data-time="',
+ '"'
+ )
+ );
+ $intro = '
' . ($content->find('div#review_intro', 0)->plaintext) . '
';
+ $review = $content->find('div#review_main', 0)->innertext;
+ $subheader = '
' . $content->find('div.review_subheader', 0)->plaintext . '
';
+ $procons = $content->find('table.review_procons', 0)->outertext;
+ $scores = $content->find('table.reviewscores', 0)->outertext;
+ $content = $this->cleanupPostContent($intro . $review . $subheader . $procons . $scores, self::URI);
+ $this->items[] = $this->buildItem($url, $title, $author, $time, $content);
+ }
+ case 'T':
+ foreach($html->find('li.portal-tutorial') as $tutorialItem){
+ $url = self::URI . $tutorialItem->find('a', 0)->href;
+ $title = $tutorialItem->find('a', 0)->plaintext;
+ $time = intval(
+ $this->extractFromDelimiters(
+ $tutorialItem->find('abbr.DateTime', 0)->outertext,
+ 'data-time="',
+ '"'
+ )
+ );
+ $author = $tutorialItem->find('a.username', 0)->plaintext;
+ $content = $this->fetchPostContent($url, self::URI);
+ $this->items[] = $this->buildItem($url, $title, $author, $time, $content);
+ }
+ case 'F':
+ foreach($html->find('li.rc_item') as $postItem){
+ $url = self::URI . $postItem->find('a', 1)->href;
+ $title = $postItem->find('a', 1)->plaintext;
+ $time = intval(
+ $this->extractFromDelimiters(
+ $postItem->find('abbr.DateTime', 0)->outertext,
+ 'data-time="',
+ '"'
+ )
+ );
+ $author = $postItem->find('a.username', 0)->plaintext;
+ $content = $this->fetchPostContent($url, self::URI);
+ $this->items[] = $this->buildItem($url, $title, $author, $time, $content);
+ }
+ }
+ }
+
+ public function getName() {
+ if(!is_null($this->getInput('type'))){
+ $type = array_search(
+ $this->getInput('type'),
+ self::PARAMETERS[$this->queriedContext]['type']['values']
+ );
+ return 'GBAtemp ' . $type . ' Bridge';
+ }
+
+ return parent::getName();
+ }
}
diff --git a/bridges/GelbooruBridge.php b/bridges/GelbooruBridge.php
index 25cd6a3a..fa4ce11a 100644
--- a/bridges/GelbooruBridge.php
+++ b/bridges/GelbooruBridge.php
@@ -1,21 +1,22 @@
getURI().'index.php?page=post&s=list&'
- .'&pid='.($this->getInput('p')?($this->getInput('p') -1)*static::PIDBYPAGE:'')
- .'&tags='.urlencode($this->getInput('t'));
- }
+ protected function getFullURI(){
+ return $this->getURI()
+ . 'index.php?page=post&s=list&pid='
+ . ($this->getInput('p') ? ($this->getInput('p') - 1) * static::PIDBYPAGE : '')
+ . '&tags=' . urlencode($this->getInput('t'));
+ }
}
diff --git a/bridges/GiphyBridge.php b/bridges/GiphyBridge.php
index 90f23a99..182d2a3f 100644
--- a/bridges/GiphyBridge.php
+++ b/bridges/GiphyBridge.php
@@ -1,71 +1,76 @@
array(
- 'name'=>'search tag',
- 'required'=>true
- ),
- 'n'=>array(
- 'name'=>'max number of returned items',
- 'type'=>'number'
- )
- ));
+ const PARAMETERS = array( array(
+ 's' => array(
+ 'name' => 'search tag',
+ 'required' => true
+ ),
+ 'n' => array(
+ 'name' => 'max number of returned items',
+ 'type' => 'number'
+ )
+ ));
public function collectData(){
$html = '';
- $base_url = 'http://giphy.com';
- $html = getSimpleHTMLDOM(self::URI.'/search/'.urlencode($this->getInput('s').'/'))
- or returnServerError('No results for this query.');
+ $base_url = 'http://giphy.com';
+ $html = getSimpleHTMLDOM(self::URI . '/search/' . urlencode($this->getInput('s') . '/'))
+ or returnServerError('No results for this query.');
- $max = GIPHY_LIMIT;
- if ($this->getInput('n')) {
- $max = $this->getInput('n');
- }
+ $max = GIPHY_LIMIT;
+ if($this->getInput('n')){
+ $max = $this->getInput('n');
+ }
- $limit = 0;
- $kw = urlencode($this->getInput('s'));
- foreach($html->find('div.hoverable-gif') as $entry) {
- if($limit < $max) {
- $node = $entry->first_child();
- $href = $node->getAttribute('href');
+ $limit = 0;
+ $kw = urlencode($this->getInput('s'));
+ foreach($html->find('div.hoverable-gif') as $entry){
+ if($limit < $max){
+ $node = $entry->first_child();
+ $href = $node->getAttribute('href');
- $html2 = getSimpleHTMLDOM(self::URI . $href)
- or returnServerError('No results for this query.');
- $figure = $html2->getElementByTagName('figure');
- $img = $figure->firstChild();
- $caption = $figure->lastChild();
+ $html2 = getSimpleHTMLDOM(self::URI . $href)
+ or returnServerError('No results for this query.');
+ $figure = $html2->getElementByTagName('figure');
+ $img = $figure->firstChild();
+ $caption = $figure->lastChild();
- $item = array();
- $item['id'] = $img->getAttribute('data-gif_id');
- $item['uri'] = $img->getAttribute('data-bitly_gif_url');
- $item['username'] = 'Giphy - '.ucfirst($kw);
- $title = $caption->innertext();
- $title = preg_replace('/\s+/', ' ',$title);
- $title = str_replace('animated GIF', '', $title);
- $title = str_replace($kw, '', $title);
- $title = preg_replace('/\s+/', ' ',$title);
- $title = trim($title);
- if (strlen($title) <= 0) {
- $title = $item['id'];
- }
- $item['title'] = trim($title);
- $item['content'] =
- '
'
- .''
- .'';
+ $item = array();
+ $item['id'] = $img->getAttribute('data-gif_id');
+ $item['uri'] = $img->getAttribute('data-bitly_gif_url');
+ $item['username'] = 'Giphy - ' . ucfirst($kw);
+ $title = $caption->innertext();
+ $title = preg_replace('/\s+/', ' ', $title);
+ $title = str_replace('animated GIF', '', $title);
+ $title = str_replace($kw, '', $title);
+ $title = preg_replace('/\s+/', ' ',$title);
+ $title = trim($title);
+ if(strlen($title) <= 0){
+ $title = $item['id'];
+ }
+ $item['title'] = trim($title);
+ $item['content'] = '
';
- $this->items[] = $item;
- $limit++;
- }
- }
+ $this->items[] = $item;
+ $limit++;
+ }
+ }
}
}
diff --git a/bridges/GithubIssueBridge.php b/bridges/GithubIssueBridge.php
index 58dfc37e..ba5b5e26 100644
--- a/bridges/GithubIssueBridge.php
+++ b/bridges/GithubIssueBridge.php
@@ -1,190 +1,187 @@
array (
- 'u'=>array(
- 'name'=>'User name',
- 'required'=>true
- ),
- 'p'=>array(
- 'name'=>'Project name',
- 'required'=>true
- )
- ),
+ const PARAMETERS = array(
+ 'global' => array(
+ 'u' => array(
+ 'name' => 'User name',
+ 'required' => true
+ ),
+ 'p' => array(
+ 'name' => 'Project name',
+ 'required' => true
+ )
+ ),
+ 'Project Issues' => array(
+ 'c' => array(
+ 'name' => 'Show Issues Comments',
+ 'type' => 'checkbox'
+ )
+ ),
+ 'Issue comments' => array(
+ 'i' => array(
+ 'name' => 'Issue number',
+ 'type' => 'number',
+ 'required' => 'true'
+ )
+ )
+ );
- 'Project Issues'=>array(
- 'c'=>array(
- 'name'=>'Show Issues Comments',
- 'type'=>'checkbox'
- )
- ),
- 'Issue comments'=>array(
- 'i'=>array(
- 'name'=>'Issue number',
- 'type'=>'number',
- 'required'=>'true'
- )
- )
- );
+ public function getName(){
+ $name = $this->getInput('u') . '/' . $this->getInput('p');
+ switch($this->queriedContext){
+ case 'Project Issues':
+ if($this->getInput('c')){
+ $prefix = static::NAME . 's comments for ';
+ } else {
+ $prefix = static::NAME . 's for ';
+ }
+ $name = $prefix . $name;
+ break;
+ case 'Issue comments':
+ $name = static::NAME . ' ' . $name . ' #' . $this->getInput('i');
+ break;
+ }
+ return $name;
+ }
- public function getName(){
- $name=$this->getInput('u').'/'.$this->getInput('p');
- switch($this->queriedContext){
- case 'Project Issues':
- if($this->getInput('c')){
- $prefix=static::NAME.'s comments for ';
- }else{
- $prefix=static::NAME.'s for ';
- }
- $name=$prefix.$name;
- break;
- case 'Issue comments':
- $name=static::NAME.' '.$name.' #'.$this->getInput('i');
- break;
- }
- return $name;
- }
+ public function getURI(){
+ $uri = static::URI . $this->getInput('u') . '/' . $this->getInput('p') . '/issues';
+ if($this->queriedContext === 'Issue comments'){
+ $uri .= '/' . $this->getInput('i');
+ } elseif($this->getInput('c')){
+ $uri .= '?q=is%3Aissue+sort%3Aupdated-desc';
+ }
+ return $uri;
+ }
- public function getURI(){
- $uri = static::URI.$this->getInput('u').'/'.$this->getInput('p').'/issues';
- if($this->queriedContext==='Issue comments'){
- $uri.='/'.$this->getInput('i');
- }else if($this->getInput('c')){
- $uri.='?q=is%3Aissue+sort%3Aupdated-desc';
- }
- return $uri;
- }
+ protected function extractIssueComment($issueNbr, $title, $comment){
+ $class = $comment->getAttribute('class');
+ $classes = explode(' ', $class);
+ $event = false;
+ if(in_array('discussion-item', $classes)){
+ $event = true;
+ }
- protected function extractIssueComment($issueNbr,$title,$comment){
- $class=$comment->getAttribute('class');
- $classes=explode(' ',$class);
- $event=false;
- if(in_array('discussion-item',$classes)){
- $event=true;
- }
+ $author = 'unknown';
+ if($comment->find('.author', 0)){
+ $author = $comment->find('.author', 0)->plaintext;
+ }
- $author='unknown';
- if($comment->find('.author',0)){
- $author=$comment->find('.author',0)->plaintext;
- }
+ $uri = static::URI . $this->getInput('u') . '/' . $this->getInput('p') . '/issues/' . $issueNbr;
- $uri=static::URI.$this->getInput('u').'/'.$this->getInput('p').'/issues/'
- .$issueNbr;
+ $comment = $comment->firstChild();
+ if(!$event){
+ $comment = $comment->nextSibling();
+ }
- $comment=$comment->firstChild();
- if(!$event){
- $comment=$comment->nextSibling();
- }
+ if($event){
+ $title .= ' / ' . substr($class, strpos($class, 'discussion-item-') + strlen('discussion-item-'));
+ if(!$comment->hasAttribute('id')){
+ $items = array();
+ $timestamp = strtotime($comment->find('relative-time', 0)->getAttribute('datetime'));
+ $content = $comment->innertext;
+ while($comment = $comment->nextSibling()){
+ $item = array();
+ $item['author'] = $author;
+ $item['title'] = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
+ $item['timestamp'] = $timestamp;
+ $item['content'] = $content . '
' . $comment->children(1)->innertext . '
';
+ $item['uri'] = $uri . '#' . $comment->children(1)->getAttribute('id');
+ $items[] = $item;
+ }
+ return $items;
+ }
+ $content = $comment->parent()->innertext;
+ } else {
+ $title .= ' / ' . trim($comment->firstChild()->plaintext);
+ $content = "
" . $comment->find('.comment-body', 0)->innertext . "
";
+ }
- if($event){
- $title.=' / '.substr($class,strpos($class,'discussion-item-')+strlen('discussion-item-'));
- if(!$comment->hasAttribute('id')){
- $items=array();
- $timestamp=strtotime($comment->find('relative-time',0)->getAttribute('datetime'));
- $content=$comment->innertext;
- while($comment=$comment->nextSibling()){
- $item=array();
- $item['author']=$author;
- $item['title']=html_entity_decode($title,ENT_QUOTES,'UTF-8');
- $item['timestamp']=$timestamp;
- $item['content']=$content.'
'.$comment->children(1)->innertext.'
';
- $item['uri']=$uri.'#'.$comment->children(1)->getAttribute('id');
- $items[]=$item;
- }
- return $items;
- }
- $content=$comment->parent()->innertext;
- }else{
- $title.=' / '.trim($comment->firstChild()->plaintext);
- $content="
".$comment->find('.comment-body',0)->innertext."
";
- }
+ $item = array();
+ $item['author'] = $author;
+ $item['uri'] = $uri . '#' . $comment->getAttribute('id');
+ $item['title'] = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
+ $item['timestamp'] = strtotime($comment->find('relative-time', 0)->getAttribute('datetime'));
+ $item['content'] = $content;
+ return $item;
+ }
- $item = array();
- $item['author']=$author;
- $item['uri']= $uri.'#'.$comment->getAttribute('id');
- $item['title']=html_entity_decode($title,ENT_QUOTES,'UTF-8');
- $item['timestamp']=strtotime($comment->find('relative-time',0)->getAttribute('datetime'));
- $item['content']=$content;
- return $item;
- }
+ protected function extractIssueComments($issue){
+ $items = array();
+ $title = $issue->find('.gh-header-title', 0)->plaintext;
+ $issueNbr = trim(substr($issue->find('.gh-header-number', 0)->plaintext, 1));
+ $comments = $issue->find('.js-discussion', 0);
+ foreach($comments->children() as $comment){
+ $classes = explode(' ', $comment->getAttribute('class'));
+ if(in_array('discussion-item', $classes)
+ || in_array('timeline-comment-wrapper', $classes)){
+ $item = $this->extractIssueComment($issueNbr, $title, $comment);
+ if(array_keys($item) !== range(0, count($item) - 1)){
+ $item = array($item);
+ }
+ $items = array_merge($items, $item);
+ }
+ }
+ return $items;
+ }
- protected function extractIssueComments($issue){
- $items=array();
- $title=$issue->find('.gh-header-title',0)->plaintext;
- $issueNbr=trim(substr($issue->find('.gh-header-number',0)->plaintext,1));
- $comments=$issue->find('.js-discussion',0);
- foreach($comments->children() as $comment){
- $classes=explode(' ',$comment->getAttribute('class'));
- if(in_array('discussion-item',$classes) ||
- in_array('timeline-comment-wrapper',$classes)
- ){
- $item=$this->extractIssueComment($issueNbr,$title,$comment);
- if(array_keys($item)!==range(0,count($item)-1)){
- $item=array($item);
- }
- $items=array_merge($items,$item);
- }
- }
- return $items;
- }
+ public function collectData(){
+ $html = getSimpleHTMLDOM($this->getURI())
+ or returnServerError('No results for Github Issue ' . $this->getURI());
- public function collectData(){
- $html = getSimpleHTMLDOM($this->getURI())
- or returnServerError('No results for Github Issue '.$this->getURI());
+ switch($this->queriedContext){
+ case 'Issue comments':
+ $this->items = $this->extractIssueComments($html);
+ break;
+ case 'Project Issues':
+ foreach($html->find('.js-active-navigation-container .js-navigation-item') as $issue){
+ $info = $issue->find('.opened-by', 0);
+ $issueNbr = substr(trim($info->plaintext), 1, strpos(trim($info->plaintext), ' '));
- switch($this->queriedContext){
- case 'Issue comments':
- $this->items=$this->extractIssueComments($html);
- break;
- case 'Project Issues':
- foreach($html->find('.js-active-navigation-container .js-navigation-item') as $issue){
- $info=$issue->find('.opened-by',0);
- $issueNbr=substr(trim($info->plaintext),1,strpos(trim($info->plaintext),' '));
+ $item = array();
+ $item['content'] = '';
- $item=array();
- $item['content']='';
+ if($this->getInput('c')){
+ $uri = static::URI . $this->getInput('u') . '/' . $this->getInput('p') . '/issues/' . $issueNbr;
+ $issue = getSimpleHTMLDOMCached($uri, static::CACHE_TIMEOUT);
+ if($issue){
+ $this->items = array_merge($this->items, $this->extractIssueComments($issue));
+ continue;
+ }
+ $item['content'] = 'Can not extract comments from ' . $uri;
+ }
- if($this->getInput('c')){
- $uri=static::URI.$this->getInput('u').'/'.$this->getInput('p').'/issues/'.$issueNbr;
- $issue=getSimpleHTMLDOMCached($uri,static::CACHE_TIMEOUT);
- if($issue){
- $this->items=array_merge($this->items,$this->extractIssueComments($issue));
- continue;
- }
- $item['content']='Can not extract comments from '.$uri;
- }
+ $item['author'] = $info->find('a', 0)->plaintext;
+ $item['timestamp'] = strtotime($info->find('relative-time', 0)->getAttribute('datetime'));
+ $item['title'] = html_entity_decode(
+ $issue->find('.js-navigation-open', 0)->plaintext,
+ ENT_QUOTES,
+ 'UTF-8'
+ );
+ $comments = $issue->find('.col-5', 0)->plaintext;
+ $item['content'] .= "\n" . 'Comments: ' . ($comments ? $comments : '0');
+ $item['uri'] = self::URI . $issue->find('.js-navigation-open', 0)->getAttribute('href');
+ $this->items[] = $item;
+ }
+ break;
+ }
- $item['author']=$info->find('a',0)->plaintext;
- $item['timestamp']=strtotime($info->find('relative-time',0)->getAttribute('datetime'));
- $item['title']=html_entity_decode(
- $issue->find('.js-navigation-open',0)->plaintext,
- ENT_QUOTES,
- 'UTF-8'
- );
- $comments=$issue->find('.col-5',0)->plaintext;
- $item['content'].="\n".'Comments: '.($comments?$comments:'0');
- $item['uri']=self::URI.$issue->find('.js-navigation-open',0)->getAttribute('href');
- $this->items[]=$item;
- }
- break;
- }
-
- array_walk($this->items, function(&$item){
- $item['content']=preg_replace('/\s+/',' ',$item['content']);
- $item['content']=str_replace('href="/','href="'.static::URI,$item['content']);
- $item['content']=str_replace(
- 'href="#',
- 'href="'.substr($item['uri'],0,strpos($item['uri'],'#')+1),
- $item['content']
- );
- $item['title']=preg_replace('/\s+/',' ',$item['title']);
- });
- }
+ array_walk($this->items, function(&$item){
+ $item['content'] = preg_replace('/\s+/', ' ', $item['content']);
+ $item['content'] = str_replace('href="/', 'href="' . static::URI, $item['content']);
+ $item['content'] = str_replace(
+ 'href="#',
+ 'href="' . substr($item['uri'], 0, strpos($item['uri'], '#') + 1),
+ $item['content']
+ );
+ $item['title'] = preg_replace('/\s+/', ' ', $item['title']);
+ });
+ }
}
diff --git a/bridges/GizmodoBridge.php b/bridges/GizmodoBridge.php
index bb99c668..c98f7550 100644
--- a/bridges/GizmodoBridge.php
+++ b/bridges/GizmodoBridge.php
@@ -1,22 +1,26 @@
find('div.entry-content', 0)->innertext;
- foreach($articleHTMLContent->find('pagespeed_iframe') as $element) {
- $text .= '
link to a iframe (could be a video): '.$element->src.'
';
+ foreach($articleHTMLContent->find('pagespeed_iframe') as $element){
+ $text .= '
link to a iframe (could be a video): '
+ . $element->src
+ . '
';
}
$text = strip_tags($text, '
');
diff --git a/bridges/GoComicsBridge.php b/bridges/GoComicsBridge.php
index 87c30df0..b9d6b2d8 100644
--- a/bridges/GoComicsBridge.php
+++ b/bridges/GoComicsBridge.php
@@ -1,51 +1,51 @@
array(
- 'name' => 'comicname',
- 'type' => 'text',
- 'required' => true
- )
- ));
+ const MAINTAINER = 'sky';
+ const NAME = 'GoComics Unofficial RSS';
+ const URI = 'http://www.gocomics.com/';
+ const CACHE_TIMEOUT = 21600; // 6h
+ const DESCRIPTION = 'The Unofficial GoComics RSS';
+ const PARAMETERS = array( array(
+ 'comicname' => array(
+ 'name' => 'comicname',
+ 'type' => 'text',
+ 'required' => true
+ )
+ ));
- public function collectData() {
- $html = getSimpleHTMLDOM($this->getURI()) or returnServerError('Could not request GoComics: '.$this->getURI());
+ public function collectData(){
+ $html = getSimpleHTMLDOM($this->getURI())
+ or returnServerError('Could not request GoComics: ' . $this->getURI());
- foreach ($html->find('div.item-comic-container') as $element) {
+ foreach($html->find('div.item-comic-container') as $element){
- $img = $element->find('img', 0);
- $link = $element->find('a.item-comic-link', 0);
- $comic = $img->src;
- $title = $link->title;
- $url = $html->find('input.js-copy-link', 0)->value;
- $date = substr($title, -10);
- if (empty($title))
- $title = 'GoComics '.$this->getInput('comicname').' on '.$date;
- $date = strtotime($date);
+ $img = $element->find('img', 0);
+ $link = $element->find('a.item-comic-link', 0);
+ $comic = $img->src;
+ $title = $link->title;
+ $url = $html->find('input.js-copy-link', 0)->value;
+ $date = substr($title, -10);
+ if (empty($title))
+ $title = 'GoComics ' . $this->getInput('comicname') . ' on ' . $date;
+ $date = strtotime($date);
- $item = array();
- $item['id'] = $url;
- $item['uri'] = $url;
- $item['title'] = $title;
- $item['author'] = preg_replace('/by /', '', $element->find('a.link-blended small', 0)->plaintext);
- $item['timestamp'] = $date;
- $item['content'] = '';
- $this->items[] = $item;
- }
- }
+ $item = array();
+ $item['id'] = $url;
+ $item['uri'] = $url;
+ $item['title'] = $title;
+ $item['author'] = preg_replace('/by /', '', $element->find('a.link-blended small', 0)->plaintext);
+ $item['timestamp'] = $date;
+ $item['content'] = '';
+ $this->items[] = $item;
+ }
+ }
- public function getURI() {
- return self::URI.urlencode($this->getInput('comicname'));
- }
+ public function getURI(){
+ return self::URI . urlencode($this->getInput('comicname'));
+ }
- public function getName() {
- return $this->getInput('comicname') .' - '.'GoComics';
- }
+ public function getName(){
+ return $this->getInput('comicname') . ' - GoComics';
+ }
}
-?>
diff --git a/bridges/GooglePlusPostBridge.php b/bridges/GooglePlusPostBridge.php
index 64cc5ef8..5d4680e1 100644
--- a/bridges/GooglePlusPostBridge.php
+++ b/bridges/GooglePlusPostBridge.php
@@ -1,39 +1,40 @@
array(
- 'name'=>'username or Id',
- 'required'=>true
- )
- ));
+ const PARAMETERS = array( array(
+ 'username' => array(
+ 'name' => 'username or Id',
+ 'required' => true
+ )
+ ));
- public function collectData()
- {
+ public function collectData(){
// get content parsed
$html = getSimpleHTMLDOMCached(self::URI . urlencode($this->getInput('username')) . '/posts'
// force language
- , 84600, false, stream_context_create(array('http'=> array(
- 'header' => 'Accept-Language: fr,fr-be,fr-fr;q=0.8,en;q=0.4,en-us;q=0.2;*' . "\r\n"
+ , 84600
+ , false
+ , stream_context_create(array(
+ 'http' => array(
+ 'header' => 'Accept-Language: fr,fr-be,fr-fr;q=0.8,en;q=0.4,en-us;q=0.2;*' . "\r\n"
)))
- ) OR returnServerError('No results for this query.');
+ ) or returnServerError('No results for this query.');
// get title, url, ... there is a lot of intresting stuff in meta
$this->_title = $html->find('meta[property]', 0)->getAttribute('content');
$this->_url = $html->find('meta[itemprop=url]', 0)->getAttribute('content');
// div[jsmodel=XNmfOc]
- foreach($html->find('div.yt') as $post)
- {
+ foreach($html->find('div.yt') as $post){
$item = array();
// $item['content'] = $post->find('div.Al', 0)->innertext;
$item['author'] = $item['fullname'] = $post->find('header.lea h3 a', 0)->innertext;
@@ -45,34 +46,39 @@ class GooglePlusPostBridge extends BridgeAbstract
// hashtag to treat : https://plus.google.com/explore/tag
$hashtags = array();
- foreach($post->find('a.d-s') as $hashtag)
- {
- $hashtags[ trim($hashtag->plaintext) ] = self::URI . $hashtag->href;
+ foreach($post->find('a.d-s') as $hashtag){
+ $hashtags[trim($hashtag->plaintext)] = self::URI . $hashtag->href;
}
$item['content'] = '';
// avatar display
- $item['content'] .= '';
+ $item['content'] .= '';
$content = $post->find('div.Al', 0);
- // XXX ugly but I don't have any idea how to do a better stuff, str_replace on link doesn't work as expected and ask too many checks
- foreach($content->find('a') as $link)
- {
+ // XXX ugly but I don't have any idea how to do a better stuff,
+ // str_replace on link doesn't work as expected and ask too many checks
+ foreach($content->find('a') as $link){
$hasHttp = strpos($link->href, 'http');
$hasDoubleSlash = strpos($link->href, '//');
- if ((!$hasHttp && !$hasDoubleSlash)
- || (false !== $hasHttp && strpos($link->href, 'http') != 0)
- || (false === $hasHttp && false !== $hasDoubleSlash && $hasDoubleSlash != 0))
- {
+ if((!$hasHttp && !$hasDoubleSlash)
+ || (false !== $hasHttp && strpos($link->href, 'http') != 0)
+ || (false === $hasHttp && false !== $hasDoubleSlash && $hasDoubleSlash != 0)){
// skipp bad link, for some hashtag or other stuff
- if (strpos($link->href, '/') == 0)
- {
+ if(strpos($link->href, '/') == 0){
$link->href = substr($link->href, 1);
}
+
$link->href = self::URI . $link->href;
}
}
@@ -86,13 +92,11 @@ class GooglePlusPostBridge extends BridgeAbstract
}
}
- public function getName()
- {
+ public function getName(){
return $this->_title ?: 'Google Plus Post Bridge';
}
- public function getURI()
- {
+ public function getURI(){
return $this->_url ?: self::URI;
}
}
diff --git a/bridges/GoogleSearchBridge.php b/bridges/GoogleSearchBridge.php
index 4e97210d..bd07f36d 100644
--- a/bridges/GoogleSearchBridge.php
+++ b/bridges/GoogleSearchBridge.php
@@ -9,11 +9,11 @@
*/
class GoogleSearchBridge extends BridgeAbstract {
- const MAINTAINER = "sebsauvage";
- const NAME = "Google search";
- const URI = "https://www.google.com/";
+ const MAINTAINER = 'sebsauvage';
+ const NAME = 'Google search';
+ const URI = 'https://www.google.com/';
const CACHE_TIMEOUT = 1800; // 30min
- const DESCRIPTION = "Returns most recent results from Google search.";
+ const DESCRIPTION = 'Returns most recent results from Google search.';
const PARAMETERS = array(array(
'q' => array(
@@ -22,30 +22,31 @@ class GoogleSearchBridge extends BridgeAbstract {
)
));
-
- public function collectData() {
+ public function collectData(){
$html = '';
- $html = getSimpleHTMLDOM(self::URI.'search?q='.urlencode($this->getInput('q'))
- .'&num=100&complete=0&tbs=qdr:y,sbd:1')
- or returnServerError('No results for this query.');
+ $html = getSimpleHTMLDOM(self::URI
+ . 'search?q='
+ . urlencode($this->getInput('q'))
+ .'&num=100&complete=0&tbs=qdr:y,sbd:1')
+ or returnServerError('No results for this query.');
$emIsRes = $html->find('div[id=ires]', 0);
- if( !is_null($emIsRes) ) {
-
- foreach($emIsRes->find('div[class=g]') as $element) {
+ if(!is_null($emIsRes)){
+ foreach($emIsRes->find('div[class=g]') as $element){
$item = array();
// Extract direct URL from google href (eg. /url?q=...)
$t = $element->find('a[href]', 0)->href;
- $item['uri'] = ''.$t;
+ $item['uri'] = '' . $t;
parse_str(parse_url($t, PHP_URL_QUERY), $parameters);
- if (isset($parameters['q'])) { $item['uri'] = $parameters['q']; }
+ if(isset($parameters['q'])){
+ $item['uri'] = $parameters['q'];
+ }
$item['title'] = $element->find('h3', 0)->plaintext;
-
$item['content'] = $element->find('span[class=st]', 0)->plaintext;
$this->items[] = $item;
@@ -54,7 +55,6 @@ class GoogleSearchBridge extends BridgeAbstract {
}
public function getName(){
-
- return $this->getInput('q') .' - Google search';
+ return $this->getInput('q') . ' - Google search';
}
}
diff --git a/bridges/HDWallpapersBridge.php b/bridges/HDWallpapersBridge.php
index 740b7005..309c3fdf 100644
--- a/bridges/HDWallpapersBridge.php
+++ b/bridges/HDWallpapersBridge.php
@@ -1,62 +1,79 @@
array(
- 'name'=>'category',
- 'defaultValue'=>'latest_wallpapers'
- ),
- 'm'=>array('name'=>'max number of wallpapers'),
- 'r'=>array(
- 'name'=>'resolution',
- 'defaultValue'=>'1920x1200',
- 'exampleValue'=>'1920x1200, 1680x1050,…'
- )
- ));
+ const PARAMETERS = array( array(
+ 'c' => array(
+ 'name' => 'category',
+ 'defaultValue' => 'latest_wallpapers'
+ ),
+ 'm' => array(
+ 'name' => 'max number of wallpapers'
+ ),
+ 'r' => array(
+ 'name' => 'resolution',
+ 'defaultValue' => '1920x1200',
+ 'exampleValue' => '1920x1200, 1680x1050,…'
+ )
+ ));
- public function collectData(){
- $category = $this->category;
- if (strrpos($category, 'wallpapers') !== strlen($category)-strlen('wallpapers')) {
- $category .= '-desktop-wallpapers';
- }
+ public function collectData(){
+ $category = $this->category;
+ if(strrpos($category, 'wallpapers') !== strlen($category) - strlen('wallpapers')){
+ $category .= '-desktop-wallpapers';
+ }
- $num = 0;
- $max = $this->getInput('m') ?: 14;
- $lastpage = 1;
+ $num = 0;
+ $max = $this->getInput('m') ?: 14;
+ $lastpage = 1;
- for ($page = 1; $page <= $lastpage; $page++) {
- $link = self::URI.'/'.$category.'/page/'.$page;
- $html = getSimpleHTMLDOM($link) or returnServerError('No results for this query.');
+ for($page = 1; $page <= $lastpage; $page++){
+ $link = self::URI . '/' . $category . '/page/' . $page;
+ $html = getSimpleHTMLDOM($link)
+ or returnServerError('No results for this query.');
- if ($page === 1) {
- preg_match('/page\/(\d+)$/', $html->find('.pagination a', -2)->href, $matches);
- $lastpage = min($matches[1], ceil($max/14));
- }
+ if($page === 1){
+ preg_match('/page\/(\d+)$/', $html->find('.pagination a', -2)->href, $matches);
+ $lastpage = min($matches[1], ceil($max / 14));
+ }
- foreach($html->find('.wallpapers .wall a') as $element) {
- $thumbnail = $element->find('img', 0);
+ foreach($html->find('.wallpapers .wall a') as $element){
+ $thumbnail = $element->find('img', 0);
- $item = array();
- // http://www.hdwallpapers.in/download/yosemite_reflections-1680x1050.jpg
- $item['uri'] = self::URI.'/download'.str_replace('wallpapers.html', $this->getInput('r').'.jpg', $element->href);
- $item['timestamp'] = time();
- $item['title'] = $element->find('p', 0)->text();
- $item['content'] = $item['title'].'
';
- $this->items[] = $item;
+ $item = array();
+ // http://www.hdwallpapers.in/download/yosemite_reflections-1680x1050.jpg
+ $item['uri'] = self::URI
+ . '/download'
+ . str_replace('wallpapers.html', $this->getInput('r') . '.jpg', $element->href);
- $num++;
- if ($num >= $max)
- break 2;
- }
- }
- }
+ $item['timestamp'] = time();
+ $item['title'] = $element->find('p', 0)->text();
+ $item['content'] = $item['title']
+ . '
';
- public function getName(){
- return 'HDWallpapers - '.str_replace(['__', '_'], [' & ', ' '], $this->getInput('c')).' ['.$this->getInput('r').']';
- }
+ $this->items[] = $item;
+
+ $num++;
+ if ($num >= $max)
+ break 2;
+ }
+ }
+ }
+
+ public function getName(){
+ return 'HDWallpapers - '
+ . str_replace(['__', '_'], [' & ', ' '], $this->getInput('c'))
+ . ' ['
+ . $this->getInput('r')
+ . ']';
+ }
}
diff --git a/bridges/HentaiHavenBridge.php b/bridges/HentaiHavenBridge.php
index f075cb6a..14f4ee57 100644
--- a/bridges/HentaiHavenBridge.php
+++ b/bridges/HentaiHavenBridge.php
@@ -1,23 +1,37 @@
find('div.zoe-grid') as $element) {
- $item = array();
- $item['uri'] = $element->find('div.brick-content h3 a', 0)->href;
- $thumbnailUri = $element->find('a.thumbnail-image img', 0)->getAttribute('data-src');
- $item['title'] = mb_convert_encoding(trim($element->find('div.brick-content h3 a', 0)->innertext), 'UTF-8', 'HTML-ENTITIES');
- $item['tags'] = $element->find('div.oFlyout_bg div.oFlyout div.flyoutContent span.tags', 0)->plaintext;
- $item['content'] = 'Tags: ' . $item['tags'].'
' . $element->find('div.oFlyout_bg div.oFlyout div.flyoutContent p.description', 0)->innertext;
- $this->items[] = $item;
- }
- }
+ public function collectData(){
+ $html = getSimpleHTMLDOM(self::URI)
+ or returnServerError('Could not request Hentai Haven.');
+
+ foreach($html->find('div.zoe-grid') as $element){
+ $item = array();
+ $item['uri'] = $element->find('div.brick-content h3 a', 0)->href;
+ $thumbnailUri = $element->find('a.thumbnail-image img', 0)->getAttribute('data-src');
+ $item['title'] = mb_convert_encoding(
+ trim($element->find('div.brick-content h3 a', 0)->innertext),
+ 'UTF-8',
+ 'HTML-ENTITIES'
+ );
+
+ $item['tags'] = $element->find('div.oFlyout_bg div.oFlyout div.flyoutContent span.tags', 0)->plaintext;
+ $item['content'] = 'Tags: '
+ . $item['tags']
+ . '
'
+ . $element->find('div.oFlyout_bg div.oFlyout div.flyoutContent p.description', 0)->innertext;
+
+ $this->items[] = $item;
+ }
+ }
}
diff --git a/bridges/IdenticaBridge.php b/bridges/IdenticaBridge.php
index a0c3bb2e..05d832ad 100644
--- a/bridges/IdenticaBridge.php
+++ b/bridges/IdenticaBridge.php
@@ -1,38 +1,44 @@
array(
- 'name'=>'username',
- 'required'=>true
- )
- ));
+ const PARAMETERS = array( array(
+ 'u' => array(
+ 'name' => 'username',
+ 'required' => true
+ )
+ ));
- public function collectData(){
- $html = getSimpleHTMLDOM($this->getURI())
- or returnServerError('Requested username can\'t be found.');
+ public function collectData(){
+ $html = getSimpleHTMLDOM($this->getURI())
+ or returnServerError('Requested username can\'t be found.');
- foreach($html->find('li.major') as $dent) {
- $item = array();
- $item['uri'] = html_entity_decode($dent->find('a', 0)->href); // get dent link
- $item['timestamp'] = strtotime($dent->find('abbr.easydate', 0)->plaintext); // extract dent timestamp
- $item['content'] = trim($dent->find('div.activity-content', 0)->innertext); // extract dent text
- $item['title'] = $this->getInput('u') . ' | ' . $item['content'];
- $this->items[] = $item;
- }
- }
+ foreach($html->find('li.major') as $dent){
+ $item = array();
- public function getName(){
- return $this->getInput('u') .' - Identica Bridge';
- }
+ // get dent link
+ $item['uri'] = html_entity_decode($dent->find('a', 0)->href);
- public function getURI(){
- return self::URI.urlencode($this->getInput('u'));
- }
+ // extract dent timestamp
+ $item['timestamp'] = strtotime($dent->find('abbr.easydate', 0)->plaintext);
+
+ // extract dent text
+ $item['content'] = trim($dent->find('div.activity-content', 0)->innertext);
+ $item['title'] = $this->getInput('u') . ' | ' . $item['content'];
+ $this->items[] = $item;
+ }
+ }
+
+ public function getName(){
+ return $this->getInput('u') . ' - Identica Bridge';
+ }
+
+ public function getURI(){
+ return self::URI . urlencode($this->getInput('u'));
+ }
}
diff --git a/bridges/InstagramBridge.php b/bridges/InstagramBridge.php
index e3c4b511..36240b10 100644
--- a/bridges/InstagramBridge.php
+++ b/bridges/InstagramBridge.php
@@ -1,71 +1,62 @@
array(
- 'name'=>'username',
- 'required'=>true
- )
- ));
+ const PARAMETERS = array( array(
+ 'u' => array(
+ 'name' => 'username',
+ 'required' => true
+ )
+ ));
- public function collectData(){
- $html = getSimpleHTMLDOM($this->getURI())
- or returnServerError('Could not request Instagram.');
+ public function collectData(){
+ $html = getSimpleHTMLDOM($this->getURI())
+ or returnServerError('Could not request Instagram.');
- $innertext = null;
+ $innertext = null;
- foreach($html->find('script') as $script)
- {
- if ('' === $script->innertext) {
- continue;
- }
+ foreach($html->find('script') as $script){
+ if('' === $script->innertext){
+ continue;
+ }
- $pos = strpos(trim($script->innertext), 'window._sharedData');
- if (0 !== $pos)
- {
- continue;
- }
+ $pos = strpos(trim($script->innertext), 'window._sharedData');
+ if(0 !== $pos){
+ continue;
+ }
- $innertext = $script->innertext;
- break;
- }
+ $innertext = $script->innertext;
+ break;
+ }
- $json = trim(substr($innertext, $pos+18), ' =;');
- $data = json_decode($json);
+ $json = trim(substr($innertext, $pos + 18), ' =;');
+ $data = json_decode($json);
+ $userMedia = $data->entry_data->ProfilePage[0]->user->media->nodes;
+ foreach($userMedia as $media){
+ $item = array();
+ $item['uri'] = self::URI . 'p/' . $media->code . '/';
+ $item['content'] = '';
+ if (isset($media->caption)){
+ $item['title'] = $media->caption;
+ } else {
+ $item['title'] = basename($media->display_src);
+ }
+ $item['timestamp'] = $media->date;
+ $this->items[] = $item;
+ }
+ }
- $userMedia = $data->entry_data->ProfilePage[0]->user->media->nodes;
+ public function getName(){
+ return $this->getInput('u') . ' - Instagram Bridge';
+ }
- foreach($userMedia as $media)
- {
-
- $item = array();
- $item['uri'] = self::URI.'p/'.$media->code.'/';
- $item['content'] = '';
- if (isset($media->caption))
- {
- $item['title'] = $media->caption;
- } else {
- $item['title'] = basename($media->display_src);
- }
- $item['timestamp'] = $media->date;
- $this->items[] = $item;
-
- }
- }
-
- public function getName(){
- return $this->getInput('u') .' - Instagram Bridge';
- }
-
- public function getURI(){
- return self::URI.urlencode($this->getInput('u'));
- }
+ public function getURI(){
+ return self::URI . urlencode($this->getInput('u'));
+ }
}
-
diff --git a/bridges/IsoHuntBridge.php b/bridges/IsoHuntBridge.php
index 8101d327..a465bdd0 100644
--- a/bridges/IsoHuntBridge.php
+++ b/bridges/IsoHuntBridge.php
@@ -1,472 +1,465 @@
array(
- 'latest_category'=>array(
- 'name'=>'Latest category',
- 'type'=>'list',
- 'required'=>true,
- 'title'=>'Select your category',
- 'defaultValue'=>'news',
- 'values'=>array(
- 'Hot Torrents'=>'hot_torrents',
- 'News'=>'news',
- 'Releases'=>'releases',
- 'Torrents'=>'torrents'
- )
- )
- ),
-
- /*
- * Get feeds for one of the "torrent" categories
- * Make sure to add new categories also to get_torrent_category_index($)!
- * Elements are sorted by name ascending!
- */
- 'By "Torrent" category' => array(
- 'torrent_category'=>array(
- 'name'=>'Torrent category',
- 'type'=>'list',
- 'required'=>true,
- 'title'=>'Select your category',
- 'defaultValue'=>'anime',
- 'values'=>array(
- 'Adult'=>'adult',
- 'Anime'=>'anime',
- 'Books'=>'books',
- 'Games'=>'games',
- 'Movies'=>'movies',
- 'Music'=>'music',
- 'Other'=>'other',
- 'Series & TV'=>'series_tv',
- 'Software'=>'software'
- )
- ),
- 'torrent_popularity'=>array(
- 'name'=>'Sort by popularity',
- 'type'=>'checkbox',
- 'title'=>'Activate to receive results by popularity'
- )
- ),
-
- /*
- * Get feeds for a specific search request
- */
- 'Search torrent by name' => array(
- 'search_name'=>array(
- 'name'=>'Name',
- 'required'=>true,
- 'title'=>'Insert your search query',
- 'exampleValue'=>'Bridge'
- ),
- 'search_category'=>array(
- 'name'=>'Category',
- 'type'=>'list',
- 'title'=>'Select your category',
- 'defaultValue'=>'all',
- 'values'=>array(
- 'Adult'=>'adult',
- 'All'=>'all',
- 'Anime'=>'anime',
- 'Books'=>'books',
- 'Games'=>'games',
- 'Movies'=>'movies',
- 'Music'=>'music',
- 'Other'=>'other',
- 'Series & TV'=>'series_tv',
- 'Software'=>'software'
- )
- )
- )
- );
-
- public function getURI(){
- $uri=self::URI;
- switch($this->queriedContext){
- case 'By "Latest" category':
- switch($this->getInput('latest_category')){
- case 'hot_torrents':
- $uri .= 'statistic/hot/torrents';
- break;
- case 'news':
- break;
- case 'releases':
- $uri .= 'releases.php';
- break;
- case 'torrents':
- $uri .= 'latest.php';
- break;
- }
- break;
-
- case 'By "Torrent" category':
- $uri .= $this->build_category_uri(
- $this->getInput('torrent_category'),
- $this->getInput('torrent_popularity')
- );
- break;
-
- case 'Search torrent by name':
- $category=$this->getInput('search_category');
- $uri .= $this->build_category_uri($category);
- if($category!=='movies')
- $uri .= '&ihq=' . urlencode($this->getInput('search_name'));
- break;
-
- default: parent::getURI();
- }
-
- return $uri;
- }
-
- public function getName(){
- switch($this->queriedContext){
- case 'By "Latest" category':
- $categoryName =
- array_search(
- $this->getInput('latest_category'),
- self::PARAMETERS['By "Latest" category']['latest_category']['values']
- );
- $name = 'Latest '.$categoryName.' - ' . self::NAME;
- break;
-
- case 'By "Torrent" category':
- $categoryName =
- array_search(
- $this->getInput('torrent_category'),
- self::PARAMETERS['By "Torrent" category']['torrent_category']['values']
- );
- $name = 'Category: ' . $categoryName . ' - ' . self::NAME;
- break;
-
- case 'Search torrent by name':
- $categoryName =
- array_search(
- $this->getInput('search_category'),
- self::PARAMETERS['Search torrent by name']['search_category']['values']
- );
- $name = 'Search: "' . $this->getInput('search_name') . '" in category: ' . $categoryName . ' - ' . self::NAME;
- break;
-
- default: return parent::getName();
- }
-
- return $name;
- }
-
-
- public function collectData(){
- $html = $this->load_html($this->getURI());
-
- switch($this->queriedContext){
- case 'By "Latest" category':
- switch($this->getInput('latest_category')){
- case 'hot_torrents':
- $this->get_latest_hot_torrents($html);
- break;
- case 'news':
- $this->get_latest_news($html);
- break;
- case 'releases':
- case 'torrents':
- $this->get_latest_torrents($html);
- break;
- }
- break;
-
- case 'By "Torrent" category':
- if($this->getInput('torrent_category') === 'movies'){
- // This one is special (content wise)
- $this->get_movie_torrents($html);
- }else{
- $this->get_latest_torrents($html);
- }
- break;
-
- case 'Search torrent by name':
- if( $this->getInput('search_category') === 'movies'){
- // This one is special (content wise)
- $this->get_movie_torrents($html);
- } else {
- $this->get_latest_torrents($html);
- }
- break;
- }
- }
-
- #region Helper functions for "Movie Torrents"
-
- private function get_movie_torrents($html){
- $container = $html->find('div#w0', 0);
- if(!$container)
- returnServerError('Unable to find torrent container!');
-
- $torrents = $container->find('article');
- if(!$torrents)
- returnServerError('Unable to find torrents!');
-
- foreach($torrents as $torrent){
-
- $anchor = $torrent->find('a', 0);
- if(!$anchor)
- returnServerError('Unable to find anchor!');
-
- $date = $torrent->find('small', 0);
- if(!$date)
- returnServerError('Unable to find date!');
-
- $item = array();
-
- $item['uri'] = $this->fix_relative_uri($anchor->href);
- $item['title'] = $anchor->title;
- // $item['author'] =
- $item['timestamp'] = strtotime($date->plaintext);
- $item['content'] = $this->fix_relative_uri($torrent->innertext);
-
- $this->items[] = $item;
- }
- }
-
- #endregion
-
- #region Helper functions for "Latest Hot Torrents"
-
- private function get_latest_hot_torrents($html){
- $container = $html->find('div#serps', 0);
- if(!$container)
- returnServerError('Unable to find torrent container!');
-
- $torrents = $container->find('tr');
- if(!$torrents)
- returnServerError('Unable to find torrents!');
-
- // Remove first element (header row)
- $torrents = array_slice($torrents, 1);
-
- foreach($torrents as $torrent){
-
- $cell = $torrent->find('td', 0);
- if(!$cell)
- returnServerError('Unable to find cell!');
-
- $element = $cell->find('a', 0);
- if(!$element)
- returnServerError('Unable to find element!');
-
- $item = array();
-
- $item['uri'] = $element->href;
- $item['title'] = $element->plaintext;
- // $item['author'] =
- // $item['timestamp'] =
- // $item['content'] =
-
- $this->items[] = $item;
- }
- }
-
- #endregion
+class IsoHuntBridge extends BridgeAbstract {
+ const MAINTAINER = 'logmanoriginal';
+ const NAME = 'isoHunt Bridge';
+ const URI = 'https://isohunt.to/';
+ const CACHE_TIMEOUT = 300; //5min
+ const DESCRIPTION = 'Returns the latest results by category or search result';
+
+ const PARAMETERS = array(
+ /*
+ * Get feeds for one of the "latest" categories
+ * Notice: The categories "News" and "Top Searches" are received from the main page
+ * Elements are sorted by name ascending!
+ */
+ 'By "Latest" category' => array(
+ 'latest_category' => array(
+ 'name' => 'Latest category',
+ 'type' => 'list',
+ 'required' => true,
+ 'title' => 'Select your category',
+ 'defaultValue' => 'news',
+ 'values' => array(
+ 'Hot Torrents' => 'hot_torrents',
+ 'News' => 'news',
+ 'Releases' => 'releases',
+ 'Torrents' => 'torrents'
+ )
+ )
+ ),
+
+ /*
+ * Get feeds for one of the "torrent" categories
+ * Make sure to add new categories also to get_torrent_category_index($)!
+ * Elements are sorted by name ascending!
+ */
+ 'By "Torrent" category' => array(
+ 'torrent_category' => array(
+ 'name' => 'Torrent category',
+ 'type' => 'list',
+ 'required' => true,
+ 'title' => 'Select your category',
+ 'defaultValue' => 'anime',
+ 'values' => array(
+ 'Adult' => 'adult',
+ 'Anime' => 'anime',
+ 'Books' => 'books',
+ 'Games' => 'games',
+ 'Movies' => 'movies',
+ 'Music' => 'music',
+ 'Other' => 'other',
+ 'Series & TV' => 'series_tv',
+ 'Software' => 'software'
+ )
+ ),
+ 'torrent_popularity' => array(
+ 'name' => 'Sort by popularity',
+ 'type' => 'checkbox',
+ 'title' => 'Activate to receive results by popularity'
+ )
+ ),
+
+ /*
+ * Get feeds for a specific search request
+ */
+ 'Search torrent by name' => array(
+ 'search_name' => array(
+ 'name' => 'Name',
+ 'required' => true,
+ 'title' => 'Insert your search query',
+ 'exampleValue' => 'Bridge'
+ ),
+ 'search_category' => array(
+ 'name' => 'Category',
+ 'type' => 'list',
+ 'title' => 'Select your category',
+ 'defaultValue' => 'all',
+ 'values' => array(
+ 'Adult' => 'adult',
+ 'All' => 'all',
+ 'Anime' => 'anime',
+ 'Books' => 'books',
+ 'Games' => 'games',
+ 'Movies' => 'movies',
+ 'Music' => 'music',
+ 'Other' => 'other',
+ 'Series & TV' => 'series_tv',
+ 'Software' => 'software'
+ )
+ )
+ )
+ );
+
+ public function getURI(){
+ $uri = self::URI;
+ switch($this->queriedContext){
+ case 'By "Latest" category':
+ switch($this->getInput('latest_category')){
+ case 'hot_torrents':
+ $uri .= 'statistic/hot/torrents';
+ break;
+ case 'news':
+ break;
+ case 'releases':
+ $uri .= 'releases.php';
+ break;
+ case 'torrents':
+ $uri .= 'latest.php';
+ break;
+ }
+ break;
+ case 'By "Torrent" category':
+ $uri .= $this->buildCategoryUri(
+ $this->getInput('torrent_category'),
+ $this->getInput('torrent_popularity')
+ );
+ break;
+ case 'Search torrent by name':
+ $category = $this->getInput('search_category');
+ $uri .= $this->buildCategoryUri($category);
+ if($category !== 'movies')
+ $uri .= '&ihq=' . urlencode($this->getInput('search_name'));
+ break;
+
+ default: parent::getURI();
+ }
+
+ return $uri;
+ }
+
+ public function getName(){
+ switch($this->queriedContext){
+ case 'By "Latest" category':
+ $categoryName = array_search(
+ $this->getInput('latest_category'),
+ self::PARAMETERS['By "Latest" category']['latest_category']['values']
+ );
+ $name = 'Latest ' . $categoryName . ' - ' . self::NAME;
+ break;
+ case 'By "Torrent" category':
+ $categoryName = array_search(
+ $this->getInput('torrent_category'),
+ self::PARAMETERS['By "Torrent" category']['torrent_category']['values']
+ );
+ $name = 'Category: ' . $categoryName . ' - ' . self::NAME;
+ break;
+ case 'Search torrent by name':
+ $categoryName = array_search(
+ $this->getInput('search_category'),
+ self::PARAMETERS['Search torrent by name']['search_category']['values']
+ );
+ $name = 'Search: "'
+ . $this->getInput('search_name')
+ . '" in category: '
+ . $categoryName . ' - '
+ . self::NAME;
+ break;
+ default: return parent::getName();
+ }
+
+ return $name;
+ }
+
+ public function collectData(){
+ $html = $this->loadHtml($this->getURI());
+
+ switch($this->queriedContext){
+ case 'By "Latest" category':
+ switch($this->getInput('latest_category')){
+ case 'hot_torrents':
+ $this->getLatestHotTorrents($html);
+ break;
+ case 'news':
+ $this->getLatestNews($html);
+ break;
+ case 'releases':
+ case 'torrents':
+ $this->getLatestTorrents($html);
+ break;
+ }
+ break;
+ case 'By "Torrent" category':
+ if($this->getInput('torrent_category') === 'movies'){
+ // This one is special (content wise)
+ $this->getMovieTorrents($html);
+ } else {
+ $this->getLatestTorrents($html);
+ }
+ break;
+ case 'Search torrent by name':
+ if( $this->getInput('search_category') === 'movies'){
+ // This one is special (content wise)
+ $this->getMovieTorrents($html);
+ } else {
+ $this->getLatestTorrents($html);
+ }
+ break;
+ }
+ }
+
+ #region Helper functions for "Movie Torrents"
+
+ private function getMovieTorrents($html){
+ $container = $html->find('div#w0', 0);
+ if(!$container)
+ returnServerError('Unable to find torrent container!');
+
+ $torrents = $container->find('article');
+ if(!$torrents)
+ returnServerError('Unable to find torrents!');
+
+ foreach($torrents as $torrent){
+
+ $anchor = $torrent->find('a', 0);
+ if(!$anchor)
+ returnServerError('Unable to find anchor!');
+
+ $date = $torrent->find('small', 0);
+ if(!$date)
+ returnServerError('Unable to find date!');
+
+ $item = array();
+
+ $item['uri'] = $this->fixRelativeUri($anchor->href);
+ $item['title'] = $anchor->title;
+ // $item['author'] =
+ $item['timestamp'] = strtotime($date->plaintext);
+ $item['content'] = $this->fixRelativeUri($torrent->innertext);
+
+ $this->items[] = $item;
+ }
+ }
+
+ #endregion
+
+ #region Helper functions for "Latest Hot Torrents"
+
+ private function getLatestHotTorrents($html){
+ $container = $html->find('div#serps', 0);
+ if(!$container)
+ returnServerError('Unable to find torrent container!');
+
+ $torrents = $container->find('tr');
+ if(!$torrents)
+ returnServerError('Unable to find torrents!');
+
+ // Remove first element (header row)
+ $torrents = array_slice($torrents, 1);
+
+ foreach($torrents as $torrent){
+
+ $cell = $torrent->find('td', 0);
+ if(!$cell)
+ returnServerError('Unable to find cell!');
+
+ $element = $cell->find('a', 0);
+ if(!$element)
+ returnServerError('Unable to find element!');
+
+ $item = array();
+
+ $item['uri'] = $element->href;
+ $item['title'] = $element->plaintext;
+ // $item['author'] =
+ // $item['timestamp'] =
+ // $item['content'] =
+
+ $this->items[] = $item;
+ }
+ }
+
+ #endregion
+
+ #region Helper functions for "Latest News"
+
+ private function getLatestNews($html){
+ $container = $html->find('div#postcontainer', 0);
+ if(!$container)
+ returnServerError('Unable to find post container!');
+
+ $posts = $container->find('div.index-post');
+ if(!$posts)
+ returnServerError('Unable to find posts!');
- #region Helper functions for "Latest News"
+ foreach($posts as $post){
+ $item = array();
- private function get_latest_news($html){
- $container = $html->find('div#postcontainer', 0);
- if(!$container)
- returnServerError('Unable to find post container!');
+ $item['uri'] = $this->latestNewsExtractUri($post);
+ $item['title'] = $this->latestNewsExtractTitle($post);
+ $item['author'] = $this->latestNewsExtractAuthor($post);
+ $item['timestamp'] = $this->latestNewsExtractTimestamp($post);
+ $item['content'] = $this->latestNewsExtractContent($post);
- $posts = $container->find('div.index-post');
- if(!$posts)
- returnServerError('Unable to find posts!');
+ $this->items[] = $item;
+ }
+ }
- foreach($posts as $post){
- $item = array();
+ private function latestNewsExtractAuthor($post){
+ $author = $post->find('small', 0);
+ if(!$author)
+ returnServerError('Unable to find author!');
- $item['uri'] = $this->latest_news_extract_uri($post);
- $item['title'] = $this->latest_news_extract_title($post);
- $item['author'] = $this->latest_news_extract_author($post);
- $item['timestamp'] = $this->latest_news_extract_timestamp($post);
- $item['content'] = $this->latest_news_extract_content($post);
+ // The author is hidden within a string like: 'Posted by {author} on {date}'
+ preg_match('/Posted\sby\s(.*)\son/i', $author->innertext, $matches);
- $this->items[] = $item;
- }
- }
+ return $matches[1];
+ }
- private function latest_news_extract_author($post){
- $author = $post->find('small', 0);
- if(!$author)
- returnServerError('Unable to find author!');
+ private function latestNewsExtractTimestamp($post){
+ $date = $post->find('small', 0);
+ if(!$date)
+ returnServerError('Unable to find date!');
- // The author is hidden within a string like: 'Posted by {author} on {date}'
- preg_match('/Posted\sby\s(.*)\son/i', $author->innertext, $matches);
+ // The date is hidden within a string like: 'Posted by {author} on {date}'
+ preg_match('/Posted\sby\s.*\son\s(.*)/i', $date->innertext, $matches);
- return $matches[1];
- }
+ $timestamp = strtotime($matches[1]);
- private function latest_news_extract_timestamp($post){
- $date = $post->find('small', 0);
- if(!$date)
- returnServerError('Unable to find date!');
+ // Make sure date is not in the future (dates are given like 'Nov. 20' without year)
+ if($timestamp > time()){
+ $timestamp = strtotime('-1 year', $timestamp);
+ }
- // The date is hidden within a string like: 'Posted by {author} on {date}'
- preg_match('/Posted\sby\s.*\son\s(.*)/i', $date->innertext, $matches);
+ return $timestamp;
+ }
- $timestamp = strtotime($matches[1]);
+ private function latestNewsExtractTitle($post){
+ $title = $post->find('a', 0);
+ if(!$title)
+ returnServerError('Unable to find title!');
- // Make sure date is not in the future (dates are given like 'Nov. 20' without year)
- if($timestamp > time()){
- $timestamp = strtotime('-1 year', $timestamp);
- }
+ return $title->plaintext;
+ }
- return $timestamp;
- }
+ private function latestNewsExtractUri($post){
+ $uri = $post->find('a', 0);
+ if(!$uri)
+ returnServerError('Unable to find uri!');
- private function latest_news_extract_title($post){
- $title = $post->find('a', 0);
- if(!$title)
- returnServerError('Unable to find title!');
+ return $uri->href;
+ }
- return $title->plaintext;
- }
+ private function latestNewsExtractContent($post){
+ $content = $post->find('div', 0);
+ if(!$content)
+ returnServerError('Unable to find content!');
- private function latest_news_extract_uri($post){
- $uri = $post->find('a', 0);
- if(!$uri)
- returnServerError('Unable to find uri!');
+ // Remove ...
(title)
+ foreach($content->find('h2') as $element){
+ $element->outertext = '';
+ }
- return $uri->href;
- }
+ // Remove ... (author)
+ foreach($content->find('small') as $element){
+ $element->outertext = '';
+ }
- private function latest_news_extract_content($post){
- $content = $post->find('div', 0);
- if(!$content)
- returnServerError('Unable to find content!');
+ return $content->innertext;
+ }
+
+ #endregion
+
+ #region Helper functions for "Latest Torrents", "Latest Releases" and "Torrent Category"
- // Remove ...
(title)
- foreach($content->find('h2') as $element){
- $element->outertext = '';
- }
+ private function getLatestTorrents($html){
+ $container = $html->find('div#serps', 0);
+ if(!$container)
+ returnServerError('Unable to find torrent container!');
- // Remove ... (author)
- foreach($content->find('small') as $element){
- $element->outertext = '';
- }
+ $torrents = $container->find('tr[data-key]');
+ if(!$torrents)
+ returnServerError('Unable to find torrents!');
- return $content->innertext;
- }
-
- #endregion
-
- #region Helper functions for "Latest Torrents", "Latest Releases" and "Torrent Category"
+ foreach($torrents as $torrent){
+ $item = array();
+
+ $item['uri'] = $this->latestTorrentsExtractUri($torrent);
+ $item['title'] = $this->latestTorrentsExtractTitle($torrent);
+ $item['author'] = $this->latestTorrentsExtractAuthor($torrent);
+ $item['timestamp'] = $this->latestTorrentsExtractTimestamp($torrent);
+ $item['content'] = ''; // There is no valuable content
+
+ $this->items[] = $item;
+ }
+ }
+
+ private function latestTorrentsExtractTitle($torrent){
+ $cell = $torrent->find('td.title-row', 0);
+ if(!$cell)
+ returnServerError('Unable to find title cell!');
- private function get_latest_torrents($html){
- $container = $html->find('div#serps', 0);
- if(!$container)
- returnServerError('Unable to find torrent container!');
+ $title = $cell->find('span', 0);
+ if(!$title)
+ returnServerError('Unable to find title!');
- $torrents = $container->find('tr[data-key]');
- if(!$torrents)
- returnServerError('Unable to find torrents!');
+ return $title->plaintext;
+ }
+
+ private function latestTorrentsExtractUri($torrent){
+ $cell = $torrent->find('td.title-row', 0);
+ if(!$cell)
+ returnServerError('Unable to find title cell!');
- foreach($torrents as $torrent){
- $item = array();
-
- $item['uri'] = $this->latest_torrents_extract_uri($torrent);
- $item['title'] = $this->latest_torrents_extract_title($torrent);
- $item['author'] = $this->latest_torrents_extract_author($torrent);
- $item['timestamp'] = $this->latest_torrents_extract_timestamp($torrent);
- $item['content'] = ''; // There is no valuable content
-
- $this->items[] = $item;
- }
- }
-
- private function latest_torrents_extract_title($torrent){
- $cell = $torrent->find('td.title-row', 0);
- if(!$cell)
- returnServerError('Unable to find title cell!');
+ $uri = $cell->find('a', 0);
+ if(!$uri)
+ returnServerError('Unable to find uri!');
- $title = $cell->find('span', 0);
- if(!$title)
- returnServerError('Unable to find title!');
+ return $this->fixRelativeUri($uri->href);
+ }
+
+ private function latestTorrentsExtractAuthor($torrent){
+ $cell = $torrent->find('td.user-row', 0);
+ if(!$cell)
+ return; // No author
- return $title->plaintext;
- }
-
- private function latest_torrents_extract_uri($torrent){
- $cell = $torrent->find('td.title-row', 0);
- if(!$cell)
- returnServerError('Unable to find title cell!');
+ $user = $cell->find('a', 0);
+ if(!$user)
+ returnServerError('Unable to find user!');
+
+ return $user->plaintext;
+ }
+
+ private function latestTorrentsExtractTimestamp($torrent){
+ $cell = $torrent->find('td.date-row', 0);
+ if(!$cell)
+ returnServerError('Unable to find date cell!');
+
+ return strtotime('-' . $cell->plaintext, time());
+ }
+
+ #endregion
+
+ #region Generic helper functions
+
+ private function loadHtml($uri){
+ $html = getSimpleHTMLDOM($uri);
+ if(!$html)
+ returnServerError('Unable to load ' . $uri . '!');
- $uri = $cell->find('a', 0);
- if(!$uri)
- returnServerError('Unable to find uri!');
-
- return $this->fix_relative_uri($uri->href);
- }
-
- private function latest_torrents_extract_author($torrent){
- $cell = $torrent->find('td.user-row', 0);
- if(!$cell)
- return; // No author
-
- $user = $cell->find('a', 0);
- if(!$user)
- returnServerError('Unable to find user!');
-
- return $user->plaintext;
- }
-
- private function latest_torrents_extract_timestamp($torrent){
- $cell = $torrent->find('td.date-row', 0);
- if(!$cell)
- returnServerError('Unable to find date cell!');
-
- return strtotime('-' . $cell->plaintext, time());
- }
-
- #endregion
-
- #region Generic helper functions
-
- private function load_html($uri){
- $html = getSimpleHTMLDOM($uri);
- if(!$html)
- returnServerError('Unable to load ' . $uri . '!');
-
- return $html;
- }
-
- private function fix_relative_uri($uri){
- return preg_replace('/\//i', self::URI, $uri, 1);
- }
-
- private function build_category_uri($category, $order_popularity = false){
- switch($category){
- case 'anime': $index = 1; break;
- case 'software' : $index = 2; break;
- case 'games' : $index = 3; break;
- case 'adult' : $index = 4; break;
- case 'movies' : $index = 5; break;
- case 'music' : $index = 6; break;
- case 'other' : $index = 7; break;
- case 'series_tv' : $index = 8; break;
- case 'books': $index = 9; break;
- case 'all':
- default: $index = 0; break;
- }
-
- return 'torrents/?iht=' . $index . '&ihs=' . ($order_popularity ? 1 : 0) . '&age=0';
- }
-
- #endregion
+ return $html;
+ }
+
+ private function fixRelativeUri($uri){
+ return preg_replace('/\//i', self::URI, $uri, 1);
+ }
+
+ private function buildCategoryUri($category, $order_popularity = false){
+ switch($category){
+ case 'anime': $index = 1; break;
+ case 'software' : $index = 2; break;
+ case 'games' : $index = 3; break;
+ case 'adult' : $index = 4; break;
+ case 'movies' : $index = 5; break;
+ case 'music' : $index = 6; break;
+ case 'other' : $index = 7; break;
+ case 'series_tv' : $index = 8; break;
+ case 'books': $index = 9; break;
+ case 'all':
+ default: $index = 0; break;
+ }
+
+ return 'torrents/?iht=' . $index . '&ihs=' . ($order_popularity ? 1 : 0) . '&age=0';
+ }
+
+ #endregion
}
diff --git a/bridges/JapanExpoBridge.php b/bridges/JapanExpoBridge.php
index 72dd0a6c..040754cd 100644
--- a/bridges/JapanExpoBridge.php
+++ b/bridges/JapanExpoBridge.php
@@ -1,89 +1,100 @@
array(
- 'name'=>'Show full contents',
- 'type'=>'checkbox',
- )
- ));
+ const MAINTAINER = 'Ginko';
+ const NAME = 'Japan Expo Actualités';
+ const URI = 'http://www.japan-expo-paris.com/fr/actualites';
+ const CACHE_TIMEOUT = 14400; // 4h
+ const DESCRIPTION = 'Returns most recent entries from Japan Expo actualités.';
+ const PARAMETERS = array( array(
+ 'mode' => array(
+ 'name' => 'Show full contents',
+ 'type' => 'checkbox',
+ )
+ ));
- public function collectData(){
+ public function collectData(){
- function french_pubdate_to_timestamp($date_to_parse) {
- return strtotime(
- strtr(
- strtolower(str_replace('Publié le ', '', $date_to_parse)),
- array(
- 'janvier' => 'jan',
- 'février' => 'feb',
- 'mars' => 'march',
- 'avril' => 'apr',
- 'mai' => 'may',
- 'juin' => 'jun',
- 'juillet' => 'jul',
- 'août' => 'aug',
- 'septembre' => 'sep',
- 'octobre' => 'oct',
- 'novembre' => 'nov',
- 'décembre' => 'dec'
- )
- )
- );
- }
+ function frenchPubDateToTimestamp($date_to_parse) {
+ return strtotime(
+ strtr(
+ strtolower(str_replace('Publié le ', '', $date_to_parse)),
+ array(
+ 'janvier' => 'jan',
+ 'février' => 'feb',
+ 'mars' => 'march',
+ 'avril' => 'apr',
+ 'mai' => 'may',
+ 'juin' => 'jun',
+ 'juillet' => 'jul',
+ 'août' => 'aug',
+ 'septembre' => 'sep',
+ 'octobre' => 'oct',
+ 'novembre' => 'nov',
+ 'décembre' => 'dec'
+ )
+ )
+ );
+ }
- $convert_article_images = function ($matches) {
- if (is_array($matches) && count($matches) > 1) {
- return '';
- }
- };
+ $convert_article_images = function($matches){
+ if(is_array($matches) && count($matches) > 1){
+ return '';
+ }
+ };
- $html = getSimpleHTMLDOM(self::URI)
- or returnServerError('Could not request JapanExpo: '.self::URI);
- $fullcontent = $this->getInput('mode');
- $count = 0;
+ $html = getSimpleHTMLDOM(self::URI)
+ or returnServerError('Could not request JapanExpo: ' . self::URI);
+ $fullcontent = $this->getInput('mode');
+ $count = 0;
- foreach ($html->find('a._tile2') as $element) {
+ foreach($html->find('a._tile2') as $element){
- $url = $element->href;
- $thumbnail = 'http://s.japan-expo.com/katana/images/JES049/paris.png';
- preg_match('/url\(([^)]+)\)/', $element->find('img.rspvimgset', 0)->style, $img_search_result);
- if (count($img_search_result) >= 2)
- $thumbnail = trim($img_search_result[1], "'");
+ $url = $element->href;
+ $thumbnail = 'http://s.japan-expo.com/katana/images/JES049/paris.png';
+ preg_match('/url\(([^)]+)\)/', $element->find('img.rspvimgset', 0)->style, $img_search_result);
- if ($fullcontent) {
- if ($count >= 5) {
- break;
- }
+ if(count($img_search_result) >= 2)
+ $thumbnail = trim($img_search_result[1], "'");
- $article_html = getSimpleHTMLDOMCached('Could not request JapanExpo: '.$url);
- $header = $article_html->find('header.pageHeadBox', 0);
- $timestamp = strtotime($header->find('time', 0)->datetime);
- $title_html = $header->find('div.section', 0)->next_sibling();
- $title = $title_html->plaintext;
- $headings = $title_html->next_sibling()->outertext;
- $article = $article_html->find('div.content', 0)->innertext;
- $article = preg_replace_callback('/]+ style="[^\(]+\(\'([^\']+)\'[^>]+>/i', $convert_article_images, $article);
- $content = $headings.$article;
- } else {
- $date_text = $element->find('span.date', 0)->plaintext;
- $timestamp = french_pubdate_to_timestamp($date_text);
- $title = trim($element->find('span._title', 0)->plaintext);
- $content = '
'.$date_text.'
Lire l\'article';
- }
+ if($fullcontent){
+ if($count >= 5){
+ break;
+ }
- $item = array();
- $item['uri'] = $url;
- $item['title'] = $title;
- $item['timestamp'] = $timestamp;
- $item['content'] = $content;
- $this->items[] = $item;
- $count++;
- }
- }
+ $article_html = getSimpleHTMLDOMCached('Could not request JapanExpo: ' . $url);
+ $header = $article_html->find('header.pageHeadBox', 0);
+ $timestamp = strtotime($header->find('time', 0)->datetime);
+ $title_html = $header->find('div.section', 0)->next_sibling();
+ $title = $title_html->plaintext;
+ $headings = $title_html->next_sibling()->outertext;
+ $article = $article_html->find('div.content', 0)->innertext;
+ $article = preg_replace_callback(
+ '/]+ style="[^\(]+\(\'([^\']+)\'[^>]+>/i',
+ $convert_article_images,
+ $article);
+
+ $content = $headings . $article;
+ } else {
+ $date_text = $element->find('span.date', 0)->plaintext;
+ $timestamp = frenchPubDateToTimestamp($date_text);
+ $title = trim($element->find('span._title', 0)->plaintext);
+ $content = '
'
+ . $date_text
+ . '
Lire l\'article';
+ }
+
+ $item = array();
+ $item['uri'] = $url;
+ $item['title'] = $title;
+ $item['timestamp'] = $timestamp;
+ $item['content'] = $content;
+ $this->items[] = $item;
+ $count++;
+ }
+ }
}
diff --git a/bridges/KonachanBridge.php b/bridges/KonachanBridge.php
index 6d170312..4250e8b8 100644
--- a/bridges/KonachanBridge.php
+++ b/bridges/KonachanBridge.php
@@ -3,9 +3,9 @@ require_once('MoebooruBridge.php');
class KonachanBridge extends MoebooruBridge {
- const MAINTAINER = "mitsukarenai";
- const NAME = "Konachan";
- const URI = "http://konachan.com/";
- const DESCRIPTION = "Returns images from given page";
+ const MAINTAINER = 'mitsukarenai';
+ const NAME = 'Konachan';
+ const URI = 'http://konachan.com/';
+ const DESCRIPTION = 'Returns images from given page';
}
diff --git a/bridges/KoreusBridge.php b/bridges/KoreusBridge.php
index 25d8dbf9..a5e09cbd 100644
--- a/bridges/KoreusBridge.php
+++ b/bridges/KoreusBridge.php
@@ -1,12 +1,12 @@
array(
- 'site'=>array(
- 'name'=>'Site',
- 'type'=>'list',
- 'required'=>true,
- 'title'=>'Select your site',
- 'values'=>array(
- 'Austria'=>'at',
- 'Germany'=>'de',
- 'Switzerland'=>'ch',
- 'United States'=>'us'
+ 'site' => array(
+ 'name' => 'Site',
+ 'type' => 'list',
+ 'required' => true,
+ 'title' => 'Select your site',
+ 'values' => array(
+ 'Austria' => 'at',
+ 'Germany' => 'de',
+ 'Switzerland' => 'ch',
+ 'United States' => 'us'
)
- ),
- 'full'=>array(
- 'name'=>'Load full article',
- 'type'=>'checkbox',
- 'required'=>false,
- 'exampleValue'=>'checked',
- 'title'=>'Activate to load full article'
+ ),
+ 'full' => array(
+ 'name' => 'Load full article',
+ 'type' => 'checkbox',
+ 'required' => false,
+ 'exampleValue' => 'checked',
+ 'title' => 'Activate to load full article'
)
),
-
array(
- 'company'=>array(
- 'name'=>'Company',
- 'required'=>true,
- 'exampleValue'=>'kununu-us',
- 'title'=>'Insert company name (i.e. Kununu US) or URI path (i.e. kununu-us)'
+ 'company' => array(
+ 'name' => 'Company',
+ 'required' => true,
+ 'exampleValue' => 'kununu-us',
+ 'title' => 'Insert company name (i.e. Kununu US) or URI path (i.e. kununu-us)'
)
)
);
@@ -44,7 +43,7 @@ class KununuBridge extends BridgeAbstract {
public function getURI(){
if(!is_null($this->getInput('company')) && !is_null($this->getInput('site'))){
- $company = $this->fix_company_name($this->getInput('company'));
+ $company = $this->fixCompanyName($this->getInput('company'));
$site = $this->getInput('site');
$section = '';
@@ -67,8 +66,8 @@ class KununuBridge extends BridgeAbstract {
function getName(){
if(!is_null($this->getInput('company'))){
- $company = $this->fix_company_name($this->getInput('company'));
- return ($this->companyName?:$company).' - '.self::NAME;
+ $company = $this->fixCompanyName($this->getInput('company'));
+ return ($this->companyName ?: $company) . ' - ' . self::NAME;
}
return paren::getName();
@@ -82,7 +81,7 @@ class KununuBridge extends BridgeAbstract {
if(!$html)
returnServerError('Unable to receive data from ' . $this->getURI() . '!');
// Update name for this request
- $this->companyName = $this->extract_company_name($html);
+ $this->companyName = $this->extractCompanyName($html);
// Find the section with all the panels (reviews)
$section = $html->find('section.kununu-scroll-element', 0);
@@ -98,15 +97,18 @@ class KununuBridge extends BridgeAbstract {
foreach($articles as $article){
$item = array();
- $item['author'] = $this->extract_article_author_position($article);
- $item['timestamp'] = $this->extract_article_date($article);
- $item['title'] = $this->extract_article_rating($article) . ' : ' . $this->extract_article_summary($article);
- $item['uri'] = $this->extract_article_uri($article);
+ $item['author'] = $this->extractArticleAuthorPosition($article);
+ $item['timestamp'] = $this->extractArticleDate($article);
+ $item['title'] = $this->extractArticleRating($article)
+ . ' : '
+ . $this->extractArticleSummary($article);
+
+ $item['uri'] = $this->extractArticleUri($article);
if($full)
- $item['content'] = $this->extract_full_description($item['uri']);
+ $item['content'] = $this->extractFullDescription($item['uri']);
else
- $item['content'] = $this->extract_article_description($article);
+ $item['content'] = $this->extractArticleDescription($article);
$this->items[] = $item;
}
@@ -115,24 +117,24 @@ class KununuBridge extends BridgeAbstract {
/**
* Fixes relative URLs in the given text
*/
- private function fix_url($text){
+ private function fixUrl($text){
return preg_replace('/href=(\'|\")\//i', 'href="'.self::URI, $text);
}
/*
* Returns a fixed version of the provided company name
*/
- private function fix_company_name($company){
+ private function fixCompanyName($company){
$company = trim($company);
$company = str_replace(' ', '-', $company);
$company = strtolower($company);
- return $this->encode_umlauts($company);
+ return $this->encodeUmlauts($company);
}
/**
* Encodes unmlauts in the given text
*/
- private function encode_umlauts($text){
+ private function encodeUmlauts($text){
$umlauts = Array("/ä/","/ö/","/ü/","/Ä/","/Ö/","/Ü/","/ß/");
$replace = Array("ae","oe","ue","Ae","Oe","Ue","ss");
@@ -142,7 +144,7 @@ class KununuBridge extends BridgeAbstract {
/**
* Returns the company name from the review html
*/
- private function extract_company_name($html){
+ private function extractCompanyName($html){
$company_name = $html->find('h1[itemprop=name]', 0);
if(is_null($company_name))
returnServerError('Cannot find company name!');
@@ -153,7 +155,7 @@ class KununuBridge extends BridgeAbstract {
/**
* Returns the date from a given article
*/
- private function extract_article_date($article){
+ private function extractArticleDate($article){
// They conviniently provide a time attribute for us :)
$date = $article->find('meta[itemprop=dateCreated]', 0);
if(is_null($date))
@@ -165,7 +167,7 @@ class KununuBridge extends BridgeAbstract {
/**
* Returns the rating from a given article
*/
- private function extract_article_rating($article){
+ private function extractArticleRating($article){
$rating = $article->find('span.rating', 0);
if(is_null($rating))
returnServerError('Cannot find article rating!');
@@ -176,7 +178,7 @@ class KununuBridge extends BridgeAbstract {
/**
* Returns the summary from a given article
*/
- private function extract_article_summary($article){
+ private function extractArticleSummary($article){
$summary = $article->find('[itemprop=name]', 0);
if(is_null($summary))
returnServerError('Cannot find article summary!');
@@ -187,7 +189,7 @@ class KununuBridge extends BridgeAbstract {
/**
* Returns the URI from a given article
*/
- private function extract_article_uri($article){
+ private function extractArticleUri($article){
$anchor = $article->find('ku-company-review-more', 0);
if(is_null($anchor))
returnServerError('Cannot find article URI!');
@@ -198,7 +200,7 @@ class KununuBridge extends BridgeAbstract {
/**
* Returns the position of the author from a given article
*/
- private function extract_article_author_position($article){
+ private function extractArticleAuthorPosition($article){
// We need to parse the user-content manually
$user_content = $article->find('div.user-content', 0);
if(is_null($user_content))
@@ -219,18 +221,18 @@ class KununuBridge extends BridgeAbstract {
/**
* Returns the description from a given article
*/
- private function extract_article_description($article){
+ private function extractArticleDescription($article){
$description = $article->find('[itemprop=reviewBody]', 0);
if(is_null($description))
returnServerError('Cannot find article description!');
- return $this->fix_url($description->innertext);
+ return $this->fixUrl($description->innertext);
}
/**
* Returns the full description from a given uri
*/
- private function extract_full_description($uri){
+ private function extractFullDescription($uri){
// Load full article
$html = getSimpleHTMLDOMCached($uri);
if($html === false)
@@ -242,6 +244,6 @@ class KununuBridge extends BridgeAbstract {
returnServerError('Cannot find article!');
// Luckily they use the same layout for the review overview and full article pages :)
- return $this->extract_article_description($article);
+ return $this->extractArticleDescription($article);
}
}
diff --git a/bridges/LWNprevBridge.php b/bridges/LWNprevBridge.php
index 8c2c4356..c0ad4109 100644
--- a/bridges/LWNprevBridge.php
+++ b/bridges/LWNprevBridge.php
@@ -1,144 +1,145 @@
nodeType===XML_TEXT_NODE){
- $nextNode=$node->nextSibling;
- if(!$nextNode){
- break;
- }
- $node=$nextNode;
- }
- }
+ private function jumpToNextTag(&$node){
+ while($node && $node->nodeType === XML_TEXT_NODE){
+ $nextNode = $node->nextSibling;
+ if(!$nextNode){
+ break;
+ }
+ $node = $nextNode;
+ }
+ }
- private function jumpToPreviousTag(&$node){
- while($node && $node->nodeType===XML_TEXT_NODE){
- $previousNode=$node->previousSibling;
- if(!$previousNode){
- break;
- }
- $node=$previousNode;
- }
- }
+ private function jumpToPreviousTag(&$node){
+ while($node && $node->nodeType === XML_TEXT_NODE){
+ $previousNode = $node->previousSibling;
+ if(!$previousNode){
+ break;
+ }
+ $node = $previousNode;
+ }
+ }
- public function collectData(){
- // Because the LWN page is written in loose HTML and not XHTML,
- // Simple HTML Dom is not accurate enough for the job
- $content=getContents($this->getURI())
- or returnServerError('No results for LWNprev');
+ public function collectData(){
+ // Because the LWN page is written in loose HTML and not XHTML,
+ // Simple HTML Dom is not accurate enough for the job
+ $content = getContents($this->getURI())
+ or returnServerError('No results for LWNprev');
- libxml_use_internal_errors(true);
- $html=new DOMDocument();
- $html->loadHTML($content);
- libxml_clear_errors();
+ libxml_use_internal_errors(true);
+ $html = new DOMDocument();
+ $html->loadHTML($content);
+ libxml_clear_errors();
- $cat1='';
- $cat2='';
+ $cat1 = '';
+ $cat2 = '';
- foreach($html->getElementsByTagName('a') as $a){
- if($a->textContent==='Multi-page format'){
- break;
- }
- }
- $realURI=self::URI.$a->getAttribute('href');
- $URICounter=0;
+ foreach($html->getElementsByTagName('a') as $a){
+ if($a->textContent === 'Multi-page format'){
+ break;
+ }
+ }
+ $realURI = self::URI . $a->getAttribute('href');
+ $URICounter = 0;
- $edition=$html->getElementsByTagName('h1')->item(0)->textContent;
- $editionTimeStamp=strtotime(
- substr($edition,strpos($edition,'for ')+strlen('for '))
- );
+ $edition = $html->getElementsByTagName('h1')->item(0)->textContent;
+ $editionTimeStamp = strtotime(
+ substr($edition, strpos($edition, 'for ') + strlen('for '))
+ );
- foreach($html->getElementsByTagName('h2') as $h2){
- if($h2->getAttribute('class')!=='SummaryHL'){
- continue;
- }
+ foreach($html->getElementsByTagName('h2') as $h2){
+ if($h2->getAttribute('class') !== 'SummaryHL'){
+ continue;
+ }
- $item = array();
+ $item = array();
- $h2NextSibling=$h2->nextSibling;
- $this->jumpToNextTag($h2NextSibling);
+ $h2NextSibling = $h2->nextSibling;
+ $this->jumpToNextTag($h2NextSibling);
- switch($h2NextSibling->getAttribute('class')){
- case 'FeatureByline':
- $item['author']=$h2NextSibling->getElementsByTagName('b')->item(0)->textContent;
- break;
- case 'GAByline':
- $text=$h2NextSibling->textContent;
- $item['author']=substr($text,strpos($text,'by '));
- break;
- default:
- $item['author']='LWN';
- break;
- };
+ switch($h2NextSibling->getAttribute('class')){
+ case 'FeatureByline':
+ $item['author'] = $h2NextSibling->getElementsByTagName('b')->item(0)->textContent;
+ break;
+ case 'GAByline':
+ $text = $h2NextSibling->textContent;
+ $item['author'] = substr($text,strpos($text, 'by '));
+ break;
+ default:
+ $item['author'] = 'LWN';
+ break;
+ };
- $h2FirstChild=$h2->firstChild;
- $this->jumpToNextTag($h2FirstChild);
- if($h2FirstChild->nodeName==='a'){
- $item['uri']=self::URI.$h2FirstChild->getAttribute('href');
- }else{
- $item['uri']=$realURI.'#'.$URICounter;
- }
- $URICounter++;
+ $h2FirstChild = $h2->firstChild;
+ $this->jumpToNextTag($h2FirstChild);
+ if($h2FirstChild->nodeName === 'a'){
+ $item['uri'] = self::URI . $h2FirstChild->getAttribute('href');
+ }else{
+ $item['uri'] = $realURI . '#' . $URICounter;
+ }
+ $URICounter++;
- $item['timestamp']=$editionTimeStamp+$URICounter;
+ $item['timestamp'] = $editionTimeStamp + $URICounter;
- $h2PrevSibling=$h2->previousSibling;
- $this->jumpToPreviousTag($h2PrevSibling);
- switch($h2PrevSibling->getAttribute('class')){
- case 'Cat2HL':
- $cat2=$h2PrevSibling->textContent;
- $h2PrevSibling=$h2PrevSibling->previousSibling;
- $this->jumpToPreviousTag($h2PrevSibling);
- if($h2PrevSibling->getAttribute('class')!=='Cat1HL'){
- break;
- }
- $cat1=$h2PrevSibling->textContent;
- break;
- case 'Cat1HL':
- $cat1=$h2PrevSibling->textContent;
- $cat2='';
- break;
- default:
- break;
- }
- $h2PrevSibling=null;
+ $h2PrevSibling = $h2->previousSibling;
+ $this->jumpToPreviousTag($h2PrevSibling);
+ switch($h2PrevSibling->getAttribute('class')){
+ case 'Cat2HL':
+ $cat2 = $h2PrevSibling->textContent;
+ $h2PrevSibling = $h2PrevSibling->previousSibling;
+ $this->jumpToPreviousTag($h2PrevSibling);
+ if($h2PrevSibling->getAttribute('class') !== 'Cat1HL'){
+ break;
+ }
+ $cat1 = $h2PrevSibling->textContent;
+ break;
+ case 'Cat1HL':
+ $cat1 = $h2PrevSibling->textContent;
+ $cat2 = '';
+ break;
+ default:
+ break;
+ }
+ $h2PrevSibling = null;
- $item['title']='';
- if(!empty($cat1)){
- $item['title'].='['.$cat1.($cat2?'/'.$cat2:'').'] ';
- }
- $item['title'].=$h2->textContent;
+ $item['title'] = '';
+ if(!empty($cat1)){
+ $item['title'] .= '[' . $cat1 . ($cat2 ? '/' . $cat2 : '') . '] ';
+ }
+ $item['title'] .= $h2->textContent;
- $node=$h2;
- $content='';
- $contentEnd=false;
- while(!$contentEnd){
- $node=$node->nextSibling;
- if(
- !$node || (
- $node->nodeType!==XML_TEXT_NODE && (
- $node->nodeName==='h2' ||
- (!is_null($node->attributes) && !is_null($class=$node->attributes->getNamedItem('class')) &&
- in_array($class->nodeValue,array('Cat1HL','Cat2HL')))
- )
- )
- ){
- $contentEnd=true;
- }else{
- $content.=$node->C14N();
- }
- }
- $item['content']=$content;
- $this->items[]=$item;
- }
- }
+ $node = $h2;
+ $content = '';
+ $contentEnd = false;
+ while(!$contentEnd){
+ $node = $node->nextSibling;
+ if(!$node || (
+ $node->nodeType !== XML_TEXT_NODE && (
+ $node->nodeName === 'h2' || (
+ !is_null($node->attributes) &&
+ !is_null($class = $node->attributes->getNamedItem('class')) &&
+ in_array($class->nodeValue, array('Cat1HL', 'Cat2HL'))
+ )
+ )
+ )
+ ){
+ $contentEnd = true;
+ }else{
+ $content .= $node->C14N();
+ }
+ }
+ $item['content'] = $content;
+ $this->items[] = $item;
+ }
+ }
}
diff --git a/bridges/LeBonCoinBridge.php b/bridges/LeBonCoinBridge.php
index 54c0f5ec..624401eb 100755
--- a/bridges/LeBonCoinBridge.php
+++ b/bridges/LeBonCoinBridge.php
@@ -1,162 +1,166 @@
array('name'=>'Mot Clé'),
- 'r'=>array(
- 'name'=>'Région',
- 'type'=>'list',
- 'values'=>array(
- 'Toute la France'=>'ile_de_france/occasions',
- 'Alsace'=>'alsace',
- 'Aquitaine'=>'aquitaine',
- 'Auvergne'=>'auvergne',
- 'Basse Normandie'=>'basse_normandie',
- 'Bourgogne'=>'bourgogne',
- 'Bretagne'=>'bretagne',
- 'Centre'=>'centre',
- 'Champagne Ardenne'=>'champagne_ardenne',
- 'Corse'=>'corse',
- 'Franche Comté'=>'franche_comte',
- 'Haute Normandie'=>'haute_normandie',
- 'Ile de France'=>'ile_de_france',
- 'Languedoc Roussillon'=>'languedoc_roussillon',
- 'Limousin'=>'limousin',
- 'Lorraine'=>'lorraine',
- 'Midi Pyrénées'=>'midi_pyrenees',
- 'Nord Pas De Calais'=>'nord_pas_de_calais',
- 'Pays de la Loire'=>'pays_de_la_loire',
- 'Picardie'=>'picardie',
- 'Poitou Charentes'=>'poitou_charentes',
- 'Provence Alpes Côte d\'Azur'=>'provence_alpes_cote_d_azur',
- 'Rhône-Alpes'=>'rhone_alpes',
- 'Guadeloupe'=>'guadeloupe',
- 'Martinique'=>'martinique',
- 'Guyane'=>'guyane',
- 'Réunion'=>'reunion'
- )
- ),
- 'c'=>array(
- 'name'=>'Catégorie',
- 'type'=>'list',
- 'values'=>array(
- 'TOUS'=>'',
- 'EMPLOI'=>'_emploi_',
- 'VEHICULES'=>array(
- 'Tous'=>'_vehicules_',
- 'Voitures'=>'voitures',
- 'Motos'=>'motos',
- 'Caravaning'=>'caravaning',
- 'Utilitaires'=>'utilitaires',
- 'Équipement Auto'=>'equipement_auto',
- 'Équipement Moto'=>'equipement_moto',
- 'Équipement Caravaning'=>'equipement_caravaning',
- 'Nautisme'=>'nautisme',
- 'Équipement Nautisme'=>'equipement_nautisme'
- ),
- 'IMMOBILIER'=>array(
- 'Tous'=>'_immobilier_',
- 'Ventes immobilières'=>'ventes_immobilieres',
- 'Locations'=>'locations',
- 'Colocations'=>'colocations',
- 'Bureaux & Commerces'=>'bureaux_commerces'
- ),
- 'VACANCES'=>array(
- 'Tous'=>'_vacances_',
- 'Location gîtes'=>'locations_gites',
- 'Chambres d\'hôtes'=>'chambres_d_hotes',
- 'Campings'=>'campings',
- 'Hôtels'=>'hotels',
- 'Hébergements insolites'=>'hebergements_insolites'
- ),
- 'MULTIMEDIA'=>array(
- 'Tous'=>'_multimedia_',
- 'Informatique'=>'informatique',
- 'Consoles & Jeux vidéo'=>'consoles_jeux_video',
- 'Image & Son'=>'image_son',
- 'Téléphonie'=>'telephonie'
- ),
- 'LOISIRS'=>array(
- 'Tous'=>'_loisirs_',
- 'DVD / Films'=>'dvd_films',
- 'CD / Musique'=>'cd_musique',
- 'Livres'=>'livres',
- 'Animaux'=>'animaux',
- 'Vélos'=>'velos',
- 'Sports & Hobbies'=>'sports_hobbies',
- 'Instruments de musique'=>'instruments_de_musique',
- 'Collection'=>'collection',
- 'Jeux & Jouets'=>'jeux_jouets',
- 'Vins & Gastronomie'=>'vins_gastronomie'
- ),
- 'MATÉRIEL PROFESSIONNEL'=>array(
- 'Tous'=>'_materiel_professionnel_',
- 'Matériel Agricole'=>'mateiel_agricole',
- 'Transport - Manutention'=>'transport_manutention',
- 'BTP - Chantier - Gros-œuvre'=>'btp_chantier_gros_oeuvre',
- 'Outillage - Matériaux 2nd-œuvre'=>'outillage_materiaux_2nd_oeuvre',
- 'Équipements Industriels'=>'equipement_industriels',
- 'Restauration - Hôtellerie'=>'restauration_hotellerie',
- 'Fournitures de Bureau'=>'fournitures_de_bureau',
- 'Commerces & Marchés'=>'commerces_marches',
- 'Matériel médical'=>'materiel_medical'
- ),
- 'SERVICES'=>array(
- 'Tous'=>'_services_',
- 'Prestations de services'=>'prestations_de_services',
- 'Billetterie'=>'billetterie',
- 'Évènements'=>'evenements',
- 'Cours particuliers'=>'cours_particuliers',
- 'Covoiturage'=>'covoiturage'
- ),
- 'MAISON'=>array(
- 'Tous'=>'_maison_',
- 'Ameublement'=>'ameublement',
- 'Électroménager'=>'electromenager',
- 'Arts de la table'=>'arts_de_la_table',
- 'Décoration'=>'decoration',
- 'Linge de maison'=>'linge_de_maison',
- 'Bricolage'=>'bricolage',
- 'Jardinage'=>'jardinage',
- 'Vêtements'=>'vetements',
- 'Chaussures'=>'chaussures',
- 'Accessoires & Bagagerie'=>'accessoires_bagagerie',
- 'Montres & Bijoux'=>'montres_bijoux',
- 'Équipement bébé'=>'equipement_bebe',
- 'Vêtements bébé'=>'vetements_bebe'
- ),
- 'AUTRES'=>'autres'
- )
- )
- )
- );
+ const PARAMETERS = array(
+ array(
+ 'k' => array('name' => 'Mot Clé'),
+ 'r' => array(
+ 'name' => 'Région',
+ 'type' => 'list',
+ 'values' => array(
+ 'Toute la France' => 'ile_de_france/occasions',
+ 'Alsace' => 'alsace',
+ 'Aquitaine' => 'aquitaine',
+ 'Auvergne' => 'auvergne',
+ 'Basse Normandie' => 'basse_normandie',
+ 'Bourgogne' => 'bourgogne',
+ 'Bretagne' => 'bretagne',
+ 'Centre' => 'centre',
+ 'Champagne Ardenne' => 'champagne_ardenne',
+ 'Corse' => 'corse',
+ 'Franche Comté' => 'franche_comte',
+ 'Haute Normandie' => 'haute_normandie',
+ 'Ile de France' => 'ile_de_france',
+ 'Languedoc Roussillon' => 'languedoc_roussillon',
+ 'Limousin' => 'limousin',
+ 'Lorraine' => 'lorraine',
+ 'Midi Pyrénées' => 'midi_pyrenees',
+ 'Nord Pas De Calais' => 'nord_pas_de_calais',
+ 'Pays de la Loire' => 'pays_de_la_loire',
+ 'Picardie' => 'picardie',
+ 'Poitou Charentes' => 'poitou_charentes',
+ 'Provence Alpes Côte d\'Azur' => 'provence_alpes_cote_d_azur',
+ 'Rhône-Alpes' => 'rhone_alpes',
+ 'Guadeloupe' => 'guadeloupe',
+ 'Martinique' => 'martinique',
+ 'Guyane' => 'guyane',
+ 'Réunion' => 'reunion'
+ )
+ ),
+ 'c' => array(
+ 'name' => 'Catégorie',
+ 'type' => 'list',
+ 'values' => array(
+ 'TOUS' => '',
+ 'EMPLOI' => '_emploi_',
+ 'VEHICULES' => array(
+ 'Tous' => '_vehicules_',
+ 'Voitures' => 'voitures',
+ 'Motos' => 'motos',
+ 'Caravaning' => 'caravaning',
+ 'Utilitaires' => 'utilitaires',
+ 'Équipement Auto' => 'equipement_auto',
+ 'Équipement Moto' => 'equipement_moto',
+ 'Équipement Caravaning' => 'equipement_caravaning',
+ 'Nautisme' => 'nautisme',
+ 'Équipement Nautisme' => 'equipement_nautisme'
+ ),
+ 'IMMOBILIER' => array(
+ 'Tous' => '_immobilier_',
+ 'Ventes immobilières' => 'ventes_immobilieres',
+ 'Locations' => 'locations',
+ 'Colocations' => 'colocations',
+ 'Bureaux & Commerces' => 'bureaux_commerces'
+ ),
+ 'VACANCES' => array(
+ 'Tous' => '_vacances_',
+ 'Location gîtes' => 'locations_gites',
+ 'Chambres d\'hôtes' => 'chambres_d_hotes',
+ 'Campings' => 'campings',
+ 'Hôtels' => 'hotels',
+ 'Hébergements insolites' => 'hebergements_insolites'
+ ),
+ 'MULTIMEDIA' => array(
+ 'Tous' => '_multimedia_',
+ 'Informatique' => 'informatique',
+ 'Consoles & Jeux vidéo' => 'consoles_jeux_video',
+ 'Image & Son' => 'image_son',
+ 'Téléphonie' => 'telephonie'
+ ),
+ 'LOISIRS' => array(
+ 'Tous' => '_loisirs_',
+ 'DVD / Films' => 'dvd_films',
+ 'CD / Musique' => 'cd_musique',
+ 'Livres' => 'livres',
+ 'Animaux' => 'animaux',
+ 'Vélos' => 'velos',
+ 'Sports & Hobbies' => 'sports_hobbies',
+ 'Instruments de musique' => 'instruments_de_musique',
+ 'Collection' => 'collection',
+ 'Jeux & Jouets' => 'jeux_jouets',
+ 'Vins & Gastronomie' => 'vins_gastronomie'
+ ),
+ 'MATÉRIEL PROFESSIONNEL' => array(
+ 'Tous' => '_materiel_professionnel_',
+ 'Matériel Agricole' => 'mateiel_agricole',
+ 'Transport - Manutention' => 'transport_manutention',
+ 'BTP - Chantier - Gros-œuvre' => 'btp_chantier_gros_oeuvre',
+ 'Outillage - Matériaux 2nd-œuvre' => 'outillage_materiaux_2nd_oeuvre',
+ 'Équipements Industriels' => 'equipement_industriels',
+ 'Restauration - Hôtellerie' => 'restauration_hotellerie',
+ 'Fournitures de Bureau' => 'fournitures_de_bureau',
+ 'Commerces & Marchés' => 'commerces_marches',
+ 'Matériel médical' => 'materiel_medical'
+ ),
+ 'SERVICES' => array(
+ 'Tous' => '_services_',
+ 'Prestations de services' => 'prestations_de_services',
+ 'Billetterie' => 'billetterie',
+ 'Évènements' => 'evenements',
+ 'Cours particuliers' => 'cours_particuliers',
+ 'Covoiturage' => 'covoiturage'
+ ),
+ 'MAISON' => array(
+ 'Tous' => '_maison_',
+ 'Ameublement' => 'ameublement',
+ 'Électroménager' => 'electromenager',
+ 'Arts de la table' => 'arts_de_la_table',
+ 'Décoration' => 'decoration',
+ 'Linge de maison' => 'linge_de_maison',
+ 'Bricolage' => 'bricolage',
+ 'Jardinage' => 'jardinage',
+ 'Vêtements' => 'vetements',
+ 'Chaussures' => 'chaussures',
+ 'Accessoires & Bagagerie' => 'accessoires_bagagerie',
+ 'Montres & Bijoux' => 'montres_bijoux',
+ 'Équipement bébé' => 'equipement_bebe',
+ 'Vêtements bébé' => 'vetements_bebe'
+ ),
+ 'AUTRES' => 'autres'
+ )
+ )
+ )
+ );
public function collectData(){
- $category=$this->getInput('c');
- if (empty($category)){
- $category='annonces';
- }
+ $category = $this->getInput('c');
+ if(empty($category)){
+ $category = 'annonces';
+ }
- $html = getSimpleHTMLDOM(
- self::URI.$category.'/offres/' . $this->getInput('r') . '/?'
- .'f=a&th=1&'
- .'q=' . urlencode($this->getInput('k'))
- ) or returnServerError('Could not request LeBonCoin.');
+ $html = getSimpleHTMLDOM(self::URI
+ . $category
+ . '/offres/'
+ . $this->getInput('r')
+ . '/?f=a&th=1&q='
+ . urlencode($this->getInput('k')))
+ or returnServerError('Could not request LeBonCoin.');
$list = $html->find('.tabsContent', 0);
- if($list === NULL) {
+ if($list === null){
return;
}
$tags = $list->find('li');
- foreach($tags as $element) {
+ foreach($tags as $element){
$element = $element->find('a', 0);
@@ -165,7 +169,7 @@ class LeBonCoinBridge extends BridgeAbstract{
$title = html_entity_decode($element->getAttribute('title'));
$content_image = $element->find('div.item_image', 0)->find('.lazyload', 0);
- if($content_image !== NULL) {
+ if($content_image !== null){
$content = '';
} else {
$content = "";
@@ -176,7 +180,7 @@ class LeBonCoinBridge extends BridgeAbstract{
for($i = 0; $i <= 1; $i++) $content .= $detailsList->find('p.item_supp', $i)->plaintext;
$price = $detailsList->find('h3.item_price', 0);
- $content .= $price === NULL ? '' : $price->plaintext;
+ $content .= $price === null ? '' : $price->plaintext;
$item['title'] = $title;
$item['content'] = $content . $date;
diff --git a/bridges/LeMondeInformatiqueBridge.php b/bridges/LeMondeInformatiqueBridge.php
index de6ac66d..e315f937 100644
--- a/bridges/LeMondeInformatiqueBridge.php
+++ b/bridges/LeMondeInformatiqueBridge.php
@@ -1,42 +1,44 @@
collectExpandableDatas(self::URI . 'rss/rss.xml', 10);
- }
+ public function collectData(){
+ $this->collectExpandableDatas(self::URI . 'rss/rss.xml', 10);
+ }
- protected function parseItem($newsItem){
- $item = parent::parseItem($newsItem);
- $article_html = getSimpleHTMLDOMCached($item['uri'])
- or returnServerError('Could not request LeMondeInformatique: ' . $item['uri']);
- $item['content'] = $this->CleanArticle($article_html->find('div#article', 0)->innertext);
- $item['title'] = $article_html->find('h1.cleanprint-title', 0)->plaintext;
- return $item;
- }
+ protected function parseItem($newsItem){
+ $item = parent::parseItem($newsItem);
+ $article_html = getSimpleHTMLDOMCached($item['uri'])
+ or returnServerError('Could not request LeMondeInformatique: ' . $item['uri']);
+ $item['content'] = $this->cleanArticle($article_html->find('div#article', 0)->innertext);
+ $item['title'] = $article_html->find('h1.cleanprint-title', 0)->plaintext;
+ return $item;
+ }
- private function StripCDATA($string) {
- $string = str_replace('', '', $string);
- return $string;
- }
+ private function stripCDATA($string){
+ $string = str_replace('', '', $string);
+ return $string;
+ }
- private function StripWithDelimiters($string, $start, $end) {
- while (strpos($string, $start) !== false) {
- $section_to_remove = substr($string, strpos($string, $start));
- $section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
- $string = str_replace($section_to_remove, '', $string);
- } return $string;
- }
+ private function stripWithDelimiters($string, $start, $end){
+ while(strpos($string, $start) !== false){
+ $section_to_remove = substr($string, strpos($string, $start));
+ $section_to_remove = substr($section_to_remove, 0, strpos($section_to_remove, $end) + strlen($end));
+ $string = str_replace($section_to_remove, '', $string);
+ }
- private function CleanArticle($article_html) {
- $article_html = $this->StripWithDelimiters($article_html, '');
+ $article_html = $this->stripWithDelimiters($article_html, '');
+ return $article_html;
+ }
}
diff --git a/bridges/LegifranceJOBridge.php b/bridges/LegifranceJOBridge.php
index 6cc8086b..2233db4a 100644
--- a/bridges/LegifranceJOBridge.php
+++ b/bridges/LegifranceJOBridge.php
@@ -1,70 +1,68 @@
author;
- $item['timestamp']=$this->timestamp;
- $item['uri']=$this->uri.'#'.count($this->items);
- $item['title']=$section->plaintext;
+ private function extractItem($section, $subsection = null, $origin = null){
+ $item = array();
+ $item['author'] = $this->author;
+ $item['timestamp'] = $this->timestamp;
+ $item['uri'] = $this->uri . '#' . count($this->items);
+ $item['title'] = $section->plaintext;
- if(!is_null($origin)){
- $item['title']='[ '.$item['title'].' / '.$subsection->plaintext.' ] '.$origin->plaintext;
- $data=$origin;
- }elseif(!is_null($subsection)){
- $item['title']='[ '.$item['title'].' ] '.$subsection->plaintext;
- $data=$subsection;
- }else{
- $data=$section;
- }
+ if(!is_null($origin)){
+ $item['title'] = '[ ' . $item['title'] . ' / ' . $subsection->plaintext . ' ] ' . $origin->plaintext;
+ $data = $origin;
+ } elseif(!is_null($subsection)){
+ $item['title'] = '[ ' . $item['title'] . ' ] ' . $subsection->plaintext;
+ $data = $subsection;
+ } else {
+ $data = $section;
+ }
- $item['content']='';
- foreach($data->nextSibling()->find('a') as $content){
- $text=$content->plaintext;
- $href=$content->nextSibling()->getAttribute('resource');
- $item['content'].='
'.$text.'
';
- }
- return $item;
- }
+ $item['content'] = '';
+ foreach($data->nextSibling()->find('a') as $content){
+ $text = $content->plaintext;
+ $href = $content->nextSibling()->getAttribute('resource');
+ $item['content'] .= '' . $text . '
';
+ }
+ return $item;
+ }
- public function collectData(){
- $html=getSimpleHTMLDOM(self::URI)
- or $this->returnServer('Unable to download '.self::URI);
+ public function collectData(){
+ $html = getSimpleHTMLDOM(self::URI)
+ or $this->returnServer('Unable to download ' . self::URI);
- $this->author=trim($html->find('h2.title',0)->plaintext);
- $uri=$html->find('h2.titleELI',0)->plaintext;
- $this->uri=trim(substr($uri,strpos($uri,'https')));
- $this->timestamp=strtotime(substr($this->uri,strpos($this->uri,'eli/jo/')+strlen('eli/jo/')));
+ $this->author = trim($html->find('h2.title', 0)->plaintext);
+ $uri = $html->find('h2.titleELI', 0)->plaintext;
+ $this->uri = trim(substr($uri, strpos($uri, 'https')));
+ $this->timestamp = strtotime(substr($this->uri, strpos($this->uri, 'eli/jo/') + strlen('eli/jo/')));
- foreach($html->find('h3') as $section){
- $subsections=$section->nextSibling()->find('h4');
- foreach($subsections as $subsection){
- $origins=$subsection->nextSibling()->find('h5');
- foreach($origins as $origin){
- $this->items[]=$this->extractItem($section,$subsection,$origin);
- }
- if(!empty($origins)){
- continue;
- }
- $this->items[]=$this->extractItem($section,$subsection);
- }
- if(!empty($subsections)){
- continue;
- }
- $this->items[]=$this->extractItem($section);
- }
- }
+ foreach($html->find('h3') as $section){
+ $subsections = $section->nextSibling()->find('h4');
+ foreach($subsections as $subsection){
+ $origins = $subsection->nextSibling()->find('h5');
+ foreach($origins as $origin){
+ $this->items[] = $this->extractItem($section, $subsection, $origin);
+ }
+ if(!empty($origins)){
+ continue;
+ }
+ $this->items[] = $this->extractItem($section, $subsection);
+ }
+ if(!empty($subsections)){
+ continue;
+ }
+ $this->items[] = $this->extractItem($section);
+ }
+ }
}
-
-
diff --git a/bridges/LesJoiesDuCodeBridge.php b/bridges/LesJoiesDuCodeBridge.php
index cde49776..79dfc5ea 100644
--- a/bridges/LesJoiesDuCodeBridge.php
+++ b/bridges/LesJoiesDuCodeBridge.php
@@ -1,47 +1,45 @@
find('div.blog-post') as $element) {
- $item = array();
- $temp = $element->find('h1 a', 0);
- $titre = html_entity_decode($temp->innertext);
- $url = $temp->href;
+ foreach($html->find('div.blog-post') as $element){
+ $item = array();
+ $temp = $element->find('h1 a', 0);
+ $titre = html_entity_decode($temp->innertext);
+ $url = $temp->href;
- $temp = $element->find('div.blog-post-content', 0);
+ $temp = $element->find('div.blog-post-content', 0);
- // retrieve .gif instead of static .jpg
- $images = $temp->find('p img');
- foreach($images as $image){
- $img_src = str_replace(".jpg",".gif",$image->src);
- $image->src = $img_src;
- }
- $content = $temp->innertext;
+ // retrieve .gif instead of static .jpg
+ $images = $temp->find('p img');
+ foreach($images as $image){
+ $img_src = str_replace(".jpg", ".gif", $image->src);
+ $image->src = $img_src;
+ }
+ $content = $temp->innertext;
- $auteur = $temp->find('i', 0);
- $pos = strpos($auteur->innertext, "by");
+ $auteur = $temp->find('i', 0);
+ $pos = strpos($auteur->innertext, "by");
- if($pos > 0)
- {
- $auteur = trim(str_replace("*/", "", substr($auteur->innertext, ($pos + 2))));
- $item['author'] = $auteur;
- }
+ if($pos > 0){
+ $auteur = trim(str_replace("*/", "", substr($auteur->innertext, ($pos + 2))));
+ $item['author'] = $auteur;
+ }
+ $item['content'] .= trim($content);
+ $item['uri'] = $url;
+ $item['title'] = trim($titre);
- $item['content'] .= trim($content);
- $item['uri'] = $url;
- $item['title'] = trim($titre);
-
- $this->items[] = $item;
- }
- }
+ $this->items[] = $item;
+ }
+ }
}
diff --git a/bridges/LichessBridge.php b/bridges/LichessBridge.php
index e0657b86..bf7369fb 100644
--- a/bridges/LichessBridge.php
+++ b/bridges/LichessBridge.php
@@ -1,31 +1,31 @@
collectExpandableDatas(self::URI . '.atom', 5);
- }
+ public function collectData(){
+ $this->collectExpandableDatas(self::URI . '.atom', 5);
+ }
- protected function parseItem($newsItem){
- $item = parent::parseItem($newsItem);
- $item['content'] = $this->retrieve_lichess_post($item['uri']);
- return $item;
- }
+ protected function parseItem($newsItem){
+ $item = parent::parseItem($newsItem);
+ $item['content'] = $this->retrieveLichessPost($item['uri']);
+ return $item;
+ }
- private function retrieve_lichess_post($blog_post_uri){
- $blog_post_html = getSimpleHTMLDOMCached($blog_post_uri);
- $blog_post_div = $blog_post_html->find('#lichess_blog', 0);
+ private function retrieveLichessPost($blog_post_uri){
+ $blog_post_html = getSimpleHTMLDOMCached($blog_post_uri);
+ $blog_post_div = $blog_post_html->find('#lichess_blog', 0);
- $post_chapo = $blog_post_div->find('.shortlede', 0)->innertext;
- $post_content = $blog_post_div->find('.body', 0)->innertext;
+ $post_chapo = $blog_post_div->find('.shortlede', 0)->innertext;
+ $post_content = $blog_post_div->find('.body', 0)->innertext;
- $content = '' . $post_chapo . '
';
- $content .= '' . $post_content . '
';
+ $content = '' . $post_chapo . '
';
+ $content .= '' . $post_content . '
';
- return $content;
- }
+ return $content;
+ }
}
diff --git a/bridges/LinkedInCompanyBridge.php b/bridges/LinkedInCompanyBridge.php
index 7e966f61..73cdcbf0 100644
--- a/bridges/LinkedInCompanyBridge.php
+++ b/bridges/LinkedInCompanyBridge.php
@@ -1,36 +1,37 @@
apple)";
+ const DESCRIPTION = 'Returns most recent actus from Company on LinkedIn.
+ (https://www.linkedin.com/company/apple)';
- const PARAMETERS = array( array(
- 'c'=>array(
- 'name'=>'Company name',
- 'required'=>true
- )
- ));
+ const PARAMETERS = array( array(
+ 'c' => array(
+ 'name' => 'Company name',
+ 'required' => true
+ )
+ ));
- public function collectData(){
- $html = '';
- $link = self::URI.'company/'.$this->getInput('c');
+ public function collectData(){
+ $html = '';
+ $link = self::URI . 'company/' . $this->getInput('c');
- $html = getSimpleHTMLDOM($link)
- or returnServerError('Could not request LinkedIn.');
+ $html = getSimpleHTMLDOM($link)
+ or returnServerError('Could not request LinkedIn.');
- foreach($html->find('//*[@id="my-feed-post"]/li') as $element) {
- $title = $element->find('span.share-body', 0)->innertext;
- if ($title) {
- $item = array();
- $item['uri'] = $link;
- $item['title'] = mb_substr(strip_tags($element->find('span.share-body', 0)->innertext), 0 ,100);
- $item['content'] = strip_tags($element->find('span.share-body', 0)->innertext);
- $this->items[] = $item;
- $i++;
- }
- }
- }
+ foreach($html->find('//*[@id="my-feed-post"]/li') as $element){
+ $title = $element->find('span.share-body', 0)->innertext;
+ if($title){
+ $item = array();
+ $item['uri'] = $link;
+ $item['title'] = mb_substr(strip_tags($element->find('span.share-body', 0)->innertext), 0, 100);
+ $item['content'] = strip_tags($element->find('span.share-body', 0)->innertext);
+ $this->items[] = $item;
+ $i++;
+ }
+ }
+ }
}
diff --git a/bridges/LolibooruBridge.php b/bridges/LolibooruBridge.php
index 781bc238..b5bbd754 100644
--- a/bridges/LolibooruBridge.php
+++ b/bridges/LolibooruBridge.php
@@ -1,11 +1,11 @@
array(),
- 'Get popular mangas' => array(
- 'category' => array(
- 'name' => 'Category',
- 'type' => 'list',
- 'required' => true,
- 'values' => array(
- 'All' => 'all',
- 'Action' => 'action',
- 'Adventure' => 'adventure',
- 'Comedy' => 'comedy',
- 'Demons' => 'demons',
- 'Drama' => 'drama',
- 'Ecchi' => 'ecchi',
- 'Fantasy' => 'fantasy',
- 'Gender Bender' => 'gender-bender',
- 'Harem' => 'harem',
- 'Historical' => 'historical',
- 'Horror' => 'horror',
- 'Josei' => 'josei',
- 'Magic' => 'magic',
- 'Martial Arts' => 'martial-arts',
- 'Mature' => 'mature',
- 'Mecha' => 'mecha',
- 'Military' => 'military',
- 'Mystery' => 'mystery',
- 'One Shot' => 'one-shot',
- 'Psychological' => 'psychological',
- 'Romance' => 'romance',
- 'School Life' => 'school-life',
- 'Sci-Fi' => 'sci-fi',
- 'Seinen' => 'seinen',
- 'Shoujo' => 'shoujo',
- 'Shoujoai' => 'shoujoai',
- 'Shounen' => 'shounen',
- 'Shounenai' => 'shounenai',
- 'Slice of Life' => 'slice-of-life',
- 'Smut' => 'smut',
- 'Sports' => 'sports',
- 'Super Power' => 'super-power',
- 'Supernatural' => 'supernatural',
- 'Tragedy' => 'tragedy',
- 'Vampire' => 'vampire',
- 'Yaoi' => 'yaoi',
- 'Yuri' => 'yuri'
- ),
- 'exampleValue' => 'All',
- 'title' => 'Select your category'
- )
- ),
- 'Get manga updates' => array(
- 'path' => array(
- 'name' => 'Path',
- 'required' => true,
- 'pattern' => '[a-zA-Z0-9-_]*',
- 'exampleValue' => 'bleach, umi-no-kishidan',
- 'title' => 'URL part of desired manga'
- ),
- 'limit' => array(
- 'name' => 'Limit',
- 'type' => 'number',
- 'defaultValue' => 10,
- 'title' => 'Number of items to return [-1 returns all]'
- )
- )
- );
+ const PARAMETERS = array(
+ 'Get latest updates' => array(),
+ 'Get popular mangas' => array(
+ 'category' => array(
+ 'name' => 'Category',
+ 'type' => 'list',
+ 'required' => true,
+ 'values' => array(
+ 'All' => 'all',
+ 'Action' => 'action',
+ 'Adventure' => 'adventure',
+ 'Comedy' => 'comedy',
+ 'Demons' => 'demons',
+ 'Drama' => 'drama',
+ 'Ecchi' => 'ecchi',
+ 'Fantasy' => 'fantasy',
+ 'Gender Bender' => 'gender-bender',
+ 'Harem' => 'harem',
+ 'Historical' => 'historical',
+ 'Horror' => 'horror',
+ 'Josei' => 'josei',
+ 'Magic' => 'magic',
+ 'Martial Arts' => 'martial-arts',
+ 'Mature' => 'mature',
+ 'Mecha' => 'mecha',
+ 'Military' => 'military',
+ 'Mystery' => 'mystery',
+ 'One Shot' => 'one-shot',
+ 'Psychological' => 'psychological',
+ 'Romance' => 'romance',
+ 'School Life' => 'school-life',
+ 'Sci-Fi' => 'sci-fi',
+ 'Seinen' => 'seinen',
+ 'Shoujo' => 'shoujo',
+ 'Shoujoai' => 'shoujoai',
+ 'Shounen' => 'shounen',
+ 'Shounenai' => 'shounenai',
+ 'Slice of Life' => 'slice-of-life',
+ 'Smut' => 'smut',
+ 'Sports' => 'sports',
+ 'Super Power' => 'super-power',
+ 'Supernatural' => 'supernatural',
+ 'Tragedy' => 'tragedy',
+ 'Vampire' => 'vampire',
+ 'Yaoi' => 'yaoi',
+ 'Yuri' => 'yuri'
+ ),
+ 'exampleValue' => 'All',
+ 'title' => 'Select your category'
+ )
+ ),
+ 'Get manga updates' => array(
+ 'path' => array(
+ 'name' => 'Path',
+ 'required' => true,
+ 'pattern' => '[a-zA-Z0-9-_]*',
+ 'exampleValue' => 'bleach, umi-no-kishidan',
+ 'title' => 'URL part of desired manga'
+ ),
+ 'limit' => array(
+ 'name' => 'Limit',
+ 'type' => 'number',
+ 'defaultValue' => 10,
+ 'title' => 'Number of items to return [-1 returns all]'
+ )
+ )
+ );
- private $request = '';
+ private $request = '';
- public function collectData(){
- // We'll use the DOM parser for this as it makes navigation easier
- $html = getContents($this->getURI());
- if(!$html){
- returnClientError('Could not receive data for ' . $path . '!');
- }
- libxml_use_internal_errors(true);
- $doc = new DomDocument;
- @$doc->loadHTML($html);
- libxml_clear_errors();
+ public function collectData(){
+ // We'll use the DOM parser for this as it makes navigation easier
+ $html = getContents($this->getURI());
+ if(!$html){
+ returnClientError('Could not receive data for ' . $path . '!');
+ }
+ libxml_use_internal_errors(true);
+ $doc = new DomDocument;
+ @$doc->loadHTML($html);
+ libxml_clear_errors();
- // Navigate via XPath
- $xpath = new DomXPath($doc);
+ // Navigate via XPath
+ $xpath = new DomXPath($doc);
- $this->request = '';
- switch($this->queriedContext){
- case 'Get latest updates':
- $this->request = 'Latest updates';
- $this->get_latest_updates($xpath);
- break;
- case 'Get popular mangas':
- // Find manga name within "Popular mangas for ..."
- $pagetitle = $xpath->query(".//*[@id='bodyalt']/h1")->item(0)->nodeValue;
- $this->request = substr($pagetitle, 0, strrpos($pagetitle, " -"));
- $this->get_popular_mangas($xpath);
- break;
- case 'Get manga updates':
- $limit = $this->getInput('limit');
- if(empty($limit)){
- $limit = self::PARAMETERS[$this->queriedContext]['limit']['defaultValue'];
- }
+ $this->request = '';
+ switch($this->queriedContext){
+ case 'Get latest updates':
+ $this->request = 'Latest updates';
+ $this->getLatestUpdates($xpath);
+ break;
+ case 'Get popular mangas':
+ // Find manga name within "Popular mangas for ..."
+ $pagetitle = $xpath->query(".//*[@id='bodyalt']/h1")->item(0)->nodeValue;
+ $this->request = substr($pagetitle, 0, strrpos($pagetitle, " -"));
+ $this->getPopularMangas($xpath);
+ break;
+ case 'Get manga updates':
+ $limit = $this->getInput('limit');
+ if(empty($limit)){
+ $limit = self::PARAMETERS[$this->queriedContext]['limit']['defaultValue'];
+ }
- $this->request = $xpath->query(".//*[@id='mangaproperties']//*[@class='aname']")
- ->item(0)
- ->nodeValue;
+ $this->request = $xpath->query(".//*[@id='mangaproperties']//*[@class='aname']")
+ ->item(0)
+ ->nodeValue;
- $this->get_manga_updates($xpath, $limit);
- break;
- }
+ $this->getMangaUpdates($xpath, $limit);
+ break;
+ }
- // Return some dummy-data if no content available
- if(empty($this->items)){
- $item = array();
- $item['content'] = "No updates available
";
+ // Return some dummy-data if no content available
+ if(empty($this->items)){
+ $item = array();
+ $item['content'] = "No updates available
";
- $this->items[] = $item;
- }
- }
+ $this->items[] = $item;
+ }
+ }
- private function get_latest_updates($xpath){
- // Query each item (consists of Manga + chapters)
- $nodes = $xpath->query("//*[@id='latestchapters']/table//td");
+ private function getLatestUpdates($xpath){
+ // Query each item (consists of Manga + chapters)
+ $nodes = $xpath->query("//*[@id='latestchapters']/table//td");
- foreach ($nodes as $node){
- // Query the manga
- $manga = $xpath->query("a[@class='chapter']", $node)->item(0);
+ foreach ($nodes as $node){
+ // Query the manga
+ $manga = $xpath->query("a[@class='chapter']", $node)->item(0);
- // Collect the chapters for each Manga
- $chapters = $xpath->query("a[@class='chaptersrec']", $node);
+ // Collect the chapters for each Manga
+ $chapters = $xpath->query("a[@class='chaptersrec']", $node);
- if (isset($manga) && $chapters->length >= 1){
- $item = array();
- $item['uri'] = self::URI . htmlspecialchars($manga->getAttribute('href'));
- $item['title'] = htmlspecialchars($manga->nodeValue);
+ if (isset($manga) && $chapters->length >= 1){
+ $item = array();
+ $item['uri'] = self::URI . htmlspecialchars($manga->getAttribute('href'));
+ $item['title'] = htmlspecialchars($manga->nodeValue);
- // Add each chapter to the feed
- $item['content'] = "";
+ // Add each chapter to the feed
+ $item['content'] = "";
- foreach ($chapters as $chapter){
- if($item['content'] <> ""){
- $item['content'] .= "
";
- }
- $item['content'] .=
- ""
- . htmlspecialchars($chapter->nodeValue)
- . "";
- }
+ foreach ($chapters as $chapter){
+ if($item['content'] <> ""){
+ $item['content'] .= "
";
+ }
+ $item['content'] .= ""
+ . htmlspecialchars($chapter->nodeValue)
+ . "";
+ }
- $this->items[] = $item;
- }
- }
- }
+ $this->items[] = $item;
+ }
+ }
+ }
- private function get_popular_mangas($xpath){
- // Query all mangas
- $mangas = $xpath->query("//*[@id='mangaresults']/*[@class='mangaresultitem']");
+ private function getPopularMangas($xpath){
+ // Query all mangas
+ $mangas = $xpath->query("//*[@id='mangaresults']/*[@class='mangaresultitem']");
- foreach ($mangas as $manga){
+ foreach ($mangas as $manga){
- // The thumbnail is encrypted in a css-style...
- // format: "background-image:url('')"
- $mangaimgelement = $xpath->query(".//*[@class='imgsearchresults']", $manga)
- ->item(0)
- ->getAttribute('style');
- $thumbnail = substr($mangaimgelement, 22, strlen($mangaimgelement) - 24);
+ // The thumbnail is encrypted in a css-style...
+ // format: "background-image:url('')"
+ $mangaimgelement = $xpath->query(".//*[@class='imgsearchresults']", $manga)
+ ->item(0)
+ ->getAttribute('style');
+ $thumbnail = substr($mangaimgelement, 22, strlen($mangaimgelement) - 24);
- $item = array();
- $item['title'] = htmlspecialchars($xpath->query(".//*[@class='manga_name']//a", $manga)
- ->item(0)
- ->nodeValue);
- $item['uri'] = self::URI . $xpath->query(".//*[@class='manga_name']//a", $manga)
- ->item(0)
- ->getAttribute('href');
- $item['author'] = htmlspecialchars($xpath->query("//*[@class='author_name']", $manga)
- ->item(0)
- ->nodeValue);
- $item['chaptercount'] = $xpath->query(".//*[@class='chapter_count']", $manga)
- ->item(0)
- ->nodeValue;
- $item['genre'] = htmlspecialchars($xpath->query(".//*[@class='manga_genre']", $manga)
- ->item(0)
- ->nodeValue);
- $item['content'] = <<query(".//*[@class='manga_name']//a", $manga)
+ ->item(0)
+ ->nodeValue);
+ $item['uri'] = self::URI . $xpath->query(".//*[@class='manga_name']//a", $manga)
+ ->item(0)
+ ->getAttribute('href');
+ $item['author'] = htmlspecialchars($xpath->query("//*[@class='author_name']", $manga)
+ ->item(0)
+ ->nodeValue);
+ $item['chaptercount'] = $xpath->query(".//*[@class='chapter_count']", $manga)
+ ->item(0)
+ ->nodeValue;
+ $item['genre'] = htmlspecialchars($xpath->query(".//*[@class='manga_genre']", $manga)
+ ->item(0)
+ ->nodeValue);
+ $item['content'] = <<
{$item['genre']}
{$item['chaptercount']}
EOD;
- $this->items[] = $item;
- }
- }
+ $this->items[] = $item;
+ }
+ }
- private function get_manga_updates($xpath, $limit){
- $query = "(.//*[@id='listing']//tr)[position() > 1]";
+ private function getMangaUpdates($xpath, $limit){
+ $query = "(.//*[@id='listing']//tr)[position() > 1]";
- if($limit !== -1){
- $query = "(.//*[@id='listing']//tr)[position() > 1][position() > last() - {$limit}]";
- }
+ if($limit !== -1){
+ $query = "(.//*[@id='listing']//tr)[position() > 1][position() > last() - {$limit}]";
+ }
- $chapters = $xpath->query($query);
+ $chapters = $xpath->query($query);
- foreach ($chapters as $chapter){
- $item = array();
- $item['title'] = htmlspecialchars($xpath->query("td[1]", $chapter)
- ->item(0)
- ->nodeValue);
- $item['uri'] = self::URI . $xpath->query("td[1]/a", $chapter)
- ->item(0)
- ->getAttribute('href');
- $item['timestamp'] = strtotime($xpath->query("td[2]", $chapter)
- ->item(0)
- ->nodeValue);
- array_unshift($this->items, $item);
- }
- }
+ foreach ($chapters as $chapter){
+ $item = array();
+ $item['title'] = htmlspecialchars($xpath->query("td[1]", $chapter)
+ ->item(0)
+ ->nodeValue);
+ $item['uri'] = self::URI . $xpath->query("td[1]/a", $chapter)
+ ->item(0)
+ ->getAttribute('href');
+ $item['timestamp'] = strtotime($xpath->query("td[2]", $chapter)
+ ->item(0)
+ ->nodeValue);
+ array_unshift($this->items, $item);
+ }
+ }
- public function getURI(){
- switch($this->queriedContext){
- case 'Get latest updates':
- $path = "latest";
- break;
- case 'Get popular mangas':
- $path = "popular";
- if($this->getInput('category') !== "all"){
- $path .= "/" . $this->getInput('category');
- }
- break;
- case 'Get manga updates':
- $path = $this->getInput('path');
- break;
- default: return parent::getURI();
- }
- return self::URI . $path;
- }
+ public function getURI(){
+ switch($this->queriedContext){
+ case 'Get latest updates':
+ $path = "latest";
+ break;
+ case 'Get popular mangas':
+ $path = "popular";
+ if($this->getInput('category') !== "all"){
+ $path .= "/" . $this->getInput('category');
+ }
+ break;
+ case 'Get manga updates':
+ $path = $this->getInput('path');
+ break;
+ default: return parent::getURI();
+ }
+ return self::URI . $path;
+ }
-
- public function getName(){
- return (!empty($this->request) ? $this->request . ' - ' : '') . 'Mangareader Bridge';
- }
+ public function getName(){
+ return (!empty($this->request) ? $this->request . ' - ' : '') . 'Mangareader Bridge';
+ }
}
-?>
diff --git a/bridges/MilbooruBridge.php b/bridges/MilbooruBridge.php
index bc10c3f9..c3b633ea 100644
--- a/bridges/MilbooruBridge.php
+++ b/bridges/MilbooruBridge.php
@@ -1,11 +1,11 @@
array(
- 'name' => 'username',
- 'required' => true,
- )));
+ const PARAMETERS = array(array(
+ 'u' => array(
+ 'name' => 'username',
+ 'required' => true,
+ )
+ ));
- public function getName(){
+ public function getName(){
+ return 'MixCloud - ' . $this->getInput('u');
+ }
- return 'MixCloud - '.$this->getInput('u');
- }
+ public function collectData(){
- public function collectData() {
+ $html = getSimpleHTMLDOM(self::URI . '/' . $this->getInput('u'))
+ or returnServerError('Could not request MixCloud.');
- $html = getSimpleHTMLDOM(self::URI.'/'.$this->getInput('u'))
- or returnServerError('Could not request MixCloud.');
+ foreach($html->find('div.card-elements-container') as $element){
- foreach($html->find('div.card-elements-container') as $element) {
+ $item = array();
- $item = array();
+ $item['uri'] = self::URI . $element->find('h3.card-cloudcast-title a', 0)->getAttribute('href');
+ $item['title'] = html_entity_decode(
+ $element->find('h3.card-cloudcast-title a span', 0)->getAttribute('title'),
+ ENT_QUOTES
+ );
- $item['uri'] = self::URI.$element->find('h3.card-cloudcast-title a', 0)->getAttribute('href');
- $item['title'] = html_entity_decode($element->find('h3.card-cloudcast-title a span', 0)->getAttribute('title'), ENT_QUOTES);
+ $image = $element->find('img.image-for-cloudcast', 0);
- $image = $element->find('img.image-for-cloudcast', 0);
+ if($image){
+ $item['content'] = '
';
+ }
- if( $image ) {
+ $item['author'] = trim($element->find('h4.card-cloudcast-user a', 0)->innertext);
- $item['content'] = '
';
- }
-
- $item['author'] = trim($element->find('h4.card-cloudcast-user a', 0)->innertext);
-
- $this->items[] = $item;
- }
- }
+ $this->items[] = $item;
+ }
+ }
}
diff --git a/bridges/MoebooruBridge.php b/bridges/MoebooruBridge.php
index 716ae81a..787a45f7 100644
--- a/bridges/MoebooruBridge.php
+++ b/bridges/MoebooruBridge.php
@@ -1,47 +1,56 @@
array(
- 'name'=>'page',
- 'defaultValue'=>1,
- 'type'=>'number'
- ),
- 't'=>array('name'=>'tags')
- ));
+ const PARAMETERS = array( array(
+ 'p' => array(
+ 'name' => 'page',
+ 'defaultValue' => 1,
+ 'type' => 'number'
+ ),
+ 't' => array(
+ 'name' => 'tags'
+ )
+ ));
- protected function getFullURI(){
- return $this->getURI().'post?'
- .'page='.$this->getInput('p')
- .'&tags='.urlencode($this->getInput('t'));
- }
+ protected function getFullURI(){
+ return $this->getURI()
+ . 'post?page='
+ . $this->getInput('p')
+ . '&tags='
+ . urlencode($this->getInput('t'));
+ }
- public function collectData(){
- $html = getSimpleHTMLDOM($this->getFullURI())
- or returnServerError('Could not request '.$this->getName());
+ public function collectData(){
+ $html = getSimpleHTMLDOM($this->getFullURI())
+ or returnServerError('Could not request ' . $this->getName());
+ $input_json = explode('Post.register(', $html);
+ foreach($input_json as $element)
+ $data[] = preg_replace('/}\)(.*)/', '}', $element);
+ unset($data[0]);
- $input_json = explode('Post.register(', $html);
- foreach($input_json as $element)
- $data[] = preg_replace('/}\)(.*)/', '}', $element);
- unset($data[0]);
+ foreach($data as $datai){
+ $json = json_decode($datai, true);
+ $item = array();
+ $item['uri'] = $this->getURI() . '/post/show/' . $json['id'];
+ $item['postid'] = $json['id'];
+ $item['timestamp'] = $json['created_at'];
+ $item['imageUri'] = $json['file_url'];
+ $item['title'] = $this->getName() . ' | ' . $json['id'];
+ $item['content'] = '
Tags: '
+ . $json['tags'];
- foreach($data as $datai) {
- $json = json_decode($datai, TRUE);
- $item = array();
- $item['uri'] = $this->getURI().'/post/show/'.$json['id'];
- $item['postid'] = $json['id'];
- $item['timestamp'] = $json['created_at'];
- $item['imageUri'] = $json['file_url'];
- $item['title'] = $this->getName().' | '.$json['id'];
- $item['content'] = '
Tags: '.$json['tags'];
- $this->items[] = $item;
- }
- }
+ $this->items[] = $item;
+ }
+ }
}
diff --git a/bridges/MondeDiploBridge.php b/bridges/MondeDiploBridge.php
index e0cf78c0..b543c64b 100644
--- a/bridges/MondeDiploBridge.php
+++ b/bridges/MondeDiploBridge.php
@@ -1,22 +1,25 @@
find('div.unarticle') as $article) {
+ foreach($html->find('div.unarticle') as $article){
$element = $article->parent();
$item = array();
$item['uri'] = self::URI . $element->href;
$item['title'] = $element->find('h3', 0)->plaintext;
- $item['content'] = $element->find('div.dates_auteurs', 0)->plaintext . '
' . strstr($element->find('div', 0)->plaintext, $element->find('div.dates_auteurs', 0)->plaintext, true);
+ $item['content'] = $element->find('div.dates_auteurs', 0)->plaintext
+ . '
'
+ . strstr($element->find('div', 0)->plaintext, $element->find('div.dates_auteurs', 0)->plaintext, true);
+
$this->items[] = $item;
}
}
diff --git a/bridges/MsnMondeBridge.php b/bridges/MsnMondeBridge.php
index 348bdb91..a6679f2d 100644
--- a/bridges/MsnMondeBridge.php
+++ b/bridges/MsnMondeBridge.php
@@ -1,30 +1,32 @@
find('#content', 0)->find('article', 0)->find('section', 0)->plaintext;
$item['timestamp'] = strtotime($html2->find('.authorinfo-txt', 0)->find('time', 0)->datetime);
}
public function collectData(){
- $html = getSimpleHTMLDOM($this->getURI()) or returnServerError('Could not request MsnMonde.');
+ $html = getSimpleHTMLDOM($this->getURI())
+ or returnServerError('Could not request MsnMonde.');
+
$limit = 0;
- foreach($html->find('.smalla') as $article) {
- if($limit < 10) {
+ foreach($html->find('.smalla') as $article){
+ if($limit < 10){
$item = array();
$item['title'] = utf8_decode($article->find('h4', 0)->innertext);
$item['uri'] = self::URI . utf8_decode($article->find('a', 0)->href);
- $this->MsnMondeExtractContent($item['uri'], $item);
+ $this->msnMondeExtractContent($item['uri'], $item);
$this->items[] = $item;
$limit++;
}
diff --git a/bridges/MspabooruBridge.php b/bridges/MspabooruBridge.php
index 96ae52ad..00a7bd71 100644
--- a/bridges/MspabooruBridge.php
+++ b/bridges/MspabooruBridge.php
@@ -1,12 +1,12 @@
", $html->find('b', 0)->innertext);
+ $html = getSimpleHTMLDOM(self::URI . 'archivepix.html')
+ or returnServerError('Error while downloading the website content');
- for($i = 0; $i < 3;$i++)
- {
- $line = $list[$i];
- $item = array();
+ $list = explode("
", $html->find('b', 0)->innertext);
- $uri_page = $html->find('a',$i + 3)->href;
- $uri = self::URI.$uri_page;
- $item['uri'] = $uri;
+ for($i = 0; $i < 3; $i++){
+ $line = $list[$i];
+ $item = array();
- $picture_html = getSimpleHTMLDOM($uri);
- $picture_html_string = $picture_html->innertext;
+ $uri_page = $html->find('a', $i + 3)->href;
+ $uri = self::URI . $uri_page;
+ $item['uri'] = $uri;
- //Extract image and explanation
- $media = $picture_html->find('p',1)->innertext;
- $media = strstr($media, '
');
- $media = preg_replace('/
/', '', $media, 1);
- $explanation = $picture_html->find('p',2)->innertext;
+ $picture_html = getSimpleHTMLDOM($uri);
+ $picture_html_string = $picture_html->innertext;
- //Extract date from the picture page
- $date = explode(" ", $picture_html->find('p',1)->innertext);
- $item['timestamp'] = strtotime($date[4].$date[3].$date[2]);
+ //Extract image and explanation
+ $media = $picture_html->find('p', 1)->innertext;
+ $media = strstr($media, '
');
+ $media = preg_replace('/
/', '', $media, 1);
+ $explanation = $picture_html->find('p', 2)->innertext;
- //Other informations
- $item['content'] = $media.'
'.$explanation;
- $item['title'] = $picture_html->find('b',0)->innertext;
- $this->items[] = $item;
- }
- }
+ //Extract date from the picture page
+ $date = explode(" ", $picture_html->find('p', 1)->innertext);
+ $item['timestamp'] = strtotime($date[4] . $date[3] . $date[2]);
+
+ //Other informations
+ $item['content'] = $media . '
' . $explanation;
+ $item['title'] = $picture_html->find('b', 0)->innertext;
+ $this->items[] = $item;
+ }
+ }
}
diff --git a/bridges/NeuviemeArtBridge.php b/bridges/NeuviemeArtBridge.php
index 0bf3ce38..2b899411 100644
--- a/bridges/NeuviemeArtBridge.php
+++ b/bridges/NeuviemeArtBridge.php
@@ -1,17 +1,19 @@
find('img.img_full') as $img){
if ($img->alt == $item['title']){
- $article_image = self::URI.$img->src;
+ $article_image = self::URI . $img->src;
break;
}
}
- $article_content='';
+ $article_content = '';
if($article_image){
- $article_content = '
';
+ $article_content = '
';
}
$article_content .= str_replace(
- 'src="/', 'src="'.self::URI,
+ 'src="/', 'src="' . self::URI,
$article_html->find('div.newsGenerique_con', 0)->innertext
);
- $article_content = $this->StripWithDelimiters($article_content, '');
+ $article_content = $this->stripWithDelimiters($article_content, '