Lingotek Translation - Version 1.2.8

Version Description

(2017-4-17) =

  • Fixed code that got released that was not compatible with older versions of PHP which broke the plugin for some users
Download this release

Release Info

Developer robertdhanna
Plugin Icon 128x128 Lingotek Translation
Version 1.2.8
Comparing to
See all releases

Code changes from version 1.2.7 to 1.2.8

Files changed (82) hide show
  1. admin/actions.php +0 -0
  2. admin/admin.php +22 -16
  3. admin/content-table.php +5 -3
  4. admin/custom-fields-table.php +5 -3
  5. admin/filters-columns.php +34 -32
  6. admin/filters-media.php +0 -0
  7. admin/filters-post.php +0 -0
  8. admin/filters-term.php +7 -3
  9. admin/manage/view-content.php +0 -0
  10. admin/manage/view-custom-fields.php +0 -0
  11. admin/manage/view-edit-profile.php +0 -0
  12. admin/manage/view-profiles.php +0 -0
  13. admin/manage/view-string-groups.php +0 -0
  14. admin/manage/view-strings.php +0 -0
  15. admin/post-actions.php +20 -28
  16. admin/profiles-table.php +5 -3
  17. admin/settings.php +5 -4
  18. admin/settings/connect-account.php +5 -5
  19. admin/settings/view-account.php +0 -0
  20. admin/settings/view-defaults.php +9 -5
  21. admin/settings/view-preferences.php +10 -3
  22. admin/settings/view-utilities.php +5 -4
  23. admin/string-actions.php +0 -0
  24. admin/strings-table.php +9 -7
  25. admin/table-string.php +4 -2
  26. admin/term-actions.php +0 -0
  27. admin/tutorial/content.php +0 -0
  28. admin/tutorial/credits.php +0 -0
  29. admin/tutorial/faq.php +0 -0
  30. admin/tutorial/features.php +0 -0
  31. admin/tutorial/img/add-languages.png +0 -0
  32. admin/tutorial/img/add-page.png +0 -0
  33. admin/tutorial/img/add-page2.png +0 -0
  34. admin/tutorial/img/automatic-translation.gif +0 -0
  35. admin/tutorial/img/automatic-translation.png +0 -0
  36. admin/tutorial/img/check-status.png +0 -0
  37. admin/tutorial/img/content-types.png +0 -0
  38. admin/tutorial/img/dashboard.png +0 -0
  39. admin/tutorial/img/polylang-compatible.png +0 -0
  40. admin/tutorial/img/pro-translation.png +0 -0
  41. admin/tutorial/img/professional-translation.png +0 -0
  42. admin/tutorial/img/ready-to-upload.png +0 -0
  43. admin/tutorial/img/request-translations.png +0 -0
  44. admin/tutorial/img/translation-profiles.png +0 -0
  45. admin/tutorial/img/translation-services.png +0 -0
  46. admin/tutorial/img/translations-downloaded.png +0 -0
  47. admin/tutorial/img/translations-ready-for-download.png +0 -0
  48. admin/tutorial/img/translations-underway.png +0 -0
  49. admin/tutorial/img/workbench-full.png +0 -0
  50. admin/tutorial/img/workbench.png +0 -0
  51. admin/utilities.php +0 -0
  52. admin/view-dashboard.php +0 -0
  53. admin/view-manage.php +0 -0
  54. admin/view-network.php +0 -0
  55. admin/view-tutorial.php +0 -0
  56. admin/workflows/professional-translation-workflow.php +10 -10
  57. admin/workflows/workflow-factory.php +2 -2
  58. admin/workflows/workflow.php +30 -26
  59. admin/wp-import.php +0 -0
  60. css/admin.css +0 -0
  61. img/lingotek-chevrons-blue.png +0 -0
  62. img/lingotek-icon.png +0 -0
  63. img/lingotek-white.png +0 -0
  64. include/api.php +0 -0
  65. include/callback.php +0 -0
  66. include/dashboard.php +0 -0
  67. include/group-post.php +6 -3
  68. include/group-string.php +0 -0
  69. include/group-term.php +0 -0
  70. include/group.php +0 -0
  71. include/http.php +0 -0
  72. include/model.php +0 -0
  73. include/plugins-compat.php +0 -0
  74. include/pointer.php +0 -0
  75. js/defaults.js +0 -0
  76. js/progress.js +0 -0
  77. js/updater.js +0 -0
  78. languages/wp-lingotek-fr_FR.mo +0 -0
  79. languages/wp-lingotek-fr_FR.po +0 -0
  80. lingotek.php +40 -17
  81. readme.txt +5 -1
  82. uninstall.php +0 -0
admin/actions.php CHANGED
File without changes
admin/admin.php CHANGED
@@ -49,16 +49,17 @@ class Lingotek_Admin {
49
  if ( null === $object_ids ) {
50
  return;
51
  }
52
- $terms = ! empty( filter_input( INPUT_POST, 'terms_translations' ) );
 
53
 
54
  // The main array consists of ids and nonces. Each id has a source language, languages with statuses, and a workbench link.
55
  $content_metadata = array();
56
  foreach ( $object_ids as $object_id ) {
57
  $id = $object_id;
58
  $type = $terms ? 'term' : 'post';
59
- if ( ! empty( filter_input( INPUT_POST, 'taxonomy' ) ) ) {
60
- $taxonomy = filter_input( INPUT_POST, 'taxonomy' );
61
- if ( strpos( filter_input( INPUT_POST, 'taxonomy' ), '&' ) ) {
62
  $taxonomy = strstr( filter_input( INPUT_POST, 'taxonomy' ), '&', true );
63
  }
64
  } else {
@@ -258,14 +259,16 @@ class Lingotek_Admin {
258
  public function display_settings_page() {
259
 
260
  // disconnect Lingotek account.
261
- if ( ! empty( filter_input( INPUT_GET, 'delete_access_token' ) ) ) {
 
262
  delete_option( 'lingotek_token' );
263
  delete_option( 'lingotek_community' );
264
  delete_option( 'lingotek_defaults' );
265
  }
266
 
267
  // connect Lingotek account.
268
- if ( ! empty( filter_input( INPUT_GET, 'access_token' ) ) ) {
 
269
  // set and get token details.
270
  $client = new Lingotek_API();
271
  $token_details = $client->get_token_details( filter_input( INPUT_GET, 'access_token' ) );
@@ -279,16 +282,18 @@ class Lingotek_Admin {
279
 
280
  // set page key primarily used for form submissions.
281
  $page_key = $this->plugin_slug . '_settings';
282
- if ( ! empty( filter_input( INPUT_GET, 'sm' ) ) ) {
283
- $page_key .= '&sm=' . sanitize_text_field( filter_input( INPUT_GET, 'sm' ) );
 
284
  }
285
 
286
  // set community.
287
- if ( ! empty( filter_input( INPUT_POST, 'lingotek_community' ) ) && strlen( filter_input( INPUT_POST, 'lingotek_community' ) ) ) {
 
288
  check_admin_referer( $page_key, '_wpnonce_' . $page_key );
289
- update_option( 'lingotek_community', filter_input( INPUT_POST, 'lingotek_community' ) );
290
  add_settings_error( 'lingotek_community', 'update', __( 'Your community has been successfully saved.', 'lingotek-translation' ), 'updated' );
291
- $this->set_community_resources( filter_input( INPUT_POST, 'lingotek_community' ) );
292
  }
293
  $community_id = get_option( 'lingotek_community' );
294
  if ( ! $community_id ) {
@@ -306,9 +311,10 @@ class Lingotek_Admin {
306
  } else {
307
  $connect_url = '';
308
  // connect cloak redirect.
309
- if ( ! empty( filter_input( INPUT_GET, 'connect' ) ) ) {
 
310
  // set sandbox or production (after button clicked).
311
- if ( 0 === strcasecmp( filter_input( INPUT_GET, 'connect' ),'sandbox' ) ) {
312
  update_option( 'lingotek_base_url', Lingotek_API::SANDBOX_URL );
313
  } else {
314
  update_option( 'lingotek_base_url', Lingotek_API::PRODUCTION_URL );
@@ -316,7 +322,7 @@ class Lingotek_Admin {
316
  $client = new Lingotek_API();
317
  echo '<div class="wrap"><p class="description">' . esc_html( __( 'Redirecting to Lingotek to connect your account...','lingotek-translation' ) ) . '</p></div>';
318
 
319
- $connect_url = (0 === strcasecmp( filter_input( INPUT_GET, 'connect' ),'new' )) ? $client->get_new_url( $redirect_url ) : $client->get_connect_url( $redirect_url );
320
  }
321
  $connect_account_cloak_url_new = admin_url( 'admin.php?page=' . $this->plugin_slug . '_settings&connect=new' );
322
  $connect_account_cloak_url_test = admin_url( 'admin.php?page=' . $this->plugin_slug . '_settings&connect=sandbox' );
@@ -464,10 +470,10 @@ class Lingotek_Admin {
464
  }
465
  $diff = array_diff_key( $workflows, $default_workflows );
466
  if ( empty( $diff ) ) {
467
- $workflows = [
468
  'c675bd20-0688-11e2-892e-0800200c9a66' => 'Machine Translation',
469
  // 'professional-translation' => 'Professional Translation',
470
- ];
471
  }
472
  natcasesort( $workflows ); // order by title (case-insensitive).
473
  $refresh_success['workflows'] = true;
49
  if ( null === $object_ids ) {
50
  return;
51
  }
52
+ $terms_translations = filter_input( INPUT_POST, 'terms_translations' );
53
+ $terms = ! empty( $terms_translations );
54
 
55
  // The main array consists of ids and nonces. Each id has a source language, languages with statuses, and a workbench link.
56
  $content_metadata = array();
57
  foreach ( $object_ids as $object_id ) {
58
  $id = $object_id;
59
  $type = $terms ? 'term' : 'post';
60
+ $taxonomy = filter_input( INPUT_POST, 'taxonomy' );
61
+ if ( ! empty( $taxonomy ) ) {
62
+ if ( strpos( $taxonomy, '&' ) ) {
63
  $taxonomy = strstr( filter_input( INPUT_POST, 'taxonomy' ), '&', true );
64
  }
65
  } else {
259
  public function display_settings_page() {
260
 
261
  // disconnect Lingotek account.
262
+ $delete_access_token = filter_input( INPUT_GET, 'delete_access_token' );
263
+ if ( ! empty( $delete_access_token ) ) {
264
  delete_option( 'lingotek_token' );
265
  delete_option( 'lingotek_community' );
266
  delete_option( 'lingotek_defaults' );
267
  }
268
 
269
  // connect Lingotek account.
270
+ $access_token = filter_input( INPUT_GET, 'access_token' );
271
+ if ( ! empty( $access_token ) ) {
272
  // set and get token details.
273
  $client = new Lingotek_API();
274
  $token_details = $client->get_token_details( filter_input( INPUT_GET, 'access_token' ) );
282
 
283
  // set page key primarily used for form submissions.
284
  $page_key = $this->plugin_slug . '_settings';
285
+ $sm = filter_input( INPUT_GET, 'sm' );
286
+ if ( ! empty( $sm ) ) {
287
+ $page_key .= '&sm=' . sanitize_text_field( $sm );
288
  }
289
 
290
  // set community.
291
+ $lingotek_community = filter_input( INPUT_POST, 'lingotek_community' );
292
+ if ( ! empty( $lingotek_community ) && strlen( $lingotek_community ) ) {
293
  check_admin_referer( $page_key, '_wpnonce_' . $page_key );
294
+ update_option( 'lingotek_community', $lingotek_community );
295
  add_settings_error( 'lingotek_community', 'update', __( 'Your community has been successfully saved.', 'lingotek-translation' ), 'updated' );
296
+ $this->set_community_resources( $lingotek_community );
297
  }
298
  $community_id = get_option( 'lingotek_community' );
299
  if ( ! $community_id ) {
311
  } else {
312
  $connect_url = '';
313
  // connect cloak redirect.
314
+ $connect = filter_input( INPUT_GET, 'connect' );
315
+ if ( ! empty( $connect ) ) {
316
  // set sandbox or production (after button clicked).
317
+ if ( 0 === strcasecmp( $connect,'sandbox' ) ) {
318
  update_option( 'lingotek_base_url', Lingotek_API::SANDBOX_URL );
319
  } else {
320
  update_option( 'lingotek_base_url', Lingotek_API::PRODUCTION_URL );
322
  $client = new Lingotek_API();
323
  echo '<div class="wrap"><p class="description">' . esc_html( __( 'Redirecting to Lingotek to connect your account...','lingotek-translation' ) ) . '</p></div>';
324
 
325
+ $connect_url = (0 === strcasecmp( $connect,'new' )) ? $client->get_new_url( $redirect_url ) : $client->get_connect_url( $redirect_url );
326
  }
327
  $connect_account_cloak_url_new = admin_url( 'admin.php?page=' . $this->plugin_slug . '_settings&connect=new' );
328
  $connect_account_cloak_url_test = admin_url( 'admin.php?page=' . $this->plugin_slug . '_settings&connect=sandbox' );
470
  }
471
  $diff = array_diff_key( $workflows, $default_workflows );
472
  if ( empty( $diff ) ) {
473
+ $workflows = array(
474
  'c675bd20-0688-11e2-892e-0800200c9a66' => 'Machine Translation',
475
  // 'professional-translation' => 'Professional Translation',
476
+ );
477
  }
478
  natcasesort( $workflows ); // order by title (case-insensitive).
479
  $refresh_success['workflows'] = true;
admin/content-table.php CHANGED
@@ -201,11 +201,13 @@ class Lingotek_Content_Table extends WP_List_Table {
201
  * @return int sort direction.
202
  */
203
  function usort_reorder( $a, $b ) {
204
- $result = strcmp( $a[ filter_input( INPUT_GET, 'orderby' ) ], $b[ filter_input( INPUT_GET, 'orderby' ) ] ); // determine sort order.
205
- return (empty( filter_input( INPUT_GET, 'order' ) ) || filter_input( INPUT_GET, 'order' ) === 'asc') ? $result : -$result; // send final sort direction to usort.
 
 
206
  };
207
 
208
- if ( ! empty( filter_input( INPUT_GET, 'orderby' ) ) ) { // no sort by default.
209
  usort( $data, 'usort_reorder' );
210
  }
211
 
201
  * @return int sort direction.
202
  */
203
  function usort_reorder( $a, $b ) {
204
+ $order = filter_input( INPUT_GET, 'order' );
205
+ $orderby = filter_input( INPUT_GET, 'orderby' );
206
+ $result = strcmp( $a[ $orderby ], $b[ $orderby ] ); // determine sort order.
207
+ return (empty( $order ) || $order === 'asc') ? $result : -$result; // send final sort direction to usort.
208
  };
209
 
210
+ if ( ! empty( $orderby ) ) { // no sort by default.
211
  usort( $data, 'usort_reorder' );
212
  }
213
 
admin/custom-fields-table.php CHANGED
@@ -115,11 +115,13 @@ class Lingotek_Custom_Fields_Table extends WP_List_Table {
115
  * @return int sort direction.
116
  */
117
  function usort_reorder( $a, $b ) {
118
- $result = strcmp( $a[ filter_input( INPUT_GET, 'orderby' ) ], $b[ filter_input( INPUT_GET, 'orderby' ) ] ); // determine sort order.
119
- return (empty( filter_input( INPUT_GET, 'order' ) ) || 'asc' === filter_input( INPUT_GET, 'order' ) ) ? $result : -$result; // send final sort direction to usort.
 
 
120
  };
121
 
122
- if ( ! empty( filter_input( INPUT_GET, 'orderby' ) ) ) { // no sort by default.
123
  usort( $data, 'usort_reorder' );
124
  }
125
 
115
  * @return int sort direction.
116
  */
117
  function usort_reorder( $a, $b ) {
118
+ $order = filter_input( INPUT_GET, 'order' );
119
+ $orderby = filter_input( INPUT_GET, 'orderby' );
120
+ $result = strcmp( $a[ $orderby ], $b[ $orderby ] ); // determine sort order.
121
+ return (empty( $order ) || 'asc' === $order ) ? $result : -$result; // send final sort direction to usort.
122
  };
123
 
124
+ if ( ! empty( $orderby ) ) { // no sort by default.
125
  usort( $data, 'usort_reorder' );
126
  }
127
 
admin/filters-columns.php CHANGED
@@ -72,9 +72,11 @@ class Lingotek_Filters_Columns extends PLL_Admin_Filters_Columns {
72
  */
73
  protected function _column( $type, $column, $object_id, $custom_data = null ) {
74
  $action = 'post' === $type ? 'inline-save' : 'inline-save-tax';
75
- $inline = defined( 'DOING_AJAX' ) && filter_input( INPUT_GET, 'action' ) === $action && ! empty( filter_input( INPUT_POST, 'inline_lang_choice' ) );
 
 
76
  $lang = $inline ?
77
- $this->model->get_language( filter_input( INPUT_POST, 'inline_lang_choice' ) ) :
78
  'post' === $type ? PLL()->model->post->get_language( $object_id ) : PLL()->model->term->get_language( $object_id );
79
 
80
  if ( false === strpos( $column, 'language_' ) || ! $lang ) {
@@ -171,16 +173,16 @@ class Lingotek_Filters_Columns extends PLL_Admin_Filters_Columns {
171
  public function post_column( $column, $post_id ) {
172
  $this->content_type = get_post_type( $post_id );
173
 
174
- $allowed_html = [
175
- 'a' => [
176
- 'href' => [],
177
- 'class' => [],
178
- 'title' => [],
179
- ],
180
- 'div' => [
181
- 'class' => [],
182
- ],
183
- ];
184
  echo wp_kses( $this->_column( 'post', $column, $post_id ), $allowed_html );
185
 
186
  /**
@@ -214,19 +216,19 @@ class Lingotek_Filters_Columns extends PLL_Admin_Filters_Columns {
214
  * @param int $term_id term id.
215
  */
216
  public function term_column( $custom_data, $column, $term_id ) {
217
- $allowed_html = [
218
- 'a' => [
219
- 'href' => [],
220
- 'class' => [],
221
- 'title' => [],
222
- ],
223
- 'div' => [
224
- 'class' => [],
225
- ],
226
- 'span' => [
227
- 'class' => [],
228
- ],
229
- ];
230
  $this->content_type = $GLOBALS['taxonomy'];
231
 
232
  /**
@@ -264,13 +266,13 @@ class Lingotek_Filters_Columns extends PLL_Admin_Filters_Columns {
264
  if ( $source_column === $source_locale ) {
265
  if ( isset( $errors[ $object_id ] ) ) {
266
  $api_error = Lingotek_Actions::retrieve_api_error( $errors[ $object_id ] );
267
- $allowed_html = [
268
- 'a' => [
269
- 'href' => [],
270
- 'class' => [],
271
- 'title' => [],
272
- ],
273
- ];
274
  echo wp_kses( Lingotek_Actions::display_error_icon( 'error', $api_error ), $allowed_html );
275
  }
276
  }
72
  */
73
  protected function _column( $type, $column, $object_id, $custom_data = null ) {
74
  $action = 'post' === $type ? 'inline-save' : 'inline-save-tax';
75
+ $get_action = filter_input( INPUT_GET, 'action' );
76
+ $inline_lang_choice = filter_input( INPUT_POST, 'inline_lang_choice' );
77
+ $inline = defined( 'DOING_AJAX' ) && $get_action === $action && ! empty( $inline_lang_choice );
78
  $lang = $inline ?
79
+ $this->model->get_language( $inline_lang_choice ) :
80
  'post' === $type ? PLL()->model->post->get_language( $object_id ) : PLL()->model->term->get_language( $object_id );
81
 
82
  if ( false === strpos( $column, 'language_' ) || ! $lang ) {
173
  public function post_column( $column, $post_id ) {
174
  $this->content_type = get_post_type( $post_id );
175
 
176
+ $allowed_html = array(
177
+ 'a' => array(
178
+ 'href' => array(),
179
+ 'class' => array(),
180
+ 'title' => array(),
181
+ ),
182
+ 'div' => array(
183
+ 'class' => array(),
184
+ ),
185
+ );
186
  echo wp_kses( $this->_column( 'post', $column, $post_id ), $allowed_html );
187
 
188
  /**
216
  * @param int $term_id term id.
217
  */
218
  public function term_column( $custom_data, $column, $term_id ) {
219
+ $allowed_html = array(
220
+ 'a' => array(
221
+ 'href' => array(),
222
+ 'class' => array(),
223
+ 'title' => array(),
224
+ ),
225
+ 'div' => array(
226
+ 'class' => array(),
227
+ ),
228
+ 'span' => array(
229
+ 'class' => array(),
230
+ ),
231
+ );
232
  $this->content_type = $GLOBALS['taxonomy'];
233
 
234
  /**
266
  if ( $source_column === $source_locale ) {
267
  if ( isset( $errors[ $object_id ] ) ) {
268
  $api_error = Lingotek_Actions::retrieve_api_error( $errors[ $object_id ] );
269
+ $allowed_html = array(
270
+ 'a' => array(
271
+ 'href' => array(),
272
+ 'class' => array(),
273
+ 'title' => array(),
274
+ ),
275
+ );
276
  echo wp_kses( Lingotek_Actions::display_error_icon( 'error', $api_error ), $allowed_html );
277
  }
278
  }
admin/filters-media.php CHANGED
File without changes
admin/filters-post.php CHANGED
File without changes
admin/filters-term.php CHANGED
@@ -64,7 +64,9 @@ class Lingotek_Filters_Term extends PLL_Admin_Filters_Term {
64
  return;
65
  }
66
 
67
- if ( empty( filter_input( INPUT_GET, 'import' ) ) && empty( filter_input( INPUT_POST, 'import' ) ) ) {
 
 
68
  parent::save_term( $term_id, $tt_id, $taxonomy );
69
 
70
  if ( 'automatic' === Lingotek_Model::get_profile_option( 'upload', $taxonomy, PLL()->model->term->get_language( $term_id ) ) && $this->lgtm->can_upload( 'term', $term_id ) ) {
@@ -128,9 +130,11 @@ class Lingotek_Filters_Term extends PLL_Admin_Filters_Term {
128
  }
129
 
130
  $delete_tags = null;
131
- if ( ! empty( filter_input( INPUT_GET, 'delete_tags' ) ) ) {
 
 
132
  $delete_tags = filter_input( INPUT_GET, 'delete_tags' );
133
- } elseif ( ! empty( filter_input( INPUT_POST, 'delete_tags' ) ) ) {
134
  $delete_tags = filter_input( INPUT_POST, 'delete_tags' );
135
  }
136
 
64
  return;
65
  }
66
 
67
+ $import_get = filter_input( INPUT_GET, 'import' );
68
+ $import_post = filter_input( INPUT_POST, 'import' );
69
+ if ( empty( $import ) && empty( $import_post ) ) {
70
  parent::save_term( $term_id, $tt_id, $taxonomy );
71
 
72
  if ( 'automatic' === Lingotek_Model::get_profile_option( 'upload', $taxonomy, PLL()->model->term->get_language( $term_id ) ) && $this->lgtm->can_upload( 'term', $term_id ) ) {
130
  }
131
 
132
  $delete_tags = null;
133
+ $delete_tags_get = filter_input( INPUT_GET, 'delete_tags' );
134
+ $delete_tags_post = filter_input( INPUT_POST, 'delete_tags' );
135
+ if ( ! empty( $delete_tags_get ) ) {
136
  $delete_tags = filter_input( INPUT_GET, 'delete_tags' );
137
+ } elseif ( ! empty( $delete_tags_post ) ) {
138
  $delete_tags = filter_input( INPUT_POST, 'delete_tags' );
139
  }
140
 
admin/manage/view-content.php CHANGED
File without changes
admin/manage/view-custom-fields.php CHANGED
File without changes
admin/manage/view-edit-profile.php CHANGED
File without changes
admin/manage/view-profiles.php CHANGED
File without changes
admin/manage/view-string-groups.php CHANGED
File without changes
admin/manage/view-strings.php CHANGED
File without changes
admin/post-actions.php CHANGED
@@ -25,11 +25,17 @@ class Lingotek_Post_actions extends Lingotek_Actions {
25
  add_filter( 'bulk_actions-edit-post', array( &$this, 'add_bulk_actions' ) );
26
  add_filter( 'bulk_actions-edit-page', array( &$this, 'add_bulk_actions' ) );
27
 
28
- $add_bulk_actions_to_custom_post_types = function($type) {
29
- add_filter( "bulk_actions-edit-$type", array( &$this, 'add_bulk_actions' ) );
30
- };
31
 
32
- $this->iterate_custom_post_types($add_bulk_actions_to_custom_post_types);
 
 
 
 
 
 
33
 
34
  // manage bulk actions, row actions and icon actions.
35
  add_action( 'load-edit.php', array( &$this, 'manage_actions' ) );
@@ -236,11 +242,17 @@ class Lingotek_Post_actions extends Lingotek_Actions {
236
  }
237
  }
238
 
239
- $add_meta_box_to_custom_post_types = function($type) {
240
- add_meta_box('lingotek_post_meta_box', __('Lingotek Translation', 'lingotek-translation'), array( __CLASS__, 'lingotek_edit_meta_box_html'), $type, 'side', 'default');
241
- };
242
 
243
- $this->iterate_custom_post_types($add_meta_box_to_custom_post_types);
 
 
 
 
 
 
244
 
245
  add_meta_box('lingotek_post_meta_box', __('Lingotek Translation', 'lingotek-translation'), array( __CLASS__, 'lingotek_edit_meta_box_html'), 'post', 'side', 'default');
246
  add_meta_box('lingotek_page_meta_box', __('Lingotek Translation', 'lingotek-translation'), array( __CLASS__, 'lingotek_edit_meta_box_html'), 'page', 'side', 'default');
@@ -367,24 +379,4 @@ class Lingotek_Post_actions extends Lingotek_Actions {
367
  return $language_profiles;
368
  }
369
 
370
- /**
371
- * Iterates through the enabled custom post types and passes in the type to a provided anonymous method.
372
- * The provided method is only called if the custom post type has been enabled by Polylong.
373
- *
374
- * @param function $method the method to be called. Must take in a single parameter (type)
375
- */
376
- private function iterate_custom_post_types($method)
377
- {
378
- $polylang_enabled = PLL()->model->get_translated_post_types();
379
- $custom_post_types = get_post_types( [ '_builtin' => false ] );
380
- unset( $custom_post_types[ 'polylang_mo' ] );
381
-
382
- foreach ( $custom_post_types as $type )
383
- {
384
- if (isset($polylang_enabled[$type]))
385
- {
386
- $method($type);
387
- }
388
- }
389
- }
390
  }
25
  add_filter( 'bulk_actions-edit-post', array( &$this, 'add_bulk_actions' ) );
26
  add_filter( 'bulk_actions-edit-page', array( &$this, 'add_bulk_actions' ) );
27
 
28
+ $polylang_enabled = PLL()->model->get_translated_post_types();
29
+ $custom_post_types = get_post_types( array( '_builtin' => false ) );
30
+ unset( $custom_post_types[ 'polylang_mo' ] );
31
 
32
+ foreach ( $custom_post_types as $type )
33
+ {
34
+ if (isset($polylang_enabled[$type]))
35
+ {
36
+ add_filter( "bulk_actions-edit-$type", array( &$this, 'add_bulk_actions' ) );
37
+ }
38
+ }
39
 
40
  // manage bulk actions, row actions and icon actions.
41
  add_action( 'load-edit.php', array( &$this, 'manage_actions' ) );
242
  }
243
  }
244
 
245
+ $polylang_enabled = PLL()->model->get_translated_post_types();
246
+ $custom_post_types = get_post_types( array( '_builtin' => false ) );
247
+ unset( $custom_post_types[ 'polylang_mo' ] );
248
 
249
+ foreach ( $custom_post_types as $type )
250
+ {
251
+ if (isset($polylang_enabled[$type]))
252
+ {
253
+ add_meta_box('lingotek_post_meta_box', __('Lingotek Translation', 'lingotek-translation'), array( __CLASS__, 'lingotek_edit_meta_box_html'), $type, 'side', 'default');
254
+ }
255
+ }
256
 
257
  add_meta_box('lingotek_post_meta_box', __('Lingotek Translation', 'lingotek-translation'), array( __CLASS__, 'lingotek_edit_meta_box_html'), 'post', 'side', 'default');
258
  add_meta_box('lingotek_page_meta_box', __('Lingotek Translation', 'lingotek-translation'), array( __CLASS__, 'lingotek_edit_meta_box_html'), 'page', 'side', 'default');
379
  return $language_profiles;
380
  }
381
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
382
  }
admin/profiles-table.php CHANGED
@@ -126,11 +126,13 @@ class Lingotek_Profiles_Table extends WP_List_Table {
126
  * @return int sort direction.
127
  */
128
  function usort_reorder( $a, $b ) {
129
- $result = strcmp( $a[ filter_input( INPUT_GET, 'orderby' ) ], $b[ filter_input( INPUT_GET, 'orderby' ) ] ); // determine sort order.
130
- return (empty( filter_input( INPUT_GET, 'order' ) ) || 'asc' === filter_input( INPUT_GET, 'order' ) ) ? $result : -$result; // send final sort direction to usort.
 
 
131
  };
132
 
133
- if ( ! empty( filter_input( INPUT_GET, 'orderby' ) ) ) { // no sort by default.
134
  usort( $data, 'usort_reorder' );
135
  }
136
 
126
  * @return int sort direction.
127
  */
128
  function usort_reorder( $a, $b ) {
129
+ $order = filter_input( INPUT_GET, 'order' );
130
+ $orderby = filter_input( INPUT_GET, 'orderby' );
131
+ $result = strcmp( $a[ $orderby ], $b[ $orderby ] ); // determine sort order.
132
+ return (empty( $order ) || 'asc' === $order ) ? $result : -$result; // send final sort direction to usort.
133
  };
134
 
135
+ if ( ! empty( $orderby ) ) { // no sort by default.
136
  usort( $data, 'usort_reorder' );
137
  }
138
 
admin/settings.php CHANGED
@@ -3,6 +3,7 @@
3
 
4
  <?php
5
  if ( strlen( $access_token ) ) {
 
6
  ?>
7
 
8
  <?php
@@ -27,15 +28,15 @@
27
  <?php
28
  $menu_item_index = 0;
29
  foreach ( $menu_items as $menu_item_key => $menu_item_label ) {
30
- $use_as_default = (0 === $menu_item_index && empty( filter_input( INPUT_GET, 'sm' ) )) ? true : false;
31
  $alias = null;
32
  // custom sub sub-menus.
33
- if ( ! empty( filter_input( INPUT_GET, 'sm' ) ) && 'edit-profile' === filter_input( INPUT_GET, 'sm' ) ) {
34
  $alias = 'profiles';
35
  }
36
  ?>
37
 
38
- <a class="nav-tab <?php if ( $use_as_default || ( ! empty( filter_input( INPUT_GET, 'sm' ) ) && filter_input( INPUT_GET, 'sm' ) === $menu_item_key) || $alias === $menu_item_key ) : ?> nav-tab-active<?php endif; ?>"
39
  href="admin.php?page=<?php echo filter_input( INPUT_GET, 'page' ); ?>&amp;sm=<?php echo esc_html( $menu_item_key ); ?>"><?php echo esc_html( $menu_item_label ); ?></a>
40
  <?php
41
  $menu_item_index++;
@@ -45,7 +46,7 @@
45
 
46
  <?php
47
  settings_errors();
48
- $submenu = ! empty( filter_input( INPUT_GET, 'sm' ) ) ? sanitize_text_field( filter_input( INPUT_GET, 'sm' ) ) : 'account';
49
  $dir = dirname( __FILE__ ) . '/settings/';
50
  $filename = $dir . 'view-' . $submenu . '.php';
51
  if ( file_exists( $filename ) ) {
3
 
4
  <?php
5
  if ( strlen( $access_token ) ) {
6
+ $sm = filter_input( INPUT_GET, 'sm' );
7
  ?>
8
 
9
  <?php
28
  <?php
29
  $menu_item_index = 0;
30
  foreach ( $menu_items as $menu_item_key => $menu_item_label ) {
31
+ $use_as_default = (0 === $menu_item_index && empty( $sm )) ? true : false;
32
  $alias = null;
33
  // custom sub sub-menus.
34
+ if ( ! empty( $sm ) && 'edit-profile' === $sm ) {
35
  $alias = 'profiles';
36
  }
37
  ?>
38
 
39
+ <a class="nav-tab <?php if ( $use_as_default || ( ! empty( $sm ) && $sm === $menu_item_key) || $alias === $menu_item_key ) : ?> nav-tab-active<?php endif; ?>"
40
  href="admin.php?page=<?php echo filter_input( INPUT_GET, 'page' ); ?>&amp;sm=<?php echo esc_html( $menu_item_key ); ?>"><?php echo esc_html( $menu_item_label ); ?></a>
41
  <?php
42
  $menu_item_index++;
46
 
47
  <?php
48
  settings_errors();
49
+ $submenu = ! empty( $sm ) ? sanitize_text_field( $sm ) : 'account';
50
  $dir = dirname( __FILE__ ) . '/settings/';
51
  $filename = $dir . 'view-' . $submenu . '.php';
52
  if ( file_exists( $filename ) ) {
admin/settings/connect-account.php CHANGED
@@ -25,11 +25,11 @@
25
  <hr/>
26
  <p class="description">
27
  <?php
28
- $allowed_html = [
29
- 'a' => [
30
- 'href' => [],
31
- ],
32
- ];
33
 
34
  echo sprintf( wp_kses( __( 'Do you already have a Lingotek account? <a href="%s">Connect Lingotek Account</a>', 'lingotek-translation' ), $allowed_html ), esc_attr( $connect_account_cloak_url_prod ) )
35
  ?>
25
  <hr/>
26
  <p class="description">
27
  <?php
28
+ $allowed_html = array(
29
+ 'a' => array(
30
+ 'href' => array(),
31
+ ),
32
+ );
33
 
34
  echo sprintf( wp_kses( __( 'Do you already have a Lingotek account? <a href="%s">Connect Lingotek Account</a>', 'lingotek-translation' ), $allowed_html ), esc_attr( $connect_account_cloak_url_prod ) )
35
  ?>
admin/settings/view-account.php CHANGED
File without changes
admin/settings/view-defaults.php CHANGED
@@ -6,7 +6,8 @@ wp_enqueue_script( 'defaults', LINGOTEK_URL . '/js/defaults.js' );
6
 
7
  if ( ! empty( $_POST ) ) {
8
  check_admin_referer( $page_key, '_wpnonce_' . $page_key );
9
- if ( ! empty( filter_input( INPUT_POST, 'refresh' ) ) ) {
 
10
  $refresh_success = $this->set_community_resources( $community_id );
11
  if ( true === $refresh_success['projects'] && true === $refresh_success['workflows'] ) {
12
  add_settings_error( 'lingotek_community_resources', 'options', __( 'Resources from Lingotek were successfully updated for projects and workflows.', 'lingotek-translation' ), 'updated' );
@@ -21,14 +22,16 @@ if ( ! empty( $_POST ) ) {
21
  $options = array();
22
  $settings = $this->get_profiles_settings( true );
23
  foreach ( $settings as $key => $setting ) {
24
- if ( ! empty( filter_input( INPUT_POST, $key ) ) ) {
25
- $options[ $key ] = filter_input( INPUT_POST, $key );
 
26
  }
27
  }
28
  update_option( 'lingotek_defaults', $options );
29
  add_settings_error( 'lingotek_defaults', 'defaultgs', __( 'Your <i>Defaults</i> were sucessfully saved.', 'lingotek-translation' ), 'updated' );
30
 
31
- if ( ! empty( filter_input( INPUT_POST, 'update_callback' ) ) ) {
 
32
  $client = new Lingotek_API();
33
  if ( $client->update_callback_url( $options['project_id'] ) ) {
34
  add_settings_error( 'lingotek_defaults', 'defaultgs', __( 'Your callback url was successfully updated.', 'lingotek-translation' ), 'updated' );
@@ -36,7 +39,8 @@ if ( ! empty( $_POST ) ) {
36
  }
37
 
38
  // adds new project if text box is filled out.
39
- if ( ! empty( filter_input( INPUT_POST, 'new_project' ) ) ) {
 
40
  $client = new Lingotek_API();
41
  $title = stripslashes( filter_input( INPUT_POST, 'new_project' ) );
42
 
6
 
7
  if ( ! empty( $_POST ) ) {
8
  check_admin_referer( $page_key, '_wpnonce_' . $page_key );
9
+ $refresh = filter_input( INPUT_POST, 'refresh' );
10
+ if ( ! empty( $refresh ) ) {
11
  $refresh_success = $this->set_community_resources( $community_id );
12
  if ( true === $refresh_success['projects'] && true === $refresh_success['workflows'] ) {
13
  add_settings_error( 'lingotek_community_resources', 'options', __( 'Resources from Lingotek were successfully updated for projects and workflows.', 'lingotek-translation' ), 'updated' );
22
  $options = array();
23
  $settings = $this->get_profiles_settings( true );
24
  foreach ( $settings as $key => $setting ) {
25
+ $key_input = filter_input( INPUT_POST, $key );
26
+ if ( ! empty( $key_input ) ) {
27
+ $options[ $key ] = $key_input;
28
  }
29
  }
30
  update_option( 'lingotek_defaults', $options );
31
  add_settings_error( 'lingotek_defaults', 'defaultgs', __( 'Your <i>Defaults</i> were sucessfully saved.', 'lingotek-translation' ), 'updated' );
32
 
33
+ $update_callback = filter_input( INPUT_POST, 'update_callback' );
34
+ if ( ! empty( $update_callback ) ) {
35
  $client = new Lingotek_API();
36
  if ( $client->update_callback_url( $options['project_id'] ) ) {
37
  add_settings_error( 'lingotek_defaults', 'defaultgs', __( 'Your callback url was successfully updated.', 'lingotek-translation' ), 'updated' );
39
  }
40
 
41
  // adds new project if text box is filled out.
42
+ $new_project = filter_input( INPUT_POST, 'new_project' );
43
+ if ( ! empty( $new_project ) ) {
44
  $client = new Lingotek_API();
45
  $title = stripslashes( filter_input( INPUT_POST, 'new_project' ) );
46
 
admin/settings/view-preferences.php CHANGED
@@ -57,10 +57,17 @@ if ( ! empty( $_POST ) ) {
57
  check_admin_referer( $page_key, '_wpnonce_' . $page_key );
58
  $options = array();
59
  foreach ( $setting_details as $key => $setting ) {
60
- if ( ! empty( filter_input( INPUT_POST, $key ) ) ) {
61
- $options[ $key ] = filter_input( INPUT_POST, $key );
 
62
  } else {
63
- $options[ $key ] = null;
 
 
 
 
 
 
64
  }
65
  }
66
  update_option( 'lingotek_prefs', $options );
57
  check_admin_referer( $page_key, '_wpnonce_' . $page_key );
58
  $options = array();
59
  foreach ( $setting_details as $key => $setting ) {
60
+ $key_input = filter_input( INPUT_POST, $key );
61
+ if ( ! empty( $key_input ) ) {
62
+ $options[ $key ] = $key_input;
63
  } else {
64
+ $key_input = filter_input_array( INPUT_POST );
65
+ if (!empty($key_input[$key])) {
66
+ $options[ $key ] = $key_input[$key];
67
+ }
68
+ else {
69
+ $options[ $key ] = null;
70
+ }
71
  }
72
  }
73
  update_option( 'lingotek_prefs', $options );
admin/settings/view-utilities.php CHANGED
@@ -5,7 +5,8 @@ if ( ! empty( $_POST ) ) {
5
  check_admin_referer( $page_key, '_wpnonce_' . $page_key );
6
 
7
  // progress dialog placeholder.
8
- if ( ! empty( filter_input( INPUT_POST, 'utility_disassociate' ) ) ) {
 
9
  $ids = Lingotek_Utilities::get_all_document_ids();
10
  if ( ! empty( $ids ) ) {
11
  printf( '<div id="lingotek-progressdialog" title="%s"><div id="lingotek-progressbar"></div></div>', esc_html( __( 'Disassociating content...', 'lingotek-translation' ) ) );
@@ -30,9 +31,9 @@ if ( ! empty( $_POST ) ) {
30
  <form id="lingotek-utilities" method="post" action="admin.php?page=<?php echo esc_attr( $page_key ); ?>" class="validate"><?php
31
  wp_nonce_field( $page_key, '_wpnonce_' . $page_key );
32
 
33
- $allowed_html = [
34
- 'i' => [],
35
- ];
36
  printf(
37
  '<p><input type="checkbox" name="%1$s" id="%1$s"/><label for="%1$s">%2$s</label></p>',
38
  'utility_set_default_language',
5
  check_admin_referer( $page_key, '_wpnonce_' . $page_key );
6
 
7
  // progress dialog placeholder.
8
+ $utility_disassociate = filter_input( INPUT_POST, 'utility_disassociate' );
9
+ if ( ! empty( $utility_disassociate ) ) {
10
  $ids = Lingotek_Utilities::get_all_document_ids();
11
  if ( ! empty( $ids ) ) {
12
  printf( '<div id="lingotek-progressdialog" title="%s"><div id="lingotek-progressbar"></div></div>', esc_html( __( 'Disassociating content...', 'lingotek-translation' ) ) );
31
  <form id="lingotek-utilities" method="post" action="admin.php?page=<?php echo esc_attr( $page_key ); ?>" class="validate"><?php
32
  wp_nonce_field( $page_key, '_wpnonce_' . $page_key );
33
 
34
+ $allowed_html = array(
35
+ 'i' => array(),
36
+ );
37
  printf(
38
  '<p><input type="checkbox" name="%1$s" id="%1$s"/><label for="%1$s">%2$s</label></p>',
39
  'utility_set_default_language',
admin/string-actions.php CHANGED
File without changes
admin/strings-table.php CHANGED
@@ -61,13 +61,13 @@ class Lingotek_Strings_Table extends WP_List_Table {
61
  $language = $this->pllm->get_language( substr( $column_name, 9 ) );
62
  $document = $this->lgtm->get_group( 'string', $item['context'] ); // FIXME.
63
 
64
- $allowed_html = [
65
- 'a' => [
66
  'class' => array(),
67
  'title' => array(),
68
  'href' => array(),
69
- ],
70
- ];
71
  // post ready for upload.
72
  if ( $this->lgtm->can_upload( 'string', $item['context'] ) && $language->slug === $this->pllm->options['default_lang'] ) {
73
  echo wp_kses( $this->string_actions->upload_icon( $item['context'] ), $allowed_html );
@@ -177,11 +177,13 @@ class Lingotek_Strings_Table extends WP_List_Table {
177
  * @return int sort direction.
178
  */
179
  function usort_reorder( $a, $b ) {
180
- $result = strcmp( $a[ filter_input( INPUT_GET, 'orderby' ) ], $b[ filter_input( INPUT_GET, 'orderby' ) ] ); // determine sort order.
181
- return (empty( filter_input( INPUT_GET, 'order' ) ) || 'asc' === filter_input( INPUT_GET, 'order' ) ) ? $result : -$result; // send final sort direction to usort.
 
 
182
  };
183
 
184
- if ( ! empty( filter_input( INPUT_GET, 'orderby' ) ) ) { // no sort by default.
185
  usort( $data, 'usort_reorder' );
186
  }
187
 
61
  $language = $this->pllm->get_language( substr( $column_name, 9 ) );
62
  $document = $this->lgtm->get_group( 'string', $item['context'] ); // FIXME.
63
 
64
+ $allowed_html = array(
65
+ 'a' => array(
66
  'class' => array(),
67
  'title' => array(),
68
  'href' => array(),
69
+ ),
70
+ );
71
  // post ready for upload.
72
  if ( $this->lgtm->can_upload( 'string', $item['context'] ) && $language->slug === $this->pllm->options['default_lang'] ) {
73
  echo wp_kses( $this->string_actions->upload_icon( $item['context'] ), $allowed_html );
177
  * @return int sort direction.
178
  */
179
  function usort_reorder( $a, $b ) {
180
+ $order = filter_input( INPUT_GET, 'order' );
181
+ $orderby = filter_input( INPUT_GET, 'orderby' );
182
+ $result = strcmp( $a[ $orderby ], $b[ $orderby ] ); // determine sort order.
183
+ return (empty( $order ) || 'asc' === $order ) ? $result : -$result; // send final sort direction to usort.
184
  };
185
 
186
+ if ( ! empty( $orderby ) ) { // no sort by default.
187
  usort( $data, 'usort_reorder' );
188
  }
189
 
admin/table-string.php CHANGED
@@ -38,7 +38,8 @@ class Lingotek_Table_String extends PLL_Table_String {
38
  $listlanguages = $GLOBALS['polylang']->model->get_languages_list();
39
 
40
  // Filter for search string.
41
- $s = empty( filter_input( INPUT_GET, 's' ) ) ? '' : wp_unslash( filter_input( INPUT_GET, 's' ) );
 
42
  foreach ( $data as $key => $row ) {
43
  if ( ( -1 !== $this->selected_group && $row['context'] !== $this->selected_group ) || ( ! empty( $s ) && stripos( $row['name'], $s ) === false && stripos( $row['string'], $s ) === false ) ) {
44
  unset( $data[ $key ] );
@@ -63,7 +64,8 @@ class Lingotek_Table_String extends PLL_Table_String {
63
  $per_page = $this->get_items_per_page( 'pll_strings_per_page' );
64
  $this->_column_headers = array( $this->get_columns(), array(), $this->get_sortable_columns() );
65
 
66
- if ( ! empty( filter_input( INPUT_GET, 'orderby' ) ) ) { // No sort by default.
 
67
  usort( $data, array( $this, 'usort_reorder' ) );
68
  }
69
 
38
  $listlanguages = $GLOBALS['polylang']->model->get_languages_list();
39
 
40
  // Filter for search string.
41
+ $s = filter_input( INPUT_GET, 's' );
42
+ $s = empty( $s ) ? '' : wp_unslash( $s );
43
  foreach ( $data as $key => $row ) {
44
  if ( ( -1 !== $this->selected_group && $row['context'] !== $this->selected_group ) || ( ! empty( $s ) && stripos( $row['name'], $s ) === false && stripos( $row['string'], $s ) === false ) ) {
45
  unset( $data[ $key ] );
64
  $per_page = $this->get_items_per_page( 'pll_strings_per_page' );
65
  $this->_column_headers = array( $this->get_columns(), array(), $this->get_sortable_columns() );
66
 
67
+ $orderby = filter_input( INPUT_GET, 'orderby' );
68
+ if ( ! empty( $orderby ) ) { // No sort by default.
69
  usort( $data, array( $this, 'usort_reorder' ) );
70
  }
71
 
admin/term-actions.php CHANGED
File without changes
admin/tutorial/content.php CHANGED
File without changes
admin/tutorial/credits.php CHANGED
File without changes
admin/tutorial/faq.php CHANGED
File without changes
admin/tutorial/features.php CHANGED
File without changes
admin/tutorial/img/add-languages.png CHANGED
File without changes
admin/tutorial/img/add-page.png CHANGED
File without changes
admin/tutorial/img/add-page2.png CHANGED
File without changes
admin/tutorial/img/automatic-translation.gif CHANGED
File without changes
admin/tutorial/img/automatic-translation.png CHANGED
File without changes
admin/tutorial/img/check-status.png CHANGED
File without changes
admin/tutorial/img/content-types.png CHANGED
File without changes
admin/tutorial/img/dashboard.png CHANGED
File without changes
admin/tutorial/img/polylang-compatible.png CHANGED
File without changes
admin/tutorial/img/pro-translation.png CHANGED
File without changes
admin/tutorial/img/professional-translation.png CHANGED
File without changes
admin/tutorial/img/ready-to-upload.png CHANGED
File without changes
admin/tutorial/img/request-translations.png CHANGED
File without changes
admin/tutorial/img/translation-profiles.png CHANGED
File without changes
admin/tutorial/img/translation-services.png CHANGED
File without changes
admin/tutorial/img/translations-downloaded.png CHANGED
File without changes
admin/tutorial/img/translations-ready-for-download.png CHANGED
File without changes
admin/tutorial/img/translations-underway.png CHANGED
File without changes
admin/tutorial/img/workbench-full.png CHANGED
File without changes
admin/tutorial/img/workbench.png CHANGED
File without changes
admin/utilities.php CHANGED
File without changes
admin/view-dashboard.php CHANGED
File without changes
admin/view-manage.php CHANGED
File without changes
admin/view-network.php CHANGED
File without changes
admin/view-tutorial.php CHANGED
File without changes
admin/workflows/professional-translation-workflow.php CHANGED
@@ -14,9 +14,9 @@ class Lingotek_Professional_Translation_Workflow extends Lingotek_Workflow {
14
  public function override_events( $id ) {
15
  add_thickbox();
16
  wp_enqueue_script( 'lingotek_professional_workflow', LINGOTEK_URL . '/js/workflow/professional-workflow.js' );
17
- $vars = [
18
  'id' => $id,
19
- ];
20
  wp_localize_script( 'lingotek_professional_workflow', 'workflow_vars', $vars );
21
  }
22
 
@@ -28,7 +28,7 @@ class Lingotek_Professional_Translation_Workflow extends Lingotek_Workflow {
28
  public function echo_info_modal( $id ) {
29
  if ( ! $this->info_modal_launched ) {
30
  $this->info_modal_launched = true;
31
- $args = [
32
  'header' => __( 'Professional Translation Workflow', 'lingotek-translation' ),
33
  'body' => __( "The Professional Translation Workflow allows you to have any of your content
34
  translated professionally. Translations are priced by word count and can be requested from within
@@ -36,7 +36,7 @@ class Lingotek_Professional_Translation_Workflow extends Lingotek_Workflow {
36
  <br><br>In order to use this workflow you must set up a payment method and purchase Word Credits.
37
  <br><br>Would you like to set up a payment method?", 'lingotek-translation' ),
38
  'id' => $id,
39
- ];
40
  $this->_echo_modal( $args );
41
  }
42
  }
@@ -49,7 +49,7 @@ class Lingotek_Professional_Translation_Workflow extends Lingotek_Workflow {
49
  public function echo_posts_modal( $id ) {
50
  if ( ! $this->post_modal_launched ) {
51
  $this->post_modal_launched = true;
52
- $args = [
53
  'header' => __( 'Confirm Document Upload', 'lingotek-translation' ),
54
  'body' => __( "You have the Professional Translation workflow selected. This means that all
55
  translations of this document will cost Word Credits.
@@ -57,7 +57,7 @@ class Lingotek_Professional_Translation_Workflow extends Lingotek_Workflow {
57
  edited and re-translations are requested.
58
  <br><br>Would you like to continue?", 'lingotek-translation' ),
59
  'id' => $id,
60
- ];
61
  $this->_echo_modal( $args );
62
  $this->echo_request_modal( $id );
63
  }
@@ -72,11 +72,11 @@ class Lingotek_Professional_Translation_Workflow extends Lingotek_Workflow {
72
  public function echo_terms_modal( $id ) {
73
  if ( ! $this->terms_modal_launched ) {
74
  $this->terms_modal_launched = true;
75
- $args = [
76
  'header' => __( 'Lingotek Terms', 'lingotek-translation' ),
77
  'body' => __( 'This is an example of a terms modal.', 'lingotek-translation' ),
78
  'id' => $id,
79
- ];
80
  $this->_echo_modal( $args );
81
  $this->echo_request_modal( $id );
82
  }
@@ -90,7 +90,7 @@ class Lingotek_Professional_Translation_Workflow extends Lingotek_Workflow {
90
  * @param string $id the workflow id.
91
  */
92
  public function echo_request_modal( $id ) {
93
- $args = [
94
  'header' => __( 'Confirm Request Translation', 'lingotek-translation' ),
95
  'body' => __( "You have the Professional Translation workflow selected. This document will be translated by a professional
96
  in the selected language.
@@ -99,7 +99,7 @@ class Lingotek_Professional_Translation_Workflow extends Lingotek_Workflow {
99
  <br><br>The translation request is <b>final</b> meaning that if the source document is changed then it will cost Word Credits to request re-translation.
100
  <br><br> Would you like to request this translation?", 'lingotek-translation' ),
101
  'id' => $id . '-request',
102
- ];
103
  $this->_echo_modal( $args );
104
  }
105
  }
14
  public function override_events( $id ) {
15
  add_thickbox();
16
  wp_enqueue_script( 'lingotek_professional_workflow', LINGOTEK_URL . '/js/workflow/professional-workflow.js' );
17
+ $vars = array(
18
  'id' => $id,
19
+ );
20
  wp_localize_script( 'lingotek_professional_workflow', 'workflow_vars', $vars );
21
  }
22
 
28
  public function echo_info_modal( $id ) {
29
  if ( ! $this->info_modal_launched ) {
30
  $this->info_modal_launched = true;
31
+ $args = array(
32
  'header' => __( 'Professional Translation Workflow', 'lingotek-translation' ),
33
  'body' => __( "The Professional Translation Workflow allows you to have any of your content
34
  translated professionally. Translations are priced by word count and can be requested from within
36
  <br><br>In order to use this workflow you must set up a payment method and purchase Word Credits.
37
  <br><br>Would you like to set up a payment method?", 'lingotek-translation' ),
38
  'id' => $id,
39
+ );
40
  $this->_echo_modal( $args );
41
  }
42
  }
49
  public function echo_posts_modal( $id ) {
50
  if ( ! $this->post_modal_launched ) {
51
  $this->post_modal_launched = true;
52
+ $args = array(
53
  'header' => __( 'Confirm Document Upload', 'lingotek-translation' ),
54
  'body' => __( "You have the Professional Translation workflow selected. This means that all
55
  translations of this document will cost Word Credits.
57
  edited and re-translations are requested.
58
  <br><br>Would you like to continue?", 'lingotek-translation' ),
59
  'id' => $id,
60
+ );
61
  $this->_echo_modal( $args );
62
  $this->echo_request_modal( $id );
63
  }
72
  public function echo_terms_modal( $id ) {
73
  if ( ! $this->terms_modal_launched ) {
74
  $this->terms_modal_launched = true;
75
+ $args = array(
76
  'header' => __( 'Lingotek Terms', 'lingotek-translation' ),
77
  'body' => __( 'This is an example of a terms modal.', 'lingotek-translation' ),
78
  'id' => $id,
79
+ );
80
  $this->_echo_modal( $args );
81
  $this->echo_request_modal( $id );
82
  }
90
  * @param string $id the workflow id.
91
  */
92
  public function echo_request_modal( $id ) {
93
+ $args = array(
94
  'header' => __( 'Confirm Request Translation', 'lingotek-translation' ),
95
  'body' => __( "You have the Professional Translation workflow selected. This document will be translated by a professional
96
  in the selected language.
99
  <br><br>The translation request is <b>final</b> meaning that if the source document is changed then it will cost Word Credits to request re-translation.
100
  <br><br> Would you like to request this translation?", 'lingotek-translation' ),
101
  'id' => $id . '-request',
102
+ );
103
  $this->_echo_modal( $args );
104
  }
105
  }
admin/workflows/workflow-factory.php CHANGED
@@ -21,9 +21,9 @@ class Lingotek_Workflow_Factory {
21
  *
22
  * @var array
23
  */
24
- private static $map = [
25
  'professional-translation' => 'Lingotek_Professional_Translation_Workflow',
26
- ];
27
 
28
  /**
29
  * Checks the map to see if a specialized workflow exists. A BasicWorkflow is returned
21
  *
22
  * @var array
23
  */
24
+ private static $map = array(
25
  'professional-translation' => 'Lingotek_Professional_Translation_Workflow',
26
+ );
27
 
28
  /**
29
  * Checks the map to see if a specialized workflow exists. A BasicWorkflow is returned
admin/workflows/workflow.php CHANGED
@@ -82,33 +82,28 @@ class Lingotek_Workflow {
82
  * This allows us to use the 'display' CSS attribute. WP
83
  * blacklists it by default.
84
  */
85
- add_filter( 'safe_style_css', function( $styles ) {
86
- $styles[] = 'display';
87
- $styles[] = 'position';
88
- $styles[] = 'bottom';
89
- return $styles;
90
- } );
91
 
92
- $allowed_html = [
93
- 'div' => [
94
- 'id' => [],
95
- 'style' => [],
96
- ],
97
- 'h2' => [
98
- 'style' => [],
99
- ],
100
- 'br' => [],
101
- 'b' => [],
102
- 'p' => [
103
- 'style' => [],
104
- ],
105
- 'a' => [
106
- 'id' => [],
107
- 'href' => [],
108
- 'style' => [],
109
- 'class' => []
110
- ],
111
- ];
112
  $id = isset( $args['id'] ) ? '-' . $args['id'] : '';
113
  echo wp_kses( "<div id='modal-window-id" . esc_attr( $id ) . "' style='display:none; height:100%;' >
114
  <h2 style='text-align:center; font-size:large;'>" . esc_html( $args['header'] ) . "</h2>
@@ -120,4 +115,13 @@ class Lingotek_Workflow {
120
  </div>
121
  </div>", $allowed_html);
122
  }
 
 
 
 
 
 
 
 
 
123
  }
82
  * This allows us to use the 'display' CSS attribute. WP
83
  * blacklists it by default.
84
  */
85
+ add_filter( 'safe_style_css', array(&$this, 'add_modal_styles'));
 
 
 
 
 
86
 
87
+ $allowed_html = array(
88
+ 'div' => array(
89
+ 'id' => array(),
90
+ 'style' => array(),
91
+ ),
92
+ 'h2' => array(
93
+ 'style' => array(),
94
+ ),
95
+ 'br' => array(),
96
+ 'b' => array(),
97
+ 'p' => array(
98
+ 'style' => array(),
99
+ ),
100
+ 'a' => array(
101
+ 'id' => array(),
102
+ 'href' => array(),
103
+ 'style' => array(),
104
+ 'class' => array()
105
+ ),
106
+ );
107
  $id = isset( $args['id'] ) ? '-' . $args['id'] : '';
108
  echo wp_kses( "<div id='modal-window-id" . esc_attr( $id ) . "' style='display:none; height:100%;' >
109
  <h2 style='text-align:center; font-size:large;'>" . esc_html( $args['header'] ) . "</h2>
115
  </div>
116
  </div>", $allowed_html);
117
  }
118
+
119
+ public function add_modal_styles()
120
+ {
121
+ $styles = array();
122
+ $styles[] = 'display';
123
+ $styles[] = 'position';
124
+ $styles[] = 'bottom';
125
+ return $styles;
126
+ }
127
  }
admin/wp-import.php CHANGED
File without changes
css/admin.css CHANGED
File without changes
img/lingotek-chevrons-blue.png CHANGED
File without changes
img/lingotek-icon.png CHANGED
File without changes
img/lingotek-white.png CHANGED
File without changes
include/api.php CHANGED
File without changes
include/callback.php CHANGED
File without changes
include/dashboard.php CHANGED
File without changes
include/group-post.php CHANGED
@@ -388,9 +388,12 @@ class Lingotek_Group_Post extends Lingotek_Group {
388
  * @param array $translation the array returned from TMS.
389
  */
390
  private function translationNotReady($translation) {
391
- return empty( trim( $translation['post']['post_title'] ) ) &&
392
- empty( trim( $translation['post']['post_content'] ) ) &&
393
- empty( trim( $translation['post']['post_excerpt'] ) );
 
 
 
394
  }
395
 
396
  /*
388
  * @param array $translation the array returned from TMS.
389
  */
390
  private function translationNotReady($translation) {
391
+ $trimmed_title = trim( $translation['post']['post_title'] );
392
+ $trimmed_content = trim( $translation['post']['post_content'] );
393
+ $trimmed_excerpt = trim($translation['post']['post_excerpt'] );
394
+ return empty( $trimmed_title ) &&
395
+ empty( $trimmed_content ) &&
396
+ empty( $trimmed_excerpt );
397
  }
398
 
399
  /*
include/group-string.php CHANGED
File without changes
include/group-term.php CHANGED
File without changes
include/group.php CHANGED
File without changes
include/http.php CHANGED
File without changes
include/model.php CHANGED
File without changes
include/plugins-compat.php CHANGED
File without changes
include/pointer.php CHANGED
File without changes
js/defaults.js CHANGED
File without changes
js/progress.js CHANGED
File without changes
js/updater.js CHANGED
File without changes
languages/wp-lingotek-fr_FR.mo CHANGED
File without changes
languages/wp-lingotek-fr_FR.po CHANGED
File without changes
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.2.7
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.2.7' ); // 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).
@@ -193,20 +193,20 @@ class Lingotek {
193
  register_activation_hook( __FILE__, array( &$this, 'activate' ) );
194
  register_deactivation_hook( __FILE__, array( &$this, 'deactivate' ) );
195
 
 
 
 
196
  // stopping here if we are going to deactivate the plugin (avoids breaking rewrite rules).
197
- if ( ! empty( filter_input( INPUT_GET, 'action' ) ) && ! empty( filter_input( INPUT_GET, 'plugin' ) ) && 'deactivate' === filter_input( INPUT_GET, 'action' ) && plugin_basename( __FILE__ ) === filter_input( INPUT_GET, 'plugin' ) ) {
198
  return;
199
  }
200
 
201
- $action = filter_input( INPUT_GET, 'action' );
202
  $action = isset( $action ) ? $action : filter_input( INPUT_POST, 'action' );
203
  // loads the admin side of Polylang for the dashboard.
204
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $action ) && 'lingotek_language' === $action ) {
205
  define( 'PLL_AJAX_ON_FRONT', false );
206
- $method = function( $c ) {
207
- return 'PLL_Admin_Model';
208
- };
209
- add_filter( 'pll_model', $method );
210
  }
211
 
212
  spl_autoload_register( array( &$this, 'autoload' ) ); // autoload classes.
@@ -271,7 +271,9 @@ class Lingotek {
271
  */
272
  protected function do_for_all_blogs( $what ) {
273
  // network.
274
- if ( is_multisite() && ! empty( filter_input( INPUT_GET, 'networkwide' ) ) && ( 1 === filter_input( INPUT_GET, 'networkwide' ) ) ) {
 
 
275
  global $wpdb;
276
 
277
  foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ) as $blog_id ) {
@@ -442,7 +444,9 @@ class Lingotek {
442
  * @return string modified class 'PLL_Model' | 'PLL_Admin_Model'.
443
  */
444
  public function pll_model( $class ) {
445
- if ( PLL_ADMIN && ! empty( filter_input( INPUT_GET, 'page' ) ) && in_array( filter_input( INPUT_GET, 'page' ), array( 'lingotek-translation', 'lingotek-translation_manage', 'lingotek-translation_settings', 'lingotek-translation_network' ), true ) ) {
 
 
446
  return 'PLL_Admin_Model';
447
  }
448
  return $class;
@@ -472,10 +476,9 @@ class Lingotek {
472
  // overrides Polylang classes.
473
  $classes = array( 'Filters_Post', 'Filters_Term', 'Filters_Media', 'Filters_Columns' );
474
  foreach ( $classes as $class ) {
475
- $method = function( $v ) use ( $class ) {
476
- return "Lingotek_$class";
477
- };
478
- add_filter( 'pll_' . strtolower( $class ) , $method );
479
  }
480
 
481
  // add actions to posts, media and terms list.
@@ -497,6 +500,26 @@ class Lingotek {
497
  }
498
  }
499
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
500
  /**
501
  * Some init
502
  *
@@ -549,9 +572,9 @@ class Lingotek {
549
  * @since 0.1
550
  */
551
  public function pll_old_notice() {
552
- $allowed_html = [
553
- 'strong' => [],
554
- ];
555
  printf(
556
  '<div class="error"><p>%s</p></div>',
557
  sprintf(
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.2.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
  exit();
17
  }
18
 
19
+ define( 'LINGOTEK_VERSION', '1.2.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).
193
  register_activation_hook( __FILE__, array( &$this, 'activate' ) );
194
  register_deactivation_hook( __FILE__, array( &$this, 'deactivate' ) );
195
 
196
+ $action = filter_input( INPUT_GET, 'action' );
197
+ $plugin = filter_input( INPUT_GET, 'plugin' );
198
+
199
  // stopping here if we are going to deactivate the plugin (avoids breaking rewrite rules).
200
+ if ( ! empty( $action ) && ! empty( $plugin ) && 'deactivate' === $action && plugin_basename( __FILE__ ) === $plugin ) {
201
  return;
202
  }
203
 
 
204
  $action = isset( $action ) ? $action : filter_input( INPUT_POST, 'action' );
205
  // loads the admin side of Polylang for the dashboard.
206
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $action ) && 'lingotek_language' === $action ) {
207
  define( 'PLL_AJAX_ON_FRONT', false );
208
+
209
+ add_filter( 'pll_model', array( &$this, 'PLL_Admin_Model' ) );
 
 
210
  }
211
 
212
  spl_autoload_register( array( &$this, 'autoload' ) ); // autoload classes.
271
  */
272
  protected function do_for_all_blogs( $what ) {
273
  // network.
274
+ $network_wide = filter_input( INPUT_GET, 'networkwide' );
275
+
276
+ if ( is_multisite() && ! empty( $network_wide ) && ( 1 === $network_wide ) ) {
277
  global $wpdb;
278
 
279
  foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ) as $blog_id ) {
444
  * @return string modified class 'PLL_Model' | 'PLL_Admin_Model'.
445
  */
446
  public function pll_model( $class ) {
447
+ $page = filter_input( INPUT_GET, 'page' );
448
+
449
+ if ( PLL_ADMIN && ! empty( $page ) && in_array( $page, array( 'lingotek-translation', 'lingotek-translation_manage', 'lingotek-translation_settings', 'lingotek-translation_network' ), true ) ) {
450
  return 'PLL_Admin_Model';
451
  }
452
  return $class;
476
  // overrides Polylang classes.
477
  $classes = array( 'Filters_Post', 'Filters_Term', 'Filters_Media', 'Filters_Columns' );
478
  foreach ( $classes as $class ) {
479
+ $method = "Lingotek_$class";
480
+
481
+ add_filter( 'pll_' . strtolower( $class ) , array( &$this, $method ));
 
482
  }
483
 
484
  // add actions to posts, media and terms list.
500
  }
501
  }
502
 
503
+ public function PLL_Admin_Model() {
504
+ return 'PLL_Admin_Model';
505
+ }
506
+
507
+ public function Lingotek_Filters_Post() {
508
+ return 'Lingotek_Filters_Post';
509
+ }
510
+
511
+ public function Lingotek_Filters_Term() {
512
+ return 'Lingotek_Filters_Term';
513
+ }
514
+
515
+ public function Lingotek_Filters_Media() {
516
+ return 'Lingotek_Filters_Media';
517
+ }
518
+
519
+ public function Lingotek_Filters_Columns() {
520
+ return 'Lingotek_Filters_Columns';
521
+ }
522
+
523
  /**
524
  * Some init
525
  *
572
  * @since 0.1
573
  */
574
  public function pll_old_notice() {
575
+ $allowed_html = array(
576
+ 'strong' => array(),
577
+ );
578
  printf(
579
  '<div class="error"><p>%s</p></div>',
580
  sprintf(
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.7
7
- Stable tag: 1.2.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -122,6 +122,10 @@ For more, visit the [Lingotek documentation site](https://lingotek.atlassian.net
122
 
123
  == Changelog ==
124
 
 
 
 
 
125
  = 1.2.7 (2017-4-14) =
126
 
127
  * Added Lingotek bulk actions to custom content types
4
  Tags: automation, bilingual, international, language, Lingotek, localization, multilanguage, multilingual, translate, translation
5
  Requires at least: 3.8
6
  Tested up to: 4.7
7
+ Stable tag: 1.2.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
122
 
123
  == Changelog ==
124
 
125
+ = 1.2.8 (2017-4-17) =
126
+
127
+ * Fixed code that got released that was not compatible with older versions of PHP which broke the plugin for some users
128
+
129
  = 1.2.7 (2017-4-14) =
130
 
131
  * Added Lingotek bulk actions to custom content types
uninstall.php CHANGED
File without changes