2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
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:
|
2015-12-11 05:29:05 +00:00
|
|
|
* Sanitized string <STRING>
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* ["<CoolGroup>CoolGuy", true] call ace_common_fnc_sanitizeString;
|
2015-09-19 18:17:38 +00:00
|
|
|
*
|
|
|
|
* Public: Yes
|
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-12-14 12:08:19 +00:00
|
|
|
private _array = [];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
switch _x do {
|
2015-12-11 05:29:05 +00:00
|
|
|
case 60 : { // less than symbol: `<`
|
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-12-11 05:29:05 +00:00
|
|
|
case 62 : { // greater than symbol: `>`
|
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
|