You are not logged in. Please login or register.


Post new reply

ochiba forum → Discuss → custom.php → Post new reply

Post new reply

Compose and post your new reply

You may use: BBCode

All fields with bold label must be completed before the form is submitted.

Required information for guests


Required information

(delete this if you are not)

Topic review (newest first)

1

This finds links marked with BBCode:

    // This finds http URLs in the form [url]http://www.google.com/page[/url]
    //$string = ereg_replace("\[url\](http:[^>\r\n]+)\[/url\]","${lt}a href=${q}\\1${q}${gt}\\1${lt}/a${gt}",$string);

The next one is better (imo) as it finds plain text Links. But it's either this or the BBCode one above.

    //This finds a plain text-url (http://www.google.com or www.google.com) and creates a link from it 
 
//"www."
   $pattern_preg1 = '#(^|\s)(www|WWW)\.([^\s<>\.]+)\.([^\s\n<>]+)#sm';
   $replace_preg1 = '\\1${lt}a href=${q}http://\\2.\\3.\\4${q} target=${q}_blank${q} class=${q}link${q}${gt}\\2.\\3.\\4${lt}/a${gt}';

//"http://"
   $pattern_preg2 = "#(^|[^\"=\]]{1})(http|HTTP|ftp)(s|S)?://([^\s<>\.]+)\.([^\s<>]+)#sm";
   $replace_preg2 = "\\1${lt}a href=${q}\\2\\3://\\4.\\5${q} target=${q}_blank${q} class=${q}link${q}${gt}\\2\\3://\\4.\\5${lt}/a${gt}";
  
   $string = preg_replace($pattern_preg1, $replace_preg1, $string);
   $string = preg_replace($pattern_preg2, $replace_preg2, $string);

Basic BulletinBoardCode:

 // This finds [b]BOLD TEXT[/b] [i]ITALIC TEXT[/i] [u]UNDERLINED TEXT[/u]
    $string = preg_replace("/\[(\/?)([biuq])\]/i", "${lt}$1$2${gt}", $string);

ochiba forum → Discuss → custom.php → Post new reply



Generated in 0.017 seconds (76% PHP - 24% DB) with 8 queries