setClientId( $client_id ); $client->setClientSecret( $client_secret ); $client->setRedirectUri( site_url() . '/wp-admin/admin.php?page=wp-database-backup&action=auth' ); $client->setScopes( array( 'https://www.googleapis.com/auth/drive' ) ); $service = new Google_DriveService( $client ); $auth_url = $client->createAuthUrl(); if ( isset( $_GET['code'] ) ) { update_option( 'wpdb_dest_google_authCode', wp_db_filter_data( sanitize_text_field( wp_unslash( $_GET['code'] ) ) ), false ); } else { if ( isset( $_POST['wpdb_dest_google_client_key'] ) && ! empty( $_POST['wpdb_dest_google_client_key'] ) && isset( $_POST['wpdb_dest_google_secret_key'] ) && ! empty( $_POST['wpdb_dest_google_secret_key'] ) ) { wp_redirect( filter_var( $auth_url, FILTER_SANITIZE_URL ) ); exit; } } } elseif ( isset( $_POST['reset'] ) && 'Reset Configure' === $_POST['reset'] ) { update_option( 'wpdb_dest_google_authCode', '' , false); wp_safe_redirect( esc_url( site_url() . '/wp-admin/admin.php?page=wp-database-backup' ) ); exit; } // Put a "settings updated" message on the screen. $update_msg = '

Your google drive setting has been saved.

'; } if ( isset( $_GET['code'] ) ) { update_option( 'wpdb_dest_google_authCode', wp_db_filter_data( sanitize_text_field( wp_unslash( $_GET['code'] ) ) ) , false); $wpdbbkp_gdrive_authCode = wp_db_filter_data( sanitize_text_field( wp_unslash( $_GET['code'] ) ) ); } $wpdb_dest_google_auth_code = get_option( 'wpdb_dest_google_authCode' ); $wpdb_dest_google_client_key = get_option( 'wpdb_dest_google_client_key' ); $wpdb_dest_google_secret_key = get_option( 'wpdb_dest_google_secret_key' ); $wpdbbkp_gdrive_status = ' '; if(!empty($wpdb_dest_google_auth_code) && !empty($wpdb_dest_google_client_key) && !empty($wpdb_dest_google_secret_key)) { $wpdbbkp_gdrive_status=' '; } ?>

Google drive