Example #1
0
 public function googledrive_checkchange($google)
 {
     $opts = UpdraftPlus_Options::get_updraft_option('updraft_googledrive');
     if (!is_array($google)) {
         return $opts;
     }
     $old_client_id = empty($opts['clientid']) ? '' : $opts['clientid'];
     if (!empty($opts['token']) && $old_client_id != $google['clientid']) {
         require_once UPDRAFTPLUS_DIR . '/methods/googledrive.php';
         add_action('http_request_args', array($this, 'modify_http_options'));
         UpdraftPlus_BackupModule_googledrive::gdrive_auth_revoke(false);
         remove_action('http_request_args', array($this, 'modify_http_options'));
         $google['token'] = '';
         unset($opts['ownername']);
     }
     foreach ($google as $key => $value) {
         // Trim spaces - I got support requests from users who didn't spot the spaces they introduced when copy/pasting
         $opts[$key] = 'clientid' == $key || 'secret' == $key ? trim($value) : $value;
     }
     if (isset($opts['folder'])) {
         $opts['folder'] = apply_filters('updraftplus_options_googledrive_foldername', 'UpdraftPlus', $opts['folder']);
         unset($opts['parentid']);
     }
     return $opts;
 }
Example #2
0
 function googledrive_clientid_checkchange($client_id)
 {
     if (UpdraftPlus_Options::get_updraft_option('updraft_googledrive_token') != '' && UpdraftPlus_Options::get_updraft_option('updraft_googledrive_clientid') != $client_id) {
         require_once UPDRAFTPLUS_DIR . '/methods/googledrive.php';
         add_action('http_api_curl', array($this, 'add_curl_capath'));
         UpdraftPlus_BackupModule_googledrive::gdrive_auth_revoke(true);
         remove_action('http_api_curl', array($this, 'add_curl_capath'));
     }
     return $client_id;
 }