Code Duplication    Length = 16-16 lines in 2 locations

mod/event_calendar/start.php 1 location

@@ 127-142 (lines=16) @@
124
/**
125
 * Add a menu item to an ownerblock
126
 */
127
function event_calendar_owner_block_menu($hook, $type, $return, $params) {
128
	elgg_load_library('elgg:event_calendar');
129
	if (elgg_instanceof($params['entity'], 'group')) {
130
		if (event_calendar_activated_for_group($params['entity'])) {
131
			$url = "event_calendar/group/{$params['entity']->guid}";
132
			$item = new ElggMenuItem('event_calendar', elgg_echo('event_calendar:group'), $url);
133
			$return[] = $item;
134
		}
135
	} else if (elgg_instanceof($params['entity'], 'user')) {
136
		$url = "event_calendar/owner/{$params['entity']->username}";
137
		$item = new ElggMenuItem('event_calendar', elgg_echo('event_calendar:widget_title'), $url);
138
		$return[] = $item;
139
	}
140
141
	return $return;
142
}
143
144
/**
145
 * Set url for event_calendar objects

mod/polls/start.php 1 location

@@ 122-137 (lines=16) @@
119
/**
120
 * Add a menu item to an owner block
121
 */
122
function polls_owner_block_menu($hook, $type, $return, $params) {
123
	if (elgg_instanceof($params['entity'], 'user')) {
124
		$url = "polls/owner/{$params['entity']->username}";
125
		$item = new ElggMenuItem('polls', elgg_echo('polls'), $url);
126
		$return[] = $item;
127
	} else {
128
		elgg_load_library('elgg:polls');
129
		if (polls_activated_for_group($params['entity'])) {
130
			$url = "polls/group/{$params['entity']->guid}/all";
131
			$item = new ElggMenuItem('polls', elgg_echo('polls:group_polls'), $url);
132
			$return[] = $item;
133
		}
134
	}
135
136
	return $return;
137
}
138