Code Duplication    Length = 7-10 lines in 3 locations

Sources/Load.php 1 location

@@ 180-189 (lines=10) @@
177
			$ent_arr = preg_split('~(' . $ent_list . '|.)~' . ($utf8 ? 'u' : '') . '', $ent_check($string), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
178
			return $length === null ? implode('', array_slice($ent_arr, $start)) : implode('', array_slice($ent_arr, $start, $length));
179
		},
180
		'strtolower' => $utf8 ? function($string) use ($sourcedir)
181
		{
182
			if (!function_exists('mb_strtolower'))
183
			{
184
				require_once($sourcedir . '/Subs-Charset.php');
185
				return utf8_strtolower($string);
186
			}
187
188
			return mb_strtolower($string, 'UTF-8');
189
		} : 'strtolower',
190
		'strtoupper' => $utf8 ? function($string)
191
		{
192
			global $sourcedir;

other/install.php 2 locations

@@ 1454-1460 (lines=7) @@
1451
	reloadSettings();
1452
1453
	// We need this to properly hash the password for Admin
1454
	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) {
1455
			global $sourcedir;
1456
			if (function_exists('mb_strtolower'))
1457
				return mb_strtolower($string, 'UTF-8');
1458
			require_once($sourcedir . '/Subs-Charset.php');
1459
			return utf8_strtolower($string);
1460
		};
1461
1462
	if (!isset($_POST['username']))
1463
		$_POST['username'] = '';
@@ 1712-1718 (lines=7) @@
1709
1710
	// This function is needed to do the updateStats('subject') call.
1711
	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' :
1712
		function($string){
1713
			global $sourcedir;
1714
			if (function_exists('mb_strtolower'))
1715
				return mb_strtolower($string, 'UTF-8');
1716
			require_once($sourcedir . '/Subs-Charset.php');
1717
			return utf8_strtolower($string);
1718
		};
1719
1720
	$request = $smcFunc['db_query']('', '
1721
		SELECT id_msg