Completed
Pull Request — release-2.1 (#4574)
by Matthew
07:51
created
Sources/ManageMembers.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 			// INET.
361 361
 			elseif ($param_info['type'] == 'inet')
362 362
 			{
363
-				if(count($search_params[$param_name]) === 1)
363
+				if (count($search_params[$param_name]) === 1)
364 364
 				{
365 365
 					$query_parts[] = '(' . $param_info['db_fields'][0] . ' = {inet:' . $param_name . '})';
366 366
 					$where_params[$param_name] = $search_params[$param_name][0];
@@ -368,8 +368,8 @@  discard block
 block discarded – undo
368 368
 				elseif (count($search_params[$param_name]) === 2)
369 369
 				{
370 370
 					$query_parts[] = '(' . $param_info['db_fields'][0] . ' <= {inet:' . $param_name . '_high} and ' . $param_info['db_fields'][0] . ' >= {inet:' . $param_name . '_low})';
371
-					$where_params[$param_name.'_low'] = $search_params[$param_name]['low'];
372
-					$where_params[$param_name.'_high'] = $search_params[$param_name]['high'];
371
+					$where_params[$param_name . '_low'] = $search_params[$param_name]['low'];
372
+					$where_params[$param_name . '_high'] = $search_params[$param_name]['high'];
373 373
 				}
374 374
 				
375 375
 			}
Please login to merge, or discard this patch.
Sources/Who.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 						'Jessica "Suki" Gonz&aacute;lez',
593 593
 						'Karl "RegularExpression" Benson',
594 594
 						'Matthew "Labradoodle-360" Kerle',
595
-						$user_info['is_admin'] ? 'Matt "Grudge" Wolf': 'Grudge',
595
+						$user_info['is_admin'] ? 'Matt "Grudge" Wolf' : 'Grudge',
596 596
 						'Michael "Thantos" Miller',
597 597
 						'Norv',
598 598
 						'Peter "Arantor" Spicer',
@@ -824,13 +824,13 @@  discard block
 block discarded – undo
824 824
 			$credit_info = $smcFunc['json_decode']($row['credits'], true);
825 825
 
826 826
 			$copyright = empty($credit_info['copyright']) ? '' : $txt['credits_copyright'] . ' &copy; ' . $smcFunc['htmlspecialchars']($credit_info['copyright']);
827
-			$license = empty($credit_info['license']) ? '' : $txt['credits_license'] . ': ' . (!empty($credit_info['licenseurl']) ? '<a href="'. $smcFunc['htmlspecialchars']($credit_info['licenseurl']) .'">'. $smcFunc['htmlspecialchars']($credit_info['license']) .'</a>' : $smcFunc['htmlspecialchars']($credit_info['license']));
827
+			$license = empty($credit_info['license']) ? '' : $txt['credits_license'] . ': ' . (!empty($credit_info['licenseurl']) ? '<a href="' . $smcFunc['htmlspecialchars']($credit_info['licenseurl']) . '">' . $smcFunc['htmlspecialchars']($credit_info['license']) . '</a>' : $smcFunc['htmlspecialchars']($credit_info['license']));
828 828
 			$version = $txt['credits_version'] . ' ' . $row['version'];
829 829
 			$title = (empty($credit_info['title']) ? $row['name'] : $smcFunc['htmlspecialchars']($credit_info['title'])) . ': ' . $version;
830 830
 
831 831
 			// build this one out and stash it away
832 832
 			$mod_name = empty($credit_info['url']) ? $title : '<a href="' . $credit_info['url'] . '">' . $title . '</a>';
833
-			$mods[] = $mod_name . (!empty($license) ? ' | ' . $license  : '') . (!empty($copyright) ? ' | ' . $copyright  : '');
833
+			$mods[] = $mod_name . (!empty($license) ? ' | ' . $license : '') . (!empty($copyright) ? ' | ' . $copyright : '');
834 834
 		}
835 835
 		cache_put_data('mods_credits', $mods, 86400);
836 836
 	}
Please login to merge, or discard this patch.
Sources/Subscriptions-PayPal.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -236,7 +236,7 @@
 block discarded – undo
236 236
 			$header = 'POST /cgi-bin/webscr HTTP/1.1' . "\r\n";
237 237
 			$header .= 'content-type: application/x-www-form-urlencoded' . "\r\n";
238 238
 			$header .= 'Host: www.' . (!empty($modSettings['paidsubs_test']) ? 'sandbox.' : '') . 'paypal.com' . "\r\n";
239
-			$header .= 'content-length: ' . strlen ($requestString) . "\r\n";
239
+			$header .= 'content-length: ' . strlen($requestString) . "\r\n";
240 240
 			$header .= 'connection: close' . "\r\n\r\n";
241 241
 
242 242
 			// Open the connection.
Please login to merge, or discard this patch.
Sources/Attachments.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		// Just send a generic message.
77 77
 		else
78 78
 			$this->setResponse(array(
79
-				'text' => $this->_sa == 'add' ? 'attach_error_title' :   'attached_file_deleted_error',
79
+				'text' => $this->_sa == 'add' ? 'attach_error_title' : 'attached_file_deleted_error',
80 80
 				'type' => 'error',
81 81
 				'data' => false,
82 82
 			));
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 			// Gotta urlencode the filename.
411 411
 			if ($this->_attachResults)
412 412
 				foreach ($this->_attachResults as $k => $v)
413
-					$this->_attachResults[$k]['name'] =  urlencode($this->_attachResults[$k]['name']);
413
+					$this->_attachResults[$k]['name'] = urlencode($this->_attachResults[$k]['name']);
414 414
 
415 415
 			$this->_response = array(
416 416
 				'files' => $this->_attachResults ? $this->_attachResults : false,
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 			ob_start();
438 438
 
439 439
 		// Set the header.
440
-		header('content-type: application/json; charset='. $context['character_set'] .'');
440
+		header('content-type: application/json; charset=' . $context['character_set'] . '');
441 441
 
442 442
 		echo $smcFunc['json_encode']($this->_response ? $this->_response : array());
443 443
 
Please login to merge, or discard this patch.
Sources/Subs-Post.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -704,7 +704,7 @@
 block discarded – undo
704 704
 					$mail_result = false;
705 705
 				}
706 706
 			}
707
-			catch(ErrorException $e)
707
+			catch (ErrorException $e)
708 708
 			{
709 709
 				log_error($e->getMessage(), 'general', $e->getFile(), $e->getLine());
710 710
 				log_error(sprintf($txt['mail_send_unable'], $to));
Please login to merge, or discard this patch.
Themes/default/PersonalMessage.template.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
 				foreach ($message['custom_fields']['above_member'] as $custom)
233 233
 					echo '
234
-							<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
234
+							<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
235 235
 
236 236
 				echo '
237 237
 						</ul>
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 			if (!empty($message['custom_fields']['below_avatar']))
281 281
 				foreach ($message['custom_fields']['below_avatar'] as $custom)
282 282
 					echo '
283
-						<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
283
+						<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
284 284
 
285 285
 			if (!$message['member']['is_guest'])
286 286
 				echo '
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 
323 323
 					foreach ($message['custom_fields']['icons'] as $custom)
324 324
 						echo '
325
-								<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
325
+								<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
326 326
 
327 327
 					echo '
328 328
 							</ol>
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 				if (!empty($message['custom_fields']['standard']))
387 387
 					foreach ($message['custom_fields']['standard'] as $custom)
388 388
 						echo '
389
-						<li class="custom ', $custom['col_name'] ,'">', $custom['title'], ': ', $custom['value'], '</li>';
389
+						<li class="custom ', $custom['col_name'], '">', $custom['title'], ': ', $custom['value'], '</li>';
390 390
 
391 391
 				// Are we showing the warning status?
392 392
 				if ($message['member']['can_see_warning'])
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 				if (!empty($message['custom_fields']['bottom_poster']))
398 398
 					foreach ($message['custom_fields']['bottom_poster'] as $custom)
399 399
 						echo '
400
-						<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
400
+						<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
401 401
 			}
402 402
 
403 403
 			// Done with the information about the poster... on to the post itself.
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 
499 499
 				foreach ($message['custom_fields']['above_signature'] as $custom)
500 500
 					echo '
501
-								<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
501
+								<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
502 502
 
503 503
 				echo '
504 504
 							</ul>
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 
522 522
 				foreach ($message['custom_fields']['below_signature'] as $custom)
523 523
 					echo '
524
-								<li class="custom ', $custom['col_name'] ,'">', $custom['value'], '</li>';
524
+								<li class="custom ', $custom['col_name'], '">', $custom['value'], '</li>';
525 525
 
526 526
 				echo '
527 527
 							</ul>
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 	while ($message = $context['get_pmessage']('subject'))
658 658
 	{
659 659
 		echo '
660
-			<tr class="windowbg', $message['is_unread'] ? ' unread_pm' : '','">
660
+			<tr class="windowbg', $message['is_unread'] ? ' unread_pm' : '', '">
661 661
 				<td class="table_icon">
662 662
 					<script>
663 663
 						currentLabels[', $message['id'], '] = {';
@@ -946,13 +946,13 @@  discard block
 block discarded – undo
946 946
 				// You can only reply if they are not a guest...
947 947
 				if (!$message['member']['is_guest'])
948 948
 					echo '
949
-					<a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=', $context['folder'] == 'sent' ? '' : $message['member']['id'], '">', $quote_button , '</a>', $context['menu_separator'], '
950
-					<a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $reply_button , '</a> ', $context['menu_separator'];
949
+					<a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote;u=', $context['folder'] == 'sent' ? '' : $message['member']['id'], '">', $quote_button, '</a>', $context['menu_separator'], '
950
+					<a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';u=', $message['member']['id'], '">', $reply_button, '</a> ', $context['menu_separator'];
951 951
 
952 952
 				// This is for "forwarding" - even if the member is gone.
953 953
 				else
954 954
 					echo '
955
-					<a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote">', $quote_button , '</a>', $context['menu_separator'];
955
+					<a href="', $scripturl, '?action=pm;sa=send;f=', $context['folder'], $context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '', ';pmsg=', $message['id'], ';quote">', $quote_button, '</a>', $context['menu_separator'];
956 956
 			}
957 957
 
958 958
 			echo '
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
 				<div class="', empty($context['error_type']) || $context['error_type'] != 'serious' ? 'noticebox' : 'errorbox', '"', empty($context['post_error']['messages']) ? ' style="display: none"' : '', ' id="errors">
1055 1055
 					<dl>
1056 1056
 						<dt>
1057
-							<strong id="error_serious">', $txt['error_while_submitting'] , '</strong>
1057
+							<strong id="error_serious">', $txt['error_while_submitting'], '</strong>
1058 1058
 						</dt>
1059 1059
 						<dd class="error" id="error_list">
1060 1060
 							', empty($context['post_error']['messages']) ? '' : implode('<br>', $context['post_error']['messages']), '
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
 						<span', (isset($context['post_error']['no_subject']) ? ' class="error"' : ''), ' id="caption_subject">', $txt['subject'], ':</span>
1111 1111
 					</dt>
1112 1112
 					<dd id="pm_subject">
1113
-						<input type="text" name="subject" value="', $context['subject'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="80"',isset($context['post_error']['no_subject']) ? ' class="error"' : '', '>
1113
+						<input type="text" name="subject" value="', $context['subject'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="80"', isset($context['post_error']['no_subject']) ? ' class="error"' : '', '>
1114 1114
 					</dd>
1115 1115
 				</dl>';
1116 1116
 
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
 		echo '
1464 1464
 		<div class="padding">
1465 1465
 			<input type="submit" name="save" value="', $txt['save'], '" class="button">
1466
-			<input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" data-confirm="', $txt['pm_labels_delete'] ,'" class="button you_sure">
1466
+			<input type="submit" name="delete" value="', $txt['quickmod_delete_selected'], '" data-confirm="', $txt['pm_labels_delete'], '" class="button you_sure">
1467 1467
 		</div>';
1468 1468
 
1469 1469
 	echo '
@@ -1628,7 +1628,7 @@  discard block
 block discarded – undo
1628 1628
 	if (!empty($context['rules']))
1629 1629
 		echo '
1630 1630
 			<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
1631
-			<input type="submit" name="delselected" value="', $txt['pm_delete_selected_rule'], '" data-confirm="', $txt['pm_js_delete_rule_confirm'] ,'" class="button smalltext you_sure">';
1631
+			<input type="submit" name="delselected" value="', $txt['pm_delete_selected_rule'], '" data-confirm="', $txt['pm_js_delete_rule_confirm'], '" class="button smalltext you_sure">';
1632 1632
 
1633 1633
 	echo '
1634 1634
 		</div>
@@ -1871,9 +1871,9 @@  discard block
 block discarded – undo
1871 1871
 
1872 1872
 		echo '
1873 1873
 				<select name="acttype[', $k, ']" id="acttype', $k, '" onchange="updateActionDef(', $k, '); rebuildRuleDesc();">
1874
-					<option value="">', $txt['pm_rule_sel_action'] , ':</option>
1875
-					<option value="lab"', $action['t'] == 'lab' ? ' selected' : '', '>', $txt['pm_rule_label'] , '</option>
1876
-					<option value="del"', $action['t'] == 'del' ? ' selected' : '', '>', $txt['pm_rule_delete'] , '</option>
1874
+					<option value="">', $txt['pm_rule_sel_action'], ':</option>
1875
+					<option value="lab"', $action['t'] == 'lab' ? ' selected' : '', '>', $txt['pm_rule_label'], '</option>
1876
+					<option value="del"', $action['t'] == 'del' ? ' selected' : '', '>', $txt['pm_rule_delete'], '</option>
1877 1877
 				</select>
1878 1878
 				<span id="labdiv', $k, '">
1879 1879
 					<select name="labdef[', $k, ']" id="labdef', $k, '" onchange="rebuildRuleDesc();">
@@ -1985,7 +1985,7 @@  discard block
 block discarded – undo
1985 1985
 			</div>
1986 1986
 			<ul class="quickbuttons">
1987 1987
 				<li><a href="', $scripturl, '?action=pm;sa=showpmdrafts;id_draft=', $draft['id_draft'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons modifybutton"></span>', $txt['draft_edit'], '</a></li>
1988
-				<li><a href="', $scripturl, '?action=pm;sa=showpmdrafts;delete=', $draft['id_draft'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['draft_remove'] ,'?" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['draft_delete'], '</a></li>
1988
+				<li><a href="', $scripturl, '?action=pm;sa=showpmdrafts;delete=', $draft['id_draft'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['draft_remove'], '?" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['draft_delete'], '</a></li>
1989 1989
 			</ul>
1990 1990
 		</div><!-- .windowbg -->';
1991 1991
 		}
Please login to merge, or discard this patch.
Sources/Profile-Modify.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1256,7 +1256,7 @@  discard block
 block discarded – undo
1256 1256
 			);
1257 1257
 			if (empty($value))
1258 1258
 			{
1259
-				$deletes = array('id_theme' => 1 , 'variable' => $row['col_name'], 'id_member' => $memID);
1259
+				$deletes = array('id_theme' => 1, 'variable' => $row['col_name'], 'id_member' => $memID);
1260 1260
 				unset($user_profile[$memID]['options'][$row['col_name']]);
1261 1261
 			}
1262 1262
 			else
@@ -1284,7 +1284,7 @@  discard block
 block discarded – undo
1284 1284
 				array('id_theme', 'variable', 'id_member')
1285 1285
 			);
1286 1286
 		if (!empty($deletes))
1287
-			$smcFunc['db_query']('','
1287
+			$smcFunc['db_query']('', '
1288 1288
 				DELETE FROM {db_prefix}themes 
1289 1289
 				WHERE id_theme = {int:id_theme} AND 
1290 1290
 						variable = {string:variable} AND 
Please login to merge, or discard this patch.
proxy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@
 block discarded – undo
140 140
 		$max_age = $time - $cached['time'] + (5 * 86400);
141 141
 		header('content-type: ' . $cached['content_type']);
142 142
 		header('content-length: ' . $cached['size']);
143
-		header('cache-control: public, max-age=' . $max_age );
143
+		header('cache-control: public, max-age=' . $max_age);
144 144
 		header('last-modified: ' . gmdate('D, d M Y H:i:s', $cached['time']) . ' GMT');
145 145
 		header('etag: ' . $eTag);
146 146
 		echo base64_decode($cached['body']);
Please login to merge, or discard this patch.
Sources/Subs.php 1 patch
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 			{
387 387
 				$val = 'CASE ';
388 388
 				foreach ($members as $k => $v)
389
-					$val .= 'WHEN id_member = ' . $v . ' THEN '. count(fetch_alerts($v, false, 0, array(), false)) . ' ';
389
+					$val .= 'WHEN id_member = ' . $v . ' THEN ' . count(fetch_alerts($v, false, 0, array(), false)) . ' ';
390 390
 				$val = $val . ' END';
391 391
 				$type = 'raw';
392 392
 			}
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
 			$unsupportedFormats = (array) cache_get_data('unsupportedtimeformats', 86400);
818 818
 		if (empty($unsupportedFormats))
819 819
 		{
820
-			foreach($strftimeFormatSubstitutions as $format => $substitution)
820
+			foreach ($strftimeFormatSubstitutions as $format => $substitution)
821 821
 			{
822 822
 				$value = @strftime('%' . $format);
823 823
 
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
 					'height' => array('optional' => true, 'match' => '(\d+)'),
1183 1183
 				),
1184 1184
 				'content' => '$1',
1185
-				'validate' => function (&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt)
1185
+				'validate' => function(&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt)
1186 1186
 				{
1187 1187
 					$returnContext = '';
1188 1188
 
@@ -1217,7 +1217,7 @@  discard block
 block discarded – undo
1217 1217
 						}
1218 1218
 
1219 1219
 						if ($currentAttachment['thumbnail']['has_thumb'] && empty($params['{width}']) && empty($params['{height}']))
1220
-							$returnContext .= '<a href="'. $currentAttachment['href']. ';image" id="link_'. $currentAttachment['id']. '" onclick="'. $currentAttachment['thumbnail']['javascript']. '"><img src="'. $currentAttachment['thumbnail']['href']. '"' . $alt . $title . ' id="thumb_'. $currentAttachment['id']. '" class="atc_img"></a>';
1220
+							$returnContext .= '<a href="' . $currentAttachment['href'] . ';image" id="link_' . $currentAttachment['id'] . '" onclick="' . $currentAttachment['thumbnail']['javascript'] . '"><img src="' . $currentAttachment['thumbnail']['href'] . '"' . $alt . $title . ' id="thumb_' . $currentAttachment['id'] . '" class="atc_img"></a>';
1221 1221
 						else
1222 1222
 							$returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . $width . $height . ' class="bbc_img"/>';
1223 1223
 					}
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
 				'type' => 'unparsed_content',
1247 1247
 				'content' => '<div class="codeheader"><span class="code floatleft">' . $txt['code'] . '</span> <a class="codeoperation smf_select_text">' . $txt['code_select'] . '</a></div><code class="bbc_code">$1</code>',
1248 1248
 				// @todo Maybe this can be simplified?
1249
-				'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context)
1249
+				'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context)
1250 1250
 				{
1251 1251
 					if (!isset($disabled['code']))
1252 1252
 					{
@@ -1283,7 +1283,7 @@  discard block
 block discarded – undo
1283 1283
 				'type' => 'unparsed_equals_content',
1284 1284
 				'content' => '<div class="codeheader"><span class="code floatleft">' . $txt['code'] . '</span> ($2) <a class="codeoperation smf_select_text">' . $txt['code_select'] . '</a></div><code class="bbc_code">$1</code>',
1285 1285
 				// @todo Maybe this can be simplified?
1286
-				'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context)
1286
+				'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context)
1287 1287
 				{
1288 1288
 					if (!isset($disabled['code']))
1289 1289
 					{
@@ -1327,7 +1327,7 @@  discard block
 block discarded – undo
1327 1327
 				'type' => 'unparsed_content',
1328 1328
 				'content' => '<a href="mailto:$1" class="bbc_email">$1</a>',
1329 1329
 				// @todo Should this respect guest_hideContacts?
1330
-				'validate' => function (&$tag, &$data, $disabled)
1330
+				'validate' => function(&$tag, &$data, $disabled)
1331 1331
 				{
1332 1332
 					$data = strtr($data, array('<br>' => ''));
1333 1333
 				},
@@ -1346,7 +1346,7 @@  discard block
 block discarded – undo
1346 1346
 				'type' => 'unparsed_commas_content',
1347 1347
 				'test' => '\d+,\d+\]',
1348 1348
 				'content' => '<embed type="application/x-shockwave-flash" src="$1" width="$2" height="$3" play="true" loop="true" quality="high" AllowScriptAccess="never">',
1349
-				'validate' => function (&$tag, &$data, $disabled)
1349
+				'validate' => function(&$tag, &$data, $disabled)
1350 1350
 				{
1351 1351
 					if (isset($disabled['url']))
1352 1352
 						$tag['content'] = '$1';
@@ -1362,7 +1362,7 @@  discard block
 block discarded – undo
1362 1362
 				'test' => '(left|right)(\s+max=\d+(?:%|px|em|rem|ex|pt|pc|ch|vw|vh|vmin|vmax|cm|mm|in)?)?\]',
1363 1363
 				'before' => '<div $1>',
1364 1364
 				'after' => '</div>',
1365
-				'validate' => function (&$tag, &$data, $disabled)
1365
+				'validate' => function(&$tag, &$data, $disabled)
1366 1366
 				{
1367 1367
 					$class = 'class="bbc_float float' . (strpos($data, 'left') === 0 ? 'left' : 'right') . '"';
1368 1368
 
@@ -1411,7 +1411,7 @@  discard block
 block discarded – undo
1411 1411
 					'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),
1412 1412
 				),
1413 1413
 				'content' => '<img src="$1" alt="{alt}" title="{title}"{width}{height} class="bbc_img resized">',
1414
-				'validate' => function (&$tag, &$data, $disabled)
1414
+				'validate' => function(&$tag, &$data, $disabled)
1415 1415
 				{
1416 1416
 					global $image_proxy_enabled, $user_info;
1417 1417
 
@@ -1437,7 +1437,7 @@  discard block
 block discarded – undo
1437 1437
 				'tag' => 'img',
1438 1438
 				'type' => 'unparsed_content',
1439 1439
 				'content' => '<img src="$1" alt="" class="bbc_img">',
1440
-				'validate' => function (&$tag, &$data, $disabled)
1440
+				'validate' => function(&$tag, &$data, $disabled)
1441 1441
 				{
1442 1442
 					global $image_proxy_enabled, $user_info;
1443 1443
 
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
 				'tag' => 'iurl',
1464 1464
 				'type' => 'unparsed_content',
1465 1465
 				'content' => '<a href="$1" class="bbc_link">$1</a>',
1466
-				'validate' => function (&$tag, &$data, $disabled)
1466
+				'validate' => function(&$tag, &$data, $disabled)
1467 1467
 				{
1468 1468
 					$data = strtr($data, array('<br>' => ''));
1469 1469
 					$scheme = parse_url($data, PHP_URL_SCHEME);
@@ -1477,7 +1477,7 @@  discard block
 block discarded – undo
1477 1477
 				'quoted' => 'optional',
1478 1478
 				'before' => '<a href="$1" class="bbc_link">',
1479 1479
 				'after' => '</a>',
1480
-				'validate' => function (&$tag, &$data, $disabled)
1480
+				'validate' => function(&$tag, &$data, $disabled)
1481 1481
 				{
1482 1482
 					if (substr($data, 0, 1) == '#')
1483 1483
 						$data = '#post_' . substr($data, 1);
@@ -1557,7 +1557,7 @@  discard block
 block discarded – undo
1557 1557
 				'tag' => 'php',
1558 1558
 				'type' => 'unparsed_content',
1559 1559
 				'content' => '<span class="phpcode">$1</span>',
1560
-				'validate' => isset($disabled['php']) ? null : function (&$tag, &$data, $disabled)
1560
+				'validate' => isset($disabled['php']) ? null : function(&$tag, &$data, $disabled)
1561 1561
 				{
1562 1562
 					if (!isset($disabled['php']))
1563 1563
 					{
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
 				'test' => '[1-7]\]',
1656 1656
 				'before' => '<span style="font-size: $1;" class="bbc_size">',
1657 1657
 				'after' => '</span>',
1658
-				'validate' => function (&$tag, &$data, $disabled)
1658
+				'validate' => function(&$tag, &$data, $disabled)
1659 1659
 				{
1660 1660
 					$sizes = array(1 => 0.7, 2 => 1.0, 3 => 1.35, 4 => 1.45, 5 => 2.0, 6 => 2.65, 7 => 3.95);
1661 1661
 					$data = $sizes[$data] . 'em';
@@ -1693,7 +1693,7 @@  discard block
 block discarded – undo
1693 1693
 				'tag' => 'time',
1694 1694
 				'type' => 'unparsed_content',
1695 1695
 				'content' => '$1',
1696
-				'validate' => function (&$tag, &$data, $disabled)
1696
+				'validate' => function(&$tag, &$data, $disabled)
1697 1697
 				{
1698 1698
 					if (is_numeric($data))
1699 1699
 						$data = timeformat($data);
@@ -1721,7 +1721,7 @@  discard block
 block discarded – undo
1721 1721
 				'tag' => 'url',
1722 1722
 				'type' => 'unparsed_content',
1723 1723
 				'content' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">$1</a>',
1724
-				'validate' => function (&$tag, &$data, $disabled)
1724
+				'validate' => function(&$tag, &$data, $disabled)
1725 1725
 				{
1726 1726
 					$data = strtr($data, array('<br>' => ''));
1727 1727
 					$scheme = parse_url($data, PHP_URL_SCHEME);
@@ -1735,7 +1735,7 @@  discard block
 block discarded – undo
1735 1735
 				'quoted' => 'optional',
1736 1736
 				'before' => '<a href="$1" class="bbc_link" target="_blank" rel="noopener">',
1737 1737
 				'after' => '</a>',
1738
-				'validate' => function (&$tag, &$data, $disabled)
1738
+				'validate' => function(&$tag, &$data, $disabled)
1739 1739
 				{
1740 1740
 					$scheme = parse_url($data, PHP_URL_SCHEME);
1741 1741
 					if (empty($scheme))
@@ -1761,7 +1761,7 @@  discard block
 block discarded – undo
1761 1761
 		{
1762 1762
 			if (isset($temp_bbc))
1763 1763
 				$bbc_codes = $temp_bbc;
1764
-			usort($codes, function ($a, $b) {
1764
+			usort($codes, function($a, $b) {
1765 1765
 				return strcmp($a['tag'], $b['tag']);
1766 1766
 			});
1767 1767
 			return $codes;
@@ -1998,7 +1998,7 @@  discard block
 block discarded – undo
1998 1998
 										# a run of Unicode domain name characters and a dot
1999 1999
 										[\p{L}\p{M}\p{N}\-.:@]+\.
2000 2000
 										# and then a TLD valid in the DNS or the reserved "local" TLD
2001
-										(?:'. $modSettings['tld_regex'] .'|local)
2001
+										(?:'. $modSettings['tld_regex'] . '|local)
2002 2002
 									)
2003 2003
 									# followed by a non-domain character or end of line
2004 2004
 									(?=[^\p{L}\p{N}\-.]|$)
@@ -2066,7 +2066,7 @@  discard block
 block discarded – undo
2066 2066
 						)?
2067 2067
 						';
2068 2068
 
2069
-						$data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) {
2069
+						$data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function($matches) {
2070 2070
 							$url = array_shift($matches);
2071 2071
 
2072 2072
 							$scheme = parse_url($url, PHP_URL_SCHEME);
@@ -2147,7 +2147,7 @@  discard block
 block discarded – undo
2147 2147
 			$look_for = strtolower(substr($message, $pos + 2, $pos2 - $pos - 2));
2148 2148
 
2149 2149
 			// A closing tag that doesn't match any open tags? Skip it.
2150
-			if (!in_array($look_for, array_map(function($code){return $code['tag'];}, $open_tags)))
2150
+			if (!in_array($look_for, array_map(function($code) {return $code['tag']; }, $open_tags)))
2151 2151
 				continue;
2152 2152
 
2153 2153
 			$to_close = array();
@@ -2814,7 +2814,7 @@  discard block
 block discarded – undo
2814 2814
 		for ($i = 0, $n = count($smileysfrom); $i < $n; $i++)
2815 2815
 		{
2816 2816
 			$specialChars = $smcFunc['htmlspecialchars']($smileysfrom[$i], ENT_QUOTES);
2817
-			$smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => '&#58;', '(' => '&#40;', ')' => '&#41;', '$' => '&#36;', '[' => '&#091;')). '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => '&#58;', '(' => '&#40;', ')' => '&#41;', '$' => '&#36;', '[' => '&#091;')) . '" class="smiley">';
2817
+			$smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => '&#58;', '(' => '&#40;', ')' => '&#41;', '$' => '&#36;', '[' => '&#091;')) . '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => '&#58;', '(' => '&#40;', ')' => '&#41;', '$' => '&#36;', '[' => '&#091;')) . '" class="smiley">';
2818 2818
 
2819 2819
 			$smileyPregReplacements[$smileysfrom[$i]] = $smileyCode;
2820 2820
 
@@ -2831,7 +2831,7 @@  discard block
 block discarded – undo
2831 2831
 
2832 2832
 	// Replace away!
2833 2833
 	$message = preg_replace_callback($smileyPregSearch,
2834
-		function ($matches) use ($smileyPregReplacements)
2834
+		function($matches) use ($smileyPregReplacements)
2835 2835
 		{
2836 2836
 			return $smileyPregReplacements[$matches[1]];
2837 2837
 		}, $message);
@@ -2915,13 +2915,13 @@  discard block
 block discarded – undo
2915 2915
 	{
2916 2916
 		if (defined('SID') && SID != '')
2917 2917
 			$setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&amp;))((?:board|topic)=[^#]+?)(#[^"]*?)?$~',
2918
-				function ($m) use ($scripturl)
2918
+				function($m) use ($scripturl)
2919 2919
 				{
2920
-					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID. (isset($m[2]) ? "$m[2]" : "");
2920
+					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID . (isset($m[2]) ? "$m[2]" : "");
2921 2921
 				}, $setLocation);
2922 2922
 		else
2923 2923
 			$setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~',
2924
-				function ($m) use ($scripturl)
2924
+				function($m) use ($scripturl)
2925 2925
 				{
2926 2926
 					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? "$m[2]" : "");
2927 2927
 				}, $setLocation);
@@ -3244,7 +3244,7 @@  discard block
 block discarded – undo
3244 3244
 
3245 3245
 	// Add a generic "Are you sure?" confirmation message.
3246 3246
 	addInlineJavaScript('
3247
-	var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) .';');
3247
+	var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) . ';');
3248 3248
 
3249 3249
 	// Now add the capping code for avatars.
3250 3250
 	if (!empty($modSettings['avatar_max_width_external']) && !empty($modSettings['avatar_max_height_external']) && !empty($modSettings['avatar_action_too_large']) && $modSettings['avatar_action_too_large'] == 'option_css_resize')
@@ -3688,7 +3688,7 @@  discard block
 block discarded – undo
3688 3688
 	if (!empty($normal))
3689 3689
 		foreach ($normal as $nf)
3690 3690
 			echo '
3691
-	<link rel="stylesheet" href="', $nf ,'">';
3691
+	<link rel="stylesheet" href="', $nf, '">';
3692 3692
 
3693 3693
 	if ($db_show_debug === true)
3694 3694
 	{
@@ -3704,7 +3704,7 @@  discard block
 block discarded – undo
3704 3704
 	<style>';
3705 3705
 
3706 3706
 		foreach ($context['css_header'] as $css)
3707
-			echo $css .'
3707
+			echo $css . '
3708 3708
 	';
3709 3709
 
3710 3710
 		echo'
@@ -3743,7 +3743,7 @@  discard block
 block discarded – undo
3743 3743
 		return true;
3744 3744
 
3745 3745
 	// No namespaces, sorry!
3746
-	$classType = 'MatthiasMullie\\Minify\\'. strtoupper($type);
3746
+	$classType = 'MatthiasMullie\\Minify\\' . strtoupper($type);
3747 3747
 
3748 3748
 	// Temp path.
3749 3749
 	$cTempPath = $settings['theme_dir'] . '/' . ($type == 'css' ? 'css' : 'scripts') . '/';
@@ -3869,7 +3869,7 @@  discard block
 block discarded – undo
3869 3869
 	else
3870 3870
 		$path = $modSettings['attachmentUploadDir'];
3871 3871
 
3872
-	return $path . '/' . $attachment_id . '_' . $file_hash .'.dat';
3872
+	return $path . '/' . $attachment_id . '_' . $file_hash . '.dat';
3873 3873
 }
3874 3874
 
3875 3875
 /**
@@ -3913,10 +3913,10 @@  discard block
 block discarded – undo
3913 3913
 		$valid_low = isValidIP($ip_parts[0]);
3914 3914
 		$valid_high = isValidIP($ip_parts[1]);
3915 3915
 		$count = 0;
3916
-		$mode = (preg_match('/:/',$ip_parts[0]) > 0 ? ':' : '.');
3916
+		$mode = (preg_match('/:/', $ip_parts[0]) > 0 ? ':' : '.');
3917 3917
 		$max = ($mode == ':' ? 'ffff' : '255');
3918 3918
 		$min = 0;
3919
-		if(!$valid_low)
3919
+		if (!$valid_low)
3920 3920
 		{
3921 3921
 			$ip_parts[0] = preg_replace('/\*/', '0', $ip_parts[0]);
3922 3922
 			$valid_low = isValidIP($ip_parts[0]);
@@ -3930,7 +3930,7 @@  discard block
 block discarded – undo
3930 3930
 		}
3931 3931
 
3932 3932
 		$count = 0;
3933
-		if(!$valid_high)
3933
+		if (!$valid_high)
3934 3934
 		{
3935 3935
 			$ip_parts[1] = preg_replace('/\*/', $max, $ip_parts[1]);
3936 3936
 			$valid_high = isValidIP($ip_parts[1]);
@@ -3943,7 +3943,7 @@  discard block
 block discarded – undo
3943 3943
 			}
3944 3944
 		}
3945 3945
 
3946
-		if($valid_high && $valid_low)
3946
+		if ($valid_high && $valid_low)
3947 3947
 		{
3948 3948
 			$ip_array['low'] = $ip_parts[0];
3949 3949
 			$ip_array['high'] = $ip_parts[1];
@@ -4125,7 +4125,7 @@  discard block
 block discarded – undo
4125 4125
 		addInlineJavaScript('
4126 4126
 	var user_menus = new smc_PopupMenu();
4127 4127
 	user_menus.add("profile", "' . $scripturl . '?action=profile;area=popup");
4128
-	user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u='. $context['user']['id'] .'");', true);
4128
+	user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u=' . $context['user']['id'] . '");', true);
4129 4129
 		if ($context['allow_pm'])
4130 4130
 			addInlineJavaScript('
4131 4131
 	user_menus.add("pm", "' . $scripturl . '?action=pm;sa=popup");', true);
@@ -4761,7 +4761,7 @@  discard block
 block discarded – undo
4761 4761
 		// No? try a fallback to $sourcedir
4762 4762
 		else
4763 4763
 		{
4764
-			$absPath = $sourcedir .'/'. $file;
4764
+			$absPath = $sourcedir . '/' . $file;
4765 4765
 
4766 4766
 			if (file_exists($absPath))
4767 4767
 				require_once($absPath);
@@ -4842,15 +4842,15 @@  discard block
 block discarded – undo
4842 4842
 
4843 4843
 	// UTF-8 occurences of MS special characters
4844 4844
 	$findchars_utf8 = array(
4845
-		"\xe2\x80\x9a",	// single low-9 quotation mark
4846
-		"\xe2\x80\x9e",	// double low-9 quotation mark
4847
-		"\xe2\x80\xa6",	// horizontal ellipsis
4848
-		"\xe2\x80\x98",	// left single curly quote
4849
-		"\xe2\x80\x99",	// right single curly quote
4850
-		"\xe2\x80\x9c",	// left double curly quote
4851
-		"\xe2\x80\x9d",	// right double curly quote
4852
-		"\xe2\x80\x93",	// en dash
4853
-		"\xe2\x80\x94",	// em dash
4845
+		"\xe2\x80\x9a", // single low-9 quotation mark
4846
+		"\xe2\x80\x9e", // double low-9 quotation mark
4847
+		"\xe2\x80\xa6", // horizontal ellipsis
4848
+		"\xe2\x80\x98", // left single curly quote
4849
+		"\xe2\x80\x99", // right single curly quote
4850
+		"\xe2\x80\x9c", // left double curly quote
4851
+		"\xe2\x80\x9d", // right double curly quote
4852
+		"\xe2\x80\x93", // en dash
4853
+		"\xe2\x80\x94", // em dash
4854 4854
 	);
4855 4855
 
4856 4856
 	// windows 1252 / iso equivalents
@@ -4868,15 +4868,15 @@  discard block
 block discarded – undo
4868 4868
 
4869 4869
 	// safe replacements
4870 4870
 	$replacechars = array(
4871
-		',',	// &sbquo;
4872
-		',,',	// &bdquo;
4873
-		'...',	// &hellip;
4874
-		"'",	// &lsquo;
4875
-		"'",	// &rsquo;
4876
-		'"',	// &ldquo;
4877
-		'"',	// &rdquo;
4878
-		'-',	// &ndash;
4879
-		'--',	// &mdash;
4871
+		',', // &sbquo;
4872
+		',,', // &bdquo;
4873
+		'...', // &hellip;
4874
+		"'", // &lsquo;
4875
+		"'", // &rsquo;
4876
+		'"', // &ldquo;
4877
+		'"', // &rdquo;
4878
+		'-', // &ndash;
4879
+		'--', // &mdash;
4880 4880
 	);
4881 4881
 
4882 4882
 	if ($context['utf8'])
@@ -5294,7 +5294,7 @@  discard block
 block discarded – undo
5294 5294
  */
5295 5295
 function inet_dtop($bin)
5296 5296
 {
5297
-	if(empty($bin))
5297
+	if (empty($bin))
5298 5298
 		return '';
5299 5299
 
5300 5300
 	global $db_type;
@@ -5325,28 +5325,28 @@  discard block
 block discarded – undo
5325 5325
  */
5326 5326
 function _safe_serialize($value)
5327 5327
 {
5328
-	if(is_null($value))
5328
+	if (is_null($value))
5329 5329
 		return 'N;';
5330 5330
 
5331
-	if(is_bool($value))
5332
-		return 'b:'. (int) $value .';';
5331
+	if (is_bool($value))
5332
+		return 'b:' . (int) $value . ';';
5333 5333
 
5334
-	if(is_int($value))
5335
-		return 'i:'. $value .';';
5334
+	if (is_int($value))
5335
+		return 'i:' . $value . ';';
5336 5336
 
5337
-	if(is_float($value))
5338
-		return 'd:'. str_replace(',', '.', $value) .';';
5337
+	if (is_float($value))
5338
+		return 'd:' . str_replace(',', '.', $value) . ';';
5339 5339
 
5340
-	if(is_string($value))
5341
-		return 's:'. strlen($value) .':"'. $value .'";';
5340
+	if (is_string($value))
5341
+		return 's:' . strlen($value) . ':"' . $value . '";';
5342 5342
 
5343
-	if(is_array($value))
5343
+	if (is_array($value))
5344 5344
 	{
5345 5345
 		$out = '';
5346
-		foreach($value as $k => $v)
5346
+		foreach ($value as $k => $v)
5347 5347
 			$out .= _safe_serialize($k) . _safe_serialize($v);
5348 5348
 
5349
-		return 'a:'. count($value) .':{'. $out .'}';
5349
+		return 'a:' . count($value) . ':{' . $out . '}';
5350 5350
 	}
5351 5351
 
5352 5352
 	// safe_serialize cannot serialize resources or objects.
@@ -5388,7 +5388,7 @@  discard block
 block discarded – undo
5388 5388
 function _safe_unserialize($str)
5389 5389
 {
5390 5390
 	// Input  is not a string.
5391
-	if(empty($str) || !is_string($str))
5391
+	if (empty($str) || !is_string($str))
5392 5392
 		return false;
5393 5393
 
5394 5394
 	$stack = array();
@@ -5402,40 +5402,40 @@  discard block
 block discarded – undo
5402 5402
 	 *   3 - in array, expecting value or another array
5403 5403
 	 */
5404 5404
 	$state = 0;
5405
-	while($state != 1)
5405
+	while ($state != 1)
5406 5406
 	{
5407 5407
 		$type = isset($str[0]) ? $str[0] : '';
5408
-		if($type == '}')
5408
+		if ($type == '}')
5409 5409
 			$str = substr($str, 1);
5410 5410
 
5411
-		else if($type == 'N' && $str[1] == ';')
5411
+		else if ($type == 'N' && $str[1] == ';')
5412 5412
 		{
5413 5413
 			$value = null;
5414 5414
 			$str = substr($str, 2);
5415 5415
 		}
5416
-		else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
5416
+		else if ($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
5417 5417
 		{
5418 5418
 			$value = $matches[1] == '1' ? true : false;
5419 5419
 			$str = substr($str, 4);
5420 5420
 		}
5421
-		else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
5421
+		else if ($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
5422 5422
 		{
5423
-			$value = (int)$matches[1];
5423
+			$value = (int) $matches[1];
5424 5424
 			$str = $matches[2];
5425 5425
 		}
5426
-		else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
5426
+		else if ($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
5427 5427
 		{
5428
-			$value = (float)$matches[1];
5428
+			$value = (float) $matches[1];
5429 5429
 			$str = $matches[3];
5430 5430
 		}
5431
-		else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";')
5431
+		else if ($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int) $matches[1], 2) == '";')
5432 5432
 		{
5433
-			$value = substr($matches[2], 0, (int)$matches[1]);
5434
-			$str = substr($matches[2], (int)$matches[1] + 2);
5433
+			$value = substr($matches[2], 0, (int) $matches[1]);
5434
+			$str = substr($matches[2], (int) $matches[1] + 2);
5435 5435
 		}
5436
-		else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches))
5436
+		else if ($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches))
5437 5437
 		{
5438
-			$expectedLength = (int)$matches[1];
5438
+			$expectedLength = (int) $matches[1];
5439 5439
 			$str = $matches[2];
5440 5440
 		}
5441 5441
 
@@ -5443,10 +5443,10 @@  discard block
 block discarded – undo
5443 5443
 		else
5444 5444
 			return false;
5445 5445
 
5446
-		switch($state)
5446
+		switch ($state)
5447 5447
 		{
5448 5448
 			case 3: // In array, expecting value or another array.
5449
-				if($type == 'a')
5449
+				if ($type == 'a')
5450 5450
 				{
5451 5451
 					$stack[] = &$list;
5452 5452
 					$list[$key] = array();
@@ -5455,7 +5455,7 @@  discard block
 block discarded – undo
5455 5455
 					$state = 2;
5456 5456
 					break;
5457 5457
 				}
5458
-				if($type != '}')
5458
+				if ($type != '}')
5459 5459
 				{
5460 5460
 					$list[$key] = $value;
5461 5461
 					$state = 2;
@@ -5466,29 +5466,29 @@  discard block
 block discarded – undo
5466 5466
 				return false;
5467 5467
 
5468 5468
 			case 2: // in array, expecting end of array or a key
5469
-				if($type == '}')
5469
+				if ($type == '}')
5470 5470
 				{
5471 5471
 					// Array size is less than expected.
5472
-					if(count($list) < end($expected))
5472
+					if (count($list) < end($expected))
5473 5473
 						return false;
5474 5474
 
5475 5475
 					unset($list);
5476
-					$list = &$stack[count($stack)-1];
5476
+					$list = &$stack[count($stack) - 1];
5477 5477
 					array_pop($stack);
5478 5478
 
5479 5479
 					// Go to terminal state if we're at the end of the root array.
5480 5480
 					array_pop($expected);
5481 5481
 
5482
-					if(count($expected) == 0)
5482
+					if (count($expected) == 0)
5483 5483
 						$state = 1;
5484 5484
 
5485 5485
 					break;
5486 5486
 				}
5487 5487
 
5488
-				if($type == 'i' || $type == 's')
5488
+				if ($type == 'i' || $type == 's')
5489 5489
 				{
5490 5490
 					// Array size exceeds expected length.
5491
-					if(count($list) >= end($expected))
5491
+					if (count($list) >= end($expected))
5492 5492
 						return false;
5493 5493
 
5494 5494
 					$key = $value;
@@ -5501,7 +5501,7 @@  discard block
 block discarded – undo
5501 5501
 
5502 5502
 			// Expecting array or value.
5503 5503
 			case 0:
5504
-				if($type == 'a')
5504
+				if ($type == 'a')
5505 5505
 				{
5506 5506
 					$data = array();
5507 5507
 					$list = &$data;
@@ -5510,7 +5510,7 @@  discard block
 block discarded – undo
5510 5510
 					break;
5511 5511
 				}
5512 5512
 
5513
-				if($type != '}')
5513
+				if ($type != '}')
5514 5514
 				{
5515 5515
 					$data = $value;
5516 5516
 					$state = 1;
@@ -5523,7 +5523,7 @@  discard block
 block discarded – undo
5523 5523
 	}
5524 5524
 
5525 5525
 	// Trailing data in input.
5526
-	if(!empty($str))
5526
+	if (!empty($str))
5527 5527
 		return false;
5528 5528
 
5529 5529
 	return $data;
@@ -5577,7 +5577,7 @@  discard block
 block discarded – undo
5577 5577
 	// Set different modes.
5578 5578
 	$chmodValues = $isDir ? array(0750, 0755, 0775, 0777) : array(0644, 0664, 0666);
5579 5579
 
5580
-	foreach($chmodValues as $val)
5580
+	foreach ($chmodValues as $val)
5581 5581
 	{
5582 5582
 		// If it's writable, break out of the loop.
5583 5583
 		if (is_writable($file))
@@ -5612,13 +5612,13 @@  discard block
 block discarded – undo
5612 5612
 	$returnArray = @json_decode($json, $returnAsArray);
5613 5613
 
5614 5614
 	// PHP 5.3 so no json_last_error_msg()
5615
-	switch(json_last_error())
5615
+	switch (json_last_error())
5616 5616
 	{
5617 5617
 		case JSON_ERROR_NONE:
5618 5618
 			$jsonError = false;
5619 5619
 			break;
5620 5620
 		case JSON_ERROR_DEPTH:
5621
-			$jsonError =  'JSON_ERROR_DEPTH';
5621
+			$jsonError = 'JSON_ERROR_DEPTH';
5622 5622
 			break;
5623 5623
 		case JSON_ERROR_STATE_MISMATCH:
5624 5624
 			$jsonError = 'JSON_ERROR_STATE_MISMATCH';
@@ -5646,10 +5646,10 @@  discard block
 block discarded – undo
5646 5646
 		loadLanguage('Errors');
5647 5647
 
5648 5648
 		if (!empty($jsonDebug))
5649
-			log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']);
5649
+			log_error($txt['json_' . $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']);
5650 5650
 
5651 5651
 		else
5652
-			log_error($txt['json_'. $jsonError], 'critical');
5652
+			log_error($txt['json_' . $jsonError], 'critical');
5653 5653
 
5654 5654
 		// Everyone expects an array.
5655 5655
 		return array();
@@ -5761,7 +5761,7 @@  discard block
 block discarded – undo
5761 5761
 		});
5762 5762
 
5763 5763
 		// Convert Punycode to Unicode
5764
-		$tlds = array_map(function ($input) {
5764
+		$tlds = array_map(function($input) {
5765 5765
 			$prefix = 'xn--';
5766 5766
 			$safe_char = 0xFFFC;
5767 5767
 			$base = 36;
@@ -5777,7 +5777,7 @@  discard block
 block discarded – undo
5777 5777
 
5778 5778
 			foreach ($enco_parts as $encoded)
5779 5779
 			{
5780
-				if (strpos($encoded,$prefix) !== 0 || strlen(trim(str_replace($prefix,'',$encoded))) == 0)
5780
+				if (strpos($encoded, $prefix) !== 0 || strlen(trim(str_replace($prefix, '', $encoded))) == 0)
5781 5781
 				{
5782 5782
 					$output_parts[] = $encoded;
5783 5783
 					continue;
@@ -5788,7 +5788,7 @@  discard block
 block discarded – undo
5788 5788
 				$idx = 0;
5789 5789
 				$char = 0x80;
5790 5790
 				$decoded = array();
5791
-				$output='';
5791
+				$output = '';
5792 5792
 				$delim_pos = strrpos($encoded, '-');
5793 5793
 
5794 5794
 				if ($delim_pos > strlen($prefix))
@@ -5804,7 +5804,7 @@  discard block
 block discarded – undo
5804 5804
 
5805 5805
 				for ($enco_idx = $delim_pos ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len)
5806 5806
 				{
5807
-					for ($old_idx = $idx, $w = 1, $k = $base; 1 ; $k += $base)
5807
+					for ($old_idx = $idx, $w = 1, $k = $base; 1; $k += $base)
5808 5808
 					{
5809 5809
 						$cp = ord($encoded{$enco_idx++});
5810 5810
 						$digit = ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $base));
@@ -5845,15 +5845,15 @@  discard block
 block discarded – undo
5845 5845
 
5846 5846
 					// 2 bytes
5847 5847
 					elseif ($v < (1 << 11))
5848
-						$output .= chr(192+($v >> 6)) . chr(128+($v & 63));
5848
+						$output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63));
5849 5849
 
5850 5850
 					// 3 bytes
5851 5851
 					elseif ($v < (1 << 16))
5852
-						$output .= chr(224+($v >> 12)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63));
5852
+						$output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63));
5853 5853
 
5854 5854
 					// 4 bytes
5855 5855
 					elseif ($v < (1 << 21))
5856
-						$output .= chr(240+($v >> 18)) . chr(128+(($v >> 12) & 63)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63));
5856
+						$output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63));
5857 5857
 
5858 5858
 					//  'Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k
5859 5859
 					else
@@ -5958,7 +5958,7 @@  discard block
 block discarded – undo
5958 5958
 	}
5959 5959
 
5960 5960
 	// This recursive function creates the index array from the strings
5961
-	$add_string_to_index = function ($string, $index) use (&$strlen, &$substr, &$add_string_to_index)
5961
+	$add_string_to_index = function($string, $index) use (&$strlen, &$substr, &$add_string_to_index)
5962 5962
 	{
5963 5963
 		static $depth = 0;
5964 5964
 		$depth++;
@@ -5985,7 +5985,7 @@  discard block
 block discarded – undo
5985 5985
 	};
5986 5986
 
5987 5987
 	// This recursive function turns the index array into a regular expression
5988
-	$index_to_regex = function (&$index, $delim) use (&$strlen, &$index_to_regex)
5988
+	$index_to_regex = function(&$index, $delim) use (&$strlen, &$index_to_regex)
5989 5989
 	{
5990 5990
 		static $depth = 0;
5991 5991
 		$depth++;
@@ -6009,11 +6009,11 @@  discard block
 block discarded – undo
6009 6009
 
6010 6010
 				if (count(array_keys($value)) == 1)
6011 6011
 				{
6012
-					$new_key_array = explode('(?'.'>', $sub_regex);
6012
+					$new_key_array = explode('(?' . '>', $sub_regex);
6013 6013
 					$new_key .= $new_key_array[0];
6014 6014
 				}
6015 6015
 				else
6016
-					$sub_regex = '(?'.'>' . $sub_regex . ')';
6016
+					$sub_regex = '(?' . '>' . $sub_regex . ')';
6017 6017
 			}
6018 6018
 
6019 6019
 			if ($depth > 1)
@@ -6056,10 +6056,10 @@  discard block
 block discarded – undo
6056 6056
 	{
6057 6057
 		$regex = array();
6058 6058
 		while (!empty($index))
6059
-			$regex[] = '(?'.'>' . $index_to_regex($index, $delim) . ')';
6059
+			$regex[] = '(?' . '>' . $index_to_regex($index, $delim) . ')';
6060 6060
 	}
6061 6061
 	else
6062
-		$regex = '(?'.'>' . $index_to_regex($index, $delim) . ')';
6062
+		$regex = '(?' . '>' . $index_to_regex($index, $delim) . ')';
6063 6063
 
6064 6064
 	// Restore PHP's internal character encoding to whatever it was originally
6065 6065
 	if (!empty($current_encoding))
Please login to merge, or discard this patch.