DansTonChatBridge.php 951 B

12345678910111213141516171819202122232425262728293031
  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";
  7. $this->description = "Returns latest quotes from DansTonChat.";
  8. }
  9. public function collectData(array $param){
  10. $html = '';
  11. $link = 'http://danstonchat.com/latest.html';
  12. $html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request DansTonChat.');
  13. foreach($html->find('div.item') as $element) {
  14. $item = array();
  15. $item['uri'] = $element->find('a', 0)->href;
  16. $item['title'] = 'DansTonChat '.$element->find('a', 1)->plaintext;
  17. $item['content'] = $element->find('a', 0)->innertext;
  18. $this->items[] = $item;
  19. }
  20. }
  21. public function getCacheDuration(){
  22. return 21600; // 6 hours
  23. }
  24. }