1
0

DilbertBridge.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. *
  4. * @name Dilbert Daily Strip
  5. * @homepage http://dilbert.com/strips/
  6. * @description The Unofficial Dilbert Daily Comic Strip
  7. * @update 30/01/2015
  8. * initial maintainer: superbaillot.net
  9. * @maintainer kranack
  10. */
  11. class DilbertBridge extends BridgeAbstract{
  12. public function collectData(array $param){
  13. $html = file_get_html('http://dilbert.com/strips/') or $this->returnError('Could not request Dilbert.', 404);
  14. foreach($html->find('section.comic-item') as $element) {
  15. $comic = $element->find('img', 0);
  16. $item = new Item();
  17. $item->uri = $element->find('a',0)->href;
  18. $item->content = '<img src="'. $comic->src . '" alt="' . $comic->alt . '" />';
  19. $item->title = $comic->alt;
  20. $item->timestamp = strtotime($element->find('h3', 0)->plaintext);
  21. $this->items[] = $item;
  22. }
  23. }
  24. public function getName(){
  25. return 'Dilbert';
  26. }
  27. public function getURI(){
  28. return 'http://dilbert.com';
  29. }
  30. public function getDescription(){
  31. return 'Dilbert via rss-bridge';
  32. }
  33. public function getCacheDuration(){
  34. return 14400; // 4 hours
  35. }
  36. }
  37. ?>