コード例 #1
0
 /**
  * Returns the text of this post.
  *
  * @return 	string		the text of this post
  */
 public function getFormattedMessage()
 {
     // return message cache
     if ($this->messageCache) {
         return KeywordHighlighter::doHighlight($this->messageCache);
     }
     // parse message
     $parser = MessageParser::getInstance();
     $parser->setOutputType('text/html');
     AttachmentBBCode::setMessageID($this->postID);
     return $parser->parse($this->message, $this->enableSmilies, $this->enableHtml, $this->enableBBCodes, !$this->messagePreview);
 }
コード例 #2
0
 /**
  * Formats a message for search result output.
  * 
  * @param	string		$text
  * @return	string
  */
 public static function parse($text)
 {
     // remove html codes
     $text = StringUtil::stripHTML($text);
     // decode html
     $text = StringUtil::decodeHTML($text);
     // get abstract
     $text = self::getMessageAbstract($text);
     // encode html
     $text = StringUtil::encodeHTML($text);
     // do highlighting
     return KeywordHighlighter::doHighlight($text);
 }
コード例 #3
0
 /**
  * Parses a message.
  * 
  * @param	string		$message
  * @param	boolean		$enableSmilies
  * @param	boolean		$enableHtml
  * @param	boolean		$enableBBCodes
  * @return	string		parsed message
  */
 public function parse($message, $enableSmilies = true, $enableHtml = false, $enableBBCodes = true, $doKeywordHighlighting = true)
 {
     $this->cachedCodes = array();
     if ($this->getOutputType() != 'text/plain') {
         if ($enableBBCodes) {
             // cache codes
             $message = $this->cacheCodes($message);
         }
         if (!$enableHtml) {
             // encode html
             $message = StringUtil::encodeHTML($message);
             // converts newlines to <br />'s
             $message = nl2br($message);
         }
     }
     // parse bbcodes
     if ($enableBBCodes) {
         $message = parent::parse($message);
     }
     if ($this->getOutputType() != 'text/plain') {
         // parse smilies
         if ($enableSmilies) {
             $message = $this->parseSmilies($message, $enableHtml);
         }
         if ($enableBBCodes && count($this->cachedCodes) > 0) {
             // insert cached codes
             $message = $this->insertCachedCodes($message);
         }
         // highlight search query
         if ($doKeywordHighlighting) {
             $message = KeywordHighlighter::doHighlight($message);
         }
         // replace bad html tags (script etc.)
         $badSearch = array('/javascript:/i', '/about:/i', '/vbscript:/i');
         $badReplace = array('javascript<b></b>:', 'about<b></b>:', 'vbscript<b></b>:');
         $message = preg_replace($badSearch, $badReplace, $message);
         // wrap text
         //$message = $this->wrap($message);
     }
     return $message;
 }
コード例 #4
0
 /**
  * Gets the items for the current page.
  */
 protected function readItems()
 {
     for ($i = $this->startIndex - 1; $i < $this->endIndex; $i++) {
         // get item name
         $itemName = $this->result[$i];
         // get description
         $description = WCF::getLanguage()->getDynamicVariable('wcf.help.item.' . $itemName . '.description');
         // remove headlines
         $description = preg_replace('~<h4>.*?</h4>~', '', $description);
         // remove help images
         $description = preg_replace('~<p class="helpImage.*?</p>~s', '', $description);
         // add item
         $this->helpItems[] = array('item' => $itemName, 'title' => KeywordHighlighter::doHighlight(WCF::getLanguage()->get('wcf.help.item.' . $itemName)), 'description' => SearchResultTextParser::parse($description));
     }
 }
コード例 #5
0
 /**
  * @see Thread::getTopic()
  */
 public function getHighlightedTopic()
 {
     return KeywordHighlighter::doHighlight(StringUtil::encodeHTML($this->topic));
 }