english/administrator/components/com_config/models/component.php
/**
	 * Method to save the configuration data.
	 *
	 * @param	array	An array containing all global config data.
	 *
	 * @return	bool	True on success, false on failure.
	 * @since	1.6
	 */
Method to save the configuration data.
@param       array   An array containing all global config data.

@return      bool    True on success, false on failure.
Method to save the configuration data . @param array An array containing all global config data . @return bool True on success false on failure .
public function save($data)
	{
		$table	= JTable::getInstance('extension');
		if (isset($data['params']) && isset($data['params']['rules'])) {
			jimport('joomla.access.rules');
			$rules	= new JRules($data['params']['rules']);
			$asset	= JTable::getInstance('asset');
			if (!$asset->loadByName($data['option'])) {
				$root	= JTable::getInstance('asset');
				$root->loadByName('root.1');
				$asset->name = $data['option'];
				$asset->title = $data['option'];
				$asset->setLocation($root->id,'last-child');
			}
			$asset->rules = (string) $rules;
			if (!$asset->check() || !$asset->store()) {
				$this->setError($asset->getError());
				return false;
			}
			unset($data['option']);
			unset($data['params']['rules']);
		}
		if (!$table->load($data['id'])) {
			$this->setError($table->getError());
			return false;
		}
		unset($data['id']);
		if (!$table->bind($data)) {
			$this->setError($table->getError());
			return false;
		}
		if (!$table->check()) {
			$this->setError($table->getError());
			return false;
		}
		if (!$table->store()) {
			$this->setError($table->getError());
			return false;
		}
		$this->cleanCache('_system', 0);
		$this->cleanCache('_system', 1);
		return true;
	}
public function save ( $ data ) { $ table = JTable :: getInstance ( 'extension' ) ; if ( isset ( $ data [ 'params' ] ) && isset ( $ data [ 'params' ] [ 'rules' ] ) ) { jimport ( 'joomla.access.rules' ) ; $ rules = new JRules ( $ data [ 'params' ] [ 'rules' ] ) ; $ asset = JTable :: getInstance ( 'asset' ) ; if ( ! $ asset -> loadByName ( $ data [ 'option' ] ) ) { $ root = JTable :: getInstance ( 'asset' ) ; $ root -> loadByName ( 'root.1' ) ; $ asset -> name = $ data [ 'option' ] ; $ asset -> title = $ data [ 'option' ] ; $ asset -> setLocation ( $ root -> id , 'last-child' ) ; } $ asset -> rules = ( string ) $ rules ; if ( ! $ asset -> check ( ) || ! $ asset -> store ( ) ) { $ this -> setError ( $ asset -> getError ( ) ) ; return false ; } unset ( $ data [ 'option' ] ) ; unset ( $ data [ 'params' ] [ 'rules' ] ) ; } if ( ! $ table -> load ( $ data [ 'id' ] ) ) { $ this -> setError ( $ table -> getError ( ) ) ; return false ; } unset ( $ data [ 'id' ] ) ; if ( ! $ table -> bind ( $ data ) ) { $ this -> setError ( $ table -> getError ( ) ) ; return false ; } if ( ! $ table -> check ( ) ) { $ this -> setError ( $ table -> getError ( ) ) ; return false ; } if ( ! $ table -> store ( ) ) { $ this -> setError ( $ table -> getError ( ) ) ; return false ; } $ this -> cleanCache ( '_system' , 0 ) ; $ this -> cleanCache ( '_system' , 1 ) ; return true ; }
Method to save the configuration data.
Method to save the configuration data .
// Save the rules. // We don't need this anymore // Load the previous Data // Bind the data. // Check the data. // Store the data. // Clean the cache.