public function upload_term($term_id, $taxonomy) { $term = get_term($term_id, $taxonomy); $language = $this->pllm->get_term_language($term_id); if (empty($term) || empty($language)) { return; } $profile = self::get_profile($taxonomy, $language); if ('disabled' == $profile['profile']) { return; } $client = new Lingotek_API(); $params = array('title' => $term->name, 'content' => Lingotek_Group_Term::get_content($term), 'locale_code' => $language->lingotek_locale, 'project_id' => self::get_profile_option('project_id', $taxonomy, $language), 'workflow_id' => self::get_profile_option('workflow_id', $taxonomy, $language)); $filter_ids = array(); if (self::get_profile_option('primary_filter_id', $taxonomy, $language)) { $filter_ids['fprm_id'] = self::get_profile_option('primary_filter_id', $taxonomy, $language); } if (self::get_profile_option('secondary_filter_id', $taxonomy, $language)) { $filter_ids['fprm_subfilter_id'] = self::get_profile_option('secondary_filter_id', $taxonomy, $language); } $params = array_merge($params, $filter_ids); if (($document = $this->get_group('term', $term_id)) && 'edited' == $document->status) { $document->patch($term->name, $term, '', $filter_ids); } elseif (!Lingotek_Group::$creating_translation && !self::$copying_term) { $document_id = $client->upload_document($params, $term_id); if ($document_id) { Lingotek_Group_Term::create($term_id, $taxonomy, $language, $document_id); // If a translation profile has targets set to copy then copy them $targets_to_copy = $this->targets_to_be_copied($profile); if (!empty($targets_to_copy)) { foreach ($targets_to_copy as $target) { $this->copy_term($term, $target, $taxonomy); } } } } }