Skip to content

Commit 5c9eab2

Browse files
committed
Fix CS violations (case of null, false and true)
1 parent b575ebd commit 5c9eab2

File tree

9 files changed

+44
-44
lines changed

9 files changed

+44
-44
lines changed

include/branches.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,5 +400,5 @@ function get_current_release_for_branch(int $major, ?int $minor): ?string {
400400
}
401401
}
402402

403-
return NULL;
403+
return null;
404404
}

include/do-download.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
function get_actual_download_file($file)
1010
{
1111
// Could be a normal download or a manual download file
12-
$possible_files = array($file => TRUE, "manual/$file" => FALSE);
12+
$possible_files = array($file => true, "manual/$file" => false);
1313

1414
// Find out what is the exact file requested
15-
$found = FALSE;
15+
$found = false;
1616
foreach ($possible_files as $name => $log) {
1717
if (@file_exists($_SERVER['DOCUMENT_ROOT'] . '/distributions/' . $name)) {
1818
$found = $name;

include/get-download.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ $site_config = array(
1616
);
1717

1818
// Find out what is the exact file requested
19-
$file = FALSE;
19+
$file = false;
2020
foreach ($possible_files as $name) {
2121
if (@file_exists($_SERVER['DOCUMENT_ROOT'] . '/distributions/' . $name)) {
2222
$file = $name;
@@ -30,7 +30,7 @@ site_header('Get Download', $site_config);
3030
echo '<div id="mirrors-container">';
3131
$size = 0;
3232
// No downloadable file found
33-
if ($file === FALSE) {
33+
if ($file === false) {
3434
$info = "<p>
3535
The file you requested (<strong>" . htmlspecialchars($df, ENT_QUOTES, "UTF-8") . "</strong>) is not found on
3636
this server (<strong>{$MYSITE}</strong>).</p>";

include/ip-to-country.inc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ function i2c_go()
5151
$ipnum = i2c_realip();
5252

5353
// User already has a country detected with this IP stored
54-
if (!empty($_COOKIE['COUNTRY']) && strpos($_COOKIE['COUNTRY'], ',') !== FALSE) {
54+
if (!empty($_COOKIE['COUNTRY']) && strpos($_COOKIE['COUNTRY'], ',') !== false) {
5555
list($COUNTRY, $storedip) = explode(",", $_COOKIE['COUNTRY']);
56-
if ($storedip == $ipnum) { return TRUE; }
56+
if ($storedip == $ipnum) { return true; }
5757
}
5858

5959
// Convert the IP number to some useable form for searching
@@ -66,7 +66,7 @@ function i2c_go()
6666
// in the index do not search, as it would take
6767
// a very long time. It is an error, if we have
6868
// not found anything in the index
69-
if ($idx !== FALSE) {
69+
if ($idx !== false) {
7070
$country = i2c_search_in_db($ipn, $idx);
7171
} else {
7272
$country = 'NA';
@@ -91,7 +91,7 @@ function i2c_search_in_index($ip)
9191
__DIR__ . "/../backend/ip-to-country.idx",
9292
"r"
9393
);
94-
if (!$dbidx) { return FALSE; }
94+
if (!$dbidx) { return false; }
9595

9696
// Read in granularity from index file and
9797
// convert current IP to something useful
@@ -188,7 +188,7 @@ function i2c_realip()
188188
{
189189
// No IP found (will be overwritten by for
190190
// if any IP is found behind a firewall)
191-
$ip = FALSE;
191+
$ip = false;
192192

193193
// If HTTP_CLIENT_IP is set, then give it priority
194194
if (!empty($_SERVER["HTTP_CLIENT_IP"])) {
@@ -203,7 +203,7 @@ function i2c_realip()
203203

204204
// Put the IP's into an array which we shall work with shortly.
205205
$ips = explode (", ", $_SERVER['HTTP_X_FORWARDED_FOR']);
206-
if ($ip) { array_unshift($ips, $ip); $ip = FALSE; }
206+
if ($ip) { array_unshift($ips, $ip); $ip = false; }
207207

208208
for ($i = 0; $i < count($ips); $i++) {
209209
// Skip RFC 1918 IP's 10.0.0.0/8, 172.16.0.0/12 and

include/languages.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ $ACTIVE_ONLINE_LANGUAGES = array_diff($LANGUAGES, $INACTIVE_ONLINE_LANGUAGES);
9090
// Convert between language codes back and forth
9191
// [We use non standard languages codes and so conversion
9292
// is needed when communicating with the outside world]
93-
function language_convert($langcode, $to_phpweb_format = TRUE)
93+
function language_convert($langcode, $to_phpweb_format = true)
9494
{
9595
global $LANGUAGES;
9696
if ($to_phpweb_format) {

include/layout.inc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ ini_set('highlight.string', 'string');
1010
ini_set('highlight.html', 'html');
1111

1212
// Highlight PHP code
13-
function highlight_php($code, $return = FALSE)
13+
function highlight_php($code, $return = false)
1414
{
15-
$highlighted = highlight_string($code, TRUE);
15+
$highlighted = highlight_string($code, true);
1616

1717
// Use this ugly hack for now to avoid code snippets with bad syntax screwing up the highlighter
1818
if (strstr($highlighted, "include/layout.inc</b>")) {
19-
$highlighted = '<span class="html">'. nl2br(htmlentities($code, ENT_HTML5), FALSE) ."</span>";
19+
$highlighted = '<span class="html">'. nl2br(htmlentities($code, ENT_HTML5), false) ."</span>";
2020
}
2121

2222
// Fix output to use CSS classes and wrap well
@@ -81,8 +81,8 @@ function resize_image($img, $width = 1, $height = 1)
8181
}
8282

8383
// Return an <img> tag for a given image file available on the server
84-
function make_image($file, $alt = FALSE, $align = FALSE, $extras = FALSE,
85-
$dir = '/images', $addsize = TRUE)
84+
function make_image($file, $alt = false, $align = false, $extras = false,
85+
$dir = '/images', $addsize = true)
8686
{
8787
// If no / was provided at the start of $dir, add it
8888
$webdir = $_SERVER['MYSITE'] . ($dir[0] == '/' ? '' : '/') . $dir;
@@ -116,7 +116,7 @@ function make_image($file, $alt = FALSE, $align = FALSE, $extras = FALSE,
116116
}
117117

118118
// Print an <img> tag out for a given file
119-
function print_image($file, $alt = FALSE, $align = FALSE, $extras = FALSE,
119+
function print_image($file, $alt = false, $align = false, $extras = false,
120120
$dir = '/images')
121121
{
122122
echo make_image($file, $alt, $align, $extras, $dir);
@@ -134,13 +134,13 @@ function news_image($URL, $image, $alt, $print = true)
134134
}
135135

136136
// Return HTML code for a submit button image
137-
function make_submit($file, $alt = FALSE, $align = FALSE, $extras = FALSE,
137+
function make_submit($file, $alt = false, $align = false, $extras = false,
138138
$dir = '/images', $border = 0)
139139
{
140140
// Get an image without size info and convert the
141141
// border attribute to use CSS, as border="" is not
142142
// supported on <input> elements in [X]HTML
143-
$img = make_image($file, $alt, $align, $extras, $dir, FALSE);
143+
$img = make_image($file, $alt, $align, $extras, $dir, false);
144144
$img = str_replace(
145145
"border=\"$border\"",
146146
"style=\"border: {$border}px;\"",
@@ -152,7 +152,7 @@ function make_submit($file, $alt = FALSE, $align = FALSE, $extras = FALSE,
152152
}
153153

154154
// Return a hiperlink to something within the site
155-
function make_link ($url, $linktext = FALSE, $target = FALSE, $extras = FALSE)
155+
function make_link ($url, $linktext = false, $target = false, $extras = false)
156156
{
157157
return sprintf("<a href=\"%s\"%s%s>%s</a>",
158158
$url,
@@ -163,7 +163,7 @@ function make_link ($url, $linktext = FALSE, $target = FALSE, $extras = FALSE)
163163
}
164164

165165
// Print a hyperlink to something, within the site
166-
function print_link($url, $linktext = FALSE, $target = FALSE, $extras = FALSE)
166+
function print_link($url, $linktext = false, $target = false, $extras = false)
167167
{
168168
echo make_link($url, $linktext, $target, $extras);
169169
}
@@ -249,7 +249,7 @@ function clean($var) {
249249
function clean_note($text)
250250
{
251251
// Highlight PHP source
252-
$text = highlight_php(trim($text), TRUE);
252+
$text = highlight_php(trim($text), true);
253253

254254
// Turn urls into links
255255
return preg_replace(

include/manual-lookup.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,12 @@ function find_manual_page($lang, $keyword)
105105
// open the database, fall back to normal search. Use
106106
// open rather than popen to avoid any chance of confusion
107107
// when rsync updates the database
108-
$dbh = FALSE;
108+
$dbh = false;
109109
if (class_exists('PDO')) {
110110
if (in_array('sqlite', PDO::getAvailableDrivers())) {
111111
if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/backend/manual-lookup.sqlite')) {
112112
try {
113-
$dbh = new PDO( 'sqlite:' . $_SERVER['DOCUMENT_ROOT'] . '/backend/manual-lookup.sqlite', '', '', array(PDO::ATTR_PERSISTENT => TRUE, PDO::ATTR_EMULATE_PREPARES => TRUE) );
113+
$dbh = new PDO( 'sqlite:' . $_SERVER['DOCUMENT_ROOT'] . '/backend/manual-lookup.sqlite', '', '', array(PDO::ATTR_PERSISTENT => true, PDO::ATTR_EMULATE_PREPARES => true) );
114114
} catch (PDOException $e) {
115115
return find_manual_page_slow($lang, $keyword);
116116
}
@@ -130,7 +130,7 @@ function find_manual_page($lang, $keyword)
130130
if ($keyword != '_') {
131131
$keyword = str_replace('_', '-', $keyword);
132132
}
133-
if (strpos($keyword, '(') !== FALSE) {
133+
if (strpos($keyword, '(') !== false) {
134134
$keyword = preg_replace("!\\(.*\\)!", "-", $keyword);
135135
}
136136

include/prepend.inc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ function myphpnet_load()
9999
global $MYPHPNET, $MYSITE;
100100

101101
// Empty the preferences array
102-
$MYPHPNET = array(FALSE, FALSE, "NONE", 0, FALSE);
102+
$MYPHPNET = array(false, false, "NONE", 0, false);
103103

104104
if ($MYSITE === 'http://docs.php.net/') {
105-
$MYPHPNET[4] = TRUE;
105+
$MYPHPNET[4] = true;
106106
}
107107

108108
// If we have a cookie, set the values in the array
@@ -115,7 +115,7 @@ function myphpnet_load()
115115
}
116116

117117
// Get or set preferred language code
118-
function myphpnet_language($langcode = FALSE)
118+
function myphpnet_language($langcode = false)
119119
{
120120
global $MYPHPNET, $LANGUAGES;
121121

@@ -135,7 +135,7 @@ const MYPHPNET_URL_FUNC = 'quickref';
135135
const MYPHPNET_URL_MANUAL = 'manual';
136136

137137
// Set URL search fallback preference
138-
function myphpnet_urlsearch($type = FALSE)
138+
function myphpnet_urlsearch($type = false)
139139
{
140140
global $MYPHPNET;
141141

@@ -179,7 +179,7 @@ function myphpnet_save()
179179

180180
// Fill in values not specified
181181
for ($i = 0; $i <= 3; $i++) {
182-
if (!isset($MYPHPNET[$i])) { $MYPHPNET[$i] = FALSE; }
182+
if (!isset($MYPHPNET[$i])) { $MYPHPNET[$i] = false; }
183183
}
184184

185185
// Set all the preferred values for a year

include/site.inc

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ const MIRROR_DOESNOTWORK = 3;
1515

1616
$MIRRORS = array(
1717
"https://www.php.net/" => array(
18-
"DEU", "MyraCloud", FALSE,
19-
"https://myracloud.com/en/", MIRROR_SPECIAL, TRUE,
18+
"DEU", "MyraCloud", false,
19+
"https://myracloud.com/en/", MIRROR_SPECIAL, true,
2020
"en", MIRROR_OK),
2121
);
2222

@@ -30,7 +30,7 @@ include __DIR__ . '/languages.inc';
3030

3131
// Returns true if the current (or specified)
3232
// site is the primary mirror site
33-
function is_primary_site($site = FALSE)
33+
function is_primary_site($site = false)
3434
{
3535
global $MYSITE;
3636
if (!$site) { $site = $MYSITE; }
@@ -39,32 +39,32 @@ function is_primary_site($site = FALSE)
3939

4040
// Returns true if the current (or specified)
4141
// mirror site is an official mirror site
42-
function is_official_mirror($site = FALSE)
42+
function is_official_mirror($site = false)
4343
{
4444
return (mirror_type($site) != MIRROR_VIRTUAL);
4545
}
4646

4747
// Returns the current (or specified)
4848
// mirror site's default language
49-
function default_language($site = FALSE)
49+
function default_language($site = false)
5050
{
5151
global $MIRRORS, $MYSITE;
5252
if (!$site) { $site = $MYSITE; }
53-
return (isset($MIRRORS[$site]) ? $MIRRORS[$site][6] : FALSE);
53+
return (isset($MIRRORS[$site]) ? $MIRRORS[$site][6] : false);
5454
}
5555

5656
// Returns true if the current (or specified) mirror
5757
// site is registered to have local search support
58-
function have_search($site = FALSE)
58+
function have_search($site = false)
5959
{
6060
global $MIRRORS, $MYSITE;
6161
if (!$site) { $site = $MYSITE; }
62-
return (isset($MIRRORS[$site]) ? $MIRRORS[$site][5] : FALSE);
62+
return (isset($MIRRORS[$site]) ? $MIRRORS[$site][5] : false);
6363
}
6464

6565
// Returns the current (or specified)
6666
// mirror site's provider's name
67-
function mirror_provider($site = FALSE)
67+
function mirror_provider($site = false)
6868
{
6969
global $MIRRORS, $MYSITE;
7070
if (!$site) { $site = $MYSITE; }
@@ -82,7 +82,7 @@ function mirror_provider($site = FALSE)
8282

8383
// Returns the current (or specified)
8484
// mirror site's provider's URL
85-
function mirror_provider_url($site = FALSE)
85+
function mirror_provider_url($site = false)
8686
{
8787
global $MIRRORS,$MYSITE;
8888
if (!$site) { $site = $MYSITE; }
@@ -100,7 +100,7 @@ function mirror_provider_url($site = FALSE)
100100

101101
// Returns the current (or specified)
102102
// mirror site's type (use the constants!)
103-
function mirror_type($site = FALSE)
103+
function mirror_type($site = false)
104104
{
105105
global $MIRRORS, $MYSITE;
106106
if (!$site) { $site = $MYSITE; }
@@ -149,7 +149,7 @@ function mirror_setcookie($name, $content, $exptime)
149149
return setcookie($name, $content, time() + $exptime, '/');
150150
}
151151

152-
return FALSE;
152+
return false;
153153
}
154154

155155
// Use this function to write out proper headers on
@@ -259,7 +259,7 @@ if ($_SERVER["SERVER_PORT"] != '80' && $_SERVER["SERVER_PORT"] != 443) {
259259
// If the mirror is not registered with this name, provide defaults
260260
// (no country code, no search, no stats, English default language ...)
261261
if (!isset($MIRRORS[$MYSITE])) {
262-
$MIRRORS[$MYSITE] = array("xx", $MYSITE, FALSE, $MYSITE, MIRROR_VIRTUAL, FALSE, "en", MIRROR_OK);
262+
$MIRRORS[$MYSITE] = array("xx", $MYSITE, false, $MYSITE, MIRROR_VIRTUAL, false, "en", MIRROR_OK);
263263
}
264264

265265
// Override mirror language with local preference

0 commit comments

Comments
 (0)