|
84 | 84 | <div class="build-btn-button"> |
85 | 85 | <div class="build-ico-button"> |
86 | 86 | <div class="build-ico-os"> |
87 | | - <img alt="Windows" src="img/icons/list/os-windows-11.png" style='height: 100%; width: 100%; object-fit: contain'/> |
88 | | - <img alt="Linux" src="img/icons/list/os-linux-na.png" style='height: 100%; width: 100%; object-fit: contain; display:none;'/> |
89 | | - <img alt="macOS" src="img/icons/list/os-macos.png" style='height: 100%; width: 100%; object-fit: contain; display:none;'/> |
90 | | - <img alt="FreeBSD" src="img/icons/list/os-bsd.png" style='height: 100%; width: 100%; object-fit: contain; display:none;'/> |
| 87 | + <?php |
| 88 | + |
| 89 | + $os_icons = [ |
| 90 | + 'Windows' => 'img/icons/list/os-windows-11.png', |
| 91 | + 'Linux' => 'img/icons/list/os-linux-na.png', |
| 92 | + 'macOS' => 'img/icons/list/os-macos.png', |
| 93 | + 'FreeBSD' => 'img/icons/list/os-bsd.png', |
| 94 | + ]; |
| 95 | + |
| 96 | + $os_name = $os_icon = null; |
| 97 | + $ua = $_SERVER['HTTP_USER_AGENT'] ?? ''; |
| 98 | + |
| 99 | + if (str_contains($ua, 'FreeBSD')) { $os_name = 'FreeBSD'; $os_icon = $os_icons['FreeBSD']; } |
| 100 | + elseif (str_contains($ua, 'Windows')) { $os_name = 'Windows'; $os_icon = $os_icons['Windows']; } |
| 101 | + elseif (str_contains($ua, 'Mac OS X')) { $os_name = 'macOS'; $os_icon = $os_icons['macOS']; } |
| 102 | + elseif (str_contains($ua, 'Linux') && !str_contains($ua, 'Android')) { $os_name = 'Linux'; $os_icon = $os_icons['Linux']; } |
| 103 | + ?> |
| 104 | + |
| 105 | + <?php if ($os_icon !== null): ?> |
| 106 | + <img alt="<?= $os_name ?>" src="<?= $os_icon ?>" style='height: 100%; width: 100%; object-fit: contain'/> |
| 107 | + <?php else: ?> |
| 108 | + <?php $first = true; foreach ($os_icons as $name => $icon): ?> |
| 109 | + <img alt="<?= $name ?>" src="<?= $icon ?>" style='height: 100%; width: 100%; object-fit: contain<?= $first ? '' : '; display:none' ?>'/> |
| 110 | + <?php $first = false; endforeach; ?> |
| 111 | + <?php endif; ?> |
91 | 112 | </div> |
92 | 113 | </div> |
93 | 114 | <a href="/download"> |
|
0 commit comments