Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions images/php8/logo_php8_5.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 70 additions & 0 deletions releases/8.5/common.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php

declare(strict_types=1);

namespace releases\php85;

include_once __DIR__ . '/../../include/prepend.inc';

const LANGUAGES = [
'en' => 'English',
];

function common_header(string $description): void {
global $MYSITE;

$meta_image_path = \htmlspecialchars(
\filter_var($MYSITE . 'images/php8/php_8_5_released.png', \FILTER_VALIDATE_URL));
$meta_description = \htmlspecialchars($description);

\site_header("PHP 8.5 Release Announcement", [
'current' => 'php8',
'css' => ['php8.css'],
'meta_tags' => <<<META
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@official_php" />
<meta name="twitter:title" content="PHP 8.5 Released" />
<meta name="twitter:description" content="{$meta_description}" />
<meta name="twitter:creator" content="@official_php" />
<meta name="twitter:image:src" content="{$meta_image_path}" />

<meta itemprop="name" content="PHP 8.5 Released" />
<meta itemprop="description" content="{$meta_description}" />
<meta itemprop="image" content="{$meta_image_path}" />

<meta property="og:image" content="{$meta_image_path}" />
<meta property="og:description" content="{$meta_description}" />
META
]);
}

function language_chooser(string $currentLang): void {
// Print out the form with all the options
echo '
<form action="" method="get" id="changelang" name="changelang">
<fieldset>
<label for="changelang-langs">Change language:</label>
<select onchange="location = this.value + \'.php\'" name="lang" id="changelang-langs">
';

$tab = ' ';
foreach (LANGUAGES as $lang => $text) {
$selected = ($lang === $currentLang) ? ' selected="selected"' : '';
echo $tab, "<option value='$lang'$selected>$text</option>\n";
}

echo ' </select>
</fieldset>
</form>
';
}

function message($code, $language = 'en')
{
$original = require __DIR__ . '/languages/en.php';
if (($language !== 'en') && file_exists(__DIR__ . '/languages/' . $language . '.php')) {
$translation = require __DIR__ . '/languages/' . $language . '.php';
}

return $translation[$code] ?? $original[$code] ?? $code;
}
5 changes: 5 additions & 0 deletions releases/8.5/en.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

$lang = 'en';

include_once __DIR__ . '/release.inc';
13 changes: 13 additions & 0 deletions releases/8.5/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

use phpweb\LangChooser;
use const releases\php85\LANGUAGES;

$_SERVER['BASE_PAGE'] = 'releases/8.5/index.php';
require_once __DIR__ . '/common.php';
require_once __DIR__ . '/../../src/autoload.php';

$langChooser = new LangChooser(LANGUAGES, [], "", "");
[$lang,] = $langChooser->chooseCode("", "", $_SERVER['HTTP_ACCEPT_LANGUAGE']);

mirror_redirect("/releases/8.5/$lang.php");
23 changes: 23 additions & 0 deletions releases/8.5/languages/en.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

return [
'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.',
'documentation' => 'Doc',
'main_title' => 'Released!',
'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.',
'upgrade_now' => 'Upgrade to PHP 8.5 now!',

'pipe_operator_title' => 'Pipe operator',
'url_parsing_api_title' => 'Add RFC 3986 and WHATWG URL compliant API',
'url_parsing_api_description' => '<code>Uri\UriException</code>, <code>Uri\InvalidUriException</code>, <code>Uri\UriComparisonMode</code>,
<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.',

'new_classes_title' => 'New Classes, Interfaces, and Functions',
'new_core_attributes' => '<code>#[\NoDiscard]</code> and <code>#[\DelayedTargetValidation]</code> attributes',

'bc_title' => 'Deprecations and backward compatibility breaks',

'footer_title' => 'Better performance, better syntax, improved type safety.',
'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>
<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>',
];
154 changes: 154 additions & 0 deletions releases/8.5/release.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
<?php

use function releases\php85\common_header;use function releases\php85\language_chooser;use function releases\php85\message;

if (!isset($lang)) {
$lang = 'en';
}
if (!isset($documentation)) {
$documentation = $lang;
}

$_SERVER['BASE_PAGE'] = 'releases/8.5/' . $lang . '.php';

include_once __DIR__ . '/common.php';

common_header(message('common_header', $lang));

?>
<section class="php8-section php8-section_dark php8-section_header center">
<div class="page-tools">
<div class="change-language">
<?php language_chooser($lang); ?>
</div>
</div>
<div class="php8-section__content">
<div class="php8-logo">
<img src="/images/php8/logo_php8_5.svg" alt="PHP 8.5" height="126" width="343">
</div>
<div class="php8-title"><?= message('main_title', $lang) ?></div>
<div class="php8-subtitle"><?= message('main_subtitle', $lang) ?></div>
<div class="php8-button-wrapper center">
<a class="php8-button php8-button_light" href="/downloads"><?= message('upgrade_now', $lang) ?></a>
</div>
</div>
</section>

<section class="php8-section center">
<div class="php8-compare">
<h2 class="php8-h2" id="property_hooks">
<?= message('pipe_operator_title', $lang) ?>
<a class="php8-rfc" href="https://wiki.php.net/rfc/pipe-operator-v3">RFC</a>
</h2>
<div class="php8-compare__main">
<div class="php8-compare__block example-contents">
<div class="php8-compare__label">PHP &lt; 8.5</div>
<div class="php8-code phpcode">
<?php highlight_php_trimmed(
<<<'PHP'
$input = ' Some kind of string. ';
$output = strtolower(
str_replace(['.', '/', '…'], '',
str_replace(' ', '-',
trim($input)
)
)
);
PHP

); ?>
</div>
</div>
<div class="php8-compare__arrow"></div>
<div class="php8-compare__block example-contents" style="display: table;">
<div class="php8-compare__label php8-compare__label_new">PHP 8.5</div>
<div class="php8-code phpcode" style="display: table-cell;">
<?php highlight_php_trimmed(
<<<'PHP'
$input = ' Some kind of string. ';
$output = $input
|> trim(...)
|> fn (string $string) => str_replace(' ', '-', $string)
|> fn (string $string) => str_replace(['.', '/', '…'], '', $string)
|> strtolower(...);
PHP
); ?>
</div>
</div>
</div>
</div>

<div class="php8-compare">
<h2 class="php8-h2" id="property_hooks">
<?= message('url_parsing_api_title', $lang) ?>
<a class="php8-rfc" href="https://wiki.php.net/rfc/url_parsing_api">RFC</a>
</h2>
<div class="php8-compare__main">
<div class="php8-compare__block example-contents">
<div class="php8-compare__label">PHP &lt; 8.5</div>
<div class="php8-code phpcode">
<?php highlight_php_trimmed(
<<<'PHP'
$components = parse_url("https://php.net/releases/8.5/en.php");
var_dump($components['host']); // string(7) "php.net"
PHP

); ?>
</div>
</div>
<div class="php8-compare__arrow"></div>
<div class="php8-compare__block example-contents" style="display: table;">
<div class="php8-compare__label php8-compare__label_new">PHP 8.5</div>
<div class="php8-code phpcode" style="display: table-cell;">
<?php highlight_php_trimmed(
<<<'PHP'
$uri = new Uri\Rfc3986\Uri("https://php.net/releases/8.5/en.php");
var_dump($uri->getHost()); // string(7) "php.net"
PHP
); ?>
</div>
</div>
</div>
<div class="php8-compare__content">
<?= message('url_parsing_api_description', $lang) ?>
</div>
</div>
</section>

<section class="php8-section center php8-section_light php8-columns">
<div class="php8-column">
<h2 class="php8-h2" id="other_new_things"><?= message('new_classes_title', $lang) ?></h2>
<div class="php8-compare__content php8-compare__content--block">
<ul>

</ul>
</div>
</div>

<div class="php8-column">
<h2 class="php8-h2" id="deprecations_and_bc_breaks"><?= message('bc_title', $lang) ?></h2>
<div class="php8-compare__content">
<ul>

</ul>
</div>
</div>
</section>

<section class="php8-section php8-section_dark php8-section_footer php8-footer">
<div class="php8-section__content">
<h2 class="php8-h2 center"><?= message('footer_title', $lang) ?></h2>
<div class="php8-button-wrapper center">
<a class="php8-button php8-button_light" href="/downloads"><?= message('upgrade_now', $lang) ?></a>
</div>
<div class="php8-footer__content"><?= message('footer_description', $lang) ?></div>
</div>
</section>

<?php

site_footer();