Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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.
9 changes: 9 additions & 0 deletions images/php8/php_8_5-animated.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions include/layout.inc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function highlight_php($code, $return = false)
// Same as highlight_php() but does not require '<?php' in $code
function highlight_php_trimmed($code, $return = false)
{
$code = "<?php\n" . $code;
$code = "<?php\r\n" . $code;
$highlighted_code = highlight_php($code, true);
$highlighted_code = preg_replace("!&lt;\?php(<br />)+!", '', $highlighted_code, 1);

Expand Down Expand Up @@ -506,10 +506,10 @@ function get_nav_items(): array {
id: 'help',
),
new NavItem(
name: 'PHP 8.4',
href: '/releases/8.4/index.php',
name: 'PHP 8.5',
href: '/releases/8.5/index.php',
id: 'php8',
image: '/images/php8/logo_php8_4.svg',
image: '/images/php8/logo_php8_5.svg',
)
];
}
Expand Down
79 changes: 79 additions & 0 deletions releases/8.5/common.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php

declare(strict_types=1);

namespace releases\php85;

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

const LANGUAGES = [
'en' => 'English',
'fr' => 'Français',
'ru' => 'Russian',
'pt_BR' => 'Brazilian Portuguese',
'nl' => 'Nederlands',
'es' => 'Spanish',
'tr' => 'Türkçe',
'uk' => 'Українська',
'zh' => '简体中文',
'ja' => '日本語',
];

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' => ['php85.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';
5 changes: 5 additions & 0 deletions releases/8.5/es.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

$lang = 'es';

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

$lang = 'fr';

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\php84\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");
5 changes: 5 additions & 0 deletions releases/8.5/ja.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

$lang = 'ja';

include_once __DIR__ . '/release.inc';
Loading
Loading