/** * Adds emoticons * * @return void */ protected function addSmiles() { $path = $this->container->get('templating.helper.assets')->getUrl('/bundles/valantirforum/plugin/sceditor/emoticons/'); foreach ($this->smiles as $smile) { $tag = '<img src="' . $path . $smile['file'] . '" alt="' . $smile['name'] . '">'; $this->parser->setParser($smile['name'], $smile['pattern'], $tag, $smile['content']); } }
public function testCustomParser() { $b = new BBCodeParser(); $b->setParser('verybold', '/\\[verybold\\](.*)\\[\\/verybold\\]/', '<strong>VERY $1 BOLD</strong>'); $result = $b->parse('[verybold]something[/verybold]'); $this->assertEquals($result, '<strong>VERY something BOLD</strong>'); }