/** * Replace BBCodes and other formatting elements with whitespace * * NOTE: preserves smilies as text * * @param string $xml Parsed text * @return string Plain text */ public function clean_formatting($xml) { // Insert a space before <s> and <e> then remove formatting $xml = preg_replace('#<[es]>#', ' $0', $xml); return \s9e\TextFormatter\Utils::removeFormatting($xml); }
/** * @testdox removeFormatting() tests * @dataProvider getRemoveFormattingTests */ public function testRemoveFormatting($original, $expected) { $this->assertSame($expected, Utils::removeFormatting($original)); }