/** * Runs the authentication request against the Translation Proxy API */ public function run() { $service = $this->get_current_service(); if ((bool) $service === false) { throw new RuntimeException('Tried to authenticate a service, but no service is active!'); } $service->custom_fields_data = $this->custom_field_data; $this->set_current_service($service); $project = $this->create_project($service); $translation_projects = $this->sitepress->get_setting('icl_translation_projects'); $extra_fields = $this->tp_networking->get_extra_fields_remote($project); // Store project, to be used if service is restored $translation_projects[TranslationProxy_Project::generate_service_index($service)] = array('id' => $project->id, 'access_key' => $project->access_key, 'ts_id' => $project->ts_id, 'ts_access_key' => $project->ts_access_key, 'extra_fields' => $extra_fields); $this->sitepress->set_setting('icl_translation_projects', $translation_projects, true); }