public function load($config) { if (!array_key_exists('component', $config)) { self::$component = $config['extensionName']; } else { self::$component = $config['component']; } if (!array_key_exists('key', $config)) { self::$key = 'liveupdate'; } else { self::$key = $config['key']; } jimport('joomla.html.parameter'); jimport('joomla.application.component.helper'); // Not using JComponentHelper to avoid conflicts ;) $db = JFactory::getDbo(); if (version_compare(JVERSION, '1.6.0', 'ge')) { $sql = $db->getQuery(true)->select($db->nq('params'))->from($db->nq('#__extensions'))->where($db->nq('type') . ' = ' . $db->q('component'))->where($db->nq('element') . ' = ' . $db->q(self::$component)); } else { $sql = 'SELECT ' . $db->nameQuote('params') . ' FROM ' . $db->nameQuote('#__components') . ' WHERE ' . $db->nameQuote('option') . ' = ' . $db->Quote(self::$component) . " AND `parent` = 0 AND `menuid` = 0"; } $db->setQuery($sql); $rawparams = $db->loadResult(); if (version_compare(JVERSION, '1.6.0', 'ge')) { $params = new JRegistry(); $params->loadJSON($rawparams); } else { $params = new JParameter($rawparams); } $data = $params->getValue(self::$key, ''); jimport('joomla.registry.registry'); self::$registry = new JRegistry('update'); self::$registry->loadINI($data); }
public function load($config) { if (!array_key_exists('component', $config)) { self::$component = $config['extensionName']; } else { self::$component = $config['component']; } if (!array_key_exists('key', $config)) { self::$key = 'liveupdate'; } else { self::$key = $config['key']; } jimport('joomla.html.parameter'); jimport('joomla.application.component.helper'); $component =& JComponentHelper::getComponent(self::$component); if (!$component->params instanceof JRegistry) { $params = new JParameter($component->params); } else { $params = $component->params; } $data = $params->getValue(self::$key, ''); jimport('joomla.registry.registry'); self::$registry = new JRegistry('update'); self::$registry->loadINI($data); }
public function load($config) { if (!array_key_exists('component', $config)) { self::$component = $config['extensionName']; } else { self::$component = $config['component']; } if (!array_key_exists('key', $config)) { self::$key = 'liveupdate'; } else { self::$key = $config['key']; } // Not using JComponentHelper to avoid conflicts ;) $db = JFactory::getDbo(); $sql = $db->getQuery(true)->select($db->qn('params'))->from($db->qn('#__extensions'))->where($db->qn('type') . ' = ' . $db->q('component'))->where($db->qn('element') . ' = ' . $db->q(self::$component)); $db->setQuery($sql); $rawparams = $db->loadResult(); $params = new JRegistry(); $params->loadString($rawparams, 'JSON'); $data = $params->get(self::$key, ''); jimport('joomla.registry.registry'); self::$registry = new JRegistry('update'); self::$registry->loadString($data, 'INI'); }