Code Duplication    Length = 15-15 lines in 3 locations

Sources/Subs-Db-mysql.php 1 location

@@ 820-834 (lines=15) @@
817
 * @param bool $translate_human_wildcards If true, turns human readable wildcards into SQL wildcards.
818
 * @return string The escaped string
819
 */
820
function smf_db_escape_wildcard_string($string, $translate_human_wildcards=false)
821
{
822
	$replacements = array(
823
		'%' => '\%',
824
		'_' => '\_',
825
		'\\' => '\\\\',
826
	);
827
828
	if ($translate_human_wildcards)
829
		$replacements += array(
830
			'*' => '%',
831
		);
832
833
	return strtr($string, $replacements);
834
}
835
836
?>

Sources/Subs-Db-mysqli.php 1 location

@@ 878-892 (lines=15) @@
875
 * @param bool $translate_human_wildcards If true, turns human readable wildcards into SQL wildcards.
876
 * @return string The escaped string
877
 */
878
function smf_db_escape_wildcard_string($string, $translate_human_wildcards=false)
879
{
880
	$replacements = array(
881
		'%' => '\%',
882
		'_' => '\_',
883
		'\\' => '\\\\',
884
	);
885
886
	if ($translate_human_wildcards)
887
		$replacements += array(
888
			'*' => '%',
889
		);
890
891
	return strtr($string, $replacements);
892
}
893
894
/**
895
 * Validates whether the resource is a valid mysqli instance.

Sources/Subs-Db-postgresql.php 1 location

@@ 886-900 (lines=15) @@
883
 * @param bool $translate_human_wildcards If true, turns human readable wildcards into SQL wildcards.
884
 * @return string The escaped string
885
 */
886
function smf_db_escape_wildcard_string($string, $translate_human_wildcards=false)
887
{
888
	$replacements = array(
889
		'%' => '\%',
890
		'_' => '\_',
891
		'\\' => '\\\\',
892
	);
893
894
	if ($translate_human_wildcards)
895
		$replacements += array(
896
			'*' => '%',
897
		);
898
899
	return strtr($string, $replacements);
900
}
901
902
?>