Skip to content

Commit 2614191

Browse files
committed
Add PHP 8.5 release page
1 parent e7e5fb6 commit 2614191

6 files changed

Lines changed: 274 additions & 0 deletions

File tree

images/php8/logo_php8_5.svg

Lines changed: 9 additions & 0 deletions
Loading

releases/8.5/common.php

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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+
];
12+
13+
function common_header(string $description): void {
14+
global $MYSITE;
15+
16+
$meta_image_path = \htmlspecialchars(
17+
\filter_var($MYSITE . 'images/php8/php_8_5_released.png', \FILTER_VALIDATE_URL));
18+
$meta_description = \htmlspecialchars($description);
19+
20+
\site_header("PHP 8.5 Release Announcement", [
21+
'current' => 'php8',
22+
'css' => ['php8.css'],
23+
'meta_tags' => <<<META
24+
<meta name="twitter:card" content="summary_large_image" />
25+
<meta name="twitter:site" content="@official_php" />
26+
<meta name="twitter:title" content="PHP 8.5 Released" />
27+
<meta name="twitter:description" content="{$meta_description}" />
28+
<meta name="twitter:creator" content="@official_php" />
29+
<meta name="twitter:image:src" content="{$meta_image_path}" />
30+
31+
<meta itemprop="name" content="PHP 8.5 Released" />
32+
<meta itemprop="description" content="{$meta_description}" />
33+
<meta itemprop="image" content="{$meta_image_path}" />
34+
35+
<meta property="og:image" content="{$meta_image_path}" />
36+
<meta property="og:description" content="{$meta_description}" />
37+
META
38+
]);
39+
}
40+
41+
function language_chooser(string $currentLang): void {
42+
// Print out the form with all the options
43+
echo '
44+
<form action="" method="get" id="changelang" name="changelang">
45+
<fieldset>
46+
<label for="changelang-langs">Change language:</label>
47+
<select onchange="location = this.value + \'.php\'" name="lang" id="changelang-langs">
48+
';
49+
50+
$tab = ' ';
51+
foreach (LANGUAGES as $lang => $text) {
52+
$selected = ($lang === $currentLang) ? ' selected="selected"' : '';
53+
echo $tab, "<option value='$lang'$selected>$text</option>\n";
54+
}
55+
56+
echo ' </select>
57+
</fieldset>
58+
</form>
59+
';
60+
}
61+
62+
function message($code, $language = 'en')
63+
{
64+
$original = require __DIR__ . '/languages/en.php';
65+
if (($language !== 'en') && file_exists(__DIR__ . '/languages/' . $language . '.php')) {
66+
$translation = require __DIR__ . '/languages/' . $language . '.php';
67+
}
68+
69+
return $translation[$code] ?? $original[$code] ?? $code;
70+
}

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/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\php85\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/languages/en.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
return [
4+
'common_header' => 'PHP 8.5 is a major update of the PHP language. It contains many new features, such as Pipe operator, Final Property Promotion, Attributes on Constants, performance improvements, bug fixes, and general cleanup.',
5+
'documentation' => 'Doc',
6+
'main_title' => 'Released!',
7+
'main_subtitle' => 'PHP 8.5 is a major update of the PHP language.<br class="display-none-md"> It contains many new features, such as Pipe operator, Final Property Promotion, Attributes on Constants, performance improvements, bug fixes, and general cleanup.',
8+
'upgrade_now' => 'Upgrade to PHP 8.5 now!',
9+
10+
'pipe_operator_title' => 'Pipe operator',
11+
'url_parsing_api_title' => 'Add RFC 3986 and WHATWG URL compliant API',
12+
'url_parsing_api_description' => '<code>Uri\UriException</code>, <code>Uri\InvalidUriException</code>, <code>Uri\UriComparisonMode</code>,
13+
<code>Uri\Rfc3986\Uri</code>, <code>Uri\WhatWg\InvalidUrlException</code>, <code>Uri\WhatWg\UrlValidationErrorType</code>, <code>Uri\WhatWg\UrlValidationError</code>, and <code>Uri\WhatWg\Url</code> are now available.',
14+
15+
'new_classes_title' => 'New Classes, Interfaces, and Functions',
16+
'new_core_attributes' => '<code>#[\NoDiscard]</code> and <code>#[\DelayedTargetValidation]</code> attributes',
17+
18+
'bc_title' => 'Deprecations and backward compatibility breaks',
19+
20+
'footer_title' => 'Better performance, better syntax, improved type safety.',
21+
'footer_description' => '<p>For source downloads of PHP 8.5 please visit the <a href="/downloads">downloads</a> page. Windows binaries can be found on the <a href="https://windows.php.net/download">PHP for Windows</a> site. The list of changes is recorded in the <a href="/ChangeLog-8.php#PHP_8_5">ChangeLog</a>.</p>
22+
<p>The <a href="/manual/en/migration85.php">migration guide</a> is available in the PHP Manual. Please consult it for a detailed list of new features and backward-incompatible changes.</p>',
23+
];

releases/8.5/release.inc

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
<?php
2+
3+
use function releases\php85\common_header;use function releases\php85\language_chooser;use function releases\php85\message;
4+
5+
if (!isset($lang)) {
6+
$lang = 'en';
7+
}
8+
if (!isset($documentation)) {
9+
$documentation = $lang;
10+
}
11+
12+
$_SERVER['BASE_PAGE'] = 'releases/8.5/' . $lang . '.php';
13+
14+
include_once __DIR__ . '/common.php';
15+
16+
common_header(message('common_header', $lang));
17+
18+
?>
19+
<section class="php8-section php8-section_dark php8-section_header center">
20+
<div class="page-tools">
21+
<div class="change-language">
22+
<?php language_chooser($lang); ?>
23+
</div>
24+
</div>
25+
<div class="php8-section__content">
26+
<div class="php8-logo">
27+
<img src="/images/php8/logo_php8_5.svg" alt="PHP 8.5" height="126" width="343">
28+
</div>
29+
<div class="php8-title"><?= message('main_title', $lang) ?></div>
30+
<div class="php8-subtitle"><?= message('main_subtitle', $lang) ?></div>
31+
<div class="php8-button-wrapper center">
32+
<a class="php8-button php8-button_light" href="/downloads"><?= message('upgrade_now', $lang) ?></a>
33+
</div>
34+
</div>
35+
</section>
36+
37+
<section class="php8-section center">
38+
<div class="php8-compare">
39+
<h2 class="php8-h2" id="property_hooks">
40+
<?= message('pipe_operator_title', $lang) ?>
41+
<a class="php8-rfc" href="https://wiki.php.net/rfc/pipe-operator-v3">RFC</a>
42+
</h2>
43+
<div class="php8-compare__main">
44+
<div class="php8-compare__block example-contents">
45+
<div class="php8-compare__label">PHP &lt; 8.5</div>
46+
<div class="php8-code phpcode">
47+
<?php highlight_php_trimmed(
48+
<<<'PHP'
49+
$input = ' Some kind of string. ';
50+
51+
$output = strtolower(
52+
str_replace(['.', '/', '…'], '',
53+
str_replace(' ', '-',
54+
trim($input)
55+
)
56+
)
57+
);
58+
PHP
59+
60+
); ?>
61+
</div>
62+
</div>
63+
<div class="php8-compare__arrow"></div>
64+
<div class="php8-compare__block example-contents" style="display: table;">
65+
<div class="php8-compare__label php8-compare__label_new">PHP 8.5</div>
66+
<div class="php8-code phpcode" style="display: table-cell;">
67+
<?php highlight_php_trimmed(
68+
<<<'PHP'
69+
$input = ' Some kind of string. ';
70+
71+
$output = $input
72+
|> trim(...)
73+
|> fn (string $string) => str_replace(' ', '-', $string)
74+
|> fn (string $string) => str_replace(['.', '/', '…'], '', $string)
75+
|> strtolower(...);
76+
PHP
77+
); ?>
78+
</div>
79+
</div>
80+
</div>
81+
</div>
82+
83+
<div class="php8-compare">
84+
<h2 class="php8-h2" id="property_hooks">
85+
<?= message('url_parsing_api_title', $lang) ?>
86+
<a class="php8-rfc" href="https://wiki.php.net/rfc/url_parsing_api">RFC</a>
87+
</h2>
88+
<div class="php8-compare__main">
89+
<div class="php8-compare__block example-contents">
90+
<div class="php8-compare__label">PHP &lt; 8.5</div>
91+
<div class="php8-code phpcode">
92+
<?php highlight_php_trimmed(
93+
<<<'PHP'
94+
$components = parse_url("https://php.net/releases/8.5/en.php");
95+
96+
var_dump($components['host']); // string(7) "php.net"
97+
PHP
98+
99+
); ?>
100+
</div>
101+
</div>
102+
<div class="php8-compare__arrow"></div>
103+
<div class="php8-compare__block example-contents" style="display: table;">
104+
<div class="php8-compare__label php8-compare__label_new">PHP 8.5</div>
105+
<div class="php8-code phpcode" style="display: table-cell;">
106+
<?php highlight_php_trimmed(
107+
<<<'PHP'
108+
$uri = new Uri\Rfc3986\Uri("https://php.net/releases/8.5/en.php");
109+
110+
var_dump($uri->getHost()); // string(7) "php.net"
111+
PHP
112+
); ?>
113+
</div>
114+
</div>
115+
</div>
116+
<div class="php8-compare__content">
117+
<?= message('url_parsing_api_description', $lang) ?>
118+
</div>
119+
</div>
120+
</section>
121+
122+
<section class="php8-section center php8-section_light php8-columns">
123+
<div class="php8-column">
124+
<h2 class="php8-h2" id="other_new_things"><?= message('new_classes_title', $lang) ?></h2>
125+
<div class="php8-compare__content php8-compare__content--block">
126+
<ul>
127+
128+
</ul>
129+
</div>
130+
</div>
131+
132+
<div class="php8-column">
133+
<h2 class="php8-h2" id="deprecations_and_bc_breaks"><?= message('bc_title', $lang) ?></h2>
134+
<div class="php8-compare__content">
135+
<ul>
136+
137+
</ul>
138+
</div>
139+
</div>
140+
</section>
141+
142+
<section class="php8-section php8-section_dark php8-section_footer php8-footer">
143+
<div class="php8-section__content">
144+
<h2 class="php8-h2 center"><?= message('footer_title', $lang) ?></h2>
145+
<div class="php8-button-wrapper center">
146+
<a class="php8-button php8-button_light" href="/downloads"><?= message('upgrade_now', $lang) ?></a>
147+
</div>
148+
<div class="php8-footer__content"><?= message('footer_description', $lang) ?></div>
149+
</div>
150+
</section>
151+
152+
<?php
153+
154+
site_footer();

0 commit comments

Comments
 (0)