X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=banana%2Fmisc.inc.php;h=f57ed8e4441d53d71312b35ac9bf1816e255deaf;hb=5aea143704852333c2d10b306261a716fa328905;hp=e9f7c94c6f6263cb21230044bf7843943c052faf;hpb=c42efe2f093bae5e429288c6a39df6ff9357a88f;p=banana.git diff --git a/banana/misc.inc.php b/banana/misc.inc.php index e9f7c94..f57ed8e 100644 --- a/banana/misc.inc.php +++ b/banana/misc.inc.php @@ -14,25 +14,123 @@ 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 = '