From d4fa469d81a33bdaae881d654f747304511b6a86 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Wed, 28 Sep 2022 15:17:09 +0100 Subject: [PATCH] Simplify links (#580) --- include/layout.inc | 19 ++++--------------- include/site.inc | 12 +++++++++--- mirror.php | 4 ++-- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/include/layout.inc b/include/layout.inc index 27e2aa8fa..8ffebd487 100644 --- a/include/layout.inc +++ b/include/layout.inc @@ -152,20 +152,9 @@ function make_submit($file, $alt = false, $align = false, $extras = false, } // Return a hiperlink to something within the site -function make_link ($url, $linktext = false, $target = false, $extras = false) +function make_link (string $url, string $linktext = ''): string { - return sprintf("%s", - $url, - ($target ? ' target="' . $target . '"' : ''), - ($extras ? ' ' . $extras : ''), - ($linktext ?: $url) - ); -} - -// Print a hyperlink to something, within the site -function print_link($url, $linktext = false, $target = false, $extras = false) -{ - echo make_link($url, $linktext, $target, $extras); + return sprintf("%s", $url, $linktext ?: $url); } // make_popup_link() @@ -196,7 +185,7 @@ function download_link($file, $title) $download_link = "/distributions/" . $file; // Print out the download link - print_link($download_link, $title); + echo make_link($download_link, $title); // We have a full path or a relative to the distributions dir if ($tmp = strrchr($file, "/")) { @@ -208,7 +197,7 @@ function download_link($file, $title) if (@file_exists($local_file . ".asc")) { echo " "; $sig_link = "/distributions/$file.asc"; - print_link($sig_link, "(sig)"); + echo make_link($sig_link, "(sig)"); } // Try to get the size of the file diff --git a/include/site.inc b/include/site.inc index 82e010e52..65183ed1d 100644 --- a/include/site.inc +++ b/include/site.inc @@ -15,9 +15,15 @@ const MIRROR_DOESNOTWORK = 3; $MIRRORS = [ "https://www.php.net/" => [ - "DEU", "MyraCloud", false, - "https://myracloud.com/en/", MIRROR_SPECIAL, true, - "en", MIRROR_OK], + "DEU", + "MyraCloud", + false, + "https://myracloud.com/en/", + MIRROR_SPECIAL, + true, + "en", + MIRROR_OK + ] ]; /** diff --git a/mirror.php b/mirror.php index d5d7c0cf9..b6b8a5229 100644 --- a/mirror.php +++ b/mirror.php @@ -66,14 +66,14 @@ site_header("Information About This PHP Mirror Site", ["current" => "community"]

Mirror Provider