<?php
function Ubb ($string) {
$searcharray [' bbcode_regexp '] = Array (
"/s*[quote][nr]* (. +?) [Nr]*[/quote]s*/is ",
"/([Box= (#[0-9a-f]{6}|[ a-z]+)] [nr]* (. +?)] [Nr]* ([/box])/is ",
"/[url]s* (www.|https?://|ftp://|gopher://|news://|telnet://|rtsp://|mms://) {1} ([^[" ']+?) S*[/url]/ie ",
"/[url=www. ([^["']+?)] (.+?) [/url]/is ",
"/[url= (https?| Ftp|gopher|news|telnet|rtsp|mms) {1}://([^["']+?)] (.+?) [/url]/is ",
"/[email]s* ([A-za-z0-9-_.] +) @ ([a-za-z0-9-_]+[.] [A-za-z0-9-_.] +) s*[/email]/i ",
"/[email= ([A-za-z0-9-_.] +) @ ([a-za-z0-9-_]+[.] [A-za-z0-9-_.] +)](.+?) [/email]/is ",
"/[color= ([^[]+?)] /I ",
"/[size= ([^[]+?)] /I ",
"/[font= ([^[]+?)] /I ",
"/[align= ([^[]+?)] /I ",
"/[center]/i",
"/[swf]s* ([^[]+?) S*[/swf]/ies ",
"/[img]s* ([^[]+?) S*[/img]/ies ",
"/[img= (d{1,3}) [X|,] (d{1,3})]s* ([^[]+?) S*[/img]/ies "
);
$replacearray [' bbcode_regexp '] = Array (
"<br><br><center><table border=" 0 "width=" 90% "cellspacing=" 0 "cellpadding=" 0 "><tr> <td> Quote:</td></tr><tr><td><table border= "0" width= "100%" cellspacing= "1" cellpadding= "10" Bgcolor= "". BorderColor. "" ><TR><TD width= "100%" bgcolor= "". ALTBG2. "" "style=" Word-break:break-all ">\1</td></tr></table></td></tr></ Table></center><br> ",
"<blockquote style=" Background-color: \2; " ><span class= "Bold" > $title </span>\3</blockquote> ",
"Cuturl (' \1\2 ')",
"<a href=" http://www.\1 "target=" _blank ">\2</a>",
"<a href=" \1://\2 "target=" _blank ">\3</a>",
"<a href=" mailto:\1@\2 ">\1@\2</a>",
"<a href=" mailto:\1@\2 ">\3</a>",
"<font color=" \1 ">",
"<font size=" \1 ">",
"<font face=" \1 ">",
"<p align=" \1 ">",
"<p align=" Center ">",
"Bbcodeurl (' \1 ', ' <a href="%s "target=" _blank ">Flash:%s </a> ') ",
"Bbcodeurl (' \1 ', ' screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt= ' Click here to open New window ';} ' Onmouseover= "if (this.resized) this.style.cursor= ' hand '; ' onclick= ' if (this.resized) {window.open ('%s ');}" > ') ",
"Bbcodeurl (' \3 ', ' );
$searcharray [' bbcode_str '] = Array (
' [/color] ', ' [/size] ', ' [/font] ', ' [/align] ', ' [b] ', ' [ii] ',
' [i] ', ' [i] ', ' [u] ', ' [/u] ', ' [list] ', ' [list=1] ', ' [List=a] ',
' [List=a] ', ' [*] ', ' [/list] ', ' [/center] '
);
$replacearray [' bbcode_str '] = Array (
' </font> ', ' </font> ', ' </font> ', ' </p> ', ' <b> ', ' </b> ', ' <i> ',
' </i> ', ' <u> ', ' </u> ', ' <ul> ', ' <ol type=1> ', ' <ol type=a> ',
' <ol type=a> ', ' <li> ', ' </ul></ol> ', ' </p> '
);
$string = Str_replace ($searcharray [' bbcode_str '], $replacearray [' Bbcode_str '], preg_replace ($searcharray [' Bbcode_ RegExp '], $replacearray [' Bbcode_regexp '], $string));
return $string;
}
function Bbcodeurl ($url, $tags) {
if (!preg_match ("/<.+?>/s", $url)) {
if (!in_array (Strtolower (substr ($url, 0, 6)), Array (' http:/', ' ftp://', ' rtsp:/', ' mms://'))} {
$url = ' http://'. $url;
}
Return Str_replace (' Submit ', ', ', sprintf ($tags, $url, $url));
} else {
Return ' '. $url;
}
}
function Cuturl ($url) {
$length = 65;
$urllink = "<a href=" ". (substr strtolower ($url), 0, 4) = = ' www. '? "http://$url": $url). ' target= ' _blank ' > ';
if (strlen ($url) > $length) {
$url = substr ($url, 0, intval ($length * 0.5)). '. substr ($url,-intval ($length * 0.3));
}
$urllink. = $url. ' </a> ';
return $urllink;
}
?>