From 9014e27c61b7c342816019f43d8323b675e5773e Mon Sep 17 00:00:00 2001 From: k-paulius Date: Mon, 15 Feb 2016 23:29:27 -0600 Subject: Do not generate empty tags if there is no link. --- src/usr/local/www/head.inc | 14 +++++++++++--- src/usr/local/www/shortcuts.inc | 3 +++ 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/usr/local/www/head.inc b/src/usr/local/www/head.inc index 66c6940..4a52da6 100644 --- a/src/usr/local/www/head.inc +++ b/src/usr/local/www/head.inc @@ -512,9 +512,17 @@ if (!$hide_service_status && !empty($shortcuts[$shortcut_section]['service'])) { } } -echo '
  • '. get_shortcut_main_link($shortcut_section, false). '
  • '; -echo '
  • '. get_shortcut_status_link($shortcut_section, false). '
  • '; -echo '
  • '. get_shortcut_log_link($shortcut_section, false). '
  • '; +if ('' != ($link = get_shortcut_main_link($shortcut_section, false))) { + echo '
  • ' . $link . '
  • '; +} + +if ('' != ($link = get_shortcut_status_link($shortcut_section, false))) { + echo '
  • ' . $link . '
  • '; +} + +if ('' != ($link = get_shortcut_log_link($shortcut_section, false))) { + echo '
  • ' . $link . '
  • '; +} ?> diff --git a/src/usr/local/www/shortcuts.inc b/src/usr/local/www/shortcuts.inc index 7e86f66..d74ded2 100644 --- a/src/usr/local/www/shortcuts.inc +++ b/src/usr/local/www/shortcuts.inc @@ -123,6 +123,7 @@ function get_shortcut_main_link($shortcut_section, $addspace = true, $service = if (!empty($link) && ($_SERVER['REQUEST_URI'] != "/{$link}")) { return "{$space}"; } + return ""; } function get_shortcut_status_link($shortcut_section, $addspace = true, $service = array()) { @@ -151,6 +152,7 @@ function get_shortcut_status_link($shortcut_section, $addspace = true, $service if (!empty($link)) { return "{$space}"; } + return ""; } function get_shortcut_log_link($shortcut_section, $addspace = true) { @@ -159,6 +161,7 @@ function get_shortcut_log_link($shortcut_section, $addspace = true) { if (!empty($shortcut_section) && !empty($shortcuts[$shortcut_section]['log'])) { return "{$space}"; } + return ""; } // Load shortcuts -- cgit v1.1