Code Duplication    Length = 10-10 lines in 2 locations

engine/lib/deprecated-1.9.php 2 locations

@@ 3786-3795 (lines=10) @@
3783
function elgg_get_calling_plugin_id($mainfilename = false) {
3784
	elgg_deprecated_notice('elgg_get_calling_plugin_id() is deprecated', 1.9);
3785
	if (!$mainfilename) {
3786
		if ($backtrace = debug_backtrace()) {
3787
			foreach ($backtrace as $step) {
3788
				$file = $step['file'];
3789
				$file = str_replace("\\", "/", $file);
3790
				$file = str_replace("//", "/", $file);
3791
				if (preg_match("/mod\/([a-zA-Z0-9\-\_]*)\/start\.php$/", $file, $matches)) {
3792
					return $matches[1];
3793
				}
3794
			}
3795
		}
3796
	} else {
3797
		//@todo this is a hack -- plugins do not have to match their page handler names!
3798
		if ($handler = get_input('handler', false)) {
@@ 3798-3807 (lines=10) @@
3795
		}
3796
	} else {
3797
		//@todo this is a hack -- plugins do not have to match their page handler names!
3798
		if ($handler = get_input('handler', false)) {
3799
			return $handler;
3800
		} else {
3801
			$file = $_SERVER["SCRIPT_NAME"];
3802
			$file = str_replace("\\", "/", $file);
3803
			$file = str_replace("//", "/", $file);
3804
			if (preg_match("/mod\/([a-zA-Z0-9\-\_]*)\//", $file, $matches)) {
3805
				return $matches[1];
3806
			}
3807
		}
3808
	}
3809
	return false;
3810
}