2013-08-11 15:30:41 +04:00
|
|
|
<?php
|
|
|
|
/* rss-bridge library.
|
|
|
|
Foundation functions for rss-bridge project.
|
|
|
|
See https://github.com/sebsauvage/rss-bridge
|
|
|
|
Licence: Public domain.
|
|
|
|
*/
|
|
|
|
|
|
|
|
define('PATH_VENDOR', '/../vendor');
|
|
|
|
|
|
|
|
require __DIR__ . '/Exceptions.php';
|
|
|
|
require __DIR__ . '/Format.php';
|
2016-09-05 19:05:19 +03:00
|
|
|
require __DIR__ . '/FormatAbstract.php';
|
2013-08-11 15:30:41 +04:00
|
|
|
require __DIR__ . '/Bridge.php';
|
2016-09-05 19:05:19 +03:00
|
|
|
require __DIR__ . '/BridgeAbstract.php';
|
|
|
|
require __DIR__ . '/FeedExpander.php';
|
2013-08-11 15:30:41 +04:00
|
|
|
require __DIR__ . '/Cache.php';
|
2016-09-05 19:05:19 +03:00
|
|
|
require __DIR__ . '/CacheAbstract.php';
|
2015-11-05 23:26:48 +03:00
|
|
|
require __DIR__ . '/HTMLUtils.php';
|
2013-08-11 15:30:41 +04:00
|
|
|
|
|
|
|
$vendorLibSimpleHtmlDom = __DIR__ . PATH_VENDOR . '/simplehtmldom/simple_html_dom.php';
|
|
|
|
if( !file_exists($vendorLibSimpleHtmlDom) ){
|
2016-09-10 21:41:11 +03:00
|
|
|
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);
|
2013-08-11 15:30:41 +04:00
|
|
|
}
|
|
|
|
require_once $vendorLibSimpleHtmlDom;
|
|
|
|
|
|
|
|
/* Example use
|
2016-09-10 21:41:11 +03:00
|
|
|
|
|
|
|
require_once __DIR__ . '/lib/RssBridge.php';
|
|
|
|
|
|
|
|
// Data retrieval
|
|
|
|
Bridge::setDir(__DIR__ . '/bridges/');
|
|
|
|
$bridge = Bridge::create('GoogleSearch');
|
|
|
|
$bridge->collectData($_REQUEST);
|
|
|
|
|
|
|
|
// Data transformation
|
|
|
|
Format::setDir(__DIR__ . '/formats/');
|
|
|
|
$format = Format::create('Atom');
|
|
|
|
$format
|
|
|
|
->setItems($bridge->getItems())
|
|
|
|
->setExtraInfos(array(
|
|
|
|
'name' => $bridge->getName(),
|
|
|
|
'uri' => $bridge->getURI(),
|
|
|
|
))
|
|
|
|
->display();
|
2013-08-11 15:30:41 +04:00
|
|
|
|
2015-11-05 13:12:58 +03:00
|
|
|
*/
|