com web/php: Some code-style improvements... I think. It also improves some HTML semantics (such as using label instead of p) so if you revert this,
please bear that in mind. It probably should have been separate commits; I'm sorry.: include/shared-manual.inc
| From: | Levi Morrison | Date: | Wed, 01 Jan 2014 19:37:19 +0000 |
| Subject: | com web/php: Some code-style improvements... I think. It also improves some HTML semantics (such as using label instead of p) so if you revert this, please bear that in mind. It probably should have been separate commits; I'm sorry.: include/shared-manual.inc |
||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-17979@lists.php.net to get a copy of this message | ||
Commit: acf87cb5bc70ee6007fa6b967757bd96288b1b22
Author: Levi Morrison <levim@php.net> Wed, 1 Jan 2014 12:37:19 -0700
Parents: ddc2e92602542b09defaed7d6f5a449e1a4d52e3
Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=acf87cb5bc70ee6007fa6b967757bd96288b1b22
Log:
Some code-style improvements... I think. It also improves some HTML semantics (such as using label
instead of p) so if you revert this, please bear that in mind. It probably should have been separate
commits; I'm sorry.
Changed paths:
M include/shared-manual.inc
Diff:
diff --git a/include/shared-manual.inc b/include/shared-manual.inc
index 5916fa3..b66003c 100644
--- a/include/shared-manual..inc
+++ b/include/shared-manual.inc
@@ -399,23 +399,23 @@ function manual_setup($setup) {
site_header($setup["this"][1] . " - Manual ", $config);
$id = substr($setup['this'][0], 0, -4);
- ?>
- <div class="page-tools">
- <div class="change-language">
- <?php echo manual_language_chooser($config['lang'],
$config['thispage']); ?>
- </div>
- <div class="edit-bug">
- <a href="https://edit.php.net/?project=PHP&perm=<?php
echo $config['lang']; ?>/<?php echo $config['thispage'];
?>">Edit</a>
- <a href="https://bugs.php.net/report.php?bug_type=Documentation+problem&manpage=<?php
echo $id; ?>">Report a Bug</a>
- </div>
- </div>
- <?php
+ $language_chooser = 'manual_language_chooser';
+ echo <<<PAGE_TOOLS
+ <div class="page-tools">
+ <div class="change-language">
+ {$language_chooser($config['lang'], $config['thispage'])}
+ </div>
+ <div class="edit-bug">
+ <a href="https://edit.php.net/?project=PHP&perm={$config['lang']}/{$config['thispage']}">Edit</a>
+ <a href="https://bugs.php.net/report.php?bug_type=Documentation+problem&manpage=$id">Report
a Bug</a>
+ </div>
+ </div>
+PAGE_TOOLS;
}
function manual_language_chooser($currentlang, $currentpage) {
global $ACTIVE_ONLINE_LANGUAGES;
-
$links = array();
foreach ($ACTIVE_ONLINE_LANGUAGES as $lang => $name) {
@@ -423,19 +423,31 @@ function manual_language_chooser($currentlang, $currentpage) {
}
// Print out the form with all the options
- $rt = '<form action="/manual/change.php" method="get"
id="changelang" name="changelang">'.
- '<fieldset>'.
- '
- <p>Change language:
- <select onchange="document.changelang.submit()" name="page"
id="changelang-langs">';
- foreach ($links as $link) {
- $rt.= "<option value='{$link[0]}' " .($link[2] ==
$currentlang ? "selected" : ""). ">{$link[1]}</option>\n";
- }
- $rt.= '<option value="help-translate.php">Other</option>'.
- '</select></p>'.
- '</fieldset>'.
- '</form>';
- return $rt;
+ $format_options = function (array $links) use ($currentlang) {
+ $out = '';
+ $tab = str_repeat(' ', 6);
+ foreach ($links as $link) {
+ list($value, $text, $lang) = $link;
+ $selected = '';
+ if ($lang == $currentlang) {
+ $selected = ' selected="selected"';
+ }
+ $out .= "$tab<option
value='$value'$selected>$text</option>\n";
+ }
+ return trim($out);
+ };
+ $r = <<<CHANGE_LANG
+ <form action="/manual/change.php" method="get"
id="changelang" name="changelang">
+ <fieldset>
+ <label for="changelang-langs">Change language:</label>
+ <select onchange="document.changelang.submit()" name="page"
id="changelang-langs">
+ {$format_options($links)}
+ <option value="help-translate.php">Other</option>
+ </select>
+ </fieldset>
+ </form>
+CHANGE_LANG;
+ return trim($r);
}
function manual_header(){}