diff options
author | z0rglub <z0rglub@piwigo.org> | 2003-10-05 13:43:00 +0000 |
---|---|---|
committer | z0rglub <z0rglub@piwigo.org> | 2003-10-05 13:43:00 +0000 |
commit | 1ee0d7153c17bb2925707d59f13edd1dbee12ff3 (patch) | |
tree | 10d50c60940a2643e57c6eb72a5b70d1fc256582 /comments.php | |
parent | ff1dc9edad76b265992b34b67b171704ff42bbf4 (diff) |
Support of special syntax to underline, emphasis or italic words in users
comments
git-svn-id: http://piwigo.org/svn/trunk@180 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'comments.php')
-rw-r--r-- | comments.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/comments.php b/comments.php index f6c51e034..83fe67e08 100644 --- a/comments.php +++ b/comments.php @@ -108,7 +108,25 @@ function display_pictures( $mysql_result, $maxtime, $forbidden_cat_ids ) $vtp->setVar( $handle, 'comment.author', $author ); $displayed_date = format_date( $subrow['date'], 'unix', true ); $vtp->setVar( $handle, 'comment.date', $displayed_date ); - $vtp->setVar( $handle, 'comment.content', nl2br( $subrow['content'] ) ); + + $content = nl2br( $subrow['content'] ); + + // replace _word_ by an underlined word + $pattern = '/_([^\s]*)_/'; + $replacement = '<span style="text-decoration:underline;">\1</span>'; + $content = preg_replace( $pattern, $replacement, $content ); + + // replace *word* by a bolded word + $pattern = '/\*([^\s]*)\*/'; + $replacement = '<span style="font-weight:bold;">\1</span>'; + $content = preg_replace( $pattern, $replacement, $content ); + + // replace /word/ by an italic word + $pattern = '/\/([^\s]*)\//'; + $replacement = '<span style="font-style:italic;">\1</span>'; + $content = preg_replace( $pattern, $replacement, $content ); + + $vtp->setVar( $handle, 'comment.content', $content ); $vtp->closeSession( $handle, 'comment' ); } $vtp->closeSession( $handle, 'picture' ); |