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:
|
|
|
|
* 0: Source string (String)
|
|
|
|
* 1: Remove html tags (Bool, optional)
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Sanitized string
|
|
|
|
*/
|
2015-01-13 19:56:02 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-05-14 18:06:06 +00:00
|
|
|
private ["_array", "_arrayNew"];
|
|
|
|
|
|
|
|
PARAMS_2(_string,_removeTags);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
if (isNil "_removeTags") then {_removeTags = false};
|
|
|
|
|
|
|
|
_array = toArray _string;
|
|
|
|
|
|
|
|
_arrayNew = [];
|
|
|
|
{
|
|
|
|
switch _x do {
|
|
|
|
case 60 : {
|
|
|
|
_arrayNew = if (_removeTags) then {_arrayNew + toArray "<";} else {_arrayNew + [_x];};
|
|
|
|
};
|
|
|
|
case 62 : {
|
|
|
|
_arrayNew = if (_removeTags) then {_arrayNew + toArray ">";} else {_arrayNew + [_x];};
|
|
|
|
};
|
|
|
|
case 34 : {
|
|
|
|
};
|
|
|
|
case 39 : {
|
|
|
|
};
|
|
|
|
default {
|
|
|
|
_arrayNew = _arrayNew + [_x];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
} forEach _array;
|
|
|
|
|
|
|
|
toString _arrayNew
|