15 * Purpose: Converts plaintext notes to richer HTML (very simple)
16 * Example: {$entry.note|noteparser}
17 * @author Andreas Gohr <gohr@cosmocode.de>
21 function smarty_modifier_noteparser($string){
22 $string = htmlspecialchars($string);
24 $string = preg_replace('!\*\*Call\*\*!i','<img src="pix/phone.png" width="16" height="16" alt="Call" />',$string);
25 $string = preg_replace('!\*\*ToDo\*\*!i','<img src="pix/arrow_right.png" width="16" height="16" alt="ToDo" />',$string);
26 $string = preg_replace('!\*\*Mail\*\*!i','<img src="pix/email.png" width="16" height="16" alt="Mail" />',$string);
27 $string = preg_replace('!\*\*Note\*\*!i','<img src="pix/note.png" width="16" height="16" alt="note" />',$string);
29 $string = preg_replace('!\*\*(.*?)\*\*!','<b>\\1</b>',$string);
30 $string = preg_replace('!__(.*?)__!','<u>\\1</u>',$string);
31 $string = preg_replace('!//(.*?)//!','<i>\\1</i>',$string);
33 $string = preg_replace('!(https?://[\w;/?:@&=+$\-_.\!~*\\\']+)!i',
34 '<a href="\\1">\\1</a>',$string);
36 $string = preg_replace('!\n\n+!','</p><p>',$string);
37 $string = nl2br($string);
39 return '<p>'.$string.' </p>';
42 /* vim: set expandtab: */