Skip to content

Commit d9aebea

Browse files
committed
Fix: Run 'make coding-standards'
1 parent b0ddb28 commit d9aebea

17 files changed

+523
-523
lines changed

archive/index.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
include_once __DIR__ . '/../include/prepend.inc';
33
$i = 0;
44
do {
5-
$y = date("Y")-$i;
6-
if (file_exists("./$y.php")) {
7-
mirror_redirect("/archive/$y.php");
8-
break;
9-
}
5+
$y = date("Y")-$i;
6+
if (file_exists("./$y.php")) {
7+
mirror_redirect("/archive/$y.php");
8+
break;
9+
}
1010
} while(++$i<3);
1111

1212
include_once __DIR__ . '/../include/errors.inc';

docs.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
// List all manual languages viewable online
3030
$lastlang = end($ACTIVE_ONLINE_LANGUAGES);
3131
foreach ($ACTIVE_ONLINE_LANGUAGES as $langcode => $langname) {
32-
if (!file_exists($_SERVER["DOCUMENT_ROOT"] . "/manual/{$langcode}/index.php")) {
33-
continue;
34-
}
32+
if (!file_exists($_SERVER["DOCUMENT_ROOT"] . "/manual/{$langcode}/index.php")) {
33+
continue;
34+
}
3535

3636
// Make preferred language bold
3737
if ($langcode == $LANG) { echo "<strong>"; }

eol.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
// Notes for specific branches can be added here, and will appear in the table.
88
$BRANCH_NOTES = array(
99
'7.3' => '<a href="/migration74">A guide is available for migrating from PHP 7.3 to 7.4.</a>',
10-
'7.2' => '<a href="/migration73">A guide is available for migrating from PHP 7.2 to 7.3.</a>',
11-
'7.1' => '<a href="/migration72">A guide is available for migrating from PHP 7.1 to 7.2.</a>',
12-
'7.0' => '<a href="/migration71">A guide is available for migrating from PHP 7.0 to 7.1.</a>',
13-
'5.6' => '<a href="/migration70">A guide is available for migrating from PHP 5.6 to 7.0.</a>',
14-
'5.5' => '<a href="/migration56">A guide is available for migrating from PHP 5.5 to 5.6.</a>',
15-
'5.4' => '<a href="/migration55">A guide is available for migrating from PHP 5.4 to 5.5.</a>',
16-
'5.3' => '<a href="/migration54">A guide is available for migrating from PHP 5.3 to 5.4.</a>',
17-
'5.2' => '<a href="/migration53">A guide is available for migrating from PHP 5.2 to 5.3.</a>',
18-
'5.1' => '<a href="/migration52">A guide is available for migrating from PHP 5.1 to 5.2.</a>',
19-
'5.0' => '<a href="/migration51">A guide is available for migrating from PHP 5.0 to 5.1.</a>',
20-
'4.4' => '<a href="/migration5">A guide is available for migrating from PHP 4 to PHP 5.0.</a>',
10+
'7.2' => '<a href="/migration73">A guide is available for migrating from PHP 7.2 to 7.3.</a>',
11+
'7.1' => '<a href="/migration72">A guide is available for migrating from PHP 7.1 to 7.2.</a>',
12+
'7.0' => '<a href="/migration71">A guide is available for migrating from PHP 7.0 to 7.1.</a>',
13+
'5.6' => '<a href="/migration70">A guide is available for migrating from PHP 5.6 to 7.0.</a>',
14+
'5.5' => '<a href="/migration56">A guide is available for migrating from PHP 5.5 to 5.6.</a>',
15+
'5.4' => '<a href="/migration55">A guide is available for migrating from PHP 5.4 to 5.5.</a>',
16+
'5.3' => '<a href="/migration54">A guide is available for migrating from PHP 5.3 to 5.4.</a>',
17+
'5.2' => '<a href="/migration53">A guide is available for migrating from PHP 5.2 to 5.3.</a>',
18+
'5.1' => '<a href="/migration52">A guide is available for migrating from PHP 5.1 to 5.2.</a>',
19+
'5.0' => '<a href="/migration51">A guide is available for migrating from PHP 5.0 to 5.1.</a>',
20+
'4.4' => '<a href="/migration5">A guide is available for migrating from PHP 4 to PHP 5.0.</a>',
2121
);
2222

2323
site_header('Unsupported Branches');

git-php.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158
} // endif: no data or checkread not checked
159159

160160
else {
161-
if (count($_POST)) {
161+
if (count($_POST)) {
162162
print <<<EOT
163163
<div class="warning">
164164
<p>
@@ -361,9 +361,9 @@ class="max" value="<?php if (isset($_POST['email'])) echo clean($_POST['email'])
361361
<td>
362362
<?php
363363
$purposes = array("Learning PHP", "Coding in PHP", "Reading the PHP source",
364-
"Using PHP extensions", "Creating experimental PHP extensions",
365-
"Submitting a patch to PHP", "Adding notes to the documentation",
366-
"Writing web pages with PHP");
364+
"Using PHP extensions", "Creating experimental PHP extensions",
365+
"Submitting a patch to PHP", "Adding notes to the documentation",
366+
"Writing web pages with PHP");
367367

368368
foreach ($purposes as $i => $p) { ?>
369369
<input type="checkbox" name="purpose[<?php echo $i?>]" value="1"

images/logo.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ function serve_compressed_if_available($logo): void {
7272

7373
$logo = './logos/php-logo.svg';
7474
if (isset($_SERVER['QUERY_STRING'])) {
75-
switch ($_SERVER['QUERY_STRING']) {
76-
case 'QA':
77-
case 'qa':
78-
$logo = './logos/qa.jpg';
79-
break;
80-
}
75+
switch ($_SERVER['QUERY_STRING']) {
76+
case 'QA':
77+
case 'qa':
78+
$logo = './logos/qa.jpg';
79+
break;
80+
}
8181
}
8282

8383
// xmas season, december and the first week of January

images/supported-versions.php

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,49 +11,49 @@
1111
$footer_height = 24;
1212

1313
function branches_to_show() {
14-
// Basically: show all 5.3+ branches with EOL dates > min_date().
15-
$branches = array();
16-
17-
// Flatten out the majors.
18-
foreach (get_all_branches() as $major_branches) {
19-
foreach ($major_branches as $branch => $version) {
20-
if (version_compare($branch, '5.3', 'ge') && get_branch_security_eol_date($branch) > min_date()) {
21-
$branches[$branch] = $version;
22-
}
23-
}
24-
}
25-
26-
ksort($branches);
27-
return $branches;
14+
// Basically: show all 5.3+ branches with EOL dates > min_date().
15+
$branches = array();
16+
17+
// Flatten out the majors.
18+
foreach (get_all_branches() as $major_branches) {
19+
foreach ($major_branches as $branch => $version) {
20+
if (version_compare($branch, '5.3', 'ge') && get_branch_security_eol_date($branch) > min_date()) {
21+
$branches[$branch] = $version;
22+
}
23+
}
24+
}
25+
26+
ksort($branches);
27+
return $branches;
2828
}
2929

3030
function min_date() {
31-
$now = new DateTime('January 1');
32-
return $now->sub(new DateInterval('P3Y'));
31+
$now = new DateTime('January 1');
32+
return $now->sub(new DateInterval('P3Y'));
3333
}
3434

3535
function max_date() {
36-
$now = new DateTime('January 1');
37-
return $now->add(new DateInterval('P5Y'));
36+
$now = new DateTime('January 1');
37+
return $now->add(new DateInterval('P5Y'));
3838
}
3939

4040
function date_horiz_coord(DateTime $date) {
41-
$diff = $date->diff(min_date());
42-
if (!$diff->invert) {
43-
return $GLOBALS['margin_left'];
44-
}
45-
return $GLOBALS['margin_left'] + ($diff->days / (365.24 / $GLOBALS['year_width']));
41+
$diff = $date->diff(min_date());
42+
if (!$diff->invert) {
43+
return $GLOBALS['margin_left'];
44+
}
45+
return $GLOBALS['margin_left'] + ($diff->days / (365.24 / $GLOBALS['year_width']));
4646
}
4747

4848
$branches = branches_to_show();
4949
$i = 0;
5050
foreach ($branches as $branch => $version) {
51-
$branches[$branch]['top'] = $header_height + ($branch_height * $i++);
51+
$branches[$branch]['top'] = $header_height + ($branch_height * $i++);
5252
}
5353

5454
if (!isset($non_standalone)) {
55-
header('Content-Type: image/svg+xml');
56-
echo '<?xml version="1.0"?>';
55+
header('Content-Type: image/svg+xml');
56+
echo '<?xml version="1.0"?>';
5757
}
5858

5959
$years = iterator_to_array(new DatePeriod(min_date(), new DateInterval('P1Y'), max_date()));
@@ -132,10 +132,10 @@ function date_horiz_coord(DateTime $date) {
132132
<g class="branches">
133133
<?php foreach ($branches as $branch => $version): ?>
134134
<?php
135-
$x_release = date_horiz_coord(get_branch_release_date($branch));
136-
$x_bug = date_horiz_coord(get_branch_bug_eol_date($branch));
137-
$x_eol = date_horiz_coord(get_branch_security_eol_date($branch));
138-
?>
135+
$x_release = date_horiz_coord(get_branch_release_date($branch));
136+
$x_bug = date_horiz_coord(get_branch_bug_eol_date($branch));
137+
$x_eol = date_horiz_coord(get_branch_security_eol_date($branch));
138+
?>
139139
<rect class="stable" x="<?php echo $x_release ?>" y="<?php echo $version['top'] ?>" width="<?php echo $x_bug - $x_release ?>" height="<?php echo $branch_height ?>" />
140140
<rect class="security" x="<?php echo $x_bug ?>" y="<?php echo $version['top'] ?>" width="<?php echo $x_eol - $x_bug ?>" height="<?php echo $branch_height ?>" />
141141
<?php endforeach ?>
@@ -154,9 +154,9 @@ function date_horiz_coord(DateTime $date) {
154154
<!-- Today -->
155155
<g class="today">
156156
<?php
157-
$now = new DateTime;
158-
$x = date_horiz_coord($now);
159-
?>
157+
$now = new DateTime;
158+
$x = date_horiz_coord($now);
159+
?>
160160
<line x1="<?php echo $x ?>" y1="<?php echo $header_height ?>" x2="<?php echo $x ?>" y2="<?php echo $header_height + (count($branches) * $branch_height) ?>" />
161161
<text x="<?php echo $x ?>" y="<?php echo $header_height + (count($branches) * $branch_height) + (0.8 * $footer_height) ?>">
162162
<?php echo 'Today: '.$now->format('j M Y') ?>

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
);
181181
$announcements = "";
182182
foreach($CONF_TEASER as $category => $entries) {
183-
if ($entries) {
183+
if ($entries) {
184184
$announcements .= '<div class="panel">';
185185
$announcements .= ' <a href="/conferences" class="headline" title="' . $conftype[$category] . '">' . $conftype[$category] .'</a>';
186186
$announcements .= '<div class="body"><ul>';

manual-lookup.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
}
1414

1515
if(!empty($_GET['scope']) && is_string($_GET['scope'])) {
16-
$scope = htmlspecialchars($_GET['scope'], ENT_QUOTES, 'UTF-8');
16+
$scope = htmlspecialchars($_GET['scope'], ENT_QUOTES, 'UTF-8');
1717
} else {
18-
$scope = '';
18+
$scope = '';
1919
}
2020

2121
// Prepare data for search

manual/spam_challenge.php

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,63 +4,63 @@
44
const NUMS = array('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine');
55

66
function plus($a, $b) {
7-
return $a + $b;
7+
return $a + $b;
88
}
99

1010
function gen_plus($a) {
11-
return rand(0, 9 - $a);
11+
return rand(0, 9 - $a);
1212
}
1313

1414
function minus($a, $b) {
15-
return $a - $b;
15+
return $a - $b;
1616
}
1717

1818
function gen_minus($a) {
19-
return rand(0, $a);
19+
return rand(0, $a);
2020
}
2121

2222
function print_infix($name, $a, $b) {
23-
return "$a $name $b";
23+
return "$a $name $b";
2424
}
2525

2626
function print_prefix($name, $a, $b) {
27-
return "$name($a, $b)";
27+
return "$name($a, $b)";
2828
}
2929

3030
const CHALLENGES = array(
31-
// name, print, generator
32-
array('max', 'print_prefix'),
33-
array('min', 'print_prefix'),
34-
array('minus', 'print_infix', 'gen_minus'),
35-
array('plus', 'print_infix', 'gen_plus'),
31+
// name, print, generator
32+
array('max', 'print_prefix'),
33+
array('min', 'print_prefix'),
34+
array('minus', 'print_infix', 'gen_minus'),
35+
array('plus', 'print_infix', 'gen_plus'),
3636
);
3737

3838
// generate a challenge
3939
function gen_challenge() {
40-
$c = CHALLENGES[rand(0, count(CHALLENGES)-1)];
40+
$c = CHALLENGES[rand(0, count(CHALLENGES)-1)];
4141

42-
$a = rand(0, 9);
43-
$an = NUMS[$a];
44-
$b = isset($c[2]) ? $c[2]($a) : rand(0, 9);
45-
$bn = NUMS[$b];
42+
$a = rand(0, 9);
43+
$an = NUMS[$a];
44+
$b = isset($c[2]) ? $c[2]($a) : rand(0, 9);
45+
$bn = NUMS[$b];
4646

47-
return array($c[0], $an, $bn, $c[1]($c[0], $an, $bn));
47+
return array($c[0], $an, $bn, $c[1]($c[0], $an, $bn));
4848
}
4949

5050

5151
// test an answer for validity
5252
function test_answer($name, $an, $bn, $answer) {
53-
foreach (CHALLENGES as $x) {
54-
if ($x[0] === $name) {
55-
$c = $x;
56-
break;
57-
}
58-
}
53+
foreach (CHALLENGES as $x) {
54+
if ($x[0] === $name) {
55+
$c = $x;
56+
break;
57+
}
58+
}
5959

60-
$a = array_search($an, NUMS);
61-
$b = array_search($bn, NUMS);
60+
$a = array_search($an, NUMS);
61+
$b = array_search($bn, NUMS);
6262

63-
if (empty($c) || $a === false || $b === false) return false;
63+
if (empty($c) || $a === false || $b === false) return false;
6464

65-
return (NUMS[$c[0]($a, $b)] === $answer);
65+
return (NUMS[$c[0]($a, $b)] === $answer);
6666
}

mirror-info.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
$dist = $latest['source'][0];
1717
$filename = __DIR__ . "/distributions/{$dist['filename']}";
1818
if (!file_exists($filename)) {
19-
$hash_ok = 0;
19+
$hash_ok = 0;
2020
} elseif (isset($dist['sha256']) &&
21-
function_exists('hash_file') &&
22-
in_array('sha256', hash_algos(), true)) {
23-
$hash_ok = (int)(hash_file('sha256', $filename) === $dist['sha256']);
21+
function_exists('hash_file') &&
22+
in_array('sha256', hash_algos(), true)) {
23+
$hash_ok = (int)(hash_file('sha256', $filename) === $dist['sha256']);
2424
} else {
25-
$hash_ok = 0;
25+
$hash_ok = 0;
2626
}
2727

2828
// Does this mirror have sqlite?

releases/5_3_3.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
non-namespaced classes.
2323

2424
<p><?php
25-
highlight_string('<?php
25+
highlight_string('<?php
2626
namespace Foo;
2727
class Bar {
2828
public function Bar() {
@@ -31,7 +31,7 @@ public function Bar() {
3131
}
3232
}
3333
?>');
34-
?></p>
34+
?></p>
3535
<p>There is no impact on migration from 5.2.x because namespaces were only introduced in PHP 5.3.</p></li>
3636
</ul>
3737
<p>

0 commit comments

Comments
 (0)