'yes', 'logs' => 'yes', 'retry' => 'yes', 'debug' => 'no', 'delete_data' => 'no' ); } public static function all() : array { return wp_parse_args( get_option( 'authkey_settings', array() ), self::defaults() ); } public static function get( string $key, $default = '' ) { $all = self::all(); return $all[ $key ] ?? $default; } public static function credentials() : array { return array( 'authkey' => (string) get_option( 'authkey_authkey', '' ), 'user_id' => (string) get_option( 'authkey_user_id', '' ), 'token' => (string) get_option( 'authkey_token', '' ), 'user_name' => (string) get_option( 'authkey_user_name', '' ), 'balance' => (string) get_option( 'authkey_balance', '' ), 'currency' => (string) get_option( 'authkey_currency', '' ) ); } public static function connected() : bool { $c = self::credentials(); return '' !== $c['authkey'] && '' !== $c['token']; } public static function disconnect() : void { foreach ( array( 'authkey_authkey','authkey_user_id','authkey_token','authkey_user_name','authkey_balance','authkey_currency' ) as $key ) { delete_option( $key ); } } }