PATH:
home
/
thebhoeo
/
.trash
/
backwpup
/
inc
<?php use Krizalys\Onedrive\ClientState; trait BackWPup_Pro_OneDrive_ConfigTrait { /** * Returns [client_id, client_secret] already resolved. * * @return array{0:string|null,1:string|null} [client_id, client_secret] */ protected function one_drive_credentials(): array { $client_id = get_site_option( BackWPup_Pro_Settings_APIKeys::OPTION_ONEDRIVE_CLIENT_ID ); $client_secret = BackWPup_Encryption::decrypt( get_site_option( BackWPup_Pro_Settings_APIKeys::OPTION_ONEDRIVE_CLIENT_SECRET ) ); return [ $client_id, $client_secret ]; } /** * Default scopes (single source of truth). * * @return array */ protected function one_drive_scopes(): array { return [ 'files.read', 'files.read.all', 'files.readwrite', 'files.readwrite.all', 'offline_access', ]; } /** * Builds the configuration array for Onedrive::client(), optionally injecting the state. * * @param null $state * @return array */ protected function one_drive_client_config( $state = null ): array { $config = [ 'client_secret' => null, // filled by the caller (has the secret at hand). 'redirect_uri' => home_url( 'wp-load.php' ), 'scopes' => $this->one_drive_scopes(), ]; if ( null !== $state ) { $config['state'] = $state; } return $config; } /** * Extracts obtained/expires_in supporting array|object|ClientState|null. * Returns [obtained:int, expires:int]. Falls back to (0, 0) to force renewal if missing. * * @param mixed $client_state * @return array{0:int,1:int} [obtained, expires_in] */ protected function extract_token_times( $client_state ): array { $token = null; if ( $client_state instanceof ClientState ) { $token = $client_state->token ?? null; } elseif ( is_object( $client_state ) ) { $token = $client_state->token ?? null; } elseif ( is_array( $client_state ) ) { $token = $client_state['token'] ?? null; } if ( is_array( $token ) ) { $obtained = (int) ( $token['obtained'] ?? 0 ); $data = $token['data'] ?? []; $expires = is_array( $data ) ? (int) ( $data['expires_in'] ?? 0 ) : ( is_object( $data ) ? (int) ( $data->expires_in ?? 0 ) : 0 ); return [ $obtained, $expires ]; } if ( is_object( $token ) ) { $obtained = (int) ( $token->obtained ?? 0 ); $data = $token->data ?? null; $expires = is_array( $data ) ? (int) ( $data['expires_in'] ?? 0 ) : ( is_object( $data ) ? (int) ( $data->expires_in ?? 0 ) : 0 ); return [ $obtained, $expires ]; } return [ 0, 0 ]; } }
[-] class-system-tests-runner.php
[edit]
[-] class-jobtype-dbdump.php
[edit]
[-] class-destination-rsc.php
[edit]
[-] class-encryption.php
[edit]
[-] class-destination-downloader-factory.php
[edit]
[-] class-destination-downloader-interface.php
[edit]
[-] class-destination-ftp-type-ftp.php
[edit]
[-] class-path-fixer.php
[edit]
[-] class-message-box.php
[edit]
[-] class-destination-dropbox-api.php
[edit]
[-] class-option.php
[edit]
[-] class-destination-dropbox-api-request-exception.php
[edit]
[-] class-page-about.php
[edit]
[-] class-migrate.php
[edit]
[-] class-system-requirements.php
[edit]
[-] class-adminbar.php
[edit]
[-] class-msazure-destination-configuration.php
[edit]
[-] class-job.php
[edit]
[-] class-destination-ftp-type-exception.php
[edit]
[-] class-destination-sugarsync-api.php
[edit]
[-] class-download-file-interface.php
[edit]
[-] class-encryption-fallback.php
[edit]
[-] BackWPup.php
[edit]
[-] class-page-backwpup.php
[edit]
[-] class-destination-downloader-data.php
[edit]
[-] class-mysqldump-exception.php
[edit]
[-] class-s3-destination.php
[edit]
[-] class-destination-ftp.php
[edit]
[-] class-cron.php
[edit]
[+]
Notice
[-] class-destination-downloader.php
[edit]
[-] class-destinations.php
[edit]
[-] class-destination-ftp-downloader.php
[edit]
[-] class-destination-dropbox-downloader.php
[edit]
[-] class-download-handler.php
[edit]
[-] class-destination-dropbox.php
[edit]
[-] class-system-tests.php
[edit]
[-] class-destination-folder-downloader.php
[edit]
[-] class-destination-ftp-type.php
[edit]
[-] class-thirdparties.php
[edit]
[-] class-jobtype-wpplugin.php
[edit]
[-] class-directory.php
[edit]
[-] class-recursive-directory.php
[edit]
[-] class-destination-msazure-downloader.php
[edit]
[-] class-destination-connect-interface.php
[edit]
[-] class-install.php
[edit]
[-] class-admin.php
[edit]
[-] class-jobtype-file.php
[edit]
[-] functions.php
[edit]
[+]
Utils
[+]
ThirdParty
[-] class-destination-s3-downloader.php
[edit]
[-] class-destination-rsc-downloader.php
[edit]
[-] class-destination-sugarsync-downloader.php
[edit]
[-] class-destination-email.php
[edit]
[+]
..
[-] class-mysqldump.php
[edit]
[-] class-page-firstbackup.php
[edit]
[-] class-jobtype-wpexp.php
[edit]
[-] class-jobtype-dbcheck.php
[edit]
[-] class-file.php
[edit]
[-] class-sanitize-path.php
[edit]
[+]
Settings
[-] class-destination-s3.php
[edit]
[-] class-page-logs.php
[edit]
[-] class-factory-exception.php
[edit]
[-] class-page-restore.php
[edit]
[+]
dependencies
[-] class-create-archive-exception.php
[edit]
[-] class-page-editjob.php
[edit]
[-] class-page-backups.php
[edit]
[-] class-destination-dropbox-api-exception.php
[edit]
[-] class-create-archive.php
[edit]
[-] class-encryption-openssl.php
[edit]
[-] class-destination-onedrive-config-trait.php
[edit]
[-] class-destination-download-exception.php
[edit]
[-] class-download-file.php
[edit]
[-] class-page-settings.php
[edit]
[-] class-destination-msazure.php
[edit]
[-] class-page-onboarding.php
[edit]
[-] class-destination-folder.php
[edit]
[-] class-jobtypes.php
[edit]
[-] class-destination-connect-exception.php
[edit]
[-] class-destination-sugarsync.php
[edit]
[-] class-page-jobs.php
[edit]
[-] class-destination-sugarsync-api-exception.php
[edit]
[-] class-encryption-mcrypt.php
[edit]