Lingotek Translation - Version 1.3.9

Version Description

(2018-11-2) =

  • Added bulk custom fields change
  • Fixed other minor bugs
Download this release

Release Info

Developer ipoulsen
Plugin Icon 128x128 Lingotek Translation
Version 1.3.9
Comparing to
See all releases

Code changes from version 1.3.8 to 1.3.9

admin/custom-fields-table.php CHANGED
@@ -42,6 +42,8 @@ class Lingotek_Custom_Fields_Table extends WP_List_Table {
42
  * @return string
43
  */
44
  function column_meta_key( $item ) {
 
 
45
  return isset( $item['meta_key'] ) ? esc_html( $item['meta_key'] ) : '';
46
  }
47
 
@@ -53,9 +55,10 @@ class Lingotek_Custom_Fields_Table extends WP_List_Table {
53
  * @param array $item item.
54
  */
55
  function column_setting( $item ) {
 
56
  $settings = array( 'translate', 'copy', 'ignore' );
57
  $custom_field_choices = get_option( 'lingotek_custom_fields', array() );
58
-
59
  printf( '<select class="custom-field-setting" name="%1$s" id="%1$s">', 'settings[' . esc_html( $item['meta_key'] ) . ']' );
60
 
61
  // select the option from the lingotek_custom_fields option.
@@ -79,7 +82,8 @@ class Lingotek_Custom_Fields_Table extends WP_List_Table {
79
  */
80
  function get_columns() {
81
  return array(
82
- 'meta_key' => __( 'Custom Field Key', 'lingotek-translation' ),
 
83
  'setting' => __( 'Action', 'lingotek-translation' ),
84
  );
85
  }
42
  * @return string
43
  */
44
  function column_meta_key( $item ) {
45
+ // var_dump($item);
46
+ printf('<input type="checkbox" onClick="show(this);" class="boxes" name="%s" value="value1" > ',$item['meta_key'] );
47
  return isset( $item['meta_key'] ) ? esc_html( $item['meta_key'] ) : '';
48
  }
49
 
55
  * @param array $item item.
56
  */
57
  function column_setting( $item ) {
58
+ //var_dump($item);
59
  $settings = array( 'translate', 'copy', 'ignore' );
60
  $custom_field_choices = get_option( 'lingotek_custom_fields', array() );
61
+ //var_dump($custom_field_choices);
62
  printf( '<select class="custom-field-setting" name="%1$s" id="%1$s">', 'settings[' . esc_html( $item['meta_key'] ) . ']' );
63
 
64
  // select the option from the lingotek_custom_fields option.
82
  */
83
  function get_columns() {
84
  return array(
85
+
86
+ 'meta_key' => __( '<input type="checkbox" id="master" onClick="toggle(this);" value="value2" > Custom Field Key', 'lingotek-translation' ),
87
  'setting' => __( 'Action', 'lingotek-translation' ),
88
  );
89
  }
admin/manage/view-custom-fields.php CHANGED
@@ -11,6 +11,7 @@ if (!empty($_POST)) {
11
 
12
  if (!empty($_POST['submit'])) {
13
  $arr = empty($_POST['settings']) ? array() : $_POST['settings'];
 
14
  if (isset($_POST['default_custom_fields'])) {
15
  $default_custom_fields = $_POST['default_custom_fields'];
16
  update_option('lingotek_default_custom_fields', $default_custom_fields);
@@ -18,6 +19,31 @@ if (!empty($_POST)) {
18
  update_option('lingotek_custom_fields', $arr);
19
  add_settings_error('lingotek_custom_fields_save', 'custom_fields', __('Your <i>Custom Fields</i> were sucessfully saved.', 'lingotek-translation'), 'updated');
20
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  if (!empty($_POST['refresh'])) {
23
  Lingotek_Group_Post::get_updated_meta_values();
@@ -45,8 +71,17 @@ wp_nonce_field('lingotek-custom-fields', '_wpnonce_lingotek-custom-fields'); ?>
45
  echo "\n\t<option value='" . $key . "' $selected>" . $title . '</option>';
46
  } ?>
47
  </select>
48
-
 
 
 
 
 
 
 
49
  <?php
 
 
50
  $table = new Lingotek_Custom_Fields_Table();
51
  $table->prepare_items($items);
52
  $table->display();
@@ -57,3 +92,36 @@ $table->display();
57
  <?php submit_button(__( 'Refresh Custom Fields', 'lingotek-translation'), 'secondary', 'refresh', false ); ?>
58
  </p>
59
  </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  if (!empty($_POST['submit'])) {
13
  $arr = empty($_POST['settings']) ? array() : $_POST['settings'];
14
+
15
  if (isset($_POST['default_custom_fields'])) {
16
  $default_custom_fields = $_POST['default_custom_fields'];
17
  update_option('lingotek_default_custom_fields', $default_custom_fields);
19
  update_option('lingotek_custom_fields', $arr);
20
  add_settings_error('lingotek_custom_fields_save', 'custom_fields', __('Your <i>Custom Fields</i> were sucessfully saved.', 'lingotek-translation'), 'updated');
21
  }
22
+
23
+ if (!empty($_POST['submit2'])) {//Bulk Change
24
+ $arr = empty($_POST['settings']) ? array() : $_POST['settings'];
25
+
26
+ if (isset($_POST['custom_fields'])) {
27
+ $custom_fields = $_POST['custom_fields'];
28
+ }
29
+ foreach ($_POST as $post => $value){
30
+ if($value == 'value1'){
31
+ $temp = explode('_', $post);
32
+ $temp = implode(' ', $temp);
33
+
34
+ foreach ($arr as $item => $val)
35
+ {
36
+ $temp2 = explode('_', $item);
37
+ $temp2 = implode(' ', $temp2);
38
+ if($temp == $temp2){
39
+ $arr[$item] = $custom_fields;
40
+ }
41
+
42
+ }
43
+ }
44
+ }
45
+ update_option('lingotek_custom_fields', $arr);
46
+ }
47
 
48
  if (!empty($_POST['refresh'])) {
49
  Lingotek_Group_Post::get_updated_meta_values();
71
  echo "\n\t<option value='" . $key . "' $selected>" . $title . '</option>';
72
  } ?>
73
  </select>
74
+ </br>
75
+ <div id="d1" style="display: none;">
76
+ <select name="custom_fields"><?php
77
+ foreach ($default_setting as $key => $title) {
78
+ $selected = $key == $default_custom_fields ? 'selected="selected"' : '';
79
+ echo "\n\t<option value='" . $key . "' $selected>" . $title . '</option>';
80
+ } ?>
81
+ </select>
82
  <?php
83
+ submit_button(__('Bulk Change', 'lingotek-translation'), 'primary', 'submit2', false);
84
+ echo "</div>";
85
  $table = new Lingotek_Custom_Fields_Table();
86
  $table->prepare_items($items);
87
  $table->display();
92
  <?php submit_button(__( 'Refresh Custom Fields', 'lingotek-translation'), 'secondary', 'refresh', false ); ?>
93
  </p>
94
  </form>
95
+
96
+
97
+ <?php
98
+ echo"
99
+ <script>
100
+
101
+ function show(source){
102
+ var ids = document.getElementsByClassName('boxes');
103
+ for ( var i in ids) {
104
+ if (ids[i].checked == true || source.checked == true ) {
105
+ document.getElementById('d1').style.display='block';
106
+ break;
107
+ }
108
+ else{
109
+ document.getElementById('d1').style.display='none';
110
+ }
111
+ }
112
+
113
+ }
114
+ var selectedIds = [];
115
+ function toggle(source) {
116
+ document.getElementById('d1').style.display='block';
117
+ if(source.checked == false){
118
+ document.getElementById('d1').style.display='none';
119
+ }
120
+
121
+
122
+ checkboxes = document.getElementsByClassName('boxes');
123
+ for ( var i in checkboxes)
124
+ checkboxes[i].checked = source.checked;
125
+ }
126
+
127
+ </script>" ?>
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.3.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,7 +16,7 @@ if ( ! function_exists( 'add_action' ) ) {
16
  exit();
17
  }
18
 
19
- define( 'LINGOTEK_VERSION', '1.3.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).
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.3.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
  exit();
17
  }
18
 
19
+ define( 'LINGOTEK_VERSION', '1.3.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).
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.9
7
- Stable tag: 1.3.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -123,6 +123,12 @@ For more, visit the [Lingotek documentation site](https://lingotek.atlassian.net
123
 
124
  == Changelog ==
125
 
 
 
 
 
 
 
126
  = 1.3.8 (2018-7-11) =
127
 
128
  * Added document metadata fields to 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.9
7
+ Stable tag: 1.3.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
123
 
124
  == Changelog ==
125
 
126
+ = 1.3.9 (2018-11-2) =
127
+
128
+ * Added bulk custom fields change
129
+ * Fixed other minor bugs
130
+
131
+
132
  = 1.3.8 (2018-7-11) =
133
 
134
  * Added document metadata fields to translation profiles