}
/**
- * 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
*/
*
* @return string formatted description.
*/
-function format_description($description, $redirector) {
+function format_description($description, $redirector = false) {
return nl2br(space2nbsp(text2clickable($description, $redirector)));
}