From be46a583c8e74f9b7013de2f26d5da1831abc7ef Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 23 Jan 2006 10:30:51 +0100 Subject: [PATCH] missing note parser added darcs-hash:20060123093051-6e07b-55b12d4ce7ccbbc59bb79044467a7d3aeb909cee.gz --- smarty/plugins/modifier.noteparser.php | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 smarty/plugins/modifier.noteparser.php 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: */ + +?> -- 2.39.5