rss-bridge/actions/ListAction.php

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
1.4 KiB
PHP
Raw Normal View History

2019-02-06 18:34:51 +01:00
<?php
2019-02-06 18:34:51 +01: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 18:30:37 +02:00
class ListAction implements ActionInterface
{
public function execute(array $request)
2019-02-06 18:34:51 +01:00
{
$list = new \stdClass();
2019-02-06 18:34:51 +01:00
$list->bridges = [];
$list->total = 0;
$bridgeFactory = new BridgeFactory();
foreach ($bridgeFactory->getBridgeClassNames() as $bridgeClassName) {
$bridge = $bridgeFactory->create($bridgeClassName);
$list->bridges[$bridgeClassName] = [
'status' => $bridgeFactory->isWhitelisted($bridgeClassName) ? 'active' : 'inactive',
2019-02-06 18:34:51 +01:00
'uri' => $bridge->getURI(),
'donationUri' => $bridge->getDonationURI(),
2019-02-06 18:34:51 +01:00
'name' => $bridge->getName(),
'icon' => $bridge->getIcon(),
'parameters' => $bridge->getParameters(),
'maintainer' => $bridge->getMaintainer(),
'description' => $bridge->getDescription()
];
}
2019-02-06 18:34:51 +01:00
$list->total = count($list->bridges);
2019-02-06 18:34:51 +01:00
header('Content-Type: application/json');
print Json::encode($list);
2019-02-06 18:34:51 +01:00
}
}