Skip to content

Commit

Permalink
merge branch 1.5 into trunk r1001:1002: bug 259 fixed
Browse files Browse the repository at this point in the history
git-svn-id: http://piwigo.org/svn/trunk@1030 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
nikrou committed Feb 9, 2006
1 parent 0e78db4 commit c8e9793
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions include/functions_html.inc.php
Expand Up @@ -409,21 +409,25 @@ function get_html_menu_category($categories)
function parse_comment_content($content)
{
$content = nl2br($content);

$pattern = '/(http?:\/\/\S*)/';
$replacement = '<a href="$1">$1</a>';
$content = preg_replace($pattern, $replacement, $content);

// replace _word_ by an underlined word
$pattern = '/_([^\s]*)_/';
$replacement = '<span style="text-decoration:underline;">\1</span>';
$pattern = '/\b_(\S*)_\b/';
$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>';
$pattern = '/\b\*(\S*)\*\b/';
$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);
$pattern = "/\/(\S*)\/(\s)/";
$replacement = '<span style="font-style:italic;">$1$2</span>';
$content = preg_replace($pattern, $replacement, $content);

return $content;
}
Expand Down

0 comments on commit c8e9793

Please sign in to comment.