2019-02-06 20:34:51 +03:00
|
|
|
<?php
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2019-02-06 20:34:51 +03:00
|
|
|
/**
|
|
|
|
* This file is part of RSS-Bridge, a PHP project capable of generating RSS and
|
|
|
|
* Atom feeds for websites that don't have one.
|
|
|
|
*
|
|
|
|
* For the full license information, please view the UNLICENSE file distributed
|
|
|
|
* with this source code.
|
|
|
|
*
|
|
|
|
* @package Core
|
|
|
|
* @license http://unlicense.org/ UNLICENSE
|
|
|
|
* @link https://github.com/rss-bridge/rss-bridge
|
|
|
|
*/
|
|
|
|
|
2022-06-22 19:30:37 +03:00
|
|
|
class ListAction implements ActionInterface
|
|
|
|
{
|
2022-07-08 22:06:14 +03:00
|
|
|
public function execute(array $request)
|
2019-02-06 20:34:51 +03:00
|
|
|
{
|
2022-08-06 23:46:28 +03:00
|
|
|
$list = new \stdClass();
|
2019-02-06 20:34:51 +03:00
|
|
|
$list->bridges = [];
|
|
|
|
$list->total = 0;
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2022-08-06 23:46:28 +03:00
|
|
|
$bridgeFactory = new BridgeFactory();
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2022-07-08 13:54:23 +03:00
|
|
|
foreach ($bridgeFactory->getBridgeClassNames() as $bridgeClassName) {
|
|
|
|
$bridge = $bridgeFactory->create($bridgeClassName);
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2022-07-08 13:54:23 +03:00
|
|
|
$list->bridges[$bridgeClassName] = [
|
2023-06-11 04:16:03 +03:00
|
|
|
'status' => $bridgeFactory->isEnabled($bridgeClassName) ? 'active' : 'inactive',
|
2019-02-06 20:34:51 +03:00
|
|
|
'uri' => $bridge->getURI(),
|
2021-06-25 22:45:25 +03:00
|
|
|
'donationUri' => $bridge->getDonationURI(),
|
2019-02-06 20:34:51 +03:00
|
|
|
'name' => $bridge->getName(),
|
|
|
|
'icon' => $bridge->getIcon(),
|
|
|
|
'parameters' => $bridge->getParameters(),
|
|
|
|
'maintainer' => $bridge->getMaintainer(),
|
|
|
|
'description' => $bridge->getDescription()
|
|
|
|
];
|
|
|
|
}
|
|
|
|
$list->total = count($list->bridges);
|
2022-11-07 20:22:54 +03:00
|
|
|
return new Response(Json::encode($list), 200, ['Content-Type' => 'application/json']);
|
2019-02-06 20:34:51 +03:00
|
|
|
}
|
|
|
|
}
|