mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Return strip_html_properly() back
This commit is contained in:
@@ -226,6 +226,31 @@
|
||||
/proc/capitalize(var/t as text)
|
||||
return uppertext(copytext(t, 1, 2)) + copytext(t, 2)
|
||||
|
||||
//This proc strips html properly, remove < > and all text between
|
||||
//for complete text sanitizing should be used sanitize()
|
||||
/proc/strip_html_properly(var/input)
|
||||
if(!input)
|
||||
return
|
||||
var/opentag = 1 //These store the position of < and > respectively.
|
||||
var/closetag = 1
|
||||
while(1)
|
||||
opentag = findtext(input, "<")
|
||||
closetag = findtext(input, ">")
|
||||
if(closetag && opentag)
|
||||
if(closetag < opentag)
|
||||
input = copytext(input, (closetag + 1))
|
||||
else
|
||||
input = copytext(input, 1, opentag) + copytext(input, (closetag + 1))
|
||||
else if(closetag || opentag)
|
||||
if(opentag)
|
||||
input = copytext(input, 1, opentag)
|
||||
else
|
||||
input = copytext(input, (closetag + 1))
|
||||
else
|
||||
break
|
||||
|
||||
return input
|
||||
|
||||
//This proc fills in all spaces with the "replace" var (* by default) with whatever
|
||||
//is in the other string at the same spot (assuming it is not a replace char).
|
||||
//This is used for fingerprints
|
||||
|
||||
Reference in New Issue
Block a user