/** * Text we need to parse, usually text added via a <textarea>. * * @param string $sTxt is the string we need to parse * @return string Parsed string */ public function parse($sTxt) { if (empty($sTxt)) { return $sTxt; } $sTxt = ' ' . $sTxt; ($sPlugin = Phpfox_Plugin::get('parse_output_parse')) ? eval($sPlugin) : null; if (isset($override) && is_callable($override)) { $sTxt = call_user_func($override, $sTxt); } else { $sTxt = $this->htmlspecialchars($sTxt); } $sTxt = Phpfox::getService('ban.word')->clean($sTxt); $sTxt = $this->parseUrls($sTxt); $sTxt = preg_replace_callback('/\\[PHPFOX_PHRASE\\](.*?)\\[\\/PHPFOX_PHRASE\\]/i', array($this, '_getPhrase'), $sTxt); if (Phpfox::getParam('tag.enable_hashtag_support')) { $sTxt = $this->replaceHashTags($sTxt); } $sTxt = str_replace("\n\r\n\r", "", $sTxt); $sTxt = str_replace("\n\r", "", $sTxt); $sTxt = str_replace("\n", "<div class=\"newline\"></div>", $sTxt); $sTxt = ' ' . $sTxt; $sTxt = Phpfox_Parse_Bbcode::instance()->parse($sTxt); $sTxt = preg_replace_callback($this->_regex['mentions'], array($this, '_replaceMentions'), $sTxt); $sTxt = trim($sTxt); return $sTxt; }
/** * Text we need to parse, usually text added via a <textarea>. * * @param string $sTxt is the string we need to parse * @return string Parsed string */ public function parse($sTxt) { if (empty($sTxt)) { return $sTxt; } if ($sPlugin = Phpfox_Plugin::get('phpfox_parse_output_parse__start')) { eval($sPlugin); } $sTxt = ' ' . $sTxt; $sTxt = $this->htmlspecialchars($sTxt); $sTxt = Phpfox::getService('ban.word')->clean($sTxt); $sTxt = $this->parseUrls($sTxt); // $sTxt = preg_replace_callback('/<object(.*?)>(.*?)<\/object>/is', array($this, '_embedWmode'), $sTxt); $sTxt = preg_replace_callback('/\\[PHPFOX_PHRASE\\](.*?)\\[\\/PHPFOX_PHRASE\\]/i', array($this, '_getPhrase'), $sTxt); if (Phpfox::getParam('tag.enable_hashtag_support')) { $sTxt = $this->replaceHashTags($sTxt); } $sTxt = str_replace("\n\r\n\r", "", $sTxt); $sTxt = str_replace("\n\r", "", $sTxt); // $sTxt = str_replace("\n\r\n\r", "\n", $sTxt); // $sTxt = nl2br($sTxt); $sTxt = str_replace("\n", "<div class=\"newline\"></div>", $sTxt); // $sTxt = str_replace("<br>\n<br>", "", $sTxt); /* if (preg_match_all("/\[quote(.*?)\]/i", $sTxt, $aSample) && isset($aSample[0])) { for ($i = 0; $i < count($aSample[0]); $i++) { $sTxt = preg_replace_callback("/\[quote(.*?)\](.*?)\[\/quote\]/is", function($aMatches) { $bData = false; $bLink = true; $sDetail = null; $sTxt = $aMatches[1]; if (isset($aMatches[2])) { $sDetail = $aMatches[1]; $sTxt = $aMatches[2]; } if (!empty($sDetail)) { $bData = true; $sDetail = substr_replace($sDetail, '', 0, 1); $sDetail = Phpfox::getLib('parse.input')->jsClean(trim($sDetail)); $aUser = Phpfox::getService('user')->getUser($sDetail,'u.user_id, u.user_name, u.full_name'); if (empty($aUser)) { $bLink = false; } } $sTxt = stripslashes($sTxt); // $sTxt = Phpfox::getLib('parse.input')->prepare($sTxt); (($sPlugin = Phpfox_Plugin::get('parse_bbcode_quote_start')) ? eval($sPlugin) : false); $sTxt = '<div class="new_quote">' . ($bData ? '<div class="new_quote_header">' . ($bLink ? '<a href="' . Phpfox_Url::instance()->makeUrl('profile', $aUser['user_name']) . '">' : '') . ($bLink ? $aUser['full_name'] : $sDetail) . ($bLink ? '</a>' : '') . '</div>' : '') . '<div class="new_quote_content_holder"><div class="new_quote_content">' . $sTxt . '</div></div></div>'; (($sPlugin = Phpfox_Plugin::get('parse_bbcode_quote_end')) ? eval($sPlugin) : false); return $sTxt; }, $sTxt); } } */ $sTxt = Phpfox_Parse_Bbcode::instance()->parse($sTxt); return $sTxt; }