Changeset 579 for trunk/include/functions_html.inc.php
- Timestamp:
- Oct 23, 2004, 7:56:46 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_html.inc.php
r572 r579 270 270 return $menu; 271 271 } 272 273 /** 274 * returns HTMLized comment contents retrieved from database 275 * 276 * newlines becomes br tags, _word_ becomes underline, /word/ becomes 277 * italic, *word* becomes bolded 278 * 279 * @param string content 280 * @return string 281 */ 282 function parse_comment_content($content) 283 { 284 $content = nl2br($content); 285 286 // replace _word_ by an underlined word 287 $pattern = '/_([^\s]*)_/'; 288 $replacement = '<span style="text-decoration:underline;">\1</span>'; 289 $content = preg_replace($pattern, $replacement, $content); 290 291 // replace *word* by a bolded word 292 $pattern = '/\*([^\s]*)\*/'; 293 $replacement = '<span style="font-weight:bold;">\1</span>'; 294 $content = preg_replace($pattern, $replacement, $content); 295 296 // replace /word/ by an italic word 297 $pattern = '/\/([^\s]*)\//'; 298 $replacement = '<span style="font-style:italic;">\1</span>'; 299 $content = preg_replace($pattern, $replacement, $content); 300 301 return $content; 302 } 272 303 ?>
Note: See TracChangeset
for help on using the changeset viewer.