Code Duplication    Length = 4-4 lines in 3 locations

Sources/Calendar.php 1 location

@@ 237-240 (lines=4) @@
234
		$_REQUEST['eventid'] = (int) $_REQUEST['eventid'];
235
236
	// We want a fairly compact version of the time, but as close as possible to the user's settings.
237
	if (preg_match('~%[HkIlMpPrRSTX](?:[^%]*%[HkIlMpPrRSTX])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0]))
238
		$time_string = '%k:%M';
239
	else
240
		$time_string = str_replace(array('%I', '%H', '%S', '%r', '%R', '%T'), array('%l', '%k', '', '%l:%M %p', '%k:%M', '%l:%M'), $matches[0]);
241
242
	$js_time_string = str_replace(
243
		array('%H', '%k', '%I', '%l', '%M', '%p', '%P', '%r',      '%R',  '%S', '%T',    '%X'),

Sources/Post.php 1 location

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

Sources/Subs-Calendar.php 1 location

@@ 1481-1484 (lines=4) @@
1478
		$row['timezone'] = getUserTimezone();
1479
1480
	// We want a fairly compact version of the time, but as close as possible to the user's settings.
1481
	if (preg_match('~%[HkIlMpPrRSTX](?:[^%]*%[HkIlMpPrRSTX])*~', $user_info['time_format'], $matches) == 0 || empty($matches[0]))
1482
		$time_format = '%k:%M';
1483
	else
1484
		$time_format = str_replace(array('%I', '%H', '%S', '%r', '%R', '%T'), array('%l', '%k', '', '%l:%M %p', '%k:%M', '%l:%M'), $matches[0]);
1485
1486
	$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;
1487