MondeDiploBridge.php 956 B

123456789101112131415161718192021222324252627
  1. <?php
  2. class MondeDiploBridge extends BridgeAbstract{
  3. public function loadMetadatas() {
  4. $this->maintainer = "Pitchoule";
  5. $this->name = 'Monde Diplomatique';
  6. $this->uri = 'http://www.monde-diplomatique.fr';
  7. $this->description = "Returns most recent results from MondeDiplo.";
  8. }
  9. public function collectData(array $param){
  10. $html = $this->getSimpleHTMLDOM($this->uri) or $this->returnServerError('Could not request MondeDiplo. for : ' . $link);
  11. foreach($html->find('div.unarticle') as $article) {
  12. $element = $article->parent();
  13. $item = array();
  14. $item['uri'] = $this->uri . $element->href;
  15. $item['title'] = $element->find('h3', 0)->plaintext;
  16. $item['content'] = $element->find('div.dates_auteurs', 0)->plaintext . '<br>' . strstr($element->find('div', 0)->plaintext, $element->find('div.dates_auteurs', 0)->plaintext, true);
  17. $this->items[] = $item;
  18. }
  19. }
  20. public function getCacheDuration(){
  21. return 21600; // 6 hours
  22. }
  23. }