From: Andreas Gohr Date: Mon, 23 Jan 2006 09:30:51 +0000 (+0100) Subject: missing note parser added X-Git-Tag: 0.7.1~99 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=be46a583c8e74f9b7013de2f26d5da1831abc7ef;p=contagged missing note parser added darcs-hash:20060123093051-6e07b-55b12d4ce7ccbbc59bb79044467a7d3aeb909cee.gz --- diff --git a/smarty/plugins/modifier.noteparser.php b/smarty/plugins/modifier.noteparser.php new file mode 100644 index 0000000..18553ce --- /dev/null +++ b/smarty/plugins/modifier.noteparser.php @@ -0,0 +1,44 @@ + + * @param string + * @return string + */ +function smarty_modifier_noteparser($string){ + $string = htmlspecialchars($string); + + $string = preg_replace('!\*\*Call\*\*!i','Call',$string); + $string = preg_replace('!\*\*ToDo\*\*!i','ToDo',$string); + $string = preg_replace('!\*\*Mail\*\*!i','Mail',$string); + $string = preg_replace('!\*\*Note\*\*!i','note',$string); + + $string = preg_replace('!\*\*(.*?)\*\*!','\\1',$string); + $string = preg_replace('!__(.*?)__!','\\1',$string); + $string = preg_replace('!//(.*?)//!','\\1',$string); + + $string = preg_replace('!(https?://[\w;/?:@&=+$\-_.\!~*\\\']+)!i', + '\\1',$string); + + $string = preg_replace('!\n\n+!','

',$string); + $string = nl2br($string); + + return '

'.$string.'

'; +} + +/* vim: set expandtab: */ + +?>