function smileReplace($fb_message, $history, $emoticons, $iconList = null, $parent = null) { $fb_message_txt = $fb_message; //implement the new parser $parser = new TagParser(); $interpreter = new KunenaBBCodeInterpreter($parser, $parent); $task = $interpreter->NewTask(); $task->SetText($fb_message_txt . ' _EOP_'); $task->dry = FALSE; $task->drop_errtag = FALSE; $task->history = $history; $task->emoticons = $emoticons; $task->iconList = $iconList; $task->Parse(); return JString::trim(JString::substr($task->text, 0, -6)); }
function smileReplace($fb_message, $history, $emoticons, $iconList = null) { $fb_message_txt = $fb_message; //implement the new parser $parser = new TagParser(); $interpreter = new KunenaBBCodeInterpreter($parser); $task = $interpreter->NewTask(); $task->SetText($fb_message_txt . ' _EOP_'); $task->dry = FALSE; $task->drop_errtag = FALSE; $task->history = $history; $task->emoticons = $emoticons; $task->iconList = $iconList; $task->Parse(); // Show Parse errors for debug //$task->ErrorShow(); return substr($task->text, 0, -6); }
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; }