Code Duplication    Length = 21-30 lines in 2 locations

mod/gc_mobile_api/inc/functions.php 1 location

@@ 116-136 (lines=21) @@
113
	return $comments;
114
}
115
116
function wire_filter($text)
117
{
118
	$site_url = elgg_get_site_url();
119
120
	$text = ''.$text;
121
122
	// email addresses
123
	$text = preg_replace('/(^|[^\w])([\w\-\.]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})/i', '$1<a href="mailto:$2@$3">$2@$3</a>', $text);
124
125
	// links
126
	$text = parse_urls($text);
127
128
	// usernames
129
	$text = preg_replace('/(^|[^\w])@([\p{L}\p{Nd}._]+)/u', '$1<a href="' . $site_url . 'thewire/owner/$2">@$2</a>', $text);
130
131
	// hashtags
132
	$text = preg_replace('/(^|[^\w])#(\w*[^\s\d!-\/:-@]+\w*)/', '$1<a href="' . $site_url . 'thewire/tag/$2">#$2</a>', $text);
133
134
	$text = trim($text);
135
136
	return $text;
137
}
138
139
function clean_text($text)

mod/thewire/start.php 1 location

@@ 222-251 (lines=30) @@
219
 * @param string $text The text of a post
220
 * @return string
221
 */
222
function thewire_filter($text) {
223
	global $CONFIG;
224
225
	$text = ' ' . $text;
226
227
	// email addresses
228
	$text = preg_replace(
229
				'/(^|[^\w])([\w\-\.]+)@(([0-9a-z-]+\.)+[0-9a-z]{2,})/i',
230
				'$1<a href="mailto:$2@$3">$2@$3</a>',
231
				$text);
232
233
	// links
234
	$text = parse_urls($text);
235
236
	// usernames
237
	$text = preg_replace(
238
				'/(^|[^\w])@([\p{L}\p{Nd}._]+)/u',
239
				'$1<a href="' . $CONFIG->wwwroot . 'thewire/owner/$2">@$2</a>',
240
				$text);
241
242
	// hashtags
243
	$text = preg_replace(
244
				'/(^|[^\w])#(\w*[^\s\d!-\/:-@]+\w*)/',
245
				'$1<a href="' . $CONFIG->wwwroot . 'thewire/tag/$2">#$2</a>',
246
				$text);
247
248
	$text = trim($text);
249
250
	return $text;
251
}
252
253
/**
254
 * Create a new wire post.