runcmf/runtracy

View on GitHub
src/RunTracy/Templates/VendorVersionsPanel.phtml

Summary

Maintainability
Test Coverage
<?php

use Tracy\Helpers;

function h($str) {
    return htmlspecialchars($str, ENT_QUOTES | ENT_HTML5, 'UTF-8');
}

/**
 * @var  string|NULL $lockFile
 * @var  string|NULL $jsonFile
 * @var  string|NULL $error
 * @var  array $data
 */
?>
<style type="text/css">
    .milo-VendorVersionsPanel h2 {
        font-weight: bold !important;
    }
    .milo-VendorVersionsPanel small {
        font-size: 85% !important;
    }
    .milo-VendorVersionsPanel {
        width: 100%;
    }
    .milo-VendorVersionsPanel table {
        white-space: nowrap;
        font: 9pt/1.5 Consolas,monospace !important;
    }
    .milo-VendorVersionsPanel td.version {
        font-weight: bold !important;
    }
</style>

<div class="tracy-inner">
    <h1>
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 512" width="16px" height="16px"><path fill="#478CCC" d="M489.349,131.258l0.47-0.462L374.228,15.515l-32.895,32.894l65.485,65.47c-29.182,11.174-49.97,39.258-49.97,72.303  c0,42.818,34.758,77.576,77.575,77.576c11.016,0,21.576-2.326,31.03-6.516V480.97c0,17.061-13.97,31.03-31.03,31.03  s-31.03-13.97-31.03-31.03V341.333c0-34.287-27.772-62.061-62.061-62.061h-31.03V62.061C310.303,27.772,282.53,0,248.242,0H62.061  C27.772,0,0,27.772,0,62.061v496.485h310.303V325.818h46.546V480.97c0,42.818,34.758,77.576,77.575,77.576  c42.818,0,77.576-34.758,77.576-77.576V186.182C512,164.772,503.303,145.379,489.349,131.258z M248.242,217.212H62.061V62.061  h186.182V217.212z M434.424,217.212c-17.061,0-31.03-13.962-31.03-31.03s13.97-31.03,31.03-31.03s31.03,13.962,31.03,31.03  S451.484,217.212,434.424,217.212z"/></svg>
        Vendor Versions
        </h1>
    <div class="milo-VendorVersionsPanel">
        <?php if ($error): ?>
            <span style="color:red"><?= h($error) ?></span>
        <?php else: ?>
            <?php foreach ($data as $title => $packages): ?>
            <h2><?= h($title) ?></h2>
            <table>
                <thead>
                    <tr>
                        <th>Name</th>
                        <th>Installed</th>
                        <th>Required</th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach ($packages as $name => $p): ?>
                        <tr>
                            <td><?= $p->url ? ("<a href='" . h($p->url) . "' target='_blank' rel='noreferrer'>" . h($name) . "</a>") : h($name) ?></td>
                            <td class="version"><?= h($p->installed) ?></td>
                            <td><?= h($p->required) ?></td>
                        </tr>
                    <?php endforeach ?>
                </tbody>
            </table>
            <?php endforeach ?>
            <p><small>Source:<p><?= Helpers::editorLink($jsonFile) ?></p><p><?= Helpers::editorLink($lockFile) ?></p></small></p>
        <?php endif ?>
    </div>
</div>