RssBridge.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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__ . '/Item.php';
  10. require __DIR__ . '/Format.php';
  11. require __DIR__ . '/Bridge.php';
  12. require __DIR__ . '/Cache.php';
  13. require __DIR__ . '/HTMLUtils.php';
  14. $vendorLibSimpleHtmlDom = __DIR__ . PATH_VENDOR . '/simplehtmldom/simple_html_dom.php';
  15. if( !file_exists($vendorLibSimpleHtmlDom) ){
  16. throw new \HttpException('"PHP Simple HTML DOM Parser" library is missing. Get it from http://simplehtmldom.sourceforge.net and place the script "simple_html_dom.php" in '.substr(PATH_VENDOR,4) . '/simplehtmldom/', 500);
  17. }
  18. require_once $vendorLibSimpleHtmlDom;
  19. /* Example use
  20. require_once __DIR__ . '/lib/RssBridge.php';
  21. // Data retrieval
  22. Bridge::setDir(__DIR__ . '/bridges/');
  23. $bridge = Bridge::create('GoogleSearch');
  24. $bridge->collectData($_REQUEST);
  25. // Data transformation
  26. Format::setDir(__DIR__ . '/formats/');
  27. $format = Format::create('Atom');
  28. $format
  29. ->setDatas($bridge->getDatas())
  30. ->setExtraInfos(array(
  31. 'name' => $bridge->getName(),
  32. 'uri' => $bridge->getURI(),
  33. ))
  34. ->display();
  35. */