Mercurial > owls
diff Includes/Bbcodeparser.inc.php @ 8:2672cd855fa2
added further doxygen-comments
author | Meillo r e t u r n s <meillo@marmaro.de> |
---|---|
date | Wed, 13 Dec 2006 23:08:55 +0100 |
parents | ab74e95a8040 |
children | 144bc36a6c27 |
line wrap: on
line diff
--- a/Includes/Bbcodeparser.inc.php Wed Dec 13 22:16:59 2006 +0100 +++ b/Includes/Bbcodeparser.inc.php Wed Dec 13 23:08:55 2006 +0100 @@ -1,27 +1,39 @@ <?php - /** - * * BB-Code-Parser * - * by Meillo r e t u r n s - * + * @author Meillo r e t u r n s <meillo@marmaro.de> */ - define('SMILIE_DIR', 'Smilies/'); // path to smilies + /// path to smilies + define('SMILIE_DIR', 'Smilies/'); - - function parse_quote1($textinput,$level = 1) { // ohne Quelle + /** + * parses recursive quotes without a source mentioned + * + * @param $textinput the bbcode-text + * @param $level number of levels to go inside + * @return HTML-text + */ + function parse_quote1($textinput,$level = 1) { $pattern = '#\[quote\](((?R)|(.*))*)\[/quote\]#isUe'; $replacement = "'<br />[nl]<span class=\"quote0\">Zitat:</span>[nl]<div class=\"quote1\">[nl]'.parse_quote1('$1', ". ($level + 1) ." ).'[nl]</div>[nl]'"; return preg_replace($pattern, $replacement, $textinput); } - function parse_quote2($textinput,$level = 1) { // mit Quelle + + /** + * parses recursive quotes with a source mentioned + * + * @param $textinput the bbcode-text + * @param $level number of levels to go inside + * @return HTML-text + */ + function parse_quote2($textinput,$level = 1) { $pattern = '#\[quote\=(.*)\](((?R)|(.*))*)\[/quote\]#isUe'; $replacement = "'<br />[nl]<span class=\"quote0\">Zitat: ($1)</span>[nl]<div class=\"quote2\">[nl]'.parse_quote2('$2', ". ($level + 1) ." @@ -29,6 +41,12 @@ return preg_replace($pattern, $replacement, $textinput); } + /** + * replaces smilies + * + * @param $text text with ASCII-smilies + * @return text with [img]-smilies + */ function smilies($text) { $smilies = array( ':-)' => 'Smile.gif', ':)' => 'Smile.gif', @@ -57,6 +75,14 @@ } + /** + * turns bbcode in HTML + * + * @param $text the text with bbcode inside + * @param $smilies set to 1 causes smilies to be replaced with pics + * @param $images set to 1 causes images to be displayed ([img]-tag) + * @return text with HTML-code + */ function bbcode($text, $smilies = 0, $images = 0) { // smilies @@ -94,4 +120,4 @@ return $text; } -?> \ No newline at end of file +?>