]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/Utils.php
Markdown: don't escape content + sanitize sensible tags
[github/shaarli/Shaarli.git] / application / Utils.php
index 10d606987c826990e94fad0489f36aad66f6a969..868946df756d98c1a726350cd524556e48b4a667 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
  */