1<?php 2 3declare(strict_types=1); 4 5namespace releases\php80; 6 7include_once __DIR__ . '/../../include/prepend.inc'; 8 9function common_header(string $description): void { 10 global $MYSITE; 11 12 $meta_image_path = \htmlspecialchars( 13 \filter_var($MYSITE . 'images/php8/php_8_released.png', \FILTER_VALIDATE_URL)); 14 $meta_description = \htmlspecialchars($description); 15 16 \site_header("PHP 8.0.0 Release Announcement", [ 17 'current' => 'php8', 18 'css' => ['php8.css'], 19 'meta_tags' => <<<META 20<meta name="twitter:card" content="summary_large_image" /> 21<meta name="twitter:site" content="@official_php" /> 22<meta name="twitter:title" content="PHP 8.0 Released" /> 23<meta name="twitter:description" content="{$meta_description}" /> 24<meta name="twitter:creator" content="@official_php" /> 25<meta name="twitter:image:src" content="{$meta_image_path}" /> 26 27<meta itemprop="name" content="PHP 8.0 Released" /> 28<meta itemprop="description" content="{$meta_description}" /> 29<meta itemprop="image" content="{$meta_image_path}" /> 30 31<meta property="og:image" content="{$meta_image_path}" /> 32<meta property="og:description" content="{$meta_description}" /> 33META 34 ]); 35} 36 37function language_chooser(string $currentLang): void { 38 $LANGUAGES = [ 39 'en' => 'English', 40 'de' => 'Deutsch', 41 'es' => 'Español', 42 'fr' => 'Français', 43 'it' => 'Italiano', 44 'ja' => '日本語', 45 'nl' => 'Nederlands', 46 'pt_BR' => 'Português do Brasil', 47 'ru' => 'Русский', 48 'tr' => 'Türkçe', 49 'zh' => '简体中文', 50 'ka' => 'ქართული', 51 ]; 52 53 // Print out the form with all the options 54 echo ' 55 <form action="" method="get" id="changelang" name="changelang"> 56 <fieldset> 57 <label for="changelang-langs">Change language:</label> 58 <select onchange="location = this.value + \'.php\'" name="lang" id="changelang-langs"> 59'; 60 61 $tab = ' '; 62 foreach ($LANGUAGES as $lang => $text) { 63 $selected = ($lang === $currentLang) ? ' selected="selected"' : ''; 64 echo $tab, "<option value='$lang'$selected>$text</option>\n"; 65 } 66 67 echo ' </select> 68 </fieldset> 69 </form> 70'; 71} 72