FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » FUDforum Suggestions » Create automatic links with www. only
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Create automatic links with www. only [message #15045] Sun, 30 November 2003 17:13 Go to next message
Squeebee is currently offline  Squeebee   Canada
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 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
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 #15056 is a reply to message #15045] Sun, 30 November 2003 22:04 Go to previous messageGo to next message
Squeebee is currently offline  Squeebee   Canada
Messages: 110
Registered: November 2003
Karma: 0
Senior Member
I can understand that, I am just looking at things from the point of view of my users. They have become accustomed with having www. strings converted to URLs.

That being said, I cannot think of many situations where www. would produce a false positive, as there are not any non-URL situations where you would encounter the string www.
Re: Create automatic links with www. only [message #15057 is a reply to message #15056] Sun, 30 November 2003 22:11 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Most urls are pasted, and thus already have http:// or equivalent prefix. Even when not pasting many people use the http:// prefix, so I do not see this as a critial issue.

FUDforum Core Developer
Re: Create automatic links with www. only [message #15060 is a reply to message #15056] Mon, 01 December 2003 05:00 Go to previous messageGo to next message
melvyn is currently offline  melvyn   Netherlands
Messages: 7
Registered: December 2003
Location: Hilversum, The Netherland...
Karma: 0
Junior Member
Squeebee geschreven op zo, 30 november 2003 23:04


That being said, I cannot think of many situations where www. would produce a false positive, as there are not any non-URL situations where you would encounter the string www.


awwww, you can't? Shocked


Melvyn
Re: Create automatic links with www. only [message #15076 is a reply to message #15060] Mon, 01 December 2003 14:10 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
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 Go to previous messageGo to next message
melvyn is currently offline  melvyn   Netherlands
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 #15087 is a reply to message #15086] Mon, 01 December 2003 23:04 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
The 'i' flag is needed for "www".



FUDforum Core Developer
Re: Create automatic links with www. only [message #15089 is a reply to message #15087] Mon, 01 December 2003 23:57 Go to previous messageGo to next message
melvyn is currently offline  melvyn   Netherlands
Messages: 7
Registered: December 2003
Location: Hilversum, The Netherland...
Karma: 0
Junior Member
right - [wW]{3} Wink

Melvyn
Re: Create automatic links with www. only [message #15090 is a reply to message #15089] Tue, 02 December 2003 00:13 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
melvyn wrote on Mon, 01 December 2003 18:57

right - [wW]{3} Wink


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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Private message commands at top of page
Next Topic: Cmd line installer.
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 29 16:21:24 GMT 2024

Total time taken to generate the page: 0.04428 seconds