<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * Manage logo display
 *
 * @package PhpMyAdmin-template
 *
 * @param bool   $displayLogo Display logo or not
 * @param bool   $useLogoLink Use link on logo or not
 * @param string $logoLink    Destination of link on logo
 * @param string $linkAttribs Link's attributes
 */
$displayLogo = isset($displayLogo) ? $displayLogo : true;
$useLogoLink = isset($useLogoLink) ? $useLogoLink : false;
$logoLink = isset($logoLink) ? $logoLink : '#';
$linkAttribs = isset($linkAttribs) ? $linkAttribs : null;
if (!isset($logo)) {
    $logo = null;
    if (isset($GLOBALS['pmaThemeImage'])) {
        $imgTag = '<img src="%s%s" ' . 'alt="phpMyAdmin" id="imgpmalogo" />';
        if (@file_exists($GLOBALS['pmaThemeImage'] . 'logo_left.png')) {
            $logo = sprintf($imgTag, $GLOBALS['pmaThemeImage'], 'logo_left.png');
        } elseif (@file_exists($GLOBALS['pmaThemeImage'] . 'pma_logo2.png')) {
            $logo = sprintf($imgTag, $GLOBALS['pmaThemeImage'], 'pma_logo2.png');
        }
    }
}
?>
<!-- LOGO START -->
<?php if (false === $displayLogo) : ?>
    <!-- LOGO END -->
    <?php return;
      endif;
    ?>
<div id="pmalogo">
    <?php if (true === $useLogoLink) : ?>
        <a href="<?= $logoLink; ?>"<?= isset($linkAttribs) ? ' ' . $linkAttribs : null; ?>>
    <?php endif; ?>
    <?= $logo; ?>
    <?php if (true === $useLogoLink) : ?>
        </a>
    <?php endif; ?>
</div>
<!-- LOGO END -->