ViadeoCompanyBridge.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. class ViadeoCompanyBridge extends BridgeAbstract {
  3. const MAINTAINER = 'regisenguehard';
  4. const NAME = 'Viadeo Company';
  5. const URI = 'https://www.viadeo.com/';
  6. const CACHE_TIMEOUT = 21600; // 6h
  7. const DESCRIPTION = 'Returns most recent actus from Company on Viadeo.
  8. (http://www.viadeo.com/fr/company/<strong style="font-weight:bold;">apple</strong>)';
  9. const PARAMETERS = array( array(
  10. 'c' => array(
  11. 'name' => 'Company name',
  12. 'required' => true
  13. )
  14. ));
  15. public function collectData(){
  16. $html = '';
  17. $link = self::URI . 'fr/company/' . $this->getInput('c');
  18. $html = getSimpleHTMLDOM($link)
  19. or returnServerError('Could not request Viadeo.');
  20. foreach($html->find('//*[@id="company-newsfeed"]/ul/li') as $element) {
  21. $title = $element->find('p', 0)->innertext;
  22. if($title) {
  23. $item = array();
  24. $item['uri'] = $link;
  25. $item['title'] = mb_substr($element->find('p', 0)->innertext, 0, 100);
  26. $item['content'] = $element->find('p', 0)->innertext;;
  27. $this->items[] = $item;
  28. $i++;
  29. }
  30. }
  31. }
  32. }