RssBridge.php 1.4 KB

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