예제 #1
0
 /**
  * Load the emoticons from the JSON file.
  *
  * @access public
  * @param array $config
  */
 public function __construct(array $config = array())
 {
     parent::__construct($config);
     $path = DECODA_CONFIG . 'emoticons.json';
     // Check if there's an emoticon directory in template's folder
     $this->_config['path'] = '/templates/' . JFactory::getApplication()->getTemplate() . '/html/com_easysocial/emoticons/';
     if (!JFolder::exists(JPATH_ROOT . $this->_config['path'])) {
         // Set the path to our own directory
         // Force root URI in as '/' does not work properly on subfolder sites
         $this->_config['path'] = SOCIAL_JOOMLA_URI . '/media/com_easysocial/images/emoticons/';
     }
     if (file_exists($path)) {
         $this->_emoticons = json_decode(file_get_contents($path), true);
         foreach ($this->_emoticons as $emoticon => $smilies) {
             foreach ($smilies as $smile) {
                 $this->_map[$smile] = $emoticon;
             }
         }
         if (empty($this->_config['path'])) {
             $this->_config['path'] = str_replace(array(realpath($_SERVER['DOCUMENT_ROOT']), '\\', '/'), array('', '/', '/'), DECODA_EMOTICONS);
         }
     }
     // Always append the absolute url here
     $this->_config['path'] = $this->_config['path'];
 }
예제 #2
0
파일: CensorHook.php 프로젝트: 4bs4/marifa
 /**
  * Load the censored words from the text file.
  *
  * @access public
  * @param array $config
  */
 public function __construct(array $config = array())
 {
     parent::__construct($config);
     $path = DECODA_CONFIG . 'censored.txt';
     if (file_exists($path)) {
         $this->blacklist(file($path));
     }
 }
예제 #3
0
 /**
  * Load the emoticons from the JSON file.
  *
  * @access public
  * @param array $config
  */
 public function __construct(array $config = array())
 {
     parent::__construct($config);
     $path = DECODA_CONFIG . 'emoticons.json';
     if (file_exists($path)) {
         $this->_emoticons = json_decode(file_get_contents($path), true);
         foreach ($this->_emoticons as $emoticon => $smilies) {
             foreach ($smilies as $smile) {
                 $this->_map[$smile] = $emoticon;
             }
         }
         if (empty($this->_config['path'])) {
             $this->_config['path'] = str_replace(array(realpath($_SERVER['DOCUMENT_ROOT']), '\\', '/'), array('', '/', '/'), DECODA_EMOTICONS);
         }
     }
 }
예제 #4
0
 /**
  * Add hooks that are triggered at specific events.
  * 
  * @access public
  * @param DecodaHook $hook
  * @return Decoda 
  * @chainable
  */
 public function addHook(DecodaHook $hook)
 {
     $hook->setParser($this);
     $class = str_replace('Hook', '', get_class($hook));
     $this->_hooks[$class] = $hook;
     $hook->setupFilters($this);
     return $this;
 }