diff --git a/app/TextFormatter.inc b/app/TextFormatter.inc
index 38fea174..e226c7e5 100644
--- a/app/TextFormatter.inc
+++ b/app/TextFormatter.inc
@@ -57,8 +57,22 @@
*/
public function t($string)
{
- // Remove chars and replace linefeeds
- $string = nl2br(htmlspecialchars($string));
+ // Remove chars
+ $string = htmlspecialchars($string, ENT_NOQUOTES);
+
+ // Create tables
+ $string = str_replace('[table]', '
', $string);
+ $string = str_replace('[/table]', '
', $string);
+ $string = str_replace('[tr]', '
', $string);
+ $string = str_replace('[/tr]', '
', $string);
+ $string = str_replace('[th]', '', $string);
+ $string = str_replace('[/th]', ' | ', $string);
+ $string = str_replace('[td]', '', $string);
+ $string = str_replace('[/td]', ' | ', $string);
+
+ // Create links
+ $string = preg_replace('!(^|\s)"([^"]+)":(https?://[^\s]+)(\s|$)!i', '$1$2$4', $string);
+ $string = preg_replace('!(^|\s)(https?://[^\s]+)(\s|$)!i', '$1$2$4', $string);
// Handle Seminarymedia
$seminarymedia = array();
@@ -89,7 +103,7 @@
// Return processed string
- return $string;
+ return nl2br($string);
}