1
0
mirror of https://github.com/php/web-php.git synced 2026-03-23 23:02:13 +01:00

Enhancement: Enable and configure concat_space fixer

Closes GH-657.
This commit is contained in:
Andreas Möller
2022-08-22 19:04:47 +02:00
committed by GitHub
parent d9bcfed482
commit 57f505ed58
20 changed files with 58 additions and 55 deletions

View File

@@ -22,6 +22,9 @@ $config
'array_indentation' => true,
'array_syntax' => true,
'class_attributes_separation' => true,
'concat_space' => [
'spacing' => 'one',
],
'constant_case' => true,
'indentation_type' => true,
'line_ending' => true,

View File

@@ -18,7 +18,7 @@ if (!isset($_GET["f"])) {
exit;
}
$pwd = realpath($_SERVER["DOCUMENT_ROOT"]);
$abs = $pwd. "/" .(string)$_GET["f"];
$abs = $pwd . "/" . (string)$_GET["f"];
$abs = realpath($abs);
if (strncmp($abs, $pwd, strlen($pwd)) != 0) {

14
cal.php
View File

@@ -41,7 +41,7 @@ if ($id) {
}
// Unable to find event, put this to the error messages' list
else {
$errors[] = "There is no event for specified id ('".htmlentities($id, ENT_QUOTES | ENT_IGNORE, 'UTF-8')."')";
$errors[] = "There is no event for specified id ('" . htmlentities($id, ENT_QUOTES | ENT_IGNORE, 'UTF-8') . "')";
}
}
@@ -57,7 +57,7 @@ elseif ($cy && $cm && $cd) {
// Try to load events for that day, and display them all
if ($events = load_events($date)) {
$site_header_config = ['classes' => 'calendar calendar-day'] + $site_header_config;
site_header("Events: ".date("F j, Y", $date), $site_header_config);
site_header("Events: " . date("F j, Y", $date), $site_header_config);
echo "<h2>", date("F j, Y", $date), "</h2>\n";
foreach ($events as $event) {
display_event($event, 0);
@@ -68,20 +68,20 @@ elseif ($cy && $cm && $cd) {
// 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) . ").";
}
}
// Wrong date specified
else {
$errors[] = "The specified date (".htmlentities("$cy/$cm/$cd", ENT_QUOTES | ENT_IGNORE, 'UTF-8').") was not valid.";
$errors[] = "The specified date (" . htmlentities("$cy/$cm/$cd", ENT_QUOTES | ENT_IGNORE, 'UTF-8') . ") was not valid.";
unset($cm, $cd, $cy);
}
}
// Check if month and year is valid
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.";
$errors[] = "The specified year and month (" . htmlentities("$cy, $cm", ENT_QUOTES | ENT_IGNORE, 'UTF-8') . ") are not valid.";
unset($cm, $cy);
}
@@ -93,7 +93,7 @@ if (empty($cy)) { $cy = date("Y"); }
$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);
?>
<div class="tip">
<p>
@@ -189,7 +189,7 @@ 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

View File

@@ -31,7 +31,7 @@ foreach ($frontpage as $entry) {
$id = parse_url($entry["id"], PHP_URL_FRAGMENT);
$date = date_format(date_create($entry["updated"]), 'Y-m-d');
$content .= '<div class="newsentry">';
$content .= '<h3 class="newstitle title"><a href="'. $MYSITE.$link .'" id="' . $id . '">' . $entry["title"] . '</a></h3>';
$content .= '<h3 class="newstitle title"><a href="' . $MYSITE . $link . '" id="' . $id . '">' . $entry["title"] . '</a></h3>';
$content .= '<div class="newsimage">';
if (isset($entry["newsImage"])) {

View File

@@ -664,7 +664,7 @@ if ($try) {
}
// BC. The class methods are now classname.methodname
if (preg_match("!^manual/(.+)/function\.(.+)-(.+).php$!", $URI, $array)) {
$try = find_manual_page($array[1], $array[2]. "." .$array[3]);
$try = find_manual_page($array[1], $array[2] . "." . $array[3]);
if ($try) {
status_header(301);
mirror_redirect($try);

View File

@@ -6,7 +6,7 @@ include_once __DIR__ . '/include/posttohost.inc';
// Force the account requests to php.net
if (!is_primary_site()) {
header('Location: https://www.php.net/'.$_SERVER['BASE_PAGE']);
header('Location: https://www.php.net/' . $_SERVER['BASE_PAGE']);
exit;
}
@@ -49,7 +49,7 @@ if (count($_POST) && (!isset($_POST['purpose']) || !is_array($_POST['purpose'])
if (empty($_POST['id'])) {
$error .= "You must supply a desired Git user id. <br>";
} elseif (!preg_match('!^[a-z]\w+$!', $_POST['id']) || strlen($_POST['id']) > 16) {
$error .= "Your user id must be from 1-16 characters long, start with ".
$error .= "Your user id must be from 1-16 characters long, start with " .
"a letter and contain nothing but a-z, 0-9, and _ <br>";
}
if (empty($_POST['fullname'])) {

View File

@@ -159,7 +159,7 @@ $height = $header_height + $footer_height + (count($branches) * $branch_height);
?>
<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') ?>
<?php echo 'Today: ' . $now->format('j M Y') ?>
</text>
</g>
</svg>

View File

@@ -103,6 +103,6 @@ function blacklisted($email) {
'@conferenceseries.com',
];
foreach ($mosquitoes as $m) {
if (preg_match('/'.preg_quote($m, '/').'/i',$email)) return true;
if (preg_match('/' . preg_quote($m, '/') . '/i',$email)) return true;
}
}

View File

@@ -89,8 +89,8 @@
<?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";
$path = dirname(__DIR__) . '/js/' . $filename;
echo '<script src="/cached.php?t=' . @filemtime($path) . '&amp;f=/js/' . $filename . '"></script>' . "\n";
}
?>

View File

@@ -109,9 +109,9 @@ function gpg_key_get(string $rm): ?string {
return
"pub rsa4096 2021-03-26 [SC] [expires: 2030-03-26]\n" .
" E609 13E4 DF20 9907 D8E3 0D96 659A 97C9 CF2A 795A\n" .
"uid [ultimate] Sergey Panteleev <sergey@php.net>\n".
"uid [ultimate] Sergey Panteleev <sergey@s-panteleev.ru>\n".
"uid [ultimate] Sergey Panteleev <sergey@sergeypanteleev.com>\n".
"uid [ultimate] Sergey Panteleev <sergey@php.net>\n" .
"uid [ultimate] Sergey Panteleev <sergey@s-panteleev.ru>\n" .
"uid [ultimate] Sergey Panteleev <sergey@sergeypanteleev.com>\n" .
"sub rsa4096 2021-03-26 [E] [expires: 2025-03-26]";
case 'stas':

View File

@@ -31,7 +31,7 @@ if ($config["cache"]) {
if (is_numeric($config["cache"])) {
$timestamp = $config["cache"];
} else {
$timestamp = filemtime($_SERVER["DOCUMENT_ROOT"] . "/" .$_SERVER["BASE_PAGE"]);
$timestamp = filemtime($_SERVER["DOCUMENT_ROOT"] . "/" . $_SERVER["BASE_PAGE"]);
}
$tsstring = gmdate("D, d M Y H:i:s ", $timestamp) . "GMT";

View File

@@ -16,7 +16,7 @@ function highlight_php($code, $return = false)
// Use this ugly hack for now to avoid code snippets with bad syntax screwing up the highlighter
if (strstr($highlighted, "include/layout.inc</b>")) {
$highlighted = '<span class="html">'. nl2br(htmlentities($code, ENT_HTML5), false) ."</span>";
$highlighted = '<span class="html">' . nl2br(htmlentities($code, ENT_HTML5), false) . "</span>";
}
// Fix output to use CSS classes and wrap well
@@ -178,7 +178,7 @@ function make_popup_link ($url, $linktext=false, $target=false, $windowprops="",
htmlspecialchars($url, ENT_QUOTES | ENT_IGNORE),
($target ?: "_new"),
$windowprops,
($extras ? ' '.$extras : ''),
($extras ? ' ' . $extras : ''),
($linktext ?: $url)
);
}
@@ -205,7 +205,7 @@ function download_link($file, $title)
$local_file = "distributions/$file";
}
if (@file_exists($local_file.".asc")) {
if (@file_exists($local_file . ".asc")) {
echo " ";
$sig_link = "/distributions/$file.asc";
print_link($sig_link, "(sig)");
@@ -338,14 +338,14 @@ function display_event($event, $include_date = 1)
break;
case 3:
case 'recur':
$days = $re[$event['recur']]. " " .$days[$event['recur_day']];
$days = $re[$event['recur']] . " " . $days[$event['recur_day']];
if (!$cm || $cy) {
$cm = date("m");
$cy = date("Y");
}
$month = date("M", mktime(0, 0, 0, $cm, 1, $cy));
$dtstart = date("Y-m-d", strtotime($days . ' 0st' .$month. ' ' .$cy));
echo ' (Every <abbr class="dtstart" title="'.$dtstart.'">', $days, "</abbr> of the month)";
$dtstart = date("Y-m-d", strtotime($days . ' 0st' . $month . ' ' . $cy));
echo ' (Every <abbr class="dtstart" title="' . $dtstart . '">', $days, "</abbr> of the month)";
break;
}
@@ -431,7 +431,7 @@ function print_news($news, $dog, $max = 5, $onlyyear = null, $return = false) {
}
}
if (!isset($permlink)) {
$permlink = "#" .$id;
$permlink = "#" . $id;
}
$published = substr($item["published"], 0, 10);
@@ -506,7 +506,7 @@ function site_header($title = '', $config = [])
$shorturl = "https://www.php.net/" . $shortname;
}
require __DIR__ ."/header.inc";
require __DIR__ . "/header.inc";
}
function site_footer($config = [])
{

View File

@@ -1,4 +1,4 @@
<?php echo '<?xml version="1.0"?>'."\n"; ?>
<?php echo '<?xml version="1.0"?>' . "\n"; ?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>PHP.net</ShortName>
<Description>PHP.net - Search</Description>

View File

@@ -8,25 +8,25 @@ function search_results($res, $q, $profile='all', $per_page=10, $s=0, $l='en', $
$disp_start_result = $start_result + 1;
$disp_end_result = $end_result + 1;
if($show_title) echo "<h2>Showing results $disp_start_result to $disp_end_result of $results_count</h2>\n";
echo '<ul id="search-results">'."\n";
echo '<ul id="search-results">' . "\n";
$pos = $res['ResultSet']['firstResultPosition'];
$php_img_dir = 'http://www.php.net/images';
$types = [
'pear' => '<img src="'. $php_img_dir .'/pear_item.gif" height="19" width="17" style="float:left; margin-left:-30px;"/>',
'pecl' => '<img src="'. $php_img_dir .'/pecl_item.gif" height="19" width="17" style="float:left; margin-left:-30px;"/>',
'pecl4win' => '<img src="'. $php_img_dir .'/pecl_item_win.gif" height="22" width="21" style="float:left; margin-left:-31px;"/>',
'peclbugs' => '<img src="'. $php_img_dir .'/pecl_item_bug.gif" height="19" width="17" style="float:left; margin-left:-30px;"/>',
'pearbugs' => '<img src="'. $php_img_dir .'/pear_item_bug.gif" height="19" width="17" style="float:left; margin-left:-30px;"/>',
'talks' => '<img src="'. $php_img_dir .'/ele-icon.gif" height="20" width="32" style="float:left; margin-left:-40px;"/>',
'snaps' => '<img src="'. $php_img_dir .'/logos/php_xpstyle_ico.png" height="32" width="32" style="float:left; margin-left:-40px;"/>',
'cvsweb' => '<img src="'. $php_img_dir .'/logos/php_script_ico.png" height="32" width="32" style="float:left; margin-left:-40px;"/>',
'viewcvs' => '<img src="'. $php_img_dir .'/logos/php_script_ico.png" height="32" width="32" style="float:left; margin-left:-40px;"/>',
'news' => '<img src="'. $php_img_dir .'/logos/php-icon-white.gif" height="32" width="32" style="float:left; margin-left:-40px;"/>',
'php' => '<img src="'. $php_img_dir .'/logos/php-icon-white.gif" height="32" width="32" style="float:left; margin-left:-40px;"/>',
'doc' => '<img src="'. $php_img_dir .'/logos/php-icon-white.gif" height="32" width="32" style="float:left; margin-left:-40px;"/>',
'bugs' => '<img src="'. $php_img_dir .'/php_bug.gif" height="32" width="32" style="float:left; margin-left:-40px;"/>',
'gtk' => '<img src="'. $php_img_dir .'/logos/php-gtk-white.gif" height="26" width="32" style="float:left; margin-left:-40px;"/>'
'pear' => '<img src="' . $php_img_dir . '/pear_item.gif" height="19" width="17" style="float:left; margin-left:-30px;"/>',
'pecl' => '<img src="' . $php_img_dir . '/pecl_item.gif" height="19" width="17" style="float:left; margin-left:-30px;"/>',
'pecl4win' => '<img src="' . $php_img_dir . '/pecl_item_win.gif" height="22" width="21" style="float:left; margin-left:-31px;"/>',
'peclbugs' => '<img src="' . $php_img_dir . '/pecl_item_bug.gif" height="19" width="17" style="float:left; margin-left:-30px;"/>',
'pearbugs' => '<img src="' . $php_img_dir . '/pear_item_bug.gif" height="19" width="17" style="float:left; margin-left:-30px;"/>',
'talks' => '<img src="' . $php_img_dir . '/ele-icon.gif" height="20" width="32" style="float:left; margin-left:-40px;"/>',
'snaps' => '<img src="' . $php_img_dir . '/logos/php_xpstyle_ico.png" height="32" width="32" style="float:left; margin-left:-40px;"/>',
'cvsweb' => '<img src="' . $php_img_dir . '/logos/php_script_ico.png" height="32" width="32" style="float:left; margin-left:-40px;"/>',
'viewcvs' => '<img src="' . $php_img_dir . '/logos/php_script_ico.png" height="32" width="32" style="float:left; margin-left:-40px;"/>',
'news' => '<img src="' . $php_img_dir . '/logos/php-icon-white.gif" height="32" width="32" style="float:left; margin-left:-40px;"/>',
'php' => '<img src="' . $php_img_dir . '/logos/php-icon-white.gif" height="32" width="32" style="float:left; margin-left:-40px;"/>',
'doc' => '<img src="' . $php_img_dir . '/logos/php-icon-white.gif" height="32" width="32" style="float:left; margin-left:-40px;"/>',
'bugs' => '<img src="' . $php_img_dir . '/php_bug.gif" height="32" width="32" style="float:left; margin-left:-40px;"/>',
'gtk' => '<img src="' . $php_img_dir . '/logos/php-gtk-white.gif" height="26" width="32" style="float:left; margin-left:-40px;"/>'
];
foreach($res['ResultSet']['Result'] as $i => $hit) {

View File

@@ -128,7 +128,7 @@ site_header("Hypertext Preprocessor",
'<link rel="alternate" type="application/atom+xml" title="PHP: Hypertext Preprocessor" href="' . $MYSITE . 'feed.atom">',
'<script>',
"function okc(f){var c=[38,38,40,40,37,39,37,39,66,65,13],x=function(){x.c=x.c||Array.apply({},c);x.r=function(){x.c=null};return x.c},h=function(e){if(x()[0]==(e||window.event).keyCode){x().shift();if(!x().length){x.r();f()}}else{x.r()}};window.addEventListener?window.addEventListener('keydown',h,false):document.attachEvent('onkeydown',h)}",
"okc(function(){if(document.getElementById){i=document.getElementById('phplogo');i.src='".$MYSITE."images/php_konami.gif'}});",
"okc(function(){if(document.getElementById){i=document.getElementById('phplogo');i.src='" . $MYSITE . "images/php_konami.gif'}});",
'</script>'
],
'link' => [
@@ -181,7 +181,7 @@ if (is_array($CONF_TEASER)) {
foreach ($CONF_TEASER as $category => $entries) {
if ($entries) {
$announcements .= '<div class="panel">';
$announcements .= ' <a href="/conferences" class="headline" title="' . $conftype[$category] . '">' . $conftype[$category] .'</a>';
$announcements .= ' <a href="/conferences" class="headline" title="' . $conftype[$category] . '">' . $conftype[$category] . '</a>';
$announcements .= '<div class="body"><ul>';
foreach (array_slice($entries, 0, 4) as $url => $title) {
$title = preg_replace("'([A-Za-z0-9])([\s:\-,]*?)call for(.*?)$'i", "$1", $title);

View File

@@ -313,7 +313,7 @@ function output_lists_table($mailing_lists): void
"<th>Newsgroup</th><th>Normal</th><th>Digest</th></tr>\n";
} else {
echo '<tr align="center">';
echo '<td align="left"><strong>' . $listinfo[1] . '</strong> <small>&lt;<a href="mailto:' . $listinfo[0] . '@lists.php.net">' . $listinfo[0] . '@lists.php.net</a>&gt;</small><br><small>'. $listinfo[2] . '</small></td>';
echo '<td align="left"><strong>' . $listinfo[1] . '</strong> <small>&lt;<a href="mailto:' . $listinfo[0] . '@lists.php.net">' . $listinfo[0] . '@lists.php.net</a>&gt;</small><br><small>' . $listinfo[2] . '</small></td>';
echo '<td>' . ($listinfo[3] ? 'yes' : 'no') . '</td>';
// Let the list name defined with a string, if the

View File

@@ -109,7 +109,7 @@ if ($process) {
} elseif (($pos = strpos($result, '[SPAMMER]')) !== false) {
$ip = trim(substr($result, $pos+9));
$spam_url = $ip_spam_lookup_url . $ip;
print '<p class="formerror">Your IP is listed in one of the spammers lists we use, which aren\'t controlled by us. More information is available at <a href="'.$spam_url.'">'.$spam_url.'</a>.</p>';
print '<p class="formerror">Your IP is listed in one of the spammers lists we use, which aren\'t controlled by us. More information is available at <a href="' . $spam_url . '">' . $spam_url . '</a>.</p>';
} elseif (strpos($result, '[SPAM WORD]') !== false) {
echo '<p class="formerror">Your note contains a prohibited (usually SPAM) word. Please remove it and try again.</p>';
} elseif (strpos($result, '[CLOSED]') !== false) {

View File

@@ -29,7 +29,7 @@ $archived = ['da', 'kr', 'pl', 'tw'];
foreach ($INACTIVE_ONLINE_LANGUAGES as $cc => $lang) {
$link = 'no archive';
if (in_array($cc, $archived, true)) {
$link = '<a href="http://docs.php.net/manual/'. $cc .'">archive</a>';
$link = '<a href="http://docs.php.net/manual/' . $cc . '">archive</a>';
}
echo '<li>', $lang, ': (', $link, ')</li>';
}

View File

@@ -88,7 +88,7 @@ echo "<p>
$active_majors = array_keys($RELEASES);
$latest = max($active_majors);
foreach ($OLDRELEASES as $major => $a) {
echo '<a id="v' .$major. '"></a>';
echo '<a id="v' . $major . '"></a>';
if (!in_array($major, $active_majors, false)) {
echo "\n<br>\n";
echo "<p>Support for PHP $major has been <b style=\"color: red;\">discontinued</b> ";

View File

@@ -9,11 +9,11 @@ $SIDEBAR_DATA='
examples you can try out:
</p>
<ul class="simple">
<li><a href="'.$MYSITE.'echo">/echo</a></li>
<li><a href="'.$MYSITE.'it/echo">/it/echo</a></li>
<li><a href="'.$MYSITE.'imap">/imap</a></li>
<li><a href="'.$MYSITE.'downloads">/downloads</a></li>
<li><a href="'.$MYSITE.'searchterm">/searchterm</a></li>
<li><a href="' . $MYSITE . 'echo">/echo</a></li>
<li><a href="' . $MYSITE . 'it/echo">/it/echo</a></li>
<li><a href="' . $MYSITE . 'imap">/imap</a></li>
<li><a href="' . $MYSITE . 'downloads">/downloads</a></li>
<li><a href="' . $MYSITE . 'searchterm">/searchterm</a></li>
</ul>
<h3>My PHP.net</h3>