aboutsummaryrefslogtreecommitdiff
path: root/lib/BridgeList.php
diff options
context:
space:
mode:
authorGravatar Dag <me@dvikan.no> 2022-08-06 22:46:28 +0200
committerGravatar GitHub <noreply@github.com> 2022-08-06 22:46:28 +0200
commit2bbce8ebef8cf4f88392431aabe84a15482dc933 (patch)
tree1f5027ca69b1dfa2364bd9319e8536b86a41e928 /lib/BridgeList.php
parentb042412416cc4ecc71c3f9c13239661a0dd588a6 (diff)
downloadrss-bridge-2bbce8ebef8cf4f88392431aabe84a15482dc933.tar.gz
rss-bridge-2bbce8ebef8cf4f88392431aabe84a15482dc933.tar.zst
rss-bridge-2bbce8ebef8cf4f88392431aabe84a15482dc933.zip
refactor: general code base refactor (#2950)
* refactor * fix: bug in previous refactor * chore: exclude phpcompat sniff due to bug in phpcompat * fix: do not leak absolute paths * refactor/fix: batch extensions checking, fix DOS issue
Diffstat (limited to 'lib/BridgeList.php')
-rw-r--r--lib/BridgeList.php54
1 files changed, 27 insertions, 27 deletions
diff --git a/lib/BridgeList.php b/lib/BridgeList.php
index f8d0b1a1..41b1f267 100644
--- a/lib/BridgeList.php
+++ b/lib/BridgeList.php
@@ -23,6 +23,28 @@
final class BridgeList
{
/**
+ * Create the entire home page
+ *
+ * @param bool $showInactive Inactive bridges are displayed on the home page,
+ * if enabled.
+ * @return string The home page
+ */
+ public static function create($showInactive = true)
+ {
+ $totalBridges = 0;
+ $totalActiveBridges = 0;
+
+ return '<!DOCTYPE html><html lang="en">'
+ . BridgeList::getHead()
+ . '<body onload="search()">'
+ . BridgeList::getHeader()
+ . BridgeList::getSearchbar()
+ . BridgeList::getBridges($showInactive, $totalBridges, $totalActiveBridges)
+ . BridgeList::getFooter($totalBridges, $totalActiveBridges, $showInactive)
+ . '</body></html>';
+ }
+
+ /**
* Get the document head
*
* @return string The document head
@@ -65,7 +87,7 @@ EOD;
$totalActiveBridges = 0;
$inactiveBridges = '';
- $bridgeFactory = new \BridgeFactory();
+ $bridgeFactory = new BridgeFactory();
$bridgeClassNames = $bridgeFactory->getBridgeClassNames();
$formatFactory = new FormatFactory();
@@ -126,7 +148,7 @@ EOD;
*/
private static function getSearchbar()
{
- $query = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_SPECIAL_CHARS);
+ $query = filter_input(INPUT_GET, 'q', \FILTER_SANITIZE_SPECIAL_CHARS);
return <<<EOD
<section class="searchbar">
@@ -167,10 +189,10 @@ EOD;
$inactive = '';
if ($totalActiveBridges !== $totalBridges) {
- if (!$showInactive) {
- $inactive = '<a href="?show_inactive=1"><button class="small">Show inactive bridges</button></a><br>';
- } else {
+ if ($showInactive) {
$inactive = '<a href="?show_inactive=0"><button class="small">Hide inactive bridges</button></a><br>';
+ } else {
+ $inactive = '<a href="?show_inactive=1"><button class="small">Show inactive bridges</button></a><br>';
}
}
@@ -184,26 +206,4 @@ EOD;
</section>
EOD;
}
-
- /**
- * Create the entire home page
- *
- * @param bool $showInactive Inactive bridges are displayed on the home page,
- * if enabled.
- * @return string The home page
- */
- public static function create($showInactive = true)
- {
- $totalBridges = 0;
- $totalActiveBridges = 0;
-
- return '<!DOCTYPE html><html lang="en">'
- . BridgeList::getHead()
- . '<body onload="search()">'
- . BridgeList::getHeader()
- . BridgeList::getSearchbar()
- . BridgeList::getBridges($showInactive, $totalBridges, $totalActiveBridges)
- . BridgeList::getFooter($totalBridges, $totalActiveBridges, $showInactive)
- . '</body></html>';
- }
}