cvs: phpweb /include layout.inc
| From: | Hannes Magnusson | Date: | Mon, 20 Apr 2009 07:37:18 +0000 |
| Subject: | cvs: phpweb /include layout.inc | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-4483@lists.php.net to get a copy of this message | ||
bjori Mon Apr 20 07:37:18 2009 UTC
Modified files:
/phpweb/include layout.inc
Log:
Better fix for sending out correct content language headers
http://cvs.php.net/viewvc.cgi/phpweb/include/layout.inc?r1=1.302&r2=1.303&diff_format=u
Index: phpweb/include/layout.inc
diff -u phpweb/include/layout.inc:1.302 phpweb/include/layout.inc:1.303
--- phpweb/include/layout.inc:1.302 Mon Apr 20 07:25:33 2009
+++ phpweb/include/layout.inc Mon Apr 20 07:37:18 2009
@@ -1,5 +1,5 @@
<?php
-/* $Id: layout.inc,v 1.302 2009/04/20 07:25:33 bjori Exp $ */
+/* $Id: layout.inc,v 1.303 2009/04/20 07:37:18 bjori Exp $ */
// Set the static content root differently on php.net
$_SERVER['STATIC_ROOT'] = ($MYSITE == 'http://www.php.net/') ?
@@ -75,11 +75,18 @@
if (!empty($SIDEBAR_DATA)) { $PAGE_COLUMNS++; }
if (!empty($RSIDEBAR_DATA)) { $PAGE_COLUMNS++; }
+ // Check which language we are presenting, default to english
+ $lang = "en";
+ if (isset($config["lang"])) {
+ $lang = language_convert($config["lang"]);
+ } elseif (isset($PGI, $PGI['head'], $PGI['head'][1])) {
+ $lang = language_convert($PGI['head'][1]);
+ }
+
// Print out lang and charset headers
- if (!isset($config["lang"])) { $config["lang"] = "en"; }
if (!isset($config["charset"])) { $config["charset"] = "utf-8"; }
header("Content-type: text/html;charset={$config['charset']}");
- header("Content-language: {$config['lang']}");
+ header("Content-language: {$lang}");
header("X-PHP-QUESTION: I wonder if anyone will ever notice this");
if (isset($config["extra_headers"]) &&
is_array($config["extra_headers"])) {
foreach($config["extra_headers"] as $key => $value) {
@@ -150,15 +157,11 @@
// Right-to-left support
$rtl = "";
- $lang = "en";
- if (isset($PGI, $PGI['head'], $PGI['head'][1])) {
- $lang = language_convert($PGI['head'][1]);
- switch ($lang) {
- case "he":
- case "ar":
- $rtl = ' style="direction: rtl"';
- break;
- }
+ switch ($lang) {
+ case "he":
+ case "ar":
+ $rtl = ' style="direction: rtl"';
+ break;
}
$profile = "";