EOD; } private static function getBridges($whitelist, $showInactive, &$totalBridges, &$totalActiveBridges) { $body = ''; $totalActiveBridges = 0; $inactiveBridges = ''; $bridgeList = Bridge::listBridges(); $formats = Format::searchInformation(); $totalBridges = count($bridgeList); foreach($bridgeList as $bridgeName) { if(Bridge::isWhitelisted($whitelist, strtolower($bridgeName))) { $body .= BridgeCard::displayBridgeCard($bridgeName, $formats); $totalActiveBridges++; } elseif($showInactive) { // inactive bridges $inactiveBridges .= BridgeCard::displayBridgeCard($bridgeName, $formats, false) . PHP_EOL; } } $body .= $inactiveBridges; return $body; } private static function getHeader() { $status = ''; if(defined('DEBUG') && DEBUG === true) { $status .= 'debug mode active'; } return <<

RSS-Bridge

·Reconnecting the Web·

{$status}

EOD; } private static function getSearchbar() { $query = filter_input(INPUT_GET, 'q'); return <<

Search

EOD; } private static function getFooter($totalBridges, $totalActiveBridges, $showInactive) { $version = Configuration::getVersion(); $inactive = ''; if($totalActiveBridges !== $totalBridges) { if(!$showInactive) { $inactive = '
'; } else { $inactive = '
'; } } return << RSS-Bridge ~ Public Domain

{$version}

{$totalActiveBridges}/{$totalBridges} active bridges.
{$inactive} EOD; } static function create($whitelist, $showInactive = true) { $totalBridges = 0; $totalActiveBridges = 0; return '' . BridgeList::getHead() . '' . BridgeList::getHeader() . BridgeList::getSearchbar() . BridgeList::getBridges($whitelist, $showInactive, $totalBridges, $totalActiveBridges) . BridgeList::getFooter($totalBridges, $totalActiveBridges, $showInactive) . ''; } }