FierPandaBridge.php 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. Class FierPandaBridge extends BridgeAbstract{
  3. public function loadMetadatas() {
  4. $this->maintainer = "snroki";
  5. $this->name = "Fier Panda Bridge";
  6. $this->uri = "http://www.fier-panda.fr/";
  7. $this->description = "Returns latest articles from Fier Panda.";
  8. }
  9. public function collectData(array $param){
  10. $link = 'http://www.fier-panda.fr/';
  11. $html = $this->getSimpleHTMLDOM($link) or $this->returnServerError('Could not request Fier Panda.');
  12. foreach($html->find('div.container-content article') as $element) {
  13. $item = array();
  14. $item['uri'] = $this->getURI().$element->find('a', 0)->href;
  15. $item['title'] = trim($element->find('h2 a', 0)->innertext);
  16. // Remove the link at the end of the article
  17. $element->find('p a', 0)->outertext = '';
  18. $item['content'] = $element->find('p', 0)->innertext;
  19. $this->items[] = $item;
  20. }
  21. }
  22. public function getCacheDuration(){
  23. return 21600; // 6 hours
  24. }
  25. }