public static function getInstance($login = null, $password = null) { if (self::$instance === null) { self::$instance = new static(); } self::$instance->login = $login; self::$instance->password = $password; if (empty($login) || empty($password)) { self::$instance->_getPlgRoistatSettings(); } if (empty(self::$instance->project)) { self::$instance->project = self::$instance->getProjectId(); } return self::$instance; }
private static function saveSettings($login, $password) { if (!empty($login) && !empty($password)) { $roistat = Roistat::getInstance(); $roistat->set('login', $login); $roistat->set('password', $password); $table = JTable::getInstance('extension'); $table->load(array('name' => 'roistat')); $table->params = new JRegistry($table->params); $table->params->set('login', $login); $table->params->set('password', $password); $table->params->set('project', $roistat->getProjectId()); return $table->save(array('params' => $table->params->toString())); } return false; }