Exemplo n.º 1
0
 /**
  * Set up Decoda.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->object->setBrackets('[', ']');
     $this->object->setLineBreaks(true);
     $this->object->setXhtml(false);
     $this->object->addFilter(new DefaultFilter());
     $hook = new EmoticonHook();
     $hook->addLoader(new DataLoader(array('test/tag/open' => array('['), 'test/tag/close' => array(']'), 'test/tag/within' => array('[o]_[o]'), 'test/unicode' => array("☺"))));
     $this->object->addHook($hook);
 }
Exemplo n.º 2
0
 /**
  * Constructor.
  *
  * @param LoaderInterface $loader   A LoaderInterface instance
  * @param mixed           $resource The main resource to load
  * @param array           $options  An array of options
  */
 public function __construct(LoaderInterface $loader, ContainerInterface $container, array $options = array())
 {
     $this->loader = $loader;
     $this->container = $container;
     $this->setOptions($options);
     parent::__construct($options);
 }
Exemplo n.º 3
0
<?php

use Decoda\Decoda;
use Decoda\Hook\EmoticonHook;
use FM\BbcodeBundle\Emoticon\EmoticonCollection;
use FM\BbcodeBundle\Emoticon\Emoticon;
// Convert a default decoda emoticons array to an EmoticonCollection
$collection = new EmoticonCollection();
$decoda = new Decoda();
$hook = new EmoticonHook();
$hook->setParser($decoda);
$hook->startup();
$emoticons = $hook->getEmoticons();
foreach ($emoticons as $name => $smilies) {
    $emoticon = new Emoticon();
    foreach ($smilies as $smiley) {
        $emoticon->setSmiley($smiley);
    }
    $collection->add($name, $emoticon);
}
return $collection;
Exemplo n.º 4
0
 /**
  * @see \Decoda\Hook\EmoticonHook::setParser()
  *
  * @param Decoda $parser
  *
  * @return EmoticonHook
  */
 public function setParser(Decoda $parser)
 {
     parent::setParser($parser);
     $this->_emoticons = $this->getMatcher()->getEmoticons();
     return $this;
 }