Skip to content

Commit dec8e8f

Browse files
committed
Links in the comment field of parts, are working now.
1 parent 092fdd8 commit dec8e8f

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

lib/Part.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,10 @@ public function getComment($parse_bbcode = true)
317317
$val = htmlspecialchars($this->db_data['comment']);
318318
if ($parse_bbcode) {
319319
$bbcode = new BBCodeParser;
320+
$bbcode->setParser('brLinebreak', "/\[br\]/s", "<br/>", "");
321+
$bbcode->setParser('namedlink', '/\[url\=(.*?)\](.*?)\[\/url\]/s', '<a href="$1" class="link-external" target="_blank">$2</a>', '$2');
322+
$bbcode->setParser('link', '/\[url\](.*?)\[\/url\]/s', '<a href="$1" class="link-external" target="_blank">$1</a>', '$1');
323+
320324
$val = $bbcode->parse($val);
321325
}
322326

startup.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,6 @@
213213
if (! $fatal_error) {
214214
$bbcode = new \Golonka\BBCode\BBCodeParser();
215215
$bbcode->setParser('brLinebreak', "/\[br\]/s", "<br/>", "");
216-
/*$bbcode->parsers['link'] = [
217-
'pattern' => '/\[url\](.*?)\[\/url\]/s',
218-
'replace' => '<a href="$1" class="link-external">$1</a>',
219-
'content' => '$1'
220-
];
221-
$bbcode->parsers['namedlink'] = [
222-
'pattern' => '/\[url\=(.*?)\](.*?)\[\/url\]/s',
223-
'replace' => '<a href="$1" class="link-external">$2</a>',
224-
'content' => '$2'
225-
];*/
226216
$bbcode->setParser('namedlink', '/\[url\=(.*?)\](.*?)\[\/url\]/s', '<a href="$1" class="link-external" target="_blank">$2</a>', '$2');
227217
$bbcode->setParser('link', '/\[url\](.*?)\[\/url\]/s', '<a href="$1" class="link-external" target="_blank">$1</a>', '$1');
228218
$str = $bbcode->parse(htmlspecialchars($config['startup']['custom_banner']));

0 commit comments

Comments
 (0)