RssBridge.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /* rss-bridge library.
  3. Foundation functions for rss-bridge project.
  4. See https://github.com/sebsauvage/rss-bridge
  5. Licence: Public domain.
  6. */
  7. define('PATH_VENDOR', '/../vendor');
  8. require __DIR__ . '/Exceptions.php';
  9. require __DIR__ . '/Format.php';
  10. require __DIR__ . '/FormatAbstract.php';
  11. require __DIR__ . '/Bridge.php';
  12. require __DIR__ . '/BridgeAbstract.php';
  13. require __DIR__ . '/FeedExpander.php';
  14. require __DIR__ . '/Cache.php';
  15. require __DIR__ . '/CacheAbstract.php';
  16. require __DIR__ . '/HTMLUtils.php';
  17. $vendorLibSimpleHtmlDom = __DIR__ . PATH_VENDOR . '/simplehtmldom/simple_html_dom.php';
  18. if( !file_exists($vendorLibSimpleHtmlDom) ){
  19. throw new \HttpException('"PHP Simple HTML DOM Parser" library is missing.'
  20. . ' Get it from http://simplehtmldom.sourceforge.net and place the script'
  21. . ' "simple_html_dom.php" in '
  22. . substr(PATH_VENDOR,4)
  23. . '/simplehtmldom/'
  24. , 500);
  25. }
  26. require_once $vendorLibSimpleHtmlDom;
  27. /* Example use
  28. require_once __DIR__ . '/lib/RssBridge.php';
  29. // Data retrieval
  30. Bridge::setDir(__DIR__ . '/bridges/');
  31. $bridge = Bridge::create('GoogleSearch');
  32. $bridge->collectData($_REQUEST);
  33. // Data transformation
  34. Format::setDir(__DIR__ . '/formats/');
  35. $format = Format::create('Atom');
  36. $format
  37. ->setItems($bridge->getItems())
  38. ->setExtraInfos(array(
  39. 'name' => $bridge->getName(),
  40. 'uri' => $bridge->getURI(),
  41. ))
  42. ->display();
  43. */