Create automatic links with www. only [message #15045] |
Sun, 30 November 2003 17:13 |
Squeebee
Messages: 110 Registered: November 2003
Karma: 0
|
Senior Member |
|
|
Hi There;
It appears fudforum will only create a hyperlink automatically when it finds http:// leading URLs. I think it would be beneficial if www. was also used to auto-create a link, as many board users to not apply http:// to the start of links.
|
|
|
Re: Create automatic links with www. only [message #15052 is a reply to message #15045] |
Sun, 30 November 2003 21:27 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
I've made [url] tags handle this situation, however parsing plain text urls from www. would be to slow and inacurate "www" is often used with no reference to a url and www. would result in a false url.
FUDforum Core Developer
|
|
|
|
|
|
Re: Create automatic links with www. only [message #15076 is a reply to message #15060] |
Mon, 01 December 2003 14:10 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
If you want to do it you can do so by adding:
$str = preg_replace('!(^|\s)(www\.[A-Za-z0-9_]+\.[A-Za-z]+([^\s]?))!i','\1http://\2', $str);
To the top of tags_to_html() function inside post_proc.inc.t. However at this time I am not convinced it is needed in the standard forum distribution.
FUDforum Core Developer
|
|
|
Re: Create automatic links with www. only [message #15086 is a reply to message #15076] |
Mon, 01 December 2003 22:32 |
melvyn
Messages: 7 Registered: December 2003 Location: Hilversum, The Netherland...
Karma: 0
|
Junior Member |
|
|
_ aren't allowed in domains (long discussion about '_' being used in RR records) but '-' are
[^\s] = \S
[A-Za-z] with /i is redundant
www.country.domain.tld isn't recognized
tld needs a minimum of 2 and I think a max of 6 (.museum) which can be used as an anchor point.
resulting in:
$str = preg_replace('!(^|\s)(www\.[A-Za-z0-9.-]+\.[A-Za-z]{2,6})!','\1http://\2', $str);
Melvyn
[Updated on: Mon, 01 December 2003 22:33] Report message to a moderator
|
|
|
|
|
Re: Create automatic links with www. only [message #15090 is a reply to message #15089] |
Tue, 02 December 2003 00:13 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
melvyn wrote on Mon, 01 December 2003 18:57 | right - [wW]{3}
|
good point.
Btw while tld has a maximum number of chars, you'll still want to support query & paths so you need ([\S]*) at the end.
FUDforum Core Developer
|
|
|