Ejemplo n.º 1
0
 /**
  * @see	\wcf\system\bbcode\highlighter\Highlighter::highlightKeywords()
  */
 protected function highlightKeywords($string)
 {
     $string = parent::highlightKeywords($string);
     // find tags
     $regex = new Regex('<(?:/|\\!|\\?)?[a-z0-9]+(?:\\s+' . self::XML_ATTRIBUTE_NAME . '(?:=[^\\s/\\?&]+)?)*(?:\\s+/|\\?)?>', Regex::CASE_INSENSITIVE);
     $string = $regex->replace($string, new Callback(function ($matches) {
         // highlight attributes
         $tag = Regex::compile(XmlHighlighter::XML_ATTRIBUTE_NAME . '(?:=[^\\s/\\?&]+)?(?=\\s|&)', Regex::CASE_INSENSITIVE)->replace($matches[0], '<span class="hlKeywords2">\\0</span>');
         // highlight tag
         return '<span class="hlKeywords1">' . $tag . '</span>';
     }));
     return $string;
 }