public function __construct() { $this->plugin = strtolower( str_replace( 'KomentoHelper', '', get_class( $this ) ) ); $this->pluginpath = JPATH_ROOT . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'komento'; $this->pluginbase = rtrim( JURI::root(), '/' ) . '/plugins/komento'; if( Komento::joomlaVersion() >= '1.6' ) { $this->pluginpath .= DIRECTORY_SEPARATOR . $this->plugin; $this->pluginbase .= '/' . $this->plugin; } // load plugin language JFactory::getLanguage()->load( 'plg_komento_' . $this->plugin, JPATH_ROOT ); // load plugin params $this->params = Komento::getRegistry( JPluginHelper::getPlugin( 'komento', $this->plugin )->params ); }
public static function getKonfig() { static $konfig = null; if (!$konfig) { //load default ini data first $file = KOMENTO_ADMIN_ROOT . DIRECTORY_SEPARATOR . 'konfiguration.json'; $konfig = Komento::getRegistry(JFile::read($file), 'json'); $konfig->default = clone $konfig->toObject(); //get config stored in db $dbConfig = self::getTable('configs'); $dbConfig->load('com_komento'); $stored = Komento::getRegistry($dbConfig->params, 'json'); $konfig->extend($stored); } return $konfig; }
function saveColumns() { $columns = array('comment', 'published', 'edit', 'component', 'article', 'date', 'author', 'email', 'homepage', 'ip', 'latitude', 'longitude', 'address', 'id'); $message = JText::_('COM_KOMENTO_COMMENTS_COLUMNS_SAVED'); $type = 'message'; $data = JRequest::get('post'); foreach ($data as $key => $value) { if (!in_array(str_replace('column_', '', $key), $columns)) { unset($data[$key]); } } $config = Komento::getTable('configs'); $config->load('com_komento_reports_columns'); $config->component = 'com_komento_reports_columns'; $params = $config ? $config->params : ''; $registry = Komento::getRegistry($params, 'json'); $registry->extend($data); $config->params = $registry->toString('json'); if (!$config->store()) { $message = $config->getError(); $type = 'error'; } $this->setRedirect('index.php?option=com_komento&view=reports', $message, $type); }
public function getThemeInfo( $name ) { if (empty($this->_themeInfo[$name])) { $mainframe = JFactory::getApplication(); $file = ''; // We need to specify if the template override folder also have config.ini file if ( JFile::exists( JPATH_ROOT . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $mainframe->getTemplate() . DIRECTORY_SEPARATOR . 'html' . DIRECTORY_SEPARATOR . 'com_komento' . DIRECTORY_SEPARATOR . 'config.ini' ) ) { $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . $mainframe->getTemplate() . DIRECTORY_SEPARATOR . 'html' . DIRECTORY_SEPARATOR . 'com_komento' . DIRECTORY_SEPARATOR . 'config.ini'; } // then check the current theme folder elseif ( JFile::exists( JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_komento'. DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR . 'config.ini' ) ) { $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_komento' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR . 'config.ini'; } if( !empty( $file ) ) { $this->_themeInfo[$name] = Komento::getRegistry( JFile::read( $file ) ); } else{ $this->_themeInfo[$name] = Komento::getRegistry( '' ); } } return $this->_themeInfo[$name]; }