📄 functions_filters.asp
字号:
strTempOutputMessage = strMessageInput
'****** Remove flash forum code so it's not changed *******
'Loop through all the codes in the message and convert them to formated flash links
Do While InStr(1, strTempMessageText, "[FLASH", 1) > 0 AND InStr(1, strTempMessageText, "[/FLASH]", 1) > 0
'Get the Flash BBcode from the message
lngStartPos = InStr(1, strTempMessageText, "[FLASH", 1)
lngEndPos = InStr(lngStartPos, strTempMessageText, "[/FLASH]", 1) + 8
'Make sure the end position is not in error
If lngEndPos < lngStartPos Then lngEndPos = lngStartPos + 6
'Get the original Flash BBcode from the message
strTempFlashMsg = Trim(Mid(strTempMessageText, lngStartPos, lngEndPos-lngStartPos))
'Add 1 to the loop counter
lngLoopCounter = lngLoopCounter + 1
'Redim the array, use preserve to keep the old array parts
ReDim Preserve saryHTMLlinks(2,lngLoopCounter)
'Create a code to replace the link with in original string
strHTMLlinksCode = " **/**WWFflash00" & lngLoopCounter & "**\** "
'Place the code and the original link into the array
saryHTMLlinks(1,lngLoopCounter) = strHTMLlinksCode
saryHTMLlinks(2,lngLoopCounter) = strHTMLMessage
'Rpleace the HTML tag with the new code that is saved in array
strTempMessageText = Replace(strTempMessageText, strTempFlashMsg, strHTMLlinksCode, 1, -1, 0)
'A link is found so set the link found variable to true
blnHTMLlink = True
strTempMessageText = Replace(strTempMessageText, strTempFlashMsg, Replace(strTempFlashMsg, "[", "[", 1, -1, 1), 1, -1, 1)
Loop
'****** Strip HTML from message *******
'Loop through each character in the post message
For lngMessagePosition = 1 to CLng(Len(strMessageInput))
'If this is the end of the message then save some process time and jump out the loop
If Mid(strMessageInput, lngMessagePosition, 1) = "" Then Exit For
'If an HTML tag is found then jump to the end so we can strip it
If Mid(strMessageInput, lngMessagePosition, 1) = "<" Then
'Get the length of the HTML tag
intHTMLTagLength = (InStr(lngMessagePosition, strMessageInput, ">", 1) - lngMessagePosition)
'If the end of the HTML string is in error then set it to the number of characters being passed
If intHTMLTagLength < 0 Then intHTMLTagLength = CLng(Len(strTempMessageText))
'Place the HTML tag back into the temporary message store
strHTMLMessage = Mid(strMessageInput, lngMessagePosition, intHTMLTagLength + 1)
'****** Remove links so they aren't changed *******
'See if the HTML tag is a link, if so replace with a code so it is not changed when spliting long chars
If InStr(1, strHTMLMessage, "href", 1) Then
'Add 1 to the loop counter
lngLoopCounter = lngLoopCounter + 1
'Redim the array, use preserve to keep the old array values
ReDim Preserve saryHTMLlinks(2,lngLoopCounter)
'Create a code to replace the link with in original string
strHTMLlinksCode = " **/**WWFlink00" & lngLoopCounter & "**\** "
'Place the code and the original link into the array
saryHTMLlinks(1,lngLoopCounter) = strHTMLlinksCode
saryHTMLlinks(2,lngLoopCounter) = strHTMLMessage
'Rpleace the HTML tag with the new code that is saved in array
strTempOutputMessage = Replace(strTempOutputMessage, strHTMLMessage, strHTMLlinksCode, 1, -1, 0)
'A link is found so set the link found variable to true
blnHTMLlink = True
End If
'***************************************************
'Strip the HTML
strTempMessageText = Replace(strTempMessageText, strHTMLMessage, " ", 1, -1, 0)
End If
Next
'****** Strip Forum Codes from message *******
'Loop through each character in the post message
For lngMessagePosition = 1 to CLng(Len(strMessageInput))
'If this is the end of the message then save some process time and jump out the loop
If Mid(strMessageInput, lngMessagePosition, 1) = "" Then Exit For
'If an BBCode tag is found then jump to the end so we can strip it
If Mid(strMessageInput, lngMessagePosition, 1) = "[" Then
'Get the length of the BBCode tag
intHTMLTagLength = (InStr(lngMessagePosition, strMessageInput, "]", 1) - lngMessagePosition)
'If the end of the BBCode string is in error then set it to the number of characters being passed
If intHTMLTagLength < 0 Then intHTMLTagLength = CLng(Len(strTempMessageText))
'Place the BBCode tag back into the temporary message store
strHTMLMessage = Mid(strMessageInput, lngMessagePosition, intHTMLTagLength + 1)
'Strip the BBCode
strTempMessageText = Replace(strTempMessageText, strHTMLMessage, " ", 1, -1, 0)
End If
Next
'****** Check for and remove long strings *******
'Now we have just the text (no HTML) in plain text variable see if any of the text strings in it are over 30 chars in length
saryPlainTextWord = Split(Trim(strTempMessageText), " ")
'Loop through all the words till they are shortened
For lngLoopCounter = 0 To UBound(saryPlainTextWord)
'If the text string length is more than the max word length then place spaces in the text string
If Len(saryPlainTextWord(lngLoopCounter)) > intMaxWordLength Then
'Redim the array (don't use preserve as we want to loose the last data in the array)
Redim sarySplitTextWord(CInt(Len(saryPlainTextWord(lngLoopCounter))/intMaxWordLength+1))
'Initiliase variable
intWordSartPos = 1
'Loop through all the splits in the word
For lngSplitPlainTextWordLoop = 1 To UBound(sarySplitTextWord)
'Place the split word into the array
sarySplitTextWord(lngSplitPlainTextWordLoop) = Mid(saryPlainTextWord(lngLoopCounter), intWordSartPos, intMaxWordLength)
'Add max word length to the start position
intWordSartPos = intWordSartPos + intMaxWordLength
Next
'Place the split up long text string back together in one variable with spaces at the max word length
strTempPlainTextWord = Join(sarySplitTextWord, " ")
'Place the split up word back into the orginal message
strTempOutputMessage = Replace(strTempOutputMessage, saryPlainTextWord(lngLoopCounter), strTempPlainTextWord, 1, -1, 0)
End If
Next
'****** Replace links so they aren't changed ******
'Place back all the links into the message in place of the codes placed in for them
If blnHTMLlink Then
'Loop through each of the changed links
For lngLoopCounter = 1 To Ubound(saryHTMLlinks,2)
'Strip line carridge returns for MAC users
saryHTMLlinks(2,lngLoopCounter) = Replace(saryHTMLlinks(2,lngLoopCounter), vbCrLf, "", 1, -1, 0)
'Replace the code with the link
strTempOutputMessage = Replace(strTempOutputMessage, saryHTMLlinks(1,lngLoopCounter), saryHTMLlinks(2,lngLoopCounter), 1, -1, 0)
Next
End If
'Return the function
removeLongText = strTempOutputMessage
End Function
'*********************************************
'*** Decode HTML encoding *****
'*********************************************
'Decode encoded strings
Private Function decodeString(ByVal strInputEntry)
'Decode HTML character entities
strInputEntry = Replace(strInputEntry, "a", "a", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "b", "b", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "c", "c", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "d", "d", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "e", "e", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "f", "f", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "g", "g", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "h", "h", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "i", "i", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "j", "j", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "k", "k", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "l", "l", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "m", "m", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "n", "n", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "o", "o", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "p", "p", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "q", "q", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "r", "r", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "s", "s", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "t", "t", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "u", "u", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "v", "v", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "w", "w", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "x", "x", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "y", "y", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "z", "z", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "A", "A", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "B", "B", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "C", "C", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "D", "D", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "E", "E", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "F", "F", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "G", "G", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "H", "H", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "I", "I", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "J", "J", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "K", "K", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "L", "L", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "M", "M", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "N", "N", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "O", "O", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "P", "P", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Q", "Q", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "R", "R", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "S", "S", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "T", "T", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "U", "U", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "V", "V", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "W", "W", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "X", "X", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Y", "Y", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "Z", "Z", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "0", "0", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "1", "1", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "2", "2", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "3", "3", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "4", "4", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "5", "5", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "6", "6", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "7", "7", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "8", "8", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "9", "9", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "=", "=", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "<", "<", 1, -1, 0)
strInputEntry = Replace(strInputEntry, ">", ">", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "&", "&", 1, -1, 0)
strInputEntry = Replace(strInputEntry, "’", "'", 1, -1, 1)
'Return
decodeString = strInputEntry
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -