Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Enable statement_indentation fixer #886

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
'constructs_preceded_by_a_single_space' => [],
'constructs_followed_by_a_single_space' => [],
],
'statement_indentation' => true,
'strict_param' => true,
'switch_case_space' => true,
'ternary_operator_spaces' => true,
Expand Down
66 changes: 33 additions & 33 deletions cal.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@
$date = mktime(0, 0, 1, $cm, 1, $cy);

if (!$begun) {
site_header("Events: " . date("F Y", $date), $site_header_config);
?>
site_header("Events: " . date("F Y", $date), $site_header_config);
?>
Comment on lines +96 to +97
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not work very well when mixing PHP with other code.

<div class="tip">
<p>
If you would like to suggest an upcoming event to be listed on this
Expand Down Expand Up @@ -139,10 +139,10 @@
$month = date('m', $lm);
$monthName = date('F', $lm);
return sprintf('<a href="/cal.php?cm=%s&amp;cy=%s">%s, %s</a>',
urlencode($month),
urlencode($year),
htmlentities($monthName),
htmlentities($year));
urlencode($month),
urlencode($year),
htmlentities($monthName),
htmlentities($year));
})();

// Link to next month (but do not link to too early dates)
Expand All @@ -156,21 +156,21 @@
$month = date('m', $nm);
$monthName = date('F', $nm);
return sprintf('<a href="/cal.php?cm=%s&amp;cy=%s">%s, %s</a>',
urlencode($month),
urlencode($year),
htmlentities($monthName),
htmlentities($year));
urlencode($month),
urlencode($year),
htmlentities($monthName),
htmlentities($year));
})();

// Print out navigation links for previous and next month
echo '<br><table id="calnav" width="100%" border="0" cellspacing="0" cellpadding="3">',
"\n<tr>", '<td align="left" width="33%">', $prev_link, '</td>',
'<td align="center" width="33%"><b>', htmlentities(date('F, Y', $bom)), '</b></td>',
'<td align="right" width="33%">', $next_link, "</td></tr>\n</table>\n";
"\n<tr>", '<td align="left" width="33%">', $prev_link, '</td>',
'<td align="center" width="33%"><b>', htmlentities(date('F, Y', $bom)), '</b></td>',
'<td align="right" width="33%">', $next_link, "</td></tr>\n</table>\n";

// Begin the calendar table
echo '<table id="cal" width="100%" border="1" cellspacing="0" cellpadding="3">',
"\n",'<tr>',"\n";
"\n",'<tr>',"\n";

// Print out headers for weekdays
for ($i = 0; $i < 7; $i++) {
Expand All @@ -188,7 +188,7 @@

// Print out day number and all events for the day
echo '<td><a class="day" href="/cal.php', "?cm=$cm&amp;cd=$i&amp;cy=$cy",
'">',$i,'</a>';
'">',$i,'</a>';
display_events_for_day(date("Y-m-",$bom) . sprintf("%02d",$i), $events);
echo '</td>';

Expand Down Expand Up @@ -241,13 +241,13 @@ function display_events_for_day($day, $events): void
if (($event['type'] == 2 && $event['start'] <= $day && $event['end'] >= $day)
|| ($event['start'] == $day)) {
echo '<div class="event">',
($COUNTRY == $event['country'] ? "<strong>" : ""),
'<a class="cat' . $event['category'] . '" href="/cal.php',
"?id=$event[id]&amp;cm=$cm&amp;cy=$cy", '">',
stripslashes(htmlentities($event['sdesc'], ENT_QUOTES | ENT_IGNORE, 'UTF-8')),
'</a>',
($COUNTRY == $event['country'] ? "</strong>" : ""),
'</div>';
($COUNTRY == $event['country'] ? "<strong>" : ""),
'<a class="cat' . $event['category'] . '" href="/cal.php',
"?id=$event[id]&amp;cm=$cm&amp;cy=$cy", '">',
stripslashes(htmlentities($event['sdesc'], ENT_QUOTES | ENT_IGNORE, 'UTF-8')),
'</a>',
($COUNTRY == $event['country'] ? "</strong>" : ""),
'</div>';
}
}
}
Expand All @@ -262,14 +262,14 @@ function load_event($id)
// Read as we can, event by event
while (!feof($fp)) {

$event = read_event($fp);
$event = read_event($fp);

// Return with the event, if it's ID is the one
// we search for (also close the file)
if ($event !== false && $event['id'] == $id) {
fclose($fp);
return $event;
}
// Return with the event, if it's ID is the one
// we search for (also close the file)
if ($event !== false && $event['id'] == $id) {
fclose($fp);
return $event;
}
}

// Close file, and return sign of failure
Expand Down Expand Up @@ -311,25 +311,25 @@ function load_events($from, $whole_month = false)
// Check if event is in our scope, depending on type
switch ($event['type']) {

// Recurring event
// Recurring event
case 3:
$date = date_for_recur($event['recur'], $event['recur_day'], $bom, $eom);
$event['start'] = date("Y-m-d", $date);
// Fall through. Now it is just like a single-day event

// Single-day event
// Single-day event
case 1:
if ($event['start'] >= $from_date && $event['start'] <= $to_date) {
$events[] = $event;
}
break;

// Multi-day event
// Multi-day event
case 2:
if (($event['start'] >= $from_date && $event['start'] <= $to_date)
|| ($event['end'] >= $from_date && $event['end'] <= $to_date)
|| ($event['start'] <= $from_date && $event['end'] >= $to_date)) {
$events[] = $event;
$events[] = $event;
}
break;
}
Expand Down
2 changes: 1 addition & 1 deletion download-docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
// Go through all possible manual languages
foreach ($LANGUAGES as $langcode => $language) {
if (isset($INACTIVE_ONLINE_LANGUAGES[$langcode]) && $MYSITE !== 'http://docs.php.net/') {
continue;
continue;
}

// Go through all possible manual formats
Expand Down
10 changes: 5 additions & 5 deletions downloads.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
);
?>
<?php $i = 0; foreach ($RELEASES as $MAJOR => $major_releases): /* major releases loop start */
$releases = array_slice($major_releases, 0, $SHOW_COUNT);
?>
$releases = array_slice($major_releases, 0, $SHOW_COUNT);
?>
<a id="v<?php echo $MAJOR; ?>"></a>
<?php foreach ($releases as $v => $a): ?>
<?php $mver = substr($v, 0, strrpos($v, '.')); ?>
Expand All @@ -60,9 +60,9 @@
<?php download_link($rel['filename'], $rel['filename']); ?>
<span class="releasedate"><?php echo date('d M Y', strtotime($rel['date'])); ?></span>
<?php
if (isset($rel['md5'])) echo '<span class="md5sum">', $rel['md5'], '</span>';
if (isset($rel['sha256'])) echo '<span class="sha256">', $rel['sha256'], '</span>';
?>
if (isset($rel['md5'])) echo '<span class="md5sum">', $rel['md5'], '</span>';
if (isset($rel['sha256'])) echo '<span class="sha256">', $rel['sha256'], '</span>';
?>
<?php if (isset($rel['note']) && $rel['note']): ?>
<p>
<strong>Note:</strong>
Expand Down
10 changes: 5 additions & 5 deletions git-php.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
echo "<div class=\"warning\"><p>$error</p></div>";
}
else {
?>
?>
<p>
Thank you. Your request has been sent. You should hear something within the
next week or so. If you haven't heard anything by around <?php echo date('l, F jS', time() + 604800); ?>
Expand Down Expand Up @@ -152,7 +152,7 @@
</p>

<?php
site_footer();
site_footer();
exit;
} // endif: no error found
} // endif: no data or checkread not checked
Expand All @@ -168,7 +168,7 @@
</div>
EOT;
}
?>
?>

<div class="content-box">
<p>
Expand Down Expand Up @@ -399,8 +399,8 @@ class="max" value="<?php if (isset($_POST['password'])) echo clean($_POST['passw
<select name="group">
<?php
foreach ($groups as $group => $name) {
$selected = (isset($_POST["group"]) && $_POST["group"] == $group) ? ' selected="selected"' : '';
echo "<option value='$group'$selected>$name</option>\n";
$selected = (isset($_POST["group"]) && $_POST["group"] == $group) ? ' selected="selected"' : '';
echo "<option value='$group'$selected>$name</option>\n";
}
?>
</select>
Expand Down
10 changes: 5 additions & 5 deletions images/supported-versions.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ function date_horiz_coord(DateTime $date) {
<?php foreach ($branches as $branch => $version): ?>
<?php
$x_release = date_horiz_coord(get_branch_release_date($branch));
$x_bug = date_horiz_coord(get_branch_bug_eol_date($branch));
$x_eol = date_horiz_coord(get_branch_security_eol_date($branch));
?>
$x_bug = date_horiz_coord(get_branch_bug_eol_date($branch));
$x_eol = date_horiz_coord(get_branch_security_eol_date($branch));
?>
<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 ?>" />
<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 ?>" />
<?php endforeach ?>
Expand All @@ -157,8 +157,8 @@ function date_horiz_coord(DateTime $date) {
<g class="today">
<?php
$now = new DateTime();
$x = date_horiz_coord($now);
?>
$x = date_horiz_coord($now);
?>
<line x1="<?php echo $x ?>" y1="<?php echo $header_height ?>" x2="<?php echo $x ?>" y2="<?php echo $header_height + (count($branches) * $branch_height) ?>" />
<text x="<?php echo $x ?>" y="<?php echo $header_height + (count($branches) * $branch_height) + (0.8 * $footer_height) ?>">
<?php echo 'Today: ' . $now->format('j M Y') ?>
Expand Down
18 changes: 9 additions & 9 deletions include/branches.inc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function format_interval($from, DateTime $to) {
if ($diff->y) {
$times[] = [$diff->y, 'year'];
if ($diff->m) {
$times[] = [$diff->m, 'month'];
$times[] = [$diff->m, 'month'];
}
} elseif ($diff->m) {
$times[] = [$diff->m, 'month'];
Expand All @@ -63,14 +63,14 @@ function format_interval($from, DateTime $to) {
}
if ($times) {
$eolPeriod = implode(', ',
array_map(
function ($t) {
return "$t[0] $t[1]" .
($t[0] != 1 ? 's' : '');
},
$times,
),
);
array_map(
function ($t) {
return "$t[0] $t[1]" .
($t[0] != 1 ? 's' : '');
},
$times,
),
);

if ($diff->invert) {
$eolPeriod = "$eolPeriod ago";
Expand Down
12 changes: 6 additions & 6 deletions include/footer.inc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<?php
foreach($section['children'] as $item):
$cleanTitle = $item['title'];
?>
?>
<li class="<?php echo ($item['current']) ? 'current' : ''; ?>">
<a href="<?php echo $item['link']; ?>" title="<?php echo $cleanTitle; ?>"><?php echo $cleanTitle; ?></a>
</li>
Expand Down Expand Up @@ -88,11 +88,11 @@
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
<?php
$jsfiles = ["ext/hogan-3.0.2.min.js", "ext/typeahead.min.js", "ext/mousetrap.min.js", "ext/jquery.scrollTo.min.js", "search.js", "common.js"];
foreach ($jsfiles as $filename) {
$path = dirname(__DIR__) . '/js/' . $filename;
echo '<script src="/cached.php?t=' . @filemtime($path) . '&amp;f=/js/' . $filename . '"></script>' . "\n";
}
?>
foreach ($jsfiles as $filename) {
$path = dirname(__DIR__) . '/js/' . $filename;
echo '<script src="/cached.php?t=' . @filemtime($path) . '&amp;f=/js/' . $filename . '"></script>' . "\n";
}
?>

<a id="toTop" href="javascript:;"><span id="toTopHover"></span><img width="40" height="40" alt="To Top" src="/images/to-top@2x.png"></a>

Expand Down
2 changes: 1 addition & 1 deletion include/get-download.inc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ echo '<div id="mirrors-container">';
$size = 0;
// No downloadable file found
if ($file === false) {
$info = "<p>
$info = "<p>
The file you requested (<strong>" . htmlspecialchars($df, ENT_QUOTES, "UTF-8") . "</strong>) is not found on
this server (<strong>{$MYSITE}</strong>).</p>";

Expand Down
12 changes: 6 additions & 6 deletions include/header.inc
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ if (!isset($config["languages"])) {
<ul>
<?php
$breadcrumbs = $config['breadcrumbs'];
$last = array_pop($breadcrumbs);
foreach ($breadcrumbs as $crumb) {
echo " <li><a href='{$crumb['link']}'>{$crumb['title']}</a></li>";
}
echo " <li><a href='{$last['link']}'>{$last['title']}</a></li>";
$last = array_pop($breadcrumbs);
foreach ($breadcrumbs as $crumb) {
echo " <li><a href='{$crumb['link']}'>{$crumb['title']}</a></li>";
}
echo " <li><a href='{$last['link']}'>{$last['title']}</a></li>";

?>
?>
</ul>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions include/ip-to-country.inc
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ function i2c_go()

// User already has a country detected with this IP stored
if (!empty($_COOKIE['COUNTRY']) && strpos($_COOKIE['COUNTRY'], ',') !== false) {
list($COUNTRY, $storedip) = explode(",", $_COOKIE['COUNTRY']);
if ($storedip == $ipnum) { return true; }
list($COUNTRY, $storedip) = explode(",", $_COOKIE['COUNTRY']);
if ($storedip == $ipnum) { return true; }
}

// Convert the IP number to some useable form for searching
Expand Down
14 changes: 7 additions & 7 deletions include/langchooser.inc
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,14 @@ function language_choose_code()
// As most of the language dependant operations involve manual
// page display (lookup, search, shortcuts), we will check for
// the index file of manuals.
/*
foreach ($languages as $language) {
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/manual/$language/index.php")) {
$selected = $language;
break;
/*
foreach ($languages as $language) {
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/manual/$language/index.php")) {
$selected = $language;
break;
}
}
}
*/
*/
$selected = $languages[0];

// Return with all found data
Expand Down
Loading