]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/Utils.php
Merge pull request #491 from ArthurHoaro/markdown-escape2
[github/shaarli/Shaarli.git] / application / Utils.php
index 91e28a68fba38de7e7992c63b989bbc9bac2c1ff..3d819716316e78f1a884cb662723668a1529560d 100644 (file)
@@ -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
  */