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 diff
1.1 --- a/Includes/Bbcodeparser.inc.php Wed Dec 13 22:16:59 2006 +0100 1.2 +++ b/Includes/Bbcodeparser.inc.php Wed Dec 13 23:08:55 2006 +0100 1.3 @@ -1,27 +1,39 @@ 1.4 <?php 1.5 - 1.6 /** 1.7 - * 1.8 * BB-Code-Parser 1.9 * 1.10 - * by Meillo r e t u r n s 1.11 - * 1.12 + * @author Meillo r e t u r n s <meillo@marmaro.de> 1.13 */ 1.14 1.15 1.16 - define('SMILIE_DIR', 'Smilies/'); // path to smilies 1.17 + /// path to smilies 1.18 + define('SMILIE_DIR', 'Smilies/'); 1.19 1.20 1.21 1.22 - 1.23 - function parse_quote1($textinput,$level = 1) { // ohne Quelle 1.24 + /** 1.25 + * parses recursive quotes without a source mentioned 1.26 + * 1.27 + * @param $textinput the bbcode-text 1.28 + * @param $level number of levels to go inside 1.29 + * @return HTML-text 1.30 + */ 1.31 + function parse_quote1($textinput,$level = 1) { 1.32 $pattern = '#\[quote\](((?R)|(.*))*)\[/quote\]#isUe'; 1.33 $replacement = "'<br />[nl]<span class=\"quote0\">Zitat:</span>[nl]<div class=\"quote1\">[nl]'.parse_quote1('$1', 1.34 ". ($level + 1) ." 1.35 ).'[nl]</div>[nl]'"; 1.36 return preg_replace($pattern, $replacement, $textinput); 1.37 } 1.38 - function parse_quote2($textinput,$level = 1) { // mit Quelle 1.39 + 1.40 + /** 1.41 + * parses recursive quotes with a source mentioned 1.42 + * 1.43 + * @param $textinput the bbcode-text 1.44 + * @param $level number of levels to go inside 1.45 + * @return HTML-text 1.46 + */ 1.47 + function parse_quote2($textinput,$level = 1) { 1.48 $pattern = '#\[quote\=(.*)\](((?R)|(.*))*)\[/quote\]#isUe'; 1.49 $replacement = "'<br />[nl]<span class=\"quote0\">Zitat: ($1)</span>[nl]<div class=\"quote2\">[nl]'.parse_quote2('$2', 1.50 ". ($level + 1) ." 1.51 @@ -29,6 +41,12 @@ 1.52 return preg_replace($pattern, $replacement, $textinput); 1.53 } 1.54 1.55 + /** 1.56 + * replaces smilies 1.57 + * 1.58 + * @param $text text with ASCII-smilies 1.59 + * @return text with [img]-smilies 1.60 + */ 1.61 function smilies($text) { 1.62 $smilies = array( ':-)' => 'Smile.gif', 1.63 ':)' => 'Smile.gif', 1.64 @@ -57,6 +75,14 @@ 1.65 } 1.66 1.67 1.68 + /** 1.69 + * turns bbcode in HTML 1.70 + * 1.71 + * @param $text the text with bbcode inside 1.72 + * @param $smilies set to 1 causes smilies to be replaced with pics 1.73 + * @param $images set to 1 causes images to be displayed ([img]-tag) 1.74 + * @return text with HTML-code 1.75 + */ 1.76 function bbcode($text, $smilies = 0, $images = 0) { 1.77 1.78 // smilies 1.79 @@ -94,4 +120,4 @@ 1.80 return $text; 1.81 } 1.82 1.83 -?> 1.84 \ No newline at end of file 1.85 +?>