LesJoiesDuCode.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. *
  4. * @name Les Joies Du Code
  5. * @description LesJoiesDuCode via rss-bridge
  6. * @update 30/01/2014
  7. */
  8. class LesJoiesDuCode extends BridgeAbstract{
  9. public function collectData(array $param){
  10. $html = file_get_html('http://lesjoiesducode.fr/') or $this->returnError('Could not request LesJoiesDuCode.', 404);
  11. foreach($html->find('div.post') as $element) {
  12. $item = new Item();
  13. $temp = $element->find('h3 a', 0);
  14. $titre = $temp->innertext;
  15. $url = $temp->href;
  16. $temp = $element->find('div.bodytype', 0);
  17. $content = $temp->innertext;
  18. $auteur = $temp->find('.c1 em', 0);
  19. $pos = strpos($auteur->innertext, "by");
  20. if($pos > 0)
  21. {
  22. $auteur = trim(str_replace("*/", "", substr($auteur->innertext, ($pos + 2))));
  23. $item->name = $auteur;
  24. }
  25. $item->content .= trim($content);
  26. $item->uri = $url;
  27. $item->title = trim($titre);
  28. $this->items[] = $item;
  29. }
  30. }
  31. public function getName(){
  32. return 'Les Joies Du Code';
  33. }
  34. public function getURI(){
  35. return 'http://lesjoiesducode.fr/';
  36. }
  37. public function getCacheDuration(){
  38. return 7200; // 2h hours
  39. }
  40. public function getDescription(){
  41. return "Les Joies Du Code via rss-bridge";
  42. }
  43. }