Make formatting tag removal smarter.

Instead of removing all tags, only known
formatting tags.

Fixes #2203
This commit is contained in:
mark_story 2011-11-02 21:50:16 -04:00
parent 18a34c03a4
commit 98a8f44fa7
2 changed files with 15 additions and 1 deletions

View file

@ -178,7 +178,8 @@ class ConsoleOutput {
return $text;
}
if ($this->_outputAs == self::PLAIN) {
return strip_tags($text);
$tags = implode('|', array_keys(self::$_styles));
return preg_replace('#</?(?:' . $tags . ')>#', '', $text);
}
return preg_replace_callback(
'/<(?<tag>[a-z0-9-_]+)>(?<text>.*?)<\/(\1)>/ims', array($this, '_replaceTags'), $text