Skip to content

Commit

Permalink
Fix: Run 'make coding-standards'
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Jul 12, 2022
1 parent cedd04c commit 5d7fbd6
Show file tree
Hide file tree
Showing 21 changed files with 236 additions and 196 deletions.
222 changes: 111 additions & 111 deletions ChangeLog-8.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cached.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
$abs = realpath($abs);

if (strncmp($abs, $pwd, strlen($pwd)) != 0) {
header("Location: https://www.php.net/" . strtr($_GET["f"],array("\r"=>"", "\n"=>"")));
header("Location: https://www.php.net/" . strtr($_GET["f"], array("\r"=>"", "\n"=>"")));
exit;
}

Expand Down
52 changes: 28 additions & 24 deletions cal.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
elseif ($cy && $cm && $cd) {

// Check if date is valid
if (checkdate($cm,$cd,$cy)) {
if (checkdate($cm, $cd, $cy)) {

// Date integer for that day
$date = mktime(0, 0, 1, $cm, $cd, $cy);
Expand All @@ -68,7 +68,7 @@

// Unable to load events for that day
else {
$errors[] = "There are no events for the specified date (".date("F j, Y",$date).").";
$errors[] = "There are no events for the specified date (".date("F j, Y", $date).").";
}
}

Expand All @@ -80,7 +80,7 @@
}

// Check if month and year is valid
if ($cm && $cy && !checkdate($cm,1,$cy)) {
if ($cm && $cy && !checkdate($cm, 1, $cy)) {
$errors[] = "The specified year and month (".htmlentities("$cy, $cm", ENT_QUOTES | ENT_IGNORE, 'UTF-8').") are not valid.";
unset($cm, $cy);
}
Expand Down Expand Up @@ -125,7 +125,7 @@
}

// Beginning and end of this month
$bom = mktime(0, 0, 1, $cm, 1, $cy);
$bom = mktime(0, 0, 1, $cm, 1, $cy);
$eom = mktime(0, 0, 1, $cm+1, 0, $cy);

// Link to previous month (but do not link to too early dates)
Expand All @@ -138,11 +138,13 @@

$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));
return sprintf(
'<a href="/cal.php?cm=%s&amp;cy=%s">%s, %s</a>',
urlencode($month),
urlencode($year),
htmlentities($monthName),
htmlentities($year)
);
})();

// Link to next month (but do not link to too early dates)
Expand All @@ -155,11 +157,13 @@

$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));
return sprintf(
'<a href="/cal.php?cm=%s&amp;cy=%s">%s, %s</a>',
urlencode($month),
urlencode($year),
htmlentities($monthName),
htmlentities($year)
);
})();

// Print out navigation links for previous and next month
Expand All @@ -174,22 +178,22 @@

// Print out headers for weekdays
for ($i = 0; $i < 7; $i++) {
echo '<th width="14%">', date("l",mktime(0,0,1,4,$i+1,2001)), "</th>\n";
echo '<th width="14%">', date("l", mktime(0, 0, 1, 4, $i+1, 2001)), "</th>\n";
}
echo "</tr>\n<tr>";

// Generate the requisite number of blank days to get things started
for ($days = $i = date("w",$bom); $i > 0; $i--) {
for ($days = $i = date("w", $bom); $i > 0; $i--) {
echo '<td class="notaday">&nbsp;</td>';
}

// Print out all the days in this month
for ($i = 1; $i <= date("t",$bom); $i++) {
for ($i = 1; $i <= date("t", $bom); $i++) {

// 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>';
display_events_for_day(date("Y-m-",$bom).sprintf("%02d",$i), $events);
display_events_for_day(date("Y-m-", $bom).sprintf("%02d", $i), $events);
echo '</td>';

// Break HTML table row if at end of week
Expand Down Expand Up @@ -218,11 +222,11 @@ function date_for_recur($recur, $day, $bom, $eom)
if ($recur > 0) {
$bomd = date("w", $bom) + 1;
$days = (($day - $bomd + 7) % 7) + (($recur - 1) * 7);
return mktime(0,0,1, date("m",$bom), $days + 1, date("Y",$bom));
return mktime(0, 0, 1, date("m", $bom), $days + 1, date("Y", $bom));
}

// ${recur}th to last $day of the month
$eomd = date("w",$eom) + 1;
$eomd = date("w", $eom) + 1;
$days = (($eomd - $day + 7) % 7) + ((abs($recur) - 1) * 7);

return mktime(0, 0, 1, date("m", $bom)+1, -$days, date("Y", $bom));
Expand Down Expand Up @@ -256,7 +260,7 @@ function display_events_for_day($day, $events): void
function load_event($id)
{
// Open events CSV file, return on error
$fp = @fopen("backend/events.csv",'r');
$fp = @fopen("backend/events.csv", 'r');
if (!$fp) { return FALSE; }

// Read as we can, event by event
Expand All @@ -283,15 +287,15 @@ function load_events($from, $whole_month = FALSE)
{
// Take advantage of the equality behavior of this date format
$from_date = date("Y-m-d", $from);
$bom = mktime(0, 0, 1, date("m",$from), 1, date("Y",$from));
$eom = mktime(0, 0, 1, date("m",$from) + 1, 0, date("Y",$from));
$bom = mktime(0, 0, 1, date("m", $from), 1, date("Y", $from));
$eom = mktime(0, 0, 1, date("m", $from) + 1, 0, date("Y", $from));
$to_date = date("Y-m-d", $whole_month ? $eom : $from);

// Set arrays to their default
$events = $seen = array();

// Try to open the events file for reading, return if unable to
$fp = @fopen("backend/events.csv",'r');
$fp = @fopen("backend/events.csv", 'r');
if (!$fp) { return FALSE; }

// For all events, read in the event and check it if fits our scope
Expand Down
3 changes: 2 additions & 1 deletion downloads.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
<p class="panel"><a href="/releases/">Old archives</a></p>
';

site_header("Downloads",
site_header(
"Downloads",
array(
'link' => array(
array(
Expand Down
3 changes: 2 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@
$meta_image_path = $MYSITE . 'images/meta-image.png';
$meta_description = "PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.";

site_header("Hypertext Preprocessor",
site_header(
"Hypertext Preprocessor",
array(
'current' => 'home',
'headtags' => array(
Expand Down
20 changes: 14 additions & 6 deletions manual/vote-note.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"vote" => $_REQUEST['vote'],
"ip" => $_SERVER['REMOTE_ADDR']
);
if (($r = posttohost($master_url, $data)) === null || strpos($r,"failed to open socket to") !== false) {
if (($r = posttohost($master_url, $data)) === null || strpos($r, "failed to open socket to") !== false) {
$response["success"] = false;
$response["msg"] = "Could not process your request at this time. Please try again later...";
}
Expand Down Expand Up @@ -76,7 +76,7 @@
"vote" => $_REQUEST['vote'],
"ip" => $_SERVER['REMOTE_ADDR'],
);
if (($r = posttohost($master_url, $data)) !== null && strpos($r,"failed to open socket to") === false) {
if (($r = posttohost($master_url, $data)) !== null && strpos($r, "failed to open socket to") === false) {
$r = json_decode($r);
if (isset($r->status, $r->votes) && $r->status) {
$thankyou = true;
Expand Down Expand Up @@ -129,8 +129,12 @@
$backID = htmlspecialchars($_REQUEST['id']);
$backPAGE = htmlspecialchars($_REQUEST['page']);
manual_note_display(
$N[$_REQUEST['id']]['xwhen'], $N[$_REQUEST['id']]['user'], $N[$_REQUEST['id']]['note'], $N[$_REQUEST['id']]['id'],
$N[$_REQUEST['id']]['votes'], false
$N[$_REQUEST['id']]['xwhen'],
$N[$_REQUEST['id']]['user'],
$N[$_REQUEST['id']]['note'],
$N[$_REQUEST['id']]['id'],
$N[$_REQUEST['id']]['votes'],
false
);
?>
</div>
Expand Down Expand Up @@ -185,8 +189,12 @@
$backID = htmlspecialchars($_REQUEST['id']);
$backPAGE = htmlspecialchars($_REQUEST['page']);
manual_note_display(
$N[$_REQUEST['id']]['xwhen'], $N[$_REQUEST['id']]['user'], $N[$_REQUEST['id']]['note'], $N[$_REQUEST['id']]['id'],
$N[$_REQUEST['id']]['votes'], false
$N[$_REQUEST['id']]['xwhen'],
$N[$_REQUEST['id']]['user'],
$N[$_REQUEST['id']]['note'],
$N[$_REQUEST['id']]['id'],
$N[$_REQUEST['id']]['votes'],
false
);
?>
</div>
Expand Down
3 changes: 2 additions & 1 deletion releases/8.0/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ function common_header(string $description): void {
global $MYSITE;

$meta_image_path = \htmlspecialchars(
\filter_var($MYSITE . 'images/php8/php_8_released.png', \FILTER_VALIDATE_URL));
\filter_var($MYSITE . 'images/php8/php_8_released.png', \FILTER_VALIDATE_URL)
);
$meta_description = \htmlspecialchars($description);

\site_header("PHP 8.0.0 Release Announcement", [
Expand Down
7 changes: 4 additions & 3 deletions releases/8.0/de.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
'Es beinhaltet viele neue Funktionen und Optimierungen wie beispielsweise ' .
'Named Arguments, Union Types, Attribute, Constructor Property Promotion, ' .
'Match Ausdrücke, Nullsafe Operator, JIT und Verbesserungen des Typen-Systems, ' .
'der Fehlerbehandlung und der Konsistenz.');
'der Fehlerbehandlung und der Konsistenz.'
);

?>
<section class="php8-section php8-section_dark php8-section_header center">
Expand Down Expand Up @@ -44,8 +45,8 @@
<div class="php8-compare__label">PHP 7</div>
<div class="php8-code phpcode">
<?php highlight_php_trimmed(
'htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, \'UTF-8\', false);'
);?>
'htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, \'UTF-8\', false);'
);?>
</div>
</div>
<div class="php8-compare__arrow"></div>
Expand Down
7 changes: 4 additions & 3 deletions releases/8.0/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
'It contains many new features and optimizations including ' .
'named arguments, union types, attributes, constructor property promotion, ' .
'match expression, nullsafe operator, JIT, and ' .
'improvements in the type system, error handling, and consistency.');
'improvements in the type system, error handling, and consistency.'
);

?>
<section class="php8-section php8-section_dark php8-section_header center">
Expand Down Expand Up @@ -43,8 +44,8 @@
<div class="php8-compare__label">PHP 7</div>
<div class="php8-code phpcode">
<?php highlight_php_trimmed(
'htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, \'UTF-8\', false);'
);?>
'htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, \'UTF-8\', false);'
);?>
</div>


Expand Down
7 changes: 4 additions & 3 deletions releases/8.0/es.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
releases\php80\common_header(
'PHP 8.0 es una actualización importante del lenguaje php que contiene nuevos recursos y optimizaciones incluyendo ' .
'argumentos nombrados, tipos de uniones, atributos, promoción de propiedades constructivas, expresiones de equivalencia, ' .
'operador nullsafe, JIT (traducción dinámica) y también mejoras en el sistema de tipos, manejo de errores y consistencia en general.');
'operador nullsafe, JIT (traducción dinámica) y también mejoras en el sistema de tipos, manejo de errores y consistencia en general.'
);

?>
<section class="php8-section php8-section_dark php8-section_header center">
Expand Down Expand Up @@ -42,8 +43,8 @@
<div class="php8-compare__label">PHP 7</div>
<div class="php8-code phpcode">
<?php highlight_php_trimmed(
'htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, \'UTF-8\', false);'
);?>
'htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, \'UTF-8\', false);'
);?>
</div>


Expand Down
7 changes: 4 additions & 3 deletions releases/8.0/fr.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"promotion de propriétés de constructeur, l'expression match, " .
"l'opérateur nullsafe, JIT (Compilation à la Volée), " .
"et des améliorations dans le système de typage, " .
"la gestion d'erreur, et de cohérence.");
"la gestion d'erreur, et de cohérence."
);

?>
<section class="php8-section php8-section_dark php8-section_header center">
Expand Down Expand Up @@ -47,8 +48,8 @@
<div class="php8-compare__label">PHP 7</div>
<div class="php8-code phpcode">
<?php highlight_php_trimmed(
'htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, \'UTF-8\', false);'
);?>
'htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, \'UTF-8\', false);'
);?>
</div>


Expand Down
7 changes: 4 additions & 3 deletions releases/8.0/it.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
'Contiene molte nuove funzionalità ed ottimizzazioni quali ' .
'i named arguments, la definizione di tipi unione, gli attributi, la promozione a proprietà degli argomenti del costruttore, ' .
'l\'espressione match, l\'operatore nullsafe, la compilazione JIT e ' .
'miglioramenti al sistema dei tipi, alla gestione degli errori e alla consistenza.');
'miglioramenti al sistema dei tipi, alla gestione degli errori e alla consistenza.'
);

?>
<section class="php8-section php8-section_dark php8-section_header center">
Expand Down Expand Up @@ -45,8 +46,8 @@
<div class="php8-compare__label">PHP 7</div>
<div class="php8-code phpcode">
<?php highlight_php_trimmed(
'htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, \'UTF-8\', false);'
);?>
'htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, \'UTF-8\', false);'
);?>
</div>


Expand Down
7 changes: 4 additions & 3 deletions releases/8.0/ja.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
'このアップデートには、たくさんの新機能や最適化が含まれています。たとえば' .
'名前付き引数、union 型、アトリビュート、コンストラクタでのプロパティのプロモーション、' .
'match 式、 nullsafe 演算子、JIT、' .
'型システムの改善、エラーハンドリング、一貫性の向上などです。');
'型システムの改善、エラーハンドリング、一貫性の向上などです。'
);

?>
<section class="php8-section php8-section_dark php8-section_header center">
Expand Down Expand Up @@ -42,8 +43,8 @@
<div class="php8-compare__label">PHP 7</div>
<div class="php8-code phpcode">
<?php highlight_php_trimmed(
'htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, \'UTF-8\', false);'
);?>
'htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, \'UTF-8\', false);'
);?>
</div>


Expand Down
7 changes: 4 additions & 3 deletions releases/8.0/ka.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
'მათ შორის დასახელებული არგუმენტები, union type, ატრიბუტები, ' .
'თვისებების გამარტივებული განსაზღვრა კონსტრუქტორში, გამოსახულება match, ' .
'ოპერატორი nullsafe, JIT და გაუმჯობესებები ტიპის სისტემაში, ' .
'შეცდომების დამუშავება და თანმიმდევრულობა.');
'შეცდომების დამუშავება და თანმიმდევრულობა.'
);

?>
<section class="php8-section php8-section_dark php8-section_header center">
Expand Down Expand Up @@ -44,8 +45,8 @@
<div class="php8-compare__label">PHP 7</div>
<div class="php8-code phpcode">
<?php highlight_php_trimmed(
'htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, \'UTF-8\', false);'
);?>
'htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, \'UTF-8\', false);'
);?>
</div>


Expand Down
7 changes: 4 additions & 3 deletions releases/8.0/nl.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
'Het bevat veel nieuwe mogelijkheden en optimalisaties, waaronder ' .
'argument naamgeving, unie types, attributen, promotie van constructor eigenschappen, ' .
'expressie vergelijking, null-veilige operator, JIT, en ' .
'verbeteringen aan het type systeem, foute afhandeling, en consistentie.');
'verbeteringen aan het type systeem, foute afhandeling, en consistentie.'
);

?>
<section class="php8-section php8-section_dark php8-section_header center">
Expand Down Expand Up @@ -44,8 +45,8 @@
<div class="php8-compare__label">PHP 7</div>
<div class="php8-code phpcode">
<?php highlight_php_trimmed(
'htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, \'UTF-8\', false);'
);?>
'htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, \'UTF-8\', false);'
);?>
</div>


Expand Down
Loading

0 comments on commit 5d7fbd6

Please sign in to comment.