Author: Andreas Möller (localheinz) Committer: GitHub (web-flow) Pusher: cmb69 Date: 2022-08-22T19:04:47+02:00
Commit: https://github.com/php/web-php/commit/57f505ed585bcf40a060203817be594b7e5fb1e2 Raw diff: https://github.com/php/web-php/commit/57f505ed585bcf40a060203817be594b7e5fb1e2.diff Enhancement: Enable and configure `concat_space` fixer Closes GH-657. Changed paths: M .php-cs-fixer.php M cached.php M cal.php M conferences/index.php M error.php M git-php.php M images/supported-versions.php M include/email-validation.inc M include/footer.inc M include/gpg-keys.inc M include/header.inc M include/layout.inc M include/mozopensearch.inc M include/results.inc M index.php M mailing-lists.php M manual/add-note.php M manual/help-translate.php M releases/index.php M urlhowto.php Diff: diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 49cfb94c87..1a68746b04 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -22,6 +22,9 @@ 'array_indentation' => true, 'array_syntax' => true, 'class_attributes_separation' => true, + 'concat_space' => [ + 'spacing' => 'one', + ], 'constant_case' => true, 'indentation_type' => true, 'line_ending' => true, diff --git a/cached.php b/cached.php index 3c8f0ae268..e57bbebc1d 100644 --- a/cached.php +++ b/cached.php @@ -18,7 +18,7 @@ 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) { diff --git a/cal.php b/cal.php index 8855c757fe..cabf415f42 100644 --- a/cal.php +++ b/cal.php @@ -41,7 +41,7 @@ } // 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 @@ // 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 @@ // 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 @@ $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 @@ // Print out day number and all events for the day echo '<td><a class="day" href="/cal.php', "?cm=$cm&cd=$i&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 diff --git a/conferences/index.php b/conferences/index.php index 647538c11e..ce206a7289 100644 --- a/conferences/index.php +++ b/conferences/index.php @@ -31,7 +31,7 @@ $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"])) { diff --git a/error.php b/error.php index b2205ef94e..b15b5c58a0 100644 --- a/error.php +++ b/error.php @@ -664,7 +664,7 @@ } // 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); diff --git a/git-php.php b/git-php.php index e518c3a671..23191d9fdb 100644 --- a/git-php.php +++ b/git-php.php @@ -6,7 +6,7 @@ // 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 (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'])) { diff --git a/images/supported-versions.php b/images/supported-versions.php index d2c26d1f36..3c28e29a61 100644 --- a/images/supported-versions.php +++ b/images/supported-versions.php @@ -159,7 +159,7 @@ function date_horiz_coord(DateTime $date) { ?> <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> diff --git a/include/email-validation.inc b/include/email-validation.inc index 777e1bb945..4a8b6b98d4 100644 --- a/include/email-validation.inc +++ b/include/email-validation.inc @@ -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; } } diff --git a/include/footer.inc b/include/footer.inc index 20c8d3e277..380815dd3b 100644 --- a/include/footer.inc +++ b/include/footer.inc @@ -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) . '&f=/js/' . $filename . '"></script>'."\n"; + $path = dirname(__DIR__) . '/js/' . $filename; + echo '<script src="/cached.php?t=' . @filemtime($path) . '&f=/js/' . $filename . '"></script>' . "\n"; } ?> diff --git a/include/gpg-keys.inc b/include/gpg-keys.inc index 48ce9310f3..0c5c3df8d0 100644 --- a/include/gpg-keys.inc +++ b/include/gpg-keys.inc @@ -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 <ser...@php.net>\n". - "uid [ultimate] Sergey Panteleev <ser...@s-panteleev.ru>\n". - "uid [ultimate] Sergey Panteleev <ser...@sergeypanteleev.com>\n". + "uid [ultimate] Sergey Panteleev <ser...@php.net>\n" . + "uid [ultimate] Sergey Panteleev <ser...@s-panteleev.ru>\n" . + "uid [ultimate] Sergey Panteleev <ser...@sergeypanteleev.com>\n" . "sub rsa4096 2021-03-26 [E] [expires: 2025-03-26]"; case 'stas': diff --git a/include/header.inc b/include/header.inc index 95eb299012..3a099d7ba4 100644 --- a/include/header.inc +++ b/include/header.inc @@ -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"; diff --git a/include/layout.inc b/include/layout.inc index 5707cd0252..2bd01b190d 100644 --- a/include/layout.inc +++ b/include/layout.inc @@ -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 = []) { diff --git a/include/mozopensearch.inc b/include/mozopensearch.inc index c978ad6b2b..f222ca34c0 100644 --- a/include/mozopensearch.inc +++ b/include/mozopensearch.inc @@ -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> diff --git a/include/results.inc b/include/results.inc index 605b8c1c90..62d0761732 100644 --- a/include/results.inc +++ b/include/results.inc @@ -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) { diff --git a/index.php b/index.php index 0a19f0f95a..d41627bdf8 100644 --- a/index.php +++ b/index.php @@ -128,7 +128,7 @@ '<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 @@ 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); diff --git a/mailing-lists.php b/mailing-lists.php index 893fe89966..c717c2b855 100644 --- a/mailing-lists.php +++ b/mailing-lists.php @@ -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><<a href="mailto:' . $listinfo[0] . '@lists.php.net">' . $listinfo[0] . '@lists.php.net</a>></small><br><small>'. $listinfo[2] . '</small></td>'; + echo '<td align="left"><strong>' . $listinfo[1] . '</strong> <small><<a href="mailto:' . $listinfo[0] . '@lists.php.net">' . $listinfo[0] . '@lists.php.net</a>></small><br><small>' . $listinfo[2] . '</small></td>'; echo '<td>' . ($listinfo[3] ? 'yes' : 'no') . '</td>'; // Let the list name defined with a string, if the diff --git a/manual/add-note.php b/manual/add-note.php index ae7016e562..c54485803a 100644 --- a/manual/add-note.php +++ b/manual/add-note.php @@ -109,7 +109,7 @@ } 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) { diff --git a/manual/help-translate.php b/manual/help-translate.php index 2ead6a6d0f..c416b10930 100644 --- a/manual/help-translate.php +++ b/manual/help-translate.php @@ -29,7 +29,7 @@ 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>'; } diff --git a/releases/index.php b/releases/index.php index 0af11b144a..cbfd16eefa 100644 --- a/releases/index.php +++ b/releases/index.php @@ -88,7 +88,7 @@ $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> "; diff --git a/urlhowto.php b/urlhowto.php index 336f8e8b72..75fa82cfc1 100644 --- a/urlhowto.php +++ b/urlhowto.php @@ -9,11 +9,11 @@ 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> -- PHP Webmaster List Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php