setOAuthTokens( maybe_unserialize( get_option( 'wpdb_dropboxtoken' ) ) ); $dropbox->authTokenRevoke(); } catch ( Exception $e ) { echo '

Dropbox API: ' . esc_attr( $e->getMessage() ) . '

'; } update_option( 'wpdb_dropboxtoken', '' , false); wp_safe_redirect( site_url() . '/wp-admin/admin.php?page=wp-database-backup¬ification=deleteauth' ); } $dropbox = new WPDBBackup_Destination_Dropbox_API( 'dropbox' ); $dropbox_auth_url = $dropbox->oAuthAuthorize(); if ( true === isset( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'] , 'wp-database-backup' ) ) { if ( isset( $_POST['wpdb_dropbbox_code'] ) && ! empty( $_POST['wpdb_dropbbox_code'] ) ) { $dropboxtoken = $dropbox->oAuthToken( sanitize_text_field( wp_unslash( $_POST['wpdb_dropbbox_code'] ) ) ); $dropboxtoken = update_option( 'wpdb_dropboxtoken', maybe_serialize( $dropboxtoken ) , false); } if ( isset( $_POST['wpdb_dropbbox_dir'] ) ) { $dropboxtoken = update_option( 'wpdb_dropbbox_dir', sanitize_text_field( wp_unslash( $_POST['wpdb_dropbbox_dir'] ) ), false ); } } $wpdb_dropboxtoken = get_option( 'wpdb_dropboxtoken' ); $dropboxtoken = ! empty( $wpdb_dropboxtoken ) ? maybe_unserialize( $wpdb_dropboxtoken ) : array(); ?>

 


setOAuthTokens( $dropboxtoken ); $info = $dropbox->usersGetCurrentAccount(); if ( ! empty( $info['account_id'] ) ) { $user = $info['name']['display_name']; esc_attr_e( ' with Dropbox of user ', 'wpdbbkp' ); echo esc_attr( $user ) . '
'; // Quota. $quota = $dropbox->usersGetSpaceUsage(); $dropboxfreespase = $quota['allocation']['allocated'] - $quota['used']; echo esc_attr( size_format( $dropboxfreespase, 2 ) ); esc_attr_e( ' available on your Dropbox', 'wpdbbkp' ); } ?>