RssBridge.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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__ . '/Authentication.php';
  16. require __DIR__ . '/Configuration.php';
  17. require __DIR__ . '/BridgeCard.php';
  18. require __DIR__ . '/BridgeList.php';
  19. require __DIR__ . '/validation.php';
  20. require __DIR__ . '/html.php';
  21. require __DIR__ . '/error.php';
  22. require __DIR__ . '/contents.php';
  23. $vendorLibSimpleHtmlDom = __DIR__ . PATH_VENDOR . '/simplehtmldom/simple_html_dom.php';
  24. if(!file_exists($vendorLibSimpleHtmlDom)) {
  25. throw new \HttpException('"PHP Simple HTML DOM Parser" library is missing.
  26. Get it from http://simplehtmldom.sourceforge.net and place the script "simple_html_dom.php" in '
  27. . substr(PATH_VENDOR, 4)
  28. . '/simplehtmldom/',
  29. 500);
  30. }
  31. require_once $vendorLibSimpleHtmlDom;
  32. /* Example use
  33. require_once __DIR__ . '/lib/RssBridge.php';
  34. // Data retrieval
  35. Bridge::setDir(__DIR__ . '/bridges/');
  36. $bridge = Bridge::create('GoogleSearch');
  37. $bridge->collectData($_REQUEST);
  38. // Data transformation
  39. Format::setDir(__DIR__ . '/formats/');
  40. $format = Format::create('Atom');
  41. $format
  42. ->setItems($bridge->getItems())
  43. ->setExtraInfos(array(
  44. 'name' => $bridge->getName(),
  45. 'uri' => $bridge->getURI(),
  46. ))
  47. ->display();
  48. */