Code Duplication    Length = 7-10 lines in 3 locations

Sources/Load.php 1 location

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

other/install.php 2 locations

@@ 1343-1349 (lines=7) @@
1340
	require_once($sourcedir . '/Subs.php');
1341
1342
	// We need this to properly hash the password for Admin
1343
	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' : function($string) {
1344
			global $sourcedir;
1345
			if (function_exists('mb_strtolower'))
1346
				return mb_strtolower($string, 'UTF-8');
1347
			require_once($sourcedir . '/Subs-Charset.php');
1348
			return utf8_strtolower($string);
1349
		};
1350
1351
	if (!isset($_POST['username']))
1352
		$_POST['username'] = '';
@@ 1599-1605 (lines=7) @@
1596
1597
	// This function is needed to do the updateStats('subject') call.
1598
	$smcFunc['strtolower'] = $db_character_set != 'utf8' && $txt['lang_character_set'] != 'UTF-8' ? 'strtolower' :
1599
		function($string){
1600
			global $sourcedir;
1601
			if (function_exists('mb_strtolower'))
1602
				return mb_strtolower($string, 'UTF-8');
1603
			require_once($sourcedir . '/Subs-Charset.php');
1604
			return utf8_strtolower($string);
1605
		};
1606
1607
	$request = $smcFunc['db_query']('', '
1608
		SELECT id_msg