Code Duplication    Length = 4-4 lines in 4 locations

Sources/Subs-Calendar.php 2 locations

@@ 684-687 (lines=4) @@
681
	}
682
683
	// Give birthdays and holidays a friendly format, without the year
684
	if (preg_match('~%[AaBbCcDdeGghjmuYy](?:[^%]*%[AaBbCcDdeGghjmuYy])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0]))
685
		$date_format = '%b %d';
686
	else
687
		$date_format = str_replace(array('%Y', '%y', '%G', '%g', '%C', '%c', '%D'), array('', '', '', '', '', '%b %d', '%m/%d'), $matches[0]);
688
689
	foreach (array('birthdays', 'holidays') as $type)
690
	{
@@ 1545-1548 (lines=4) @@
1542
		$date_format = $matches[0];
1543
1544
	// We want a fairly compact version of the time, but as close as possible to the user's settings.
1545
	if (preg_match('~%[HkIlMpPrRSTX](?:[^%]*%[HkIlMpPrRSTX])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0]))
1546
		$time_format = '%k:%M';
1547
	else
1548
		$time_format = str_replace(array('%I', '%H', '%S', '%r', '%R', '%T'), array('%l', '%k', '', '%l:%M %p', '%k:%M', '%l:%M'), $matches[0]);
1549
1550
	// Should this be an all day event?
1551
	$allday = (empty($row['start_time']) || empty($row['end_time']) || empty($row['timezone']) || !in_array($row['timezone'], timezone_identifiers_list(DateTimeZone::ALL_WITH_BC))) ? true : false;

Sources/Post.php 1 location

@@ 253-256 (lines=4) @@
250
		isAllowedTo('calendar_post');
251
252
		// We want a fairly compact version of the time, but as close as possible to the user's settings.
253
		if (preg_match('~%[HkIlMpPrRSTX](?:[^%]*%[HkIlMpPrRSTX])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0]))
254
			$time_string = '%k:%M';
255
		else
256
			$time_string = str_replace(array('%I', '%H', '%S', '%r', '%R', '%T'), array('%l', '%k', '', '%l:%M %p', '%k:%M', '%l:%M'), $matches[0]);
257
258
		$js_time_string = str_replace(
259
			array('%H', '%k', '%I', '%l', '%M', '%p', '%P', '%r',      '%R',  '%S', '%T',    '%X'),

Sources/Calendar.php 1 location

@@ 291-294 (lines=4) @@
288
		$_REQUEST['eventid'] = (int) $_REQUEST['eventid'];
289
290
	// We want a fairly compact version of the time, but as close as possible to the user's settings.
291
	if (preg_match('~%[HkIlMpPrRSTX](?:[^%]*%[HkIlMpPrRSTX])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0]))
292
		$time_string = '%k:%M';
293
	else
294
		$time_string = str_replace(array('%I', '%H', '%S', '%r', '%R', '%T'), array('%l', '%k', '', '%l:%M %p', '%k:%M', '%l:%M'), $matches[0]);
295
296
	$js_time_string = str_replace(
297
		array('%H', '%k', '%I', '%l', '%M', '%p', '%P', '%r',      '%R',  '%S', '%T',    '%X'),