Lingotek Translation - Version 1.5.5

Version Description

(2022-04-20) = - WordPress: Paginate the custom field type page.

Download this release

Release Info

Developer sowmiya2021
Plugin Icon 128x128 Lingotek Translation
Version 1.5.5
Comparing to
See all releases

Code changes from version 1.5.4 to 1.5.5

admin/custom-fields-table.php CHANGED
@@ -10,24 +10,29 @@ if ( ! class_exists( 'WP_List_Table' ) ) {
10
  */
11
  class Lingotek_Custom_Fields_Table extends WP_List_Table {
12
  /**
13
- * List of profiles.
14
  *
15
  * @var array
16
  */
17
- protected $profiles;
18
  /**
19
- * List of content types.
20
  *
21
  * @var array
22
  */
23
- protected $content_types;
24
 
25
  /**
26
  * Constructor
27
  *
28
  * @since 0.2
 
 
 
29
  */
30
- public function __construct() {
 
 
31
  parent::__construct(
32
  array(
33
  // Do not translate (used for css class).
@@ -37,6 +42,20 @@ class Lingotek_Custom_Fields_Table extends WP_List_Table {
37
  );
38
  }
39
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  /**
41
  * Displays the item's meta_key
42
  *
@@ -44,11 +63,8 @@ class Lingotek_Custom_Fields_Table extends WP_List_Table {
44
  *
45
  * @param array $item item.
46
  * @return string
47
- *
48
- * @deprecated Unused?
49
  */
50
  protected function column_meta_key( $item ) {
51
- printf( '<input type="checkbox" onClick="show(this);" class="boxes" name="%s" value="value1" > ', esc_html( $item['meta_key'] ) );
52
  return isset( $item['meta_key'] ) ? esc_html( $item['meta_key'] ) : '';
53
  }
54
 
@@ -58,17 +74,14 @@ class Lingotek_Custom_Fields_Table extends WP_List_Table {
58
  * @since 0.2
59
  *
60
  * @param array $item item.
61
- *
62
- * @deprecated Unused?
63
  */
64
  protected function column_setting( $item ) {
65
- $settings = array( 'translate', 'copy', 'ignore' );
66
- $custom_field_choices = get_option( 'lingotek_custom_fields', array() );
67
- printf( '<select class="custom-field-setting" name="%1$s" id="%1$s">', 'settings[' . esc_html( $item['meta_key'] ) . ']' );
68
 
69
  // select the option from the lingotek_custom_fields option.
70
  foreach ( $settings as $setting ) {
71
- if ( $setting === $custom_field_choices[ $item['meta_key'] ] ) {
72
  $selected = 'selected="selected"';
73
  } else {
74
  $selected = '';
@@ -79,26 +92,19 @@ class Lingotek_Custom_Fields_Table extends WP_List_Table {
79
  }
80
 
81
  /**
82
- * Gets the list of columns
83
- *
84
- * @since 0.2
85
- *
86
- * @return array the list of column titles
87
  */
88
  public function get_columns() {
89
  return array(
90
  // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
91
- 'meta_key' => __( '<input type="checkbox" id="master" onClick="toggle(this);" value="value2" > Custom Field Key', 'lingotek-translation' ),
 
92
  'setting' => __( 'Action', 'lingotek-translation' ),
93
  );
94
  }
95
 
96
  /**
97
- * Gets the list of sortable columns
98
- *
99
- * @since 0.2
100
- *
101
- * @return array
102
  */
103
  public function get_sortable_columns() {
104
  return array(
@@ -108,44 +114,72 @@ class Lingotek_Custom_Fields_Table extends WP_List_Table {
108
  }
109
 
110
  /**
111
- * Prepares the list of items for displaying
112
- *
113
- * @since 0.2
114
- *
115
- * @param array $data data.
116
  */
117
- public function prepare_items( $data = array() ) {
 
 
 
 
 
118
  $this->_column_headers = array( $this->get_columns(), array(), $this->get_sortable_columns() );
119
 
120
- /**
121
- * Custom sorting comparator.
122
- *
123
- * @param array $a array of strings.
124
- * @param array $b array of strings.
125
- * @return int sort direction.
126
- */
127
- function usort_reorder( $a, $b ) {
128
- $order = filter_input( INPUT_GET, 'order' );
129
- $orderby = filter_input( INPUT_GET, 'orderby' );
130
- // Determine sort order.
131
- $result = strcmp( $a[ $orderby ], $b[ $orderby ] );
132
- // Send final sort direction to usort.
133
- return ( empty( $order ) || 'asc' === $order ) ? $result : -$result;
134
- };
135
-
136
  // No sort by default.
137
  if ( ! empty( $orderby ) ) {
138
- usort( $data, 'usort_reorder' );
139
  }
140
 
141
- $total_items = count( $data );
142
- $this->items = $data;
143
-
 
 
144
  $this->set_pagination_args(
145
  array(
146
  'total_items' => $total_items,
147
- 'per_page' => count( $data ),
148
  )
149
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  }
151
  }
10
  */
11
  class Lingotek_Custom_Fields_Table extends WP_List_Table {
12
  /**
13
+ * List of custom fields to display, excluding hidden-copy fields.
14
  *
15
  * @var array
16
  */
17
+ private $custom_fields;
18
  /**
19
+ * List of custom fields.
20
  *
21
  * @var array
22
  */
23
+ private $custom_field_choices;
24
 
25
  /**
26
  * Constructor
27
  *
28
  * @since 0.2
29
+ *
30
+ * @param array $custom_fields custom fields to display.
31
+ * @param array $custom_field_choices raw custom fields.
32
  */
33
+ public function __construct( $custom_fields, $custom_field_choices ) {
34
+ $this->custom_fields = $custom_fields;
35
+ $this->custom_field_choices = $custom_field_choices;
36
  parent::__construct(
37
  array(
38
  // Do not translate (used for css class).
42
  );
43
  }
44
 
45
+ /**
46
+ * Gets the custom fields to display
47
+ *
48
+ * @since 1.5.5
49
+ *
50
+ * @param string $search Search term to filter out the list.
51
+ * @return array
52
+ */
53
+ public function get_custom_fields( $search = '' ) {
54
+ if ( ! isset( $this->custom_fields ) || ! empty( $search ) ) {
55
+ $this->custom_fields = Lingotek_Group_Post::get_cached_meta_values( $search );
56
+ }
57
+ return $this->custom_fields;
58
+ }
59
  /**
60
  * Displays the item's meta_key
61
  *
63
  *
64
  * @param array $item item.
65
  * @return string
 
 
66
  */
67
  protected function column_meta_key( $item ) {
 
68
  return isset( $item['meta_key'] ) ? esc_html( $item['meta_key'] ) : '';
69
  }
70
 
74
  * @since 0.2
75
  *
76
  * @param array $item item.
 
 
77
  */
78
  protected function column_setting( $item ) {
79
+ $settings = array( 'translate', 'copy', 'ignore' );
80
+ printf( '<select class="custom-field-setting" name="%1$s" id="%1$s" onchange="this.form.submit()">', 'settings[' . esc_html( $item['meta_key'] ) . ']' );
 
81
 
82
  // select the option from the lingotek_custom_fields option.
83
  foreach ( $settings as $setting ) {
84
+ if ( $setting === $this->custom_field_choices[ $item['meta_key'] ] ) {
85
  $selected = 'selected="selected"';
86
  } else {
87
  $selected = '';
92
  }
93
 
94
  /**
95
+ * {@inheritdoc}
 
 
 
 
96
  */
97
  public function get_columns() {
98
  return array(
99
  // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
100
+ 'cb' => '<input type="checkbox" />',
101
+ 'meta_key' => __( 'Custom Field Key', 'lingotek-translation' ),
102
  'setting' => __( 'Action', 'lingotek-translation' ),
103
  );
104
  }
105
 
106
  /**
107
+ * {@inheritdoc}
 
 
 
 
108
  */
109
  public function get_sortable_columns() {
110
  return array(
114
  }
115
 
116
  /**
117
+ * {@inheritdoc}
 
 
 
 
118
  */
119
+ public function prepare_items() {
120
+ if ( isset( $_POST['page'] ) && isset( $_POST['s'] ) ) {
121
+ $this->custom_fields = $this->get_custom_fields( $_POST['s'] );
122
+ } else {
123
+ $this->custom_fields = $this->get_custom_fields();
124
+ }
125
  $this->_column_headers = array( $this->get_columns(), array(), $this->get_sortable_columns() );
126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  // No sort by default.
128
  if ( ! empty( $orderby ) ) {
129
+ usort( $this->custom_fields, 'usort_reorder' );
130
  }
131
 
132
+ /* pagination */
133
+ $per_page = 25;
134
+ $total_items = count( $this->custom_fields );
135
+ $current_page = $this->get_pagenum();
136
+ $this->custom_fields = array_slice( $this->custom_fields, ( ( $current_page - 1 ) * $per_page ), $per_page );
137
  $this->set_pagination_args(
138
  array(
139
  'total_items' => $total_items,
140
+ 'per_page' => $per_page,
141
  )
142
  );
143
+
144
+ $this->items = $this->custom_fields;
145
+ }
146
+
147
+ /**
148
+ * Custom sorting comparator.
149
+ *
150
+ * @param array $a array of strings.
151
+ * @param array $b array of strings.
152
+ * @return int sort direction.
153
+ */
154
+ public function usort_reorder( $a, $b ) {
155
+ $order = filter_input( INPUT_GET, 'order' );
156
+ $orderby = filter_input( INPUT_GET, 'orderby' );
157
+ // Determine sort order.
158
+ $result = strcmp( $a[ $orderby ], $b[ $orderby ] );
159
+ // Send final sort direction to usort.
160
+ return ( empty( $order ) || 'asc' === $order ) ? $result : -$result;
161
+ }
162
+
163
+ /**
164
+ * {@inheritdoc}
165
+ */
166
+ public function column_cb( $item ) {
167
+ return sprintf(
168
+ '<input type="checkbox" class="boxes" name="%s" value="%s" > ',
169
+ esc_html( $item['meta_key'] ),
170
+ esc_html( $item['setting'] )
171
+ );
172
+ }
173
+
174
+ /**
175
+ * {@inheritdoc}
176
+ */
177
+ public function get_bulk_actions() {
178
+ $actions = array(
179
+ 'ignore' => 'Ignore',
180
+ 'translate' => 'Translate',
181
+ 'copy' => 'Copy',
182
+ );
183
+ return $actions;
184
  }
185
  }
admin/filters-columns.php CHANGED
@@ -126,8 +126,9 @@ class Lingotek_Filters_Columns extends PLL_Admin_Filters_Columns {
126
  if ( !isset( $lingotek_log_errors['word_limit_error'] ) && empty( $lingotek_log_errors['word_limit_error'] ) ) {
127
  return;
128
  }
129
- printf( '<div class="notice notice-error is-dismissible"><p>%s</p></div>',
130
- __( 'Processed word limit exceeded. Please contact your local administrator or Lingotek Client Success <a href="mailto:sales@lingotek.com">(sales@lingotek.com)</a> for assistance.', 'lingotek-translation' ),
 
131
  );
132
  unset( $lingotek_log_errors['word_limit_error'] );
133
  update_option( 'lingotek_log_errors', $lingotek_log_errors, false );
126
  if ( !isset( $lingotek_log_errors['word_limit_error'] ) && empty( $lingotek_log_errors['word_limit_error'] ) ) {
127
  return;
128
  }
129
+ printf(
130
+ '<div class="notice notice-error is-dismissible"><p>%s</p></div>',
131
+ __( 'Processed word limit exceeded. Please contact your local administrator or Lingotek Client Success <a href="mailto:sales@lingotek.com">(sales@lingotek.com)</a> for assistance.', 'lingotek-translation' )
132
  );
133
  unset( $lingotek_log_errors['word_limit_error'] );
134
  update_option( 'lingotek_log_errors', $lingotek_log_errors, false );
admin/filters-post.php CHANGED
@@ -139,6 +139,40 @@ class Lingotek_Filters_Post extends PLL_CRUD_Posts {
139
  wp_nonce_field( 'pll_language', '_pll_nonce' );
140
  }
141
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  /**
143
  * Uploads a post when saved for the first time
144
  *
139
  wp_nonce_field( 'pll_language', '_pll_nonce' );
140
  }
141
 
142
+ /**
143
+ * marks the elementor post as edited when the content is updated.
144
+ *
145
+ * @since 1.5.3
146
+ *
147
+ * @param int $post_ID
148
+ */
149
+ public function change_elementor_status( $post_ID ) {
150
+ $lgtm = new Lingotek_model();
151
+ $elementor_edit_mode = '_elementor_edit_mode';
152
+ $elementor_active = get_post_meta( $post_ID, $elementor_edit_mode, true );
153
+ $post = get_post( $post_ID );
154
+ if ( $elementor_active && $post) {
155
+ $document = $lgtm->get_group( 'post', $post_ID );
156
+ if ( $document ) {
157
+ $language = PLL()->model->post->get_language( $post_ID );
158
+ $document->pre_save_post( $post_ID, 'post', $language );
159
+ }
160
+ if ( $this->can_save_post_data( $post_id, $post, true ) ) {
161
+ if ( $document &&
162
+ // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
163
+ $post_ID == $document->source &&
164
+ $this->post_hash_has_changed( $post ) &&
165
+ $this->is_post_valid_for_upload_by_custom_terms( $post_ID, false ) ) {
166
+ $document->source_edited();
167
+ if ( $document->is_automatic_upload() && Lingotek_Group_Post::is_valid_auto_upload_post_status( $post->post_status ) ) {
168
+ $this->lgtm->upload_post( $post_ID );
169
+ }
170
+ return;
171
+ }
172
+ }
173
+ }
174
+ }
175
+
176
  /**
177
  * Uploads a post when saved for the first time
178
  *
admin/manage/view-custom-fields.php CHANGED
@@ -2,65 +2,71 @@
2
 
3
  global $polylang;
4
 
5
- $items = array();
6
- $default_setting = array(
7
  'ignore' => 'Ignore',
8
  'translate' => 'Translate',
9
  'copy' => 'Copy',
10
  );
 
11
  $default_custom_fields = '';
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  if ( ! empty( $_POST ) ) {
14
  check_admin_referer( 'lingotek-custom-fields', '_wpnonce_lingotek-custom-fields' );
15
 
16
- if ( ! empty( $_POST['submit'] ) ) {
 
 
 
 
 
 
 
 
 
 
17
  $arr = empty( $_POST['settings'] ) ? array() : $_POST['settings'];
18
-
19
- if ( isset( $_POST['default_custom_fields'] ) ) {
20
- $default_custom_fields = $_POST['default_custom_fields'];
21
- update_option( 'lingotek_default_custom_fields', $default_custom_fields, false );
 
 
22
  }
23
- update_option( 'lingotek_custom_fields', $arr, false );
 
 
 
 
 
 
 
 
 
 
24
  $post_types = get_post_types();
25
  foreach ( $post_types as $post_type ) {
26
  $cache_key = 'content_type_fields_' . $post_type;
27
  wp_cache_delete( $cache_key, 'lingotek' );
28
  }
29
- add_settings_error( 'lingotek_custom_fields_save', 'custom_fields', __( 'Your <i>Custom Fields</i> were sucessfully saved.', 'lingotek-translation' ), 'updated' );
30
- }
31
-
32
- // Bulk Change.
33
- if ( ! empty( $_POST['submit2'] ) ) {
34
- $arr = empty( $_POST['settings'] ) ? array() : $_POST['settings'];
35
-
36
- if ( isset( $_POST['custom_fields'] ) ) {
37
- $custom_fields = $_POST['custom_fields'];
38
- }
39
- foreach ( $_POST as $post => $value ) {
40
- if ( $value == 'value1' ) {
41
- $temp = explode( '_', $post );
42
- $temp = implode( ' ', $temp );
43
-
44
- foreach ( $arr as $item => $val ) {
45
- $temp2 = explode( '_', $item );
46
- $temp2 = implode( ' ', $temp2 );
47
- if ( $temp == $temp2 ) {
48
- $arr[ $item ] = $custom_fields;
49
- }
50
- }
51
- }
52
- }
53
- update_option( 'lingotek_custom_fields', $arr, false );
54
  }//end if
55
-
56
- if ( ! empty( $_POST['refresh'] ) ) {
57
- Lingotek_Group_Post::get_updated_meta_values();
58
- add_settings_error( 'lingotek_custom_fields_refresh', 'custom_fields', __( 'Your <i>Custom Fields</i> were sucessfully identified.', 'lingotek-translation' ), 'updated' );
59
- }
60
  settings_errors();
61
  }//end if
62
 
63
- $items = Lingotek_Group_Post::get_cached_meta_values();
64
  $default_custom_fields = get_option( 'lingotek_default_custom_fields' );
65
 
66
  ?>
@@ -69,46 +75,42 @@ $default_custom_fields = get_option( 'lingotek_default_custom_fields' );
69
  <p class="description">
70
  <?php _e( 'Custom Fields can be translated, copied, or ignored. Click "Refresh Custom Fields" to identify and enable your custom fields.', 'lingotek-translation' ); ?>
71
  </p>
72
-
73
- <form id="lingotek-custom-fields" method="post" action="admin.php?page=lingotek-translation_manage&amp;sm=custom-fields"
74
- class="validate">
75
- <?php
76
  wp_nonce_field( 'lingotek-custom-fields', '_wpnonce_lingotek-custom-fields' );
77
- ?>
78
 
79
  <br>
80
  <label for="default_custom_fields">Default configuration for new Custom Fields</label>
81
- <select name="default_custom_fields">
82
  <?php
83
- foreach ( $default_setting as $key => $title ) {
84
  $selected = $key == $default_custom_fields ? 'selected="selected"' : '';
85
  echo "\n\t<option value='" . $key . "' $selected>" . $title . '</option>';
86
  }
87
  ?>
88
  </select>
89
- </br>
90
- <div id="d1" style="display: none;">
91
- <select name="custom_fields">
92
- <?php
93
- foreach ( $default_setting as $key => $title ) {
94
- $selected = $key == $default_custom_fields ? 'selected="selected"' : '';
95
- echo "\n\t<option value='" . $key . "' $selected>" . $title . '</option>';
96
- }
97
- ?>
98
- </select>
 
 
 
 
 
99
  <?php
100
- submit_button( __( 'Bulk Change', 'lingotek-translation' ), 'primary', 'submit2', false );
101
- echo '</div>';
102
- $table = new Lingotek_Custom_Fields_Table();
103
- $table->prepare_items( $items );
104
- $table->display();
105
  ?>
106
-
107
- <p>
108
- <?php submit_button( __( 'Save Changes', 'lingotek-translation' ), 'primary', 'submit', false ); ?>
109
- <?php submit_button( __( 'Refresh Custom Fields', 'lingotek-translation' ), 'secondary', 'refresh', false ); ?>
110
- </p>
111
- </form>
112
 
113
 
114
  <?php
2
 
3
  global $polylang;
4
 
5
+ $settings = array(
 
6
  'ignore' => 'Ignore',
7
  'translate' => 'Translate',
8
  'copy' => 'Copy',
9
  );
10
+
11
  $default_custom_fields = '';
12
 
13
+ /**
14
+ * Custom fields formatted to avoid displaying hidden-copy fields
15
+ *
16
+ * @var array
17
+ */
18
+ $cached_custom_fields = Lingotek_Group_Post::get_cached_meta_values();
19
+
20
+ /**
21
+ * All custom fields
22
+ *
23
+ * @var array
24
+ */
25
+ $custom_field_choices = get_option( 'lingotek_custom_fields', array() );
26
+
27
  if ( ! empty( $_POST ) ) {
28
  check_admin_referer( 'lingotek-custom-fields', '_wpnonce_lingotek-custom-fields' );
29
 
30
+ if ( isset( $_POST['default_custom_fields'] ) ) {
31
+ // Set default setting for new custom fields
32
+ $default_custom_fields = $_POST['default_custom_fields'];
33
+ update_option( 'lingotek_default_custom_fields', $default_custom_fields, false );
34
+ add_settings_error( 'lingotek_custom_fields_default_save', 'custom_fields', __( 'Your <i> Default Custom Fields </i> setting was successfully saved.', 'lingotek-translation' ), 'updated' );
35
+ } elseif ( ! empty( $_POST['refresh'] ) ) {
36
+ // Refresh custom fields
37
+ Lingotek_Group_Post::get_updated_meta_values();
38
+ add_settings_error( 'lingotek_custom_fields_refresh', 'custom_fields', __( 'Your <i>Custom Fields</i> were sucessfully identified.', 'lingotek-translation' ), 'updated' );
39
+ } elseif ( array_key_exists( $_POST['action'], $settings ) || array_key_exists( $_POST['action2'], $settings ) ) {
40
+ // Bulk Change
41
  $arr = empty( $_POST['settings'] ) ? array() : $_POST['settings'];
42
+ // if action exists in settings, use its value. if not, check if action2 exists in settings, use its value. return false if neither exists.
43
+ $action = array_key_exists( $_POST['action'], $settings ) ? $_POST['action'] : ( array_key_exists( $_POST['action2'], $settings ) ? $_POST['action2'] : false );
44
+ foreach ( $_POST as $post => $value ) {
45
+ if ( $action && array_key_exists( $post, $custom_field_choices ) ) {
46
+ $custom_field_choices[ $post ] = $action;
47
+ }
48
  }
49
+ update_option( 'lingotek_custom_fields', $custom_field_choices, false );
50
+ add_settings_error( 'lingotek_custom_fields_save', 'custom_fields', __( 'Your <i>Bulk Custom Field Changes</i> were sucessfully saved.', 'lingotek-translation' ), 'updated' );
51
+ } elseif ( ! empty( $_POST['settings'] ) ) {
52
+ // Single field change.
53
+ $arr = empty( $_POST['settings'] ) ? array() : $_POST['settings'];
54
+ foreach ( $arr as $key => $value ) {
55
+ if ( array_key_exists( $key, $custom_field_choices ) ) {
56
+ $custom_field_choices[ $key ] = $value;
57
+ }
58
+ }
59
+ update_option( 'lingotek_custom_fields', $custom_field_choices, false );
60
  $post_types = get_post_types();
61
  foreach ( $post_types as $post_type ) {
62
  $cache_key = 'content_type_fields_' . $post_type;
63
  wp_cache_delete( $cache_key, 'lingotek' );
64
  }
65
+ add_settings_error( 'lingotek_custom_fields_save', 'custom_fields', __( 'Your <i>Custom Field</i> was sucessfully saved.', 'lingotek-translation' ), 'updated' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  }//end if
 
 
 
 
 
67
  settings_errors();
68
  }//end if
69
 
 
70
  $default_custom_fields = get_option( 'lingotek_default_custom_fields' );
71
 
72
  ?>
75
  <p class="description">
76
  <?php _e( 'Custom Fields can be translated, copied, or ignored. Click "Refresh Custom Fields" to identify and enable your custom fields.', 'lingotek-translation' ); ?>
77
  </p>
78
+ <form method="post" action="admin.php?page=lingotek-translation_manage&amp;sm=custom-fields" class="validate">
79
+ <?php
 
 
80
  wp_nonce_field( 'lingotek-custom-fields', '_wpnonce_lingotek-custom-fields' );
81
+ ?>
82
 
83
  <br>
84
  <label for="default_custom_fields">Default configuration for new Custom Fields</label>
85
+ <select name="default_custom_fields" onchange="this.form.submit()">
86
  <?php
87
+ foreach ( $settings as $key => $title ) {
88
  $selected = $key == $default_custom_fields ? 'selected="selected"' : '';
89
  echo "\n\t<option value='" . $key . "' $selected>" . $title . '</option>';
90
  }
91
  ?>
92
  </select>
93
+ </form>
94
+ </br>
95
+ <?php
96
+ $table = new Lingotek_Custom_Fields_Table( $cached_custom_fields, $custom_field_choices );
97
+ $table->prepare_items();
98
+ ?>
99
+ <form method="post">
100
+ <?php wp_nonce_field( 'lingotek-custom-fields', '_wpnonce_lingotek-custom-fields' ); ?>
101
+ <input type="hidden" name="page" value="lingotek_custom_fields_table">
102
+ <?php $table->search_box( 'search', 'search_id' ); ?>
103
+ <?php $table->display(); ?>
104
+ </form>
105
+ </br>
106
+ <div id="lingotek_submit_actions" style="display: flex;flex-direction: row;justify-content: flex-start;column-gap: 1em;">
107
+ <form method="post" action="admin.php?page=lingotek-translation_manage&amp;sm=custom-fields" class="validate" id="refresh_fields">
108
  <?php
109
+ wp_nonce_field( 'lingotek-custom-fields', '_wpnonce_lingotek-custom-fields' );
110
+ submit_button( __( 'Refresh Custom Fields', 'lingotek-translation' ), 'secondary', 'refresh', false, array( 'form' => 'refresh_fields' ) );
 
 
 
111
  ?>
112
+ </form>
113
+ </div>
 
 
 
 
114
 
115
 
116
  <?php
include/group-post.php CHANGED
@@ -279,7 +279,7 @@ class Lingotek_Group_Post extends Lingotek_Group {
279
  * @return array
280
  */
281
 
282
- public static function get_cached_meta_values() {
283
  $custom_fields_from_lingotek = get_option( 'lingotek_custom_fields', array() );
284
  $items = array();
285
 
@@ -292,7 +292,9 @@ class Lingotek_Group_Post extends Lingotek_Group {
292
  'meta_key' => $key,
293
  'setting' => $setting,
294
  );
295
- $items[] = $arr;
 
 
296
  }
297
  }
298
  return $items;
279
  * @return array
280
  */
281
 
282
+ public static function get_cached_meta_values($search = "") {
283
  $custom_fields_from_lingotek = get_option( 'lingotek_custom_fields', array() );
284
  $items = array();
285
 
292
  'meta_key' => $key,
293
  'setting' => $setting,
294
  );
295
+ if (empty($search) || stripos($key, $search) !== false) {
296
+ $items[] = $arr;
297
+ }
298
  }
299
  }
300
  return $items;
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.5.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.
@@ -19,7 +19,7 @@ if ( ! function_exists( 'add_action' ) ) {
19
  }
20
 
21
  // Plugin version (should match above meta).
22
- define( 'LINGOTEK_VERSION', '1.5.4' );
23
  define( 'LINGOTEK_MIN_PLL_VERSION', '1.8' );
24
  // Plugin name as known by WordPress.
25
  define( 'LINGOTEK_BASENAME', plugin_basename( __FILE__ ) );
@@ -320,6 +320,9 @@ class Lingotek {
320
  * @since 1.15.0
321
  */
322
  add_action( 'init', array( &$this, 'lingotek_new_ui' ), 10, 2 );
 
 
 
323
  }
324
 
325
  /**
@@ -919,6 +922,22 @@ class Lingotek {
919
  }
920
  }
921
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
922
  /**
923
  * Creates a pointer to draw attention to the new Lingotek menu item upon plugin activation
924
  * code borrowed from Polylang
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.5.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.
19
  }
20
 
21
  // Plugin version (should match above meta).
22
+ define( 'LINGOTEK_VERSION', '1.5.5' );
23
  define( 'LINGOTEK_MIN_PLL_VERSION', '1.8' );
24
  // Plugin name as known by WordPress.
25
  define( 'LINGOTEK_BASENAME', plugin_basename( __FILE__ ) );
320
  * @since 1.15.0
321
  */
322
  add_action( 'init', array( &$this, 'lingotek_new_ui' ), 10, 2 );
323
+
324
+ //Action hook that triggers after the content gets saved in the elementor editor.
325
+ add_action( 'elementor/editor/after_save', [$this, 'elementor_update_status' ] );
326
  }
327
 
328
  /**
922
  }
923
  }
924
 
925
+ /**
926
+ * Function to trigger the status update after elementor content updates.
927
+ *
928
+ * @param $post_id
929
+ * @since 1.5.3
930
+ */
931
+ public function elementor_update_status( $post_id ) {
932
+
933
+ if ( $post_id ) {
934
+ global $polylang;
935
+ $post_filters = new Lingotek_Filters_Post( $polylang );
936
+ $post_filters->change_elementor_status( $post_id );
937
+ }
938
+
939
+ }
940
+
941
  /**
942
  * Creates a pointer to draw attention to the new Lingotek menu item upon plugin activation
943
  * code borrowed from Polylang
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.8
7
- Stable tag: 1.5.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -123,6 +123,9 @@ For more, visit the [Lingotek documentation site](https://lingotek.atlassian.net
123
  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.
124
 
125
  == Changelog ==
 
 
 
126
  = 1.5.4 (2022-04-12) =
127
  - WordPress: Translations are auto uploaded after edit.
128
  - WordPress: Change when translations are auto requested
4
  Tags: automation, bilingual, international, language, Lingotek, localization, multilanguage, multilingual, translate, translation
5
  Requires at least: 3.8
6
  Tested up to: 5.8
7
+ Stable tag: 1.5.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
123
  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.
124
 
125
  == Changelog ==
126
+ = 1.5.5 (2022-04-20) =
127
+ - WordPress: Paginate the custom field type page.
128
+
129
  = 1.5.4 (2022-04-12) =
130
  - WordPress: Translations are auto uploaded after edit.
131
  - WordPress: Change when translations are auto requested