1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 20:57:26 +02:00

Hide homepage/download link if its not set.

This commit is contained in:
lonalore
2016-06-20 11:30:00 +02:00
parent 90e25f1d8a
commit 6cac761e47

View File

@@ -95,8 +95,7 @@ class library_list_ui extends e_admin_ui
$provider = $this->getProvider($details); $provider = $this->getProvider($details);
$status = $this->getStatus($details); $status = $this->getStatus($details);
$homepage = $this->getHomepage($details); $links = $this->getLinks($details);
$download = $this->getDownload($details);
$html .= '<tr>'; $html .= '<tr>';
$html .= '<td>' . $details['name'] . '</td>'; $html .= '<td>' . $details['name'] . '</td>';
@@ -104,7 +103,7 @@ class library_list_ui extends e_admin_ui
$html .= '<td>' . $details['version'] . '</td>'; $html .= '<td>' . $details['version'] . '</td>';
$html .= '<td>' . $status . '</td>'; $html .= '<td>' . $status . '</td>';
$html .= '<td>' . $details['error_message'] . '</td>'; $html .= '<td>' . $details['error_message'] . '</td>';
$html .= '<td>' . $homepage . ' | ' . $download . '</td>'; $html .= '<td>' . $links . '</td>';
$html .= '</tr>'; $html .= '</tr>';
} }
@@ -114,11 +113,40 @@ class library_list_ui extends e_admin_ui
return '<div class="table-responsive">' . $html . '</div>'; return '<div class="table-responsive">' . $html . '</div>';
} }
/**
* 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. * Helper function to get homepage link.
*/ */
private function getHomepage($details) private function getHomepage($details)
{ {
if (empty($details['vendor_url']))
{
return false;
}
$href = $details['vendor_url']; $href = $details['vendor_url'];
$title = $details['name']; $title = $details['name'];
@@ -130,6 +158,11 @@ class library_list_ui extends e_admin_ui
*/ */
private function getDownload($details) private function getDownload($details)
{ {
if (empty($details['download_url']))
{
return false;
}
$href = $details['download_url']; $href = $details['download_url'];
$title = $details['name']; $title = $details['name'];