DansTonChatBridge.php 860 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. class DansTonChatBridge extends BridgeAbstract {
  3. const MAINTAINER = 'Astalaseven';
  4. const NAME = 'DansTonChat Bridge';
  5. const URI = 'https://danstonchat.com/';
  6. const CACHE_TIMEOUT = 21600; //6h
  7. const DESCRIPTION = 'Returns latest quotes from DansTonChat.';
  8. public function collectData(){
  9. $html = getSimpleHTMLDOM(self::URI . 'latest.html')
  10. or returnServerError('Could not request DansTonChat.');
  11. foreach($html->find('div.item') as $element) {
  12. $item = array();
  13. $item['uri'] = $element->find('a', 0)->href;
  14. $titleContent = $element->find('h3 a', 0);
  15. if($titleContent) {
  16. $item['title'] = 'DansTonChat ' . html_entity_decode($titleContent->plaintext, ENT_QUOTES);
  17. } else {
  18. $item['title'] = 'DansTonChat';
  19. }
  20. $item['content'] = $element->find('div.item-content a', 0)->innertext;
  21. $this->items[] = $item;
  22. }
  23. }
  24. }