diff --git a/Decoda/Hook/EmoticonHook.php b/Decoda/Hook/EmoticonHook.php index 8d507ab..8fd09ad 100644 --- a/Decoda/Hook/EmoticonHook.php +++ b/Decoda/Hook/EmoticonHook.php @@ -161,29 +161,6 @@ public function getEmoticonCollection() $this->collection = new EmoticonCollection(); - // Convert a default decoda emoticons array to an EmoticonCollection - $collection = new EmoticonCollection(); - - if (!$this->getEmoticons()) { - if (null === $this->getParser()) { - $this->setParser(new Decoda()); - } - - $this->startup(); - } - - foreach ($this->getEmoticons() as $name => $smilies) { - $emoticon = new Emoticon(); - foreach ($smilies as $smiley) { - $emoticon->setSmiley($smiley); - } - $collection->add($name, $emoticon); - } - - - $this->collection->addCollection($collection); - - if (null !== $this->options['resource']) { $subCollection = $this->loader->load($this->options['resource'], $this->options['resource_type']); $this->collection->addCollection($subCollection); diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index ac1b25e..5a37be9 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -113,7 +113,7 @@ private function addEmoticonSection(ArrayNodeDefinition $rootNode) ->canBeUnset() ->addDefaultsIfNotSet() ->children() - ->scalarNode('resource')->end() + ->scalarNode('resource')->defaultValue('@FMBbcodeBundle/Resources/config/emoticons.yml')->end() ->scalarNode('type')->end() ->scalarNode('path') ->defaultValue('/emoticons/') diff --git a/README.md b/README.md index df55160..b3a621d 100644 --- a/README.md +++ b/README.md @@ -220,6 +220,7 @@ fm_bbcode: ```yaml # path/to/emoticons.yml imports: + - { resource: '@FMBbcodeBundle/Resources/config/emoticons.yml' } # Add the emoticons configuration from Decoda - { resource: path/to/another/emoticons.yml } emoticons: diff --git a/Resources/config/emoticons.yml b/Resources/config/emoticons.yml new file mode 100644 index 0000000..69b130a --- /dev/null +++ b/Resources/config/emoticons.yml @@ -0,0 +1,17 @@ +emoticons: + angry: { smilies: ['>(', '>:(', '>[', '>:[', ':angry:'] } + aw: { smilies: [':aw:'] } + cool: { smilies: [8), '8]', ':cool:'] } + ecstatic: { smilies: [':D', 8D, ':ecstatic:'] } + furious: { smilies: ['>:D', '><', ':furious:'] } + gah: { smilies: ['D:', ':O', ':gah:'] } + happy: { smilies: [':)', ':]', ':happy:'] } + heart: { smilies: ['<3', ':heart:'] } + hm: { smilies: [':/', ':\', ':hm:'] } + kiss: { smilies: [':3', ':kiss:'] } + meh: { smilies: [':|', '-.-', '<_<', '>_>', ':meh:'] } + mmf: { smilies: [':x', ':X', ':mmf:'] } + sad: { smilies: [':(', ':[', ;(, ';[', ':''(', ':''[', ';''(', ';''[', ':sad:'] } + tongue: { smilies: [':P', ':p', ':tongue:'] } + what: { smilies: [':o', ':?', ':what:'] } + wink: { smilies: [;), ';]', ;D, ':wink:'] } diff --git a/Tests/Templating/BbcodeExtensionTest.php b/Tests/Templating/BbcodeExtensionTest.php index 9225111..b51a2a4 100644 --- a/Tests/Templating/BbcodeExtensionTest.php +++ b/Tests/Templating/BbcodeExtensionTest.php @@ -200,10 +200,10 @@ public function testEmoticonHook($value, $expected) public function dataEmoticonHook() { return array( - array(':)', ''), + array(':)', ':)'), array(':tester:', ''), array(':url_tester:', ''), - array(':\\', ''), + array(':\\', ':\\'), //array(':place_holder:', ''), // FIXME Decoda Bug: result => lace_holder: array(':_lace_holder:', ''), array(':my_emoticon:', ''),