コード例 #1
0
 /**
  * Gets the search query keywords.
  */
 protected static function getSearchQuery()
 {
     self::$searchQuery = false;
     if (isset($_GET['highlight'])) {
         $keywordString = $_GET['highlight'];
         // remove search operators
         $keywordString = preg_replace('/[\\+\\-><()~\\*]+/', '', $keywordString);
         if (StringUtil::substring($keywordString, 0, 1) == '"' && StringUtil::substring($keywordString, -1) == '"') {
             // phrases search
             $keywordString = StringUtil::trim(StringUtil::substring($keywordString, 1, -1));
             if (!empty($keywordString)) {
                 self::$searchQuery = $keywordString;
             }
         } else {
             self::$searchQuery = ArrayUtil::trim(explode(' ', $keywordString));
             if (count(self::$searchQuery) == 0) {
                 self::$searchQuery = false;
             } else {
                 if (count(self::$searchQuery) == 1) {
                     self::$searchQuery = reset(self::$searchQuery);
                 }
             }
         }
     }
 }
コード例 #2
0
 /**
  * @see ViewablePM::getFormattedMessage()
  */
 public function getFormattedMessage()
 {
     return SearchResultTextParser::parse(parent::getFormattedMessage());
 }
 /**
  * @see EntryMessage::getFormattedMessage()
  */
 public function getFormattedMessage()
 {
     return SearchResultTextParser::parse($this->message->getFormattedMessage());
 }
コード例 #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));
     }
 }