RssBridge.php 1.2 KB

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