keepassphp/lib/kphpdb.php
public function toJSon($filter, &$error)
	{
		$array = array(
			self::KEY_VERSION => self::VERSION_CURRENT,
			self::KEY_DBTYPE => $this->_dbType,
			self::KEY_DBFILEHASH => $this->_dbFileHash,
			self::KEY_KEYFILEHASH => $this->_keyFileHash,
			self::KEY_HEADERHASH => base64_encode($this->_headerHash),
			self::KEY_DB => $this->_db->toArray($filter));
		$r = json_encode($array);
		if($r === false)
		{
			$error = "KphpDB JSon save: " . json_last_error();
			return null;
		}
		$error = null;
		return $r;
	}
public function toJSon($filter, &$error)
	{
		$array = array(
			self::KEY_VERSION => self::VERSION_CURRENT,
			self::KEY_DBTYPE => $this->_dbType,
			self::KEY_DBFILEHASH => $this->_dbFileHash,
			self::KEY_KEYFILEHASH => $this->_keyFileHash,
			self::KEY_HEADERHASH => base64_encode($this->_headerHash),
			self::KEY_DB => $this->_db->toArray($filter));
		$r = json_encode($array);
		if($r === false)
		{
			$error = "KphpDB JSon save: " . json_last_error();
			return null;
		}
		$error = null;
		return $r;
	}
public function toJSon ( $ filter , & $ error ) { $ array = array ( self :: KEY_VERSION => self :: VERSION_CURRENT , self :: KEY_DBTYPE => $ this -> _dbType , self :: KEY_DBFILEHASH => $ this -> _dbFileHash , self :: KEY_KEYFILEHASH => $ this -> _keyFileHash , self :: KEY_HEADERHASH => base64_encode ( $ this -> _headerHash ) , self :: KEY_DB => $ this -> _db -> toArray ( $ filter ) ) ; $ r = json_encode ( $ array ) ; if ( $ r === false ) { $ error = "KphpDB JSon save: " . json_last_error ( ) ; return null ; } $ error = null ; return $ r ; }
Serializes this instance to a JSon string.
@param $filter An iFilter instance to select the data of the database
that must actually be serialized (if null, it will
serialize everything except from passowrds).
@param &$error A string that will receive a message in case of error.
@return A JSon string in case of success, or null in case of error.
Serializes this instance to a JSon string .