FootitoBridge.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. *
  4. * @name Footito
  5. * @homepage http://www.footito.fr/
  6. * @description Footito
  7. * @update 21/11/2013
  8. * initial maintainer: superbaillot.net
  9. */
  10. class FootitoBridge extends BridgeAbstract{
  11. public function collectData(array $param){
  12. $html = file_get_html('http://www.footito.fr/') or $this->returnError('Could not request Footito.', 404);
  13. foreach($html->find('div.post') as $element) {
  14. $item = new Item();
  15. $content = trim($element->innertext);
  16. $content = str_replace("<img", "<img style='float : left;'", $content );
  17. $content = str_replace("class=\"logo\"", "style='float : left;'", $content );
  18. $content = str_replace("class=\"contenu\"", "style='margin-left : 60px;'", $content );
  19. $content = str_replace("class=\"responsive-comment\"", "style='border-top : 1px #DDD solid; background-color : white; padding : 10px;'", $content );
  20. $content = str_replace("class=\"jaime\"", "style='display : none;'", $content );
  21. $content = str_replace("class=\"auteur-event responsive\"", "style='display : none;'", $content );
  22. $content = str_replace("class=\"report-abuse-button\"", "style='display : none;'", $content );
  23. $content = str_replace("class=\"reaction clearfix\"", "style='margin : 10px 0px; padding : 5px; border-bottom : 1px #DDD solid;'", $content );
  24. $content = str_replace("class=\"infos\"", "style='font-size : 0.7em;'", $content );
  25. $item->content = $content;
  26. $title = $element->find('.contenu .texte ', 0)->plaintext;
  27. $item->title = $title;
  28. $info = $element->find('div.infos', 0);
  29. $item->timestamp = strtotime($info->find('time', 0)->datetime);
  30. $item->name = $info->find('a.auteur', 0)->plaintext;
  31. $this->items[] = $item;
  32. }
  33. }
  34. public function getName(){
  35. return 'footito';
  36. }
  37. public function getURI(){
  38. return 'http://www.footito.fr/';
  39. }
  40. public function getCacheDuration(){
  41. return 3600; // 1h hours
  42. }
  43. public function getDescription(){
  44. return "Footito via rss-bridge";
  45. }
  46. }
  47. ?>