From 52c25153e36966e30c5a378583b4d896081fc1ae Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Sun, 13 May 2018 00:12:03 -0600 Subject: [PATCH] Add footer link support to themes, stop get_footer_urls() from returning empty links (#15) --- lib/themefunctions.php | 10 +++- public/themes/bootstrap/inc/footer.inc.php | 14 +++++ public/themes/verti/inc/footer.inc.php | 60 +++++++++++++++------- 3 files changed, 64 insertions(+), 20 deletions(-) diff --git a/lib/themefunctions.php b/lib/themefunctions.php index 79ea35e..8884d3f 100644 --- a/lib/themefunctions.php +++ b/lib/themefunctions.php @@ -486,12 +486,18 @@ function get_fontawesome_css($echo = true) { } /** - * Return an array [[title, url], [title, url]] of links for the page footer + * Return an array [[title, link], [title, link]] of links for the page footer */ function get_footer_urls() { $links = json_decode(get_setting("footerlinks", false), true); if (is_array($links)) { - return $links; + $filtered = []; + foreach ($links as $l) { + if ($l['title'] != "" && $l['link'] != "") { + $filtered[] = $l; + } + } + return $filtered; } return []; } diff --git a/public/themes/bootstrap/inc/footer.inc.php b/public/themes/bootstrap/inc/footer.inc.php index f47ad77..6ee98dc 100644 --- a/public/themes/bootstrap/inc/footer.inc.php +++ b/public/themes/bootstrap/inc/footer.inc.php @@ -9,6 +9,20 @@