Skip to content
View in the app

A better way to browse. Learn more.

Tip.It Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PHP coding issue

Featured Replies

Hey guys, I have a slight issue here, I have a function for bbcode that I have made...

 

 

 


function bbcode($txt){

$txt = htmlspecialchars($txt);

$txt = preg_replace_callback('#\[php\](.+?)\[/php\]#msi',create_function('$matches', 'return highlight_string($matches[1], true);'), $txt); 

$txt = preg_replace('#\[b\](.+?)\[/b\]#msi', '\\1', $txt);

$txt = preg_replace('#\[i\](.+?)\[/i\]#msi', '\\1', $txt);

$txt = preg_replace('#\[u\](.+?)\[/u\]#msi', '\\1', $txt);

$txt = preg_replace('#\[url=(.+?)\](.+?)\[/url\]#msi','\\2', $txt);

$txt = preg_replace('#\[url\](.+?)\[/url\]#msi','\\1', $txt);

$txt = preg_replace('#\[img](.+?)\[/img\]#msi','',$txt);



$txt = preg_replace('#\[quote name=(.+?)\](.+?)\[/quote\]#msi','</pre><table width="75%" align="center" cellpadding="2" cellspacing="1">Quoting: \\1\\2</table>',$txt);<br><br><br><br>$txt = nl2br($txt);<br><br><br><br>  return $txt;<br><br><br><br>}<b

 

 

 

That works just fine, but now for the issue.

 

In phpBB, if you just type a url, it'll transform it for you

 

 

 

http://www.clan-forge.net/

 

 

 

Such as that (Thats my website btw)

 

 

 

and also bbcode ( tags, things like that)

 

 

 

But it does both, I cannt get my function to do both without it contradicting the other... suggestions?

you can search the string for url if its found parse it, if its not found search for just http:// and parse the string until the trailing space

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.