/** * Makes sure that we have an instance of GDocs. * * @return mixed Returns TRUE if we have an instance of GDocs or one has been created, a WP_Error on failure. */ private function need_gdocs() { if (!is_gdocs($this->gdocs)) { if (!$this->goauth->is_authorized()) { return new WP_Error("not_authorized", "Account is not authorized."); } $access_token = $this->goauth->get_access_token(); if (is_wp_error($access_token)) { return $access_token; } $this->gdocs = new GDocs($access_token); $this->gdocs->set_option('chunk_size', $this->options['chunk_size']); $this->gdocs->set_option('time_limit', $this->options['time_limit']); $this->gdocs->set_option('request_timeout', $this->options['request_timeout']); $this->gdocs->set_option('max_resume_attempts', $this->options['backup_attempts']); } return true; }