普通面粉做披萨:哪位朋友能解释一下下边函数的作用?

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/29 11:04:03
if (!$imglink)这个是什么意思?
关键的function patch(temp) {
if (!$html)
function Smilies(temp) {
if (!$Smilies){
是什么意思?又有什么作用呢?

<Script Language="JScript" Runat=Server>
$UBBCode = 1 // 打开或关闭UBB代码功能.0(关闭).1(打开)
$imglink = 1 // 同样的是为了打开或关闭帖图功能
$html = 1 // 同样的是为了打开或关闭HTML功能
$Smilies = 1 // 同样的是为了打开或关闭表情功能

function Autolink(temp) {
temp=patch(temp);
temp=Smilies(temp);

if (!$imglink){
temp = temp.replace(/(http:\/\/)([\w\+\-\/\=\?\.\~]+\.(jpg|gif|pcx|bmp))/ig, "<HR SIZE=1 Noshade width=100% align=\"left\"><img src=\"\/\/$2\" alt=\"$2\">");
}
if (!$UBBCode){ // UBB 代码的支持,这里仅仅提供了一些常用的代码。
temp = temp.replace(/(^|\s)(http|https|ftp)(:\/\/[^\";,<>]+)/ig, "<a href=\"$2$3\" target=_blank>$2$3</a>");
temp = temp.replace(/([^\//]])(www\.[^\";,<>]+)/ig, "<a href=\"http:\/\/$2\" target=_blank>$2</a>");
align=\"left\"><img src=\"$2\" alt=\"$2\">");
注释掉了贴图功能!
*/
temp = temp.replace(/(\[SIZE=)(\S+)(\])(.+)(\[\/SIZE\])/ig, "<FONT SIZE=\"$2\">$4<\/FONT>");
temp = temp.replace(/(\w+\@\w+.[\w.]+)/ig, "<a href=\"mailto:$1\">$1</a>");
}
return (temp);
}
function Smilies(temp) {
if (!$Smilies){
temp = temp.replace(/\:o/g, "<img src=\icons\/redface.gif ALIGN=absmiddle>");
temp = temp.replace(/\:p/g, "<img src=\icons\/tongue.gif ALIGN=absmiddle>");
temp = temp.replace(/\:cool/ig, "<img src=\icons\/cool.gif ALIGN=absmiddle>");
temp = temp.replace(/\:rolleyes/g, "<img src=\icons\/rolleyes.gif ALIGN=absmiddle>");
temp = temp.replace(/\:mad/g, "<img src=\icons\/mad.gif ALIGN=absmiddle>");
temp = temp.replace(/\:eek/ig, "<img src=\icons\/eek.gif ALIGN=absmiddle>");
temp = temp.replace(/\:confused/ig, "<img src=\icons\/confused.gif ALIGN=absmiddle>");
}
return (temp);
}
function patch(temp) {
if (!$html){
temp = temp.replace(/</ig, "<");
temp = temp.replace(/>/ig, ">");
temp = temp.replace(/\r\n/ig, "<BR> ");
}
temp = temp.replace(/\n\r\n/ig, "<P>");
temp = temp.replace(/\n/ig, "<BR>");
temp = temp.replace(/\r/ig, "");
return (temp);
}
</Script>

上面的函数都是字符替换作用的。
temp = temp.replace(/\\n\\r\\n/ig, \"<P>\");
temp = temp.replace(/\\n/ig, \"<BR>\");
temp = temp.replace(/\\r/ig, \"\");

我来沾楼主的光学点东西