From f7bfdf58def6aadc922e1632f407d1418269a0d7 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Sat, 9 Jul 2022 19:40:17 +0300 Subject: initial --- engine/SkinString.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 engine/SkinString.php (limited to 'engine/SkinString.php') diff --git a/engine/SkinString.php b/engine/SkinString.php new file mode 100644 index 0000000..0f8f14d --- /dev/null +++ b/engine/SkinString.php @@ -0,0 +1,23 @@ +modType = $modType; + } + + public function __toString(): string { + return match ($this->modType) { + SkinStringModificationType::HTML => htmlescape($this->string), + SkinStringModificationType::URL => urlencode($this->string), + SkinStringModificationType::JSON => json_encode($this->string, JSON_UNESCAPED_UNICODE), + SkinStringModificationType::ADDSLASHES => addslashes($this->string), + default => $this->string, + }; + } + +} \ No newline at end of file -- cgit v1.2.3