Пример #1
0
 /**
  *
  * @access private
  * @return string
  */
 function getCSS($isRTL = false, $template = '')
 {
     global $mainframe;
     if (empty($template)) {
         $config =& JCommentsCfg::getInstance();
         $template = $config->get('template');
     }
     $cssName = $isRTL ? 'style_rtl.css' : 'style.css';
     $cssFile = $cssName . '?v=12';
     if (JCOMMENTS_JVERSION == '1.0') {
         global $mosConfig_live_site, $mosConfig_absolute_path;
         $cssUrl = $mosConfig_live_site . '/components/com_jcomments/tpl/' . $template . '/' . $cssFile;
     } else {
         $cssPath = JPATH_SITE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_jcomments' . DS . $template . DS . $cssName;
         $cssUrl = JURI::root(true) . '/templates/' . $mainframe->getTemplate() . '/html/com_jcomments/' . $template . '/' . $cssFile;
         if (!is_file($cssPath)) {
             $cssPath = JPATH_SITE . DS . 'components' . DS . 'com_jcomments' . DS . 'tpl' . DS . $template . DS . $cssName;
             $cssUrl = JURI::root(true) . '/components/com_jcomments/tpl/' . $template . '/' . $cssFile;
             if ($isRTL && !is_file($cssPath)) {
                 $cssUrl = '';
             }
         }
     }
     return $cssUrl;
 }
Пример #2
0
 /**
  * Returns a reference to a JCommentsCfg object.
  *
  * @param string $language The language code.
  * @param string $component The component name.
  * @return JCommentsCfg
  */
 public static function getInstance($language = '', $component = '')
 {
     static $instance = null;
     if ($language == '' && JCommentsMultilingual::isEnabled()) {
         $language = JCommentsMultilingual::getLanguage();
     }
     if (!is_object($instance)) {
         $instance = new JCommentsCfg();
         $instance->load($language, $component);
     } else {
         if ($language != $instance->_current && $instance->_current == '') {
             if ($language != '') {
                 $instance->load($language, $component);
             }
         }
     }
     return $instance;
 }
Пример #3
0
 public static function getCSS($isRTL = false, $template = '')
 {
     $app = JFactory::getApplication('site');
     if (empty($template)) {
         $config = JCommentsCfg::getInstance();
         $template = $config->get('template');
     }
     $cssName = $isRTL ? 'style_rtl.css' : 'style.css';
     $cssFile = $cssName . '?v=30';
     $cssPath = JPATH_SITE . '/templates/' . $app->getTemplate() . '/html/com_jcomments/' . $template . '/' . $cssName;
     $cssUrl = JURI::root(true) . '/templates/' . $app->getTemplate() . '/html/com_jcomments/' . $template . '/' . $cssFile;
     if (!is_file($cssPath)) {
         $cssPath = JPATH_SITE . '/components/com_jcomments/tpl/' . $template . '/' . $cssName;
         $cssUrl = JURI::root(true) . '/components/com_jcomments/tpl/' . $template . '/' . $cssFile;
         if ($isRTL && !is_file($cssPath)) {
             $cssUrl = '';
         }
     }
     return $cssUrl;
 }
Пример #4
0
 public static function getCSS($isRTL = false, $template = '')
 {
     if (empty($template)) {
         $config = JCommentsCfg::getInstance();
         $template = $config->get('template');
     }
     $cssName = $isRTL ? 'style_rtl.css' : 'style.css';
     $cssFile = $cssName . '?v=21';
     if (JCOMMENTS_JVERSION == '1.0') {
         $cssUrl = JCommentsSystemPluginHelper::getBaseUrl() . '/components/com_jcomments/tpl/' . $template . '/' . $cssFile;
     } else {
         $app = JCommentsFactory::getApplication('site');
         $cssPath = JPATH_SITE . '/templates/' . $app->getTemplate() . '/html/com_jcomments/' . $template . '/' . $cssName;
         $cssUrl = JURI::root(true) . '/templates/' . $app->getTemplate() . '/html/com_jcomments/' . $template . '/' . $cssFile;
         if (!is_file($cssPath)) {
             $cssPath = JPATH_SITE . '/components/com_jcomments/tpl/' . $template . '/' . $cssName;
             $cssUrl = JURI::root(true) . '/components/com_jcomments/tpl/' . $template . '/' . $cssFile;
             if ($isRTL && !is_file($cssPath)) {
                 $cssUrl = '';
             }
         }
     }
     return $cssUrl;
 }
Пример #5
0
 /**
  * Load configuration from DB and stores it into field _params
  *
  * @param string $lang The language to use.
  * @param string $component The component name.
  * @return void
  */
 public function load($lang = '', $component = '')
 {
     if (JCOMMENTS_JVERSION == '1.5') {
         $jcfg = JFactory::getConfig();
         // temporary fix (eAccelerator won't reset cache)
         if ($jcfg->getValue('config.cache_handler', 'file') == 'eaccelerator') {
             $params = JCommentsCfg::_load($lang, $component);
         } else {
             $cache = JCommentsFactory::getCache('com_jcomments');
             $params = (array) $cache->get('JCommentsCfg::_load', array($lang, $component));
         }
     } else {
         $cache = JCommentsFactory::getCache('com_jcomments');
         $params = (array) $cache->get('JCommentsCfg::_load', array($lang, $component));
     }
     foreach ($params as $param) {
         if ('smiles' == $param->name) {
             if (!empty($param->value)) {
                 $smileValues = explode("\n", $param->value);
                 $this->_params['smiles'] = array();
                 foreach ($smileValues as $v) {
                     list($code, $image) = explode("\t", $v);
                     $this->_params['smiles'][$code] = $image;
                 }
             } else {
                 $this->_params['smiles'] = array();
             }
         } else {
             if ('badwords' == $param->name) {
                 if ('' != trim($param->value)) {
                     $this->_params['badwords'] = explode("\n", $param->value);
                 }
             } else {
                 $this->_params[$param->name] = $param->value;
             }
         }
     }
     if ($this->get('smiles_path') == '') {
         $this->set('smiles_path', '/components/com_jcomments/images/smiles/');
     }
     if ($this->get('enable_notification') == 0 || $this->check('notification_type', 2) == false) {
         $this->set('can_report', '');
     }
     if (!extension_loaded('gd') || !function_exists('imagecreatefrompng')) {
         if ($this->get('captcha_engine', 'kcaptcha') != 'recaptcha') {
             $this->set('enable_captcha', '');
         }
     }
     $this->_current = $lang;
     unset($params);
 }
Пример #6
0
 /**
  * Returns a reference to the global {@link JCommentsCfg} object, 
  * only creating it if it doesn't already exist.
  *
  * @param $language string Language
  * @return JCommentsCfg
  */
 public static function getConfig($language = '')
 {
     return JCommentsCfg::getInstance($language);
 }
Пример #7
0
 function onAfterRoute()
 {
     include_once JPATH_ROOT . DS . 'components' . DS . 'com_jcomments' . DS . 'jcomments.legacy.php';
     $mainframe =& JFactory::getApplication('site');
     $mainframe->getRouter();
     $document =& JFactory::getDocument();
     if ($document->getType() == 'pdf') {
         return;
     }
     if ($mainframe->isAdmin()) {
         $document->addStyleSheet(JURI::base() . 'components/com_jcomments/assets/icon.css?v=2');
         $option = JAdministratorHelper::findOption();
         $task = JRequest::getCmd('task');
         $type = JRequest::getCmd('type', '', 'post');
         // remove comments if content item deleted from trash
         if ($option == 'com_trash' && $task == 'delete' && $type == 'content') {
             $cid = JRequest::getVar('cid', array(0), 'post', 'array');
             JArrayHelper::toInteger($cid, array(0));
             include_once JPATH_ROOT . DS . 'components' . DS . 'com_jcomments' . DS . 'jcomments.php';
             JComments::deleteComments($cid, 'com_content');
         }
     } else {
         $option = JRequest::getCmd('option');
         if ($option == 'com_content' || $option == 'com_alphacontent') {
             include_once JCOMMENTS_BASE . DS . 'jcomments.class.php';
             include_once JCOMMENTS_BASE . DS . 'jcomments.config.php';
             include_once JCOMMENTS_HELPERS . DS . 'system.php';
             // include JComments CSS
             if ($this->params->get('disable_template_css', 0) == 0) {
                 $document->addStyleSheet(JCommentsSystemPluginHelper::getCSS());
                 $language =& JFactory::getLanguage();
                 if ($language->isRTL()) {
                     $rtlCSS = JCommentsSystemPluginHelper::getCSS(true);
                     if ($rtlCSS != '') {
                         $document->addStyleSheet($rtlCSS);
                     }
                 }
             }
             if (!defined('JCOMMENTS_CSS')) {
                 define('JCOMMENTS_CSS', 1);
             }
             $config =& JCommentsCfg::getInstance();
             // include JComments JavaScript library
             $document->addScript(JCommentsSystemPluginHelper::getCoreJS());
             if (!defined('JOOMLATUNE_AJAX_JS')) {
                 $document->addScript(JCommentsSystemPluginHelper::getAjaxJS());
                 define('JOOMLATUNE_AJAX_JS', 1);
             }
             if (!defined('JCOMMENTS_JS')) {
                 define('JCOMMENTS_JS', 1);
             }
         }
     }
 }
Пример #8
0
 /**
  * Returns a reference to the global {@link JCommentsCfg} object, 
  * only creating it if it doesn't already exist.
  *
  * @static
  * @access public
  * @param $language string Language
  * @return JCommentsCfg
  */
 function &getConfig($language = '')
 {
     return JCommentsCfg::getInstance($language);
 }