Code Duplication    Length = 14-16 lines in 7 locations

mod/blog/start.php 1 location

@@ 183-196 (lines=14) @@
180
/**
181
 * Add a menu item to an ownerblock
182
 */
183
function blog_owner_block_menu($hook, $type, $return, $params) {
184
	if (elgg_instanceof($params['entity'], 'user')) {
185
		$url = "blog/owner/{$params['entity']->username}";
186
		$item = new ElggMenuItem('blog', elgg_echo('blog'), $url);
187
		$return[] = $item;
188
	} else {
189
		if ($params['entity']->blog_enable != "no") {
190
			$url = "blog/group/{$params['entity']->guid}/all";
191
			$item = new ElggMenuItem('blog', elgg_echo('blog:group'), $url);
192
			$return[] = $item;
193
		}
194
	}
195
	return $return;
196
}
197
198
/**
199
 * Add particular blog links/info to entity menu

mod/bookmarks/start.php 1 location

@@ 173-187 (lines=15) @@
170
 * @param array  $return
171
 * @param array  $params
172
 */
173
function bookmarks_owner_block_menu($hook, $type, $return, $params) {
174
	if (elgg_instanceof($params['entity'], 'user')) {
175
		$url = "bookmarks/owner/{$params['entity']->username}";
176
		$item = new ElggMenuItem('bookmarks', elgg_echo('bookmarks'), $url);
177
		$return[] = $item;
178
	} else {
179
		if ($params['entity']->bookmarks_enable != 'no') {
180
			$url = "bookmarks/group/{$params['entity']->guid}/all";
181
			$item = new ElggMenuItem('bookmarks', elgg_echo('bookmarks:group'), $url);
182
			$return[] = $item;
183
		}
184
	}
185
186
	return $return;
187
}
188
189
/**
190
 * Prepare a notification message about a new bookmark

mod/etherpad/start.php 1 location

@@ 224-238 (lines=15) @@
221
/**
222
 * Add a menu item to the user ownerblock
223
 */
224
function etherpad_owner_block_menu($hook, $type, $return, $params) {
225
	if (elgg_instanceof($params['entity'], 'user')) {
226
		$url = "docs/owner/{$params['entity']->username}";
227
		$item = new ElggMenuItem('etherpad', elgg_echo('etherpad'), $url);
228
		$return[] = $item;
229
	} else {
230
		if ($params['entity']->pages_enable != "no") {
231
			$url = "docs/group/{$params['entity']->guid}/all";
232
			$item = new ElggMenuItem('etherpad', elgg_echo('etherpad:group'), $url);
233
			$return[] = $item;
234
		}
235
	}
236
237
	return $return;
238
}
239
240
/**
241
 * Extend permissions checking to extend can-edit for write users.

mod/ideas/start.php 1 location

@@ 170-185 (lines=16) @@
167
 * @param array  $return
168
 * @param array  $params
169
 */
170
function ideas_owner_block_menu($hook, $type, $return, $params) {
171
	if (elgg_instanceof($params['entity'], 'user')) {
172
		$url = "ideas/owner/{$params['entity']->username}";
173
		$item = new ElggMenuItem('ideas', elgg_echo('ideas'), $url);
174
		$return[] = $item;
175
	} else {
176
		if ($params['entity']->ideas_enable != 'no') {
177
			$url = "ideas/group/{$params['entity']->guid}/top";
178
			$item = new ElggMenuItem('ideas', elgg_echo('ideas:group:idea'), $url);
179
			// if (elgg_in_context('ideas')) $item->setSelected();
180
			$return[] = $item;
181
		}
182
	}
183
184
	return $return;
185
}
186
187
/**
188
 * Returns the body of a notification message

mod/pages/start.php 1 location

@@ 227-241 (lines=15) @@
224
/**
225
 * Add a menu item to the user ownerblock
226
 */
227
function pages_owner_block_menu($hook, $type, $return, $params) {
228
	if (elgg_instanceof($params['entity'], 'user')) {
229
		$url = "pages/owner/{$params['entity']->username}";
230
		$item = new ElggMenuItem('pages', elgg_echo('pages'), $url);
231
		$return[] = $item;
232
	} else {
233
		if ($params['entity']->pages_enable != "no") {
234
			$url = "pages/group/{$params['entity']->guid}/all";
235
			$item = new ElggMenuItem('pages', elgg_echo('pages:group'), $url);
236
			$return[] = $item;
237
		}
238
	}
239
240
	return $return;
241
}
242
243
/**
244
 * Add links/info to entity menu particular to pages plugin

mod/tasks/start.php 1 location

@@ 284-298 (lines=15) @@
281
/**
282
 * Add a menu item to the user ownerblock
283
 */
284
function tasks_owner_block_menu($hook, $type, $return, $params) {
285
	if (elgg_instanceof($params['entity'], 'user')) {
286
		$url = "tasks/owner/{$params['entity']->username}";
287
		$item = new ElggMenuItem('tasks', elgg_echo('tasks'), $url);
288
		$return[] = $item;
289
	} else {
290
		if ($params['entity']->tasks_enable != "no") {
291
			$url = "tasks/group/{$params['entity']->guid}/all";
292
			$item = new ElggMenuItem('tasks', elgg_echo('tasks:group'), $url);
293
			$return[] = $item;
294
		}
295
	}
296
297
	return $return;
298
}
299
300
/**
301
 * Add links/info to entity menu particular to tasks plugin

mod/file/start.php 1 location

@@ 222-236 (lines=15) @@
219
/**
220
 * Add a menu item to the user ownerblock
221
 */
222
function file_owner_block_menu($hook, $type, $return, $params) {
223
	if (elgg_instanceof($params['entity'], 'user')) {
224
		$url = "file/owner/{$params['entity']->username}";
225
		$item = new ElggMenuItem('file', elgg_echo('file'), $url);
226
		$return[] = $item;
227
	} else {
228
		if ($params['entity']->file_enable != "no") {
229
			$url = "file/group/{$params['entity']->guid}/all";
230
			$item = new ElggMenuItem('file', elgg_echo('file:group'), $url);
231
			$return[] = $item;
232
		}
233
	}
234
235
	return $return;
236
}
237
238
/**
239
 * Registers page menu items for file type filtering and returns a view