Passed
Pull Request — release-2.1 (#7179)
by Jon
05:54
created
Sources/Subs.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 			{
379 379
 				$val = 'CASE ';
380 380
 				foreach ($members as $k => $v)
381
-					$val .= 'WHEN id_member = ' . $v . ' THEN '. alert_count($v, true) . ' ';
381
+					$val .= 'WHEN id_member = ' . $v . ' THEN ' . alert_count($v, true) . ' ';
382 382
 
383 383
 				$val = $val . ' END';
384 384
 				$type = 'raw';
@@ -868,11 +868,11 @@  discard block
 block discarded – undo
868 868
 			// Anything that isn't a specification, punctuation mark, or whitespace.
869 869
 			'~(?<!%)\p{L}|[^\p{L}\p{P}\s]~u',
870 870
 			// A series of punctuation marks (except %), possibly separated by whitespace.
871
-			'~([^%\P{P}])(\s*)(?'.'>(\1|[^%\P{Po}])\s*(?!$))*~u',
871
+			'~([^%\P{P}])(\s*)(?' . '>(\1|[^%\P{Po}])\s*(?!$))*~u',
872 872
 			// Unwanted trailing punctuation and whitespace.
873
-			'~(?'.'>([\p{Pd}\p{Ps}\p{Pi}\p{Pc}]|[^%\P{Po}])\s*)*$~u',
873
+			'~(?' . '>([\p{Pd}\p{Ps}\p{Pi}\p{Pc}]|[^%\P{Po}])\s*)*$~u',
874 874
 			// Unwanted opening punctuation and whitespace.
875
-			'~^\s*(?'.'>([\p{Pd}\p{Pe}\p{Pf}\p{Pc}]|[^%\P{Po}])\s*)*~u',
875
+			'~^\s*(?' . '>([\p{Pd}\p{Pe}\p{Pf}\p{Pc}]|[^%\P{Po}])\s*)*~u',
876 876
 		),
877 877
 		array(
878 878
 			'',
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 	{
1156 1156
 		$date_string = preg_replace_callback(
1157 1157
 			'/\xEE\x84\xA0([\d_]+)(\xEE\x84(?:[\xA1-\xAF]))/',
1158
-			function ($matches)
1158
+			function($matches)
1159 1159
 			{
1160 1160
 				switch ($matches[2])
1161 1161
 				{
@@ -1289,7 +1289,7 @@  discard block
 block discarded – undo
1289 1289
 	elseif (!empty($context['character_set']) && is_callable('mb_decode_numericentity'))
1290 1290
 	{
1291 1291
 		// Get whatever the default replacement character is for this encoding.
1292
-		$substitute = mb_decode_numericentity('&#xFFFD;', array(0xFFFD,0xFFFD,0,0xFFFF), $context['character_set']);
1292
+		$substitute = mb_decode_numericentity('&#xFFFD;', array(0xFFFD, 0xFFFD, 0, 0xFFFF), $context['character_set']);
1293 1293
 	}
1294 1294
 	else
1295 1295
 		$substitute = '?';
@@ -1774,7 +1774,7 @@  discard block
 block discarded – undo
1774 1774
 								$returnContext .= '<img src="' . $currentAttachment['href'] . '"' . $alt . $title . ' class="bbc_img">';
1775 1775
 							else
1776 1776
 							{
1777
-								$width = !empty($params['{width}']) ? ' width="' . $params['{width}'] . '"': '';
1777
+								$width = !empty($params['{width}']) ? ' width="' . $params['{width}'] . '"' : '';
1778 1778
 								$height = !empty($params['{height}']) ? 'height="' . $params['{height}'] . '"' : '';
1779 1779
 								$returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . $width . $height . ' class="bbc_img resized"/>';
1780 1780
 							}
@@ -1785,7 +1785,7 @@  discard block
 block discarded – undo
1785 1785
 							$width = !empty($params['{width}']) ? ' width="' . $params['{width}'] . '"' : '';
1786 1786
 							$height = !empty($params['{height}']) ? ' height="' . $params['{height}'] . '"' : '';
1787 1787
 
1788
-							$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
+							$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>' : '');
1789 1789
 						}
1790 1790
 						// Audio.
1791 1791
 						elseif (strpos($currentAttachment['mime_type'], 'audio/') === 0)
@@ -1793,7 +1793,7 @@  discard block
 block discarded – undo
1793 1793
 							$width = 'max-width:100%; width: ' . (!empty($params['{width}']) ? $params['{width}'] : '400') . 'px;';
1794 1794
 							$height = !empty($params['{height}']) ? 'height: ' . $params['{height}'] . 'px;' : '';
1795 1795
 
1796
-							$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
+							$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>';
1797 1797
 						}
1798 1798
 						// Anything else.
1799 1799
 						else
@@ -1962,7 +1962,7 @@  discard block
 block discarded – undo
1962 1962
 				'type' => 'unparsed_commas_content',
1963 1963
 				'test' => '\d+,\d+\]',
1964 1964
 				'content' => '<a href="$1" target="_blank" rel="noopener">$1</a>',
1965
-				'validate' => function (&$tag, &$data, $disabled)
1965
+				'validate' => function(&$tag, &$data, $disabled)
1966 1966
 				{
1967 1967
 					$data[0] = normalize_iri($data[0]);
1968 1968
 
@@ -2088,8 +2088,8 @@  discard block
 block discarded – undo
2088 2088
 					else
2089 2089
 						$url = get_proxied_url($url);
2090 2090
 
2091
-					$alt = !empty($params['{alt}']) ? ' alt="' . $params['{alt}']. '"' : ' alt=""';
2092
-					$title = !empty($params['{title}']) ? ' title="' . $params['{title}']. '"' : '';
2091
+					$alt = !empty($params['{alt}']) ? ' alt="' . $params['{alt}'] . '"' : ' alt=""';
2092
+					$title = !empty($params['{title}']) ? ' title="' . $params['{title}'] . '"' : '';
2093 2093
 
2094 2094
 					$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">';
2095 2095
 				},
@@ -2520,12 +2520,12 @@  discard block
 block discarded – undo
2520 2520
 		$codes[] = array(
2521 2521
 			'tag' => 'cowsay',
2522 2522
 			'parameters' => array(
2523
-				'e' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => 'oo', 'validate' => function ($eyes) use ($smcFunc)
2523
+				'e' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => 'oo', 'validate' => function($eyes) use ($smcFunc)
2524 2524
 					{
2525 2525
 						return $smcFunc['substr']($eyes . 'oo', 0, 2);
2526 2526
 					},
2527 2527
 				),
2528
-				't' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => '  ', 'validate' => function ($tongue) use ($smcFunc)
2528
+				't' => array('optional' => true, 'quoted' => true, 'match' => '(.*?)', 'default' => '  ', 'validate' => function($tongue) use ($smcFunc)
2529 2529
 					{
2530 2530
 						return $smcFunc['substr']($tongue . '  ', 0, 2);
2531 2531
 					},
@@ -4230,7 +4230,7 @@  discard block
 block discarded – undo
4230 4230
 		if ($fp != false)
4231 4231
 		{
4232 4232
 			// Send the HEAD request (since we don't have to worry about chunked, HTTP/1.1 is fine here.)
4233
-			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
+			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");
4234 4234
 
4235 4235
 			// Read in the HTTP/1.1 or whatever.
4236 4236
 			$test = substr(fgets($fp, 11), -1);
@@ -4826,7 +4826,7 @@  discard block
 block discarded – undo
4826 4826
 
4827 4827
 	uasort(
4828 4828
 		$context['css_files'],
4829
-		function ($a, $b)
4829
+		function($a, $b)
4830 4830
 		{
4831 4831
 			return $a['options']['order_pos'] < $b['options']['order_pos'] ? -1 : ($a['options']['order_pos'] > $b['options']['order_pos'] ? 1 : 0);
4832 4832
 		}
@@ -6123,7 +6123,7 @@  discard block
 block discarded – undo
6123 6123
 			{
6124 6124
 				fwrite($fp, 'GET ' . ($match[6] !== '/' ? str_replace(' ', '%20', $match[6]) : '') . ' HTTP/1.0' . "\r\n");
6125 6125
 				fwrite($fp, 'Host: ' . $match[3] . (empty($match[5]) ? ($match[2] ? ':443' : '') : ':' . $match[5]) . "\r\n");
6126
-				fwrite($fp, 'user-agent: '. SMF_USER_AGENT . "\r\n");
6126
+				fwrite($fp, 'user-agent: ' . SMF_USER_AGENT . "\r\n");
6127 6127
 				if ($keep_alive)
6128 6128
 					fwrite($fp, 'connection: Keep-Alive' . "\r\n\r\n");
6129 6129
 				else
@@ -6133,7 +6133,7 @@  discard block
 block discarded – undo
6133 6133
 			{
6134 6134
 				fwrite($fp, 'POST ' . ($match[6] !== '/' ? $match[6] : '') . ' HTTP/1.0' . "\r\n");
6135 6135
 				fwrite($fp, 'Host: ' . $match[3] . (empty($match[5]) ? ($match[2] ? ':443' : '') : ':' . $match[5]) . "\r\n");
6136
-				fwrite($fp, 'user-agent: '. SMF_USER_AGENT . "\r\n");
6136
+				fwrite($fp, 'user-agent: ' . SMF_USER_AGENT . "\r\n");
6137 6137
 				if ($keep_alive)
6138 6138
 					fwrite($fp, 'connection: Keep-Alive' . "\r\n");
6139 6139
 				else
@@ -6382,13 +6382,13 @@  discard block
 block discarded – undo
6382 6382
 
6383 6383
 	// UTF-8 occurences of MS special characters
6384 6384
 	$findchars_utf8 = array(
6385
-		"\xe2\x80\x9a",	// single low-9 quotation mark
6386
-		"\xe2\x80\x9e",	// double low-9 quotation mark
6387
-		"\xe2\x80\xa6",	// horizontal ellipsis
6388
-		"\xe2\x80\x98",	// left single curly quote
6389
-		"\xe2\x80\x99",	// right single curly quote
6390
-		"\xe2\x80\x9c",	// left double curly quote
6391
-		"\xe2\x80\x9d",	// right double curly quote
6385
+		"\xe2\x80\x9a", // single low-9 quotation mark
6386
+		"\xe2\x80\x9e", // double low-9 quotation mark
6387
+		"\xe2\x80\xa6", // horizontal ellipsis
6388
+		"\xe2\x80\x98", // left single curly quote
6389
+		"\xe2\x80\x99", // right single curly quote
6390
+		"\xe2\x80\x9c", // left double curly quote
6391
+		"\xe2\x80\x9d", // right double curly quote
6392 6392
 	);
6393 6393
 
6394 6394
 	// windows 1252 / iso equivalents
@@ -6404,13 +6404,13 @@  discard block
 block discarded – undo
6404 6404
 
6405 6405
 	// safe replacements
6406 6406
 	$replacechars = array(
6407
-		',',	// &sbquo;
6408
-		',,',	// &bdquo;
6409
-		'...',	// &hellip;
6410
-		"'",	// &lsquo;
6411
-		"'",	// &rsquo;
6412
-		'"',	// &ldquo;
6413
-		'"',	// &rdquo;
6407
+		',', // &sbquo;
6408
+		',,', // &bdquo;
6409
+		'...', // &hellip;
6410
+		"'", // &lsquo;
6411
+		"'", // &rsquo;
6412
+		'"', // &ldquo;
6413
+		'"', // &rdquo;
6414 6414
 	);
6415 6415
 
6416 6416
 	if ($context['utf8'])
@@ -6771,7 +6771,7 @@  discard block
 block discarded – undo
6771 6771
 		// We don't want abbreviations like '+03' or '-11'.
6772 6772
 		$abbrs = array_filter(
6773 6773
 			$tzvalue['abbrs'],
6774
-			function ($abbr)
6774
+			function($abbr)
6775 6775
 			{
6776 6776
 				return !strspn($abbr, '+-');
6777 6777
 			}
@@ -7760,7 +7760,7 @@  discard block
 block discarded – undo
7760 7760
 			EXISTS (
7761 7761
 				SELECT bpv.id_board
7762 7762
 				FROM ' . $db_prefix . 'board_permissions_view AS bpv
7763
-				WHERE bpv.id_group IN ('. implode(',', $groups) .')
7763
+				WHERE bpv.id_group IN ('. implode(',', $groups) . ')
7764 7764
 					AND bpv.deny = 0
7765 7765
 					AND bpv.id_board = b.id_board
7766 7766
 			)';
@@ -7770,7 +7770,7 @@  discard block
 block discarded – undo
7770 7770
 			AND NOT EXISTS (
7771 7771
 				SELECT bpv.id_board
7772 7772
 				FROM ' . $db_prefix . 'board_permissions_view AS bpv
7773
-				WHERE bpv.id_group IN ( '. implode(',', $groups) .')
7773
+				WHERE bpv.id_group IN ( '. implode(',', $groups) . ')
7774 7774
 					AND bpv.deny = 1
7775 7775
 					AND bpv.id_board = b.id_board
7776 7776
 			)';
@@ -8177,8 +8177,8 @@  discard block
 block discarded – undo
8177 8177
 	$i = 0;
8178 8178
 	while (empty($done))
8179 8179
 	{
8180
-		if (strpos($format, '{'. --$i . '}') !== false)
8181
-			$replacements['{'. $i . '}'] = array_pop($list);
8180
+		if (strpos($format, '{' . --$i . '}') !== false)
8181
+			$replacements['{' . $i . '}'] = array_pop($list);
8182 8182
 		else
8183 8183
 			$done = true;
8184 8184
 	}
@@ -8188,8 +8188,8 @@  discard block
 block discarded – undo
8188 8188
 	$i = 0;
8189 8189
 	while (empty($done))
8190 8190
 	{
8191
-		if (strpos($format, '{'. ++$i . '}') !== false)
8192
-			$replacements['{'. $i . '}'] = array_shift($list);
8191
+		if (strpos($format, '{' . ++$i . '}') !== false)
8192
+			$replacements['{' . $i . '}'] = array_shift($list);
8193 8193
 		else
8194 8194
 			$done = true;
8195 8195
 	}
@@ -8367,7 +8367,7 @@  discard block
 block discarded – undo
8367 8367
 	if (empty($stringSubject))
8368 8368
 		return '';
8369 8369
 
8370
-	$translatable_tokens = preg_match_all('/{(.*?)}/' , $stringSubject, $matches);
8370
+	$translatable_tokens = preg_match_all('/{(.*?)}/', $stringSubject, $matches);
8371 8371
 	$toFind = array();
8372 8372
 	$replaceWith = array();
8373 8373
 
Please login to merge, or discard this patch.