RssBridge.php 1.5 KB

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