1
0

Dilbert.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. *
  4. * @name Dilbert Daily Strip
  5. * @description The Unofficial Dilbert Daily Comic Strip RSS Feed via rss-bridge
  6. * @update 16/10/2013
  7. */
  8. class Dilbert extends BridgeAbstract{
  9. public function collectData(array $param){
  10. $html = file_get_html('http://dilbert.com/strips/') or $this->returnError('Could not request Dilbert.', 404);
  11. foreach($html->find('div.STR_Image') as $element) {
  12. $item = new Item();
  13. $href = $element->find('a',0)->href;
  14. $item->uri = 'http://dilbert.com' . $href;
  15. $content = str_replace('src="/', 'src="http://dilbert.com/',$element->innertext);
  16. $content = str_replace('href="/', 'href="http://dilbert.com/',$content);
  17. $item->content = $content;
  18. $time = strtotime(substr($href, (strrpos($href, "/", -10) + 1), 10));
  19. $item->title = date("d/m/Y", $time);
  20. $item->timestamp = $time;
  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. }