Skip to content

Commit a4e1d4d

Browse files
committed
Add PHP 8.5 Release page
1 parent 64dfeda commit a4e1d4d

File tree

27 files changed

+1898
-4
lines changed

27 files changed

+1898
-4
lines changed

images/php8/logo_php8_5.svg

Lines changed: 9 additions & 0 deletions
Loading

images/php8/php_8_5-animated.svg

Lines changed: 9 additions & 0 deletions
Loading

include/layout.inc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function highlight_php($code, $return = false)
4343
// Same as highlight_php() but does not require '<?php' in $code
4444
function highlight_php_trimmed($code, $return = false)
4545
{
46-
$code = "<?php\n" . $code;
46+
$code = "<?php\r\n" . $code;
4747
$highlighted_code = highlight_php($code, true);
4848
$highlighted_code = preg_replace("!&lt;\?php(<br />)+!", '', $highlighted_code, 1);
4949

@@ -506,10 +506,10 @@ function get_nav_items(): array {
506506
id: 'help',
507507
),
508508
new NavItem(
509-
name: 'PHP 8.4',
510-
href: '/releases/8.4/index.php',
509+
name: 'PHP 8.5',
510+
href: '/releases/8.5/index.php',
511511
id: 'php8',
512-
image: '/images/php8/logo_php8_4.svg',
512+
image: '/images/php8/logo_php8_5.svg',
513513
)
514514
];
515515
}

releases/8.5/common.php

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace releases\php85;
6+
7+
include_once __DIR__ . '/../../include/prepend.inc';
8+
9+
const LANGUAGES = [
10+
'en' => 'English',
11+
'fr' => 'Français',
12+
'ru' => 'Russian',
13+
'pt_BR' => 'Brazilian Portuguese',
14+
'nl' => 'Nederlands',
15+
'es' => 'Spanish',
16+
'tr' => 'Türkçe',
17+
'uk' => 'Українська',
18+
'zh' => '简体中文',
19+
'ja' => '日本語',
20+
];
21+
22+
function common_header(string $description): void {
23+
global $MYSITE;
24+
25+
$meta_image_path = \htmlspecialchars(
26+
\filter_var($MYSITE . 'images/php8/php_8_5_released.png', \FILTER_VALIDATE_URL));
27+
$meta_description = \htmlspecialchars($description);
28+
29+
\site_header("PHP 8.5 Release Announcement", [
30+
'current' => 'php8',
31+
'css' => ['php85.css'],
32+
'meta_tags' => <<<META
33+
<meta name="twitter:card" content="summary_large_image" />
34+
<meta name="twitter:site" content="@official_php" />
35+
<meta name="twitter:title" content="PHP 8.5 Released" />
36+
<meta name="twitter:description" content="{$meta_description}" />
37+
<meta name="twitter:creator" content="@official_php" />
38+
<meta name="twitter:image:src" content="{$meta_image_path}" />
39+
40+
<meta itemprop="name" content="PHP 8.5 Released" />
41+
<meta itemprop="description" content="{$meta_description}" />
42+
<meta itemprop="image" content="{$meta_image_path}" />
43+
44+
<meta property="og:image" content="{$meta_image_path}" />
45+
<meta property="og:description" content="{$meta_description}" />
46+
META
47+
]);
48+
}
49+
50+
function language_chooser(string $currentLang): void {
51+
// Print out the form with all the options
52+
echo '
53+
<form action="" method="get" id="changelang" name="changelang">
54+
<fieldset>
55+
<label for="changelang-langs">Change language:</label>
56+
<select onchange="location = this.value + \'.php\'" name="lang" id="changelang-langs">
57+
';
58+
59+
$tab = ' ';
60+
foreach (LANGUAGES as $lang => $text) {
61+
$selected = ($lang === $currentLang) ? ' selected="selected"' : '';
62+
echo $tab, "<option value='$lang'$selected>$text</option>\n";
63+
}
64+
65+
echo ' </select>
66+
</fieldset>
67+
</form>
68+
';
69+
}
70+
71+
function message($code, $language = 'en')
72+
{
73+
$original = require __DIR__ . '/languages/en.php';
74+
if (($language !== 'en') && file_exists(__DIR__ . '/languages/' . $language . '.php')) {
75+
$translation = require __DIR__ . '/languages/' . $language . '.php';
76+
}
77+
78+
return $translation[$code] ?? $original[$code] ?? $code;
79+
}

releases/8.5/en.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
$lang = 'en';
4+
5+
include_once __DIR__ . '/release.inc';

releases/8.5/es.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
$lang = 'es';
4+
5+
include_once __DIR__ . '/release.inc';

releases/8.5/fr.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
$lang = 'fr';
4+
5+
include_once __DIR__ . '/release.inc';

releases/8.5/index.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
use phpweb\LangChooser;
4+
use const releases\php84\LANGUAGES;
5+
6+
$_SERVER['BASE_PAGE'] = 'releases/8.5/index.php';
7+
require_once __DIR__ . '/common.php';
8+
require_once __DIR__ . '/../../src/autoload.php';
9+
10+
$langChooser = new LangChooser(LANGUAGES, [], "", "");
11+
[$lang,] = $langChooser->chooseCode("", "", $_SERVER['HTTP_ACCEPT_LANGUAGE']);
12+
13+
mirror_redirect("/releases/8.5/$lang.php");

releases/8.5/ja.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
$lang = 'ja';
4+
5+
include_once __DIR__ . '/release.inc';

0 commit comments

Comments
 (0)