No external Links in comments

Found a bug? Tell us!!
Post Reply
Tscherno
Regular
Posts: 17
Joined: Wed Oct 19, 2005 1:13 pm
Contact:

No external Links in comments

Post by Tscherno »

URLs in Comments are not clickable for me... But the option is set to make them clickable...
MySchizoBuddy
Regular
Posts: 340
Joined: Sun Jun 12, 2005 5:28 am

Post by MySchizoBuddy »

html inside comments isn't allowed. you will need BBcode and use the [url] tag.
Image
Tscherno
Regular
Posts: 17
Joined: Wed Oct 19, 2005 1:13 pm
Contact:

Post by Tscherno »

Isn't it possible to automatically make the Links clickable?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

You would need to write a HTTP link code parser. My experience is that it only works in 60% of all cases and does more bad then good by transforming links that are no links.

BBCode is the common way to go.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Tscherno
Regular
Posts: 17
Joined: Wed Oct 19, 2005 1:13 pm
Contact:

Post by Tscherno »

This should it do:
function make_urls($messagetext)
{
var $urlSearchArray, $urlReplaceArray;

$urlSearchArray = array(
"/([^]_a-z0-9-=\"'\/])((https?|ftp|gopher|news|telnet):\/\/|www\.)([^ \r\n\(\)\^\$!`\"'\|\[\]\{\}<>]*)/si",
"/^((https?|ftp|gopher|news|telnet):\/\/|www\.)([^ \r\n\(\)\^\$!`\"'\|\[\]\{\}<>]*)/si"

$urlReplaceArray = array(
'\\1<a href="\\2\\4" target="_blank">\\2\\4</a>',
'<a href="\\1\\3" target="_blank">\\1\\3</a>'
);


$text = preg_replace($urlSearchArray, $urlReplaceArray, $messagetext);

return $text;

}
Should i package it in an textformatting plugin?
Post Reply