X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2FUtils.php;h=3d819716316e78f1a884cb662723668a1529560d;hb=10269bc8c9dfe87eb213c09a44308ce64ae0c12d;hp=91e28a68fba38de7e7992c63b989bbc9bac2c1ff;hpb=cee0d9609f7cf860cf951ca2d838cfaacecd37d2;p=github%2Fshaarli%2FShaarli.git diff --git a/application/Utils.php b/application/Utils.php index 91e28a68..3d819716 100644 --- a/application/Utils.php +++ b/application/Utils.php @@ -62,13 +62,29 @@ function endsWith($haystack, $needle, $case=true) } /** - * htmlspecialchars wrapper + * Htmlspecialchars wrapper + * + * @param string $str the string to escape. + * + * @return string escaped. */ function escape($str) { return htmlspecialchars($str, ENT_COMPAT, 'UTF-8', false); } +/** + * Reverse the escape function. + * + * @param string $str the string to unescape. + * + * @return string unescaped string. + */ +function unescape($str) +{ + return htmlspecialchars_decode($str); +} + /** * Link sanitization before templating */