Link sources directly instad of through the list at the bottom

This commit is contained in:
Markus Koch 2020-01-02 22:38:41 +01:00
parent faaa3a8ecb
commit 58900e3d60

View File

@ -156,9 +156,11 @@
*/ */
$meta['sources'] = array(); $meta['sources'] = array();
$counters['sources'] = 1; $counters['sources'] = 1;
function addSource($url) { function addSource($url, $text="") {
global $counters; global $counters;
global $meta; global $meta;
if ("$text" != "")
$text .= " ";
if (is_numeric($url)) { if (is_numeric($url)) {
echo "<a href=\"#src$url\">[" . $url . "]</a>"; echo "<a href=\"#src$url\">[" . $url . "]</a>";
return $url; return $url;
@ -168,14 +170,14 @@
$i = 1; $i = 1;
foreach ($meta['sources'] as $v) { foreach ($meta['sources'] as $v) {
if ($v == $url) { if ($v == $url) {
echo "<a href=\"#src$i\">[" . $i . "]</a>"; echo "<a href=\"$url\">" . $text . "[" . $i . "]</a>";
return $i; return $i;
} }
$i++; $i++;
} }
// If not found, then add // If not found, then add
$meta['sources'][$counters['sources']] = $url; $meta['sources'][$counters['sources']] = $url;
echo "<a href=\"#src$i\">[" . $counters['sources'] . "]</a>"; echo "<a href=\"$url\">" . $text . "[" . $counters['sources'] . "]</a>";
return $counters['sources']++; return $counters['sources']++;
} }
} }