/** * 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']; }
/** * 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)); } }
/** * 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); } } }
/** * 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; }