Lingotek Translation - Version 1.0.4

Version Description

(2015-07-21) =

  • Plugin and PHP compatability improvements
Download this release

Release Info

Developer smithworx
Plugin Icon 128x128 Lingotek Translation
Version 1.0.4
Comparing to
See all releases

Code changes from version 1.0.3 to 1.0.4

admin/actions.php CHANGED
@@ -272,6 +272,7 @@ abstract class Lingotek_Actions {
272
  return $actions;
273
 
274
  $document = $this->lgtm->get_group($this->type, $id);
 
275
 
276
  if ($this->lgtm->can_upload($this->type, $id) || (isset($document->source) && 'string' != $this->type && $this->lgtm->can_upload($this->type, $document->source))) {
277
  $actions['lingotek-upload'] = $this->get_action_link(array($this->type => $id, 'action' => 'upload'));
272
  return $actions;
273
 
274
  $document = $this->lgtm->get_group($this->type, $id);
275
+ $id = $document->desc_array['lingotek']['source'];
276
 
277
  if ($this->lgtm->can_upload($this->type, $id) || (isset($document->source) && 'string' != $this->type && $this->lgtm->can_upload($this->type, $document->source))) {
278
  $actions['lingotek-upload'] = $this->get_action_link(array($this->type => $id, 'action' => 'upload'));
admin/admin.php CHANGED
@@ -44,7 +44,7 @@ class Lingotek_Admin {
44
 
45
  //The main array consists of
46
  //ids and nonces. Each id has a source language, languages with statuses, and a workbench link
47
- $content_metadata = [];
48
  foreach($object_ids as $object_id) {
49
  $id = $object_id;
50
  $document = $lgtm->get_group($taxonomy, $object_ids[$object_id]);
@@ -52,7 +52,9 @@ class Lingotek_Admin {
52
  : pll_get_post_language($document->source, 'locale');
53
  $content_metadata[$id]['source'] = $source_language;
54
  $content_metadata[$id]['doc_id'] = $document->document_id;
55
- $content_metadata[$id][$source_language]['status'] = $document->status;
 
 
56
  if(is_array($document->translations)){
57
  foreach($document->translations as $locale => $translation_status){
58
  $content_metadata[$id][$locale]['status'] = $translation_status;
44
 
45
  //The main array consists of
46
  //ids and nonces. Each id has a source language, languages with statuses, and a workbench link
47
+ $content_metadata = array();
48
  foreach($object_ids as $object_id) {
49
  $id = $object_id;
50
  $document = $lgtm->get_group($taxonomy, $object_ids[$object_id]);
52
  : pll_get_post_language($document->source, 'locale');
53
  $content_metadata[$id]['source'] = $source_language;
54
  $content_metadata[$id]['doc_id'] = $document->document_id;
55
+ $content_metadata[$id]['source_id'] = $document->source;
56
+ $target_status = $document->status == 'edited' || $document->status == null ? 'edited' : 'current';
57
+ $content_metadata[$id][$source_language]['status'] = $document->source == $object_id ? $document->status : $target_status;
58
  if(is_array($document->translations)){
59
  foreach($document->translations as $locale => $translation_status){
60
  $content_metadata[$id][$locale]['status'] = $translation_status;
admin/filters-columns.php CHANGED
@@ -63,7 +63,7 @@ class Lingotek_Filters_Columns extends PLL_Admin_Filters_Columns {
63
  * @param string $column column name
64
  * @param int $object_id id of the current object in row
65
  */
66
- protected function _column($type, $column, $object_id) {
67
  $action = 'post' == $type ? 'inline-save' : 'inline-save-tax';
68
  $inline = defined('DOING_AJAX') && $_REQUEST['action'] == $action && isset($_POST['inline_lang_choice']);
69
  $lang = $inline ?
@@ -71,7 +71,12 @@ class Lingotek_Filters_Columns extends PLL_Admin_Filters_Columns {
71
  call_user_func(array($this->model, 'get_' . $type . '_language'), $object_id);
72
 
73
  if (false === strpos($column, 'language_') || !$lang) {
74
- return '';
 
 
 
 
 
75
  }
76
 
77
  $language = $this->model->get_language(substr($column, 9));
@@ -167,8 +172,13 @@ class Lingotek_Filters_Columns extends PLL_Admin_Filters_Columns {
167
  * @param string $column column name
168
  * @param int term_id
169
  */
170
- public function term_column($empty, $column, $term_id) {
171
  $this->content_type = $GLOBALS['taxonomy'];
172
- return $this->_column('term', $column, $term_id);
 
 
 
 
 
173
  }
174
  }
63
  * @param string $column column name
64
  * @param int $object_id id of the current object in row
65
  */
66
+ protected function _column($type, $column, $object_id, $custom_data = NULL) {
67
  $action = 'post' == $type ? 'inline-save' : 'inline-save-tax';
68
  $inline = defined('DOING_AJAX') && $_REQUEST['action'] == $action && isset($_POST['inline_lang_choice']);
69
  $lang = $inline ?
71
  call_user_func(array($this->model, 'get_' . $type . '_language'), $object_id);
72
 
73
  if (false === strpos($column, 'language_') || !$lang) {
74
+ if ($custom_data) {
75
+ return $custom_data;
76
+ }
77
+ else {
78
+ return '';
79
+ }
80
  }
81
 
82
  $language = $this->model->get_language(substr($column, 9));
172
  * @param string $column column name
173
  * @param int term_id
174
  */
175
+ public function term_column($custom_data, $column, $term_id) {
176
  $this->content_type = $GLOBALS['taxonomy'];
177
+ if (!$custom_data) {
178
+ return $this->_column('term', $column, $term_id);
179
+ }
180
+ else {
181
+ return $this->_column('term', $column, $term_id, $custom_data);
182
+ }
183
  }
184
  }
admin/post-actions.php CHANGED
@@ -94,7 +94,6 @@ class Lingotek_Post_actions extends Lingotek_Actions {
94
  */
95
  public function manage_actions() {
96
  global $typenow;
97
- printf('<div id="auto-update" class="hidden"></div>');
98
  $post_type = 'load-upload.php' == current_filter() ? 'attachment' : $typenow;
99
 
100
  if (!$this->pllm->is_translated_post_type($post_type))
94
  */
95
  public function manage_actions() {
96
  global $typenow;
 
97
  $post_type = 'load-upload.php' == current_filter() ? 'attachment' : $typenow;
98
 
99
  if (!$this->pllm->is_translated_post_type($post_type))
css/admin.css CHANGED
@@ -14,7 +14,24 @@
14
  #lingotek-progressdialog .ui-dialog-titlebar-close {
15
  display: none;
16
  }
17
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  /* icons color */
19
  .lingotek-color {
20
  color: #ff7b12; /* lingotek color */
14
  #lingotek-progressdialog .ui-dialog-titlebar-close {
15
  display: none;
16
  }
17
+ .ui-dialog {
18
+ box-shadow: 0 12px 15px 0 rgba(0, 0, 0, 0.24),0 17px 50px 0 rgba(0, 0, 0, 0.19);
19
+ padding: 10px;
20
+ font-weight: 700;
21
+ }
22
+ .ui-dialog button {
23
+ position:absolute;
24
+ right: 0;
25
+ top: 0;
26
+ float: right;
27
+ background-color: #0091CD;
28
+ color: white;
29
+ border:none;
30
+ outline:none;
31
+ }
32
+ .ui-dialog button:hover {
33
+ background-color: #007fb4;
34
+ }
35
  /* icons color */
36
  .lingotek-color {
37
  color: #ff7b12; /* lingotek color */
js/updater.js CHANGED
@@ -12,7 +12,6 @@ jQuery(document).ready(function($) {
12
  var begin = url.indexOf('taxonomy=') + 'taxonomy='.length;
13
  var taxonomy_type = url.substring(begin);
14
  }
15
-
16
 
17
  if($('.edit-tags-php').length > 0){
18
  post_data['terms_translations'] = true;
@@ -41,7 +40,6 @@ jQuery(document).ready(function($) {
41
  }
42
  });
43
  },10000);
44
-
45
 
46
  function update_indicators(data){
47
  $('.lingotek-request').remove();
@@ -49,16 +47,17 @@ jQuery(document).ready(function($) {
49
  $('.lingotek-upload').remove();
50
  $('.lingotek-download').remove();
51
  for(var key in data){
 
52
  var tr = $(tr_id + key);
53
  if(data[key]['source'] === false){
54
- updateUploadBulkLink(tr, data, key, 'upload' , 'Upload this item to Lingotek TMS', 'Upload to Lingotek');
55
  continue;
56
  }
57
  if(key.indexOf('_nonce') > -1) {
58
  continue;
59
  }
60
  for(var locale in data[key]){
61
- if(locale === 'source' || locale === 'doc_id'){
62
  continue;
63
  }
64
  var td = $(tr).find('td.language_' + locale);
@@ -76,7 +75,7 @@ jQuery(document).ready(function($) {
76
  }
77
  else {
78
  var request_link = $('<a></a>').attr('href', relative_url
79
- + '/post.php?post= ' + key
80
  + '&action=edit');
81
  }
82
  $(request_link).attr('title','Source uploaded')
@@ -84,23 +83,12 @@ jQuery(document).ready(function($) {
84
  $(td).append(request_link);
85
  }
86
  else {
87
- $(td).find('.lingotek-color').remove();
88
- var request_link = $('<a></a>').attr('href', data[key][locale]['workbench_link'])
89
- .attr('title','Current')
90
- .attr('target','_blank')
91
- .addClass('lingotek-color dashicons dashicons-edit');
92
- $(td).append(request_link);
93
  }
94
  break;
95
  case 'pending':
96
- $(td).find('.pll_icon_edit').remove();
97
  updateGenericBulkLink(tr, data, key, 'status' , 'Update translations status of this item in Lingotek TMS', 'Update translations status ');
98
- $(td).find('.lingotek-color').remove();
99
- var request_link = $('<a></a>').attr('href', data[key][locale]['workbench_link'])
100
- .attr('title','In Progress')
101
- .attr('target','_blank')
102
- .addClass('lingotek-color dashicons dashicons-clock');
103
- $(td).append(request_link);
104
  break;
105
  case 'importing':
106
  $(td).find('.pll_icon_edit').remove();
@@ -108,27 +96,12 @@ jQuery(document).ready(function($) {
108
  updateIndicator(td, data, key, locale, 'status', 'Importing Source', 'clock');
109
  break;
110
  case 'not-current' :
111
- $(td).find('.pll_icon_edit').remove();
112
- $(td).find('.lingotek-color').remove();
113
- var request_link = $('<a></a>').attr('href', data[key][locale]['workbench_link'])
114
- .attr('title','The target translation is no longer current as the source content has been updated')
115
- .attr('target','_blank')
116
- .addClass('lingotek-color dashicons dashicons-edit');
117
- $(td).append(request_link);
118
  break;
119
  case 'edited':
120
  $(td).find('.pll_icon_edit').remove();
121
- updateUploadBulkLink(tr, data, key, 'upload' , 'Upload this item to Lingotek TMS', 'Upload to Lingotek');
122
- $(td).find('.lingotek-color').remove();
123
- var request_link = $('<a></a>').attr('href', relative_url
124
- + page_params + 'post= ' + key
125
- + '&locale=' + locale
126
- + '&action=lingotek-upload'
127
- + '&noheader=1'
128
- + '&_wpnonce=' + data['upload_nonce'])
129
- .attr('title','Upload Now')
130
- .addClass('lingotek-color dashicons dashicons-upload');
131
- $(td).append(request_link);
132
  break;
133
  case 'ready':
134
  updateGenericBulkLink(tr, data, key, 'download' , 'Download translations of this item from Lingotek TMS', 'Download translations');
@@ -139,12 +112,12 @@ jQuery(document).ready(function($) {
139
  if(locale === data[key]['source']){
140
  $(td).find('.lingotek-color').remove();
141
  $(td).find('.pll_icon_edit').remove();
142
- updateIndicator(td, data, key, locale, 'upload', 'Upload Now', 'upload');
143
  }
144
  else if ($(td).find('.pll_icon_add').length > 0 && data[key][data[key]['source']]['status'] === 'none'){
145
  break;
146
  }
147
- else if(source !== false && data[key][source]['status'] === 'current'){
148
  $(td).find('.pll_icon_add').remove();
149
  $(td).find('.pll_icon_edit').remove();
150
  $(td).find('.lingotek-color').remove();
@@ -163,6 +136,17 @@ jQuery(document).ready(function($) {
163
  }
164
  }
165
  }
 
 
 
 
 
 
 
 
 
 
 
166
  function updateGenericBulkLink(tr, data, key, action, title, text){
167
  var row_actions = $(tr).find('.row-actions');
168
  if($(row_actions).find('.lingotek-' + action).length === 0){
@@ -182,6 +166,7 @@ jQuery(document).ready(function($) {
182
  }
183
  }
184
  }
 
185
  function updateUploadBulkLink(tr, data, key, action, title, text){
186
  var row_actions = $(tr).find('.row-actions');
187
  if($(row_actions).find('.lingotek-' + action).length === 0){
@@ -203,6 +188,20 @@ jQuery(document).ready(function($) {
203
  }
204
  }
205
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
  function updateIndicator(td, data, key, locale, action, title, dashicon){
207
  $(td).find('.lingotek-color').remove();
208
  var request_link = $('<a></a>').attr('href', relative_url
12
  var begin = url.indexOf('taxonomy=') + 'taxonomy='.length;
13
  var taxonomy_type = url.substring(begin);
14
  }
 
15
 
16
  if($('.edit-tags-php').length > 0){
17
  post_data['terms_translations'] = true;
40
  }
41
  });
42
  },10000);
 
43
 
44
  function update_indicators(data){
45
  $('.lingotek-request').remove();
47
  $('.lingotek-upload').remove();
48
  $('.lingotek-download').remove();
49
  for(var key in data){
50
+ var source_id = key != data[key]['source_id'] ? data[key]['source_id'] : key;
51
  var tr = $(tr_id + key);
52
  if(data[key]['source'] === false){
53
+ updateUploadBulkLink(tr, data, source_id, 'upload' , 'Upload this item to Lingotek TMS', 'Upload to Lingotek');
54
  continue;
55
  }
56
  if(key.indexOf('_nonce') > -1) {
57
  continue;
58
  }
59
  for(var locale in data[key]){
60
+ if(locale === 'source' || locale === 'doc_id' || locale === 'source_id'){
61
  continue;
62
  }
63
  var td = $(tr).find('td.language_' + locale);
75
  }
76
  else {
77
  var request_link = $('<a></a>').attr('href', relative_url
78
+ + '/post.php?post=' + source_id
79
  + '&action=edit');
80
  }
81
  $(request_link).attr('title','Source uploaded')
83
  $(td).append(request_link);
84
  }
85
  else {
86
+ updateWorkbenchIcon(td, data, key, locale, 'Current', 'edit');
 
 
 
 
 
87
  }
88
  break;
89
  case 'pending':
 
90
  updateGenericBulkLink(tr, data, key, 'status' , 'Update translations status of this item in Lingotek TMS', 'Update translations status ');
91
+ updateWorkbenchIcon(td, data, key, locale, 'In Progress', 'clock');
 
 
 
 
 
92
  break;
93
  case 'importing':
94
  $(td).find('.pll_icon_edit').remove();
96
  updateIndicator(td, data, key, locale, 'status', 'Importing Source', 'clock');
97
  break;
98
  case 'not-current' :
99
+ updateWorkbenchIcon(td, data, key, locale, 'The target translation is no longer current as the source content has been updated', 'edit');
 
 
 
 
 
 
100
  break;
101
  case 'edited':
102
  $(td).find('.pll_icon_edit').remove();
103
+ updateUploadBulkLink(tr, data, source_id, 'upload' , 'Upload this item to Lingotek TMS', 'Upload to Lingotek');
104
+ updateUploadIndicator(td, data, source_id, locale);
 
 
 
 
 
 
 
 
 
105
  break;
106
  case 'ready':
107
  updateGenericBulkLink(tr, data, key, 'download' , 'Download translations of this item from Lingotek TMS', 'Download translations');
112
  if(locale === data[key]['source']){
113
  $(td).find('.lingotek-color').remove();
114
  $(td).find('.pll_icon_edit').remove();
115
+ updateUploadIndicator(td, data, key, locale);
116
  }
117
  else if ($(td).find('.pll_icon_add').length > 0 && data[key][data[key]['source']]['status'] === 'none'){
118
  break;
119
  }
120
+ else if(source !== false && data[key][source]['status'] === 'current' && key == data[key]['source_id']){
121
  $(td).find('.pll_icon_add').remove();
122
  $(td).find('.pll_icon_edit').remove();
123
  $(td).find('.lingotek-color').remove();
136
  }
137
  }
138
  }
139
+
140
+ function updateWorkbenchIcon(td, data, key, locale, title, icon){
141
+ $(td).find('.pll_icon_edit').remove();
142
+ $(td).find('.lingotek-color').remove();
143
+ var request_link = $('<a></a>').attr('href', data[key][locale]['workbench_link'])
144
+ .attr('title',title)
145
+ .attr('target','_blank')
146
+ .addClass('lingotek-color dashicons dashicons-' + icon);
147
+ $(td).append(request_link);
148
+ }
149
+
150
  function updateGenericBulkLink(tr, data, key, action, title, text){
151
  var row_actions = $(tr).find('.row-actions');
152
  if($(row_actions).find('.lingotek-' + action).length === 0){
166
  }
167
  }
168
  }
169
+
170
  function updateUploadBulkLink(tr, data, key, action, title, text){
171
  var row_actions = $(tr).find('.row-actions');
172
  if($(row_actions).find('.lingotek-' + action).length === 0){
188
  }
189
  }
190
  }
191
+
192
+ function updateUploadIndicator(td, data, key, locale){
193
+ $(td).find('.lingotek-color').remove();
194
+ var request_link = $('<a></a>').attr('href', relative_url
195
+ + page_params + 'post=' + key
196
+ + '&locale=' + locale
197
+ + '&action=lingotek-upload'
198
+ + '&noheader=1'
199
+ + '&_wpnonce=' + data['upload_nonce'])
200
+ .attr('title','Upload Now')
201
+ .addClass('lingotek-color dashicons dashicons-upload');
202
+ $(td).append(request_link);
203
+ }
204
+
205
  function updateIndicator(td, data, key, locale, action, title, dashicon){
206
  $(td).find('.lingotek-color').remove();
207
  var request_link = $('<a></a>').attr('href', relative_url
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.0.3
6
  Author: Lingotek and Frédéric Demarle
7
  Author uri: http://lingotek.com
8
  Description: Lingotek offers convenient cloud-based localization and translation.
@@ -15,7 +15,7 @@ GitHub Plugin URI: https://github.com/lingotek/wp-lingotek
15
  if (!function_exists('add_action'))
16
  exit();
17
 
18
- define('LINGOTEK_VERSION', '1.0.3'); // plugin version (should match above meta)
19
  define('LINGOTEK_MIN_PLL_VERSION', '1.7.4.2');
20
  define('LINGOTEK_BASENAME', plugin_basename(__FILE__)); // plugin name as known by WP
21
  define('LINGOTEK_PLUGIN_SLUG', 'wp-lingotek');// 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.0.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.
15
  if (!function_exists('add_action'))
16
  exit();
17
 
18
+ define('LINGOTEK_VERSION', '1.0.4'); // plugin version (should match above meta)
19
  define('LINGOTEK_MIN_PLL_VERSION', '1.7.4.2');
20
  define('LINGOTEK_BASENAME', plugin_basename(__FILE__)); // plugin name as known by WP
21
  define('LINGOTEK_PLUGIN_SLUG', 'wp-lingotek');// plugin slug (should match above meta: Text Domain)
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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: 4.2
7
- Stable tag: 1.0.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -115,6 +115,10 @@ For more, visit the [Lingotek documentation site](https://lingotek.atlassian.net
115
 
116
  == Changelog ==
117
 
 
 
 
 
118
  = 1.0.3 (2015-07-20) =
119
 
120
  * Minor usability improvements.
4
  Tags: automation, bilingual, international, language, Lingotek, localization, multilanguage, multilingual, translate, translation
5
  Requires at least: 3.8
6
  Tested up to: 4.2
7
+ Stable tag: 1.0.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
115
 
116
  == Changelog ==
117
 
118
+ = 1.0.4 (2015-07-21) =
119
+
120
+ * Plugin and PHP compatability improvements
121
+
122
  = 1.0.3 (2015-07-20) =
123
 
124
  * Minor usability improvements.