Fix link regex

main
Pk11 2 years ago
parent 2e26a99dcf
commit a33abd8758

@ -285,7 +285,7 @@
if(!empty($row['comment'])) { if(!empty($row['comment'])) {
$comment = $row['comment']; $comment = $row['comment'];
$comment = preg_replace('/^&gt;(?!&gt;\d).+/m', '<strong class="quote">$0</strong>', $comment); $comment = preg_replace('/^&gt;(?!&gt;\d).+/m', '<strong class="quote">$0</strong>', $comment);
$comment = preg_replace('/(?:https?|mailto|tel|ftp):[^\s,]+/m', '<a href="$0" target="_blank">$0</a>', $comment); $comment = preg_replace('/(?:https?|mailto|tel|ftp):.+?(?=\s|,|&lt;|<|$)/m', '<a href="$0" target="_blank">$0</a>', $comment);
$comment = preg_replace_callback('/&gt;&gt;\s*(\d+)/', 'quote_link', $comment); $comment = preg_replace_callback('/&gt;&gt;\s*(\d+)/', 'quote_link', $comment);
$comment = str_replace("\n", "<br />", $comment); $comment = str_replace("\n", "<br />", $comment);
echo "<div>$comment</div>"; echo "<div>$comment</div>";

Loading…
Cancel
Save