DansTonChatBridge.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. class DansTonChatBridge extends BridgeAbstract{
  3. public function loadMetadatas() {
  4. $this->maintainer = "Astalaseven";
  5. $this->name = "DansTonChat Bridge";
  6. $this->uri = "http://danstonchat.com/latest.html";
  7. $this->description = "Returns latest quotes from DansTonChat.";
  8. $this->update = "2014-05-25";
  9. }
  10. public function collectData(array $param){
  11. $html = '';
  12. $link = 'http://danstonchat.com/latest.html';
  13. $html = $this->file_get_html($link) or $this->returnError('Could not request DansTonChat.', 404);
  14. foreach($html->find('div.item') as $element) {
  15. $item = new \Item();
  16. $item->uri = $element->find('a', 0)->href;
  17. $item->title = 'DansTonChat '.$element->find('a', 1)->plaintext;
  18. $item->content = $element->find('a', 0)->innertext;
  19. $this->items[] = $item;
  20. }
  21. }
  22. public function getName(){
  23. return 'DansTonChat';
  24. }
  25. public function getURI(){
  26. return 'http://danstonchat.com';
  27. }
  28. public function getCacheDuration(){
  29. return 21600; // 6 hours
  30. }
  31. }