Lingotek Translation - Version 1.1.5

Version Description

(2015-10-9) =

  • Fixed some minor bugs related to error reporting
Download this release

Release Info

Developer erichie
Plugin Icon 128x128 Lingotek Translation
Version 1.1.5
Comparing to
See all releases

Code changes from version 1.1.4 to 1.1.5

Files changed (5) hide show
  1. admin/actions.php +6 -10
  2. admin/admin.php +1 -1
  3. include/api.php +31 -29
  4. lingotek.php +2 -2
  5. readme.txt +9 -1
admin/actions.php CHANGED
@@ -516,15 +516,11 @@ abstract class Lingotek_Actions {
516
  $api_error = "\n";
517
 
518
  foreach($errors as $error => $error_message) {
519
-
520
- if ($error === 'request_translation') {
521
- foreach($errors['request_translation'] as $locale => $message) {
522
- $api_error = $api_error . $message . "\n";
523
- }
524
- }
525
- else if ($error === 'get_translation') {
526
- foreach($errors['get_translation'] as $locale => $message) {
527
- $api_error = $api_error . $message . "\n";
528
  }
529
  }
530
  else {
@@ -534,4 +530,4 @@ abstract class Lingotek_Actions {
534
 
535
  return $api_error;
536
  }
537
- }
516
  $api_error = "\n";
517
 
518
  foreach($errors as $error => $error_message) {
519
+ if (is_array($error_message)) {
520
+ if (!empty($error_message)) {
521
+ foreach ($error_message as $locale => $message) {
522
+ $api_error = $api_error . $message . "\n";
523
+ }
 
 
 
 
524
  }
525
  }
526
  else {
530
 
531
  return $api_error;
532
  }
533
+ }
admin/admin.php CHANGED
@@ -64,7 +64,7 @@ class Lingotek_Admin {
64
  );
65
 
66
  $document = $lgtm->get_group($type, $object_id);
67
- if($document && !isset($document->source) && count($document->desc_array >= 3)) {
68
  $content_metadata[$id]['existing_trans'] = true;
69
  }
70
  if ($document && isset($document->source) && isset($document->document_id) && isset($document->status) && isset($document->translations)) {
64
  );
65
 
66
  $document = $lgtm->get_group($type, $object_id);
67
+ if($document && !isset($document->source) && count($document->desc_array) >= 3) {
68
  $content_metadata[$id]['existing_trans'] = true;
69
  }
70
  if ($document && isset($document->source) && isset($document->document_id) && isset($document->status) && isset($document->translations)) {
include/api.php CHANGED
@@ -107,7 +107,9 @@ class Lingotek_API extends Lingotek_HTTP {
107
  $arr = get_option('lingotek_log_errors');
108
 
109
  if (202 == wp_remote_retrieve_response_code($response)) {
110
- unset($arr[$wp_id]);
 
 
111
  }
112
  else if (is_wp_error($response)) {
113
  $arr[$wp_id]['wp_error'] = __('Make sure you have internet connectivity');
@@ -143,7 +145,9 @@ class Lingotek_API extends Lingotek_HTTP {
143
  $arr = get_option('lingotek_log_errors');
144
 
145
  if (202 == wp_remote_retrieve_response_code($response)) {
146
- unset($arr[$wp_id]);
 
 
147
  }
148
  else if (is_wp_error($response)) {
149
  $arr[$wp_id]['wp_error'] = __('Make sure you have internet connectivity');
@@ -169,8 +173,10 @@ class Lingotek_API extends Lingotek_HTTP {
169
 
170
  if ($wp_id) {
171
  $arr = get_option('lingotek_log_errors');
172
- unset($arr[$wp_id]);
173
- update_option('lingotek_log_errors', $arr);
 
 
174
  }
175
 
176
  return !is_wp_error($response) && 204 == wp_remote_retrieve_response_code($response);
@@ -210,7 +216,9 @@ class Lingotek_API extends Lingotek_HTTP {
210
  $arr = get_option('lingotek_log_errors');
211
 
212
  if (200 == wp_remote_retrieve_response_code($response)) {
213
- unset($arr[$wp_id] );
 
 
214
  }
215
  else if (is_wp_error($response)) {
216
  $arr[$wp_id]['wp_error'] = __('Make sure you have internet connectivity');
@@ -245,7 +253,9 @@ class Lingotek_API extends Lingotek_HTTP {
245
  $arr = get_option('lingotek_log_errors');
246
 
247
  if (200 == wp_remote_retrieve_response_code($response)) {
248
- unset($arr[$wp_id]);
 
 
249
  }
250
  else if (is_wp_error($response)) {
251
  $arr[$wp_id]['wp_error'] = __('Make sure you have internet connectivity');
@@ -278,10 +288,12 @@ class Lingotek_API extends Lingotek_HTTP {
278
  $arr = get_option('lingotek_log_errors');
279
 
280
  if (201 == wp_remote_retrieve_response_code($response)) {
281
- unset($arr[$wp_id]['wp_error']);
282
- unset($arr[$wp_id]['request_translation'][$locale]);
283
- if (empty($arr[$wp_id])){
284
- unset($arr[$wp_id]);
 
 
285
  }
286
  }
287
  else if (is_wp_error($response)) {
@@ -312,10 +324,12 @@ class Lingotek_API extends Lingotek_HTTP {
312
  $arr = get_option('lingotek_log_errors');
313
 
314
  if (200 == wp_remote_retrieve_response_code($response)) {
315
- unset($arr[$wp_id]['wp_error']);
316
- unset($arr[$wp_id]['get_translation'][$locale]);
317
- if (empty($arr[$wp_id])) {
318
- unset($arr[$wp_id]);
 
 
319
  }
320
  }
321
  else if (is_wp_error($response)) {
@@ -343,23 +357,11 @@ class Lingotek_API extends Lingotek_HTTP {
343
 
344
  if ($wp_id) {
345
  $arr = get_option('lingotek_log_errors');
346
-
347
- if (204 == wp_remote_retrieve_response_code($response)) {
348
- unset($arr[$wp_id]['wp_error']);
349
- unset($arr[$wp_id]['delete_translation'][$locale]);
350
- if (empty($arr[$wp_id])) {
351
- unset($arr[$wp_id]);
352
- }
353
- }
354
- else if (is_wp_error($response)) {
355
- $arr[$wp_id]['wp_error'] = __('Make sure you have internet connectivity');
356
- }
357
- else if (400 == wp_remote_retrieve_response_code($response) || 404 == wp_remote_retrieve_response_code($response)) {
358
- $arr[$wp_id]['delete_translation'][$locale] = __('There was an error deleting translation ') . $locale . __(' for WordPress item ') . $wp_id;
359
  }
360
- update_option('lingotek_log_errors', $arr);
361
  }
362
-
363
  // FIXME send a response
364
  }
365
 
107
  $arr = get_option('lingotek_log_errors');
108
 
109
  if (202 == wp_remote_retrieve_response_code($response)) {
110
+ if (isset($arr[$wp_id])) {
111
+ unset($arr[$wp_id]);
112
+ }
113
  }
114
  else if (is_wp_error($response)) {
115
  $arr[$wp_id]['wp_error'] = __('Make sure you have internet connectivity');
145
  $arr = get_option('lingotek_log_errors');
146
 
147
  if (202 == wp_remote_retrieve_response_code($response)) {
148
+ if (isset($arr[$wp_id])) {
149
+ unset($arr[$wp_id]);
150
+ }
151
  }
152
  else if (is_wp_error($response)) {
153
  $arr[$wp_id]['wp_error'] = __('Make sure you have internet connectivity');
173
 
174
  if ($wp_id) {
175
  $arr = get_option('lingotek_log_errors');
176
+ if (isset($arr[$wp_id])) {
177
+ unset($arr[$wp_id]);
178
+ update_option('lingotek_log_errors', $arr);
179
+ }
180
  }
181
 
182
  return !is_wp_error($response) && 204 == wp_remote_retrieve_response_code($response);
216
  $arr = get_option('lingotek_log_errors');
217
 
218
  if (200 == wp_remote_retrieve_response_code($response)) {
219
+ if (isset($arr[$wp_id])) {
220
+ unset($arr[$wp_id] );
221
+ }
222
  }
223
  else if (is_wp_error($response)) {
224
  $arr[$wp_id]['wp_error'] = __('Make sure you have internet connectivity');
253
  $arr = get_option('lingotek_log_errors');
254
 
255
  if (200 == wp_remote_retrieve_response_code($response)) {
256
+ if (isset($arr[$wp_id])) {
257
+ unset($arr[$wp_id]);
258
+ }
259
  }
260
  else if (is_wp_error($response)) {
261
  $arr[$wp_id]['wp_error'] = __('Make sure you have internet connectivity');
288
  $arr = get_option('lingotek_log_errors');
289
 
290
  if (201 == wp_remote_retrieve_response_code($response)) {
291
+ if (isset($arr[$wp_id])) {
292
+ unset($arr[$wp_id]['wp_error']);
293
+ unset($arr[$wp_id]['request_translation'][$locale]);
294
+ if (empty($arr[$wp_id])){
295
+ unset($arr[$wp_id]);
296
+ }
297
  }
298
  }
299
  else if (is_wp_error($response)) {
324
  $arr = get_option('lingotek_log_errors');
325
 
326
  if (200 == wp_remote_retrieve_response_code($response)) {
327
+ if (isset($arr[$wp_id])) {
328
+ unset($arr[$wp_id]['wp_error']);
329
+ unset($arr[$wp_id]['get_translation'][$locale]);
330
+ if (empty($arr[$wp_id])) {
331
+ unset($arr[$wp_id]);
332
+ }
333
  }
334
  }
335
  else if (is_wp_error($response)) {
357
 
358
  if ($wp_id) {
359
  $arr = get_option('lingotek_log_errors');
360
+ if (isset($arr[$wp_id])) {
361
+ unset($arr[$wp_id]);
362
+ update_option('lingotek_log_errors', $arr);
 
 
 
 
 
 
 
 
 
 
363
  }
 
364
  }
 
365
  // FIXME send a response
366
  }
367
 
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.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.
@@ -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.1.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)
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.1.5
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.1.5'); // 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.3
7
- Stable tag: 1.1.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -76,6 +76,10 @@ Don't hesitate to [give your feedback](https://wordpress.org/support/view/plugin
76
 
77
  Lingotek has teamed up with [Polylang](https://wordpress.org/plugins/polylang/) to offer a simple way to make your WordPress site truly multilingual. Manage all your multilingual content in the same site. No need to have a different site for each language!
78
 
 
 
 
 
79
  = How can I add a language? =
80
 
81
  On the *translation dashboard,* click on the *Translate my site into...* textbox and choose from the list or start typing to quickly find a language.
@@ -118,6 +122,10 @@ For more, visit the [Lingotek documentation site](https://lingotek.atlassian.net
118
 
119
  == Changelog ==
120
 
 
 
 
 
121
  = 1.1.4 (2015-10-5) =
122
 
123
  * Fixed a bug that prevented the ability to add new Translation profiles
4
  Tags: automation, bilingual, international, language, Lingotek, localization, multilanguage, multilingual, translate, translation
5
  Requires at least: 3.8
6
  Tested up to: 4.3
7
+ Stable tag: 1.1.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
76
 
77
  Lingotek has teamed up with [Polylang](https://wordpress.org/plugins/polylang/) to offer a simple way to make your WordPress site truly multilingual. Manage all your multilingual content in the same site. No need to have a different site for each language!
78
 
79
+ = Why won't the plugin connect to my Lingotek account? =
80
+
81
+ The Lingotek plugin requires access to a third party API server. Your hosting provider may have a firewall in place that could be blocking those requests to outside servers. Please check with your host to allow access to Lingotek's API server. Contact support@lingotek.com for more help.
82
+
83
  = How can I add a language? =
84
 
85
  On the *translation dashboard,* click on the *Translate my site into...* textbox and choose from the list or start typing to quickly find a language.
122
 
123
  == Changelog ==
124
 
125
+ = 1.1.5 (2015-10-9) =
126
+
127
+ * Fixed some minor bugs related to error reporting
128
+
129
  = 1.1.4 (2015-10-5) =
130
 
131
  * Fixed a bug that prevented the ability to add new Translation profiles