Making URLs as author in QUOTE BBCode clickable

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Scam Warning
Locked
CarolC1
Registered User
Posts: 624
Joined: Sat Dec 02, 2006 4:26 pm

Making URLs as author in QUOTE BBCode clickable

Post by CarolC1 »

It would be wonderful if this could be standard. :D

I frequently post information in a quote and use the url of the source as the author. It is not clickable unless I put spaces before and after the url, and I always have to monkey with it to get it to work. It would be great to have it clickable without inserting spaces...

With spaces in the link:

Code: Select all

[quote=" http://www.thisisalink.php "]This is the information I am quoting and I want my readers to be able to just click the link to read more or verify my source if they like.[/quote]
http://www.thisisalink.php wrote:This is the information I am quoting and I want my readers to be able to just click the link to read more or verify my source if they like.
Without spaces in the link:

Code: Select all

[quote="http://www.thisisalink.php"]This is the information I am quoting and I want my readers to be able to just click the link to read more or verify my source if they like.[/quote]
http://www.thisisalink.php wrote:This is the information I am quoting and I want my readers to be able to just click the link to read more or verify my source if they like.
Many users don't even know you can make it clickable because you have to make an extra effort to render it clickable.
Last edited by CarolC1 on Wed Jul 13, 2011 3:17 pm, edited 1 time in total.
User avatar
AmigoJack
Registered User
Posts: 5937
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Make links clickable in quotes

Post by AmigoJack »

Open /includes/functions_content.php and find:

Code: Select all

        // relative urls for this board
        $magic_url_match[] = '#(^|[\n\t (>.])(' . preg_quote($server_url, '#') . ')/(' . get_preg_expression('relative_url_inline') . ')#ie';
        $magic_url_replace[] = "make_clickable_callback(MAGIC_URL_LOCAL, '\$1', '\$2', '\$3', '$local_class')";

        // matches a xxxx://aaaaa.bbb.cccc. ...
        $magic_url_match[] = '#(^|[\n\t (>.])(' . get_preg_expression('url_inline') . ')#ie';
        $magic_url_replace[] = "make_clickable_callback(MAGIC_URL_FULL, '\$1', '\$2', '', '$class')"; 
Change to (adding two semicolons):

Code: Select all

        // relative urls for this board
        $magic_url_match[] = '#(^|[\n\t (>.;])(' . preg_quote($server_url, '#') . ')/(' . get_preg_expression('relative_url_inline') . ')#ie';
        $magic_url_replace[] = "make_clickable_callback(MAGIC_URL_LOCAL, '\$1', '\$2', '\$3', '$local_class')";

        // matches a xxxx://aaaaa.bbb.cccc. ...
        $magic_url_match[] = '#(^|[\n\t (>.;])(' . get_preg_expression('url_inline') . ')#ie';
        $magic_url_replace[] = "make_clickable_callback(MAGIC_URL_FULL, '\$1', '\$2', '', '$class')"; 
Tested. Originally you only have to use a leading whitespace, whereas the trailing whitespace doesn't matter.

Technical background: converting URLs into clickable links kicks in while parsing quote tags, which during that time carry HTML entities, so at that point you have something like this:

Code: Select all

[quote="http://www.phpbb.com":2htjkmj6]phpBB[/quote:2htjkmj6]
...and the URL is not detected, because the semicolon is not considered as a boundary. Using one of the expected characters (linebreak, tab, whitespace, opening round bracket, closing angle bracket, dot) in front of your URL is expected, so your "trick" with a leading whitespace makes it work.

Can you please change the topic title to a more precise one, like "Making URLs as author in QUOTE BBCode clickable"?
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
CarolC1
Registered User
Posts: 624
Joined: Sat Dec 02, 2006 4:26 pm

Re: Making URLs as author in QUOTE BBCode clickable

Post by CarolC1 »

Thankyouthankyouthankyou! :D It works brilliantly. It is so much easier this way. This is such a nice feature, maybe you can talk to somebody and see if they'll include it?? It is definitely going to be on our board. Thank you again!!! :D

P.S. Changed the subject line as requested. Thanks!
User avatar
AmigoJack
Registered User
Posts: 5937
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Making URLs as author in QUOTE BBCode clickable

Post by AmigoJack »

CarolC1 wrote:see if they'll include it
Hmm... why not? Created a ticket. :)
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
Locked

Return to “[3.0.x] MOD Requests”