rss-bridge/bridges/FootitoBridge.php
logmanoriginal a4b9611e66 [phpcs] Add missing rules
- Do not add spaces after opening or before closing parenthesis

  // Wrong
  if( !is_null($var) ) {
    ...
  }

  // Right
  if(!is_null($var)) {
    ...
  }

- Add space after closing parenthesis

  // Wrong
  if(true){
    ...
  }

  // Right
  if(true) {
    ...
  }

- Add body into new line
- Close body in new line

  // Wrong
  if(true) { ... }

  // Right
  if(true) {
    ...
  }

Notice: Spaces after keywords are not detected:

  // Wrong (not detected)
  // -> space after 'if' and missing space after 'else'
  if (true) {
    ...
  } else{
    ...
  }

  // Right
  if(true) {
    ...
  } else {
    ...
  }
2017-07-29 19:55:12 +02:00

75 řádky
1,8 KiB
PHP

<?php
class FootitoBridge extends BridgeAbstract {
const MAINTAINER = 'superbaillot.net';
const NAME = 'Footito';
const URI = 'http://www.footito.fr/';
const DESCRIPTION = 'Footito';
public function collectData(){
$html = getSimpleHTMLDOM(self::URI)
or returnServerError('Could not request Footito.');
foreach($html->find('div.post') as $element) {
$item = array();
$content = trim($element->innertext);
$content = str_replace(
"<img",
"<img style='float : left;'",
$content );
$content = str_replace(
"class=\"logo\"",
"style='float : left;'",
$content );
$content = str_replace(
"class=\"contenu\"",
"style='margin-left : 60px;'",
$content );
$content = str_replace(
"class=\"responsive-comment\"",
"style='border-top : 1px #DDD solid; background-color : white; padding : 10px;'",
$content );
$content = str_replace(
"class=\"jaime\"",
"style='display : none;'",
$content );
$content = str_replace(
"class=\"auteur-event responsive\"",
"style='display : none;'",
$content );
$content = str_replace(
"class=\"report-abuse-button\"",
"style='display : none;'",
$content );
$content = str_replace(
"class=\"reaction clearfix\"",
"style='margin : 10px 0px; padding : 5px; border-bottom : 1px #DDD solid;'",
$content );
$content = str_replace(
"class=\"infos\"",
"style='font-size : 0.7em;'",
$content );
$item['content'] = $content;
$title = $element->find('.contenu .texte ', 0)->plaintext;
$item['title'] = $title;
$info = $element->find('div.infos', 0);
$item['timestamp'] = strtotime($info->find('time', 0)->datetime);
$item['author'] = $info->find('a.auteur', 0)->plaintext;
$this->items[] = $item;
}
}
}