Exemple #1
0
 function Encode(&$text_new, &$task, $text_old, $context)
 {
     # Encode strings for output
     # Regard interpreter mode if needed
     # context: 'text'
     # context: 'tagremove'
     # RET:
     # TAGPARSER_RET_NOTHING: No Escaping done
     # TAGPARSER_RET_REPLACED: Escaping done
     // special states are liable for encoding (Extended Tag hit)
     if ($task->in_code) {
         // everything inside [code] is getting converted/encoded by tag delegation
         return TAGPARSER_RET_NOTHING;
     }
     if ($task->in_noparse) {
         // noparse is also needed to get encoded
         $text_new = kunena_htmlspecialchars($text_old, ENT_QUOTES);
         return TAGPARSER_RET_REPLACED;
     }
     // generally
     $text_new = $text_old;
     // pasting " " allows regexp to apply on \s at end
     // HTMLize from plaintext
     $text_new = kunena_htmlspecialchars($text_new, ENT_QUOTES);
     if ($context == 'text' && $task->autolink_disable == 0) {
         // Build links HTML2HTML
         $text_new = KunenaBBCodeInterpreter::hyperlink($text_new);
         // Calculate smilies HTML2HTML
         $text_new = smile::smileParserCallback($text_new, $task->history, $task->emoticons, $task->iconList);
     }
     return TAGPARSER_RET_REPLACED;
 }