From 2c544b1da614a6cbc8ec6a1afd5ca1644953d1ef Mon Sep 17 00:00:00 2001 From: deva Date: Wed, 29 Apr 2009 06:45:41 +0000 Subject: Added markdown support in news and event descriptions. --- utils/modules/events.php | 6 ++++-- utils/modules/news.php | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'utils') diff --git a/utils/modules/events.php b/utils/modules/events.php index f14622e..8be8f5e 100644 --- a/utils/modules/events.php +++ b/utils/modules/events.php @@ -2,6 +2,7 @@ /* -*- Mode: php; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ include_once($UTIL_DIR . "/convert.php"); +include_once($UTIL_DIR . "/markdown.php"); class Event { public $title; @@ -26,12 +27,13 @@ class Event { $icons = new Icons($ICONS_DIR."/"); $icon = $icons->icons[$this->flyer]; + $content = Markdown(htmlspecialchars_decode($this->description)); + $str = "
\n"; $str .= "
" . htmlspecialchars_decode($this->title, ENT_QUOTES) . "
\n"; $str .= "
" . date("D M jS Y", $this->time) . "
\n"; - $str .= "
" . - htmlspecialchars_decode($this->description, ENT_QUOTES) . "
\n"; + $str .= "
" . $content . "
\n"; if($this->flyer) { $str .= " \"flyer\"prefix.$icon->file."\"/>\n"; } diff --git a/utils/modules/news.php b/utils/modules/news.php index d7ad99c..9e542ae 100644 --- a/utils/modules/news.php +++ b/utils/modules/news.php @@ -5,6 +5,7 @@ include_once($UTIL_DIR . "/convert.php"); include_once($UTIL_DIR . "/forms.php"); include_once($UTIL_DIR . "/user.php"); include_once($MODULES_DIR . "/icons.php"); +include_once($UTIL_DIR . "/markdown.php"); class NewsEntry { public $title; @@ -19,6 +20,8 @@ class NewsEntry { global $users, $DATA_DIR, $ICONS_DIR; if(!isset($users)) $users = new Users($DATA_DIR . "/users.xml"); + $content = Markdown(htmlspecialchars_decode($this->description)); + $icons = new Icons($ICONS_DIR."/"); $icon = $icons->icons[$this->icon]; @@ -29,7 +32,7 @@ class NewsEntry { $str .= "
By: " . $users->findUser($this->userid)->userid . "
\n"; $str .= "
\n"; if($this->icon) $str .= " \"icon\"prefix.$icon->file . "\"/>\n"; - $str .= " ".htmlspecialchars_decode($this->description, ENT_QUOTES) . "\n"; + $str .= " ".$content. "\n"; $str .= "
\n"; $str .= "
\n"; return $str; -- cgit v1.2.3