Version Description
(2021-1-29) = * Updated patching logic to reference the translation profile * Changed access token to be sent with bearer
Download this release
Release Info
Developer | elliothanna |
Plugin | Lingotek Translation |
Version | 1.4.8 |
Comparing to | |
See all releases |
Code changes from version 1.4.7 to 1.4.8
- admin/admin.php +4 -4
- admin/manage/view-edit-profile.php +1 -3
- admin/manage/view-profiles.php +17 -6
- admin/settings/connect-account.php +6 -2
- include/api.php +8 -3
- include/group-string.php +3 -12
- include/group.php +2 -9
- include/model.php +33 -35
- js/workflow/professional-workflow-defaults.js +38 -0
- lingotek.php +2 -2
- readme.txt +6 -2
admin/admin.php
CHANGED
@@ -277,13 +277,13 @@ class Lingotek_Admin {
|
|
277 |
}
|
278 |
|
279 |
// connect Lingotek account.
|
280 |
-
$access_token = filter_input(
|
281 |
-
if ( ! empty( $access_token ) ) {
|
282 |
// set and get token details.
|
283 |
$client = new Lingotek_API();
|
284 |
-
$token_details = $client->get_token_details(
|
285 |
if ( $token_details && strlen( $token_details->login_id ) ) {
|
286 |
-
update_option( 'lingotek_token', array( 'access_token' =>
|
287 |
add_settings_error( 'lingotek_token', 'account-connection', __( 'Your Lingotek account has been successfully connected.', 'lingotek-translation' ), 'updated' );
|
288 |
} else {
|
289 |
add_settings_error( 'lingotek_token', 'account-connection', __( 'Your Lingotek account was not connected. The Access Token received was invalid.', 'lingotek-translation' ), 'error' );
|
277 |
}
|
278 |
|
279 |
// connect Lingotek account.
|
280 |
+
$access_token = filter_input( INPUT_COOKIE, 'lingotek_access_token' );
|
281 |
+
if ( ! empty( $access_token ) && empty( $delete_access_token ) ) {
|
282 |
// set and get token details.
|
283 |
$client = new Lingotek_API();
|
284 |
+
$token_details = $client->get_token_details( $access_token );
|
285 |
if ( $token_details && strlen( $token_details->login_id ) ) {
|
286 |
+
update_option( 'lingotek_token', array( 'access_token' => $access_token, 'login_id' => $token_details->login_id ) );
|
287 |
add_settings_error( 'lingotek_token', 'account-connection', __( 'Your Lingotek account has been successfully connected.', 'lingotek-translation' ), 'updated' );
|
288 |
} else {
|
289 |
add_settings_error( 'lingotek_token', 'account-connection', __( 'Your Lingotek account was not connected. The Access Token received was invalid.', 'lingotek-translation' ), 'error' );
|
admin/manage/view-edit-profile.php
CHANGED
@@ -232,9 +232,7 @@ unset($settings['secondary_filter_id']['options'][$primary_filter_id]);
|
|
232 |
$selected = isset($profile['custom'][$key][$language->slug]) && $profile['custom'][$key][$language->slug] == $id ? 'selected="selected"' : '';
|
233 |
echo "\n\t<option value='" . esc_attr($id) . "' $selected>" . esc_html($title) . '</option>';
|
234 |
} ?>
|
235 |
-
</select
|
236 |
-
//if (isset($setting['description']))
|
237 |
-
//printf('<p class="description">%s</p>', $setting['description']);?>
|
238 |
</td>
|
239 |
</tr><?php
|
240 |
} ?>
|
232 |
$selected = isset($profile['custom'][$key][$language->slug]) && $profile['custom'][$key][$language->slug] == $id ? 'selected="selected"' : '';
|
233 |
echo "\n\t<option value='" . esc_attr($id) . "' $selected>" . esc_html($title) . '</option>';
|
234 |
} ?>
|
235 |
+
</select>
|
|
|
|
|
236 |
</td>
|
237 |
</tr><?php
|
238 |
} ?>
|
admin/manage/view-profiles.php
CHANGED
@@ -42,6 +42,7 @@ if (!empty($_POST)) {
|
|
42 |
}
|
43 |
|
44 |
$custom_profile_keys = array('download', 'project_id', 'workflow_id');
|
|
|
45 |
foreach ($this->pllm->get_languages_list() as $language) {
|
46 |
switch($_POST['targets'][$language->slug]) {
|
47 |
case 'custom':
|
@@ -50,10 +51,11 @@ if (!empty($_POST)) {
|
|
50 |
$profiles[$profile_id]['custom'][$key][$language->slug] = $_POST['custom'][$key][$language->slug];
|
51 |
}
|
52 |
|
53 |
-
if (empty($_POST['custom'][$key][$language->slug]) || 'default' == $_POST['custom'][$key][$language->slug]) {
|
54 |
unset($profiles[$profile_id]['custom'][$key][$language->slug]);
|
55 |
}
|
56 |
}
|
|
|
57 |
break;
|
58 |
|
59 |
case 'disabled':
|
@@ -67,9 +69,17 @@ if (!empty($_POST)) {
|
|
67 |
case 'default':
|
68 |
unset($profiles[$profile_id]['targets'][$language->slug]);
|
69 |
foreach ($custom_profile_keys as $key) {
|
70 |
-
|
|
|
|
|
71 |
}
|
72 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
}
|
74 |
|
75 |
// Add target locales to request
|
@@ -95,14 +105,16 @@ if (!empty($_POST)) {
|
|
95 |
|
96 |
?>
|
97 |
<h3><?php _e('Translation Profiles', 'lingotek-translation'); ?></h3>
|
98 |
-
<p class="description"
|
|
|
|
|
99 |
|
100 |
$table = new Lingotek_Profiles_Table();
|
101 |
$table->prepare_items($profiles);
|
102 |
?>
|
103 |
<style>
|
104 |
.tablenav {
|
105 |
-
|
106 |
}
|
107 |
</style>
|
108 |
<?php
|
@@ -111,5 +123,4 @@ printf(
|
|
111 |
'<a href="%s" class="button button-primary">%s</a>',
|
112 |
admin_url('admin.php?page=lingotek-translation_manage&sm=edit-profile'),
|
113 |
__('Add New Profile', 'lingotek-translation')
|
114 |
-
);
|
115 |
-
|
42 |
}
|
43 |
|
44 |
$custom_profile_keys = array('download', 'project_id', 'workflow_id');
|
45 |
+
|
46 |
foreach ($this->pllm->get_languages_list() as $language) {
|
47 |
switch($_POST['targets'][$language->slug]) {
|
48 |
case 'custom':
|
51 |
$profiles[$profile_id]['custom'][$key][$language->slug] = $_POST['custom'][$key][$language->slug];
|
52 |
}
|
53 |
|
54 |
+
if ($key != 'workflow_id' && (empty($_POST['custom'][$key][$language->slug]) || 'default' == $_POST['custom'][$key][$language->slug])) {
|
55 |
unset($profiles[$profile_id]['custom'][$key][$language->slug]);
|
56 |
}
|
57 |
}
|
58 |
+
$profiles[$profile_id]['targets'][$language->slug] = $_POST['targets'][$language->slug];
|
59 |
break;
|
60 |
|
61 |
case 'disabled':
|
69 |
case 'default':
|
70 |
unset($profiles[$profile_id]['targets'][$language->slug]);
|
71 |
foreach ($custom_profile_keys as $key) {
|
72 |
+
if ($key !== 'workflow_id') {
|
73 |
+
unset($profiles[$profile_id]['custom'][$key][$language->slug]);
|
74 |
+
}
|
75 |
}
|
76 |
}
|
77 |
+
if ($_POST['targets'][$language->slug] != 'disabled' && isset($_POST['custom']['workflow_id'][$language->slug])) {
|
78 |
+
$profiles[$profile_id]['custom']['workflow_id'][$language->slug] = $_POST['custom']['workflow_id'][$language->slug];
|
79 |
+
}
|
80 |
+
}
|
81 |
+
if (!isset($_POST['custom']['workflow_id'])) {
|
82 |
+
unset($profiles[$profile_id]['custom']['workflow_id']);
|
83 |
}
|
84 |
|
85 |
// Add target locales to request
|
105 |
|
106 |
?>
|
107 |
<h3><?php _e('Translation Profiles', 'lingotek-translation'); ?></h3>
|
108 |
+
<p class="description">
|
109 |
+
<?php _e('Translation profiles allow you to quickly configure and re-use translation settings.', 'lingotek-translation'); ?>
|
110 |
+
</p><?php
|
111 |
|
112 |
$table = new Lingotek_Profiles_Table();
|
113 |
$table->prepare_items($profiles);
|
114 |
?>
|
115 |
<style>
|
116 |
.tablenav {
|
117 |
+
clear: none !important;
|
118 |
}
|
119 |
</style>
|
120 |
<?php
|
123 |
'<a href="%s" class="button button-primary">%s</a>',
|
124 |
admin_url('admin.php?page=lingotek-translation_manage&sm=edit-profile'),
|
125 |
__('Add New Profile', 'lingotek-translation')
|
126 |
+
);
|
|
admin/settings/connect-account.php
CHANGED
@@ -2,8 +2,12 @@
|
|
2 |
<script>
|
3 |
var hash = window.location.hash;
|
4 |
if (hash.length && hash.indexOf("access_token") !== -1) {
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
7 |
}
|
8 |
else if (window.location.search.indexOf("connect") != -1) {
|
9 |
window.location.href = "<?php echo esc_url_raw( $connect_url ) ?>";
|
2 |
<script>
|
3 |
var hash = window.location.hash;
|
4 |
if (hash.length && hash.indexOf("access_token") !== -1) {
|
5 |
+
var regex = /^access_token=(\w{8}-\w{4}-\w{4}-\w{4}-\w{12})/;
|
6 |
+
var access_token = regex.exec(hash.substr(1));
|
7 |
+
if (access_token && access_token[1]) {
|
8 |
+
document.cookie = 'lingotek_access_token=' + access_token[1] + ';path=/';
|
9 |
+
}
|
10 |
+
window.location.href = window.location.origin + window.location.pathname + window.location.search;
|
11 |
}
|
12 |
else if (window.location.search.indexOf("connect") != -1) {
|
13 |
window.location.href = "<?php echo esc_url_raw( $connect_url ) ?>";
|
include/api.php
CHANGED
@@ -38,9 +38,14 @@ class Lingotek_API extends Lingotek_HTTP {
|
|
38 |
}
|
39 |
|
40 |
public function get_token_details($access_token) {
|
41 |
-
$url = $this->base_url
|
42 |
Lingotek_Logger::debug( "GET" , array( "url" => $url, "method" => __METHOD__));
|
43 |
-
$
|
|
|
|
|
|
|
|
|
|
|
44 |
$response_code = wp_remote_retrieve_response_code($response);
|
45 |
|
46 |
if ($response_code == 200) {
|
@@ -879,4 +884,4 @@ class Lingotek_API extends Lingotek_HTTP {
|
|
879 |
}
|
880 |
return property_exists($responseBody, "messages") && is_array($responseBody->messages) ? implode(" ",$responseBody->messages) : false;
|
881 |
}
|
882 |
-
}
|
38 |
}
|
39 |
|
40 |
public function get_token_details($access_token) {
|
41 |
+
$url = "{$this->base_url}/auth/oauth2/access_token_info";
|
42 |
Lingotek_Logger::debug( "GET" , array( "url" => $url, "method" => __METHOD__));
|
43 |
+
$args = array(
|
44 |
+
'headers' => array(
|
45 |
+
'Authorization' => "Bearer $access_token",
|
46 |
+
),
|
47 |
+
);
|
48 |
+
$response = wp_remote_get($url, $args);
|
49 |
$response_code = wp_remote_retrieve_response_code($response);
|
50 |
|
51 |
if ($response_code == 200) {
|
884 |
}
|
885 |
return property_exists($responseBody, "messages") && is_array($responseBody->messages) ? implode(" ",$responseBody->messages) : false;
|
886 |
}
|
887 |
+
}
|
include/group-string.php
CHANGED
@@ -72,17 +72,8 @@ class Lingotek_Group_String extends Lingotek_Group {
|
|
72 |
* @param string $group group name
|
73 |
* @param string $empty used for compatibility with parent class
|
74 |
*/
|
75 |
-
public function patch($
|
76 |
-
$client = new Lingotek_API();
|
77 |
-
$content = $this->get_content($group);
|
78 |
-
|
79 |
-
$params = array(
|
80 |
-
'title' => $group,
|
81 |
-
'content' => $content,
|
82 |
-
'external_url' => $external_url,
|
83 |
-
);
|
84 |
-
$params = array_merge($params, $filters);
|
85 |
-
|
86 |
$res = $client->patch_document($this->document_id, $params, $group);
|
87 |
|
88 |
if ($res !== FALSE) {
|
@@ -170,4 +161,4 @@ class Lingotek_Group_String extends Lingotek_Group {
|
|
170 |
public function get_source_language() {
|
171 |
return $this->pllm->get_language($this->pllm->options['default_lang']);
|
172 |
}
|
173 |
-
}
|
72 |
* @param string $group group name
|
73 |
* @param string $empty used for compatibility with parent class
|
74 |
*/
|
75 |
+
public function patch($params, $group = '', $content = null) {
|
76 |
+
$client = new Lingotek_API();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
$res = $client->patch_document($this->document_id, $params, $group);
|
78 |
|
79 |
if ($res !== FALSE) {
|
161 |
public function get_source_language() {
|
162 |
return $this->pllm->get_language($this->pllm->options['default_lang']);
|
163 |
}
|
164 |
+
}
|
include/group.php
CHANGED
@@ -187,15 +187,8 @@ abstract class Lingotek_Group {
|
|
187 |
* @param string $title
|
188 |
* @param object $content can be a post object, a term object
|
189 |
*/
|
190 |
-
public function patch($
|
191 |
$client = new Lingotek_API();
|
192 |
-
|
193 |
-
$params = array(
|
194 |
-
'title' => $title,
|
195 |
-
'content' => $this->get_content($content),
|
196 |
-
'external_url' => $external_url,
|
197 |
-
);
|
198 |
-
$params = array_merge($params, $filters);
|
199 |
$res = $client->patch_document($this->document_id, $params, $this->source);
|
200 |
|
201 |
if ($res !== FALSE) {
|
@@ -603,4 +596,4 @@ abstract class Lingotek_Group {
|
|
603 |
$profile = Lingotek_Model::get_profile($type, $target_language, $item_id);
|
604 |
return isset($profile['targets'][$target_language->slug]) && ('disabled' == $profile['targets'][$target_language->slug] || 'cancelled' == $profile['targets'][$target_language->slug] || 'copy' == $profile['targets'][$target_language->slug]);
|
605 |
}
|
606 |
-
}
|
187 |
* @param string $title
|
188 |
* @param object $content can be a post object, a term object
|
189 |
*/
|
190 |
+
public function patch($params) {
|
191 |
$client = new Lingotek_API();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
$res = $client->patch_document($this->document_id, $params, $this->source);
|
193 |
|
194 |
if ($res !== FALSE) {
|
596 |
$profile = Lingotek_Model::get_profile($type, $target_language, $item_id);
|
597 |
return isset($profile['targets'][$target_language->slug]) && ('disabled' == $profile['targets'][$target_language->slug] || 'cancelled' == $profile['targets'][$target_language->slug] || 'copy' == $profile['targets'][$target_language->slug]);
|
598 |
}
|
599 |
+
}
|
include/model.php
CHANGED
@@ -277,6 +277,26 @@ class Lingotek_Model {
|
|
277 |
self::$copying_term = false;
|
278 |
}
|
279 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
/**
|
281 |
* uploads a new post to Lingotek TMS and requests the targets specified
|
282 |
*
|
@@ -307,7 +327,7 @@ class Lingotek_Model {
|
|
307 |
$filter_ids = $this->get_filter_ids($post->post_type, $language, $post_id);
|
308 |
$params = array_merge($params, $filter_ids);
|
309 |
if ($document && 'edited' == $document->status) {
|
310 |
-
$document->patch($
|
311 |
} elseif (!Lingotek_Group::$creating_translation && !self::$copying_post && (!$document || $document->document_id )) {
|
312 |
update_option($post_id, true);
|
313 |
$document_id = $client->upload_document($params, $post->ID);
|
@@ -366,7 +386,7 @@ class Lingotek_Model {
|
|
366 |
$params = array_merge($params, $filter_ids);
|
367 |
|
368 |
if (($document = $this->get_group('term', $term_id)) && 'edited' == $document->status) {
|
369 |
-
$document->patch($
|
370 |
}
|
371 |
|
372 |
elseif (!Lingotek_Group::$creating_translation && !self::$copying_term) {
|
@@ -422,7 +442,7 @@ class Lingotek_Model {
|
|
422 |
$params = array_merge($params, $filter_ids);
|
423 |
|
424 |
if (($document = $this->get_group($type, $group)) && 'edited' == $document->status) {
|
425 |
-
$document->patch($params
|
426 |
}
|
427 |
else {
|
428 |
$document_id = $client->upload_document($params, $group);
|
@@ -450,11 +470,6 @@ class Lingotek_Model {
|
|
450 |
}
|
451 |
switch ($type) {
|
452 |
case 'string':
|
453 |
-
/*
|
454 |
-
$profile = self::get_profile('string', $this->pllm->get_language($this->pllm->options['default_lang']));
|
455 |
-
if ('disabled' == $profile['profile'])
|
456 |
-
return false;
|
457 |
-
*/
|
458 |
if (empty($document))
|
459 |
return true;
|
460 |
|
@@ -786,8 +801,6 @@ class Lingotek_Model {
|
|
786 |
$total = $sources[$this->pllm->options['default_lang']];
|
787 |
}
|
788 |
}
|
789 |
-
|
790 |
-
// $total -= array_sum($disabled);
|
791 |
return $r[$taxonomy] = compact('sources', 'targets', 'total');
|
792 |
}
|
793 |
|
@@ -846,36 +859,21 @@ class Lingotek_Model {
|
|
846 |
|
847 |
// Add workflows
|
848 |
if (!empty($profile['custom']['workflow_id'])) {
|
849 |
-
$temp_workflow_ids =
|
850 |
-
$
|
851 |
foreach ($wp_target_locales as $language_slug) {
|
852 |
if (isset($profile['custom']['workflow_id'][$language_slug])) {
|
853 |
-
|
854 |
-
|
855 |
-
++$num_project_default;
|
856 |
-
}
|
857 |
-
else {
|
858 |
-
$workflow_id = $profile['custom']['workflow_id'][$language_slug] === 'project-default' ? null : $profile['custom']['workflow_id'][$language_slug];
|
859 |
-
$temp_workflow_ids[] = $workflow_id;
|
860 |
-
if ($workflow_id === null) {
|
861 |
-
++$num_project_default;
|
862 |
-
}
|
863 |
-
}
|
864 |
}
|
865 |
else {
|
866 |
-
$
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
}
|
871 |
}
|
872 |
-
|
873 |
-
$params['translation_workflow_id'] = $temp_workflow_ids;
|
874 |
-
}
|
875 |
-
else {
|
876 |
-
// All selected languages will use the project default workflow, therefore unset the workflow
|
877 |
-
unset($params['translation_workflow_id']);
|
878 |
-
}
|
879 |
}
|
880 |
}
|
881 |
else {
|
@@ -898,4 +896,4 @@ class Lingotek_Model {
|
|
898 |
}
|
899 |
return $filter_ids;
|
900 |
}
|
901 |
-
}
|
277 |
self::$copying_term = false;
|
278 |
}
|
279 |
|
280 |
+
private function format_patch_params($params, $profile, $source_lang) {
|
281 |
+
$params['translation_locale_code'] = [];
|
282 |
+
$params['translation_workflow_id'] = [];
|
283 |
+
|
284 |
+
foreach ($this->pllm->get_languages_list() as $lang) {
|
285 |
+
if ($lang->lingotek_locale == $source_lang->lingotek_locale
|
286 |
+
|| (isset($profile['targets'][$lang->slug]) && $profile['targets'][$lang->slug] == 'disabled')) {
|
287 |
+
continue;
|
288 |
+
}
|
289 |
+
$params['translation_locale_code'][] = $lang->lingotek_locale;
|
290 |
+
if (isset($profile['custom']['workflow_id'][$lang->slug])) {
|
291 |
+
$params['translation_workflow_id'][] = $profile['custom']['workflow_id'][$lang->slug];
|
292 |
+
}
|
293 |
+
}
|
294 |
+
if (empty($params['translation_workflow_id'])) {
|
295 |
+
unset($params['translation_workflow_id']);
|
296 |
+
}
|
297 |
+
return $params;
|
298 |
+
}
|
299 |
+
|
300 |
/**
|
301 |
* uploads a new post to Lingotek TMS and requests the targets specified
|
302 |
*
|
327 |
$filter_ids = $this->get_filter_ids($post->post_type, $language, $post_id);
|
328 |
$params = array_merge($params, $filter_ids);
|
329 |
if ($document && 'edited' == $document->status) {
|
330 |
+
$document->patch($this->format_patch_params($params, $profile, $language));
|
331 |
} elseif (!Lingotek_Group::$creating_translation && !self::$copying_post && (!$document || $document->document_id )) {
|
332 |
update_option($post_id, true);
|
333 |
$document_id = $client->upload_document($params, $post->ID);
|
386 |
$params = array_merge($params, $filter_ids);
|
387 |
|
388 |
if (($document = $this->get_group('term', $term_id)) && 'edited' == $document->status) {
|
389 |
+
$document->patch($this->format_patch_params($params, $profile, $language), $term->name, $term);
|
390 |
}
|
391 |
|
392 |
elseif (!Lingotek_Group::$creating_translation && !self::$copying_term) {
|
442 |
$params = array_merge($params, $filter_ids);
|
443 |
|
444 |
if (($document = $this->get_group($type, $group)) && 'edited' == $document->status) {
|
445 |
+
$document->patch($this->format_patch_params($params, $profile, $language));
|
446 |
}
|
447 |
else {
|
448 |
$document_id = $client->upload_document($params, $group);
|
470 |
}
|
471 |
switch ($type) {
|
472 |
case 'string':
|
|
|
|
|
|
|
|
|
|
|
473 |
if (empty($document))
|
474 |
return true;
|
475 |
|
801 |
$total = $sources[$this->pllm->options['default_lang']];
|
802 |
}
|
803 |
}
|
|
|
|
|
804 |
return $r[$taxonomy] = compact('sources', 'targets', 'total');
|
805 |
}
|
806 |
|
859 |
|
860 |
// Add workflows
|
861 |
if (!empty($profile['custom']['workflow_id'])) {
|
862 |
+
$temp_workflow_ids = [];
|
863 |
+
$workflow_id = null;
|
864 |
foreach ($wp_target_locales as $language_slug) {
|
865 |
if (isset($profile['custom']['workflow_id'][$language_slug])) {
|
866 |
+
$profile_override = $profile['custom']['workflow_id'][$language_slug];
|
867 |
+
$workflow_id = $profile_override === 'project-default' ? $translation_workflow_id : $profile_override;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
868 |
}
|
869 |
else {
|
870 |
+
$workflow_id = $translation_workflow_id;
|
871 |
+
}
|
872 |
+
if ($workflow_id) {
|
873 |
+
$temp_workflow_ids[] = $workflow_id;
|
874 |
}
|
875 |
}
|
876 |
+
$params['translation_workflow_id'] = $temp_workflow_ids;
|
|
|
|
|
|
|
|
|
|
|
|
|
877 |
}
|
878 |
}
|
879 |
else {
|
896 |
}
|
897 |
return $filter_ids;
|
898 |
}
|
899 |
+
}
|
js/workflow/professional-workflow-defaults.js
CHANGED
@@ -30,6 +30,12 @@ jQuery(document).ready(function() {
|
|
30 |
function set_up()
|
31 |
{
|
32 |
// last_select = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
add_payment_later_listener();
|
34 |
workflow_change_listener();
|
35 |
jQuery('.payment-portal-image').prop('src', professional_vars.translation_icon);
|
@@ -112,12 +118,44 @@ jQuery(document).ready(function() {
|
|
112 |
}
|
113 |
else
|
114 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
console.log('remove');
|
116 |
jQuery(this).closest('td').find('.edit-payment-method-already-setup, .edit-payment-method-not-setup').remove();
|
117 |
}
|
118 |
});
|
119 |
}
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
function workflow_change_listener_off()
|
122 |
{
|
123 |
jQuery('#workflow_id, select[id^="custom[workflow_id]"]').off();
|
30 |
function set_up()
|
31 |
{
|
32 |
// last_select = true;
|
33 |
+
var starting_workflow_select = jQuery('#workflow_id')[0];
|
34 |
+
if (starting_workflow_select.options[starting_workflow_select.selectedIndex].text.includes('Project Default')) {
|
35 |
+
nullifyWorkflowOverrides();
|
36 |
+
} else {
|
37 |
+
resetWorkflowOverrides();
|
38 |
+
}
|
39 |
add_payment_later_listener();
|
40 |
workflow_change_listener();
|
41 |
jQuery('.payment-portal-image').prop('src', professional_vars.translation_icon);
|
118 |
}
|
119 |
else
|
120 |
{
|
121 |
+
if (e.target.id === 'workflow_id') {
|
122 |
+
var selectedText = this.options[this.selectedIndex].text;
|
123 |
+
if (selectedText.includes('Project Default')) {
|
124 |
+
nullifyWorkflowOverrides();
|
125 |
+
} else {
|
126 |
+
resetWorkflowOverrides();
|
127 |
+
}
|
128 |
+
}
|
129 |
console.log('remove');
|
130 |
jQuery(this).closest('td').find('.edit-payment-method-already-setup, .edit-payment-method-not-setup').remove();
|
131 |
}
|
132 |
});
|
133 |
}
|
134 |
|
135 |
+
function nullifyWorkflowOverrides()
|
136 |
+
{
|
137 |
+
var workflow_overrides = jQuery('select[id^="custom[workflow_id]"]');
|
138 |
+
for (var select of workflow_overrides) {
|
139 |
+
select.selectedIndex = 1; // Project Default
|
140 |
+
select.disabled = 'disabled';
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
function resetWorkflowOverrides()
|
145 |
+
{
|
146 |
+
var workflow_overrides = jQuery('select[id^="custom[workflow_id]"]');
|
147 |
+
for (var select of workflow_overrides) {
|
148 |
+
var selected_index = 0; // Global Default
|
149 |
+
select.options[1].disabled = 'disabled';
|
150 |
+
if (select.options[0].text.includes('Project Default')) {
|
151 |
+
selected_index = 2; // After initial 2 defaults
|
152 |
+
select.options[0].disabled = 'disabled';
|
153 |
+
}
|
154 |
+
select.selectedIndex = selected_index;
|
155 |
+
select.disabled = false;
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
function workflow_change_listener_off()
|
160 |
{
|
161 |
jQuery('#workflow_id, select[id^="custom[workflow_id]"]').off();
|
lingotek.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
Plugin name: Lingotek Translation
|
4 |
Plugin URI: http://lingotek.com/wordpress#utm_source=wpadmin&utm_medium=plugin&utm_campaign=wplingotektranslationplugin
|
5 |
-
Version: 1.4.
|
6 |
Author: Lingotek and Frédéric Demarle
|
7 |
Author uri: http://lingotek.com
|
8 |
Description: Lingotek offers convenient cloud-based localization and translation.
|
@@ -16,7 +16,7 @@ if ( ! function_exists( 'add_action' ) ) {
|
|
16 |
exit();
|
17 |
}
|
18 |
|
19 |
-
define( 'LINGOTEK_VERSION', '1.4.
|
20 |
define( 'LINGOTEK_MIN_PLL_VERSION', '1.8' );
|
21 |
define( 'LINGOTEK_BASENAME', plugin_basename( __FILE__ ) ); // plugin name as known by WP.
|
22 |
define( 'LINGOTEK_PLUGIN_SLUG', 'lingotek-translation' );// plugin slug (should match above meta: Text Domain).
|
2 |
/**
|
3 |
Plugin name: Lingotek Translation
|
4 |
Plugin URI: http://lingotek.com/wordpress#utm_source=wpadmin&utm_medium=plugin&utm_campaign=wplingotektranslationplugin
|
5 |
+
Version: 1.4.8
|
6 |
Author: Lingotek and Frédéric Demarle
|
7 |
Author uri: http://lingotek.com
|
8 |
Description: Lingotek offers convenient cloud-based localization and translation.
|
16 |
exit();
|
17 |
}
|
18 |
|
19 |
+
define( 'LINGOTEK_VERSION', '1.4.8' ); // plugin version (should match above meta).
|
20 |
define( 'LINGOTEK_MIN_PLL_VERSION', '1.8' );
|
21 |
define( 'LINGOTEK_BASENAME', plugin_basename( __FILE__ ) ); // plugin name as known by WP.
|
22 |
define( 'LINGOTEK_PLUGIN_SLUG', 'lingotek-translation' );// plugin slug (should match above meta: Text Domain).
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: chouby, smithworx, erichie, robertdhanna, ipoulsen, elliothanna, l
|
|
3 |
Donate link: http://lingotek.com/
|
4 |
Tags: automation, bilingual, international, language, Lingotek, localization, multilanguage, multilingual, translate, translation
|
5 |
Requires at least: 3.8
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 1.4.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -123,6 +123,10 @@ For more, visit the [Lingotek documentation site](https://lingotek.atlassian.net
|
|
123 |
|
124 |
== Changelog ==
|
125 |
|
|
|
|
|
|
|
|
|
126 |
= 1.4.7 (2020-5-13) =
|
127 |
* Changed workebench URL to allow for In-Context translation using the new workbench
|
128 |
* Returns more descriptive error message on delete and cancel translation
|
3 |
Donate link: http://lingotek.com/
|
4 |
Tags: automation, bilingual, international, language, Lingotek, localization, multilanguage, multilingual, translate, translation
|
5 |
Requires at least: 3.8
|
6 |
+
Tested up to: 5.6
|
7 |
+
Stable tag: 1.4.8
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
123 |
|
124 |
== Changelog ==
|
125 |
|
126 |
+
= 1.4.8 (2021-1-29) =
|
127 |
+
* Updated patching logic to reference the translation profile
|
128 |
+
* Changed access token to be sent with bearer
|
129 |
+
|
130 |
= 1.4.7 (2020-5-13) =
|
131 |
* Changed workebench URL to allow for In-Context translation using the new workbench
|
132 |
* Returns more descriptive error message on delete and cancel translation
|