|
7 | 7 | // Try to make this page non-cached
|
8 | 8 | header_nocache();
|
9 | 9 |
|
10 |
| -$SHOW_COUNT = 4; |
11 |
| - |
12 | 10 | $SIDEBAR_DATA = '
|
13 | 11 | <div class="panel">
|
14 | 12 | <a href="/supported-versions.php">Supported Versions</a>
|
|
18 | 16 | </div>
|
19 | 17 | </div>
|
20 | 18 |
|
| 19 | +<p class="panel"><a href="downloads.php?source=Y">Source Tarballs</a></p> |
21 | 20 | <p class="panel"><a href="download-docs.php">Documentation Download</a></p>
|
22 | 21 | <p class="panel"><a href="download-logos.php">PHP Logos</a></p>
|
23 | 22 |
|
|
37 | 36 | ],
|
38 | 37 | ],
|
39 | 38 | "current" => "downloads",
|
| 39 | + "css" => [ |
| 40 | + "prism.css", |
| 41 | + "code-syntax.css", |
| 42 | + ], |
| 43 | + "js_files" => [ |
| 44 | + "js/ext/prism.js", |
| 45 | + ], |
40 | 46 | ],
|
41 | 47 | );
|
| 48 | + |
| 49 | +function option(string $value, string $desc, $attributes = []): string |
| 50 | +{ |
| 51 | + return '<option value="' . $value . '"' . implode(' ', array_keys(array_filter($attributes))) . '>' . $desc . '</option>'; |
| 52 | +} |
| 53 | + |
| 54 | +$usage = [ |
| 55 | + 'web' => 'Web Development', |
| 56 | + 'cli' => 'CLI/Library Development', |
| 57 | + 'fw-drupal' => 'Drupal Development', |
| 58 | + 'fw-laravel' => 'Laravel Development', |
| 59 | + 'fw-symfony' => 'Symfony Development', |
| 60 | + 'fw-wordpress' => 'WordPress Development', |
| 61 | +]; |
| 62 | + |
| 63 | +$os = [ |
| 64 | + 'linux' => [ |
| 65 | + 'name' => 'Linux', |
| 66 | + 'variants' => [ |
| 67 | + 'linux-debian' => 'Debian', |
| 68 | + 'linux-fedora' => 'Fedora', |
| 69 | + 'linux-redhat' => 'RedHat', |
| 70 | + 'linux-ubuntu' => 'Ubuntu', |
| 71 | + ], |
| 72 | + ], |
| 73 | + 'osx' => [ |
| 74 | + 'name' => 'macOS', |
| 75 | + 'variants' => [ |
| 76 | + 'osx-homebrew' => 'Homebrew/Brew', |
| 77 | + 'osx-homebrew-php' => 'Homebrew/Homebrew-PHP', |
| 78 | + 'osx-macports' => 'MacPorts', |
| 79 | + ], |
| 80 | + ], |
| 81 | + 'windows' => [ |
| 82 | + 'name' => 'Windows', |
| 83 | + 'variants' => [ |
| 84 | + 'windows-native' => 'Windows Native Build', |
| 85 | + 'windows-chocolatey' => 'Windows with Chocolatey', |
| 86 | + 'windows-scoop' => 'Windows with Scoop', |
| 87 | + 'windows-wsl-debian' => 'Windows with WSL/Debian', |
| 88 | + 'windows-wsl-ubuntu' => 'Windows with WSL/Ubuntu', |
| 89 | + ], |
| 90 | + ], |
| 91 | +]; |
| 92 | + |
| 93 | +$versions = [ |
| 94 | + '8.4' => 'version 8.4', |
| 95 | + '8.3' => 'version 8.3', |
| 96 | + '8.2' => 'version 8.2', |
| 97 | + '8.1' => 'version 8.1', |
| 98 | + 'default' => 'OS default version', |
| 99 | +]; |
| 100 | + |
| 101 | +$defaults = [ |
| 102 | + 'os' => 'linux', |
| 103 | + 'version' => 'default', |
| 104 | + 'usage' => 'web', |
| 105 | +]; |
| 106 | + |
| 107 | +$options = array_merge($defaults, $_GET); |
| 108 | +if (!array_key_exists('osvariant', $options) || !array_key_exists($options['osvariant'], $os[$options['os']]['variants'])) { |
| 109 | + $options['osvariant'] = array_key_first($os[$options['os']]['variants']); |
| 110 | +} |
42 | 111 | ?>
|
43 | 112 | <h1>Downloads & Installation Instructions</h1>
|
44 | 113 |
|
| 114 | + <form class="instructions-form" id="instructions-form"> |
| 115 | + <div class="instructions-row"> |
| 116 | + I want to use PHP for |
| 117 | + <select id="usage" name="usage"> |
| 118 | + <?php foreach ($usage as $value => $description) { ?> |
| 119 | + <?= option($value, $description, [ |
| 120 | + 'selected' => array_key_exists('usage', $options) && $options['usage'] === $value, |
| 121 | + ]); ?> |
| 122 | + <?php } ?> |
| 123 | + </select>. |
| 124 | + </div> |
| 125 | + |
| 126 | + <div class="instructions-row"> |
| 127 | + I work with |
| 128 | + <select id="os" name="os"> |
| 129 | + <?php foreach ($os as $value => $item) { ?> |
| 130 | + <?= option($value, $item['name'], [ |
| 131 | + 'selected' => array_key_exists('os', $options) && $options['os'] === $value, |
| 132 | + ]); ?> |
| 133 | + <?php } ?> |
| 134 | + </select> |
| 135 | + |
| 136 | + <?php if (array_key_exists('os', $options) && array_key_exists('osvariant', $options)) { ?> |
| 137 | + <select id="osvariant" name="osvariant"> |
| 138 | + <?php foreach ($os[$options['os']]['variants'] as $value => $description) { ?> |
| 139 | + <?= option($value, $description, [ |
| 140 | + 'selected' => $options['osvariant'] === $value, |
| 141 | + ]); ?> |
| 142 | + <?php } ?> |
| 143 | + </select> |
| 144 | + <?php } ?>, |
| 145 | + and use |
| 146 | + <select id="version" name="version"> |
| 147 | + <?php foreach ($versions as $value => $version) { ?> |
| 148 | + <?= option($value, $version, [ |
| 149 | + 'selected' => array_key_exists('version', $options) && $options['version'] === $value, |
| 150 | + ]); ?> |
| 151 | + <?php } ?> |
| 152 | + </select> |
| 153 | + </div> |
| 154 | + |
| 155 | + <label for="multiversion" class="instructions-label"> |
| 156 | + I want to be able to use multiple PHP versions: |
| 157 | + <input type="checkbox" id="multiversion" name="multiversion" value="Y" |
| 158 | + <?= array_key_exists('multiversion', $options) && $options['multiversion'] === 'Y' ? 'checked' : '' ?>/> |
| 159 | + </label> |
| 160 | + |
| 161 | + <label for="source" class="instructions-label"> |
| 162 | + I want to compile everything from source: |
| 163 | + <input type="checkbox" id="source" name="source" value="Y" |
| 164 | + <?= array_key_exists('source', $options) && $options['source'] === 'Y' ? 'checked' : '' ?>/> |
| 165 | + </label> |
| 166 | + |
| 167 | + <noscript> |
| 168 | + <button type="submit" class="button">Update Instructions</button> |
| 169 | + </noscript> |
| 170 | +</form> |
| 171 | + |
| 172 | +<h2>Instructions</h2> |
| 173 | +<div id="instructions" class="instructions"> |
| 174 | +<?php $instructionsShown = include 'downloads-get-instructions.php'; ?> |
| 175 | +</div> |
| 176 | + |
| 177 | +<?php if (!$instructionsShown): ?> |
| 178 | + |
| 179 | +<h2>Source Code</h2> |
| 180 | +<?php show_source_releases(); ?> |
| 181 | + |
| 182 | +<hr> |
| 183 | +<h2>GPG Keys</h2> |
45 | 184 | <p>
|
46 |
| - <a href="/manual/install.general.php">Installing PHP</a> is covered |
47 |
| - thoroughly in the PHP documentation. |
| 185 | +The releases are tagged and signed in the <a href='git.php'>PHP Git Repository</a>. |
| 186 | +The following official GnuPG keys of the current PHP Release Manager can be used |
| 187 | +to verify the tags: |
| 188 | +</p> |
| 189 | + |
| 190 | +<?php gpg_key_show_keys(true /* activeOnly */); ?> |
| 191 | + |
| 192 | +<p> |
| 193 | + <a href="gpg-keys.php"> |
| 194 | + A full list of GPG keys used for current and older releases is also |
| 195 | + available. |
| 196 | + </a> |
48 | 197 | </p>
|
49 | 198 |
|
50 | 199 | <h2>Binaries</h2>
|
|
65 | 214 | </ul>
|
66 | 215 | </p>
|
67 | 216 |
|
68 |
| -<h2>Source Code</h2> |
69 |
| -<?php $i = 0; foreach ($RELEASES as $MAJOR => $major_releases): /* major releases loop start */ |
70 |
| - $releases = array_slice($major_releases, 0, $SHOW_COUNT); |
71 |
| -?> |
72 |
| -<a id="v<?php echo $MAJOR; ?>"></a> |
73 |
| -<?php foreach ($releases as $v => $a): ?> |
74 |
| - <?php $mver = substr($v, 0, strrpos($v, '.')); ?> |
75 |
| - <?php $stable = $i++ === 0 ? "Current Stable" : "Old Stable"; ?> |
76 |
| - |
77 |
| - <h3 id="v<?php echo $v; ?>" class="title"> |
78 |
| - <span class="release-state"><?php echo $stable; ?></span> |
79 |
| - PHP <?php echo $v; ?> |
80 |
| - (<a href="/ChangeLog-<?php echo $MAJOR; ?>.php#<?php echo urlencode($v); ?>" class="changelog">Changelog</a>) |
81 |
| - </h3> |
82 |
| - <div class="content-box"> |
83 |
| - |
84 |
| - <ul> |
85 |
| - <?php foreach ($a['source'] as $rel): ?> |
86 |
| - <li> |
87 |
| - <?php download_link($rel['filename'], $rel['filename']); ?> |
88 |
| - <span class="releasedate"><?php echo date('d M Y', strtotime($rel['date'])); ?></span> |
89 |
| - <?php |
90 |
| - if (isset($rel['md5'])) echo '<span class="md5sum">', $rel['md5'], '</span>'; |
91 |
| - if (isset($rel['sha256'])) echo '<span class="sha256">', $rel['sha256'], '</span>'; |
92 |
| - ?> |
93 |
| - <?php if (isset($rel['note']) && $rel['note']): ?> |
94 |
| - <p> |
95 |
| - <strong>Note:</strong> |
96 |
| - <?php echo $rel['note']; ?> |
97 |
| - </p> |
98 |
| - <?php endif; ?> |
99 |
| - </li> |
100 |
| - <?php endforeach; ?> |
101 |
| - <li> |
102 |
| - <a href="https://windows.php.net/download#php-<?php echo urlencode($mver); ?>"> |
103 |
| - Windows downloads |
104 |
| - </a> |
105 |
| - </li> |
106 |
| - </ul> |
107 |
| - |
108 |
| - <a href="#gpg-<?php echo $mver; ?>">GPG Keys for PHP <?php echo $mver; ?></a> |
109 |
| - </div> |
110 |
| -<?php endforeach; ?> |
111 |
| -<?php endforeach; /* major releases loop end */ ?> |
112 |
| - |
113 |
| -<hr> |
114 |
| -<h2>GPG Keys</h2> |
115 |
| -<p> |
116 |
| -The releases are tagged and signed in the <a href='git.php'>PHP Git Repository</a>. |
117 |
| -The following official GnuPG keys of the current PHP Release Manager can be used |
118 |
| -to verify the tags: |
119 |
| -</p> |
| 217 | +<?php endif; ?> |
120 | 218 |
|
121 |
| -<?php gpg_key_show_keys(true /* activeOnly */); ?> |
| 219 | + <script> |
| 220 | + window.onload = function () { |
| 221 | + let form = document.getElementById("instructions-form") |
122 | 222 |
|
123 |
| -<p> |
124 |
| - <a href="gpg-keys.php"> |
125 |
| - A full list of GPG keys used for current and older releases is also |
126 |
| - available. |
127 |
| - </a> |
128 |
| -</p> |
| 223 | + form.addEventListener('change', function () { |
| 224 | + form.submit(); |
| 225 | + }); |
| 226 | + } |
| 227 | + </script> |
129 | 228 |
|
130 | 229 | <?php
|
131 | 230 | site_footer(['sidebar' => $SIDEBAR_DATA]);
|
0 commit comments