Clickable links in [code] bbcode

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
Petter89
Registered User
Posts: 11
Joined: Sat Jan 20, 2007 11:14 am

Clickable links in [code] bbcode

Post by Petter89 » Sun Apr 05, 2009 11:07 am

Hi,

Is it possible to make links inside the tags clickable?

Thanks a lot

user751139
Registered User
Posts: 86
Joined: Thu Oct 01, 2009 2:46 am

Re: Clickable links in [code] bbcode

Post by user751139 » Tue Jan 11, 2011 5:33 am

I hate to bump an old thread but is this possible?

User avatar
AmigoJack
Registered User
Posts: 5656
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Clickable links in [code] bbcode

Post by AmigoJack » Tue Jan 11, 2011 7:36 am

Open /includes/message_parser.php and find:

Code: Select all

        if ($code_block)
        {
            $code_block = substr($code_block, 0, -7);
            $code_block = preg_replace($htm_match, $htm_replace, $code_block);

            $out .= $this->bbcode_parse_code($stx, $code_block);
        } 
Below, add:

Code: Select all

        $out= make_clickable( str_replace( array( ':', '.' ), array( ':', '.' ), $out ), generate_board_url() ); 
Tested.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
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.

User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: Clickable links in [code] bbcode

Post by 4_seven » Tue Jan 11, 2011 11:42 am

see next post quote..
Last edited by 4_seven on Tue Jan 11, 2011 9:11 pm, edited 1 time in total.
Current Mods | Mod Base | php(BB) programming | No help via PM

User avatar
AmigoJack
Registered User
Posts: 5656
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Clickable links in [code] bbcode

Post by AmigoJack » Tue Jan 11, 2011 12:33 pm

4_seven wrote:alternative you can use
[Snippet] Make Links clickable in

Code: Select all

 Tags (en)
http://4seven.kilu.de/forum/phpbb3/viewtopic.php?p=1773#p1773[/quote]That implementation[list]
[*]does not recognize e-mails links, links with login data, links with IPv6, links with ports (too restrictive),
[*]does not recognize links with commas, pluses and other characters (it would even not take [c]http://4seven.kilu.de/forum/phpbb3/viewtopic.php?f=20&t=575&hilit=make+links+clickable[/c]),
[*]has a logically faulty regexp ([c]&[/c] or duplicate ranges),
[*]does not use already existing phpBB code (so future code fixes will leave this code untouched),
[*]uses single quotes for HTML tag values (which is not forbidden but usually indicates knowledge deficits),
[*]does not insert appropriate CSS class attributes and in turn
[*]does not distinct between local and remote links.[/list]But yes, it's an alternative.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
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.

User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: Clickable links in [code] bbcode

Post by 4_seven » Tue Jan 11, 2011 9:06 pm

does not recognize e-mails links, links with login data, links with IPv6, links with ports (too restrictive)
sorry, works with all kinds of links and the sensitivity is adjustable too,
not static as in the board functions.
see http://www.4seven.de/forum/1/viewtopic.php?p=397#p397
and the user ask for links, so who the fu** want email-adresses in code-tags.
has a logically faulty regexp (& or duplicate ranges),
that is no fault, it's a feature, so made by design.
does not use already existing phpBB code (so future code fixes will leave this code untouched),
better way (for me) to make this function independence. sometimes board-functions are better, sometimes not ;)
does not insert appropriate CSS class attributes and in turn
shure, see demo. normal link behaviour and colours.
does not distinct between local and remote links.
also a feature. so many people ask me for making links homogeneous
which is not forbidden but usually indicates knowledge deficits
Sorry for laughing, but it gives no rules about that in w3c (u can make it, as you want, no joke. ask w3c.) and the part with the 'knowledge deficits', thats simply an abusing bullshit. i build that snippet for a user-request in a short time and develope this not further and for him and several others it works 100%
Last edited by 4_seven on Thu Jan 13, 2011 5:54 pm, edited 4 times in total.
Current Mods | Mod Base | php(BB) programming | No help via PM

user751139
Registered User
Posts: 86
Joined: Thu Oct 01, 2009 2:46 am

Re: Clickable links in [code] bbcode

Post by user751139 » Wed Jan 12, 2011 6:06 am

AmigoJack wrote:Open /includes/message_parser.php and find:

Code: Select all

        if ($code_block)
        {
            $code_block = substr($code_block, 0, -7);
            $code_block = preg_replace($htm_match, $htm_replace, $code_block);

            $out .= $this->bbcode_parse_code($stx, $code_block);
        } 
Below, add:

Code: Select all

        $out= make_clickable( str_replace( array( ':', '.' ), array( ':', '.' ), $out ), generate_board_url() ); 
Tested.
hmm that's strange! After i did the edit i got this when I tried to make a new topic; Also previous topics with links in the Code tag still wasn't clickable

Code: Select all

 Your message contains too few characters‎



When i removed the edit my forum went back to normal and i was able to post :shock:

also your anti-bot question: seventeen minus 3 plus 10 - 13 = : 11 <-- not taking the correct answer :shock:

User avatar
AmigoJack
Registered User
Posts: 5656
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Clickable links in [code] bbcode

Post by AmigoJack » Wed Jan 12, 2011 7:35 am

user751139 wrote:when I tried to make a new topic; Also previous topics with links in the Code tag still wasn't clickable

Code: Select all

 Your message contains too few characters‎
Cannot confirm both: I'm able to create new topics and also post a message with clickable links in code tags. Either you did something wrong or another modification is interfering. Also note I'm talking about version 3.0.8.
user751139 wrote:also your anti-bot question
What do you mean by that?
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
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.

user751139
Registered User
Posts: 86
Joined: Thu Oct 01, 2009 2:46 am

Re: Clickable links in [code] bbcode

Post by user751139 » Fri Jan 14, 2011 6:53 pm

AmigoJack wrote:
user751139 wrote:when I tried to make a new topic; Also previous topics with links in the Code tag still wasn't clickable

Code: Select all

 Your message contains too few characters‎
Cannot confirm both: I'm able to create new topics and also post a message with clickable links in code tags. Either you did something wrong or another modification is interfering. Also note I'm talking about version 3.0.8.
user751139 wrote:also your anti-bot question
What do you mean by that?
I removed some of the mods, now after the edit I dont get any errors! but still there's no effect in the code links. Do you have a demo where i can see it in action?

About your anti-bot questions; I was referring to your sites registration page, it's not taking the answer

User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: Clickable links in [code] bbcode

Post by 4_seven » Fri Jan 14, 2011 7:35 pm

seventeen minus 3 plus 10 - 13 px = ?
what do u mean is the answer?
11 px
or
ele... px
;)
Current Mods | Mod Base | php(BB) programming | No help via PM

User avatar
AmigoJack
Registered User
Posts: 5656
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Clickable links in [code] bbcode

Post by AmigoJack » Sat Jan 15, 2011 10:16 am

@4_seven: now I cannot even read the post of your first link - the board requires a login. My whole reply was based on the modification instructions I've read, I never make things up. Now I even have no chance to make them all to a vanilla install of 3.0.8 just to prove you or me. Also I don't get why you're reacting emotionally, not impartially - who said I would do everything right - who guarantees you do everything right? Give me an account so I can both read your original instructions and also give all my examples a try on your board in the testing topic - that might clear up everything. To give a basic idea - these are all supported by phpBB natively:
http://FFFE:12AE::0000/thats/IPv6.html
http://user:pass@www.university.com/with/logindata
http://www.alternative.net:8080/port
user@host.net


@user751139: I have no demo. I tested my modifications on a vanilla install of 3.0.8. It affects all posts created after the modification. You'd have to reparse all existing posts to also affect those.
Last edited by AmigoJack on Sun Jan 16, 2011 4:28 pm, edited 1 time in total.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
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.

User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: Clickable links in [code] bbcode

Post by 4_seven » Sat Jan 15, 2011 11:23 pm

Hi Jack,

no doubt, my code works recursive (on the fly). and shure, it makes no sense, to mess witch each others. only thing missing is mailto and ipv6, but it's no problem for me. I post it later, so you can take a look.
Current Mods | Mod Base | php(BB) programming | No help via PM

User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: Clickable links in [code] bbcode

Post by 4_seven » Sun Jan 16, 2011 5:00 pm

4seven enterprises proudly presents the "top of the pop version" of

Make Links clickable in [ code ] Tags

open

includes/bbcode.php

find

Code: Select all

$code = $this->bbcode_tpl('code_open') . $code . $this->bbcode_tpl('code_close');   
before add

Code: Select all

// Make Links clickable in [code] Tags / AmigoJack / 4seven / 2011
$code = make_clickable( str_replace( array( '&#58;', '&#46;' ), array( ':', '.' ), $code ), generate_board_url() ); 
// Make Links clickable in [code] Tags / AmigoJack / 4seven / 2011             
Demo:
http://www.4seven.de/forum/1/viewtopic.php?p=389#p389

Features:
- Works recursive (no re-parsing needed)
- "Recognize e-mails links, links with login data, links with IPv6, links with ports"
- "Use already existing phpBB code"
Current Mods | Mod Base | php(BB) programming | No help via PM

user751139
Registered User
Posts: 86
Joined: Thu Oct 01, 2009 2:46 am

Re: Clickable links in [code] bbcode

Post by user751139 » Fri Mar 25, 2011 12:45 pm

Hi sorry to bump this but it seems like the "[" and "]" are not coming out right.

so my link with:

Code: Select all

www.fileserve.com/[mysite.com]_my_file.rar 
is coming out as:

Code: Select all

www.fileserve.com/&#91;mysite.com&#93;_my_file.rar

User avatar
AmigoJack
Registered User
Posts: 5656
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Clickable links in [code] bbcode

Post by AmigoJack » Fri Mar 25, 2011 3:39 pm

Well, aside from the fact that URI paths should never contain non-ASCII characters (your URL should be at least properly escaped, like www.fileserve.com/%5Bmysite.com%5D_my_file.rar) I suppose you refer to 4_seven's edits?
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
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.

Locked

Return to “[3.0.x] MOD Requests”