Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
6 changes: 3 additions & 3 deletions include/layout.inc
Original file line number Diff line number Diff line change
Expand Up @@ -564,10 +564,10 @@ function get_nav_items(): array {
id: 'help',
),
new NavItem(
name: 'PHP 8.5',
href: '/releases/8.5/index.php',
name: 'PHP 8.6',
href: '/releases/8.6/index.php',
id: 'php8',
image: '/images/php8/logo_php8_5.svg',
image: '/images/php8/logo_php8_6.svg',
)
];
}
Expand Down
9 changes: 9 additions & 0 deletions public/images/php8/logo_php8_6.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/php8/php_8_6_released.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 67 additions & 0 deletions public/releases/8.6/common.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

declare(strict_types=1);

namespace releases\php86;

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

const LANGUAGES = [
'en' => 'English',
'ru' => 'Русский',
];

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

$meta_image_url = \filter_var($MYSITE . 'images/php8/php_8_6_released.png', \FILTER_VALIDATE_URL);
$meta_image_path = $meta_image_url === false ? '' : \htmlspecialchars($meta_image_url);
$meta_description = \htmlspecialchars($description);

$languages = [];
foreach (LANGUAGES as $code => $text) {
$languages[] = ['name' => $text, 'selected' => $lang === $code, 'url' => '/releases/8.6/' . $code . '.php'];
}

\site_header("PHP 8.6 Release Announcement", [
'current' => 'php85',
Comment thread
saundefined marked this conversation as resolved.
Resolved
'css' => ['php85.css'],
'language_switcher' => $languages,
'theme_switcher' => true,
'cache_control' => 60 * 60, // 1 hour
'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.6 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.6 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
]);
}

/**
* @param array<int|string, string> $interpolations
*/
function message(string $code, string $language = 'en', array $interpolations = []): string
{
$original = require __DIR__ . '/languages/en.php';
if (($language !== 'en') && file_exists(__DIR__ . '/languages/' . $language . '.php')) {
$translation = require __DIR__ . '/languages/' . $language . '.php';
}

$message = $translation[$code] ?? $original[$code] ?? $code;

foreach ($interpolations as $name => $value) {
$message = str_replace("{{$name}}", $value, $message);
}

return $message;
}
5 changes: 5 additions & 0 deletions public/releases/8.6/en.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

$lang = 'en';

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

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

$_SERVER['BASE_PAGE'] = 'releases/8.6/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.6/$lang.php");
Loading
Loading