Lingotek Translation - Version 1.4.10

Version Description

(2021-4-15) = * Fixed bug that slowed down the download and upload process

Download this release

Release Info

Developer lopez93
Plugin Icon 128x128 Lingotek Translation
Version 1.4.10
Comparing to
See all releases

Code changes from version 1.4.9 to 1.4.10

Files changed (3) hide show
  1. include/group-post.php +23 -7
  2. lingotek.php +2 -2
  3. readme.txt +3 -1
include/group-post.php CHANGED
@@ -258,15 +258,29 @@ class Lingotek_Group_Post extends Lingotek_Group {
258
  $arr = array();
259
  $fields = self::get_content_type_fields($post->post_type, $post->ID);
260
  $content_types = get_option('lingotek_content_type');
 
 
261
  foreach (array_keys($fields) as $key) {
262
  if ('metas' == $key) {
263
- foreach (array_keys($fields['metas']) as $meta) {
264
- $value = get_post_meta($post->ID, $meta, true);
265
- if ($value)
266
- $arr['metas'][$meta] = $value;
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  }
268
  }
269
-
270
  // send slug for translation only if it has been modified
271
  elseif ('post_name' == $key && empty($content_types[$post->post_type]['fields'][$key])) {
272
  $default_slug = sanitize_title($post->post_title); // default slug created by WP
@@ -276,7 +290,6 @@ class Lingotek_Group_Post extends Lingotek_Group {
276
  $arr['post'][$key] = $post->$key;
277
  }
278
  }
279
-
280
  return json_encode($arr);
281
  }
282
 
@@ -437,7 +450,10 @@ class Lingotek_Group_Post extends Lingotek_Group {
437
  {
438
  // copy or ignore metas
439
  $custom_fields = get_option('lingotek_custom_fields', array());
440
- foreach ($custom_fields as $key => $setting) {
 
 
 
441
  if ('copy' === $setting || 'hide-copy' === $setting) {
442
  $source_meta = current(get_post_meta($post_id, $key));
443
  update_post_meta($tr_id, $key, $source_meta);
258
  $arr = array();
259
  $fields = self::get_content_type_fields($post->post_type, $post->ID);
260
  $content_types = get_option('lingotek_content_type');
261
+ $post_custom_fields = get_post_meta($post->ID);
262
+ $meta_black_list = array('_encloseme', '_edit_last', '_edit_lock', '_wp_trash_meta_status', '_wp_trash_meta_time');
263
  foreach (array_keys($fields) as $key) {
264
  if ('metas' == $key) {
265
+ foreach ($post_custom_fields as $meta => $value) {
266
+ // check for advanced custom fields meta expects a string
267
+ // so if array, check first item
268
+ $value = is_array($value) ? current($value) : $value;
269
+ if (self::is_advanced_custom_fields_meta($meta, $value) || in_array($meta, $meta_black_list)) {
270
+ continue;
271
+ }
272
+ // Get all metas in array format
273
+ $meta_value = get_post_meta($post->ID, $meta, true);
274
+ if ($meta_value && isset($fields['metas'][$meta])) {
275
+ $arr['metas'][$meta] = $meta_value;
276
+ }
277
+ }
278
+ // Check if acf is active and using these functions
279
+ $acf_empty_string = "";
280
+ if (isset($fields['metas'][$acf_empty_string]) && function_exists('acf_get_field_groups') && function_exists('acf_get_fields')) {
281
+ $arr['metas'][$acf_empty_string] = get_post_meta($post->ID, $acf_empty_string, true);
282
  }
283
  }
 
284
  // send slug for translation only if it has been modified
285
  elseif ('post_name' == $key && empty($content_types[$post->post_type]['fields'][$key])) {
286
  $default_slug = sanitize_title($post->post_title); // default slug created by WP
290
  $arr['post'][$key] = $post->$key;
291
  }
292
  }
 
293
  return json_encode($arr);
294
  }
295
 
450
  {
451
  // copy or ignore metas
452
  $custom_fields = get_option('lingotek_custom_fields', array());
453
+ $post_custom_fields = get_post_meta($post_id);
454
+ foreach ($post_custom_fields as $key => $source_meta) {
455
+ // Set to blank string to ignore if no lingotek setting has been set.
456
+ $setting = isset($custom_fields[$key]) ? $custom_fields[$key] : "";
457
  if ('copy' === $setting || 'hide-copy' === $setting) {
458
  $source_meta = current(get_post_meta($post_id, $key));
459
  update_post_meta($tr_id, $key, $source_meta);
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.9
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.9' ); // 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).
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.10
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.10' ); // 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
@@ -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: 5.6
7
- Stable tag: 1.4.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -122,6 +122,8 @@ For more, visit the [Lingotek documentation site](https://lingotek.atlassian.net
122
  5. The Lingotek Translation plugin provides the ability to Copy, Translate, and Ignore each specific custom field. Our plugin supports Wordpress custom fields and advanced custom fields.
123
 
124
  == Changelog ==
 
 
125
 
126
  = 1.4.9 (2021-2-05) =
127
  * Fixed major bug that prevented users from authenticating with Lingotek
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.10
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
122
  5. The Lingotek Translation plugin provides the ability to Copy, Translate, and Ignore each specific custom field. Our plugin supports Wordpress custom fields and advanced custom fields.
123
 
124
  == Changelog ==
125
+ = 1.4.10 (2021-4-15) =
126
+ * Fixed bug that slowed down the download and upload process
127
 
128
  = 1.4.9 (2021-2-05) =
129
  * Fixed major bug that prevented users from authenticating with Lingotek