Code Duplication    Length = 21-23 lines in 4 locations

mod/bookmarks/start.php 1 location

@@ 198-219 (lines=22) @@
195
 * @param array                           $params       Hook parameters
196
 * @return Elgg\Notifications\Notification
197
 */
198
function bookmarks_prepare_notification($hook, $type, $notification, $params) {
199
	$entity = $params['event']->getObject();
200
	$owner = $params['event']->getActor();
201
	$recipient = $params['recipient'];
202
	$language = $params['language'];
203
	$method = $params['method'];
204
205
	$descr = $entity->description;
206
	$title = $entity->title;
207
208
	$notification->subject = elgg_echo('bookmarks:notify:subject', array($title), $language); 
209
	$notification->body = elgg_echo('bookmarks:notify:body', array(
210
		$owner->name,
211
		$title,
212
		$entity->address,
213
		$descr,
214
		$entity->getURL()
215
	), $language);
216
	$notification->summary = elgg_echo('bookmarks:notify:summary', array($entity->title), $language);
217
218
	return $notification;
219
}
220
221
/**
222
 * Add a page menu menu.

mod/pages/start.php 1 location

@@ 289-309 (lines=21) @@
286
 * @param array                           $params       Hook parameters
287
 * @return Elgg\Notifications\Notification
288
 */
289
function pages_prepare_notification($hook, $type, $notification, $params) {
290
	$entity = $params['event']->getObject();
291
	$owner = $params['event']->getActor();
292
	$recipient = $params['recipient'];
293
	$language = $params['language'];
294
	$method = $params['method'];
295
296
	$descr = $entity->description;
297
	$title = $entity->title;
298
299
	$notification->subject = elgg_echo('pages:notify:subject', array($title), $language); 
300
	$notification->body = elgg_echo('pages:notify:body', array(
301
		$owner->name,
302
		$title,
303
		$descr,
304
		$entity->getURL(),
305
	), $language);
306
	$notification->summary = elgg_echo('pages:notify:summary', array($entity->title), $language);
307
308
	return $notification;
309
}
310
311
/**
312
 * Extend permissions checking to extend can-edit for write users.

mod/file/start.php 1 location

@@ 197-217 (lines=21) @@
194
 * @param array                           $params       Hook parameters
195
 * @return Elgg\Notifications\Notification
196
 */
197
function file_prepare_notification($hook, $type, $notification, $params) {
198
	$entity = $params['event']->getObject();
199
	$owner = $params['event']->getActor();
200
	$recipient = $params['recipient'];
201
	$language = $params['language'];
202
	$method = $params['method'];
203
204
	$descr = $entity->description;
205
	$title = $entity->title;
206
207
	$notification->subject = elgg_echo('file:notify:subject', array($entity->title), $language);
208
	$notification->body = elgg_echo('file:notify:body', array(
209
		$owner->name,
210
		$title,
211
		$descr,
212
		$entity->getURL()
213
	), $language);
214
	$notification->summary = elgg_echo('file:notify:summary', array($entity->title), $language);
215
216
	return $notification;
217
}
218
219
/**
220
 * Add a menu item to the user ownerblock

mod/groups/start.php 1 location

@@ 1033-1055 (lines=23) @@
1030
 * @param array                           $params       Hook parameters
1031
 * @return Elgg\Notifications\Notification
1032
 */
1033
function discussion_prepare_notification($hook, $type, $notification, $params) {
1034
	$entity = $params['event']->getObject();
1035
	$owner = $params['event']->getActor();
1036
	$recipient = $params['recipient'];
1037
	$language = $params['language'];
1038
	$method = $params['method'];
1039
1040
	$descr = $entity->description;
1041
	$title = $entity->title;
1042
	$group = $entity->getContainerEntity();
1043
1044
	$notification->subject = elgg_echo('discussion:topic:notify:subject', array($title), $language);
1045
	$notification->body = elgg_echo('discussion:topic:notify:body', array(
1046
		$owner->name,
1047
		$group->name,
1048
		$title,
1049
		$descr,
1050
		$entity->getURL()
1051
	), $language);
1052
	$notification->summary = elgg_echo('discussion:topic:notify:summary', array($entity->title), $language);
1053
1054
	return $notification;
1055
}
1056
1057
/**
1058
 * Prepare a notification message about a new discussion reply