X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=banana%2Fmisc.inc.php;h=9b568d82a767292992d5f3a8d095c91025814814;hb=940ae667f3ed96e2e3eed46a741421c5ea04440e;hp=e9f7c94c6f6263cb21230044bf7843943c052faf;hpb=c42efe2f093bae5e429288c6a39df6ff9357a88f;p=banana.git diff --git a/banana/misc.inc.php b/banana/misc.inc.php index e9f7c94..9b568d8 100644 --- a/banana/misc.inc.php +++ b/banana/misc.inc.php @@ -14,12 +14,100 @@ function _b_($str) { return utf8_decode(dgettext('banana', utf8_encode($str))); } function to_entities($str) { - require_once 'banana/utf8.php'; + require_once dirname(__FILE__).'/utf8.php'; return utf8entities(htmlentities($str, ENT_NOQUOTES, 'UTF-8')); } function is_utf8($s) { return iconv('utf-8', 'utf-8', $s) == $s; } +function textFormat_translate($format) +{ + switch (strtolower($format)) { + case 'plain': return _b_('Texte brut'); + case 'richtext': return _b_('Texte enrichi'); + case 'html': return _b_('HTML'); + default: return $format; + } +} + +/******************************************************************************** + * HTML STUFF + * Taken from php.net + */ + +/** + * @return string + * @param string + * @desc Strip forbidden tags and delegate tag-source check to removeEvilAttributes() + */ +function removeEvilTags($source) +{ + $allowedTags = '