2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-03-24 04:18:00 +00:00
|
|
|
* Author: esteldunedain, based on Killzone-Kid code
|
2015-01-11 16:42:31 +00:00
|
|
|
* Removes quotation marks to avoid exploits and optionally html tags from text to avoid conflicts with structured text.
|
|
|
|
*
|
|
|
|
* Arguments:
|
2015-09-19 18:17:38 +00:00
|
|
|
* 0: Source string <STRING>
|
2015-09-20 14:40:49 +00:00
|
|
|
* 1: Remove html tags (default: false) <BOOL>
|
2015-01-11 16:42:31 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Sanitized string
|
2015-09-19 18:17:38 +00:00
|
|
|
*
|
|
|
|
* Public: Yes
|
2015-01-11 16:42:31 +00:00
|
|
|
*/
|
2015-01-13 19:56:02 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-09-19 18:17:38 +00:00
|
|
|
params ["_string", ["_removeTags", false]];
|
2015-05-14 18:06:06 +00:00
|
|
|
|
2015-09-20 14:40:49 +00:00
|
|
|
private "_array";
|
|
|
|
_array = [];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
switch _x do {
|
|
|
|
case 60 : {
|
2015-09-20 14:40:49 +00:00
|
|
|
if (_removeTags) then {
|
|
|
|
_array append toArray "<";
|
|
|
|
} else {
|
|
|
|
_array pushBack _x;
|
|
|
|
};
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
case 62 : {
|
2015-09-20 14:40:49 +00:00
|
|
|
if (_removeTags) then {
|
|
|
|
_array append toArray ">";
|
|
|
|
} else {
|
|
|
|
_array pushBack _x;
|
|
|
|
};
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
2015-09-20 14:40:49 +00:00
|
|
|
|
2015-01-11 16:42:31 +00:00
|
|
|
case 34 : {
|
|
|
|
};
|
2015-09-20 14:40:49 +00:00
|
|
|
|
2015-01-11 16:42:31 +00:00
|
|
|
case 39 : {
|
|
|
|
};
|
2015-09-20 14:40:49 +00:00
|
|
|
|
2015-01-11 16:42:31 +00:00
|
|
|
default {
|
2015-09-20 14:40:49 +00:00
|
|
|
_array pushBack _x;
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
};
|
2015-09-19 18:17:38 +00:00
|
|
|
false
|
2015-09-20 14:40:49 +00:00
|
|
|
} count toArray _string;
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-09-20 14:40:49 +00:00
|
|
|
toString _array // return
|