From 9bb0d0bd455877b395cfa8d7cd8c306070c07ad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Tue, 12 Nov 2013 16:08:22 +0100 Subject: [PATCH] - improved timeFormatter to strip $codes -> "Formatter" --- .../core/{timeFormatter.php => Formatter.php} | 39 +++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) rename application/core/{timeFormatter.php => Formatter.php} (55%) diff --git a/application/core/timeFormatter.php b/application/core/Formatter.php similarity index 55% rename from application/core/timeFormatter.php rename to application/core/Formatter.php index 0ec1bacd..f24c4afb 100644 --- a/application/core/timeFormatter.php +++ b/application/core/Formatter.php @@ -3,11 +3,11 @@ namespace ManiaControl; /** - * Class offering methods to format times + * Class offering methods to format texts and values * - * @author Steff + * @author steeffeen & kremsy */ -class TimeFormatter { +abstract class Formatter { /** * Formats the given time (milliseconds) @@ -51,6 +51,39 @@ class TimeFormatter { public static function formatTimestamp($time) { return date("Y-m-d H:i:s", $time); } + + /** + * Strip $codes from the string + * + * @param string $string + * @return string + */ + public static function stripCodes($string) { + $string = preg_replace('/(?