diff --git a/e107_admin/library.php b/e107_admin/library.php index e182851ff..ab1b3032a 100644 --- a/e107_admin/library.php +++ b/e107_admin/library.php @@ -95,8 +95,7 @@ class library_list_ui extends e_admin_ui $provider = $this->getProvider($details); $status = $this->getStatus($details); - $homepage = $this->getHomepage($details); - $download = $this->getDownload($details); + $links = $this->getLinks($details); $html .= ''; $html .= '' . $details['name'] . ''; @@ -104,7 +103,7 @@ class library_list_ui extends e_admin_ui $html .= '' . $details['version'] . ''; $html .= '' . $status . ''; $html .= '' . $details['error_message'] . ''; - $html .= '' . $homepage . ' | ' . $download . ''; + $html .= '' . $links . ''; $html .= ''; } @@ -114,11 +113,40 @@ class library_list_ui extends e_admin_ui return '
' . $html . '
'; } + /** + * Helper function to get links. + */ + private function getLinks($details) + { + $homepage = $this->getHomepage($details); + $download = $this->getDownload($details); + + if ($homepage && $download) + { + return $homepage . ' | ' . $download; + } + + if($homepage) + { + return $homepage; + } + + if($download) + { + return $download; + } + } + /** * Helper function to get homepage link. */ private function getHomepage($details) { + if (empty($details['vendor_url'])) + { + return false; + } + $href = $details['vendor_url']; $title = $details['name']; @@ -130,6 +158,11 @@ class library_list_ui extends e_admin_ui */ private function getDownload($details) { + if (empty($details['download_url'])) + { + return false; + } + $href = $details['download_url']; $title = $details['name'];