Code Duplication    Length = 19-22 lines in 2 locations

engine/lib/friends.php 1 location

@@ 83-104 (lines=22) @@
80
	$user = $params['entity'];
81
	/* @var \ElggUser $user */
82
83
	if (elgg_is_logged_in()) {
84
		if (elgg_get_logged_in_user_guid() != $user->guid) {
85
			$isFriend = $user->isFriend();
86
87
			// Always emit both to make it super easy to toggle with ajax
88
			$return[] = \ElggMenuItem::factory(array(
89
				'name' => 'remove_friend',
90
				'href' => elgg_add_action_tokens_to_url("action/friends/remove?friend={$user->guid}"),
91
				'text' => elgg_echo('friend:remove'),
92
				'section' => 'action',
93
				'item_class' => $isFriend ? '' : 'hidden',
94
			));
95
96
			$return[] = \ElggMenuItem::factory(array(
97
				'name' => 'add_friend',
98
				'href' => elgg_add_action_tokens_to_url("action/friends/add?friend={$user->guid}"),
99
				'text' => elgg_echo('friend:add'),
100
				'section' => 'action',
101
				'item_class' => $isFriend ? 'hidden' : '',
102
			));
103
		}
104
	}
105
106
	return $return;
107
}

mod/groups/start.php 1 location

@@ 430-448 (lines=19) @@
427
	$return[] = ElggMenuItem::factory($options);
428
429
	// feature link
430
	if (elgg_is_admin_logged_in()) {
431
		$isFeatured = $entity->featured_group == "yes";
432
433
		$return[] = ElggMenuItem::factory(array(
434
			'name' => 'feature',
435
			'text' => elgg_echo("groups:makefeatured"),
436
			'href' => elgg_add_action_tokens_to_url("action/groups/featured?group_guid={$entity->guid}&action_type=feature"),
437
			'priority' => 300,
438
			'item_class' => $isFeatured ? 'hidden' : '',
439
		));
440
441
		$return[] = ElggMenuItem::factory(array(
442
			'name' => 'unfeature',
443
			'text' => elgg_echo("groups:makeunfeatured"),
444
			'href' => elgg_add_action_tokens_to_url("action/groups/featured?group_guid={$entity->guid}&action_type=unfeature"),
445
			'priority' => 300,
446
			'item_class' => $isFeatured ? '' : 'hidden',
447
		));
448
	}
449
450
	return $return;
451
}