コード例 #1
0
 /**
  * Set the Decoda parser.
  *
  * @access public
  * @param \mjohnson\decoda\Decoda $parser
  * @return \mjohnson\decoda\hooks\CensorHook
  * @chainable
  */
 public function setParser(Decoda $parser)
 {
     parent::setParser($parser);
     foreach ($parser->getPaths() as $path) {
         if (file_exists($path . 'censored.txt')) {
             $this->blacklist(file($path . 'censored.txt'));
         }
     }
     return $this;
 }
コード例 #2
0
 /**
  * Set the Decoda parser.
  *
  * @access public
  * @param \mjohnson\decoda\Decoda $parser
  * @return \mjohnson\decoda\hooks\EmoticonHook
  * @chainable
  */
 public function setParser(Decoda $parser)
 {
     parent::setParser($parser);
     foreach ($parser->getPaths() as $path) {
         if (!file_exists($path . 'emoticons.json')) {
             continue;
         }
         if ($emoticons = json_decode(file_get_contents($path . 'emoticons.json'), true)) {
             foreach ($emoticons as $emoticon => $smilies) {
                 foreach ($smilies as $smile) {
                     $this->_map[$smile] = $emoticon;
                 }
             }
             $this->_emoticons = array_merge($this->_emoticons, $emoticons);
         }
     }
     return $this;
 }