Completed
Push — release-2.1 ( 08aa48...ab4516 )
by Mathias
06:51
created
Sources/Subs.php 1 patch
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
 					'height' => array('optional' => true, 'match' => '(\d+)'),
1098 1098
 				),
1099 1099
 				'content' => '$1',
1100
-				'validate' => function (&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt)
1100
+				'validate' => function(&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt)
1101 1101
 				{
1102 1102
 					$returnContext = '';
1103 1103
 
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
 						}
1133 1133
 
1134 1134
 						if ($currentAttachment['thumbnail']['has_thumb'] && empty($params['{width}']) && empty($params['{height}']))
1135
-							$returnContext .= '<a href="'. $currentAttachment['href']. ';image" id="link_'. $currentAttachment['id']. '" onclick="'. $currentAttachment['thumbnail']['javascript']. '"><img src="'. $currentAttachment['thumbnail']['href']. '" alt="' . $currentAttachment['name'] . '" id="thumb_'. $currentAttachment['id']. '"></a>';
1135
+							$returnContext .= '<a href="' . $currentAttachment['href'] . ';image" id="link_' . $currentAttachment['id'] . '" onclick="' . $currentAttachment['thumbnail']['javascript'] . '"><img src="' . $currentAttachment['thumbnail']['href'] . '" alt="' . $currentAttachment['name'] . '" id="thumb_' . $currentAttachment['id'] . '"></a>';
1136 1136
 						else
1137 1137
 							$returnContext .= '<img src="' . $currentAttachment['href'] . ';image" alt="' . $currentAttachment['name'] . '"' . $width . $height . '/>';
1138 1138
 					}
@@ -1161,7 +1161,7 @@  discard block
 block discarded – undo
1161 1161
 				'type' => 'unparsed_content',
1162 1162
 				'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>',
1163 1163
 				// @todo Maybe this can be simplified?
1164
-				'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context)
1164
+				'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context)
1165 1165
 				{
1166 1166
 					if (!isset($disabled['code']))
1167 1167
 					{
@@ -1198,7 +1198,7 @@  discard block
 block discarded – undo
1198 1198
 				'type' => 'unparsed_equals_content',
1199 1199
 				'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>',
1200 1200
 				// @todo Maybe this can be simplified?
1201
-				'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context)
1201
+				'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context)
1202 1202
 				{
1203 1203
 					if (!isset($disabled['code']))
1204 1204
 					{
@@ -1242,7 +1242,7 @@  discard block
 block discarded – undo
1242 1242
 				'type' => 'unparsed_content',
1243 1243
 				'content' => '<a href="mailto:$1" class="bbc_email">$1</a>',
1244 1244
 				// @todo Should this respect guest_hideContacts?
1245
-				'validate' => function (&$tag, &$data, $disabled)
1245
+				'validate' => function(&$tag, &$data, $disabled)
1246 1246
 				{
1247 1247
 					$data = strtr($data, array('<br>' => ''));
1248 1248
 				},
@@ -1261,7 +1261,7 @@  discard block
 block discarded – undo
1261 1261
 				'type' => 'unparsed_commas_content',
1262 1262
 				'test' => '\d+,\d+\]',
1263 1263
 				'content' => '<embed type="application/x-shockwave-flash" src="$1" width="$2" height="$3" play="true" loop="true" quality="high" AllowScriptAccess="never">',
1264
-				'validate' => function (&$tag, &$data, $disabled)
1264
+				'validate' => function(&$tag, &$data, $disabled)
1265 1265
 				{
1266 1266
 					if (isset($disabled['url']))
1267 1267
 						$tag['content'] = '$1';
@@ -1306,7 +1306,7 @@  discard block
 block discarded – undo
1306 1306
 					'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),
1307 1307
 				),
1308 1308
 				'content' => '<img src="$1" alt="{alt}" title="{title}"{width}{height} class="bbc_img resized">',
1309
-				'validate' => function (&$tag, &$data, $disabled)
1309
+				'validate' => function(&$tag, &$data, $disabled)
1310 1310
 				{
1311 1311
 					global $image_proxy_enabled, $image_proxy_secret, $boardurl;
1312 1312
 
@@ -1329,7 +1329,7 @@  discard block
 block discarded – undo
1329 1329
 				'tag' => 'img',
1330 1330
 				'type' => 'unparsed_content',
1331 1331
 				'content' => '<img src="$1" alt="" class="bbc_img">',
1332
-				'validate' => function (&$tag, &$data, $disabled)
1332
+				'validate' => function(&$tag, &$data, $disabled)
1333 1333
 				{
1334 1334
 					global $image_proxy_enabled, $image_proxy_secret, $boardurl;
1335 1335
 
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
 				'tag' => 'iurl',
1353 1353
 				'type' => 'unparsed_content',
1354 1354
 				'content' => '<a href="$1" class="bbc_link">$1</a>',
1355
-				'validate' => function (&$tag, &$data, $disabled)
1355
+				'validate' => function(&$tag, &$data, $disabled)
1356 1356
 				{
1357 1357
 					$data = strtr($data, array('<br>' => ''));
1358 1358
 					$scheme = parse_url($data, PHP_URL_SCHEME);
@@ -1366,7 +1366,7 @@  discard block
 block discarded – undo
1366 1366
 				'quoted' => 'optional',
1367 1367
 				'before' => '<a href="$1" class="bbc_link">',
1368 1368
 				'after' => '</a>',
1369
-				'validate' => function (&$tag, &$data, $disabled)
1369
+				'validate' => function(&$tag, &$data, $disabled)
1370 1370
 				{
1371 1371
 					if (substr($data, 0, 1) == '#')
1372 1372
 						$data = '#post_' . substr($data, 1);
@@ -1446,7 +1446,7 @@  discard block
 block discarded – undo
1446 1446
 				'tag' => 'php',
1447 1447
 				'type' => 'unparsed_content',
1448 1448
 				'content' => '<span class="phpcode">$1</span>',
1449
-				'validate' => isset($disabled['php']) ? null : function (&$tag, &$data, $disabled)
1449
+				'validate' => isset($disabled['php']) ? null : function(&$tag, &$data, $disabled)
1450 1450
 				{
1451 1451
 					if (!isset($disabled['php']))
1452 1452
 					{
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
 				'test' => '[1-7]\]',
1545 1545
 				'before' => '<span style="font-size: $1;" class="bbc_size">',
1546 1546
 				'after' => '</span>',
1547
-				'validate' => function (&$tag, &$data, $disabled)
1547
+				'validate' => function(&$tag, &$data, $disabled)
1548 1548
 				{
1549 1549
 					$sizes = array(1 => 0.7, 2 => 1.0, 3 => 1.35, 4 => 1.45, 5 => 2.0, 6 => 2.65, 7 => 3.95);
1550 1550
 					$data = $sizes[$data] . 'em';
@@ -1582,7 +1582,7 @@  discard block
 block discarded – undo
1582 1582
 				'tag' => 'time',
1583 1583
 				'type' => 'unparsed_content',
1584 1584
 				'content' => '$1',
1585
-				'validate' => function (&$tag, &$data, $disabled)
1585
+				'validate' => function(&$tag, &$data, $disabled)
1586 1586
 				{
1587 1587
 					if (is_numeric($data))
1588 1588
 						$data = timeformat($data);
@@ -1610,7 +1610,7 @@  discard block
 block discarded – undo
1610 1610
 				'tag' => 'url',
1611 1611
 				'type' => 'unparsed_content',
1612 1612
 				'content' => '<a href="$1" class="bbc_link" target="_blank">$1</a>',
1613
-				'validate' => function (&$tag, &$data, $disabled)
1613
+				'validate' => function(&$tag, &$data, $disabled)
1614 1614
 				{
1615 1615
 					$data = strtr($data, array('<br>' => ''));
1616 1616
 					$scheme = parse_url($data, PHP_URL_SCHEME);
@@ -1624,7 +1624,7 @@  discard block
 block discarded – undo
1624 1624
 				'quoted' => 'optional',
1625 1625
 				'before' => '<a href="$1" class="bbc_link" target="_blank">',
1626 1626
 				'after' => '</a>',
1627
-				'validate' => function (&$tag, &$data, $disabled)
1627
+				'validate' => function(&$tag, &$data, $disabled)
1628 1628
 				{
1629 1629
 					$scheme = parse_url($data, PHP_URL_SCHEME);
1630 1630
 					if (empty($scheme))
@@ -1650,7 +1650,7 @@  discard block
 block discarded – undo
1650 1650
 		{
1651 1651
 			if (isset($temp_bbc))
1652 1652
 				$bbc_codes = $temp_bbc;
1653
-			usort($codes, function ($a, $b) {
1653
+			usort($codes, function($a, $b) {
1654 1654
 				return strcmp($a['tag'], $b['tag']);
1655 1655
 			});
1656 1656
 			return $codes;
@@ -1890,7 +1890,7 @@  discard block
 block discarded – undo
1890 1890
 										# a run of Unicode domain name characters and a dot
1891 1891
 										[\p{L}\p{M}\p{N}\-.:@]+\.
1892 1892
 										# and then a TLD valid in the DNS or the reserved "local" TLD
1893
-										(?:'. $modSettings['tld_regex'] .'|local)
1893
+										(?:'. $modSettings['tld_regex'] . '|local)
1894 1894
 									)
1895 1895
 									# followed by a non-domain character or end of line
1896 1896
 									(?=[^\p{L}\p{N}\-.]|$)
@@ -1958,7 +1958,7 @@  discard block
 block discarded – undo
1958 1958
 						)?
1959 1959
 						';
1960 1960
 
1961
-						$data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) {
1961
+						$data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function($matches) {
1962 1962
 							$url = array_shift($matches);
1963 1963
 
1964 1964
 							$scheme = parse_url($url, PHP_URL_SCHEME);
@@ -2687,7 +2687,7 @@  discard block
 block discarded – undo
2687 2687
 		for ($i = 0, $n = count($smileysfrom); $i < $n; $i++)
2688 2688
 		{
2689 2689
 			$specialChars = $smcFunc['htmlspecialchars']($smileysfrom[$i], ENT_QUOTES);
2690
-			$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">';
2690
+			$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">';
2691 2691
 
2692 2692
 			$smileyPregReplacements[$smileysfrom[$i]] = $smileyCode;
2693 2693
 
@@ -2704,7 +2704,7 @@  discard block
 block discarded – undo
2704 2704
 
2705 2705
 	// Replace away!
2706 2706
 	$message = preg_replace_callback($smileyPregSearch,
2707
-		function ($matches) use ($smileyPregReplacements)
2707
+		function($matches) use ($smileyPregReplacements)
2708 2708
 		{
2709 2709
 			return $smileyPregReplacements[$matches[1]];
2710 2710
 		}, $message);
@@ -2770,13 +2770,13 @@  discard block
 block discarded – undo
2770 2770
 	{
2771 2771
 		if (defined('SID') && SID != '')
2772 2772
 			$setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&amp;))((?:board|topic)=[^#]+?)(#[^"]*?)?$~',
2773
-				function ($m) use ($scripturl)
2773
+				function($m) use ($scripturl)
2774 2774
 				{
2775
-					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID. (isset($m[2]) ? "$m[2]" : "");
2775
+					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID . (isset($m[2]) ? "$m[2]" : "");
2776 2776
 				}, $setLocation);
2777 2777
 		else
2778 2778
 			$setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~',
2779
-				function ($m) use ($scripturl)
2779
+				function($m) use ($scripturl)
2780 2780
 				{
2781 2781
 					return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? "$m[2]" : "");
2782 2782
 				}, $setLocation);
@@ -3099,7 +3099,7 @@  discard block
 block discarded – undo
3099 3099
 
3100 3100
 	// Add a generic "Are you sure?" confirmation message.
3101 3101
 	addInlineJavaScript('
3102
-	var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) .';');
3102
+	var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) . ';');
3103 3103
 
3104 3104
 	// Now add the capping code for avatars.
3105 3105
 	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')
@@ -3463,7 +3463,7 @@  discard block
 block discarded – undo
3463 3463
 
3464 3464
 		else
3465 3465
 			echo '
3466
-	<script src="', $settings['theme_url'] ,'/scripts/minified', ($do_deferred ? '_deferred' : '') ,'.js', $minSeed ,'"></script>';
3466
+	<script src="', $settings['theme_url'], '/scripts/minified', ($do_deferred ? '_deferred' : ''), '.js', $minSeed, '"></script>';
3467 3467
 	}
3468 3468
 
3469 3469
 	// Inline JavaScript - Actually useful some times!
@@ -3541,14 +3541,14 @@  discard block
 block discarded – undo
3541 3541
 
3542 3542
 		else
3543 3543
 			echo '
3544
-	<link rel="stylesheet" href="', $settings['theme_url'] ,'/css/minified.css', $minSeed ,'">';
3544
+	<link rel="stylesheet" href="', $settings['theme_url'], '/css/minified.css', $minSeed, '">';
3545 3545
 	}
3546 3546
 
3547 3547
 	// Print the rest after the minified files.
3548 3548
 	if (!empty($normal))
3549 3549
 		foreach ($normal as $nf)
3550 3550
 			echo '
3551
-	<link rel="stylesheet" href="', $nf ,'">';
3551
+	<link rel="stylesheet" href="', $nf, '">';
3552 3552
 
3553 3553
 	if ($db_show_debug === true)
3554 3554
 	{
@@ -3564,7 +3564,7 @@  discard block
 block discarded – undo
3564 3564
 	<style>';
3565 3565
 
3566 3566
 		foreach ($context['css_header'] as $css)
3567
-			echo $css .'
3567
+			echo $css . '
3568 3568
 	';
3569 3569
 
3570 3570
 		echo'
@@ -3594,7 +3594,7 @@  discard block
 block discarded – undo
3594 3594
 		return false;
3595 3595
 
3596 3596
 	// Did we already did this?
3597
-	$toCache = cache_get_data('minimized_'. $settings['theme_id'] .'_'. $type, 86400);
3597
+	$toCache = cache_get_data('minimized_' . $settings['theme_id'] . '_' . $type, 86400);
3598 3598
 
3599 3599
 	// Already done?
3600 3600
 	if (!empty($toCache))
@@ -3602,25 +3602,25 @@  discard block
 block discarded – undo
3602 3602
 
3603 3603
 	// Yep, need a bunch of files.
3604 3604
 	require_once($sourcedir . '/minify/src/Minify.php');
3605
-	require_once($sourcedir . '/minify/src/'. strtoupper($type) .'.php');
3605
+	require_once($sourcedir . '/minify/src/' . strtoupper($type) . '.php');
3606 3606
 	require_once($sourcedir . '/minify/src/Exception.php');
3607 3607
 	require_once($sourcedir . '/minify/src/Converter.php');
3608 3608
 
3609 3609
 	// No namespaces, sorry!
3610
-	$classType = 'MatthiasMullie\\Minify\\'. strtoupper($type);
3610
+	$classType = 'MatthiasMullie\\Minify\\' . strtoupper($type);
3611 3611
 
3612 3612
 	// Temp path.
3613
-	$cTempPath = $settings['theme_dir'] .'/'. ($type == 'css' ? 'css' : 'scripts') .'/';
3613
+	$cTempPath = $settings['theme_dir'] . '/' . ($type == 'css' ? 'css' : 'scripts') . '/';
3614 3614
 
3615 3615
 	// What kind of file are we going to create?
3616
-	$toCreate = $cTempPath .'minified'. ($do_deferred ? '_deferred' : '') .'.'. $type;
3616
+	$toCreate = $cTempPath . 'minified' . ($do_deferred ? '_deferred' : '') . '.' . $type;
3617 3617
 
3618 3618
 	// File has to exists, if it isn't try to create it.
3619 3619
 	if ((!file_exists($toCreate) && @fopen($toCreate, 'w') === false) || !smf_chmod($toCreate))
3620 3620
 	{
3621 3621
 		loadLanguage('Errors');
3622 3622
 		log_error(sprintf($txt['file_not_created'], $toCreate), 'general');
3623
-		cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, null);
3623
+		cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, null);
3624 3624
 
3625 3625
 		// The process failed so roll back to print each individual file.
3626 3626
 		return $data;
@@ -3655,14 +3655,14 @@  discard block
 block discarded – undo
3655 3655
 	{
3656 3656
 		loadLanguage('Errors');
3657 3657
 		log_error(sprintf($txt['file_not_created'], $toCreate), 'general');
3658
-		cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, null);
3658
+		cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, null);
3659 3659
 
3660 3660
 		// The process failed so roll back to print each individual file.
3661 3661
 		return $data;
3662 3662
 	}
3663 3663
 
3664 3664
 	// And create a long lived cache entry.
3665
-	cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, $toCreate, 86400);
3665
+	cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, $toCreate, 86400);
3666 3666
 
3667 3667
 	return true;
3668 3668
 }
@@ -3719,7 +3719,7 @@  discard block
 block discarded – undo
3719 3719
 	else
3720 3720
 		$path = $modSettings['attachmentUploadDir'];
3721 3721
 
3722
-	return $path . '/' . $attachment_id . '_' . $file_hash .'.dat';
3722
+	return $path . '/' . $attachment_id . '_' . $file_hash . '.dat';
3723 3723
 }
3724 3724
 
3725 3725
 /**
@@ -3763,10 +3763,10 @@  discard block
 block discarded – undo
3763 3763
 		$valid_low = isValidIP($ip_parts[0]);
3764 3764
 		$valid_high = isValidIP($ip_parts[1]);
3765 3765
 		$count = 0;
3766
-		$mode = (preg_match('/:/',$ip_parts[0]) > 0 ? ':' : '.');
3766
+		$mode = (preg_match('/:/', $ip_parts[0]) > 0 ? ':' : '.');
3767 3767
 		$max = ($mode == ':' ? 'ffff' : '255');
3768 3768
 		$min = 0;
3769
-		if(!$valid_low)
3769
+		if (!$valid_low)
3770 3770
 		{
3771 3771
 			$ip_parts[0] = preg_replace('/\*/', '0', $ip_parts[0]);
3772 3772
 			$valid_low = isValidIP($ip_parts[0]);
@@ -3780,7 +3780,7 @@  discard block
 block discarded – undo
3780 3780
 		}
3781 3781
 
3782 3782
 		$count = 0;
3783
-		if(!$valid_high)
3783
+		if (!$valid_high)
3784 3784
 		{
3785 3785
 			$ip_parts[1] = preg_replace('/\*/', $max, $ip_parts[1]);
3786 3786
 			$valid_high = isValidIP($ip_parts[1]);
@@ -3793,7 +3793,7 @@  discard block
 block discarded – undo
3793 3793
 			}
3794 3794
 		}
3795 3795
 
3796
-		if($valid_high && $valid_low)
3796
+		if ($valid_high && $valid_low)
3797 3797
 		{
3798 3798
 			$ip_array['low'] = $ip_parts[0];
3799 3799
 			$ip_array['high'] = $ip_parts[1];
@@ -4066,7 +4066,7 @@  discard block
 block discarded – undo
4066 4066
 		addInlineJavaScript('
4067 4067
 	var user_menus = new smc_PopupMenu();
4068 4068
 	user_menus.add("profile", "' . $scripturl . '?action=profile;area=popup");
4069
-	user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u='. $context['user']['id'] .'");', true);
4069
+	user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u=' . $context['user']['id'] . '");', true);
4070 4070
 		if ($context['allow_pm'])
4071 4071
 			addInlineJavaScript('
4072 4072
 	user_menus.add("pm", "' . $scripturl . '?action=pm;sa=popup");', true);
@@ -4694,7 +4694,7 @@  discard block
 block discarded – undo
4694 4694
 		// No? try a fallback to $sourcedir
4695 4695
 		else
4696 4696
 		{
4697
-			$absPath = $sourcedir .'/'. $file;
4697
+			$absPath = $sourcedir . '/' . $file;
4698 4698
 
4699 4699
 			if (file_exists($absPath))
4700 4700
 				require_once($absPath);
@@ -4775,15 +4775,15 @@  discard block
 block discarded – undo
4775 4775
 
4776 4776
 	// UTF-8 occurences of MS special characters
4777 4777
 	$findchars_utf8 = array(
4778
-		"\xe2\80\x9a",	// single low-9 quotation mark
4779
-		"\xe2\80\x9e",	// double low-9 quotation mark
4780
-		"\xe2\80\xa6",	// horizontal ellipsis
4781
-		"\xe2\x80\x98",	// left single curly quote
4782
-		"\xe2\x80\x99",	// right single curly quote
4783
-		"\xe2\x80\x9c",	// left double curly quote
4784
-		"\xe2\x80\x9d",	// right double curly quote
4785
-		"\xe2\x80\x93",	// en dash
4786
-		"\xe2\x80\x94",	// em dash
4778
+		"\xe2\80\x9a", // single low-9 quotation mark
4779
+		"\xe2\80\x9e", // double low-9 quotation mark
4780
+		"\xe2\80\xa6", // horizontal ellipsis
4781
+		"\xe2\x80\x98", // left single curly quote
4782
+		"\xe2\x80\x99", // right single curly quote
4783
+		"\xe2\x80\x9c", // left double curly quote
4784
+		"\xe2\x80\x9d", // right double curly quote
4785
+		"\xe2\x80\x93", // en dash
4786
+		"\xe2\x80\x94", // em dash
4787 4787
 	);
4788 4788
 
4789 4789
 	// windows 1252 / iso equivalents
@@ -4801,15 +4801,15 @@  discard block
 block discarded – undo
4801 4801
 
4802 4802
 	// safe replacements
4803 4803
 	$replacechars = array(
4804
-		',',	// &sbquo;
4805
-		',,',	// &bdquo;
4806
-		'...',	// &hellip;
4807
-		"'",	// &lsquo;
4808
-		"'",	// &rsquo;
4809
-		'"',	// &ldquo;
4810
-		'"',	// &rdquo;
4811
-		'-',	// &ndash;
4812
-		'--',	// &mdash;
4804
+		',', // &sbquo;
4805
+		',,', // &bdquo;
4806
+		'...', // &hellip;
4807
+		"'", // &lsquo;
4808
+		"'", // &rsquo;
4809
+		'"', // &ldquo;
4810
+		'"', // &rdquo;
4811
+		'-', // &ndash;
4812
+		'--', // &mdash;
4813 4813
 	);
4814 4814
 
4815 4815
 	if ($context['utf8'])
@@ -5095,7 +5095,7 @@  discard block
 block discarded – undo
5095 5095
  */
5096 5096
 function inet_dtop($bin)
5097 5097
 {
5098
-	if(empty($bin))
5098
+	if (empty($bin))
5099 5099
 		return '';
5100 5100
 
5101 5101
 	global $db_type;
@@ -5126,28 +5126,28 @@  discard block
 block discarded – undo
5126 5126
  */
5127 5127
 function _safe_serialize($value)
5128 5128
 {
5129
-	if(is_null($value))
5129
+	if (is_null($value))
5130 5130
 		return 'N;';
5131 5131
 
5132
-	if(is_bool($value))
5133
-		return 'b:'. (int) $value .';';
5132
+	if (is_bool($value))
5133
+		return 'b:' . (int) $value . ';';
5134 5134
 
5135
-	if(is_int($value))
5136
-		return 'i:'. $value .';';
5135
+	if (is_int($value))
5136
+		return 'i:' . $value . ';';
5137 5137
 
5138
-	if(is_float($value))
5139
-		return 'd:'. str_replace(',', '.', $value) .';';
5138
+	if (is_float($value))
5139
+		return 'd:' . str_replace(',', '.', $value) . ';';
5140 5140
 
5141
-	if(is_string($value))
5142
-		return 's:'. strlen($value) .':"'. $value .'";';
5141
+	if (is_string($value))
5142
+		return 's:' . strlen($value) . ':"' . $value . '";';
5143 5143
 
5144
-	if(is_array($value))
5144
+	if (is_array($value))
5145 5145
 	{
5146 5146
 		$out = '';
5147
-		foreach($value as $k => $v)
5147
+		foreach ($value as $k => $v)
5148 5148
 			$out .= _safe_serialize($k) . _safe_serialize($v);
5149 5149
 
5150
-		return 'a:'. count($value) .':{'. $out .'}';
5150
+		return 'a:' . count($value) . ':{' . $out . '}';
5151 5151
 	}
5152 5152
 
5153 5153
 	// safe_serialize cannot serialize resources or objects.
@@ -5189,7 +5189,7 @@  discard block
 block discarded – undo
5189 5189
 function _safe_unserialize($str)
5190 5190
 {
5191 5191
 	// Input  is not a string.
5192
-	if(empty($str) || !is_string($str))
5192
+	if (empty($str) || !is_string($str))
5193 5193
 		return false;
5194 5194
 
5195 5195
 	$stack = array();
@@ -5203,40 +5203,40 @@  discard block
 block discarded – undo
5203 5203
 	 *   3 - in array, expecting value or another array
5204 5204
 	 */
5205 5205
 	$state = 0;
5206
-	while($state != 1)
5206
+	while ($state != 1)
5207 5207
 	{
5208 5208
 		$type = isset($str[0]) ? $str[0] : '';
5209
-		if($type == '}')
5209
+		if ($type == '}')
5210 5210
 			$str = substr($str, 1);
5211 5211
 
5212
-		else if($type == 'N' && $str[1] == ';')
5212
+		else if ($type == 'N' && $str[1] == ';')
5213 5213
 		{
5214 5214
 			$value = null;
5215 5215
 			$str = substr($str, 2);
5216 5216
 		}
5217
-		else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
5217
+		else if ($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
5218 5218
 		{
5219 5219
 			$value = $matches[1] == '1' ? true : false;
5220 5220
 			$str = substr($str, 4);
5221 5221
 		}
5222
-		else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
5222
+		else if ($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
5223 5223
 		{
5224
-			$value = (int)$matches[1];
5224
+			$value = (int) $matches[1];
5225 5225
 			$str = $matches[2];
5226 5226
 		}
5227
-		else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
5227
+		else if ($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
5228 5228
 		{
5229
-			$value = (float)$matches[1];
5229
+			$value = (float) $matches[1];
5230 5230
 			$str = $matches[3];
5231 5231
 		}
5232
-		else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";')
5232
+		else if ($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int) $matches[1], 2) == '";')
5233 5233
 		{
5234
-			$value = substr($matches[2], 0, (int)$matches[1]);
5235
-			$str = substr($matches[2], (int)$matches[1] + 2);
5234
+			$value = substr($matches[2], 0, (int) $matches[1]);
5235
+			$str = substr($matches[2], (int) $matches[1] + 2);
5236 5236
 		}
5237
-		else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches))
5237
+		else if ($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches))
5238 5238
 		{
5239
-			$expectedLength = (int)$matches[1];
5239
+			$expectedLength = (int) $matches[1];
5240 5240
 			$str = $matches[2];
5241 5241
 		}
5242 5242
 
@@ -5244,10 +5244,10 @@  discard block
 block discarded – undo
5244 5244
 		else
5245 5245
 			return false;
5246 5246
 
5247
-		switch($state)
5247
+		switch ($state)
5248 5248
 		{
5249 5249
 			case 3: // In array, expecting value or another array.
5250
-				if($type == 'a')
5250
+				if ($type == 'a')
5251 5251
 				{
5252 5252
 					$stack[] = &$list;
5253 5253
 					$list[$key] = array();
@@ -5256,7 +5256,7 @@  discard block
 block discarded – undo
5256 5256
 					$state = 2;
5257 5257
 					break;
5258 5258
 				}
5259
-				if($type != '}')
5259
+				if ($type != '}')
5260 5260
 				{
5261 5261
 					$list[$key] = $value;
5262 5262
 					$state = 2;
@@ -5267,29 +5267,29 @@  discard block
 block discarded – undo
5267 5267
 				return false;
5268 5268
 
5269 5269
 			case 2: // in array, expecting end of array or a key
5270
-				if($type == '}')
5270
+				if ($type == '}')
5271 5271
 				{
5272 5272
 					// Array size is less than expected.
5273
-					if(count($list) < end($expected))
5273
+					if (count($list) < end($expected))
5274 5274
 						return false;
5275 5275
 
5276 5276
 					unset($list);
5277
-					$list = &$stack[count($stack)-1];
5277
+					$list = &$stack[count($stack) - 1];
5278 5278
 					array_pop($stack);
5279 5279
 
5280 5280
 					// Go to terminal state if we're at the end of the root array.
5281 5281
 					array_pop($expected);
5282 5282
 
5283
-					if(count($expected) == 0)
5283
+					if (count($expected) == 0)
5284 5284
 						$state = 1;
5285 5285
 
5286 5286
 					break;
5287 5287
 				}
5288 5288
 
5289
-				if($type == 'i' || $type == 's')
5289
+				if ($type == 'i' || $type == 's')
5290 5290
 				{
5291 5291
 					// Array size exceeds expected length.
5292
-					if(count($list) >= end($expected))
5292
+					if (count($list) >= end($expected))
5293 5293
 						return false;
5294 5294
 
5295 5295
 					$key = $value;
@@ -5302,7 +5302,7 @@  discard block
 block discarded – undo
5302 5302
 
5303 5303
 			// Expecting array or value.
5304 5304
 			case 0:
5305
-				if($type == 'a')
5305
+				if ($type == 'a')
5306 5306
 				{
5307 5307
 					$data = array();
5308 5308
 					$list = &$data;
@@ -5311,7 +5311,7 @@  discard block
 block discarded – undo
5311 5311
 					break;
5312 5312
 				}
5313 5313
 
5314
-				if($type != '}')
5314
+				if ($type != '}')
5315 5315
 				{
5316 5316
 					$data = $value;
5317 5317
 					$state = 1;
@@ -5324,7 +5324,7 @@  discard block
 block discarded – undo
5324 5324
 	}
5325 5325
 
5326 5326
 	// Trailing data in input.
5327
-	if(!empty($str))
5327
+	if (!empty($str))
5328 5328
 		return false;
5329 5329
 
5330 5330
 	return $data;
@@ -5378,7 +5378,7 @@  discard block
 block discarded – undo
5378 5378
 	// Set different modes.
5379 5379
 	$chmodValues = $isDir ? array(0750, 0755, 0775, 0777) : array(0644, 0664, 0666);
5380 5380
 
5381
-	foreach($chmodValues as $val)
5381
+	foreach ($chmodValues as $val)
5382 5382
 	{
5383 5383
 		// If it's writable, break out of the loop.
5384 5384
 		if (is_writable($file))
@@ -5416,13 +5416,13 @@  discard block
 block discarded – undo
5416 5416
 	$returnArray = @json_decode($json, $returnAsArray);
5417 5417
 
5418 5418
 	// PHP 5.3 so no json_last_error_msg()
5419
-	switch(json_last_error())
5419
+	switch (json_last_error())
5420 5420
 	{
5421 5421
 		case JSON_ERROR_NONE:
5422 5422
 			$jsonError = false;
5423 5423
 			break;
5424 5424
 		case JSON_ERROR_DEPTH:
5425
-			$jsonError =  'JSON_ERROR_DEPTH';
5425
+			$jsonError = 'JSON_ERROR_DEPTH';
5426 5426
 			break;
5427 5427
 		case JSON_ERROR_STATE_MISMATCH:
5428 5428
 			$jsonError = 'JSON_ERROR_STATE_MISMATCH';
@@ -5450,10 +5450,10 @@  discard block
 block discarded – undo
5450 5450
 		loadLanguage('Errors');
5451 5451
 
5452 5452
 		if (!empty($jsonDebug))
5453
-			log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']);
5453
+			log_error($txt['json_' . $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']);
5454 5454
 
5455 5455
 		else
5456
-			log_error($txt['json_'. $jsonError], 'critical');
5456
+			log_error($txt['json_' . $jsonError], 'critical');
5457 5457
 
5458 5458
 		// Everyone expects an array.
5459 5459
 		return array();
@@ -5557,7 +5557,7 @@  discard block
 block discarded – undo
5557 5557
 		});
5558 5558
 
5559 5559
 		// Convert Punycode to Unicode
5560
-		$tlds = array_map(function ($input) {
5560
+		$tlds = array_map(function($input) {
5561 5561
 			$prefix = 'xn--';
5562 5562
 			$safe_char = 0xFFFC;
5563 5563
 			$base = 36;
@@ -5573,7 +5573,7 @@  discard block
 block discarded – undo
5573 5573
 
5574 5574
 			foreach ($enco_parts as $encoded)
5575 5575
 			{
5576
-				if (strpos($encoded,$prefix) !== 0 || strlen(trim(str_replace($prefix,'',$encoded))) == 0)
5576
+				if (strpos($encoded, $prefix) !== 0 || strlen(trim(str_replace($prefix, '', $encoded))) == 0)
5577 5577
 				{
5578 5578
 					$output_parts[] = $encoded;
5579 5579
 					continue;
@@ -5584,7 +5584,7 @@  discard block
 block discarded – undo
5584 5584
 				$idx = 0;
5585 5585
 				$char = 0x80;
5586 5586
 				$decoded = array();
5587
-				$output='';
5587
+				$output = '';
5588 5588
 				$delim_pos = strrpos($encoded, '-');
5589 5589
 
5590 5590
 				if ($delim_pos > strlen($prefix))
@@ -5600,7 +5600,7 @@  discard block
 block discarded – undo
5600 5600
 
5601 5601
 				for ($enco_idx = $delim_pos ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len)
5602 5602
 				{
5603
-					for ($old_idx = $idx, $w = 1, $k = $base; 1 ; $k += $base)
5603
+					for ($old_idx = $idx, $w = 1, $k = $base; 1; $k += $base)
5604 5604
 					{
5605 5605
 						$cp = ord($encoded{$enco_idx++});
5606 5606
 						$digit = ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $base));
@@ -5641,15 +5641,15 @@  discard block
 block discarded – undo
5641 5641
 
5642 5642
 					// 2 bytes
5643 5643
 					elseif ($v < (1 << 11))
5644
-						$output .= chr(192+($v >> 6)) . chr(128+($v & 63));
5644
+						$output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63));
5645 5645
 
5646 5646
 					// 3 bytes
5647 5647
 					elseif ($v < (1 << 16))
5648
-						$output .= chr(224+($v >> 12)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63));
5648
+						$output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63));
5649 5649
 
5650 5650
 					// 4 bytes
5651 5651
 					elseif ($v < (1 << 21))
5652
-						$output .= chr(240+($v >> 18)) . chr(128+(($v >> 12) & 63)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63));
5652
+						$output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63));
5653 5653
 
5654 5654
 					//  'Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k
5655 5655
 					else
@@ -5756,7 +5756,7 @@  discard block
 block discarded – undo
5756 5756
 	}
5757 5757
 
5758 5758
 	// This recursive function creates the index array from the strings
5759
-	$add_string_to_index = function ($string, $index) use (&$strlen, &$substr, &$add_string_to_index)
5759
+	$add_string_to_index = function($string, $index) use (&$strlen, &$substr, &$add_string_to_index)
5760 5760
 	{
5761 5761
 		static $depth = 0;
5762 5762
 		$depth++;
@@ -5783,7 +5783,7 @@  discard block
 block discarded – undo
5783 5783
 	};
5784 5784
 
5785 5785
 	// This recursive function turns the index array into a regular expression
5786
-	$index_to_regex = function (&$index, $delim) use (&$strlen, &$index_to_regex)
5786
+	$index_to_regex = function(&$index, $delim) use (&$strlen, &$index_to_regex)
5787 5787
 	{
5788 5788
 		static $depth = 0;
5789 5789
 		$depth++;
@@ -5807,11 +5807,11 @@  discard block
 block discarded – undo
5807 5807
 
5808 5808
 				if (count(array_keys($value)) == 1)
5809 5809
 				{
5810
-					$new_key_array = explode('(?'.'>', $sub_regex);
5810
+					$new_key_array = explode('(?' . '>', $sub_regex);
5811 5811
 					$new_key .= $new_key_array[0];
5812 5812
 				}
5813 5813
 				else
5814
-					$sub_regex = '(?'.'>' . $sub_regex . ')';
5814
+					$sub_regex = '(?' . '>' . $sub_regex . ')';
5815 5815
 			}
5816 5816
 
5817 5817
 			if ($depth > 1)
@@ -5851,7 +5851,7 @@  discard block
 block discarded – undo
5851 5851
 		$index = $add_string_to_index($string, $index);
5852 5852
 
5853 5853
 	while (!empty($index))
5854
-		$regexes[] = '(?'.'>' . $index_to_regex($index, $delim) . ')';
5854
+		$regexes[] = '(?' . '>' . $index_to_regex($index, $delim) . ')';
5855 5855
 
5856 5856
 	// Restore PHP's internal character encoding to whatever it was originally
5857 5857
 	if (!empty($current_encoding))
Please login to merge, or discard this patch.