| 3 | | require_once JLOG_BASEPATH.'/scripts/stringparser_bbcode.class.php'; |
| 4 | | |
| 5 | | // Zeilenumbrᅵche verschiedener Betriebsysteme vereinheitlichen |
| 6 | | function convertlinebreaks ($text) { |
| 7 | | return preg_replace ("/\015\012|\015|\012/", "\n", $text); |
| | 3 | require_once('Stringparser/stringparser_bbcode.class.php'); |
| | 4 | |
| | 5 | class Jlog_Bbbcode |
| | 6 | { |
| | 7 | var $bbcode = null; |
| | 8 | var $bbcomments = null; |
| | 9 | |
| | 10 | // ZeilenumbrÃŒche verschiedener Betriebsysteme vereinheitlichen |
| | 11 | function convertlinebreaks ($text) { |
| | 12 | return preg_replace ("/\015\012|\015|\012/", "\n", $text); |
| | 13 | } |
| | 14 | |
| | 15 | // Alles bis auf Neuezeile-Zeichen entfernen |
| | 16 | function bbcode_stripcontents ($text) { |
| | 17 | return preg_replace ("/[^\n]/", '', $text); |
| | 18 | } |
| | 19 | |
| | 20 | // Sonderzeichen behandeln |
| | 21 | function special_character($text) { |
| | 22 | return str_replace("&#", "&#", $text); |
| | 23 | } |
| | 24 | |
| | 25 | function do_bbcode_url ($action, $attributes, $content, $params, $node_object) { |
| | 26 | // get URL by parameters |
| | 27 | $url = isset($attributes['default']) ? $attributes['default'] : $content; |
| | 28 | |
| | 29 | // validate URL |
| | 30 | if($action == 'validate') { |
| | 31 | // Due to Bug #146 we will only allow specific protocolls in the url |
| | 32 | // currently, these are: HTTP, FTP, News and Mailto - or relative URLs |
| | 33 | // starting with a slash |
| | 34 | if(preg_match('#^(http://|ftp://|news:|mailto:|/)#i', $url)) return true; |
| | 35 | // Some people just write www.example.org, skipping the http:// |
| | 36 | // We're going to be gentle a prefix this link with the protocoll. |
| | 37 | // However, example.org (without www) will not be recognized |
| | 38 | elseif(substr($url, 0, 4) == 'www.') return true; |
| | 39 | // all other links will be ignored |
| | 40 | return true; |
| | 41 | } |
| | 42 | // generate link |
| | 43 | else { |
| | 44 | // prefix URL with http:// if the protocoll was skipped |
| | 45 | if(substr($url, 0, 4) == 'www.') { |
| | 46 | $url = 'http://' . $url; |
| | 47 | } |
| | 48 | // in case a relative url is given without a link text, we display |
| | 49 | // the full URI as link text, not just the relative path |
| | 50 | if(!isset($attributes['default']) AND substr($url, 0, 1) == '/') { |
| | 51 | $content = (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') |
| | 52 | . $_SERVER['HTTP_HOST'] |
| | 53 | . $url; |
| | 54 | } |
| | 55 | // build link |
| | 56 | return '<a href="' . htmlspecialchars($url) . '">' . $content . '</a>'; |
| | 57 | } |
| | 58 | } |
| | 59 | |
| | 60 | // Funktion zum Einbinden von Bildern |
| | 61 | function do_bbcode_img ($action, $attributes, $content, $params, $node_object) { |
| | 62 | if ($action == 'validate') { |
| | 63 | if (isset($attributes['caption'])) { |
| | 64 | $node_object->setFlag('paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT); |
| | 65 | if ($node_object->_parent->type() == STRINGPARSER_NODE_ROOT OR |
| | 66 | in_array($node_object->_parent->_codeInfo['content_type'], array('block', 'list', 'listitem'))) { |
| | 67 | return true; |
| | 68 | } |
| | 69 | else return false; |
| | 70 | } |
| | 71 | else return true; |
| | 72 | } |
| | 73 | $title = empty($attributes["title"]) ? "" : " title='".$attributes["title"]."'"; |
| | 74 | |
| | 75 | if (isset($attributes['class']) AND isset($attributes['caption'])) $class_caption = " class='img ".htmlspecialchars($attributes['class'])."'"; |
| | 76 | elseif (isset($attributes['class'])) $class = " class='".htmlspecialchars($attributes['class'])."'"; |
| | 77 | |
| | 78 | if (strpos($content, "http://") === 0) return "<img src='".htmlspecialchars($content)."'".$class." alt='".$attributes['alt']."'".$title." />"; |
| | 79 | else { |
| | 80 | list($img_width, $img_height, $img_type, $img_attr) = @getimagesize(JLOG_BASEPATH.'/img'.DIRECTORY_SEPARATOR.htmlspecialchars($content)); |
| | 81 | $img = "<img src='".JLOG_PATH."/img/".htmlspecialchars($content)."'".$class." alt='".$attributes['alt']."' style='width: ".$img_width."px;'".$title." />"; |
| | 82 | } |
| | 83 | |
| | 84 | if(isset($attributes['caption'])) { |
| | 85 | return "\n<dl".$class_caption." style='width: ".$img_width."px;'>\n <dt>".$img."</dt>\n <dd>".$attributes['caption']."</dd>\n</dl>\n"; |
| | 86 | } |
| | 87 | else return $img; |
| | 88 | } |
| | 89 | |
| | 90 | // Funktion zum Einbinden von HTML Code, welcher vom Browser interpretiert wird |
| | 91 | function do_bbcode_html($action, $attributes, $content, $params, $node_object) { |
| | 92 | if ($action == 'validate') return true; |
| | 93 | return $content; |
| | 94 | } |
| | 95 | |
| | 96 | function forContent() |
| | 97 | { |
| | 98 | if (!empty($this->bbcode)) return &$this->bbcode; |
| | 99 | |
| | 100 | $bbcode = new StringParser_BBCode (); |
| | 101 | $bbcode->addFilter (STRINGPARSER_FILTER_PRE, 'convertlinebreaks'); |
| | 102 | $bbcode->addFilter (STRINGPARSER_FILTER_POST, 'special_character'); |
| | 103 | |
| | 104 | $bbcode->addParser (array ('block', 'inline', 'link', 'listitem'), 'htmlspecialchars'); |
| | 105 | $bbcode->addParser (array ('block', 'inline', 'link', 'listitem'), 'nl2br'); |
| | 106 | $bbcode->addParser ('list', 'bbcode_stripcontents'); |
| | 107 | $bbcode->setRootParagraphHandling (true); |
| | 108 | |
| | 109 | $bbcode->addCode ('b', 'simple_replace', null, array ('start_tag' => '<strong>', 'end_tag' => '</strong>'), |
| | 110 | 'inline', array ('listitem', 'block', 'inline', 'link'), array ()); |
| | 111 | |
| | 112 | $bbcode->addCode ('i', 'simple_replace', null, array ('start_tag' => '<em>', 'end_tag' => '</em>'), |
| | 113 | 'inline', array ('listitem', 'block', 'inline', 'link'), array ()); |
| | 114 | |
| | 115 | $bbcode->addCode ('headline', 'simple_replace', null, array('start_tag' => '<h3>', 'end_tag' => '</h3>'), |
| | 116 | 'block', array('block'), array('inline', 'link')); |
| | 117 | |
| | 118 | $bbcode->addCode ('quote', 'simple_replace', null, array('start_tag' => '<blockquote>', 'end_tag' => '</blockquote>'), |
| | 119 | 'block', array('block', 'listitem'), array('inline', 'link')); |
| | 120 | |
| | 121 | $bbcode->addCode ('url', 'usecontent?', array($this, 'do_bbcode_url'), array ('usecontent_param' => 'default'), |
| | 122 | 'link', array ('listitem', 'block', 'inline'), array ('link')); |
| | 123 | |
| | 124 | $bbcode->addCode ('img', 'usecontent', array($this, 'do_bbcode_img'), array (), |
| | 125 | 'image', array ('listitem', 'block', 'inline', 'link'), array ()); |
| | 126 | |
| | 127 | $bbcode->addCode ('html', 'usecontent', array($this, 'do_bbcode_html'), array (), |
| | 128 | 'html', array ('listitem', 'block', 'inline', 'link'), array ('image')); |
| | 129 | |
| | 130 | $bbcode->addCode ('list', 'simple_replace', null, array ('start_tag' => '<ul>', 'end_tag' => '</ul>'), |
| | 131 | 'list', array ('block', 'listitem'), array ()); |
| | 132 | |
| | 133 | $bbcode->addCode ('olist', 'simple_replace', null, array ('start_tag' => '<ol>', 'end_tag' => '</ol>'), |
| | 134 | 'list', array ('block', 'listitem'), array ()); |
| | 135 | |
| | 136 | $bbcode->addCode ('*', 'simple_replace', null, array ('start_tag' => '<li>', 'end_tag' => '</li>'), |
| | 137 | 'listitem', array ('list', 'olist' ), array ()); |
| | 138 | |
| | 139 | $bbcode->setCodeFlag ('*', 'closetag', BBCODE_CLOSETAG_OPTIONAL); |
| | 140 | $bbcode->setCodeFlag ('*', 'paragraphs', false); |
| | 141 | $bbcode->setCodeFlag ('list', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT); |
| | 142 | $bbcode->setCodeFlag ('list', 'opentag.before.newline', BBCODE_NEWLINE_DROP); |
| | 143 | $bbcode->setCodeFlag ('list', 'closetag.after.newline', BBCODE_NEWLINE_DROP); |
| | 144 | $bbcode->setCodeFlag ('olist', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT); |
| | 145 | $bbcode->setCodeFlag ('olist', 'opentag.before.newline', BBCODE_NEWLINE_DROP); |
| | 146 | $bbcode->setCodeFlag ('olist', 'closetag.before.newline', BBCODE_NEWLINE_DROP); |
| | 147 | $bbcode->setCodeFlag ('headline', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT); |
| | 148 | $bbcode->setCodeFlag ('headline', 'opentag.before.newline', BBCODE_NEWLINE_DROP); |
| | 149 | $bbcode->setCodeFlag ('headline', 'closetag.after.newline', BBCODE_NEWLINE_DROP); |
| | 150 | $bbcode->setCodeFlag ('html', 'opentag.before.newline', BBCODE_NEWLINE_DROP); |
| | 151 | $bbcode->setCodeFlag ('html', 'closetag.after.newline', BBCODE_NEWLINE_DROP); |
| | 152 | $bbcode->setCodeFlag ('quote', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT); |
| | 153 | $bbcode->setCodeFlag ('quote', 'paragraphs', true); |
| | 154 | $bbcode->setCodeFlag ('quote', 'opentag.before.newline', BBCODE_NEWLINE_DROP); |
| | 155 | $bbcode->setCodeFlag ('quote', 'closetag.after.newline', BBCODE_NEWLINE_DROP); |
| | 156 | |
| | 157 | $this->bbcode = &$bbcode; |
| | 158 | return $this->bbcode; |
| | 159 | } |
| | 160 | |
| | 161 | function forCommtents() |
| | 162 | { |
| | 163 | if (!empty($this->bbcomments)) return &$this->bbcomments; |
| | 164 | |
| | 165 | // BBCode for comments |
| | 166 | $bbcomments = new StringParser_BBCode (); |
| | 167 | $bbcomments->addFilter (STRINGPARSER_FILTER_PRE, 'convertlinebreaks'); |
| | 168 | $bbcomments->addFilter (STRINGPARSER_FILTER_POST, 'special_character'); |
| | 169 | |
| | 170 | $bbcomments->addParser (array ('block', 'inline', 'link'), 'htmlspecialchars'); |
| | 171 | $bbcomments->addParser (array ('block', 'inline', 'link'), 'nl2br'); |
| | 172 | $bbcomments->setRootParagraphHandling (true); |
| | 173 | |
| | 174 | $bbcomments->addCode ('b', 'simple_replace', null, array ('start_tag' => '<strong>', 'end_tag' => '</strong>'), |
| | 175 | 'inline', array ('block', 'inline', 'link'), array ()); |
| | 176 | $bbcomments->addCode ('i', 'simple_replace', null, array ('start_tag' => '<em>', 'end_tag' => '</em>'), |
| | 177 | 'inline', array ('block', 'inline', 'link'), array ()); |
| | 178 | $bbcomments->addCode ('url', 'usecontent?', array($this, 'do_bbcode_url'), array ('usecontent_param' => 'default'), |
| | 179 | 'link', array ('block', 'inline'), array ('link')); |
| | 180 | $bbcomments->addCode ('quote', 'simple_replace', null, array('start_tag' => '<blockquote>', 'end_tag' => '</blockquote>'), |
| | 181 | 'block', array('block'), array('inline', 'link')); |
| | 182 | |
| | 183 | $bbcomments->setCodeFlag ('quote', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT); |
| | 184 | $bbcomments->setCodeFlag ('quote', 'paragraphs', true); |
| | 185 | $bbcomments->setCodeFlag ('quote', 'opentag.before.newline', BBCODE_NEWLINE_DROP); |
| | 186 | $bbcomments->setCodeFlag ('quote', 'closetag.after.newline', BBCODE_NEWLINE_DROP); |
| | 187 | |
| | 188 | $this->bbcomments = &$bbcomments; |
| | 189 | return &$this->bbcomments; |
| | 190 | } |
| | 191 | |
| | 192 | /** |
| | 193 | * Registers this class in the global $JLOG array |
| | 194 | * |
| | 195 | * @access public |
| | 196 | * @return void |
| | 197 | **/ |
| | 198 | function registerGlobal() |
| | 199 | { |
| | 200 | global $JLOG; |
| | 201 | $JLOG['bbcode'] = &$this; |
| | 202 | } |
| 10 | | // Alles bis auf Neuezeile-Zeichen entfernen |
| 11 | | function bbcode_stripcontents ($text) { |
| 12 | | return preg_replace ("/[^\n]/", '', $text); |
| 13 | | } |
| 14 | | |
| 15 | | // Sonderzeichen behandeln |
| 16 | | function special_character($text) { |
| 17 | | return str_replace("&#", "&#", $text); |
| 18 | | } |
| 19 | | |
| 20 | | function do_bbcode_url ($action, $attributes, $content, $params, $node_object) { |
| 21 | | // get URL by parameters |
| 22 | | $url = isset($attributes['default']) ? $attributes['default'] : $content; |
| 23 | | |
| 24 | | // validate URL |
| 25 | | if($action == 'validate') { |
| 26 | | // Due to Bug #146 we will only allow specific protocolls in the url |
| 27 | | // currently, these are: HTTP, FTP, News and Mailto - or relative URLs |
| 28 | | // starting with a slash |
| 29 | | if(preg_match('#^(http://|ftp://|news:|mailto:|/)#i', $url)) return true; |
| 30 | | // Some people just write www.example.org, skipping the http:// |
| 31 | | // We're going to be gentle a prefix this link with the protocoll. |
| 32 | | // However, example.org (without www) will not be recognized |
| 33 | | elseif(substr($url, 0, 4) == 'www.') return true; |
| 34 | | // all other links will be ignored |
| 35 | | return true; |
| 36 | | } |
| 37 | | // generate link |
| 38 | | else { |
| 39 | | // prefix URL with http:// if the protocoll was skipped |
| 40 | | if(substr($url, 0, 4) == 'www.') { |
| 41 | | $url = 'http://' . $url; |
| 42 | | } |
| 43 | | // in case a relative url is given without a link text, we display |
| 44 | | // the full URI as link text, not just the relative path |
| 45 | | if(!isset($attributes['default']) AND substr($url, 0, 1) == '/') { |
| 46 | | $content = (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') |
| 47 | | . $_SERVER['HTTP_HOST'] |
| 48 | | . $url; |
| 49 | | } |
| 50 | | // build link |
| 51 | | return '<a href="' . htmlspecialchars($url) . '">' . $content . '</a>'; |
| 52 | | } |
| 53 | | } |
| 54 | | |
| 55 | | // Funktion zum Einbinden von Bildern |
| 56 | | function do_bbcode_img ($action, $attributes, $content, $params, $node_object) { |
| 57 | | if ($action == 'validate') { |
| 58 | | if (isset($attributes['caption'])) { |
| 59 | | $node_object->setFlag('paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT); |
| 60 | | if ($node_object->_parent->type() == STRINGPARSER_NODE_ROOT OR |
| 61 | | in_array($node_object->_parent->_codeInfo['content_type'], array('block', 'list', 'listitem'))) { |
| 62 | | return true; |
| 63 | | } |
| 64 | | else return false; |
| 65 | | } |
| 66 | | else return true; |
| 67 | | } |
| 68 | | $title = empty($attributes["title"]) ? "" : " title='".$attributes["title"]."'"; |
| 69 | | |
| 70 | | if (isset($attributes['class']) AND isset($attributes['caption'])) $class_caption = " class='img ".htmlspecialchars($attributes['class'])."'"; |
| 71 | | elseif (isset($attributes['class'])) $class = " class='".htmlspecialchars($attributes['class'])."'"; |
| 72 | | |
| 73 | | if (strpos($content, "http://") === 0) return "<img src='".htmlspecialchars($content)."'".$class." alt='".$attributes['alt']."'".$title." />"; |
| 74 | | else { |
| 75 | | list($img_width, $img_height, $img_type, $img_attr) = @getimagesize(JLOG_BASEPATH.'/img'.DIRECTORY_SEPARATOR.htmlspecialchars($content)); |
| 76 | | $img = "<img src='".JLOG_PATH."/img/".htmlspecialchars($content)."'".$class." alt='".$attributes['alt']."' style='width: ".$img_width."px;'".$title." />"; |
| 77 | | } |
| 78 | | |
| 79 | | if(isset($attributes['caption'])) { |
| 80 | | return "\n<dl".$class_caption." style='width: ".$img_width."px;'>\n <dt>".$img."</dt>\n <dd>".$attributes['caption']."</dd>\n</dl>\n"; |
| 81 | | } |
| 82 | | else return $img; |
| 83 | | } |
| 84 | | |
| 85 | | // Funktion zum Einbinden von HTML Code, welcher vom Browser interpretiert wird |
| 86 | | function do_bbcode_html($action, $attributes, $content, $params, $node_object) { |
| 87 | | if ($action == 'validate') return true; |
| 88 | | return $content; |
| 89 | | } |
| 90 | | |
| 91 | | $bbcode = new StringParser_BBCode (); |
| 92 | | $bbcode->addFilter (STRINGPARSER_FILTER_PRE, 'convertlinebreaks'); |
| 93 | | $bbcode->addFilter (STRINGPARSER_FILTER_POST, 'special_character'); |
| 94 | | |
| 95 | | $bbcode->addParser (array ('block', 'inline', 'link', 'listitem'), 'htmlspecialchars'); |
| 96 | | $bbcode->addParser (array ('block', 'inline', 'link', 'listitem'), 'nl2br'); |
| 97 | | $bbcode->addParser ('list', 'bbcode_stripcontents'); |
| 98 | | $bbcode->setRootParagraphHandling (true); |
| 99 | | |
| 100 | | $bbcode->addCode ('b', 'simple_replace', null, array ('start_tag' => '<strong>', 'end_tag' => '</strong>'), |
| 101 | | 'inline', array ('listitem', 'block', 'inline', 'link'), array ()); |
| 102 | | |
| 103 | | $bbcode->addCode ('i', 'simple_replace', null, array ('start_tag' => '<em>', 'end_tag' => '</em>'), |
| 104 | | 'inline', array ('listitem', 'block', 'inline', 'link'), array ()); |
| 105 | | |
| 106 | | $bbcode->addCode ('headline', 'simple_replace', null, array('start_tag' => '<h3>', 'end_tag' => '</h3>'), |
| 107 | | 'block', array('block'), array('inline', 'link')); |
| 108 | | |
| 109 | | $bbcode->addCode ('quote', 'simple_replace', null, array('start_tag' => '<blockquote>', 'end_tag' => '</blockquote>'), |
| 110 | | 'block', array('block', 'listitem'), array('inline', 'link')); |
| 111 | | |
| 112 | | $bbcode->addCode ('url', 'usecontent?', 'do_bbcode_url', array ('usecontent_param' => 'default'), |
| 113 | | 'link', array ('listitem', 'block', 'inline'), array ('link')); |
| 114 | | |
| 115 | | $bbcode->addCode ('img', 'usecontent', 'do_bbcode_img', array (), |
| 116 | | 'image', array ('listitem', 'block', 'inline', 'link'), array ()); |
| 117 | | |
| 118 | | $bbcode->addCode ('html', 'usecontent', 'do_bbcode_html', array (), |
| 119 | | 'html', array ('listitem', 'block', 'inline', 'link'), array ('image')); |
| 120 | | |
| 121 | | $bbcode->addCode ('list', 'simple_replace', null, array ('start_tag' => '<ul>', 'end_tag' => '</ul>'), |
| 122 | | 'list', array ('block', 'listitem'), array ()); |
| 123 | | |
| 124 | | $bbcode->addCode ('olist', 'simple_replace', null, array ('start_tag' => '<ol>', 'end_tag' => '</ol>'), |
| 125 | | 'list', array ('block', 'listitem'), array ()); |
| 126 | | |
| 127 | | $bbcode->addCode ('*', 'simple_replace', null, array ('start_tag' => '<li>', 'end_tag' => '</li>'), |
| 128 | | 'listitem', array ('list', 'olist' ), array ()); |
| 129 | | |
| 130 | | $bbcode->setCodeFlag ('*', 'closetag', BBCODE_CLOSETAG_OPTIONAL); |
| 131 | | $bbcode->setCodeFlag ('*', 'paragraphs', false); |
| 132 | | $bbcode->setCodeFlag ('list', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT); |
| 133 | | $bbcode->setCodeFlag ('list', 'opentag.before.newline', BBCODE_NEWLINE_DROP); |
| 134 | | $bbcode->setCodeFlag ('list', 'closetag.after.newline', BBCODE_NEWLINE_DROP); |
| 135 | | $bbcode->setCodeFlag ('olist', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT); |
| 136 | | $bbcode->setCodeFlag ('olist', 'opentag.before.newline', BBCODE_NEWLINE_DROP); |
| 137 | | $bbcode->setCodeFlag ('olist', 'closetag.before.newline', BBCODE_NEWLINE_DROP); |
| 138 | | $bbcode->setCodeFlag ('headline', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT); |
| 139 | | $bbcode->setCodeFlag ('headline', 'opentag.before.newline', BBCODE_NEWLINE_DROP); |
| 140 | | $bbcode->setCodeFlag ('headline', 'closetag.after.newline', BBCODE_NEWLINE_DROP); |
| 141 | | $bbcode->setCodeFlag ('html', 'opentag.before.newline', BBCODE_NEWLINE_DROP); |
| 142 | | $bbcode->setCodeFlag ('html', 'closetag.after.newline', BBCODE_NEWLINE_DROP); |
| 143 | | $bbcode->setCodeFlag ('quote', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT); |
| 144 | | $bbcode->setCodeFlag ('quote', 'paragraphs', true); |
| 145 | | $bbcode->setCodeFlag ('quote', 'opentag.before.newline', BBCODE_NEWLINE_DROP); |
| 146 | | $bbcode->setCodeFlag ('quote', 'closetag.after.newline', BBCODE_NEWLINE_DROP); |
| 147 | | |
| 148 | | // BBCode for comments |
| 149 | | $bbcomments = new StringParser_BBCode (); |
| 150 | | $bbcomments->addFilter (STRINGPARSER_FILTER_PRE, 'convertlinebreaks'); |
| 151 | | $bbcomments->addFilter (STRINGPARSER_FILTER_POST, 'special_character'); |
| 152 | | |
| 153 | | $bbcomments->addParser (array ('block', 'inline', 'link'), 'htmlspecialchars'); |
| 154 | | $bbcomments->addParser (array ('block', 'inline', 'link'), 'nl2br'); |
| 155 | | $bbcomments->setRootParagraphHandling (true); |
| 156 | | |
| 157 | | $bbcomments->addCode ('b', 'simple_replace', null, array ('start_tag' => '<strong>', 'end_tag' => '</strong>'), |
| 158 | | 'inline', array ('block', 'inline', 'link'), array ()); |
| 159 | | $bbcomments->addCode ('i', 'simple_replace', null, array ('start_tag' => '<em>', 'end_tag' => '</em>'), |
| 160 | | 'inline', array ('block', 'inline', 'link'), array ()); |
| 161 | | $bbcomments->addCode ('url', 'usecontent?', 'do_bbcode_url', array ('usecontent_param' => 'default'), |
| 162 | | 'link', array ('block', 'inline'), array ('link')); |
| 163 | | $bbcomments->addCode ('quote', 'simple_replace', null, array('start_tag' => '<blockquote>', 'end_tag' => '</blockquote>'), |
| 164 | | 'block', array('block'), array('inline', 'link')); |
| 165 | | |
| 166 | | $bbcomments->setCodeFlag ('quote', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT); |
| 167 | | $bbcomments->setCodeFlag ('quote', 'paragraphs', true); |
| 168 | | $bbcomments->setCodeFlag ('quote', 'opentag.before.newline', BBCODE_NEWLINE_DROP); |
| 169 | | $bbcomments->setCodeFlag ('quote', 'closetag.after.newline', BBCODE_NEWLINE_DROP); |
| 170 | | |