Code Duplication    Length = 21-24 lines in 3 locations

engine/lib/deprecated-1.7.php 3 locations

@@ 553-573 (lines=21) @@
550
 *
551
 * @return string
552
 */
553
function search_list_groups_by_name($hook, $user, $returnvalue, $tag) {
554
	elgg_deprecated_notice('search_list_groups_by_name() was deprecated by new search plugin', 1.7);
555
	// Change this to set the number of groups that display on the search page
556
	$threshold = 4;
557
558
	$object = get_input('object');
559
560
	if (!get_input('offset') && (empty($object) || $object == 'group')) {
561
		if ($groups = search_for_group($tag, $threshold)) {
562
			$countgroups = search_for_group($tag, 0, 0, "", true);
563
564
			$return = elgg_view('group/search/startblurb', array('count' => $countgroups, 'tag' => $tag));
565
			foreach ($groups as $group) {
566
				$return .= elgg_view_entity($group);
567
			}
568
			$vars = array('count' => $countgroups, 'threshold' => $threshold, 'tag' => $tag);
569
			$return .= elgg_view('group/search/finishblurb', $vars);
570
			return $return;
571
		}
572
	}
573
}
574
575
/**
576
 * Displays a list of group objects that have been searched for.
@@ 824-847 (lines=24) @@
821
 *
822
 * @return array
823
 */
824
function search_list_objects_by_name($hook, $user, $returnvalue, $tag) {
825
	elgg_deprecated_notice('search_list_objects_by_name was deprecated by new search plugin.', 1.7);
826
827
	// Change this to set the number of users that display on the search page
828
	$threshold = 4;
829
830
	$object = get_input('object');
831
832
	if (!get_input('offset') && (empty($object) || $object == 'user')) {
833
		if ($users = search_for_user($tag, $threshold)) {
834
			$countusers = search_for_user($tag, 0, 0, "", true);
835
836
			$return = elgg_view('user/search/startblurb', array('count' => $countusers, 'tag' => $tag));
837
			foreach ($users as $user) {
838
				$return .= elgg_view_entity($user);
839
			}
840
			$return .= elgg_view('user/search/finishblurb',
841
				array('count' => $countusers, 'threshold' => $threshold, 'tag' => $tag));
842
843
			return $return;
844
845
		}
846
	}
847
}
848
849
/**
850
 * Return entities from relationships
@@ 1048-1070 (lines=23) @@
1045
 *
1046
 * @return void
1047
 */
1048
function search_list_users_by_name($hook, $user, $returnvalue, $tag) {
1049
	elgg_deprecated_notice('search_list_users_by_name() was deprecated by new search', 1.7);
1050
	// Change this to set the number of users that display on the search page
1051
	$threshold = 4;
1052
1053
	$object = get_input('object');
1054
1055
	if (!get_input('offset') && (empty($object) || $object == 'user')) {
1056
		if ($users = search_for_user($tag, $threshold)) {
1057
			$countusers = search_for_user($tag, 0, 0, "", true);
1058
1059
			$return = elgg_view('user/search/startblurb', array('count' => $countusers, 'tag' => $tag));
1060
			foreach ($users as $user) {
1061
				$return .= elgg_view_entity($user);
1062
			}
1063
1064
			$vars = array('count' => $countusers, 'threshold' => $threshold, 'tag' => $tag);
1065
			$return .= elgg_view('user/search/finishblurb', $vars);
1066
			return $return;
1067
1068
		}
1069
	}
1070
}
1071
1072
/**
1073
 * Extend a view