public function patch($group, $empty = '', $external_url = '', $filters = array()) { $client = new Lingotek_API(); $content = $this->get_content($group); $params = array('title' => $group, 'content' => $content, 'external_url' => $external_url); $params = array_merge($params, $filters); $res = $client->patch_document($this->document_id, $params); if ($res) { $this->md5 = md5($content); $this->status = 'importing'; $this->translations = array_fill_keys(array_keys($this->translations), 'pending'); $this->save(); } }
public function patch($title, $content, $external_url = '', $filters = array()) { $client = new Lingotek_API(); $params = array('title' => $title, 'content' => $this->get_content($content), 'external_url' => $external_url); $params = array_merge($params, $filters); $res = $client->patch_document($this->document_id, $params); if ($res) { $this->status = 'importing'; $this->translations = array_fill_keys(array_keys($this->translations), 'pending'); unset($this->desc_array['lingotek']['api_errors']['patch']); $this->save(); } else { $this->desc_array['lingotek']['api_errors']['patch'] = __('Error uploading updated post ', 'wp-lingotek') . $this->source; $this->save(); } }