Changeset 180 for trunk/comments.php


Ignore:
Timestamp:
Oct 5, 2003, 3:43:00 PM (21 years ago)
Author:
z0rglub
Message:

Support of special syntax to underline, emphasis or italic words in users
comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/comments.php

    r179 r180  
    109109      $displayed_date = format_date( $subrow['date'], 'unix', true );
    110110      $vtp->setVar( $handle, 'comment.date', $displayed_date );
    111       $vtp->setVar( $handle, 'comment.content', nl2br( $subrow['content'] ) );
     111
     112      $content = nl2br( $subrow['content'] );
     113     
     114      // replace _word_ by an underlined word
     115      $pattern = '/_([^\s]*)_/';
     116      $replacement = '<span style="text-decoration:underline;">\1</span>';
     117      $content = preg_replace( $pattern, $replacement, $content );
     118     
     119      // replace *word* by a bolded word
     120      $pattern = '/\*([^\s]*)\*/';
     121      $replacement = '<span style="font-weight:bold;">\1</span>';
     122      $content = preg_replace( $pattern, $replacement, $content );
     123
     124      // replace /word/ by an italic word
     125      $pattern = '/\/([^\s]*)\//';
     126      $replacement = '<span style="font-style:italic;">\1</span>';
     127      $content = preg_replace( $pattern, $replacement, $content );
     128     
     129      $vtp->setVar( $handle, 'comment.content', $content );
    112130      $vtp->closeSession( $handle, 'comment' );
    113131    }
Note: See TracChangeset for help on using the changeset viewer.