Passed
Pull Request — release-2.1 (#7450)
by Jon
04:41
created
Sources/Subs.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 			{
380 380
 				$val = 'CASE ';
381 381
 				foreach ($members as $k => $v)
382
-					$val .= 'WHEN id_member = ' . $v . ' THEN '. alert_count($v, true) . ' ';
382
+					$val .= 'WHEN id_member = ' . $v . ' THEN ' . alert_count($v, true) . ' ';
383 383
 
384 384
 				$val = $val . ' END';
385 385
 				$type = 'raw';
@@ -851,12 +851,12 @@  discard block
 block discarded – undo
851 851
 			// Anything that isn't a specification, punctuation mark, or whitespace.
852 852
 			'~(?<!%)\p{L}|[^\p{L}\p{P}\s]~u',
853 853
 			// Repeated punctuation marks (except %), possibly separated by whitespace.
854
-			'~(?'.'>([^%\P{P}])\s*(?=\1))*~u',
855
-			'~([^%\P{P}])(?'.'>\1(?!$))*~u',
854
+			'~(?' . '>([^%\P{P}])\s*(?=\1))*~u',
855
+			'~([^%\P{P}])(?' . '>\1(?!$))*~u',
856 856
 			// Unwanted trailing punctuation and whitespace.
857
-			'~(?'.'>([\p{Pd}\p{Ps}\p{Pi}\p{Pc}]|[^%\P{Po}])\s*)*$~u',
857
+			'~(?' . '>([\p{Pd}\p{Ps}\p{Pi}\p{Pc}]|[^%\P{Po}])\s*)*$~u',
858 858
 			// Unwanted opening punctuation and whitespace.
859
-			'~^\s*(?'.'>([\p{Pd}\p{Pe}\p{Pf}\p{Pc}]|[^%\P{Po}])\s*)*~u',
859
+			'~^\s*(?' . '>([\p{Pd}\p{Pe}\p{Pf}\p{Pc}]|[^%\P{Po}])\s*)*~u',
860 860
 			// Runs of horizontal whitespace.
861 861
 			'~\s+~',
862 862
 		),
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
 	{
1164 1164
 		$dates[$tzid . '_' . $timestamp]['results'][$format] = preg_replace_callback(
1165 1165
 			'/\xEE\x84\xA0([\d_]+)(\xEE\x84(?:[\xA1-\xAF]))/',
1166
-			function ($matches)
1166
+			function($matches)
1167 1167
 			{
1168 1168
 				switch ($matches[2])
1169 1169
 				{
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
 	elseif (!empty($context['character_set']) && is_callable('mb_decode_numericentity'))
1298 1298
 	{
1299 1299
 		// Get whatever the default replacement character is for this encoding.
1300
-		$substitute = mb_decode_numericentity('&#xFFFD;', array(0xFFFD,0xFFFD,0,0xFFFF), $context['character_set']);
1300
+		$substitute = mb_decode_numericentity('&#xFFFD;', array(0xFFFD, 0xFFFD, 0, 0xFFFF), $context['character_set']);
1301 1301
 	}
1302 1302
 	else
1303 1303
 		$substitute = '?';
@@ -1747,7 +1747,7 @@  discard block
 block discarded – undo
1747 1747
 
1748 1748
 					// parseAttachBBC will return a string ($txt key) rather than dying with a fatal_error. Up to you to decide what to do.
1749 1749
 					if (is_string($currentAttachment))
1750
-						return $data = '<span style="display:inline-block" class="errorbox">' . (!empty($txt[$currentAttachment]) ? $txt[$currentAttachment] : $currentAttachment)  . '</span>';
1750
+						return $data = '<span style="display:inline-block" class="errorbox">' . (!empty($txt[$currentAttachment]) ? $txt[$currentAttachment] : $currentAttachment) . '</span>';
1751 1751
 
1752 1752
 					// We need a display mode.
1753 1753
 					if (empty($params['{display}']))
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
 								$returnContext .= '<img src="' . $currentAttachment['href'] . '"' . $alt . $title . ' class="bbc_img">';
1774 1774
 							else
1775 1775
 							{
1776
-								$width = !empty($params['{width}']) ? ' width="' . $params['{width}'] . '"': '';
1776
+								$width = !empty($params['{width}']) ? ' width="' . $params['{width}'] . '"' : '';
1777 1777
 								$height = !empty($params['{height}']) ? 'height="' . $params['{height}'] . '"' : '';
1778 1778
 								$returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . $width . $height . ' class="bbc_img resized"/>';
1779 1779
 							}
@@ -1784,7 +1784,7 @@  discard block
 block discarded – undo
1784 1784
 							$width = !empty($params['{width}']) ? ' width="' . $params['{width}'] . '"' : '';
1785 1785
 							$height = !empty($params['{height}']) ? ' height="' . $params['{height}'] . '"' : '';
1786 1786
 
1787
-							$returnContext .= '<div class="videocontainer"><video controls preload="metadata" src="'. $currentAttachment['href'] . '" playsinline' . $width . $height . '><a href="' . $currentAttachment['href'] . '" class="bbc_link">' . $smcFunc['htmlspecialchars'](!empty($data) ? $data : $currentAttachment['name']) . '</a></video></div>' . (!empty($data) && $data != $currentAttachment['name'] ? '<div class="smalltext">' . $data . '</div>' : '');
1787
+							$returnContext .= '<div class="videocontainer"><video controls preload="metadata" src="' . $currentAttachment['href'] . '" playsinline' . $width . $height . '><a href="' . $currentAttachment['href'] . '" class="bbc_link">' . $smcFunc['htmlspecialchars'](!empty($data) ? $data : $currentAttachment['name']) . '</a></video></div>' . (!empty($data) && $data != $currentAttachment['name'] ? '<div class="smalltext">' . $data . '</div>' : '');
1788 1788
 						}
1789 1789
 						// Audio.
1790 1790
 						elseif (strpos($currentAttachment['mime_type'], 'audio/') === 0)
@@ -1792,7 +1792,7 @@  discard block
 block discarded – undo
1792 1792
 							$width = 'max-width:100%; width: ' . (!empty($params['{width}']) ? $params['{width}'] : '400') . 'px;';
1793 1793
 							$height = !empty($params['{height}']) ? 'height: ' . $params['{height}'] . 'px;' : '';
1794 1794
 
1795
-							$returnContext .= (!empty($data) && $data != $currentAttachment['name'] ? $data . ' ' : '') . '<audio controls preload="none" src="'. $currentAttachment['href'] . '" class="bbc_audio" style="vertical-align:middle;' . $width . $height . '"><a href="' . $currentAttachment['href'] . '" class="bbc_link">' . $smcFunc['htmlspecialchars'](!empty($data) ? $data : $currentAttachment['name']) . '</a></audio>';
1795
+							$returnContext .= (!empty($data) && $data != $currentAttachment['name'] ? $data . ' ' : '') . '<audio controls preload="none" src="' . $currentAttachment['href'] . '" class="bbc_audio" style="vertical-align:middle;' . $width . $height . '"><a href="' . $currentAttachment['href'] . '" class="bbc_link">' . $smcFunc['htmlspecialchars'](!empty($data) ? $data : $currentAttachment['name']) . '</a></audio>';
1796 1796
 						}
1797 1797
 						// Anything else.
1798 1798
 						else
@@ -1961,7 +1961,7 @@  discard block
 block discarded – undo
1961 1961
 				'type' => 'unparsed_commas_content',
1962 1962
 				'test' => '\d+,\d+\]',
1963 1963
 				'content' => '<a href="$1" target="_blank" rel="noopener">$1</a>',
1964
-				'validate' => function (&$tag, &$data, $disabled)
1964
+				'validate' => function(&$tag, &$data, $disabled)
1965 1965
 				{
1966 1966
 					$data[0] = normalize_iri(strtr(trim($data[0]), array('<br>' => '', ' ' => '%20')));
1967 1967
 
@@ -2087,8 +2087,8 @@  discard block
 block discarded – undo
2087 2087
 					else
2088 2088
 						$url = get_proxied_url($url);
2089 2089
 
2090
-					$alt = !empty($params['{alt}']) ? ' alt="' . $params['{alt}']. '"' : ' alt=""';
2091
-					$title = !empty($params['{title}']) ? ' title="' . $params['{title}']. '"' : '';
2090
+					$alt = !empty($params['{alt}']) ? ' alt="' . $params['{alt}'] . '"' : ' alt=""';
2091
+					$title = !empty($params['{title}']) ? ' title="' . $params['{title}'] . '"' : '';
2092 2092
 
2093 2093
 					$data = isset($disabled[$tag['tag']]) ? $url : '<img src="' . $url . '"' . $alt . $title . $params['{width}'] . $params['{height}'] . ' class="bbc_img' . (!empty($params['{width}']) || !empty($params['{height}']) ? ' resized' : '') . '" loading="lazy">';
2094 2094
 				},
@@ -2519,12 +2519,12 @@  discard block
 block discarded – undo
2519 2519
 		$codes[] = array(
2520 2520
 			'tag' => 'cowsay',
2521 2521
 			'parameters' => array(
2522
-				'e' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => 'oo', 'validate' => function ($eyes) use ($smcFunc)
2522
+				'e' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => 'oo', 'validate' => function($eyes) use ($smcFunc)
2523 2523
 					{
2524 2524
 						return $smcFunc['substr']($eyes . 'oo', 0, 2);
2525 2525
 					},
2526 2526
 				),
2527
-				't' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => '  ', 'validate' => function ($tongue) use ($smcFunc)
2527
+				't' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => '  ', 'validate' => function($tongue) use ($smcFunc)
2528 2528
 					{
2529 2529
 						return $smcFunc['substr']($tongue . '  ', 0, 2);
2530 2530
 					},
@@ -4229,7 +4229,7 @@  discard block
 block discarded – undo
4229 4229
 		if ($fp != false)
4230 4230
 		{
4231 4231
 			// Send the HEAD request (since we don't have to worry about chunked, HTTP/1.1 is fine here.)
4232
-			fwrite($fp, 'HEAD /' . $match[2] . ' HTTP/1.1' . "\r\n" . 'Host: ' . $match[1] . "\r\n" . 'user-agent: '. SMF_USER_AGENT . "\r\n" . 'Connection: close' . "\r\n\r\n");
4232
+			fwrite($fp, 'HEAD /' . $match[2] . ' HTTP/1.1' . "\r\n" . 'Host: ' . $match[1] . "\r\n" . 'user-agent: ' . SMF_USER_AGENT . "\r\n" . 'Connection: close' . "\r\n\r\n");
4233 4233
 
4234 4234
 			// Read in the HTTP/1.1 or whatever.
4235 4235
 			$test = substr(fgets($fp, 11), -1);
@@ -4825,7 +4825,7 @@  discard block
 block discarded – undo
4825 4825
 
4826 4826
 	uasort(
4827 4827
 		$context['css_files'],
4828
-		function ($a, $b)
4828
+		function($a, $b)
4829 4829
 		{
4830 4830
 			return $a['options']['order_pos'] < $b['options']['order_pos'] ? -1 : ($a['options']['order_pos'] > $b['options']['order_pos'] ? 1 : 0);
4831 4831
 		}
@@ -6145,7 +6145,7 @@  discard block
 block discarded – undo
6145 6145
 			{
6146 6146
 				fwrite($fp, 'GET ' . ($match[6] !== '/' ? str_replace(' ', '%20', $match[6]) : '') . ' HTTP/1.0' . "\r\n");
6147 6147
 				fwrite($fp, 'Host: ' . $match[3] . (empty($match[5]) ? ($match[2] ? ':443' : '') : ':' . $match[5]) . "\r\n");
6148
-				fwrite($fp, 'user-agent: '. SMF_USER_AGENT . "\r\n");
6148
+				fwrite($fp, 'user-agent: ' . SMF_USER_AGENT . "\r\n");
6149 6149
 				if ($keep_alive)
6150 6150
 					fwrite($fp, 'connection: Keep-Alive' . "\r\n\r\n");
6151 6151
 				else
@@ -6155,7 +6155,7 @@  discard block
 block discarded – undo
6155 6155
 			{
6156 6156
 				fwrite($fp, 'POST ' . ($match[6] !== '/' ? $match[6] : '') . ' HTTP/1.0' . "\r\n");
6157 6157
 				fwrite($fp, 'Host: ' . $match[3] . (empty($match[5]) ? ($match[2] ? ':443' : '') : ':' . $match[5]) . "\r\n");
6158
-				fwrite($fp, 'user-agent: '. SMF_USER_AGENT . "\r\n");
6158
+				fwrite($fp, 'user-agent: ' . SMF_USER_AGENT . "\r\n");
6159 6159
 				if ($keep_alive)
6160 6160
 					fwrite($fp, 'connection: Keep-Alive' . "\r\n");
6161 6161
 				else
@@ -6404,13 +6404,13 @@  discard block
 block discarded – undo
6404 6404
 
6405 6405
 	// UTF-8 occurences of MS special characters
6406 6406
 	$findchars_utf8 = array(
6407
-		"\xe2\x80\x9a",	// single low-9 quotation mark
6408
-		"\xe2\x80\x9e",	// double low-9 quotation mark
6409
-		"\xe2\x80\xa6",	// horizontal ellipsis
6410
-		"\xe2\x80\x98",	// left single curly quote
6411
-		"\xe2\x80\x99",	// right single curly quote
6412
-		"\xe2\x80\x9c",	// left double curly quote
6413
-		"\xe2\x80\x9d",	// right double curly quote
6407
+		"\xe2\x80\x9a", // single low-9 quotation mark
6408
+		"\xe2\x80\x9e", // double low-9 quotation mark
6409
+		"\xe2\x80\xa6", // horizontal ellipsis
6410
+		"\xe2\x80\x98", // left single curly quote
6411
+		"\xe2\x80\x99", // right single curly quote
6412
+		"\xe2\x80\x9c", // left double curly quote
6413
+		"\xe2\x80\x9d", // right double curly quote
6414 6414
 	);
6415 6415
 
6416 6416
 	// windows 1252 / iso equivalents
@@ -6426,13 +6426,13 @@  discard block
 block discarded – undo
6426 6426
 
6427 6427
 	// safe replacements
6428 6428
 	$replacechars = array(
6429
-		',',	// &sbquo;
6430
-		',,',	// &bdquo;
6431
-		'...',	// &hellip;
6432
-		"'",	// &lsquo;
6433
-		"'",	// &rsquo;
6434
-		'"',	// &ldquo;
6435
-		'"',	// &rdquo;
6429
+		',', // &sbquo;
6430
+		',,', // &bdquo;
6431
+		'...', // &hellip;
6432
+		"'", // &lsquo;
6433
+		"'", // &rsquo;
6434
+		'"', // &ldquo;
6435
+		'"', // &rdquo;
6436 6436
 	);
6437 6437
 
6438 6438
 	if ($context['utf8'])
@@ -6795,7 +6795,7 @@  discard block
 block discarded – undo
6795 6795
 		// We don't want abbreviations like '+03' or '-11'.
6796 6796
 		$abbrs = array_filter(
6797 6797
 			$tzvalue['abbrs'],
6798
-			function ($abbr)
6798
+			function($abbr)
6799 6799
 			{
6800 6800
 				return !strspn($abbr, '+-');
6801 6801
 			}
@@ -7784,7 +7784,7 @@  discard block
 block discarded – undo
7784 7784
 			EXISTS (
7785 7785
 				SELECT bpv.id_board
7786 7786
 				FROM ' . $db_prefix . 'board_permissions_view AS bpv
7787
-				WHERE bpv.id_group IN ('. implode(',', $groups) .')
7787
+				WHERE bpv.id_group IN ('. implode(',', $groups) . ')
7788 7788
 					AND bpv.deny = 0
7789 7789
 					AND bpv.id_board = b.id_board
7790 7790
 			)';
@@ -7794,7 +7794,7 @@  discard block
 block discarded – undo
7794 7794
 			AND NOT EXISTS (
7795 7795
 				SELECT bpv.id_board
7796 7796
 				FROM ' . $db_prefix . 'board_permissions_view AS bpv
7797
-				WHERE bpv.id_group IN ( '. implode(',', $groups) .')
7797
+				WHERE bpv.id_group IN ( '. implode(',', $groups) . ')
7798 7798
 					AND bpv.deny = 1
7799 7799
 					AND bpv.id_board = b.id_board
7800 7800
 			)';
@@ -8207,8 +8207,8 @@  discard block
 block discarded – undo
8207 8207
 	$i = 0;
8208 8208
 	while (empty($done))
8209 8209
 	{
8210
-		if (strpos($format, '{'. --$i . '}') !== false)
8211
-			$replacements['{'. $i . '}'] = array_pop($list);
8210
+		if (strpos($format, '{' . --$i . '}') !== false)
8211
+			$replacements['{' . $i . '}'] = array_pop($list);
8212 8212
 		else
8213 8213
 			$done = true;
8214 8214
 	}
@@ -8218,8 +8218,8 @@  discard block
 block discarded – undo
8218 8218
 	$i = 0;
8219 8219
 	while (empty($done))
8220 8220
 	{
8221
-		if (strpos($format, '{'. ++$i . '}') !== false)
8222
-			$replacements['{'. $i . '}'] = array_shift($list);
8221
+		if (strpos($format, '{' . ++$i . '}') !== false)
8222
+			$replacements['{' . $i . '}'] = array_shift($list);
8223 8223
 		else
8224 8224
 			$done = true;
8225 8225
 	}
@@ -8400,7 +8400,7 @@  discard block
 block discarded – undo
8400 8400
 	if (empty($stringSubject))
8401 8401
 		return '';
8402 8402
 
8403
-	$translatable_tokens = preg_match_all('/{(.*?)}/' , $stringSubject, $matches);
8403
+	$translatable_tokens = preg_match_all('/{(.*?)}/', $stringSubject, $matches);
8404 8404
 	$toFind = array();
8405 8405
 	$replaceWith = array();
8406 8406
 
Please login to merge, or discard this patch.