TranslatePress – Translate Multilingual sites - Version 2.0.7

Version Description

  • Security improvements
  • Added support for WooCommerce /shop/%product_cat% product permalink structure
  • Fixed URL issues with post category when using encoded characters
  • Fixed an issue with Woocommerce product links not being translated when loaded with ajax
  • Fixed notices when using WP Bakery
  • Fixed excerpt character limit in Chinese language
  • Fixed some cases of trimming custom language name in language switcher
  • Fixed adding current-menu-item class on empty menu links
  • Compatibility with Brizy to load correct assets on other languages
Download this release

Release Info

Developer razvan.mo
Plugin Icon 128x128 TranslatePress – Translate Multilingual sites
Version 2.0.7
Comparing to
See all releases

Code changes from version 2.0.6 to 2.0.7

Files changed (42) hide show
  1. assets/lib/simplehtmldom/simple_html_dom.php +3 -3
  2. assets/lib/tp-add-ons-listing/tp-add-ons-listing.php +15 -15
  3. class-translate-press.php +1 -1
  4. includes/advanced-settings/do-not-translate-certain-paths.php +8 -8
  5. includes/class-advanced-tab.php +61 -61
  6. includes/class-edd-sl-plugin-updater.php +12 -14
  7. includes/class-editor-api-gettext-strings.php +5 -5
  8. includes/class-editor-api-regular-strings.php +12 -12
  9. includes/class-elementor-language-for-blocks.php +12 -12
  10. includes/class-error-manager.php +1 -1
  11. includes/class-install-plugins.php +1 -1
  12. includes/class-language-switcher.php +7 -7
  13. includes/class-languages.php +2 -1
  14. includes/class-machine-translation-tab.php +3 -3
  15. includes/class-machine-translator.php +2 -2
  16. includes/class-plugin-notices.php +3 -3
  17. includes/class-settings.php +4 -4
  18. includes/class-translation-manager.php +10 -10
  19. includes/class-translation-memory.php +2 -2
  20. includes/class-translation-render.php +4 -4
  21. includes/class-upgrade.php +17 -17
  22. includes/class-url-converter.php +13 -8
  23. includes/class-wp-bakery-language-for-blocks.php +35 -13
  24. includes/compatibility-functions.php +10 -9
  25. includes/custom-language.php +4 -2
  26. includes/functions.php +1 -1
  27. includes/google-translate/functions.php +1 -1
  28. includes/string-translation/class-string-translation-helper.php +1 -1
  29. includes/string-translation/class-string-translation.php +4 -4
  30. includes/string-translation/string-translation-editor.php +1 -1
  31. includes/trp-ajax.php +3 -3
  32. index.php +2 -2
  33. languages/translatepress-multilingual.catalog.php +23 -1
  34. languages/translatepress-multilingual.pot +102 -14
  35. partials/error-manager-page.php +1 -1
  36. partials/language-switcher-shortcode.php +3 -3
  37. partials/license-settings-page.php +10 -10
  38. partials/machine-translation-settings-page.php +11 -11
  39. partials/main-settings-page.php +2 -2
  40. partials/test-api-settings-page.php +1 -1
  41. partials/trp-remove-duplicate-rows.php +1 -1
  42. readme.txt +12 -1
assets/lib/simplehtmldom/simple_html_dom.php CHANGED
@@ -178,12 +178,12 @@ class simple_html_dom_node
178
 
179
  function dump($show_attr = true, $depth = 0)
180
  {
181
- echo str_repeat("\t", $depth) . $this->tag;
182
 
183
  if ($show_attr && count($this->attr) > 0) {
184
  echo '(';
185
  foreach ($this->attr as $k => $v) {
186
- echo "[$k]=>\"$v\", ";
187
  }
188
  echo ')';
189
  }
@@ -243,7 +243,7 @@ class simple_html_dom_node
243
  $string .= "\n";
244
 
245
  if ($echo) {
246
- echo $string;
247
  return;
248
  } else {
249
  return $string;
178
 
179
  function dump($show_attr = true, $depth = 0)
180
  {
181
+ echo str_repeat("\t", $depth) . $this->tag; //phpcs:ignore
182
 
183
  if ($show_attr && count($this->attr) > 0) {
184
  echo '(';
185
  foreach ($this->attr as $k => $v) {
186
+ echo "[$k]=>\"$v\", "; //phpcs:ignore
187
  }
188
  echo ')';
189
  }
243
  $string .= "\n";
244
 
245
  if ($echo) {
246
+ echo $string; //phpcs:ignore
247
  return;
248
  } else {
249
  return $string;
assets/lib/tp-add-ons-listing/tp-add-ons-listing.php CHANGED
@@ -65,7 +65,7 @@ class TRP_Addons_List_Table extends WP_List_Table {
65
  $columns = array(
66
  'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
67
  'icon' => '',
68
- 'add_on' => __('Add-On', $this->text_domain ),
69
  'actions' => '',
70
  );
71
  return $columns;
@@ -120,7 +120,7 @@ class TRP_Addons_List_Table extends WP_List_Table {
120
  //for plugins we can do something general
121
  if( $item['type'] === 'plugin' ) {
122
  ?>
123
- <a class="button-primary right trp-recommended-plugin-buttons trp-install-and-activate" data-trp-plugin-slug="<?php echo $item['short-slug']; ?>" data-trp-action-performed="<?php _e( 'Installing...', 'translatepress-multilingual' );?>" <?php echo $item['disabled']; ?>><?php echo $item['install_button']; ?></a>
124
  <?php
125
 
126
  }
@@ -129,14 +129,14 @@ class TRP_Addons_List_Table extends WP_List_Table {
129
  in_array( $this->current_version, $this->section_versions ) ? $disabled = '' : $disabled = 'disabled'; //add disabled if the current version isn't eligible
130
 
131
  if ( $this->is_add_on_active( $item['slug'] ) ) {
132
- $action = '<a class="right button button-secondary" '.$disabled.' href="'. esc_url( wp_nonce_url( add_query_arg( 'trp_add_ons', $item['slug'], admin_url( 'admin.php?page='. $_REQUEST['page']. '&trp_add_ons_action=deactivate' ) ), 'trp_add_ons_action' ) ) .'">' . __('Deactivate', $this->text_domain) . '</a>';
133
  } else {
134
- $action = '<a class="right button button-primary" '.$disabled.' href="'. esc_url( wp_nonce_url( add_query_arg( 'trp_add_ons', $item['slug'], admin_url( 'admin.php?page='. $_REQUEST['page']. '&trp_add_ons_action=activate' ) ), 'trp_add_ons_action' ) ) .'">' . __('Activate', $this->text_domain) . '</a>';
135
  }
136
  }
137
 
138
 
139
- $documentation = '<a target="_blank" class="right" href="'. trp_add_affiliate_id_to_link( $item['doc_url'] ) . '">' . __( 'Documentation', $this->text_domain ) . '</a>';
140
 
141
  return $action . $documentation;
142
  }
@@ -168,7 +168,7 @@ class TRP_Addons_List_Table extends WP_List_Table {
168
  function show_search_box(){
169
  ?>
170
  <p class="trp-add-ons-search-box">
171
- <input type="text" id="trp-add-ons-search-input" name="s" value="" placeholder="<?php _e( 'Search for add-ons...', $this->text_domain ); ?>">
172
  </p>
173
  <?php
174
  }
@@ -178,7 +178,7 @@ class TRP_Addons_List_Table extends WP_List_Table {
178
  */
179
  function show_sumbit_button(){
180
  ?>
181
- <input type="submit" class="button-primary" value="<?php _e('Save Add-ons', $this->text_domain);?>">
182
  <?php
183
  }
184
 
@@ -191,9 +191,9 @@ class TRP_Addons_List_Table extends WP_List_Table {
191
  <div class="trp-add-ons-section">
192
  <?php if( !empty( $this->section_header ) ): ?>
193
 
194
- <h2><?php echo $this->section_header['title'];?></h2>
195
  <?php if( !empty( $this->section_header ) ): ?>
196
- <p class="description"><?php echo $this->section_header['description']; ?></p>
197
  <?php endif; ?>
198
  <?php endif; ?>
199
 
@@ -223,7 +223,7 @@ class TRP_Addons_List_Table extends WP_List_Table {
223
  function display_addons(){
224
  ?>
225
  <div class="wrap" id="trp-add-ons-listing">
226
- <h1 class="trp-main-header"><?php echo $this->header['title'];?></h1>
227
 
228
  <form id="trp-addons" method="post">
229
 
@@ -235,15 +235,15 @@ class TRP_Addons_List_Table extends WP_List_Table {
235
 
236
  if( !empty( $this->sections ) ){
237
  foreach ( $this->sections as $section ){
238
- echo $section;
239
  }
240
  }
241
  ?>
242
  <?php $this->show_sumbit_button(); ?>
243
 
244
  <!-- For plugins, we also need to ensure that the form posts back to our current page -->
245
- <input type="hidden" name="trp_all_add_ons" value="<?php echo implode( '|' ,$this->all_addons ); ?>" />
246
- <input type="hidden" name="trp_all_plugins" value="<?php echo implode( '|' ,$this->all_plugins ); ?>" />
247
  <input type="hidden" name="trp_add_ons_action" value="bulk_action" />
248
  <?php wp_nonce_field('trp_add_ons_action'); ?>
249
  </form>
@@ -263,7 +263,7 @@ class TRP_Addons_List_Table extends WP_List_Table {
263
  */
264
  add_action( 'admin_init', 'trp_add_ons_listing_process_actions', 1 );
265
  function trp_add_ons_listing_process_actions(){
266
- if (current_user_can( 'manage_options' ) && isset( $_REQUEST['trp_add_ons_action'] ) && isset($_REQUEST['_wpnonce']) && wp_verify_nonce( $_REQUEST['_wpnonce'], 'trp_add_ons_action' ) ){
267
 
268
  if( $_REQUEST['trp_add_ons_action'] === 'bulk_action' ){
269
  if( !empty( $_POST['trp_all_plugins'] ) && !empty( $_POST['trp_all_add_ons'] ) ){//make sure we have all the data
@@ -326,7 +326,7 @@ function trp_add_ons_listing_process_actions(){
326
  }
327
  }
328
 
329
- wp_safe_redirect( add_query_arg( 'trp_add_ons_listing_success', 'true', admin_url( 'admin.php?page='. $_REQUEST['page'] ) ) );
330
  }
331
  }
332
 
65
  $columns = array(
66
  'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
67
  'icon' => '',
68
+ 'add_on' => __('Add-On', $this->text_domain ), //phpcs:ignore
69
  'actions' => '',
70
  );
71
  return $columns;
120
  //for plugins we can do something general
121
  if( $item['type'] === 'plugin' ) {
122
  ?>
123
+ <a class="button-primary right trp-recommended-plugin-buttons trp-install-and-activate" data-trp-plugin-slug="<?php echo esc_attr( $item['short-slug'] ); ?>" data-trp-action-performed="<?php esc_html_e( 'Installing...', 'translatepress-multilingual' );?>" <?php echo esc_html( $item['disabled'] ); ?>><?php echo wp_kses_post( $item['install_button'] ); ?></a>
124
  <?php
125
 
126
  }
129
  in_array( $this->current_version, $this->section_versions ) ? $disabled = '' : $disabled = 'disabled'; //add disabled if the current version isn't eligible
130
 
131
  if ( $this->is_add_on_active( $item['slug'] ) ) {
132
+ $action = '<a class="right button button-secondary" '.$disabled.' href="'. esc_url( wp_nonce_url( add_query_arg( 'trp_add_ons', $item['slug'], admin_url( 'admin.php?page='. sanitize_text_field( $_REQUEST['page'] ) . '&trp_add_ons_action=deactivate' ) ), 'trp_add_ons_action' ) ) .'">' . __('Deactivate', $this->text_domain) . '</a>';//phpcs:ignore
133
  } else {
134
+ $action = '<a class="right button button-primary" '.$disabled.' href="'. esc_url( wp_nonce_url( add_query_arg( 'trp_add_ons', $item['slug'], admin_url( 'admin.php?page='. sanitize_text_field( $_REQUEST['page'] ). '&trp_add_ons_action=activate' ) ), 'trp_add_ons_action' ) ) .'">' . __('Activate', $this->text_domain) . '</a>';//phpcs:ignore
135
  }
136
  }
137
 
138
 
139
+ $documentation = '<a target="_blank" class="right" href="'. trp_add_affiliate_id_to_link( $item['doc_url'] ) . '">' . __( 'Documentation', $this->text_domain ) . '</a>';//phpcs:ignore
140
 
141
  return $action . $documentation;
142
  }
168
  function show_search_box(){
169
  ?>
170
  <p class="trp-add-ons-search-box">
171
+ <input type="text" id="trp-add-ons-search-input" name="s" value="" placeholder="<?php esc_html_e( 'Search for add-ons...', $this->text_domain ); //phpcs:ignore ?>">
172
  </p>
173
  <?php
174
  }
178
  */
179
  function show_sumbit_button(){
180
  ?>
181
+ <input type="submit" class="button-primary" value="<?php esc_html_e('Save Add-ons', $this->text_domain); //phpcs:ignore?>">
182
  <?php
183
  }
184
 
191
  <div class="trp-add-ons-section">
192
  <?php if( !empty( $this->section_header ) ): ?>
193
 
194
+ <h2><?php echo esc_html( $this->section_header['title'] );?></h2>
195
  <?php if( !empty( $this->section_header ) ): ?>
196
+ <p class="description"><?php echo wp_kses_post( $this->section_header['description'] ); ?></p>
197
  <?php endif; ?>
198
  <?php endif; ?>
199
 
223
  function display_addons(){
224
  ?>
225
  <div class="wrap" id="trp-add-ons-listing">
226
+ <h1 class="trp-main-header"><?php echo esc_html( $this->header['title'] );?></h1>
227
 
228
  <form id="trp-addons" method="post">
229
 
235
 
236
  if( !empty( $this->sections ) ){
237
  foreach ( $this->sections as $section ){
238
+ echo $section;/* phpcs:ignore */ /* escaped inside the variable */
239
  }
240
  }
241
  ?>
242
  <?php $this->show_sumbit_button(); ?>
243
 
244
  <!-- For plugins, we also need to ensure that the form posts back to our current page -->
245
+ <input type="hidden" name="trp_all_add_ons" value="<?php echo esc_attr( implode( '|' ,$this->all_addons ) ); ?>" />
246
+ <input type="hidden" name="trp_all_plugins" value="<?php echo esc_attr( implode( '|' ,$this->all_plugins ) ); ?>" />
247
  <input type="hidden" name="trp_add_ons_action" value="bulk_action" />
248
  <?php wp_nonce_field('trp_add_ons_action'); ?>
249
  </form>
263
  */
264
  add_action( 'admin_init', 'trp_add_ons_listing_process_actions', 1 );
265
  function trp_add_ons_listing_process_actions(){
266
+ if (current_user_can( 'manage_options' ) && isset( $_REQUEST['trp_add_ons_action'] ) && isset($_REQUEST['_wpnonce']) && wp_verify_nonce( sanitize_text_field( $_REQUEST['_wpnonce'] ), 'trp_add_ons_action' ) ){
267
 
268
  if( $_REQUEST['trp_add_ons_action'] === 'bulk_action' ){
269
  if( !empty( $_POST['trp_all_plugins'] ) && !empty( $_POST['trp_all_add_ons'] ) ){//make sure we have all the data
326
  }
327
  }
328
 
329
+ wp_safe_redirect( add_query_arg( 'trp_add_ons_listing_success', 'true', admin_url( 'admin.php?page='. sanitize_text_field( $_REQUEST['page'] ) ) ) );//phpcs:ignore
330
  }
331
  }
332
 
class-translate-press.php CHANGED
@@ -58,7 +58,7 @@ class TRP_Translate_Press{
58
  define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
59
  define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
60
  define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
61
- define( 'TRP_PLUGIN_VERSION', '2.0.6' );
62
 
63
  wp_cache_add_non_persistent_groups(array('trp'));
64
 
58
  define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
59
  define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
60
  define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
61
+ define( 'TRP_PLUGIN_VERSION', '2.0.7' );
62
 
63
  wp_cache_add_non_persistent_groups(array('trp'));
64
 
includes/advanced-settings/do-not-translate-certain-paths.php CHANGED
@@ -22,23 +22,23 @@ function trp_output_do_not_translate_certain_paths( $setting ){
22
 
23
  ?>
24
  <tr id="trp-adv-translate-certain-paths">
25
- <th scope="row"><?php echo $setting['label']; ?></th>
26
  <td>
27
  <div class="trp-adv-holder">
28
  <label>
29
- <input type='radio' id='$setting_name' name="trp_advanced_settings[<?php echo $setting['name']; ?>][option]" value="exclude" <?php echo isset( $trp_settings['trp_advanced_settings'][$setting['name']]['option'] ) && $trp_settings['trp_advanced_settings'][$setting['name']]['option'] == 'exclude' ? 'checked' : ''; ?>>
30
- <?php _e( 'Exclude Paths From Translation', 'translatepress' ); ?>
31
  </label>
32
 
33
  <label>
34
- <input type='radio' id='$setting_name' name="trp_advanced_settings[<?php echo $setting['name']; ?>][option]" value="include" <?php echo isset( $trp_settings['trp_advanced_settings'][$setting['name']]['option'] ) && $trp_settings['trp_advanced_settings'][$setting['name']]['option'] == 'include' ? 'checked' : ''; ?> >
35
- <?php _e( 'Translate Only Certain Paths', 'translatepress' ); ?>
36
  </label>
37
  </div>
38
 
39
- <textarea class="trp-adv-big-textarea" name="trp_advanced_settings[<?php echo $setting['name']; ?>][paths]"><?php echo isset( $trp_settings['trp_advanced_settings'][$setting['name']]['paths'] ) ? $trp_settings['trp_advanced_settings'][$setting['name']]['paths'] : ''; ?></textarea>
40
 
41
- <p class="description"><?php echo $setting['description']; ?></p>
42
  </td>
43
  </tr>
44
 
@@ -81,7 +81,7 @@ function trp_exclude_include_paths_to_run_on(){
81
  return true;
82
 
83
  $paths = explode("\n", str_replace("\r", "", $advanced_settings['translateable_content']['paths'] ) );
84
- $current_slug = sanitize_text_field( $_SERVER['REQUEST_URI'] );
85
 
86
  $replace = '/';
87
 
22
 
23
  ?>
24
  <tr id="trp-adv-translate-certain-paths">
25
+ <th scope="row"><?php echo esc_html( $setting['label'] ); ?></th>
26
  <td>
27
  <div class="trp-adv-holder">
28
  <label>
29
+ <input type='radio' id='$setting_name' name="trp_advanced_settings[<?php echo esc_attr( $setting['name'] ); ?>][option]" value="exclude" <?php echo isset( $trp_settings['trp_advanced_settings'][$setting['name']]['option'] ) && $trp_settings['trp_advanced_settings'][$setting['name']]['option'] == 'exclude' ? 'checked' : ''; ?>>
30
+ <?php esc_html_e( 'Exclude Paths From Translation', 'translatepress-multilingual' ); ?>
31
  </label>
32
 
33
  <label>
34
+ <input type='radio' id='$setting_name' name="trp_advanced_settings[<?php echo esc_attr( $setting['name'] ); ?>][option]" value="include" <?php echo isset( $trp_settings['trp_advanced_settings'][$setting['name']]['option'] ) && $trp_settings['trp_advanced_settings'][$setting['name']]['option'] == 'include' ? 'checked' : ''; ?> >
35
+ <?php esc_html_e( 'Translate Only Certain Paths', 'translatepress-multilingual' ); ?>
36
  </label>
37
  </div>
38
 
39
+ <textarea class="trp-adv-big-textarea" name="trp_advanced_settings[<?php echo esc_attr( $setting['name'] ); ?>][paths]"><?php echo isset( $trp_settings['trp_advanced_settings'][$setting['name']]['paths'] ) ? esc_textarea( $trp_settings['trp_advanced_settings'][$setting['name']]['paths'] ) : ''; ?></textarea>
40
 
41
+ <p class="description"><?php echo wp_kses_post( $setting['description'] ); ?></p>
42
  </td>
43
  </tr>
44
 
81
  return true;
82
 
83
  $paths = explode("\n", str_replace("\r", "", $advanced_settings['translateable_content']['paths'] ) );
84
+ $current_slug = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( $_SERVER['REQUEST_URI'] ) : '';
85
 
86
  $replace = '/';
87
 
includes/class-advanced-tab.php CHANGED
@@ -175,7 +175,7 @@ class TRP_Advanced_Tab {
175
  }
176
 
177
  } //end foreach of parsing all the registered settings array
178
- add_settings_error( 'trp_advanced_settings', 'settings_updated', __( 'Settings saved.' ), 'updated' );
179
 
180
  return apply_filters( 'trp_extra_sanitize_advanced_settings', $settings, $submitted_settings );
181
  }
@@ -236,11 +236,11 @@ class TRP_Advanced_Tab {
236
  if ( $setting['type'] !== 'separator' ){
237
  continue;
238
  }
239
- $html .= '<a class="trp_advanced_tab_content_table_item" href="#' . $setting['name'] . '">' . $setting['label'] . '</a> | ';
240
  }
241
  $html = rtrim($html, " | ");
242
  $html .= '</p>';
243
- echo $html;
244
  }
245
 
246
 
@@ -252,37 +252,37 @@ class TRP_Advanced_Tab {
252
  foreach( $advanced_settings_array as $setting ){
253
  switch( $setting['type'] ){
254
  case 'checkbox':
255
- echo $this->checkbox_setting( $setting );
256
  break;
257
  case 'radio':
258
- echo $this->radio_setting( $setting );
259
  break;
260
  case 'input':
261
- echo $this->input_setting( $setting );
262
  break;
263
  case 'number':
264
- echo $this->input_setting( $setting, 'number' );
265
  break;
266
  case 'input_array':
267
- echo $this->input_array_setting( $setting );
268
  break;
269
  case 'select':
270
- echo $this->select_setting( $setting );
271
  break;
272
  case 'separator':
273
- echo $this->separator_setting( $setting );
274
  break;
275
  case 'list':
276
- echo $this->add_to_list_setting( $setting );
277
  break;
278
  case 'text':
279
- echo $this->text_setting( $setting );
280
  break;
281
  case 'mixed':
282
- echo $this->mixed_setting( $setting );
283
  break;
284
  case 'custom':
285
- echo $this->custom_setting( $setting );
286
  break;
287
  }
288
  }
@@ -300,14 +300,14 @@ class TRP_Advanced_Tab {
300
  $checked = ( isset( $adv_option[ $setting['name'] ] ) && $adv_option[ $setting['name'] ] === 'yes' ) ? 'checked' : '';
301
  $html = "
302
  <tr>
303
- <th scope='row'>" . $setting['label'] . "</th>
304
  <td>
305
  <label>
306
- <input type='checkbox' id='" . $setting['name'] . "' name='trp_advanced_settings[" . $setting['name'] . "]' value='yes' " . $checked . ">
307
  " . __('Yes', 'translatepress-multilingual' ). "
308
  </label>
309
  <p class='description'>
310
- " . $setting['description'] . "
311
  </p>
312
  </td>
313
  </tr>";
@@ -326,7 +326,7 @@ class TRP_Advanced_Tab {
326
  $checked = '';
327
  $html = "
328
  <tr>
329
- <th scope='row'>" . $setting['label'] . "</th>
330
  <td class='trp-adst-radio'>";
331
 
332
  foreach($setting[ 'options' ] as $key => $option ){
@@ -336,13 +336,13 @@ class TRP_Advanced_Tab {
336
  $setting_name = $setting['name'];
337
  $label = $setting[ 'labels' ][$key];
338
  $html .= "<label>
339
- <input type='radio' id='$setting_name' name='trp_advanced_settings[$setting_name]' value='$option' $checked >
340
- $label
341
  </label>";
342
  }
343
 
344
  $html .= " <p class='description'>
345
- " . $setting['description'] . "
346
  </p>
347
  </td>
348
  </tr>";
@@ -363,13 +363,13 @@ class TRP_Advanced_Tab {
363
  $value = ( isset( $adv_option[ $setting['name'] ] ) ) ? $adv_option[ $setting['name'] ] : $default;
364
  $html = "
365
  <tr>
366
- <th scope='row'>" . $setting['label'] . "</th>
367
  <td>
368
  <label>
369
- <input type='{$type}' id='{$setting['name']}' name='trp_advanced_settings[{$setting['name']}]' value='{$value}'>
370
  </label>
371
  <p class='description'>
372
- {$setting['description']}
373
  </p>
374
  </td>
375
  </tr>";
@@ -390,7 +390,7 @@ class TRP_Advanced_Tab {
390
 
391
  $html = "
392
  <tr>
393
- <th scope='row'>" . $setting['label'] . "</th>
394
  <td>
395
  <table class='form-table' style='width:10rem;margin-left:-2rem;margin-top:-1rem'>";
396
  foreach ($setting['rows'] as $row_label=>$row_name ){
@@ -398,12 +398,12 @@ class TRP_Advanced_Tab {
398
 
399
  $html.= "
400
  <tr>
401
- <td><label for='{$setting['name']}-{$row_label}'> {$row_name} </label></td><td><input type='{$type}' id='{$setting['name']}-{$row_label}' name='trp_advanced_settings[{$setting['name']}][{$row_label}]' value='{$value}'>
402
  </td>
403
  </tr>";
404
  }
405
  $html.="</table>
406
- <p class='description'>{$setting['description']}</p>
407
  </td>
408
  </tr>";
409
  return apply_filters('trp_advanced_setting_input_array', $html );
@@ -425,20 +425,20 @@ class TRP_Advanced_Tab {
425
  $options = '';
426
  foreach ($setting['options'] as $lang => $label) {
427
  ($value == $lang) ? $selected = 'selected' : $selected = '' ;
428
- $options .= "<option value='{$lang}' $selected>{$label}</option>";
429
  }
430
 
431
  $html = "
432
  <tr>
433
- <th scope='row'>" . $setting['label'] . "</th>
434
  <td>
435
  <label>
436
- <select id='{$setting['name']}' name='trp_advanced_settings[{$setting['name']}]' style='width: 200px;'>
437
- {$options}
438
  </select>
439
  </label>
440
  <p class='description'>
441
- {$setting['description']}
442
  </p>
443
  </td>
444
  </tr>";
@@ -456,12 +456,12 @@ class TRP_Advanced_Tab {
456
  $html = "";
457
  if ( !isset( $setting['no-border'] ) || $setting['no-border'] !== true ) {
458
  $html .= "
459
- <tr id='" . $setting['name'] . "' style='border-bottom: 1px solid #ccc;' >
460
  <th scope='row'></th>
461
  <td></td>
462
  </tr>";
463
  }
464
- $html .="<tr><td><h2>" . $setting['label'] . "<h2></td></tr>";
465
  return apply_filters('trp_advanced_setting_separator', $html );
466
  }
467
 
@@ -476,13 +476,13 @@ class TRP_Advanced_Tab {
476
  $adv_option = $this->settings['trp_advanced_settings'];
477
  $html = "
478
  <tr>
479
- <th scope='row'>" . $setting['label'] . "</th>
480
  <td>
481
  <table class='trp-adst-list-option'>
482
  <thead>
483
  ";
484
  foreach( $setting['columns'] as $key => $value ){
485
- $html .= '<th><strong>' . $value . '</strong></th>';
486
  }
487
  //"Remove" button
488
  $html .= "<th></th>";
@@ -499,9 +499,9 @@ class TRP_Advanced_Tab {
499
  foreach ( $adv_option[ $setting['name'] ][ $first_column ] as $index => $value ) {
500
  $html .= "<tr class='trp-list-entry'>";
501
  foreach ( $setting['columns'] as $column => $column_name ) {
502
- $html .= "<td><textarea name='trp_advanced_settings[" . $setting['name'] . "][" . $column . "][]'>" . htmlspecialchars($adv_option[ $setting['name'] ][ $column ][ $index ], ENT_QUOTES) . "</textarea></td>";
503
  }
504
- $html .= "<td><span class='trp-adst-remove-element' data-confirm-message='" . __('Are you sure you want to remove this item?', 'translatepress-multilingual') . "'>" . __( 'Remove', 'translatepress-multilingual' ) . "</span></td>";
505
  $html .= "</tr>";
506
  }
507
  }
@@ -509,15 +509,15 @@ class TRP_Advanced_Tab {
509
  // add new entry to list
510
  $html .= "<tr class='trp-add-list-entry trp-list-entry'>";
511
  foreach( $setting['columns'] as $column => $column_name ) {
512
- $html .= "<td><textarea id='new_entry_" . $setting['name'] . "_" . $column . "' data-name='trp_advanced_settings[" . $setting['name'] . "][" . $column . "][]' data-setting-name='" . $setting['name'] . "' data-column-name='" . $column . "'></textarea></td>";
513
 
514
  }
515
- $html .= "<td><input type='button' class='button-secondary trp-adst-button-add-new-item' value='" . __( 'Add', 'translatepress-multilingual' ) . "'><span class='trp-adst-remove-element' style='display: none;' data-confirm-message='" . __('Are you sure you want to remove this item?', 'translatepress-multilingual') . "'>" . __( 'Remove', 'translatepress-multilingual' ) . "</span></td>";
516
  ;
517
  $html .= "</tr></table>";
518
 
519
  $html .= "<p class='description'>
520
- " . $setting['description'] . "
521
  </p>
522
  </td>
523
  </tr>";
@@ -534,10 +534,10 @@ class TRP_Advanced_Tab {
534
  public function text_setting( $setting ){
535
  $html = "
536
  <tr>
537
- <th scope='row'>" . $setting['label'] . "</th>
538
  <td>
539
  <p class='description'>
540
- " . $setting['description'] . "
541
  </p>
542
  </td>
543
  </tr>";
@@ -548,13 +548,13 @@ class TRP_Advanced_Tab {
548
  $adv_option = $this->settings['trp_advanced_settings'];
549
  $html = "
550
  <tr>
551
- <th scope='row'>" . $setting['label'] . "</th>
552
  <td>
553
  <table class='trp-adst-list-option'>
554
  <thead>
555
  ";
556
  foreach( $setting['columns'] as $option_name => $option_details ){
557
- $html .= '<th><strong>' . $option_details['label'] . '</strong></th>';
558
  }
559
 
560
  //"Remove" button
@@ -577,30 +577,30 @@ class TRP_Advanced_Tab {
577
  foreach ( $setting['columns'] as $option_name => $option_details ) {
578
  switch ( $option_details['type']) {
579
  case 'text':
580
- $html .= "<td><input class='trp_narrow_input' type='text' name='trp_advanced_settings[" . $setting['name'] . "][" . $option_name . "][]' value='" . htmlspecialchars($adv_option[ $setting['name'] ][ $option_name ][ $index ], ENT_QUOTES) . "' ></td>";
581
  break;
582
  case 'textarea':
583
- $html .= "<td><textarea class='trp_narrow_input' name='trp_advanced_settings[" . $setting['name'] . "][" . $option_name . "][]'>" . htmlspecialchars($adv_option[ $setting['name'] ][ $option_name ][ $index ], ENT_QUOTES) . "</textarea></td>";
584
  break;
585
  case 'select':
586
- $html .= "<td><select class='trp-select-advanced' name='trp_advanced_settings[" . $setting['name'] . "][" . $option_name . "][]'>";
587
- $html .= "<option value=''>" . __( 'Select...', 'translatepress-multilingual' ) . "</option>";
588
  foreach ( $option_details["values"] as $select_key => $select_value ) {
589
  $selected = ($adv_option[ $setting['name'] ][ $option_name ][ $index ] === $select_value ) ? "selected='selected'" : '';
590
- $html .= "<option value='". esc_attr($select_value). "'$selected>" . esc_attr($select_value) ."</option>";
591
  }
592
  $html .="</select></td>";
593
  break;
594
  case 'checkbox':
595
  $datavalue = isset($adv_option[ $setting['name'] ][ $option_name ][ $index ]) ? htmlspecialchars($adv_option[ $setting['name'] ][ $option_name ][ $index ], ENT_QUOTES) : '';
596
  $checked = ($datavalue === 'yes') ? "checked='checked'" : '';
597
- $html .= "<td><input type='checkbox' class='trp-adv-chk' name='trp_advanced_settings[" . $setting['name'] . "][" . $option_name . "][]' id='new_entry_" . $setting['name'] . "_" . $option_name . "' data-name='trp_advanced_settings[" . $setting['name'] . "][" . $option_name . "][]' data-setting-name='" . $setting['name'] . "' data-column-name='" . $option_name . "' value='yes' ".$checked .">";
598
- $html .= "<input type='hidden' name='trp_advanced_settings[" . $setting['name'] . "][" . $option_name . "][]' id='new_entry_" . $setting['name'] . "_" . $option_name . "' data-name='trp_advanced_settings[" . $setting['name'] . "][" . $option_name . "][]' data-setting-name='" . $setting['name'] . "' data-column-name='" . $option_name . "' value=''>";
599
  $html .="</td>";
600
  break;
601
  }
602
  }
603
- $html .= "<td><span class='trp-adst-remove-element' data-confirm-message='" . __('Are you sure you want to remove this item?', 'translatepress-multilingual') . "'>" . __( 'Remove', 'translatepress-multilingual' ) . "</span></td>";
604
  $html .= "</tr>";
605
  }
606
  }
@@ -611,30 +611,30 @@ class TRP_Advanced_Tab {
611
 
612
  switch ( $option_details['type']) {
613
  case 'text':
614
- $html .= "<td><input type='text' class='trp_narrow_input' id='new_entry_" . $setting['name'] . "_" . $option_name . "' data-name='trp_advanced_settings[" . $setting['name'] . "][" . $option_name . "][]' data-setting-name='" . $setting['name'] . "' data-column-name='" . $option_name . "'></input></td>";
615
  break;
616
  case 'textarea':
617
- $html .= "<td class='trp_narrow_input'><textarea id='new_entry_" . $setting['name'] . "_" . $option_name . "' data-name='trp_advanced_settings[" . $setting['name'] . "][" . $option_name . "][]' data-setting-name='" . $setting['name'] . "' data-column-name='" . $option_name . "'></textarea></td>";
618
  break;
619
  case 'select':
620
- $html .= "<td><select id='new_entry_" . $setting['name'] . "_" . $option_name . "' data-name='trp_advanced_settings[" . $setting['name'] . "][" . $option_name . "][]' data-setting-name='" . $setting['name'] . "' data-column-name='" . $option_name . "'>";
621
  $html .= "<option value=''>" . __( 'Select...', 'translatepress-multilingual' ) . "</option>";
622
  foreach ( $option_details["values"] as $select_key => $select_value ) {
623
- $html .= "<option value='". esc_attr($select_value). "'>" . esc_attr($select_value) . "</option>";
624
  }
625
  $html .="</select></td>";
626
  break;
627
  case 'checkbox':
628
- $html .= "<td><input type='checkbox' class='trp-adv-chk' id='new_entry_" . $setting['name'] . "_" . $option_name . "' data-name='trp_advanced_settings[" . $setting['name'] . "][" . $option_name . "][]' data-column-name='" . $option_name ."' value='yes'>";
629
- $html .= "<input type='hidden' id='new_entry_" . $setting['name'] . "_" . $option_name . "' data-name='trp_advanced_settings[" . $setting['name'] . "][" . $option_name . "][]' data-column-name='" . $option_name ."' value=''>";
630
  $html .="</td>";
631
  break;
632
  }
633
  }
634
- $html .= "<td><input type='button' id='button_add_" . $setting['name'] . "' class='button-secondary trp-adst-button-add-new-item' value='" . __( 'Add', 'translatepress-multilingual' ) . "'><span class='trp-adst-remove-element' style='display: none;' data-confirm-message='" . __('Are you sure you want to remove this item?', 'translatepress-multilingual') . "'>" . __( 'Remove', 'translatepress-multilingual' ) . "</span></td>";
635
  $html .= "</tr></table>";
636
  $html .= "<p class='description'>
637
- " . $setting['description'] . "
638
  </p>
639
  </td>
640
  </tr>";
175
  }
176
 
177
  } //end foreach of parsing all the registered settings array
178
+ add_settings_error( 'trp_advanced_settings', 'settings_updated', __( 'Settings saved.', 'translatepress-multilingual' ), 'updated' );
179
 
180
  return apply_filters( 'trp_extra_sanitize_advanced_settings', $settings, $submitted_settings );
181
  }
236
  if ( $setting['type'] !== 'separator' ){
237
  continue;
238
  }
239
+ $html .= '<a class="trp_advanced_tab_content_table_item" href="#' . esc_attr( $setting['name'] ) . '">' . esc_html( $setting['label'] ) . '</a> | ';
240
  }
241
  $html = rtrim($html, " | ");
242
  $html .= '</p>';
243
+ echo $html;//phpcs:ignore
244
  }
245
 
246
 
252
  foreach( $advanced_settings_array as $setting ){
253
  switch( $setting['type'] ){
254
  case 'checkbox':
255
+ echo $this->checkbox_setting( $setting );//phpcs:ignore
256
  break;
257
  case 'radio':
258
+ echo $this->radio_setting( $setting );//phpcs:ignore
259
  break;
260
  case 'input':
261
+ echo $this->input_setting( $setting );//phpcs:ignore
262
  break;
263
  case 'number':
264
+ echo $this->input_setting( $setting, 'number' );//phpcs:ignore
265
  break;
266
  case 'input_array':
267
+ echo $this->input_array_setting( $setting );//phpcs:ignore
268
  break;
269
  case 'select':
270
+ echo $this->select_setting( $setting );//phpcs:ignore
271
  break;
272
  case 'separator':
273
+ echo $this->separator_setting( $setting );//phpcs:ignore
274
  break;
275
  case 'list':
276
+ echo $this->add_to_list_setting( $setting );//phpcs:ignore
277
  break;
278
  case 'text':
279
+ echo $this->text_setting( $setting );//phpcs:ignore
280
  break;
281
  case 'mixed':
282
+ echo $this->mixed_setting( $setting );//phpcs:ignore
283
  break;
284
  case 'custom':
285
+ echo $this->custom_setting( $setting );//phpcs:ignore
286
  break;
287
  }
288
  }
300
  $checked = ( isset( $adv_option[ $setting['name'] ] ) && $adv_option[ $setting['name'] ] === 'yes' ) ? 'checked' : '';
301
  $html = "
302
  <tr>
303
+ <th scope='row'>" . esc_html( $setting['label'] ). "</th>
304
  <td>
305
  <label>
306
+ <input type='checkbox' id='" . esc_attr( $setting['name'] ). "' name='trp_advanced_settings[" . esc_attr( $setting['name'] ) . "]' value='yes' " . $checked . ">
307
  " . __('Yes', 'translatepress-multilingual' ). "
308
  </label>
309
  <p class='description'>
310
+ " . wp_kses_post( $setting['description'] ) . "
311
  </p>
312
  </td>
313
  </tr>";
326
  $checked = '';
327
  $html = "
328
  <tr>
329
+ <th scope='row'>" . esc_html($setting['label'] ) . "</th>
330
  <td class='trp-adst-radio'>";
331
 
332
  foreach($setting[ 'options' ] as $key => $option ){
336
  $setting_name = $setting['name'];
337
  $label = $setting[ 'labels' ][$key];
338
  $html .= "<label>
339
+ <input type='radio' id='". esc_attr( $setting_name ) . "' name='trp_advanced_settings[". esc_attr( $setting_name ) ."]' value='". esc_attr( $option ) ."' $checked >
340
+ ". esc_html( $label ) ."
341
  </label>";
342
  }
343
 
344
  $html .= " <p class='description'>
345
+ " . wp_kses_post( $setting['description'] ). "
346
  </p>
347
  </td>
348
  </tr>";
363
  $value = ( isset( $adv_option[ $setting['name'] ] ) ) ? $adv_option[ $setting['name'] ] : $default;
364
  $html = "
365
  <tr>
366
+ <th scope='row'>" . esc_html( $setting['label'] ). "</th>
367
  <td>
368
  <label>
369
+ <input type='" . esc_attr( $type ) ."' id='" . esc_attr( $setting['name'] ) ."' name='trp_advanced_settings[" .esc_attr( $setting['name'] )."]' value='" . esc_attr( $value ) ."'>
370
  </label>
371
  <p class='description'>
372
+ ". wp_kses_post( $setting['description'] ) . "
373
  </p>
374
  </td>
375
  </tr>";
390
 
391
  $html = "
392
  <tr>
393
+ <th scope='row'>" . esc_html( $setting['label'] ) . "</th>
394
  <td>
395
  <table class='form-table' style='width:10rem;margin-left:-2rem;margin-top:-1rem'>";
396
  foreach ($setting['rows'] as $row_label=>$row_name ){
398
 
399
  $html.= "
400
  <tr>
401
+ <td><label for='". esc_attr( $setting['name'] ) ."-".esc_attr( $row_label ) ."'> ".esc_attr( $row_name )." </label></td><td><input type='". esc_attr( $type ) ."' id='". esc_attr( $setting['name'] ) ."-". esc_attr( $row_label ) ."' name='trp_advanced_settings[". esc_attr( $setting['name'] )."][". esc_attr( $row_label )."]' value='".esc_attr( $value )."'>
402
  </td>
403
  </tr>";
404
  }
405
  $html.="</table>
406
+ <p class='description'>". wp_kses_post( $setting['description'] ) ."</p>
407
  </td>
408
  </tr>";
409
  return apply_filters('trp_advanced_setting_input_array', $html );
425
  $options = '';
426
  foreach ($setting['options'] as $lang => $label) {
427
  ($value == $lang) ? $selected = 'selected' : $selected = '' ;
428
+ $options .= "<option value='". esc_attr( $lang ) ."' $selected>". esc_html( $label )."</option>";
429
  }
430
 
431
  $html = "
432
  <tr>
433
+ <th scope='row'>" . esc_html( $setting['label'] ) ."</th>
434
  <td>
435
  <label>
436
+ <select id='".esc_attr( $setting['name'] ) ."' name='trp_advanced_settings[". esc_attr( $setting['name'] ) ."]' style='width: 200px;'>
437
+ ". $options ."
438
  </select>
439
  </label>
440
  <p class='description'>
441
+ ". wp_kses_post( $setting['description'] ) ."
442
  </p>
443
  </td>
444
  </tr>";
456
  $html = "";
457
  if ( !isset( $setting['no-border'] ) || $setting['no-border'] !== true ) {
458
  $html .= "
459
+ <tr id='" . esc_attr( $setting['name'] ) . "' style='border-bottom: 1px solid #ccc;' >
460
  <th scope='row'></th>
461
  <td></td>
462
  </tr>";
463
  }
464
+ $html .="<tr><td><h2>" . esc_html( $setting['label'] ) . "<h2></td></tr>";
465
  return apply_filters('trp_advanced_setting_separator', $html );
466
  }
467
 
476
  $adv_option = $this->settings['trp_advanced_settings'];
477
  $html = "
478
  <tr>
479
+ <th scope='row'>" . esc_html( $setting['label'] ) . "</th>
480
  <td>
481
  <table class='trp-adst-list-option'>
482
  <thead>
483
  ";
484
  foreach( $setting['columns'] as $key => $value ){
485
+ $html .= '<th><strong>' . esc_html( $value ) . '</strong></th>';
486
  }
487
  //"Remove" button
488
  $html .= "<th></th>";
499
  foreach ( $adv_option[ $setting['name'] ][ $first_column ] as $index => $value ) {
500
  $html .= "<tr class='trp-list-entry'>";
501
  foreach ( $setting['columns'] as $column => $column_name ) {
502
+ $html .= "<td><textarea name='trp_advanced_settings[" . esc_attr( $setting['name'] ). "][" . esc_attr( $column ) . "][]'>" . htmlspecialchars($adv_option[ $setting['name'] ][ $column ][ $index ], ENT_QUOTES) . "</textarea></td>";
503
  }
504
+ $html .= "<td><span class='trp-adst-remove-element' data-confirm-message='" . esc_html__('Are you sure you want to remove this item?', 'translatepress-multilingual') . "'>" . esc_html__( 'Remove', 'translatepress-multilingual' ) . "</span></td>";
505
  $html .= "</tr>";
506
  }
507
  }
509
  // add new entry to list
510
  $html .= "<tr class='trp-add-list-entry trp-list-entry'>";
511
  foreach( $setting['columns'] as $column => $column_name ) {
512
+ $html .= "<td><textarea id='new_entry_" . esc_attr( $setting['name'] ) . "_" . esc_attr( $column ) . "' data-name='trp_advanced_settings[" . esc_attr( $setting['name'] ) . "][" . esc_attr( $column ) . "][]' data-setting-name='" . esc_attr( $setting['name'] ) . "' data-column-name='" . esc_attr( $column ) . "'></textarea></td>";
513
 
514
  }
515
+ $html .= "<td><input type='button' class='button-secondary trp-adst-button-add-new-item' value='" . esc_html__( 'Add', 'translatepress-multilingual' ) . "'><span class='trp-adst-remove-element' style='display: none;' data-confirm-message='" . esc_html__('Are you sure you want to remove this item?', 'translatepress-multilingual') . "'>" . esc_html__( 'Remove', 'translatepress-multilingual' ) . "</span></td>";
516
  ;
517
  $html .= "</tr></table>";
518
 
519
  $html .= "<p class='description'>
520
+ " . wp_kses_post( $setting['description'] ) . "
521
  </p>
522
  </td>
523
  </tr>";
534
  public function text_setting( $setting ){
535
  $html = "
536
  <tr>
537
+ <th scope='row'>" . esc_html( $setting['label'] ) . "</th>
538
  <td>
539
  <p class='description'>
540
+ " . wp_kses_post( $setting['description'] ) . "
541
  </p>
542
  </td>
543
  </tr>";
548
  $adv_option = $this->settings['trp_advanced_settings'];
549
  $html = "
550
  <tr>
551
+ <th scope='row'>" . esc_html( $setting['label'] ) . "</th>
552
  <td>
553
  <table class='trp-adst-list-option'>
554
  <thead>
555
  ";
556
  foreach( $setting['columns'] as $option_name => $option_details ){
557
+ $html .= '<th><strong>' . esc_html( $option_details['label'] ) . '</strong></th>';
558
  }
559
 
560
  //"Remove" button
577
  foreach ( $setting['columns'] as $option_name => $option_details ) {
578
  switch ( $option_details['type']) {
579
  case 'text':
580
+ $html .= "<td><input class='trp_narrow_input' type='text' name='trp_advanced_settings[" . esc_attr( $setting['name'] ) . "][" . esc_attr( $option_name ) . "][]' value='" . htmlspecialchars($adv_option[ $setting['name'] ][ $option_name ][ $index ], ENT_QUOTES) . "' ></td>";
581
  break;
582
  case 'textarea':
583
+ $html .= "<td><textarea class='trp_narrow_input' name='trp_advanced_settings[" . esc_attr( $setting['name'] ) . "][" . esc_attr( $option_name ) . "][]'>" . htmlspecialchars($adv_option[ $setting['name'] ][ $option_name ][ $index ], ENT_QUOTES) . "</textarea></td>";
584
  break;
585
  case 'select':
586
+ $html .= "<td><select class='trp-select-advanced' name='trp_advanced_settings[" . esc_attr( $setting['name'] ) . "][" . esc_attr( $option_name ) . "][]'>";
587
+ $html .= "<option value=''>" . esc_html__( 'Select...', 'translatepress-multilingual' ) . "</option>";
588
  foreach ( $option_details["values"] as $select_key => $select_value ) {
589
  $selected = ($adv_option[ $setting['name'] ][ $option_name ][ $index ] === $select_value ) ? "selected='selected'" : '';
590
+ $html .= "<option value='". esc_attr($select_value). "'$selected>" . esc_html($select_value) ."</option>";
591
  }
592
  $html .="</select></td>";
593
  break;
594
  case 'checkbox':
595
  $datavalue = isset($adv_option[ $setting['name'] ][ $option_name ][ $index ]) ? htmlspecialchars($adv_option[ $setting['name'] ][ $option_name ][ $index ], ENT_QUOTES) : '';
596
  $checked = ($datavalue === 'yes') ? "checked='checked'" : '';
597
+ $html .= "<td><input type='checkbox' class='trp-adv-chk' name='trp_advanced_settings[" . esc_attr( $setting['name'] ) . "][" . esc_attr( $option_name ) . "][]' id='new_entry_" . esc_attr( $setting['name'] ) . "_" . esc_attr( $option_name ) . "' data-name='trp_advanced_settings[" . esc_attr( $setting['name'] ) . "][" . esc_attr( $option_name ) . "][]' data-setting-name='" . esc_attr( $setting['name'] ) . "' data-column-name='" . esc_attr( $option_name ) . "' value='yes' ".$checked .">";
598
+ $html .= "<input type='hidden' name='trp_advanced_settings[" . esc_attr( $setting['name'] ) . "][" . esc_attr( $option_name ) . "][]' id='new_entry_" . esc_attr( $setting['name'] ) . "_" . esc_attr( $option_name ) . "' data-name='trp_advanced_settings[" . esc_attr( $setting['name'] ) . "][" . esc_attr( $option_name ) . "][]' data-setting-name='" . esc_attr( $setting['name'] ) . "' data-column-name='" . esc_attr( $option_name ) . "' value=''>";
599
  $html .="</td>";
600
  break;
601
  }
602
  }
603
+ $html .= "<td><span class='trp-adst-remove-element' data-confirm-message='" . esc_html__('Are you sure you want to remove this item?', 'translatepress-multilingual') . "'>" . esc_html__( 'Remove', 'translatepress-multilingual' ) . "</span></td>";
604
  $html .= "</tr>";
605
  }
606
  }
611
 
612
  switch ( $option_details['type']) {
613
  case 'text':
614
+ $html .= "<td><input type='text' class='trp_narrow_input' id='new_entry_" . esc_attr( $setting['name'] ) . "_" . esc_attr( $option_name ) . "' data-name='trp_advanced_settings[" . esc_attr( $setting['name'] ) . "][" . esc_attr( $option_name ) . "][]' data-setting-name='" . esc_attr( $setting['name'] ) . "' data-column-name='" . esc_attr( $option_name ) . "'></input></td>";
615
  break;
616
  case 'textarea':
617
+ $html .= "<td class='trp_narrow_input'><textarea id='new_entry_" . esc_attr( $setting['name'] ) . "_" . esc_attr( $option_name ) . "' data-name='trp_advanced_settings[" . esc_attr( $setting['name'] ) . "][" . esc_attr( $option_name ) . "][]' data-setting-name='" . esc_attr( $setting['name'] ) . "' data-column-name='" . esc_attr( $option_name ) . "'></textarea></td>";
618
  break;
619
  case 'select':
620
+ $html .= "<td><select id='new_entry_" . esc_attr( $setting['name'] ) . "_" . esc_attr( $option_name ) . "' data-name='trp_advanced_settings[" . esc_attr( $setting['name'] ) . "][" . esc_attr( $option_name ) . "][]' data-setting-name='" . esc_attr( $setting['name'] ) . "' data-column-name='" . esc_attr( $option_name ) . "'>";
621
  $html .= "<option value=''>" . __( 'Select...', 'translatepress-multilingual' ) . "</option>";
622
  foreach ( $option_details["values"] as $select_key => $select_value ) {
623
+ $html .= "<option value='". esc_attr($select_value). "'>" . esc_html($select_value) . "</option>";
624
  }
625
  $html .="</select></td>";
626
  break;
627
  case 'checkbox':
628
+ $html .= "<td><input type='checkbox' class='trp-adv-chk' id='new_entry_" . esc_attr( $setting['name'] ) . "_" . esc_attr( $option_name ) . "' data-name='trp_advanced_settings[" . esc_attr( $setting['name'] ) . "][" . esc_attr( $option_name ) . "][]' data-column-name='" . esc_attr( $option_name ) ."' value='yes'>";
629
+ $html .= "<input type='hidden' id='new_entry_" . esc_attr( $setting['name'] ) . "_" . esc_attr( $option_name ) . "' data-name='trp_advanced_settings[" . esc_attr( $setting['name'] ) . "][" . esc_attr( $option_name ) . "][]' data-column-name='" . esc_attr( $option_name ) ."' value=''>";
630
  $html .="</td>";
631
  break;
632
  }
633
  }
634
+ $html .= "<td><input type='button' id='button_add_" . esc_attr( $setting['name'] ) . "' class='button-secondary trp-adst-button-add-new-item' value='" . esc_html__( 'Add', 'translatepress-multilingual' ) . "'><span class='trp-adst-remove-element' style='display: none;' data-confirm-message='" . esc_html__('Are you sure you want to remove this item?', 'translatepress-multilingual') . "'>" . esc_html__( 'Remove', 'translatepress-multilingual' ) . "</span></td>";
635
  $html .= "</tr></table>";
636
  $html .= "<p class='description'>
637
+ " . wp_kses_post( $setting['description'] ) . "
638
  </p>
639
  </td>
640
  </tr>";
includes/class-edd-sl-plugin-updater.php CHANGED
@@ -204,7 +204,7 @@ if( !class_exists('TRP_EDD_SL_Plugin_Updater') ) {
204
  // build a plugin list row, with update notification
205
  $wp_list_table = _get_list_table('WP_Plugins_List_Table');
206
  # <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
207
- echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">';
208
  echo '<td colspan="3" class="plugin-update colspanchange">';
209
  echo '<div class="update-message notice inline notice-warning notice-alt">';
210
 
@@ -212,7 +212,7 @@ if( !class_exists('TRP_EDD_SL_Plugin_Updater') ) {
212
 
213
  if (empty($version_info->download_link)) {
214
  printf(
215
- __('There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'easy-digital-downloads'),
216
  esc_html($version_info->name),
217
  '<a target="_blank" class="thickbox" href="' . esc_url($changelog_link) . '">',
218
  esc_html($version_info->new_version),
@@ -220,7 +220,7 @@ if( !class_exists('TRP_EDD_SL_Plugin_Updater') ) {
220
  );
221
  } else {
222
  printf(
223
- __('There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'easy-digital-downloads'),
224
  esc_html($version_info->name),
225
  '<a target="_blank" class="thickbox" href="' . esc_url($changelog_link) . '">',
226
  esc_html($version_info->new_version),
@@ -414,10 +414,10 @@ if( !class_exists('TRP_EDD_SL_Plugin_Updater') ) {
414
  }
415
 
416
  if (!current_user_can('update_plugins')) {
417
- wp_die(__('You do not have permission to install plugin updates', 'easy-digital-downloads'), __('Error', 'easy-digital-downloads'), array('response' => 403));
418
  }
419
 
420
- $data = $edd_plugin_data[$_REQUEST['slug']];
421
  $beta = !empty($data['beta']) ? true : false;
422
  $cache_key = md5('edd_plugin_' . sanitize_key($_REQUEST['plugin']) . '_' . $beta . '_version_info');
423
  $version_info = $this->get_cached_version_info($cache_key);
@@ -428,7 +428,7 @@ if( !class_exists('TRP_EDD_SL_Plugin_Updater') ) {
428
  'edd_action' => 'get_version',
429
  'item_name' => isset($data['item_name']) ? $data['item_name'] : false,
430
  'item_id' => isset($data['item_id']) ? $data['item_id'] : false,
431
- 'slug' => $_REQUEST['slug'],
432
  'author' => $data['author'],
433
  'url' => home_url(),
434
  'beta' => !empty($data['beta'])
@@ -459,7 +459,7 @@ if( !class_exists('TRP_EDD_SL_Plugin_Updater') ) {
459
  }
460
 
461
  if (!empty($version_info) && isset($version_info->sections['changelog'])) {
462
- echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>';
463
  }
464
 
465
  exit;
@@ -540,7 +540,7 @@ if( !class_exists('TRP_LICENSE_PAGE') ) {
540
  $action = 'options.php';
541
  ob_start();
542
  require TRP_PLUGIN_DIR . 'partials/license-settings-page.php';
543
- echo ob_get_clean();
544
  }
545
  }
546
  }
@@ -635,8 +635,6 @@ class TRP_Plugin_Updater{
635
  public function admin_activation_notices() {
636
  if ( isset( $_GET['trp_sl_activation'] ) && ! empty( $_GET['message'] ) ) {
637
 
638
- $message = urldecode( $_GET['message'] );
639
-
640
  switch( $_GET['trp_sl_activation'] ) {
641
  case 'false':
642
  $class ="error";
@@ -648,8 +646,8 @@ class TRP_Plugin_Updater{
648
  }
649
 
650
  ?>
651
- <div class="<?php echo $class; ?>">
652
- <p><?php echo wp_kses_post( $message ); ?></p>
653
  </div>
654
  <?php
655
  }
@@ -664,13 +662,13 @@ class TRP_Plugin_Updater{
664
  return; // get out if we didn't click the Activate button
665
 
666
 
667
- if (preg_match('/^[*]+$/', $_POST['trp_license_key']) && strlen( $_POST['trp_license_key'] ) > 5 ) {
668
  // pressed submit without altering the existing license key (containing only * as outputted by default)
669
  // useful for Deactivating/Activating valid license back
670
  $license = get_option('trp_license_key', '');
671
  }else{
672
  // save the license
673
- $license = $this->edd_sanitize_license( trim( $_POST['trp_license_key'] ) );
674
  $this->update_option( 'trp_license_key', $license );
675
  }
676
  $message = array();//we will check the license for each addon and we will sotre the messages in an array
204
  // build a plugin list row, with update notification
205
  $wp_list_table = _get_list_table('WP_Plugins_List_Table');
206
  # <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
207
+ echo '<tr class="plugin-update-tr" id="' . esc_attr( $this->slug ) . '-update" data-slug="' . esc_attr( $this->slug ) . '" data-plugin="' . esc_attr( $this->slug ) . '/' . esc_attr( $file ) . '">';
208
  echo '<td colspan="3" class="plugin-update colspanchange">';
209
  echo '<div class="update-message notice inline notice-warning notice-alt">';
210
 
212
 
213
  if (empty($version_info->download_link)) {
214
  printf(
215
+ __('There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'translatepress-multilingual'), //phpcs:ignore
216
  esc_html($version_info->name),
217
  '<a target="_blank" class="thickbox" href="' . esc_url($changelog_link) . '">',
218
  esc_html($version_info->new_version),
220
  );
221
  } else {
222
  printf(
223
+ __('There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'translatepress-multilingual'), //phpcs:ignore
224
  esc_html($version_info->name),
225
  '<a target="_blank" class="thickbox" href="' . esc_url($changelog_link) . '">',
226
  esc_html($version_info->new_version),
414
  }
415
 
416
  if (!current_user_can('update_plugins')) {
417
+ wp_die( esc_html__('You do not have permission to install plugin updates', 'translatepress-multilingual'), esc_html__('Error', 'translatepress-multilingual'), array('response' => 403));
418
  }
419
 
420
+ $data = $edd_plugin_data[sanitize_text_field( $_REQUEST['slug'] )];
421
  $beta = !empty($data['beta']) ? true : false;
422
  $cache_key = md5('edd_plugin_' . sanitize_key($_REQUEST['plugin']) . '_' . $beta . '_version_info');
423
  $version_info = $this->get_cached_version_info($cache_key);
428
  'edd_action' => 'get_version',
429
  'item_name' => isset($data['item_name']) ? $data['item_name'] : false,
430
  'item_id' => isset($data['item_id']) ? $data['item_id'] : false,
431
+ 'slug' => sanitize_text_field( $_REQUEST['slug'] ),
432
  'author' => $data['author'],
433
  'url' => home_url(),
434
  'beta' => !empty($data['beta'])
459
  }
460
 
461
  if (!empty($version_info) && isset($version_info->sections['changelog'])) {
462
+ echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $version_info->sections['changelog'] ) . '</div>';
463
  }
464
 
465
  exit;
540
  $action = 'options.php';
541
  ob_start();
542
  require TRP_PLUGIN_DIR . 'partials/license-settings-page.php';
543
+ echo ob_get_clean();//phpcs:ignore
544
  }
545
  }
546
  }
635
  public function admin_activation_notices() {
636
  if ( isset( $_GET['trp_sl_activation'] ) && ! empty( $_GET['message'] ) ) {
637
 
 
 
638
  switch( $_GET['trp_sl_activation'] ) {
639
  case 'false':
640
  $class ="error";
646
  }
647
 
648
  ?>
649
+ <div class="<?php echo esc_attr( $class ); ?>">
650
+ <p><?php echo wp_kses_post( urldecode( $_GET['message'] ) );//phpcs:ignore ?></p>
651
  </div>
652
  <?php
653
  }
662
  return; // get out if we didn't click the Activate button
663
 
664
 
665
+ if ( isset( $_POST['trp_license_key'] ) && preg_match('/^[*]+$/', $_POST['trp_license_key']) && strlen( $_POST['trp_license_key'] ) > 5 ) { //phpcs:ignore
666
  // pressed submit without altering the existing license key (containing only * as outputted by default)
667
  // useful for Deactivating/Activating valid license back
668
  $license = get_option('trp_license_key', '');
669
  }else{
670
  // save the license
671
+ $license = $this->edd_sanitize_license( trim( $_POST['trp_license_key'] ) );//phpcs:ignore
672
  $this->update_option( 'trp_license_key', $license );
673
  }
674
  $message = array();//we will check the license for each addon and we will sotre the messages in an array
includes/class-editor-api-gettext-strings.php CHANGED
@@ -28,7 +28,7 @@ class TRP_Editor_Api_Gettext_Strings {
28
  if (isset($_POST['action']) && $_POST['action'] === 'trp_get_translations_gettext' && !empty($_POST['string_ids']) && !empty($_POST['language']) && in_array($_POST['language'], $this->settings['translation-languages'])) {
29
  check_ajax_referer( 'gettext_get_translations', 'security' );
30
  if (!empty($_POST['string_ids']))
31
- $gettext_string_ids = json_decode(stripslashes($_POST['string_ids']));
32
  else
33
  $gettext_string_ids = array();
34
 
@@ -116,8 +116,8 @@ class TRP_Editor_Api_Gettext_Strings {
116
  }
117
  }
118
  $localized_text = $this->translation_manager->string_groups();
119
- $dictionary_by_original = trp_sort_dictionary_by_original( $dictionaries, 'gettext', $localized_text['gettextstrings'], $_POST['language'] );
120
- die( trp_safe_json_encode( $dictionary_by_original ) );
121
 
122
  }
123
  }
@@ -130,7 +130,7 @@ class TRP_Editor_Api_Gettext_Strings {
130
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX && current_user_can( apply_filters( 'trp_translating_capability', 'manage_options' ) ) ) {
131
  if (isset($_POST['action']) && $_POST['action'] === 'trp_save_translations_gettext' && !empty($_POST['strings'])) {
132
  check_ajax_referer( 'gettext_save_translations', 'security' );
133
- $strings = json_decode(stripslashes($_POST['strings']));
134
  $update_strings = array();
135
  foreach ( $strings as $language => $language_strings ) {
136
  if ( in_array( $language, $this->settings['translation-languages'] ) ) {
@@ -162,7 +162,7 @@ class TRP_Editor_Api_Gettext_Strings {
162
  do_action('trp_save_editor_translations_gettext_strings', $update_strings, $this->settings);
163
  }
164
  }
165
- echo trp_safe_json_encode( array() );
166
  wp_die();
167
  }
168
  }
28
  if (isset($_POST['action']) && $_POST['action'] === 'trp_get_translations_gettext' && !empty($_POST['string_ids']) && !empty($_POST['language']) && in_array($_POST['language'], $this->settings['translation-languages'])) {
29
  check_ajax_referer( 'gettext_get_translations', 'security' );
30
  if (!empty($_POST['string_ids']))
31
+ $gettext_string_ids = json_decode(stripslashes($_POST['string_ids']));/* phpcs:ignore */ /* sanitized when inserting in db */
32
  else
33
  $gettext_string_ids = array();
34
 
116
  }
117
  }
118
  $localized_text = $this->translation_manager->string_groups();
119
+ $dictionary_by_original = trp_sort_dictionary_by_original( $dictionaries, 'gettext', $localized_text['gettextstrings'], sanitize_text_field( $_POST['language'] ) );
120
+ die( trp_safe_json_encode( $dictionary_by_original ) );//phpcs:ignore
121
 
122
  }
123
  }
130
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX && current_user_can( apply_filters( 'trp_translating_capability', 'manage_options' ) ) ) {
131
  if (isset($_POST['action']) && $_POST['action'] === 'trp_save_translations_gettext' && !empty($_POST['strings'])) {
132
  check_ajax_referer( 'gettext_save_translations', 'security' );
133
+ $strings = json_decode(stripslashes($_POST['strings']));/* phpcs:ignore */ /* properly sanitized bellow */
134
  $update_strings = array();
135
  foreach ( $strings as $language => $language_strings ) {
136
  if ( in_array( $language, $this->settings['translation-languages'] ) ) {
162
  do_action('trp_save_editor_translations_gettext_strings', $update_strings, $this->settings);
163
  }
164
  }
165
+ echo trp_safe_json_encode( array() );//phpcs:ignore
166
  wp_die();
167
  }
168
  }
includes/class-editor-api-regular-strings.php CHANGED
@@ -30,9 +30,9 @@ class TRP_Editor_Api_Regular_Strings {
30
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
31
  check_ajax_referer( 'get_translations', 'security' );
32
  if ( isset( $_POST['action'] ) && $_POST['action'] === 'trp_get_translations_regular' && !empty( $_POST['language'] ) && in_array( $_POST['language'], $this->settings['translation-languages'] ) ) {
33
- $originals = (empty($_POST['originals']) )? array() : json_decode(stripslashes($_POST['originals']));
34
- $skip_machine_translation = (empty($_POST['skip_machine_translation']) )? array() : json_decode(stripslashes($_POST['skip_machine_translation']));
35
- $ids = (empty($_POST['string_ids']) )? array() : json_decode(stripslashes($_POST['string_ids']));
36
  if ( is_array( $ids ) || is_array( $originals) ) {
37
  $trp = TRP_Translate_Press::get_trp_instance();
38
  if (!$this->trp_query) {
@@ -49,9 +49,9 @@ class TRP_Editor_Api_Regular_Strings {
49
  if ( isset( $_POST['dynamic_strings'] ) && $_POST['dynamic_strings'] === 'true' ){
50
  $string_group = $localized_text['dynamicstrings'];
51
  }
52
- $dictionary_by_original = trp_sort_dictionary_by_original( $dictionaries, 'regular', $string_group, $_POST['language'] );
53
 
54
- echo trp_safe_json_encode( $dictionary_by_original );
55
  }
56
  }
57
  }
@@ -103,7 +103,7 @@ class TRP_Editor_Api_Regular_Strings {
103
  }
104
  }
105
 
106
- $current_language = sanitize_text_field( $_POST['language'] );
107
 
108
 
109
  // necessary in order to obtain all the original strings
@@ -182,11 +182,11 @@ class TRP_Editor_Api_Regular_Strings {
182
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX && current_user_can( apply_filters( 'trp_translating_capability', 'manage_options' ) ) ) {
183
  check_ajax_referer( 'save_translations', 'security' );
184
  if ( isset( $_POST['action'] ) && $_POST['action'] === 'trp_save_translations_regular' && !empty( $_POST['strings'] ) ) {
185
- $strings = json_decode(stripslashes($_POST['strings']));
186
  $this->save_translations_of_strings( $strings );
187
  }
188
  }
189
- echo trp_safe_json_encode( array() );
190
  die();
191
  }
192
 
@@ -250,7 +250,7 @@ class TRP_Editor_Api_Regular_Strings {
250
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX && current_user_can( apply_filters( 'trp_translating_capability', 'manage_options' ) ) ) {
251
  check_ajax_referer( 'merge_translation_block', 'security' );
252
  if ( isset( $_POST['action'] ) && $_POST['action'] === 'trp_create_translation_block' && !empty( $_POST['strings'] ) && !empty( $_POST['language'] ) && in_array( $_POST['language'], $this->settings['translation-languages'] ) && !empty( $_POST['original'] ) ) {
253
- $strings = json_decode( stripslashes( $_POST['strings'] ) );
254
 
255
  if ( isset ( $this->settings['translation-languages']) ){
256
  $trp = TRP_Translate_Press::get_trp_instance();
@@ -264,7 +264,7 @@ class TRP_Editor_Api_Regular_Strings {
264
  $active_block_type = $this->trp_query->get_constant_block_type_active();
265
  foreach( $this->settings['translation-languages'] as $language ){
266
  if ( $language != $this->settings['default-language'] ){
267
- $dictionaries = $this->get_translation_for_strings( array(), array( stripslashes( $_POST['original'] ) ), $active_block_type, array() );
268
  break;
269
  }
270
  }
@@ -331,7 +331,7 @@ class TRP_Editor_Api_Regular_Strings {
331
  }
332
  }
333
 
334
- echo trp_safe_json_encode( $dictionaries );
335
  }
336
  }
337
 
@@ -352,7 +352,7 @@ class TRP_Editor_Api_Regular_Strings {
352
  check_ajax_referer( 'split_translation_block', 'security' );
353
 
354
  if ( isset( $_POST['action'] ) && $_POST['action'] === 'trp_split_translation_block' && ! empty( $_POST['strings'] ) ) {
355
- $raw_original_array = json_decode( stripslashes( $_POST['strings'] ) );
356
  $trp = TRP_Translate_Press::get_trp_instance();
357
  if ( ! $this->trp_query ) {
358
  $this->trp_query = $trp->get_component( 'query' );
30
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
31
  check_ajax_referer( 'get_translations', 'security' );
32
  if ( isset( $_POST['action'] ) && $_POST['action'] === 'trp_get_translations_regular' && !empty( $_POST['language'] ) && in_array( $_POST['language'], $this->settings['translation-languages'] ) ) {
33
+ $originals = (empty($_POST['originals']) )? array() : json_decode(stripslashes($_POST['originals'])); /* phpcs:ignore */ /* sanitized downstream */
34
+ $skip_machine_translation = (empty($_POST['skip_machine_translation']) )? array() : json_decode(stripslashes($_POST['skip_machine_translation'])); /* phpcs:ignore */ /* sanitized downstream */
35
+ $ids = (empty($_POST['string_ids']) )? array() : json_decode(stripslashes($_POST['string_ids'])); /* phpcs:ignore */ /* sanitized downstream */
36
  if ( is_array( $ids ) || is_array( $originals) ) {
37
  $trp = TRP_Translate_Press::get_trp_instance();
38
  if (!$this->trp_query) {
49
  if ( isset( $_POST['dynamic_strings'] ) && $_POST['dynamic_strings'] === 'true' ){
50
  $string_group = $localized_text['dynamicstrings'];
51
  }
52
+ $dictionary_by_original = trp_sort_dictionary_by_original( $dictionaries, 'regular', $string_group, sanitize_text_field( $_POST['language'] ) );
53
 
54
+ echo trp_safe_json_encode( $dictionary_by_original );//phpcs:ignore
55
  }
56
  }
57
  }
103
  }
104
  }
105
 
106
+ $current_language = isset( $_POST['language'] ) ? sanitize_text_field( $_POST['language'] ) : '';
107
 
108
 
109
  // necessary in order to obtain all the original strings
182
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX && current_user_can( apply_filters( 'trp_translating_capability', 'manage_options' ) ) ) {
183
  check_ajax_referer( 'save_translations', 'security' );
184
  if ( isset( $_POST['action'] ) && $_POST['action'] === 'trp_save_translations_regular' && !empty( $_POST['strings'] ) ) {
185
+ $strings = json_decode(stripslashes($_POST['strings'])); /* phpcs:ignore */ /* sanitized downstream */
186
  $this->save_translations_of_strings( $strings );
187
  }
188
  }
189
+ echo trp_safe_json_encode( array() ); // phpcs:ignore
190
  die();
191
  }
192
 
250
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX && current_user_can( apply_filters( 'trp_translating_capability', 'manage_options' ) ) ) {
251
  check_ajax_referer( 'merge_translation_block', 'security' );
252
  if ( isset( $_POST['action'] ) && $_POST['action'] === 'trp_create_translation_block' && !empty( $_POST['strings'] ) && !empty( $_POST['language'] ) && in_array( $_POST['language'], $this->settings['translation-languages'] ) && !empty( $_POST['original'] ) ) {
253
+ $strings = json_decode( stripslashes( $_POST['strings'] ) ); /* phpcs:ignore */ /* sanitized downstream */
254
 
255
  if ( isset ( $this->settings['translation-languages']) ){
256
  $trp = TRP_Translate_Press::get_trp_instance();
264
  $active_block_type = $this->trp_query->get_constant_block_type_active();
265
  foreach( $this->settings['translation-languages'] as $language ){
266
  if ( $language != $this->settings['default-language'] ){
267
+ $dictionaries = $this->get_translation_for_strings( array(), array( stripslashes( $_POST['original'] ) ), $active_block_type, array() );/* phpcs:ignore */ /* sanitized downstream */
268
  break;
269
  }
270
  }
331
  }
332
  }
333
 
334
+ echo trp_safe_json_encode( $dictionaries );//phpcs:ignore
335
  }
336
  }
337
 
352
  check_ajax_referer( 'split_translation_block', 'security' );
353
 
354
  if ( isset( $_POST['action'] ) && $_POST['action'] === 'trp_split_translation_block' && ! empty( $_POST['strings'] ) ) {
355
+ $raw_original_array = json_decode( stripslashes( $_POST['strings'] ) ); /* phpcs:ignore */ /* sanitized downstream */
356
  $trp = TRP_Translate_Press::get_trp_instance();
357
  if ( ! $this->trp_query ) {
358
  $this->trp_query = $trp->get_component( 'query' );
includes/class-elementor-language-for-blocks.php CHANGED
@@ -88,7 +88,7 @@ class TRP_Elementor {
88
  $element->start_controls_section(
89
  $this->section_name_show, array(
90
  'tab' => Controls_Manager::TAB_ADVANCED,
91
- 'label' => __( 'Restrict by Language', 'translatepress' )
92
  )
93
  );
94
 
@@ -106,7 +106,7 @@ class TRP_Elementor {
106
  $element->start_controls_section(
107
  $this->section_name_exclude, array(
108
  'tab' => Controls_Manager::TAB_ADVANCED,
109
- 'label' => __( 'Exclude from Language', 'translatepress' )
110
  )
111
  );
112
 
@@ -121,15 +121,15 @@ class TRP_Elementor {
121
 
122
  $element->add_control(
123
  'trp_language_restriction', array(
124
- 'label' => __( 'Restrict element to language', 'translatepress' ),
125
  'type' => Controls_Manager::SWITCHER,
126
- 'description' => __( 'Show this element only in one language.', 'translatepress' ),
127
  )
128
  );
129
 
130
  $element->add_control(
131
  'trp_language_restriction_heading', array(
132
- 'label' => __( 'Select language', 'translatepress' ),
133
  'type' => Controls_Manager::HEADING,
134
  'separator' => 'before',
135
  )
@@ -146,7 +146,7 @@ class TRP_Elementor {
146
  'type' => Controls_Manager::SELECT2,
147
  'options' => $published_languages,
148
  'label_block' => 'true',
149
- 'description' => __( 'Choose in which language to show this element.', 'translatepress' ),
150
  )
151
  );
152
 
@@ -158,15 +158,15 @@ class TRP_Elementor {
158
 
159
  $element->add_control(
160
  'trp_exclude_handler', array(
161
- 'label' => __( 'Exclude element from language', 'translatepress' ),
162
  'type' => Controls_Manager::SWITCHER,
163
- 'description' => __( 'Exclude this element from specific languages.', 'translatepress' ),
164
  )
165
  );
166
 
167
  $element->add_control(
168
  'trp_excluded_heading', array(
169
- 'label' => __( 'Select languages', 'translatepress' ),
170
  'type' => Controls_Manager::HEADING,
171
  'separator' => 'before',
172
  )
@@ -184,12 +184,12 @@ class TRP_Elementor {
184
  'options' => $published_languages,
185
  'multiple' => 'true',
186
  'label_block' => 'true',
187
- 'description' => __( 'Choose from which languages to exclude this element.', 'translatepress' ),
188
  )
189
  );
190
 
191
- $message = '<p>' . __( 'This element will still be visible when you are translating your website through the Translation Editor.', 'translatepress' ) . '</p>';
192
- $message .= '<p>' . __( 'The content of this element should be written in the default language.', 'translatepress' ) . '</p>';
193
 
194
  $element->add_control(
195
  'trp_excluded_message', array(
88
  $element->start_controls_section(
89
  $this->section_name_show, array(
90
  'tab' => Controls_Manager::TAB_ADVANCED,
91
+ 'label' => __( 'Restrict by Language', 'translatepress-multilingual' )
92
  )
93
  );
94
 
106
  $element->start_controls_section(
107
  $this->section_name_exclude, array(
108
  'tab' => Controls_Manager::TAB_ADVANCED,
109
+ 'label' => __( 'Exclude from Language', 'translatepress-multilingual' )
110
  )
111
  );
112
 
121
 
122
  $element->add_control(
123
  'trp_language_restriction', array(
124
+ 'label' => __( 'Restrict element to language', 'translatepress-multilingual' ),
125
  'type' => Controls_Manager::SWITCHER,
126
+ 'description' => __( 'Show this element only in one language.', 'translatepress-multilingual' ),
127
  )
128
  );
129
 
130
  $element->add_control(
131
  'trp_language_restriction_heading', array(
132
+ 'label' => __( 'Select language', 'translatepress-multilingual' ),
133
  'type' => Controls_Manager::HEADING,
134
  'separator' => 'before',
135
  )
146
  'type' => Controls_Manager::SELECT2,
147
  'options' => $published_languages,
148
  'label_block' => 'true',
149
+ 'description' => __( 'Choose in which language to show this element.', 'translatepress-multilingual' ),
150
  )
151
  );
152
 
158
 
159
  $element->add_control(
160
  'trp_exclude_handler', array(
161
+ 'label' => __( 'Exclude element from language', 'translatepress-multilingual' ),
162
  'type' => Controls_Manager::SWITCHER,
163
+ 'description' => __( 'Exclude this element from specific languages.', 'translatepress-multilingual' ),
164
  )
165
  );
166
 
167
  $element->add_control(
168
  'trp_excluded_heading', array(
169
+ 'label' => __( 'Select languages', 'translatepress-multilingual' ),
170
  'type' => Controls_Manager::HEADING,
171
  'separator' => 'before',
172
  )
184
  'options' => $published_languages,
185
  'multiple' => 'true',
186
  'label_block' => 'true',
187
+ 'description' => __( 'Choose from which languages to exclude this element.', 'translatepress-multilingual' ),
188
  )
189
  );
190
 
191
+ $message = '<p>' . __( 'This element will still be visible when you are translating your website through the Translation Editor.', 'translatepress-multilingual' ) . '</p>';
192
+ $message .= '<p>' . __( 'The content of this element should be written in the default language.', 'translatepress-multilingual' ) . '</p>';
193
 
194
  $element->add_control(
195
  'trp_excluded_message', array(
includes/class-error-manager.php CHANGED
@@ -118,7 +118,7 @@ class TRP_Error_Manager{
118
 
119
  public function disable_error_after_click_link(){
120
 
121
- $link = $_GET['page'];
122
 
123
  if($link = 'trp_error_manager') {
124
  $this->clear_notification_from_db('disable_automatic_translations', null);
118
 
119
  public function disable_error_after_click_link(){
120
 
121
+ $link = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '';
122
 
123
  if($link = 'trp_error_manager') {
124
  $this->clear_notification_from_db('disable_automatic_translations', null);
includes/class-install-plugins.php CHANGED
@@ -35,7 +35,7 @@ class TRP_Install_Plugins {
35
  }else{
36
  $message = wp_kses( sprintf( __('Could not install. Try again from <a href="%s" >Plugins Dashboard.</a>', 'translatepress-multilingual'), admin_url('plugins.php') ), array('a' => array( 'href' => array() ) ) );
37
  }
38
- wp_die( trp_safe_json_encode( $message ));
39
  }
40
  }
41
  }
35
  }else{
36
  $message = wp_kses( sprintf( __('Could not install. Try again from <a href="%s" >Plugins Dashboard.</a>', 'translatepress-multilingual'), admin_url('plugins.php') ), array('a' => array( 'href' => array() ) ) );
37
  }
38
+ wp_die( trp_safe_json_encode( $message ));//phpcs:ignore
39
  }
40
  }
41
  }
includes/class-language-switcher.php CHANGED
@@ -283,7 +283,7 @@ class TRP_Language_Switcher{
283
  <div id="trp-floater-ls" onclick="" data-no-translation class="trp-language-switcher-container <?php echo esc_attr( $floater_class ); ?>" <?php echo ( isset( $_GET['trp-edit-translation'] ) && $_GET['trp-edit-translation'] == 'preview' ) ? 'data-trp-unpreviewable="trp-unpreviewable"' : '' ?>>
284
  <div id="trp-floater-ls-current-language" class="<?php echo esc_attr( $floater_flags_class ); ?>">
285
  <a href="#" class="trp-floater-ls-disabled-language trp-ls-disabled-language" onclick="event.preventDefault()">
286
- <?php echo ( $floater_settings['flags'] ? $this->add_flag( $current_language['code'], $current_language['name'] ) : '' ); // WPCS: ok.
287
  echo esc_html( $current_language_label ); ?>
288
  </a>
289
  </div>
@@ -302,9 +302,9 @@ class TRP_Language_Switcher{
302
 
303
  $floater_position = 'bottom';
304
  if ( !empty( $this->settings['floater-position'] ) && strpos( $this->settings['floater-position'], 'top' ) !== false ){
305
- echo $powered_by;
306
  echo '<div class="trp-language-wrap">';
307
- echo $disabled_language;
308
  $floater_position = 'top';
309
  }
310
 
@@ -327,7 +327,7 @@ class TRP_Language_Switcher{
327
  <a href="<?php echo esc_url( $this->url_converter->get_url_for_language($code, false) ); ?>"
328
  <?php echo ( isset( $_GET['trp-edit-translation'] ) && $_GET['trp-edit-translation'] == 'preview' ) ? 'data-trp-unpreviewable="trp-unpreviewable"' : '' ?> title="<?php echo esc_attr( $name ); ?>">
329
  <?php
330
- echo ( $floater_settings['flags'] ? $this->add_flag( $code, $name ) : '' ); // WPCS: ok.
331
  echo esc_html( $language_label );
332
  ?>
333
  </a>
@@ -339,9 +339,9 @@ class TRP_Language_Switcher{
339
  }
340
 
341
  if ( $floater_position == 'bottom' ){
342
- echo $disabled_language;
343
  echo '</div>';
344
- echo $powered_by;
345
  }
346
  ?>
347
  </div>
@@ -349,7 +349,7 @@ class TRP_Language_Switcher{
349
 
350
  <?php
351
  $floating_ls_html = ob_get_clean();
352
- echo apply_filters( 'trp_floating_ls_html', $floating_ls_html );
353
  }
354
 
355
  /**
283
  <div id="trp-floater-ls" onclick="" data-no-translation class="trp-language-switcher-container <?php echo esc_attr( $floater_class ); ?>" <?php echo ( isset( $_GET['trp-edit-translation'] ) && $_GET['trp-edit-translation'] == 'preview' ) ? 'data-trp-unpreviewable="trp-unpreviewable"' : '' ?>>
284
  <div id="trp-floater-ls-current-language" class="<?php echo esc_attr( $floater_flags_class ); ?>">
285
  <a href="#" class="trp-floater-ls-disabled-language trp-ls-disabled-language" onclick="event.preventDefault()">
286
+ <?php echo ( $floater_settings['flags'] ? $this->add_flag( $current_language['code'], $current_language['name'] ) : '' ); // phpcs:ignore
287
  echo esc_html( $current_language_label ); ?>
288
  </a>
289
  </div>
302
 
303
  $floater_position = 'bottom';
304
  if ( !empty( $this->settings['floater-position'] ) && strpos( $this->settings['floater-position'], 'top' ) !== false ){
305
+ echo $powered_by; // phpcs:ignore
306
  echo '<div class="trp-language-wrap">';
307
+ echo $disabled_language; // phpcs:ignore
308
  $floater_position = 'top';
309
  }
310
 
327
  <a href="<?php echo esc_url( $this->url_converter->get_url_for_language($code, false) ); ?>"
328
  <?php echo ( isset( $_GET['trp-edit-translation'] ) && $_GET['trp-edit-translation'] == 'preview' ) ? 'data-trp-unpreviewable="trp-unpreviewable"' : '' ?> title="<?php echo esc_attr( $name ); ?>">
329
  <?php
330
+ echo ( $floater_settings['flags'] ? $this->add_flag( $code, $name ) : '' ); // phpcs:ignore
331
  echo esc_html( $language_label );
332
  ?>
333
  </a>
339
  }
340
 
341
  if ( $floater_position == 'bottom' ){
342
+ echo $disabled_language; // phpcs:ignore
343
  echo '</div>';
344
+ echo $powered_by; // phpcs:ignore
345
  }
346
  ?>
347
  </div>
349
 
350
  <?php
351
  $floating_ls_html = ob_get_clean();
352
+ echo apply_filters( 'trp_floating_ls_html', $floating_ls_html ); // phpcs:ignore
353
  }
354
 
355
  /**
includes/class-languages.php CHANGED
@@ -197,8 +197,9 @@ class TRP_Languages{
197
  * @return string Short language name.
198
  */
199
  public function beautify_language_name( $name, $code, $english_or_native, $language_codes ){
 
200
  if ( $english_or_native == 'english_name' ) {
201
- if ( ! $this->duplicated_language( $code, $language_codes ) ){
202
  $name = $this->string_trim_after_character( $name, " (" );
203
  }
204
  }
197
  * @return string Short language name.
198
  */
199
  public function beautify_language_name( $name, $code, $english_or_native, $language_codes ){
200
+ $wp_lang = $this->get_wp_languages();
201
  if ( $english_or_native == 'english_name' ) {
202
+ if ( ! $this->duplicated_language( $code, $language_codes) && (!isset($wp_lang[$code]['is_custom_language']) || (isset($wp_lang[$code]['is_custom_language']) && $wp_lang[$code]['is_custom_language'] !== true))){
203
  $name = $this->string_trim_after_character( $name, " (" );
204
  }
205
  }
includes/class-machine-translation-tab.php CHANGED
@@ -164,13 +164,13 @@ class TRP_Machine_Translation_Tab {
164
  <?php
165
  foreach ( $this->settings['translation-languages'] as $language_code ) {
166
  if ( !$machine_translator->check_languages_availability( array( $language_code ) ) ) {
167
- echo '<li>' . $language_names[$language_code] . '</li>';
168
  }
169
  }
170
  ?>
171
  </ul>
172
- <a href="<?php echo esc_url( admin_url( 'admin.php?page=trp_machine_translation&trp_recheck_supported_languages=1&trp_recheck_supported_languages_nonce=' . wp_create_nonce('trp_recheck_supported_languages') ) ); ?>" class="button-secondary"><?php _e( 'Recheck supported languages', 'translatepress-multilingual' ); ?></a>
173
- <p><i><?php echo sprintf( __( '(last checked on %s)', 'translatepress-multilingual' ), esc_html( $machine_translator->get_last_checked_supported_languages() ) ); ?> </i></p>
174
  <p class="description">
175
  <?php echo wp_kses( __( 'The selected automatic translation engine does not provide support for these languages.<br>You can still manually translate pages in these languages using the Translation Editor.', 'translatepress-multilingual' ), array( 'br' => array() ) ); ?>
176
  </p>
164
  <?php
165
  foreach ( $this->settings['translation-languages'] as $language_code ) {
166
  if ( !$machine_translator->check_languages_availability( array( $language_code ) ) ) {
167
+ echo '<li>' . esc_html( $language_names[$language_code] ) . '</li>';
168
  }
169
  }
170
  ?>
171
  </ul>
172
+ <a href="<?php echo esc_url( admin_url( 'admin.php?page=trp_machine_translation&trp_recheck_supported_languages=1&trp_recheck_supported_languages_nonce=' . wp_create_nonce('trp_recheck_supported_languages') ) ); ?>" class="button-secondary"><?php esc_html_e( 'Recheck supported languages', 'translatepress-multilingual' ); ?></a>
173
+ <p><i><?php echo wp_kses_post( sprintf( __( '(last checked on %s)', 'translatepress-multilingual' ), esc_html( $machine_translator->get_last_checked_supported_languages() ) ) ); ?> </i></p>
174
  <p class="description">
175
  <?php echo wp_kses( __( 'The selected automatic translation engine does not provide support for these languages.<br>You can still manually translate pages in these languages using the Translation Editor.', 'translatepress-multilingual' ), array( 'br' => array() ) ); ?>
176
  </p>
includes/class-machine-translator.php CHANGED
@@ -59,7 +59,7 @@ class TRP_Machine_Translator {
59
  }
60
  $force_recheck = ( current_user_can('manage_options') &&
61
  !empty( $_GET['trp_recheck_supported_languages']) && $_GET['trp_recheck_supported_languages'] === '1' &&
62
- wp_verify_nonce( $_GET['trp_recheck_supported_languages_nonce'], 'trp_recheck_supported_languages' ) ) ? true : $force_recheck;
63
  $data = get_option('trp_db_stored_data', array() );
64
  if ( isset( $_GET['trp_recheck_supported_languages'] )) {
65
  unset($_GET['trp_recheck_supported_languages'] );
@@ -282,7 +282,7 @@ class TRP_Machine_Translator {
282
 
283
  $crawlers = apply_filters( 'trp_machine_translator_crawlers', 'rambler|abacho|acoi|accona|aspseek|altavista|estyle|scrubby|lycos|geona|ia_archiver|alexa|sogou|skype|facebook|twitter|pinterest|linkedin|naver|bing|google|yahoo|duckduckgo|yandex|baidu|teoma|xing|java\/1.7.0_45|bot|crawl|slurp|spider|mediapartners|\sask\s|\saol\s' );
284
 
285
- return preg_match( '/'. $crawlers .'/i', $_SERVER['HTTP_USER_AGENT'] );
286
  }
287
 
288
  private function get_placeholders( $count ){
59
  }
60
  $force_recheck = ( current_user_can('manage_options') &&
61
  !empty( $_GET['trp_recheck_supported_languages']) && $_GET['trp_recheck_supported_languages'] === '1' &&
62
+ wp_verify_nonce( sanitize_text_field( $_GET['trp_recheck_supported_languages_nonce'] ), 'trp_recheck_supported_languages' ) ) ? true : $force_recheck; //phpcs:ignore
63
  $data = get_option('trp_db_stored_data', array() );
64
  if ( isset( $_GET['trp_recheck_supported_languages'] )) {
65
  unset($_GET['trp_recheck_supported_languages'] );
282
 
283
  $crawlers = apply_filters( 'trp_machine_translator_crawlers', 'rambler|abacho|acoi|accona|aspseek|altavista|estyle|scrubby|lycos|geona|ia_archiver|alexa|sogou|skype|facebook|twitter|pinterest|linkedin|naver|bing|google|yahoo|duckduckgo|yandex|baidu|teoma|xing|java\/1.7.0_45|bot|crawl|slurp|spider|mediapartners|\sask\s|\saol\s' );
284
 
285
+ return preg_match( '/'. $crawlers .'/i', sanitize_text_field ( $_SERVER['HTTP_USER_AGENT'] ) );
286
  }
287
 
288
  private function get_placeholders( $count ){
includes/class-plugin-notices.php CHANGED
@@ -43,7 +43,7 @@ class TRP_Add_General_Notices{
43
  // Check that the user hasn't already clicked to ignore the message
44
  if ( ! get_user_meta($user_id, $this->notificationId.'_dismiss_notification' ) || $this->force_show ) {//ignore the dismissal if we have force_show
45
  add_filter('safe_style_css', array( $this, 'allow_z_index_in_wp_kses'));
46
- echo $finalMessage = wp_kses( apply_filters($this->notificationId.'_notification_message','<div class="'. $this->notificationClass .'" style="position:relative;' . ((strpos($this->notificationClass, 'trp-narrow')!==false ) ? 'max-width: 825px;' : '') . '" >'.$this->notificationMessage.'</div>', $this->notificationMessage), [ 'div' => [ 'class' => [],'style' => [] ], 'p' => ['style' => [], 'class' => []], 'a' => ['href' => [], 'type'=> [], 'class'=> [], 'style'=>[], 'title'=>[],'target'=>[]], 'span' => ['class'=> []], 'strong' => [] ] );
47
  remove_filter('safe_style_css', array( $this, 'allow_z_index_in_wp_kses'));
48
  }
49
  do_action( $this->notificationId.'_notification_displayed', $current_user, $pagenow );
@@ -297,10 +297,10 @@ Class TRP_Plugin_Notifications {
297
  public function is_plugin_page() {
298
  if( !empty( $this->pluginPages ) ){
299
  foreach ( $this->pluginPages as $pluginPage ){
300
- if( ! empty( $_GET['page'] ) && false !== strpos( $_GET['page'], $pluginPage ) )
301
  return true;
302
 
303
- if( ! empty( $_GET['post_type'] ) && false !== strpos( $_GET['post_type'], $pluginPage ) )
304
  return true;
305
 
306
  if( ! empty( $_GET['post'] ) && false !== strpos( get_post_type( (int)$_GET['post'] ), $pluginPage ) )
43
  // Check that the user hasn't already clicked to ignore the message
44
  if ( ! get_user_meta($user_id, $this->notificationId.'_dismiss_notification' ) || $this->force_show ) {//ignore the dismissal if we have force_show
45
  add_filter('safe_style_css', array( $this, 'allow_z_index_in_wp_kses'));
46
+ echo wp_kses( apply_filters($this->notificationId.'_notification_message','<div class="'. $this->notificationClass .'" style="position:relative;' . ((strpos($this->notificationClass, 'trp-narrow')!==false ) ? 'max-width: 825px;' : '') . '" >'.$this->notificationMessage.'</div>', $this->notificationMessage), [ 'div' => [ 'class' => [],'style' => [] ], 'p' => ['style' => [], 'class' => []], 'a' => ['href' => [], 'type'=> [], 'class'=> [], 'style'=>[], 'title'=>[],'target'=>[]], 'span' => ['class'=> []], 'strong' => [] ] );
47
  remove_filter('safe_style_css', array( $this, 'allow_z_index_in_wp_kses'));
48
  }
49
  do_action( $this->notificationId.'_notification_displayed', $current_user, $pagenow );
297
  public function is_plugin_page() {
298
  if( !empty( $this->pluginPages ) ){
299
  foreach ( $this->pluginPages as $pluginPage ){
300
+ if( ! empty( $_GET['page'] ) && false !== strpos( sanitize_text_field( $_GET['page'] ), $pluginPage ) )
301
  return true;
302
 
303
+ if( ! empty( $_GET['post_type'] ) && false !== strpos( sanitize_text_field( $_GET['post_type'] ), $pluginPage ) )
304
  return true;
305
 
306
  if( ! empty( $_GET['post'] ) && false !== strpos( get_post_type( (int)$_GET['post'] ), $pluginPage ) )
includes/class-settings.php CHANGED
@@ -53,7 +53,7 @@ class TRP_Settings{
53
  }
54
  $output .= '</select>';
55
 
56
- echo $output;
57
  }
58
 
59
  /**
@@ -77,7 +77,7 @@ class TRP_Settings{
77
  }
78
  $output .= '</select>';
79
 
80
- echo $output;
81
  }
82
 
83
  /**
@@ -98,7 +98,7 @@ class TRP_Settings{
98
  }
99
  $output .= '</select>';
100
 
101
- echo $output;
102
  }
103
 
104
  /**
@@ -542,7 +542,7 @@ class TRP_Settings{
542
 
543
  $active_tab = 'translate-press';
544
  if ( isset( $_GET['page'] ) ){
545
- $active_tab = esc_attr( wp_unslash( $_GET['page'] ) );
546
  }
547
 
548
  require TRP_PLUGIN_DIR . 'partials/settings-navigation-tabs.php';
53
  }
54
  $output .= '</select>';
55
 
56
+ echo $output;/* phpcs:ignore */ /* escaped above */
57
  }
58
 
59
  /**
77
  }
78
  $output .= '</select>';
79
 
80
+ echo $output; /* phpcs:ignore */ /* escaped above */
81
  }
82
 
83
  /**
98
  }
99
  $output .= '</select>';
100
 
101
+ echo $output; /* phpcs:ignore */ /* escaped above */
102
  }
103
 
104
  /**
542
 
543
  $active_tab = 'translate-press';
544
  if ( isset( $_GET['page'] ) ){
545
+ $active_tab = sanitize_text_field( wp_unslash( $_GET['page'] ) );
546
  }
547
 
548
  require TRP_PLUGIN_DIR . 'partials/settings-navigation-tabs.php';
includes/class-translation-manager.php CHANGED
@@ -38,15 +38,15 @@ class TRP_Translation_Manager
38
  */
39
  protected function conditions_met($mode = 'true')
40
  {
41
- if (isset($_REQUEST['trp-edit-translation']) && esc_attr($_REQUEST['trp-edit-translation']) == $mode) {
42
  if (current_user_can(apply_filters('trp_translating_capability', 'manage_options')) && !is_admin()) {
43
  return true;
44
- } elseif (esc_attr($_REQUEST['trp-edit-translation']) == "preview") {
45
  return true;
46
  } else {
47
  wp_die(
48
- '<h1>' . esc_html__('Cheatin&#8217; uh?') . '</h1>' .
49
- '<p>' . esc_html__('Sorry, you are not allowed to access this page.') . '</p>',
50
  403
51
  );
52
  }
@@ -211,7 +211,7 @@ class TRP_Translation_Manager
211
  if (defined('DOING_AJAX') && DOING_AJAX && current_user_can(apply_filters('trp_translating_capability', 'manage_options'))) {
212
  check_ajax_referer('trp_editor_user_meta', 'security');
213
  if (isset($_POST['action']) && $_POST['action'] === 'trp_save_editor_user_meta' && !empty($_POST['user_meta'])) {
214
- $submitted_user_meta = json_decode(stripslashes($_POST['user_meta']), true);
215
  $existing_user_meta = $this->get_editor_user_meta();
216
  foreach ($existing_user_meta as $key => $existing) {
217
  if (isset($submitted_user_meta[$key])) {
@@ -221,7 +221,7 @@ class TRP_Translation_Manager
221
  update_user_meta(get_current_user_id(), 'trp_editor_user_meta', $existing_user_meta);
222
  }
223
  }
224
- echo trp_safe_json_encode(array());
225
  die();
226
  }
227
 
@@ -670,7 +670,7 @@ class TRP_Translation_Manager
670
  {
671
 
672
  /* for our own actions return false */
673
- if (isset($_REQUEST['action']) && strpos($_REQUEST['action'], 'trp_') === 0)
674
  return false;
675
 
676
  $trp = TRP_Translate_Press::get_trp_instance();
@@ -720,7 +720,7 @@ class TRP_Translation_Manager
720
  {
721
 
722
  /* for our own actions don't do nothing */
723
- if (isset($_REQUEST['action']) && strpos($_REQUEST['action'], 'trp_') === 0)
724
  return;
725
 
726
  /* if the request came from preview mode make sure to keep it */
@@ -777,7 +777,7 @@ class TRP_Translation_Manager
777
  return $translation;
778
 
779
  /* for our own actions don't do nothing */
780
- if (isset($_REQUEST['action']) && strpos($_REQUEST['action'], 'trp_') === 0)
781
  return $translation;
782
 
783
  /* get_locale() returns WP Settings Language (WPLANG). It might not be a language in TP so it may not have a TP table. */
@@ -1264,7 +1264,7 @@ class TRP_Translation_Manager
1264
  }
1265
 
1266
  if ($current_user_can_change_roles) {
1267
- if (!wp_verify_nonce($_REQUEST['trp-view-as-nonce'], 'trp_view_as' . sanitize_text_field($_REQUEST['trp-view-as']) . get_current_user_id())) {
1268
  wp_die(esc_html__('Security check', 'translatepress-multilingual'));
1269
  } else {
1270
  global $current_user;
38
  */
39
  protected function conditions_met($mode = 'true')
40
  {
41
+ if (isset($_REQUEST['trp-edit-translation']) && sanitize_text_field($_REQUEST['trp-edit-translation']) == $mode) {
42
  if (current_user_can(apply_filters('trp_translating_capability', 'manage_options')) && !is_admin()) {
43
  return true;
44
+ } elseif (sanitize_text_field($_REQUEST['trp-edit-translation']) == "preview") {
45
  return true;
46
  } else {
47
  wp_die(
48
+ '<h1>' . esc_html__('Cheatin&#8217; uh?') . '</h1>' . //phpcs:ignore WordPress.WP.I18n.MissingArgDomain
49
+ '<p>' . esc_html__('Sorry, you are not allowed to access this page.') . '</p>', //phpcs:ignore WordPress.WP.I18n.MissingArgDomain
50
  403
51
  );
52
  }
211
  if (defined('DOING_AJAX') && DOING_AJAX && current_user_can(apply_filters('trp_translating_capability', 'manage_options'))) {
212
  check_ajax_referer('trp_editor_user_meta', 'security');
213
  if (isset($_POST['action']) && $_POST['action'] === 'trp_save_editor_user_meta' && !empty($_POST['user_meta'])) {
214
+ $submitted_user_meta = json_decode(stripslashes($_POST['user_meta']), true); /* phpcs:ignore */ /* sanitized bellow */
215
  $existing_user_meta = $this->get_editor_user_meta();
216
  foreach ($existing_user_meta as $key => $existing) {
217
  if (isset($submitted_user_meta[$key])) {
221
  update_user_meta(get_current_user_id(), 'trp_editor_user_meta', $existing_user_meta);
222
  }
223
  }
224
+ echo trp_safe_json_encode(array());//phpcs:ignore
225
  die();
226
  }
227
 
670
  {
671
 
672
  /* for our own actions return false */
673
+ if (isset($_REQUEST['action']) && strpos( sanitize_text_field( $_REQUEST['action'] ), 'trp_') === 0)
674
  return false;
675
 
676
  $trp = TRP_Translate_Press::get_trp_instance();
720
  {
721
 
722
  /* for our own actions don't do nothing */
723
+ if ( isset($_REQUEST['action']) && strpos( sanitize_text_field( $_REQUEST['action'] ), 'trp_') === 0 )
724
  return;
725
 
726
  /* if the request came from preview mode make sure to keep it */
777
  return $translation;
778
 
779
  /* for our own actions don't do nothing */
780
+ if (isset($_REQUEST['action']) && strpos( sanitize_text_field( $_REQUEST['action'] ), 'trp_') === 0)
781
  return $translation;
782
 
783
  /* get_locale() returns WP Settings Language (WPLANG). It might not be a language in TP so it may not have a TP table. */
1264
  }
1265
 
1266
  if ($current_user_can_change_roles) {
1267
+ if (!wp_verify_nonce( sanitize_text_field($_REQUEST['trp-view-as-nonce'] ), 'trp_view_as' . sanitize_text_field($_REQUEST['trp-view-as']) . get_current_user_id())) {
1268
  wp_die(esc_html__('Security check', 'translatepress-multilingual'));
1269
  } else {
1270
  global $current_user;
includes/class-translation-memory.php CHANGED
@@ -59,8 +59,8 @@ class TRP_Translation_Memory {
59
  {
60
  global $TRP_LANGUAGE;
61
  check_ajax_referer('getsimilarstring', 'security');
62
- $string = ( isset($_POST['original_string']) ) ? $_POST['original_string'] : '';
63
- $language_code = ( isset($_POST['language']) ) ? $_POST['language'] : $TRP_LANGUAGE;
64
  $selector = ( isset($_POST['selector']) ) ? sanitize_text_field( $_POST['selector'] ) : '';
65
  $number = ( isset($_POST['number']) ) ? (int) $_POST['number'] : 3;
66
 
59
  {
60
  global $TRP_LANGUAGE;
61
  check_ajax_referer('getsimilarstring', 'security');
62
+ $string = ( isset($_POST['original_string']) ) ? $_POST['original_string'] : '';//phpcs:ignore
63
+ $language_code = ( isset($_POST['language']) ) ? sanitize_text_field( $_POST['language'] ) : $TRP_LANGUAGE;
64
  $selector = ( isset($_POST['selector']) ) ? sanitize_text_field( $_POST['selector'] ) : '';
65
  $number = ( isset($_POST['number']) ) ? (int) $_POST['number'] : 3;
66
 
includes/class-translation-render.php CHANGED
@@ -408,7 +408,7 @@ class TRP_Translation_Render{
408
  */
409
  if( $json_array && $json_array != $output ) {
410
  /* if it's one of our own ajax calls don't do nothing */
411
- if ( ! empty( $_REQUEST['action'] ) && strpos( $_REQUEST['action'], 'trp_' ) === 0 && $_REQUEST['action'] != 'trp_split_translation_block' )
412
  return $output;
413
 
414
  //check if we have a json response
@@ -1096,7 +1096,7 @@ class TRP_Translation_Render{
1096
  */
1097
  if( $json_array && $json_array != $output ) {
1098
  /* if it's one of our own ajax calls don't do nothing */
1099
- if ( ! empty( $_REQUEST['action'] ) && strpos( $_REQUEST['action'], 'trp_' ) === 0 && $_REQUEST['action'] != 'trp_split_translation_block' ) {
1100
  return $output;
1101
  }
1102
 
@@ -1596,7 +1596,7 @@ class TRP_Translation_Render{
1596
  */
1597
  public function force_language_on_form_url_redirect( $location, $status ){
1598
  if( isset( $_REQUEST[ 'trp-form-language' ] ) && !empty($_REQUEST[ 'trp-form-language' ]) ){
1599
- $form_language_slug = esc_attr($_REQUEST[ 'trp-form-language' ]);
1600
  $form_language = array_search($form_language_slug, $this->settings['url-slugs']);
1601
  if ( ! $this->url_converter ) {
1602
  $trp = TRP_Translate_Press::get_trp_instance();
@@ -1668,7 +1668,7 @@ class TRP_Translation_Render{
1668
  */
1669
  function callback_add_language_to_url(&$item, $key){
1670
  if ( filter_var($item, FILTER_VALIDATE_URL) !== FALSE ) {
1671
- $form_language_slug = esc_attr($_REQUEST[ 'trp-form-language' ]);
1672
  $form_language = array_search($form_language_slug, $this->settings['url-slugs']);
1673
  if ( ! $this->url_converter ) {
1674
  $trp = TRP_Translate_Press::get_trp_instance();
408
  */
409
  if( $json_array && $json_array != $output ) {
410
  /* if it's one of our own ajax calls don't do nothing */
411
+ if ( ! empty( $_REQUEST['action'] ) && strpos( sanitize_text_field( $_REQUEST['action'] ), 'trp_' ) === 0 && $_REQUEST['action'] != 'trp_split_translation_block' )
412
  return $output;
413
 
414
  //check if we have a json response
1096
  */
1097
  if( $json_array && $json_array != $output ) {
1098
  /* if it's one of our own ajax calls don't do nothing */
1099
+ if ( ! empty( $_REQUEST['action'] ) && strpos( sanitize_text_field( $_REQUEST['action'] ), 'trp_' ) === 0 && $_REQUEST['action'] != 'trp_split_translation_block' ) {
1100
  return $output;
1101
  }
1102
 
1596
  */
1597
  public function force_language_on_form_url_redirect( $location, $status ){
1598
  if( isset( $_REQUEST[ 'trp-form-language' ] ) && !empty($_REQUEST[ 'trp-form-language' ]) ){
1599
+ $form_language_slug = sanitize_text_field($_REQUEST[ 'trp-form-language' ]);
1600
  $form_language = array_search($form_language_slug, $this->settings['url-slugs']);
1601
  if ( ! $this->url_converter ) {
1602
  $trp = TRP_Translate_Press::get_trp_instance();
1668
  */
1669
  function callback_add_language_to_url(&$item, $key){
1670
  if ( filter_var($item, FILTER_VALIDATE_URL) !== FALSE ) {
1671
+ $form_language_slug = isset( $_REQUEST[ 'trp-form-language' ] ) ? sanitize_text_field($_REQUEST[ 'trp-form-language' ]) : '';
1672
  $form_language = array_search($form_language_slug, $this->settings['url-slugs']);
1673
  if ( ! $this->url_converter ) {
1674
  $trp = TRP_Translate_Press::get_trp_instance();
includes/class-upgrade.php CHANGED
@@ -185,7 +185,7 @@ class TRP_Upgrade {
185
  $html .= '<p><strong>' . esc_html__( 'TranslatePress data update', 'translatepress-multilingual' ) . '</strong> &#8211; ' . esc_html__( 'We need to update your translations database to the latest version.', 'translatepress-multilingual' ) . '</p>';
186
  $html .= '<p class="submit"><a href="' . esc_url( $url ) . '" onclick="return confirm( \'' . __( 'IMPORTANT: It is strongly recommended to first backup the database!\nAre you sure you want to continue?', 'translatepress-multilingual' ) . '\');" class="button-primary">' . esc_html__( 'Run the updater', 'translatepress-multilingual' ) . '</a></p>';
187
  $html .= '</div>';
188
- echo $html;
189
  }
190
 
191
  public function trp_update_database_page(){
@@ -202,7 +202,7 @@ class TRP_Upgrade {
202
  $this->stop_and_print_error( __('Update aborted! Your user account doesn\'t have the capability to perform database updates.', 'translatepress-multilingual' ) );
203
  }
204
 
205
- $nonce = wp_verify_nonce( $_REQUEST['trp_updb_nonce'], 'tpupdatedatabase' );
206
  if ( $nonce === false ){
207
  $this->stop_and_print_error( __('Update aborted! Invalid nonce.', 'translatepress-multilingual' ) );
208
  }
@@ -219,7 +219,7 @@ class TRP_Upgrade {
219
  }
220
  }
221
  if ( empty ( $_REQUEST['trp_updb_action'] ) ){
222
- $back_to_settings_button = '<p><a href="' . site_url('wp-admin/options-general.php?page=translate-press') . '"> <input type="button" value="' . __('Back to TranslatePress Settings', 'translatepress-multilingual' ) . '" class="button-primary"></a></p>';
223
  // finished successfully
224
  echo json_encode( array(
225
  'trp_update_completed' => 'yes',
@@ -231,26 +231,26 @@ class TRP_Upgrade {
231
  $_REQUEST['trp_updb_batch'] = 0;
232
 
233
  $update_message_initial = isset( $updates_needed[$_REQUEST['trp_updb_action']]['message_initial'] ) ?
234
- $updates_needed[$_REQUEST['trp_updb_action']]['message_initial']
235
  : __('Updating database to version %s+', 'translatepress-multilingual' );
236
 
237
  $update_message_processing = isset( $updates_needed[$_REQUEST['trp_updb_action']]['message_processing'] ) ?
238
- $updates_needed[$_REQUEST['trp_updb_action']]['message_processing']
239
  : __('Processing table for language %s...', 'translatepress-multilingual' );
240
 
241
- $request['progress_message'] .= '<p>' . sprintf( $update_message_initial, $updates_needed[ $_REQUEST['trp_updb_action'] ]['version'] ) . '</p>';
242
- $request['progress_message'] .= sprintf( $update_message_processing, $_REQUEST['trp_updb_lang'] );
243
  }
244
  }else{
245
  if ( !isset( $updates_needed[ $_REQUEST['trp_updb_action'] ] ) ){
246
  $this->stop_and_print_error( __('Update aborted! Incorrect action.', 'translatepress-multilingual' ) );
247
  }
248
- if ( !in_array( $_REQUEST['trp_updb_lang'], $this->settings['translation-languages'] ) ) {
249
  $this->stop_and_print_error( __('Update aborted! Incorrect language code.', 'translatepress-multilingual' ) );
250
  }
251
  }
252
 
253
- $request['trp_updb_action'] = $_REQUEST['trp_updb_action'];
254
  if ( !empty( $_REQUEST['trp_updb_batch'] ) && (int) $_REQUEST['trp_updb_batch'] > 0 ) {
255
  $get_batch = (int)$_REQUEST['trp_updb_batch'];
256
  }else{
@@ -258,9 +258,9 @@ class TRP_Upgrade {
258
  }
259
 
260
  $request['trp_updb_batch'] = 0;
261
- $update_details = $updates_needed[$_REQUEST['trp_updb_action']];
262
- $batch_size = apply_filters( 'trp_updb_batch_size', $update_details['batch_size'], $_REQUEST['trp_updb_action'], $update_details );
263
- $language_code = $_REQUEST['trp_updb_lang'];
264
 
265
  if ( ! $this->trp_query ) {
266
  $trp = TRP_Translate_Press::get_trp_instance();
@@ -295,7 +295,7 @@ class TRP_Upgrade {
295
  $request['trp_updb_lang'] = $this->settings['translation-languages'][ $index + 1 ];
296
  $request['progress_message'] .= __(' done.', 'translatepress-multilingual' ) . '</br>';
297
  $update_message_processing = isset( $updates_needed[$_REQUEST['trp_updb_action']]['message_processing'] ) ?
298
- $updates_needed[$_REQUEST['trp_updb_action']]['message_processing']
299
  : __('Processing table for language %s...', 'translatepress-multilingual' );
300
  $request['progress_message'] .= '</br>' . sprintf( $update_message_processing, $request['trp_updb_lang'] );
301
  } else {
@@ -481,7 +481,7 @@ class TRP_Upgrade {
481
  echo esc_html__('Done.', 'translatepress-multilingual' ) . '<br><br><a href="' . esc_url( site_url('wp-admin/admin.php?page=trp_advanced_page') ) . '"> <input type="button" value="' . esc_attr__('Back to TranslatePress Settings', 'translatepress-multilingual' ) . '" class="button-primary"></a>';
482
  return;
483
  }
484
- $nonce = wp_verify_nonce( $_GET['trp_rm_nonce'], 'tpremoveduplicaterows' );
485
  if ( $nonce === false ){
486
  echo esc_html__('Invalid nonce.', 'translatepress-multilingual' ) . '<br><br><a href="' . esc_url( site_url('wp-admin/admin.php?page=trp_advanced_page') ) . '"> <input type="button" value="' . esc_attr__('Back to TranslatePress Settings', 'translatepress-multilingual' ) . '" class="button-primary"></a>';
487
  return;
@@ -489,7 +489,7 @@ class TRP_Upgrade {
489
 
490
  $next_get_batch = 1;
491
  $batch_size = apply_filters( 'trp_rm_duplicate_batch_size', 10000 );
492
- if ( !empty( $_GET['trp_rm_batch_size'] ) && (int) $_GET['trp_rm_batch'] > 0 ){
493
  $batch_size = (int) $_GET['trp_rm_batch_size'];
494
  }
495
  if ( in_array( sanitize_text_field( $_GET['trp_rm_duplicates'] ), $this->settings['translation-languages'] ) ) {
@@ -507,7 +507,7 @@ class TRP_Upgrade {
507
  else if (isset($_GET['trp_rm_duplicates_gettext']) )
508
  $table_name = $this->trp_query->get_gettext_table_name( $language_code );
509
 
510
- echo '<div>' . sprintf( wp_kses( __( 'Querying table <strong>%s</strong>', 'translatepress-multilingual' ), [ 'strong' => [] ] ), $table_name ) . '</div>';
511
 
512
  $last_id = $this->trp_query->get_last_id( $table_name );
513
  if ( !empty( $_GET['trp_rm_batch'] ) && (int) $_GET['trp_rm_batch'] > 0 ) {
@@ -549,7 +549,7 @@ class TRP_Upgrade {
549
  return;
550
  }else{
551
  $result = $result1 + $result2;
552
- echo '<div>' . sprintf( esc_html__( '%s duplicates removed', 'translatepress-multilingual' ), $result ) . '</div>';
553
  }
554
  }
555
  if ( $next_get_batch == 1 ) {
185
  $html .= '<p><strong>' . esc_html__( 'TranslatePress data update', 'translatepress-multilingual' ) . '</strong> &#8211; ' . esc_html__( 'We need to update your translations database to the latest version.', 'translatepress-multilingual' ) . '</p>';
186
  $html .= '<p class="submit"><a href="' . esc_url( $url ) . '" onclick="return confirm( \'' . __( 'IMPORTANT: It is strongly recommended to first backup the database!\nAre you sure you want to continue?', 'translatepress-multilingual' ) . '\');" class="button-primary">' . esc_html__( 'Run the updater', 'translatepress-multilingual' ) . '</a></p>';
187
  $html .= '</div>';
188
+ echo $html;//phpcs:ignore
189
  }
190
 
191
  public function trp_update_database_page(){
202
  $this->stop_and_print_error( __('Update aborted! Your user account doesn\'t have the capability to perform database updates.', 'translatepress-multilingual' ) );
203
  }
204
 
205
+ $nonce = isset( $_REQUEST['trp_updb_nonce'] ) ? wp_verify_nonce( sanitize_text_field( $_REQUEST['trp_updb_nonce'] ), 'tpupdatedatabase' ) : false;
206
  if ( $nonce === false ){
207
  $this->stop_and_print_error( __('Update aborted! Invalid nonce.', 'translatepress-multilingual' ) );
208
  }
219
  }
220
  }
221
  if ( empty ( $_REQUEST['trp_updb_action'] ) ){
222
+ $back_to_settings_button = '<p><a href="' . site_url('wp-admin/options-general.php?page=translate-press') . '"> <input type="button" value="' . esc_html__('Back to TranslatePress Settings', 'translatepress-multilingual' ) . '" class="button-primary"></a></p>';
223
  // finished successfully
224
  echo json_encode( array(
225
  'trp_update_completed' => 'yes',
231
  $_REQUEST['trp_updb_batch'] = 0;
232
 
233
  $update_message_initial = isset( $updates_needed[$_REQUEST['trp_updb_action']]['message_initial'] ) ?
234
+ $updates_needed[sanitize_text_field( $_REQUEST['trp_updb_action'] )]['message_initial']
235
  : __('Updating database to version %s+', 'translatepress-multilingual' );
236
 
237
  $update_message_processing = isset( $updates_needed[$_REQUEST['trp_updb_action']]['message_processing'] ) ?
238
+ $updates_needed[ sanitize_text_field( $_REQUEST['trp_updb_action'] )]['message_processing']
239
  : __('Processing table for language %s...', 'translatepress-multilingual' );
240
 
241
+ $request['progress_message'] .= '<p>' . sprintf( $update_message_initial, $updates_needed[ sanitize_text_field( $_REQUEST['trp_updb_action'] ) ]['version'] ) . '</p>';
242
+ $request['progress_message'] .= sprintf( $update_message_processing, sanitize_text_field( $_REQUEST['trp_updb_lang'] ) );//phpcs:ignore
243
  }
244
  }else{
245
  if ( !isset( $updates_needed[ $_REQUEST['trp_updb_action'] ] ) ){
246
  $this->stop_and_print_error( __('Update aborted! Incorrect action.', 'translatepress-multilingual' ) );
247
  }
248
+ if ( !in_array( $_REQUEST['trp_updb_lang'], $this->settings['translation-languages'] ) ) {//phpcs:ignore
249
  $this->stop_and_print_error( __('Update aborted! Incorrect language code.', 'translatepress-multilingual' ) );
250
  }
251
  }
252
 
253
+ $request['trp_updb_action'] = sanitize_text_field( $_REQUEST['trp_updb_action'] );
254
  if ( !empty( $_REQUEST['trp_updb_batch'] ) && (int) $_REQUEST['trp_updb_batch'] > 0 ) {
255
  $get_batch = (int)$_REQUEST['trp_updb_batch'];
256
  }else{
258
  }
259
 
260
  $request['trp_updb_batch'] = 0;
261
+ $update_details = $updates_needed[ sanitize_text_field( $_REQUEST['trp_updb_action'] )];
262
+ $batch_size = apply_filters( 'trp_updb_batch_size', $update_details['batch_size'], sanitize_text_field( $_REQUEST['trp_updb_action'] ), $update_details );
263
+ $language_code = isset( $_REQUEST['trp_updb_lang'] ) ? sanitize_text_field( $_REQUEST['trp_updb_lang'] ) : '';
264
 
265
  if ( ! $this->trp_query ) {
266
  $trp = TRP_Translate_Press::get_trp_instance();
295
  $request['trp_updb_lang'] = $this->settings['translation-languages'][ $index + 1 ];
296
  $request['progress_message'] .= __(' done.', 'translatepress-multilingual' ) . '</br>';
297
  $update_message_processing = isset( $updates_needed[$_REQUEST['trp_updb_action']]['message_processing'] ) ?
298
+ $updates_needed[ sanitize_text_field( $_REQUEST['trp_updb_action'] ) ]['message_processing']
299
  : __('Processing table for language %s...', 'translatepress-multilingual' );
300
  $request['progress_message'] .= '</br>' . sprintf( $update_message_processing, $request['trp_updb_lang'] );
301
  } else {
481
  echo esc_html__('Done.', 'translatepress-multilingual' ) . '<br><br><a href="' . esc_url( site_url('wp-admin/admin.php?page=trp_advanced_page') ) . '"> <input type="button" value="' . esc_attr__('Back to TranslatePress Settings', 'translatepress-multilingual' ) . '" class="button-primary"></a>';
482
  return;
483
  }
484
+ $nonce = isset( $_GET['trp_rm_nonce'] ) ? wp_verify_nonce( sanitize_text_field( $_GET['trp_rm_nonce'] ), 'tpremoveduplicaterows' ) : false;
485
  if ( $nonce === false ){
486
  echo esc_html__('Invalid nonce.', 'translatepress-multilingual' ) . '<br><br><a href="' . esc_url( site_url('wp-admin/admin.php?page=trp_advanced_page') ) . '"> <input type="button" value="' . esc_attr__('Back to TranslatePress Settings', 'translatepress-multilingual' ) . '" class="button-primary"></a>';
487
  return;
489
 
490
  $next_get_batch = 1;
491
  $batch_size = apply_filters( 'trp_rm_duplicate_batch_size', 10000 );
492
+ if ( !empty( $_GET['trp_rm_batch_size'] ) && isset( $_GET['trp_rm_batch'] ) && (int) $_GET['trp_rm_batch'] > 0 ){
493
  $batch_size = (int) $_GET['trp_rm_batch_size'];
494
  }
495
  if ( in_array( sanitize_text_field( $_GET['trp_rm_duplicates'] ), $this->settings['translation-languages'] ) ) {
507
  else if (isset($_GET['trp_rm_duplicates_gettext']) )
508
  $table_name = $this->trp_query->get_gettext_table_name( $language_code );
509
 
510
+ echo '<div>' . wp_kses( sprintf( __( 'Querying table <strong>%s</strong>', 'translatepress-multilingual' ), [ 'strong' => [] ] ), $table_name ) . '</div>';
511
 
512
  $last_id = $this->trp_query->get_last_id( $table_name );
513
  if ( !empty( $_GET['trp_rm_batch'] ) && (int) $_GET['trp_rm_batch'] > 0 ) {
549
  return;
550
  }else{
551
  $result = $result1 + $result2;
552
+ echo '<div>' . esc_html( sprintf( __( '%s duplicates removed', 'translatepress-multilingual' ), $result ) ) . '</div>';
553
  }
554
  }
555
  if ( $next_get_batch == 1 ) {
includes/class-url-converter.php CHANGED
@@ -79,9 +79,9 @@ class TRP_Url_Converter {
79
  // we can't use wp_get_referer() It looks like it creates an infinite loop because it calls home_url() and we're filtering that
80
  $referrer = '';
81
  if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
82
- $referrer = wp_unslash( $_REQUEST['_wp_http_referer'] );
83
  } else if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
84
- $referrer = wp_unslash( $_SERVER['HTTP_REFERER'] );
85
  }
86
 
87
  //consider an admin request a call to the rest api that came from the admin area
@@ -120,7 +120,7 @@ class TRP_Url_Converter {
120
  global $wp_current_filter;
121
 
122
  if( empty( $path ) || $path === '/' ){
123
- $path = $_SERVER['REQUEST_URI'];
124
  }
125
 
126
  // Verify that this is a sitemap url and that it contains the .xml extension
@@ -358,18 +358,18 @@ class TRP_Url_Converter {
358
 
359
  }else if( isset( $trp_current_url_term_slug ) && isset($trp_current_url_taxonomy) &&
360
  !is_wp_error( get_term_link( $trp_current_url_term_slug, $trp_current_url_taxonomy)) &&
361
- strpos( urldecode($url), get_term_link( $trp_current_url_term_slug, $trp_current_url_taxonomy) ) === 0
362
  ){ // check here if it is a term link
363
  $current_term_link = get_term_link( $trp_current_url_term_slug, $trp_current_url_taxonomy);
364
  $TRP_LANGUAGE = $language;
365
  $check_term_link = get_term_link($trp_current_url_term_slug, $trp_current_url_taxonomy);
366
  if (!is_wp_error($check_term_link))
367
- $new_url = str_replace( $current_term_link, $check_term_link, urldecode($url) );
368
  else
369
  $new_url = $url;
370
 
371
  $TRP_LANGUAGE = $trp_language_copy;
372
- }else if( is_home() && ( strpos($_SERVER['REQUEST_URI'], 'sitemap') === false && strpos($_SERVER['REQUEST_URI'], '.xml') === false ) ) {//for some reason in yoast sitemap is_home() is true ..so we need to check if we are not in the sitemap itself
373
  $TRP_LANGUAGE = $language;
374
  if ( empty($url_obj->getQuery()) ) {
375
  $new_url = $this->maybe_add_pagination_to_blog_page( get_post_type_archive_link( 'post' ) );
@@ -551,7 +551,7 @@ class TRP_Url_Converter {
551
  }
552
  if ( apply_filters('trp_adjust_absolute_home_https_based_on_server_variable', true) ) {
553
  // always return absolute_home based on the http or https version of the current page request. This means no more redirects.
554
- if ( !empty( $_SERVER['HTTPS'] ) && strtolower($_SERVER['HTTPS']) != 'off' ) {
555
  $this->absolute_home = str_replace( 'http://', 'https://', $this->absolute_home );
556
  } else {
557
  $this->absolute_home = str_replace( 'https://', 'http://', $this->absolute_home );
@@ -635,7 +635,7 @@ class TRP_Url_Converter {
635
  return $req_uri;
636
  }
637
 
638
- $req_uri = $_SERVER['REQUEST_URI'];
639
 
640
  $home_path = trim( parse_url( $this->get_abs_home(), PHP_URL_PATH ), '/' );
641
  $home_path_regex = sprintf( '|^%s|i', preg_quote( $home_path, '|' ) );
@@ -718,6 +718,11 @@ class TRP_Url_Converter {
718
  if( $TRP_LANGUAGE != $this->settings['default-language'] ) {
719
  if( trim($value['product_base'], '/') === trp_x( 'product', 'slug', 'woocommerce', $this->settings['default-language'] ) ){
720
  $value['product_base'] = '';
 
 
 
 
 
721
  }else{
722
  // if the custom base permalink starts with product, WooCommerce will translate it when on other languages
723
  if ( substr( $value['product_base'], 0, strlen('/product/' ) ) === '/product/' ) {
79
  // we can't use wp_get_referer() It looks like it creates an infinite loop because it calls home_url() and we're filtering that
80
  $referrer = '';
81
  if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
82
+ $referrer = wp_unslash( esc_url_raw( $_REQUEST['_wp_http_referer'] ) );
83
  } else if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
84
+ $referrer = wp_unslash( esc_url_raw( $_SERVER['HTTP_REFERER'] ) );
85
  }
86
 
87
  //consider an admin request a call to the rest api that came from the admin area
120
  global $wp_current_filter;
121
 
122
  if( empty( $path ) || $path === '/' ){
123
+ $path = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( $_SERVER['REQUEST_URI'] ) : '';
124
  }
125
 
126
  // Verify that this is a sitemap url and that it contains the .xml extension
358
 
359
  }else if( isset( $trp_current_url_term_slug ) && isset($trp_current_url_taxonomy) &&
360
  !is_wp_error( get_term_link( $trp_current_url_term_slug, $trp_current_url_taxonomy)) &&
361
+ strpos( $url, get_term_link( $trp_current_url_term_slug, $trp_current_url_taxonomy) ) === 0
362
  ){ // check here if it is a term link
363
  $current_term_link = get_term_link( $trp_current_url_term_slug, $trp_current_url_taxonomy);
364
  $TRP_LANGUAGE = $language;
365
  $check_term_link = get_term_link($trp_current_url_term_slug, $trp_current_url_taxonomy);
366
  if (!is_wp_error($check_term_link))
367
+ $new_url = str_replace( $current_term_link, $check_term_link, $url );
368
  else
369
  $new_url = $url;
370
 
371
  $TRP_LANGUAGE = $trp_language_copy;
372
+ }else if( is_home() && ( isset( $_SERVER['REQUEST_URI'] ) && strpos( esc_url_raw( $_SERVER['REQUEST_URI'] ), 'sitemap') === false && strpos( esc_url_raw( $_SERVER['REQUEST_URI'] ), '.xml') === false ) ) {//for some reason in yoast sitemap is_home() is true ..so we need to check if we are not in the sitemap itself
373
  $TRP_LANGUAGE = $language;
374
  if ( empty($url_obj->getQuery()) ) {
375
  $new_url = $this->maybe_add_pagination_to_blog_page( get_post_type_archive_link( 'post' ) );
551
  }
552
  if ( apply_filters('trp_adjust_absolute_home_https_based_on_server_variable', true) ) {
553
  // always return absolute_home based on the http or https version of the current page request. This means no more redirects.
554
+ if ( !empty( $_SERVER['HTTPS'] ) && strtolower( sanitize_text_field( $_SERVER['HTTPS'] ) ) != 'off' ) {
555
  $this->absolute_home = str_replace( 'http://', 'https://', $this->absolute_home );
556
  } else {
557
  $this->absolute_home = str_replace( 'https://', 'http://', $this->absolute_home );
635
  return $req_uri;
636
  }
637
 
638
+ $req_uri = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( $_SERVER['REQUEST_URI'] ) : '';
639
 
640
  $home_path = trim( parse_url( $this->get_abs_home(), PHP_URL_PATH ), '/' );
641
  $home_path_regex = sprintf( '|^%s|i', preg_quote( $home_path, '|' ) );
718
  if( $TRP_LANGUAGE != $this->settings['default-language'] ) {
719
  if( trim($value['product_base'], '/') === trp_x( 'product', 'slug', 'woocommerce', $this->settings['default-language'] ) ){
720
  $value['product_base'] = '';
721
+ /* in ajax it seems the language is not set correctly and we get the slug for the original language if we leave it blank. detected in sober theme
722
+ Will only do it for products for now as I am not 100% sure it won't impact other things */
723
+ if( wp_doing_ajax() ){
724
+ $value['product_base'] = trp_x( 'product', 'slug', 'woocommerce', $TRP_LANGUAGE );
725
+ }
726
  }else{
727
  // if the custom base permalink starts with product, WooCommerce will translate it when on other languages
728
  if ( substr( $value['product_base'], 0, strlen('/product/' ) ) === '/product/' ) {
includes/class-wp-bakery-language-for-blocks.php CHANGED
@@ -95,19 +95,19 @@ class TRP_WPBakery {
95
 
96
  $attributes_checkbox = [
97
  'type' => 'checkbox',
98
- 'heading' => __('Restrict element to language', 'translatepress'),
99
  'param_name' => $this->param_name_show,
100
  'group' => $group,
101
- 'description' => __('Show this element only in one language.', 'translatepress')
102
  ];
103
 
104
  $attributes_value = [
105
  'type' => 'dropdown',
106
- 'heading' => __('Select language', 'translatepress'),
107
  'param_name' => $this->param_name_show_language,
108
  'group' => $group,
109
  'value' => array_flip($this->get_published_languages(true)),
110
- 'description' => __('Choose in which language to show this element.', 'translatepress'),
111
  'dependency' => [
112
  'element' => $this->param_name_show,
113
  'value' => 'true'
@@ -135,31 +135,31 @@ class TRP_WPBakery {
135
 
136
  $attributes_checkbox = [
137
  'type' => 'checkbox',
138
- 'heading' => __('Exclude from Language', 'translatepress'),
139
  'param_name' => $this->param_name_exclude,
140
  'group' => $group,
141
- 'description' => __('Exclude this element from specific languages.', 'translatepress')
142
  ];
143
 
144
  $message =
145
  '<p>' .
146
  __(
147
  'This element will still be visible when you are translating your website through the Translation Editor.',
148
- 'translatepress'
149
  ) .
150
  '</p>';
151
  $message .=
152
  '<p>' .
153
- __('The content of this element should be written in the default language.', 'translatepress') .
154
  '</p>';
155
 
156
  $attributes_value = [
157
  'type' => $this->shortcode_param_type_dropdown_multi,
158
- 'heading' => __('Select languages', 'translatepress'),
159
  'param_name' => $this->param_name_exclude_languages,
160
  'group' => $group,
161
  'value' => array_flip($this->get_published_languages(true)),
162
- 'description' => __('Choose from which languages to exclude this element.', 'translatepress') . $message,
163
  'dependency' => [
164
  'element' => $this->param_name_exclude,
165
  'value' => 'true'
@@ -176,7 +176,7 @@ class TRP_WPBakery {
176
  }
177
 
178
  private function get_group() {
179
- return __('TranslatePress', 'translatepress');
180
  }
181
 
182
  private function get_published_languages($placeholder = false) {
@@ -248,9 +248,10 @@ class TRP_WPBakery {
248
  public function get_skip_sc_array(){
249
  $skip_sc = array();
250
  $sc = WPBMap::getAllShortCodes();
 
251
  if ( isset( $sc) && is_array($sc) ){
252
  foreach( $sc as $key => $value ){
253
- if ( isset($sc[$key] ) && (!isset($sc[$key]['params']) || !is_array($sc[$key]['params'])) ){
254
  $skip_sc[] = $key;
255
  }
256
  }
@@ -258,7 +259,28 @@ class TRP_WPBakery {
258
  return $skip_sc;
259
  }
260
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
  }
262
 
 
 
263
  // Instantiate Plugin Class
264
- TRP_WPBakery::instance();
 
95
 
96
  $attributes_checkbox = [
97
  'type' => 'checkbox',
98
+ 'heading' => __('Restrict element to language', 'translatepress-multilingual'),
99
  'param_name' => $this->param_name_show,
100
  'group' => $group,
101
+ 'description' => __('Show this element only in one language.', 'translatepress-multilingual')
102
  ];
103
 
104
  $attributes_value = [
105
  'type' => 'dropdown',
106
+ 'heading' => __('Select language', 'translatepress-multilingual'),
107
  'param_name' => $this->param_name_show_language,
108
  'group' => $group,
109
  'value' => array_flip($this->get_published_languages(true)),
110
+ 'description' => __('Choose in which language to show this element.', 'translatepress-multilingual'),
111
  'dependency' => [
112
  'element' => $this->param_name_show,
113
  'value' => 'true'
135
 
136
  $attributes_checkbox = [
137
  'type' => 'checkbox',
138
+ 'heading' => __('Exclude from Language', 'translatepress-multilingual'),
139
  'param_name' => $this->param_name_exclude,
140
  'group' => $group,
141
+ 'description' => __('Exclude this element from specific languages.', 'translatepress-multilingual')
142
  ];
143
 
144
  $message =
145
  '<p>' .
146
  __(
147
  'This element will still be visible when you are translating your website through the Translation Editor.',
148
+ 'translatepress-multilingual'
149
  ) .
150
  '</p>';
151
  $message .=
152
  '<p>' .
153
+ __('The content of this element should be written in the default language.', 'translatepress-multilingual') .
154
  '</p>';
155
 
156
  $attributes_value = [
157
  'type' => $this->shortcode_param_type_dropdown_multi,
158
+ 'heading' => __('Select languages', 'translatepress-multilingual'),
159
  'param_name' => $this->param_name_exclude_languages,
160
  'group' => $group,
161
  'value' => array_flip($this->get_published_languages(true)),
162
+ 'description' => __('Choose from which languages to exclude this element.', 'translatepress-multilingual') . $message,
163
  'dependency' => [
164
  'element' => $this->param_name_exclude,
165
  'value' => 'true'
176
  }
177
 
178
  private function get_group() {
179
+ return __('TranslatePress', 'translatepress-multilingual');
180
  }
181
 
182
  private function get_published_languages($placeholder = false) {
248
  public function get_skip_sc_array(){
249
  $skip_sc = array();
250
  $sc = WPBMap::getAllShortCodes();
251
+
252
  if ( isset( $sc) && is_array($sc) ){
253
  foreach( $sc as $key => $value ){
254
+ if ( isset($sc[$key] ) && (!isset($sc[$key]['params']) || !is_array($sc[$key]['params']) || $this->has_invalid_params($sc[$key]['params']))){
255
  $skip_sc[] = $key;
256
  }
257
  }
259
  return $skip_sc;
260
  }
261
 
262
+ /**
263
+ * Check if the parameters are valid (have numeric keys).
264
+ * @param $arr array
265
+ */
266
+ public function has_invalid_params($arr){
267
+ $bool=false;
268
+
269
+ foreach (array_keys($arr) as $key){
270
+ if(!is_numeric($key)){
271
+ $bool = true;
272
+ break;
273
+ }
274
+ }
275
+
276
+ $invalid_params = apply_filters('trp_wp_bakery_invalid_params', $bool, $arr);
277
+ return $invalid_params;
278
+ }
279
+
280
  }
281
 
282
+
283
+
284
  // Instantiate Plugin Class
285
+ TRP_WPBakery::instance();
286
+
includes/compatibility-functions.php CHANGED
@@ -60,7 +60,7 @@ function trp_remove_html_from_menu_title( $atts, $item, $args ){
60
  */
61
  function trp_wp_trim_words( $text, $num_words, $more, $original_text ) {
62
  if ( null === $more ) {
63
- $more = __( '&hellip;' );
64
  }
65
  // what we receive is the short text in the filter
66
  $text = $original_text;
@@ -73,7 +73,7 @@ function trp_wp_trim_words( $text, $num_words, $more, $original_text ) {
73
  $default_language= $settings["default-language"];
74
 
75
  $char_is_word = false;
76
- foreach (array('ch', 'ja', 'tw') as $lang){
77
  if (strpos($default_language, $lang) !== false){
78
  $char_is_word = true;
79
  }
@@ -418,7 +418,7 @@ function trp_nextgen_compatibility( $priority ){
418
  */
419
  add_filter( 'run_ngg_resource_manager', 'trp_nextgen_disable_nextgen_in_translation_editor');
420
  function trp_nextgen_disable_nextgen_in_translation_editor( $bool ){
421
- if ( isset( $_REQUEST['trp-edit-translation'] ) && esc_attr( $_REQUEST['trp-edit-translation'] ) === 'true' ) {
422
  return false;
423
  }
424
  return $bool;
@@ -481,7 +481,7 @@ if( class_exists( 'WooCommerce' ) ) {
481
  function trp_woo_fix_product_remove_from_cart_notice($message, $cart_item){
482
  $product = wc_get_product( $cart_item['product_id'] );
483
  if ($product){
484
- $message = sprintf( _x( '&ldquo; %s &rdquo;', 'Item name in quotes', 'woocommerce' ), $product->get_name() );
485
  }
486
  return $message;
487
  }
@@ -905,8 +905,9 @@ function trp_brizy_disable_dynamic_translation( $enable ){
905
 
906
  /**
907
  * Compatibility with Brizy PRO menu, the language switcher inside the menu does not work fully yet
 
908
  */
909
- if( defined( 'BRIZY_PRO_VERSION' ) ){
910
  add_filter( 'trp_home_url', 'trp_brizy_menu_pro_compatibility', 10, 5 );
911
  function trp_brizy_menu_pro_compatibility( $new_url, $abs_home, $TRP_LANGUAGE, $path, $url ){
912
  if ( version_compare( PHP_VERSION, '5.4.0', '>=' ) ) {
@@ -916,7 +917,7 @@ if( defined( 'BRIZY_PRO_VERSION' ) ){
916
  $callstack_functions = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
917
  }
918
 
919
- $list_of_functions = array( 'restoreSiteUrl' );
920
  if( !empty( $callstack_functions ) ) {
921
  foreach ( $callstack_functions as $callstack_function ) {
922
  if ( in_array( $callstack_function['function'], $list_of_functions ) ) {
@@ -1249,7 +1250,7 @@ function trp_add_current_menu_item_css_class( $items ){
1249
  }
1250
 
1251
  foreach( $items as $item ){
1252
- if ( !in_array( 'current-menu-item', $item->classes ) && !in_array( 'menu-item-object-language_switcher', $item->classes )){
1253
  $url_for_language = $url_converter->get_url_for_language( $TRP_LANGUAGE, $item->url );
1254
  $url_for_language = strpos( $url_for_language, '#' ) ? substr( $url_for_language, 0, strpos( $url_for_language, '#' ) ) : $url_for_language;
1255
  $cur_page_url = set_url_scheme( untrailingslashit( $url_converter->cur_page_url() ) );
@@ -1400,8 +1401,8 @@ if( class_exists('WooCommerce_Product_Search_Service') ) {
1400
  $attributes = isset($_REQUEST[WooCommerce_Product_Search_Service::ATTRIBUTES]) ? intval($_REQUEST[WooCommerce_Product_Search_Service::ATTRIBUTES]) > 0 : WooCommerce_Product_Search_Service::DEFAULT_ATTRIBUTES;
1401
  $variations = isset($_REQUEST[WooCommerce_Product_Search_Service::VARIATIONS]) ? intval($_REQUEST[WooCommerce_Product_Search_Service::VARIATIONS]) > 0 : WooCommerce_Product_Search_Service::DEFAULT_VARIATIONS;
1402
 
1403
- $min_price = isset($_REQUEST[WooCommerce_Product_Search_Service::MIN_PRICE]) ? WooCommerce_Product_Search_Service::to_float($_REQUEST[WooCommerce_Product_Search_Service::MIN_PRICE]) : null;
1404
- $max_price = isset($_REQUEST[WooCommerce_Product_Search_Service::MAX_PRICE]) ? WooCommerce_Product_Search_Service::to_float($_REQUEST[WooCommerce_Product_Search_Service::MAX_PRICE]) : null;
1405
  if ($min_price !== null && $min_price <= 0) {
1406
  $min_price = null;
1407
  }
60
  */
61
  function trp_wp_trim_words( $text, $num_words, $more, $original_text ) {
62
  if ( null === $more ) {
63
+ $more = __( '&hellip;' );//phpcs:ignore
64
  }
65
  // what we receive is the short text in the filter
66
  $text = $original_text;
73
  $default_language= $settings["default-language"];
74
 
75
  $char_is_word = false;
76
+ foreach (array('ja', 'tw', 'zh') as $lang){
77
  if (strpos($default_language, $lang) !== false){
78
  $char_is_word = true;
79
  }
418
  */
419
  add_filter( 'run_ngg_resource_manager', 'trp_nextgen_disable_nextgen_in_translation_editor');
420
  function trp_nextgen_disable_nextgen_in_translation_editor( $bool ){
421
+ if ( isset( $_REQUEST['trp-edit-translation'] ) && sanitize_text_field( $_REQUEST['trp-edit-translation'] ) === 'true' ) {
422
  return false;
423
  }
424
  return $bool;
481
  function trp_woo_fix_product_remove_from_cart_notice($message, $cart_item){
482
  $product = wc_get_product( $cart_item['product_id'] );
483
  if ($product){
484
+ $message = sprintf( _x( '&ldquo; %s &rdquo;', 'Item name in quotes', 'woocommerce' ), $product->get_name() ); //phpcs:ignore
485
  }
486
  return $message;
487
  }
905
 
906
  /**
907
  * Compatibility with Brizy PRO menu, the language switcher inside the menu does not work fully yet
908
+ * Compatibility with Brizy assets loading with language slug in url (the 'process' function)
909
  */
910
+ if( defined( 'BRIZY_PRO_VERSION' ) || defined( 'BRIZY_VERSION' ) ){
911
  add_filter( 'trp_home_url', 'trp_brizy_menu_pro_compatibility', 10, 5 );
912
  function trp_brizy_menu_pro_compatibility( $new_url, $abs_home, $TRP_LANGUAGE, $path, $url ){
913
  if ( version_compare( PHP_VERSION, '5.4.0', '>=' ) ) {
917
  $callstack_functions = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
918
  }
919
 
920
+ $list_of_functions = array( 'restoreSiteUrl', 'process' );
921
  if( !empty( $callstack_functions ) ) {
922
  foreach ( $callstack_functions as $callstack_function ) {
923
  if ( in_array( $callstack_function['function'], $list_of_functions ) ) {
1250
  }
1251
 
1252
  foreach( $items as $item ){
1253
+ if ( !in_array( 'current-menu-item', $item->classes ) && !in_array( 'menu-item-object-language_switcher', $item->classes ) && ( !empty($item->url) && $item->url !== '#')){
1254
  $url_for_language = $url_converter->get_url_for_language( $TRP_LANGUAGE, $item->url );
1255
  $url_for_language = strpos( $url_for_language, '#' ) ? substr( $url_for_language, 0, strpos( $url_for_language, '#' ) ) : $url_for_language;
1256
  $cur_page_url = set_url_scheme( untrailingslashit( $url_converter->cur_page_url() ) );
1401
  $attributes = isset($_REQUEST[WooCommerce_Product_Search_Service::ATTRIBUTES]) ? intval($_REQUEST[WooCommerce_Product_Search_Service::ATTRIBUTES]) > 0 : WooCommerce_Product_Search_Service::DEFAULT_ATTRIBUTES;
1402
  $variations = isset($_REQUEST[WooCommerce_Product_Search_Service::VARIATIONS]) ? intval($_REQUEST[WooCommerce_Product_Search_Service::VARIATIONS]) > 0 : WooCommerce_Product_Search_Service::DEFAULT_VARIATIONS;
1403
 
1404
+ $min_price = isset($_REQUEST[WooCommerce_Product_Search_Service::MIN_PRICE]) ? WooCommerce_Product_Search_Service::to_float($_REQUEST[WooCommerce_Product_Search_Service::MIN_PRICE]) : null;//phpcs:ignore
1405
+ $max_price = isset($_REQUEST[WooCommerce_Product_Search_Service::MAX_PRICE]) ? WooCommerce_Product_Search_Service::to_float($_REQUEST[WooCommerce_Product_Search_Service::MAX_PRICE]) : null;//phpcs:ignore
1406
  if ($min_price !== null && $min_price <= 0) {
1407
  $min_price = null;
1408
  }
includes/custom-language.php CHANGED
@@ -5,7 +5,7 @@ add_image_size( 'trp-custom-language-flag', 18, 12 );
5
  add_filter( 'image_size_names_choose', 'trp_add_flag_sizes' );
6
  function trp_add_flag_sizes( $sizes ) {
7
  return array_merge( $sizes, array(
8
- 'trp-custom-language-flag' => __( 'Custom Language Flag' )
9
  ) );
10
  }
11
 
@@ -33,7 +33,9 @@ function trpc_add_custom_language( $languages ) {
33
  'language' => $lang,
34
  'english_name' => $custom_language_name,
35
  'native_name' => $custom_language_native,
36
- 'iso' => array( $custom_language_iso )
 
 
37
  );
38
 
39
  global $TRP_LANGUAGE;
5
  add_filter( 'image_size_names_choose', 'trp_add_flag_sizes' );
6
  function trp_add_flag_sizes( $sizes ) {
7
  return array_merge( $sizes, array(
8
+ 'trp-custom-language-flag' => __( 'Custom Language Flag', 'translatepress-multilingual' )
9
  ) );
10
  }
11
 
33
  'language' => $lang,
34
  'english_name' => $custom_language_name,
35
  'native_name' => $custom_language_native,
36
+ 'iso' => array( $custom_language_iso ),
37
+ 'is_custom_language' => true
38
+
39
  );
40
 
41
  global $TRP_LANGUAGE;
includes/functions.php CHANGED
@@ -8,7 +8,7 @@
8
  function trp_the_language_switcher(){
9
  $trp = TRP_Translate_Press::get_trp_instance();
10
  $language_switcher = $trp->get_component( 'language_switcher' );
11
- echo $language_switcher->language_switcher();
12
  }
13
 
14
  /**
8
  function trp_the_language_switcher(){
9
  $trp = TRP_Translate_Press::get_trp_instance();
10
  $language_switcher = $trp->get_component( 'language_switcher' );
11
+ echo $language_switcher->language_switcher(); /* phpcs:ignore */ /* escaped inside the function */
12
  }
13
 
14
  /**
includes/google-translate/functions.php CHANGED
@@ -56,7 +56,7 @@ function trp_gt_add_settings( $mt_settings ){
56
  ?>
57
  <p class="description">
58
  <?php echo wp_kses( __( 'Visit <a href="https://cloud.google.com/docs/authentication/api-keys" target="_blank">this link</a> to see how you can set up an API key, <strong>control API costs</strong> and set HTTP referrer restrictions.', 'translatepress-multilingual' ), [ 'a' => [ 'href' => [], 'title' => [], 'target' => [] ], 'strong' => [] ] ); ?>
59
- <br><?php echo sprintf( esc_html__( 'Your HTTP referrer is: %s', 'translatepress-multilingual' ), $machine_translator->get_referer() ); ?>
60
  </p>
61
  </td>
62
 
56
  ?>
57
  <p class="description">
58
  <?php echo wp_kses( __( 'Visit <a href="https://cloud.google.com/docs/authentication/api-keys" target="_blank">this link</a> to see how you can set up an API key, <strong>control API costs</strong> and set HTTP referrer restrictions.', 'translatepress-multilingual' ), [ 'a' => [ 'href' => [], 'title' => [], 'target' => [] ], 'strong' => [] ] ); ?>
59
+ <br><?php echo esc_html( sprintf( __( 'Your HTTP referrer is: %s', 'translatepress-multilingual' ), $machine_translator->get_referer() ) ); ?>
60
  </p>
61
  </td>
62
 
includes/string-translation/class-string-translation-helper.php CHANGED
@@ -34,7 +34,7 @@ class TRP_String_Translation_Helper {
34
  $this->settings = $trp_settings->get_settings();
35
  }
36
  $query_args = array();
37
- $posted_query = ( empty( $_POST['query'] ) ) ? array() : json_decode( stripslashes( $_POST['query'] ), true );
38
 
39
  // translation status
40
  $translation_status_filters = $this->string_translation->get_translation_status_filters();
34
  $this->settings = $trp_settings->get_settings();
35
  }
36
  $query_args = array();
37
+ $posted_query = ( empty( $_POST['query'] ) ) ? array() : json_decode( stripslashes( $_POST['query'] ), true ); /* phpcs:ignore */ /* sanitized below */
38
 
39
  // translation status
40
  $translation_status_filters = $this->string_translation->get_translation_status_filters();
includes/string-translation/class-string-translation.php CHANGED
@@ -83,13 +83,13 @@ class TRP_String_Translation {
83
  * @return bool
84
  */
85
  public function is_string_translation_editor() {
86
- if ( isset( $_REQUEST['trp-string-translation'] ) && esc_attr( $_REQUEST['trp-string-translation'] ) === 'true' ) {
87
  if ( current_user_can( apply_filters( 'trp_translating_capability', 'manage_options' ) ) && !is_admin() ) {
88
  return true;
89
  } else {
90
  wp_die(
91
- '<h1>' . esc_html__( 'Cheatin&#8217; uh?' ) . '</h1>' .
92
- '<p>' . esc_html__( 'Sorry, you are not allowed to access this page.' ) . '</p>',
93
  403
94
  );
95
  }
@@ -227,7 +227,7 @@ class TRP_String_Translation {
227
  'in' => _x( 'in', 'Untranslated in this language', 'translatepress-multilingual' ),
228
 
229
  // specific bulk actions
230
- 'delete_warning' => __( 'Warning: This action cannot be undone. Deleting a string will remove its current translation. The original string will appear again in this interface after TranslatePress detects it. This action is NOT equivalent to excluding the string from being translated again.' ),
231
 
232
  // tooltips
233
  'next_page' => __( 'Navigate to next page', 'translatepress-multilingual' ),
83
  * @return bool
84
  */
85
  public function is_string_translation_editor() {
86
+ if ( isset( $_REQUEST['trp-string-translation'] ) && sanitize_text_field( $_REQUEST['trp-string-translation'] ) === 'true' ) {
87
  if ( current_user_can( apply_filters( 'trp_translating_capability', 'manage_options' ) ) && !is_admin() ) {
88
  return true;
89
  } else {
90
  wp_die(
91
+ '<h1>' . esc_html__( 'Cheatin&#8217; uh?' ) . '</h1>' . //phpcs:ignore
92
+ '<p>' . esc_html__( 'Sorry, you are not allowed to access this page.' ) . '</p>', //phpcs:ignore
93
  403
94
  );
95
  }
227
  'in' => _x( 'in', 'Untranslated in this language', 'translatepress-multilingual' ),
228
 
229
  // specific bulk actions
230
+ 'delete_warning' => __( 'Warning: This action cannot be undone. Deleting a string will remove its current translation. The original string will appear again in this interface after TranslatePress detects it. This action is NOT equivalent to excluding the string from being translated again.' , 'translatepress-multilingual' ),
231
 
232
  // tooltips
233
  'next_page' => __( 'Navigate to next page', 'translatepress-multilingual' ),
includes/string-translation/string-translation-editor.php CHANGED
@@ -4,7 +4,7 @@
4
  <?php
5
  do_action( 'trp_string_translation_editor_head' );
6
  ?>
7
- <title>TranslatePress - <?php _e('String Translation Editor', 'translatepress-multilingual'); ?> </title>
8
  </head>
9
  <body class="trp-editor-body">
10
 
4
  <?php
5
  do_action( 'trp_string_translation_editor_head' );
6
  ?>
7
+ <title>TranslatePress - <?php esc_html_e('String Translation Editor', 'translatepress-multilingual'); ?> </title>
8
  </head>
9
  <body class="trp-editor-body">
10
 
includes/trp-ajax.php CHANGED
@@ -22,7 +22,7 @@ class TRP_Ajax{
22
  }
23
 
24
  include './external-functions.php';
25
- if ( !trp_is_valid_language_code( $_POST['language'] ) || !trp_is_valid_language_code( $_POST['original_language'] ) ) {
26
  echo json_encode( 'TranslatePress Error: Invalid language code' );
27
  exit;
28
  }
@@ -30,8 +30,8 @@ class TRP_Ajax{
30
  if ( $this->connect_to_db() ){
31
 
32
  $this->output_translations(
33
- $this->sanitize_strings( $_POST['originals'] ),
34
- $this->sanitize_strings( $_POST['skip_machine_translation'] ),
35
  mysqli_real_escape_string( $this->connection, filter_var( $_POST['language'], FILTER_SANITIZE_STRING ) ),
36
  mysqli_real_escape_string( $this->connection, filter_var( $_POST['original_language'], FILTER_SANITIZE_STRING ) )
37
  );
22
  }
23
 
24
  include './external-functions.php';
25
+ if ( !trp_is_valid_language_code( $_POST['language'] ) || !trp_is_valid_language_code( $_POST['original_language'] ) ) {//phpcs:ignore
26
  echo json_encode( 'TranslatePress Error: Invalid language code' );
27
  exit;
28
  }
30
  if ( $this->connect_to_db() ){
31
 
32
  $this->output_translations(
33
+ $this->sanitize_strings( $_POST['originals'] ),//phpcs:ignore
34
+ $this->sanitize_strings( $_POST['skip_machine_translation'] ),//phpcs:ignore
35
  mysqli_real_escape_string( $this->connection, filter_var( $_POST['language'], FILTER_SANITIZE_STRING ) ),
36
  mysqli_real_escape_string( $this->connection, filter_var( $_POST['original_language'], FILTER_SANITIZE_STRING ) )
37
  );
index.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
- Plugin Name: TranslatePress - Multilingual
4
  Plugin URI: https://translatepress.com/
5
  Description: Experience a better way of translating your WordPress site using a visual front-end translation editor, with full support for WooCommerce and site builders.
6
- Version: 2.0.6
7
  Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
8
  Author URI: https://cozmoslabs.com/
9
  Text Domain: translatepress-multilingual
1
  <?php
2
  /*
3
+ Plugin Name: TranslatePress - Dev
4
  Plugin URI: https://translatepress.com/
5
  Description: Experience a better way of translating your WordPress site using a visual front-end translation editor, with full support for WooCommerce and site builders.
6
+ Version: 2.0.7
7
  Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
8
  Author URI: https://cozmoslabs.com/
9
  Text Domain: translatepress-multilingual
languages/translatepress-multilingual.catalog.php CHANGED
@@ -4,11 +4,16 @@
4
  <?php __("This TranslatePress add-on has been migrated to the main plugin and is no longer used. You can delete it.", "translatepress-multilingual"); ?>
5
  <?php __("<strong>TranslatePress</strong> requires at least PHP version 5.6.20+ to run. It is the <a href=\"%s\">minimum requirement of the latest WordPress version</a>. Please contact your server administrator to update your PHP version.", "translatepress-multilingual"); ?>
6
  <?php __("Advanced", "translatepress-multilingual"); ?>
 
7
  <?php __("Yes", "translatepress-multilingual"); ?>
8
  <?php __("Are you sure you want to remove this item?", "translatepress-multilingual"); ?>
9
  <?php __("Remove", "translatepress-multilingual"); ?>
10
  <?php __("Add", "translatepress-multilingual"); ?>
11
  <?php __("Select...", "translatepress-multilingual"); ?>
 
 
 
 
12
  <?php __("Your license key expired on %s.", "translatepress-multilingual"); ?>
13
  <?php __("Your license key has been disabled.", "translatepress-multilingual"); ?>
14
  <?php __("Invalid license.", "translatepress-multilingual"); ?>
@@ -18,6 +23,18 @@
18
  <?php __("An error occurred, please try again.", "translatepress-multilingual"); ?>
19
  <?php __("You have successfully activated your license", "translatepress-multilingual"); ?>
20
  <?php __("Others", "translatepress-multilingual"); ?>
 
 
 
 
 
 
 
 
 
 
 
 
21
  <?php __("<strong>TranslatePress</strong> encountered SQL errors. <a href=\"%s\" title=\"View TranslatePress SQL Errors\">Check out the errors</a>.", "translatepress-multilingual"); ?>
22
  <?php __("Automatic translation has been disabled.", "translatepress-multilingual"); ?>
23
  <?php __("Dismiss this notice.", "translatepress-multilingual"); ?>
@@ -190,8 +207,10 @@
190
  <?php __("click here", "translatepress-multilingual"); ?>
191
  <?php __("Recreated original strings table.", "translatepress-multilingual"); ?>
192
  <?php __("All individual TranslatePress add-on plugins have been discontinued and have been replaced with new Personal, Business and Developer versions of TranslatePress. Please log into the account page at <a href=\"https://translatepress.com/account/\" target=\"_blank\">translatepress.com</a> and download the new plugin and install it. Individual Add-ons will not receive updates anymore", "translatepress-multilingual"); ?>
 
193
  <?php __("<strong>TranslatePress</strong> requires <strong><a href=\"http://php.net/manual/en/book.mbstring.php\">Multibyte String PHP library</a></strong>. Please contact your server administrator to install it on your server.", "translatepress-multilingual"); ?>
194
  <?php __("Detected long query limitation on WPEngine hosting. Some large pages may appear untranslated. You can remove limitation by adding the following to your site’s wp-config.php: define( 'WPE_GOVERNOR', false ); ", "translatepress-multilingual"); ?>
 
195
  <?php __("TranslatePress Settings", "translatepress-multilingual"); ?>
196
  <?php __("TranslatePress Add-ons", "translatepress-multilingual"); ?>
197
  <?php __("You must first purchase this version to have access to the addon %1$shere%2$s", "translatepress-multilingual"); ?>
@@ -319,6 +338,8 @@
319
  <?php __("It disables search indexing the post content in translated languages.<br/>Useful when the content of the post doesn't allow HTML thus breaking the page.", "translatepress-multilingual"); ?>
320
  <?php __("Do not translate certain paths", "translatepress-multilingual"); ?>
321
  <?php __("Choose what paths can be translated. Supports wildcard at the end of the path.<br>For example, to exclude https://example.com/some/path you can either use the rule /some/path/ or /some/*.<br>Enter each rule on it's own line. To exclude the home page use {{home}}.", "translatepress-multilingual"); ?>
 
 
322
  <?php __("Automatically translate slugs", "translatepress-multilingual"); ?>
323
  <?php __("Generate automatic translations of slugs for posts, pages and Custom Post Types.<br/>Requires <a href=\"https://translatepress.com/docs/addons/seo-pack/\" title=\"TranslatePress Add-on SEO Pack documentation\" target=\"_blank\"> SEO Pack Add-on</a> to be installed and activated.<br>The slugs will be automatically translated starting with the second refresh of each page.", "translatepress-multilingual"); ?>
324
  <?php __("Enable the hreflang x-default tag for language:", "translatepress-multilingual"); ?>
@@ -388,6 +409,7 @@
388
  <?php __("To continue please type the word:", "translatepress-multilingual"); ?>
389
  <?php __("The word typed was incorrect. Action was cancelled.", "translatepress-multilingual"); ?>
390
  <?php __("in", "translatepress-multilingual"); ?>
 
391
  <?php __("Navigate to next page", "translatepress-multilingual"); ?>
392
  <?php __("Navigate to previous page", "translatepress-multilingual"); ?>
393
  <?php __("Navigate to first page", "translatepress-multilingual"); ?>
@@ -424,8 +446,8 @@
424
  <?php __("Select the type of DeepL API you want to use.", "translatepress-multilingual"); ?>
425
  <?php __("DeepL API Key", "translatepress-multilingual"); ?>
426
  <?php __("Visit <a href=\"%s\" target=\"_blank\">this link</a> to see how you can set up an API key and control API costs.", "translatepress-multilingual"); ?>
427
- <?php __(" TranslatePress Settings", "translatepress-multilingual"); ?>
428
  <?php __("Translator", "translatepress-multilingual"); ?>
 
429
  <?php __("Allow this user to translate the website.", "translatepress-multilingual"); ?>
430
  <?php __("URL Slugs Translation", "translatepress-multilingual"); ?>
431
  <?php __("Taxonomy Slugs", "translatepress-multilingual"); ?>
4
  <?php __("This TranslatePress add-on has been migrated to the main plugin and is no longer used. You can delete it.", "translatepress-multilingual"); ?>
5
  <?php __("<strong>TranslatePress</strong> requires at least PHP version 5.6.20+ to run. It is the <a href=\"%s\">minimum requirement of the latest WordPress version</a>. Please contact your server administrator to update your PHP version.", "translatepress-multilingual"); ?>
6
  <?php __("Advanced", "translatepress-multilingual"); ?>
7
+ <?php __("Settings saved.", "translatepress-multilingual"); ?>
8
  <?php __("Yes", "translatepress-multilingual"); ?>
9
  <?php __("Are you sure you want to remove this item?", "translatepress-multilingual"); ?>
10
  <?php __("Remove", "translatepress-multilingual"); ?>
11
  <?php __("Add", "translatepress-multilingual"); ?>
12
  <?php __("Select...", "translatepress-multilingual"); ?>
13
+ <?php __("There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.", "translatepress-multilingual"); ?>
14
+ <?php __("There is a new version of %1$s available. %2$sView version %3$s details%4$s.", "translatepress-multilingual"); ?>
15
+ <?php __("You do not have permission to install plugin updates", "translatepress-multilingual"); ?>
16
+ <?php __("Error", "translatepress-multilingual"); ?>
17
  <?php __("Your license key expired on %s.", "translatepress-multilingual"); ?>
18
  <?php __("Your license key has been disabled.", "translatepress-multilingual"); ?>
19
  <?php __("Invalid license.", "translatepress-multilingual"); ?>
23
  <?php __("An error occurred, please try again.", "translatepress-multilingual"); ?>
24
  <?php __("You have successfully activated your license", "translatepress-multilingual"); ?>
25
  <?php __("Others", "translatepress-multilingual"); ?>
26
+ <?php __("Restrict by Language", "translatepress-multilingual"); ?>
27
+ <?php __("Exclude from Language", "translatepress-multilingual"); ?>
28
+ <?php __("Restrict element to language", "translatepress-multilingual"); ?>
29
+ <?php __("Show this element only in one language.", "translatepress-multilingual"); ?>
30
+ <?php __("Select language", "translatepress-multilingual"); ?>
31
+ <?php __("Choose in which language to show this element.", "translatepress-multilingual"); ?>
32
+ <?php __("Exclude element from language", "translatepress-multilingual"); ?>
33
+ <?php __("Exclude this element from specific languages.", "translatepress-multilingual"); ?>
34
+ <?php __("Select languages", "translatepress-multilingual"); ?>
35
+ <?php __("Choose from which languages to exclude this element.", "translatepress-multilingual"); ?>
36
+ <?php __("This element will still be visible when you are translating your website through the Translation Editor.", "translatepress-multilingual"); ?>
37
+ <?php __("The content of this element should be written in the default language.", "translatepress-multilingual"); ?>
38
  <?php __("<strong>TranslatePress</strong> encountered SQL errors. <a href=\"%s\" title=\"View TranslatePress SQL Errors\">Check out the errors</a>.", "translatepress-multilingual"); ?>
39
  <?php __("Automatic translation has been disabled.", "translatepress-multilingual"); ?>
40
  <?php __("Dismiss this notice.", "translatepress-multilingual"); ?>
207
  <?php __("click here", "translatepress-multilingual"); ?>
208
  <?php __("Recreated original strings table.", "translatepress-multilingual"); ?>
209
  <?php __("All individual TranslatePress add-on plugins have been discontinued and have been replaced with new Personal, Business and Developer versions of TranslatePress. Please log into the account page at <a href=\"https://translatepress.com/account/\" target=\"_blank\">translatepress.com</a> and download the new plugin and install it. Individual Add-ons will not receive updates anymore", "translatepress-multilingual"); ?>
210
+ <?php __("TranslatePress", "translatepress-multilingual"); ?>
211
  <?php __("<strong>TranslatePress</strong> requires <strong><a href=\"http://php.net/manual/en/book.mbstring.php\">Multibyte String PHP library</a></strong>. Please contact your server administrator to install it on your server.", "translatepress-multilingual"); ?>
212
  <?php __("Detected long query limitation on WPEngine hosting. Some large pages may appear untranslated. You can remove limitation by adding the following to your site’s wp-config.php: define( 'WPE_GOVERNOR', false ); ", "translatepress-multilingual"); ?>
213
+ <?php __("Custom Language Flag", "translatepress-multilingual"); ?>
214
  <?php __("TranslatePress Settings", "translatepress-multilingual"); ?>
215
  <?php __("TranslatePress Add-ons", "translatepress-multilingual"); ?>
216
  <?php __("You must first purchase this version to have access to the addon %1$shere%2$s", "translatepress-multilingual"); ?>
338
  <?php __("It disables search indexing the post content in translated languages.<br/>Useful when the content of the post doesn't allow HTML thus breaking the page.", "translatepress-multilingual"); ?>
339
  <?php __("Do not translate certain paths", "translatepress-multilingual"); ?>
340
  <?php __("Choose what paths can be translated. Supports wildcard at the end of the path.<br>For example, to exclude https://example.com/some/path you can either use the rule /some/path/ or /some/*.<br>Enter each rule on it's own line. To exclude the home page use {{home}}.", "translatepress-multilingual"); ?>
341
+ <?php __("Exclude Paths From Translation", "translatepress-multilingual"); ?>
342
+ <?php __("Translate Only Certain Paths", "translatepress-multilingual"); ?>
343
  <?php __("Automatically translate slugs", "translatepress-multilingual"); ?>
344
  <?php __("Generate automatic translations of slugs for posts, pages and Custom Post Types.<br/>Requires <a href=\"https://translatepress.com/docs/addons/seo-pack/\" title=\"TranslatePress Add-on SEO Pack documentation\" target=\"_blank\"> SEO Pack Add-on</a> to be installed and activated.<br>The slugs will be automatically translated starting with the second refresh of each page.", "translatepress-multilingual"); ?>
345
  <?php __("Enable the hreflang x-default tag for language:", "translatepress-multilingual"); ?>
409
  <?php __("To continue please type the word:", "translatepress-multilingual"); ?>
410
  <?php __("The word typed was incorrect. Action was cancelled.", "translatepress-multilingual"); ?>
411
  <?php __("in", "translatepress-multilingual"); ?>
412
+ <?php __("Warning: This action cannot be undone. Deleting a string will remove its current translation. The original string will appear again in this interface after TranslatePress detects it. This action is NOT equivalent to excluding the string from being translated again.", "translatepress-multilingual"); ?>
413
  <?php __("Navigate to next page", "translatepress-multilingual"); ?>
414
  <?php __("Navigate to previous page", "translatepress-multilingual"); ?>
415
  <?php __("Navigate to first page", "translatepress-multilingual"); ?>
446
  <?php __("Select the type of DeepL API you want to use.", "translatepress-multilingual"); ?>
447
  <?php __("DeepL API Key", "translatepress-multilingual"); ?>
448
  <?php __("Visit <a href=\"%s\" target=\"_blank\">this link</a> to see how you can set up an API key and control API costs.", "translatepress-multilingual"); ?>
 
449
  <?php __("Translator", "translatepress-multilingual"); ?>
450
+ <?php __(" TranslatePress Settings", "translatepress-multilingual"); ?>
451
  <?php __("Allow this user to translate the website.", "translatepress-multilingual"); ?>
452
  <?php __("URL Slugs Translation", "translatepress-multilingual"); ?>
453
  <?php __("Taxonomy Slugs", "translatepress-multilingual"); ?>
languages/translatepress-multilingual.pot CHANGED
@@ -33,6 +33,10 @@ msgstr ""
33
  msgid "Advanced"
34
  msgstr ""
35
 
 
 
 
 
36
  #: includes/class-advanced-tab.php:307, includes/class-error-manager.php:172, partials/machine-translation-settings-page.php:13, partials/machine-translation-settings-page.php:88, partials/machine-translation-settings-page.php:121, partials/main-settings-page.php:41, partials/main-settings-page.php:54, partials/main-settings-page.php:67
37
  msgid "Yes"
38
  msgstr ""
@@ -53,35 +57,51 @@ msgstr ""
53
  msgid "Select..."
54
  msgstr ""
55
 
56
- #: includes/class-edd-sl-plugin-updater.php:708
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  msgid "Your license key expired on %s."
58
  msgstr ""
59
 
60
- #: includes/class-edd-sl-plugin-updater.php:713
61
  msgid "Your license key has been disabled."
62
  msgstr ""
63
 
64
- #: includes/class-edd-sl-plugin-updater.php:716
65
  msgid "Invalid license."
66
  msgstr ""
67
 
68
- #: includes/class-edd-sl-plugin-updater.php:720
69
  msgid "Your license is not active for this URL."
70
  msgstr ""
71
 
72
- #: includes/class-edd-sl-plugin-updater.php:723
73
  msgid "This appears to be an invalid license key for %s."
74
  msgstr ""
75
 
76
- #: includes/class-edd-sl-plugin-updater.php:726
77
  msgid "Your license key has reached its activation limit."
78
  msgstr ""
79
 
80
- #: includes/class-edd-sl-plugin-updater.php:729, includes/class-edd-sl-plugin-updater.php:697, includes/class-edd-sl-plugin-updater.php:800
81
  msgid "An error occurred, please try again."
82
  msgstr ""
83
 
84
- #: includes/class-edd-sl-plugin-updater.php:760
85
  msgid "You have successfully activated your license"
86
  msgstr ""
87
 
@@ -89,6 +109,54 @@ msgstr ""
89
  msgid "Others"
90
  msgstr ""
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  #: includes/class-error-manager.php:50
93
  msgid "<strong>TranslatePress</strong> encountered SQL errors. <a href=\"%s\" title=\"View TranslatePress SQL Errors\">Check out the errors</a>."
94
  msgstr ""
@@ -777,14 +845,22 @@ msgstr ""
777
  msgid "All individual TranslatePress add-on plugins have been discontinued and have been replaced with new Personal, Business and Developer versions of TranslatePress. Please log into the account page at <a href=\"https://translatepress.com/account/\" target=\"_blank\">translatepress.com</a> and download the new plugin and install it. Individual Add-ons will not receive updates anymore"
778
  msgstr ""
779
 
 
 
 
 
780
  #: includes/compatibility-functions.php:28
781
  msgid "<strong>TranslatePress</strong> requires <strong><a href=\"http://php.net/manual/en/book.mbstring.php\">Multibyte String PHP library</a></strong>. Please contact your server administrator to install it on your server."
782
  msgstr ""
783
 
784
- #: includes/compatibility-functions.php:1493
785
  msgid "Detected long query limitation on WPEngine hosting. Some large pages may appear untranslated. You can remove limitation by adding the following to your site’s wp-config.php: define( 'WPE_GOVERNOR', false ); "
786
  msgstr ""
787
 
 
 
 
 
788
  #: partials/addons-settings-page.php:3, partials/license-settings-page.php:46, partials/license-settings-page.php:8, partials/main-settings-page.php:5, partials/test-api-settings-page.php:11, partials/trp-remove-duplicate-rows.php:3
789
  msgid "TranslatePress Settings"
790
  msgstr ""
@@ -893,7 +969,7 @@ msgstr ""
893
  msgid "TranslatePress Advanced Settings"
894
  msgstr ""
895
 
896
- #: partials/advanced-settings-page.php:16
897
  msgid "Save Changes"
898
  msgstr ""
899
 
@@ -1298,6 +1374,14 @@ msgstr ""
1298
  msgid "Choose what paths can be translated. Supports wildcard at the end of the path.<br>For example, to exclude https://example.com/some/path you can either use the rule /some/path/ or /some/*.<br>Enter each rule on it's own line. To exclude the home page use {{home}}."
1299
  msgstr ""
1300
 
 
 
 
 
 
 
 
 
1301
  #: includes/advanced-settings/enable-auto-translate-slug.php:8
1302
  msgid "Automatically translate slugs"
1303
  msgstr ""
@@ -1576,6 +1660,10 @@ msgctxt "Untranslated in this language"
1576
  msgid "in"
1577
  msgstr ""
1578
 
 
 
 
 
1579
  #: includes/string-translation/class-string-translation.php:233
1580
  msgid "Navigate to next page"
1581
  msgstr ""
@@ -1720,12 +1808,12 @@ msgstr ""
1720
  msgid "Visit <a href=\"%s\" target=\"_blank\">this link</a> to see how you can set up an API key and control API costs."
1721
  msgstr ""
1722
 
1723
- #: add-ons-pro/translator-accounts/includes/class-translator-accounts.php:92
1724
- msgid " TranslatePress Settings"
1725
  msgstr ""
1726
 
1727
- #: add-ons-pro/translator-accounts/includes/class-translator-accounts.php:96, add-ons-pro/translator-accounts/includes/class-translator-accounts.php:97
1728
- msgid "Translator"
1729
  msgstr ""
1730
 
1731
  #: add-ons-pro/translator-accounts/includes/class-translator-accounts.php:101
33
  msgid "Advanced"
34
  msgstr ""
35
 
36
+ #: includes/class-advanced-tab.php:178
37
+ msgid "Settings saved."
38
+ msgstr ""
39
+
40
  #: includes/class-advanced-tab.php:307, includes/class-error-manager.php:172, partials/machine-translation-settings-page.php:13, partials/machine-translation-settings-page.php:88, partials/machine-translation-settings-page.php:121, partials/main-settings-page.php:41, partials/main-settings-page.php:54, partials/main-settings-page.php:67
41
  msgid "Yes"
42
  msgstr ""
57
  msgid "Select..."
58
  msgstr ""
59
 
60
+ #: includes/class-edd-sl-plugin-updater.php:223
61
+ msgid "There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s."
62
+ msgstr ""
63
+
64
+ #: includes/class-edd-sl-plugin-updater.php:215
65
+ msgid "There is a new version of %1$s available. %2$sView version %3$s details%4$s."
66
+ msgstr ""
67
+
68
+ #: includes/class-edd-sl-plugin-updater.php:417
69
+ msgid "You do not have permission to install plugin updates"
70
+ msgstr ""
71
+
72
+ #: includes/class-edd-sl-plugin-updater.php:417
73
+ msgid "Error"
74
+ msgstr ""
75
+
76
+ #: includes/class-edd-sl-plugin-updater.php:706
77
  msgid "Your license key expired on %s."
78
  msgstr ""
79
 
80
+ #: includes/class-edd-sl-plugin-updater.php:711
81
  msgid "Your license key has been disabled."
82
  msgstr ""
83
 
84
+ #: includes/class-edd-sl-plugin-updater.php:714
85
  msgid "Invalid license."
86
  msgstr ""
87
 
88
+ #: includes/class-edd-sl-plugin-updater.php:718
89
  msgid "Your license is not active for this URL."
90
  msgstr ""
91
 
92
+ #: includes/class-edd-sl-plugin-updater.php:721
93
  msgid "This appears to be an invalid license key for %s."
94
  msgstr ""
95
 
96
+ #: includes/class-edd-sl-plugin-updater.php:724
97
  msgid "Your license key has reached its activation limit."
98
  msgstr ""
99
 
100
+ #: includes/class-edd-sl-plugin-updater.php:727, includes/class-edd-sl-plugin-updater.php:695, includes/class-edd-sl-plugin-updater.php:798
101
  msgid "An error occurred, please try again."
102
  msgstr ""
103
 
104
+ #: includes/class-edd-sl-plugin-updater.php:758
105
  msgid "You have successfully activated your license"
106
  msgstr ""
107
 
109
  msgid "Others"
110
  msgstr ""
111
 
112
+ #: includes/class-elementor-language-for-blocks.php:91
113
+ msgid "Restrict by Language"
114
+ msgstr ""
115
+
116
+ #: includes/class-elementor-language-for-blocks.php:109, includes/class-wp-bakery-language-for-blocks.php:138
117
+ msgid "Exclude from Language"
118
+ msgstr ""
119
+
120
+ #: includes/class-elementor-language-for-blocks.php:124, includes/class-wp-bakery-language-for-blocks.php:98
121
+ msgid "Restrict element to language"
122
+ msgstr ""
123
+
124
+ #: includes/class-elementor-language-for-blocks.php:126, includes/class-wp-bakery-language-for-blocks.php:101
125
+ msgid "Show this element only in one language."
126
+ msgstr ""
127
+
128
+ #: includes/class-elementor-language-for-blocks.php:132, includes/class-wp-bakery-language-for-blocks.php:106
129
+ msgid "Select language"
130
+ msgstr ""
131
+
132
+ #: includes/class-elementor-language-for-blocks.php:149, includes/class-wp-bakery-language-for-blocks.php:110
133
+ msgid "Choose in which language to show this element."
134
+ msgstr ""
135
+
136
+ #: includes/class-elementor-language-for-blocks.php:161
137
+ msgid "Exclude element from language"
138
+ msgstr ""
139
+
140
+ #: includes/class-elementor-language-for-blocks.php:163, includes/class-wp-bakery-language-for-blocks.php:141
141
+ msgid "Exclude this element from specific languages."
142
+ msgstr ""
143
+
144
+ #: includes/class-elementor-language-for-blocks.php:169, includes/class-wp-bakery-language-for-blocks.php:158
145
+ msgid "Select languages"
146
+ msgstr ""
147
+
148
+ #: includes/class-elementor-language-for-blocks.php:187, includes/class-wp-bakery-language-for-blocks.php:162
149
+ msgid "Choose from which languages to exclude this element."
150
+ msgstr ""
151
+
152
+ #: includes/class-elementor-language-for-blocks.php:191, includes/class-wp-bakery-language-for-blocks.php:146
153
+ msgid "This element will still be visible when you are translating your website through the Translation Editor."
154
+ msgstr ""
155
+
156
+ #: includes/class-elementor-language-for-blocks.php:192, includes/class-wp-bakery-language-for-blocks.php:153
157
+ msgid "The content of this element should be written in the default language."
158
+ msgstr ""
159
+
160
  #: includes/class-error-manager.php:50
161
  msgid "<strong>TranslatePress</strong> encountered SQL errors. <a href=\"%s\" title=\"View TranslatePress SQL Errors\">Check out the errors</a>."
162
  msgstr ""
845
  msgid "All individual TranslatePress add-on plugins have been discontinued and have been replaced with new Personal, Business and Developer versions of TranslatePress. Please log into the account page at <a href=\"https://translatepress.com/account/\" target=\"_blank\">translatepress.com</a> and download the new plugin and install it. Individual Add-ons will not receive updates anymore"
846
  msgstr ""
847
 
848
+ #: includes/class-wp-bakery-language-for-blocks.php:179
849
+ msgid "TranslatePress"
850
+ msgstr ""
851
+
852
  #: includes/compatibility-functions.php:28
853
  msgid "<strong>TranslatePress</strong> requires <strong><a href=\"http://php.net/manual/en/book.mbstring.php\">Multibyte String PHP library</a></strong>. Please contact your server administrator to install it on your server."
854
  msgstr ""
855
 
856
+ #: includes/compatibility-functions.php:1494
857
  msgid "Detected long query limitation on WPEngine hosting. Some large pages may appear untranslated. You can remove limitation by adding the following to your site’s wp-config.php: define( 'WPE_GOVERNOR', false ); "
858
  msgstr ""
859
 
860
+ #: includes/custom-language.php:8
861
+ msgid "Custom Language Flag"
862
+ msgstr ""
863
+
864
  #: partials/addons-settings-page.php:3, partials/license-settings-page.php:46, partials/license-settings-page.php:8, partials/main-settings-page.php:5, partials/test-api-settings-page.php:11, partials/trp-remove-duplicate-rows.php:3
865
  msgid "TranslatePress Settings"
866
  msgstr ""
969
  msgid "TranslatePress Advanced Settings"
970
  msgstr ""
971
 
972
+ #: partials/advanced-settings-page.php:16, partials/machine-translation-settings-page.php:132, partials/main-settings-page.php:123
973
  msgid "Save Changes"
974
  msgstr ""
975
 
1374
  msgid "Choose what paths can be translated. Supports wildcard at the end of the path.<br>For example, to exclude https://example.com/some/path you can either use the rule /some/path/ or /some/*.<br>Enter each rule on it's own line. To exclude the home page use {{home}}."
1375
  msgstr ""
1376
 
1377
+ #: includes/advanced-settings/do-not-translate-certain-paths.php:30
1378
+ msgid "Exclude Paths From Translation"
1379
+ msgstr ""
1380
+
1381
+ #: includes/advanced-settings/do-not-translate-certain-paths.php:35
1382
+ msgid "Translate Only Certain Paths"
1383
+ msgstr ""
1384
+
1385
  #: includes/advanced-settings/enable-auto-translate-slug.php:8
1386
  msgid "Automatically translate slugs"
1387
  msgstr ""
1660
  msgid "in"
1661
  msgstr ""
1662
 
1663
+ #: includes/string-translation/class-string-translation.php:230
1664
+ msgid "Warning: This action cannot be undone. Deleting a string will remove its current translation. The original string will appear again in this interface after TranslatePress detects it. This action is NOT equivalent to excluding the string from being translated again."
1665
+ msgstr ""
1666
+
1667
  #: includes/string-translation/class-string-translation.php:233
1668
  msgid "Navigate to next page"
1669
  msgstr ""
1808
  msgid "Visit <a href=\"%s\" target=\"_blank\">this link</a> to see how you can set up an API key and control API costs."
1809
  msgstr ""
1810
 
1811
+ #: add-ons-pro/translator-accounts/includes/class-translator-accounts-activator.php:30, add-ons-pro/translator-accounts/includes/class-translator-accounts.php:96, add-ons-pro/translator-accounts/includes/class-translator-accounts.php:97
1812
+ msgid "Translator"
1813
  msgstr ""
1814
 
1815
+ #: add-ons-pro/translator-accounts/includes/class-translator-accounts.php:92
1816
+ msgid " TranslatePress Settings"
1817
  msgstr ""
1818
 
1819
  #: add-ons-pro/translator-accounts/includes/class-translator-accounts.php:101
partials/error-manager-page.php CHANGED
@@ -5,7 +5,7 @@
5
  if ( $page_output === '' ){
6
  $page_output = esc_html__('There are no logged errors.', 'translatepress-multilingual');
7
  }
8
- echo $page_output;
9
 
10
  ?>
11
 
5
  if ( $page_output === '' ){
6
  $page_output = esc_html__('There are no logged errors.', 'translatepress-multilingual');
7
  }
8
+ echo esc_html( $page_output );
9
 
10
  ?>
11
 
partials/language-switcher-shortcode.php CHANGED
@@ -5,13 +5,13 @@ $current_language_preference = $this->add_shortcode_preferences($shortcode_setti
5
  <div class="trp-language-switcher trp-language-switcher-container" data-no-translation <?php echo ( isset( $_GET['trp-edit-translation'] ) && $_GET['trp-edit-translation'] == 'preview' ) ? 'data-trp-unpreviewable="trp-unpreviewable"' : '' ?>>
6
  <div class="trp-ls-shortcode-current-language">
7
  <a href="#" class="trp-ls-shortcode-disabled-language trp-ls-disabled-language" title="<?php echo esc_attr( $current_language['name'] ); ?>" onclick="event.preventDefault()">
8
- <?php echo $current_language_preference; // WPCS: ok. ?>
9
  </a>
10
  </div>
11
  <div class="trp-ls-shortcode-language">
12
  <?php if ( apply_filters('trp_ls_shortcode_show_disabled_language', true, $current_language, $current_language_preference, $this->settings ) ){ ?>
13
  <a href="#" class="trp-ls-shortcode-disabled-language trp-ls-disabled-language" title="<?php echo esc_attr( $current_language['name'] ); ?>" onclick="event.preventDefault()">
14
- <?php echo $current_language_preference; // WPCS: ok. ?>
15
  </a>
16
  <?php } ?>
17
  <?php foreach ( $other_languages as $code => $name ){
@@ -19,7 +19,7 @@ $current_language_preference = $this->add_shortcode_preferences($shortcode_setti
19
  $language_preference = $this->add_shortcode_preferences($shortcode_settings, $code, $name);
20
  ?>
21
  <a href="<?php echo esc_url( $this->url_converter->get_url_for_language($code, false) ); ?>" title="<?php echo esc_attr( $name ); ?>">
22
- <?php echo $language_preference; // WPCS: ok. ?>
23
  </a>
24
 
25
  <?php } ?>
5
  <div class="trp-language-switcher trp-language-switcher-container" data-no-translation <?php echo ( isset( $_GET['trp-edit-translation'] ) && $_GET['trp-edit-translation'] == 'preview' ) ? 'data-trp-unpreviewable="trp-unpreviewable"' : '' ?>>
6
  <div class="trp-ls-shortcode-current-language">
7
  <a href="#" class="trp-ls-shortcode-disabled-language trp-ls-disabled-language" title="<?php echo esc_attr( $current_language['name'] ); ?>" onclick="event.preventDefault()">
8
+ <?php echo $current_language_preference; /* phpcs:ignore */ /* escaped inside the function that generates the output */ ?>
9
  </a>
10
  </div>
11
  <div class="trp-ls-shortcode-language">
12
  <?php if ( apply_filters('trp_ls_shortcode_show_disabled_language', true, $current_language, $current_language_preference, $this->settings ) ){ ?>
13
  <a href="#" class="trp-ls-shortcode-disabled-language trp-ls-disabled-language" title="<?php echo esc_attr( $current_language['name'] ); ?>" onclick="event.preventDefault()">
14
+ <?php echo $current_language_preference; /* phpcs:ignore */ /* escaped inside the function that generates the output */ ?>
15
  </a>
16
  <?php } ?>
17
  <?php foreach ( $other_languages as $code => $name ){
19
  $language_preference = $this->add_shortcode_preferences($shortcode_settings, $code, $name);
20
  ?>
21
  <a href="<?php echo esc_url( $this->url_converter->get_url_for_language($code, false) ); ?>" title="<?php echo esc_attr( $name ); ?>">
22
+ <?php echo $language_preference; /* phpcs:ignore */ /* escaped inside the function that generates the output */ ?>
23
  </a>
24
 
25
  <?php } ?>
partials/license-settings-page.php CHANGED
@@ -3,28 +3,28 @@ $trp = TRP_Translate_Press::get_trp_instance();
3
  if( !empty( $trp->active_pro_addons ) ){//if we have any Advanced or Pro addons active then show the license key activation form
4
  ?>
5
  <div id="trp-license-settings" class="wrap">
6
- <form method="post" action="<?php echo $action; ?>">
7
  <?php settings_fields( 'trp_license_key' ); ?>
8
- <h1> <?php _e( 'TranslatePress Settings', 'translatepress-multilingual' );?></h1>
9
  <?php do_action ( 'trp_settings_navigation_tabs' ); ?>
10
  <table class="form-table">
11
  <tbody>
12
  <tr valign="top">
13
  <th scope="row" valign="top">
14
- <?php _e('License Key', 'translatepress-multilingual'); ?>
15
  </th>
16
  <td>
17
  <div>
18
- <input id="trp_license_key" name="trp_license_key" type="password" class="regular-text" value="<?php esc_attr_e( $license ); ?>" />
19
  <?php wp_nonce_field( 'trp_license_nonce', 'trp_license_nonce' ); ?>
20
  <?php if( $status !== false && $status == 'valid' ) {
21
  $button_name = 'trp_edd_license_deactivate';
22
  $button_value = __('Deactivate License', 'translatepress-multilingual' );
23
 
24
  if( empty( $details['invalid'] ) )
25
- echo '<span title="'.__( 'Active on this site', 'translatepress-multilingual' ) .'" class="trp-active-license dashicons dashicons-yes"></span>';
26
  else
27
- echo '<span title="'.__( 'Your license is invalid', 'translatepress-multilingual' ) .'" class="trp-invalid-license dashicons dashicons-warning"></span>';
28
 
29
  }
30
  else {
@@ -32,10 +32,10 @@ if( !empty( $trp->active_pro_addons ) ){//if we have any Advanced or Pro addons
32
  $button_value = __('Activate License', 'translatepress-multilingual');
33
  }
34
  ?>
35
- <input type="submit" class="button-secondary" name="<?php echo $button_name; ?>" value="<?php echo $button_value; ?>"/>
36
  </div>
37
  <p class="description">
38
- <?php _e( 'Enter your license key.', 'translatepress-multilingual' ); ?>
39
  </p>
40
  </td>
41
  </tbody>
@@ -43,7 +43,7 @@ if( !empty( $trp->active_pro_addons ) ){//if we have any Advanced or Pro addons
43
  </form>
44
  </div>
45
  <?php } else{ ?>
46
- <h1> <?php _e( 'TranslatePress Settings', 'translatepress-multilingual' );?></h1>
47
  <?php do_action ( 'trp_settings_navigation_tabs' ); ?>
48
- <h4><?php printf( __( 'If you purchased a premium version, first install and activate any of the <a href="%s">Advanced or Pro Addons</a>. After this you will be prompted with an input to enter your license key.', 'translatepress-multilingual' ), admin_url('/admin.php?page=trp_addons_page') ); ?></h4>
49
  <?php } ?>
3
  if( !empty( $trp->active_pro_addons ) ){//if we have any Advanced or Pro addons active then show the license key activation form
4
  ?>
5
  <div id="trp-license-settings" class="wrap">
6
+ <form method="post" action="<?php echo esc_attr( $action ); ?>">
7
  <?php settings_fields( 'trp_license_key' ); ?>
8
+ <h1> <?php esc_html_e( 'TranslatePress Settings', 'translatepress-multilingual' );?></h1>
9
  <?php do_action ( 'trp_settings_navigation_tabs' ); ?>
10
  <table class="form-table">
11
  <tbody>
12
  <tr valign="top">
13
  <th scope="row" valign="top">
14
+ <?php esc_html_e('License Key', 'translatepress-multilingual'); ?>
15
  </th>
16
  <td>
17
  <div>
18
+ <input id="trp_license_key" name="trp_license_key" type="password" class="regular-text" value="<?php echo esc_attr( $license ); ?>" />
19
  <?php wp_nonce_field( 'trp_license_nonce', 'trp_license_nonce' ); ?>
20
  <?php if( $status !== false && $status == 'valid' ) {
21
  $button_name = 'trp_edd_license_deactivate';
22
  $button_value = __('Deactivate License', 'translatepress-multilingual' );
23
 
24
  if( empty( $details['invalid'] ) )
25
+ echo '<span title="'. esc_html__( 'Active on this site', 'translatepress-multilingual' ) .'" class="trp-active-license dashicons dashicons-yes"></span>';
26
  else
27
+ echo '<span title="'. esc_html__( 'Your license is invalid', 'translatepress-multilingual' ) .'" class="trp-invalid-license dashicons dashicons-warning"></span>';
28
 
29
  }
30
  else {
32
  $button_value = __('Activate License', 'translatepress-multilingual');
33
  }
34
  ?>
35
+ <input type="submit" class="button-secondary" name="<?php echo esc_attr( $button_name ); ?>" value="<?php echo esc_attr( $button_value ); ?>"/>
36
  </div>
37
  <p class="description">
38
+ <?php esc_html_e( 'Enter your license key.', 'translatepress-multilingual' ); ?>
39
  </p>
40
  </td>
41
  </tbody>
43
  </form>
44
  </div>
45
  <?php } else{ ?>
46
+ <h1> <?php esc_html_e( 'TranslatePress Settings', 'translatepress-multilingual' );?></h1>
47
  <?php do_action ( 'trp_settings_navigation_tabs' ); ?>
48
+ <h4><?php printf( __( 'If you purchased a premium version, first install and activate any of the <a href="%s">Advanced or Pro Addons</a>. After this you will be prompted with an input to enter your license key.', 'translatepress-multilingual' ), admin_url('/admin.php?page=trp_addons_page') ); //phpcs:ignore ?></h4>
49
  <?php } ?>
partials/machine-translation-settings-page.php CHANGED
@@ -14,7 +14,7 @@
14
  </select>
15
 
16
  <p class="description">
17
- <?php _e( 'Enable or disable the automatic translation of the site. To minimize translation costs, each untranslated string is automatically translated only once, then stored in the database.', 'translatepress-multilingual' ) ?>
18
  </p>
19
  </td>
20
  </tr>
@@ -27,12 +27,12 @@
27
  <?php foreach( $translation_engines as $engine ) : ?>
28
  <label for="trp-translation-engine-<?= esc_attr( $engine['value'] ) ?>" style="margin-right:10px;">
29
  <input type="radio" class="trp-translation-engine trp-radio" id="trp-translation-engine-<?= esc_attr( $engine['value'] ) ?>" name="trp_machine_translation_settings[translation-engine]" value="<?= esc_attr( $engine['value'] ) ?>" <?php checked( $this->settings['trp_machine_translation_settings']['translation-engine'], $engine['value'] ); ?>>
30
- <?= $engine['label'] ?>
31
  </label>
32
  <?php endforeach; ?>
33
 
34
  <p class="description">
35
- <?php _e( 'Choose which engine you want to use in order to automatically translate your website.', 'translatepress-multilingual' ) ?>
36
  </p>
37
  </td>
38
  </tr>
@@ -70,9 +70,9 @@
70
  <tr id="trp-test-api-key">
71
  <th scope="row"></th>
72
  <td>
73
- <a href="<?php echo esc_url( admin_url( 'admin.php?page=trp_test_machine_api' ) ); ?>" class="button-secondary"><?php _e( 'Test API credentials', 'translatepress-multilingual' ); ?></a>
74
  <p class="description">
75
- <?php _e( 'Click here to check if the selected translation engine is configured correctly.', 'translatepress-multilingual' ) ?>
76
  </p>
77
  </td>
78
  </tr>
@@ -85,7 +85,7 @@
85
  <td>
86
  <label>
87
  <input type=checkbox name="trp_machine_translation_settings[block-crawlers]" value="yes" <?php isset( $this->settings['trp_machine_translation_settings']['block-crawlers'] ) ? checked( $this->settings['trp_machine_translation_settings']['block-crawlers'], 'yes' ) : checked( '', 'yes' ); ?>>
88
- <?php _e( 'Yes' , 'translatepress-multilingual' ); ?>
89
  </label>
90
  <p class="description">
91
  <?php esc_html_e( 'Block crawlers from triggering automatic translations on your website.', 'translatepress-multilingual' ); ?>
@@ -97,7 +97,7 @@
97
  <th scope="row"><?php esc_html_e( 'Limit machine translation / characters per day', 'translatepress-multilingual' ); ?></th>
98
  <td>
99
  <label>
100
- <input type="number" name="trp_machine_translation_settings[machine_translation_limit]" value="<?php echo isset( $this->settings['trp_machine_translation_settings']['machine_translation_limit'] ) ? $this->settings['trp_machine_translation_settings']['machine_translation_limit'] : 1000000; ?>">
101
  </label>
102
  <p class="description">
103
  <?php esc_html_e( 'Add a limit to the number of automatically translated characters so you can better budget your project.', 'translatepress-multilingual' ); ?>
@@ -108,8 +108,8 @@
108
  <tr>
109
  <th scope="row"><?php esc_html_e( 'Today\'s character count:', 'translatepress-multilingual' ); ?></th>
110
  <td>
111
- <strong><?php echo isset( $this->settings['trp_machine_translation_settings']['machine_translation_counter'] ) ? $this->settings['trp_machine_translation_settings']['machine_translation_counter'] : 0; ?></strong>
112
- (<?php echo isset( $this->settings['trp_machine_translation_settings']['machine_translation_counter_date'] ) ? $this->settings['trp_machine_translation_settings']['machine_translation_counter_date'] : date('Y-m-d'); ?>)
113
  </td>
114
  </tr>
115
 
@@ -118,7 +118,7 @@
118
  <td>
119
  <label>
120
  <input type=checkbox name="trp_machine_translation_settings[machine_translation_log]" value="yes" <?php isset( $this->settings['trp_machine_translation_settings']['machine_translation_log'] ) ? checked( $this->settings['trp_machine_translation_settings']['machine_translation_log'], 'yes' ) : checked( '', 'yes' ); ?>>
121
- <?php _e( 'Yes' , 'translatepress-multilingual' ); ?>
122
  </label>
123
  <p class="description">
124
  <?php echo wp_kses( __( 'Only enable for testing purposes. Can impact performance.<br>All records are stored in the wp_trp_machine_translation_log database table. Use a plugin like <a href="https://wordpress.org/plugins/wp-data-access/">WP Data Access</a> to browse the logs or directly from your database manager (PHPMyAdmin, etc.)', 'translatepress-multilingual' ), array( 'br' => array(), 'a' => array( 'href' => array(), 'title' => array(), 'target' => array() ) ) ); ?>
@@ -129,6 +129,6 @@
129
  <?php do_action ( 'trp_machine_translation_extra_settings_bottom', $this->settings['trp_machine_translation_settings'] ); ?>
130
  </table>
131
 
132
- <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save Changes' ); ?>" /></p>
133
  </form>
134
  </div>
14
  </select>
15
 
16
  <p class="description">
17
+ <?php esc_html_e( 'Enable or disable the automatic translation of the site. To minimize translation costs, each untranslated string is automatically translated only once, then stored in the database.', 'translatepress-multilingual' ) ?>
18
  </p>
19
  </td>
20
  </tr>
27
  <?php foreach( $translation_engines as $engine ) : ?>
28
  <label for="trp-translation-engine-<?= esc_attr( $engine['value'] ) ?>" style="margin-right:10px;">
29
  <input type="radio" class="trp-translation-engine trp-radio" id="trp-translation-engine-<?= esc_attr( $engine['value'] ) ?>" name="trp_machine_translation_settings[translation-engine]" value="<?= esc_attr( $engine['value'] ) ?>" <?php checked( $this->settings['trp_machine_translation_settings']['translation-engine'], $engine['value'] ); ?>>
30
+ <?php echo esc_html( $engine['label'] ) ?>
31
  </label>
32
  <?php endforeach; ?>
33
 
34
  <p class="description">
35
+ <?php esc_html_e( 'Choose which engine you want to use in order to automatically translate your website.', 'translatepress-multilingual' ) ?>
36
  </p>
37
  </td>
38
  </tr>
70
  <tr id="trp-test-api-key">
71
  <th scope="row"></th>
72
  <td>
73
+ <a href="<?php echo esc_url( admin_url( 'admin.php?page=trp_test_machine_api' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Test API credentials', 'translatepress-multilingual' ); ?></a>
74
  <p class="description">
75
+ <?php esc_html_e( 'Click here to check if the selected translation engine is configured correctly.', 'translatepress-multilingual' ) ?>
76
  </p>
77
  </td>
78
  </tr>
85
  <td>
86
  <label>
87
  <input type=checkbox name="trp_machine_translation_settings[block-crawlers]" value="yes" <?php isset( $this->settings['trp_machine_translation_settings']['block-crawlers'] ) ? checked( $this->settings['trp_machine_translation_settings']['block-crawlers'], 'yes' ) : checked( '', 'yes' ); ?>>
88
+ <?php esc_html_e( 'Yes' , 'translatepress-multilingual' ); ?>
89
  </label>
90
  <p class="description">
91
  <?php esc_html_e( 'Block crawlers from triggering automatic translations on your website.', 'translatepress-multilingual' ); ?>
97
  <th scope="row"><?php esc_html_e( 'Limit machine translation / characters per day', 'translatepress-multilingual' ); ?></th>
98
  <td>
99
  <label>
100
+ <input type="number" name="trp_machine_translation_settings[machine_translation_limit]" value="<?php echo isset( $this->settings['trp_machine_translation_settings']['machine_translation_limit'] ) ? esc_attr( $this->settings['trp_machine_translation_settings']['machine_translation_limit'] ) : 1000000; ?>">
101
  </label>
102
  <p class="description">
103
  <?php esc_html_e( 'Add a limit to the number of automatically translated characters so you can better budget your project.', 'translatepress-multilingual' ); ?>
108
  <tr>
109
  <th scope="row"><?php esc_html_e( 'Today\'s character count:', 'translatepress-multilingual' ); ?></th>
110
  <td>
111
+ <strong><?php echo isset( $this->settings['trp_machine_translation_settings']['machine_translation_counter'] ) ? esc_html( $this->settings['trp_machine_translation_settings']['machine_translation_counter'] ) : 0; ?></strong>
112
+ (<?php echo isset( $this->settings['trp_machine_translation_settings']['machine_translation_counter_date'] ) ? esc_html( $this->settings['trp_machine_translation_settings']['machine_translation_counter_date'] ) : esc_html( date('Y-m-d') ); ?>)
113
  </td>
114
  </tr>
115
 
118
  <td>
119
  <label>
120
  <input type=checkbox name="trp_machine_translation_settings[machine_translation_log]" value="yes" <?php isset( $this->settings['trp_machine_translation_settings']['machine_translation_log'] ) ? checked( $this->settings['trp_machine_translation_settings']['machine_translation_log'], 'yes' ) : checked( '', 'yes' ); ?>>
121
+ <?php esc_html_e( 'Yes' , 'translatepress-multilingual' ); ?>
122
  </label>
123
  <p class="description">
124
  <?php echo wp_kses( __( 'Only enable for testing purposes. Can impact performance.<br>All records are stored in the wp_trp_machine_translation_log database table. Use a plugin like <a href="https://wordpress.org/plugins/wp-data-access/">WP Data Access</a> to browse the logs or directly from your database manager (PHPMyAdmin, etc.)', 'translatepress-multilingual' ), array( 'br' => array(), 'a' => array( 'href' => array(), 'title' => array(), 'target' => array() ) ) ); ?>
129
  <?php do_action ( 'trp_machine_translation_extra_settings_bottom', $this->settings['trp_machine_translation_settings'] ); ?>
130
  </table>
131
 
132
+ <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save Changes', 'translatepress-multilingual' ); ?>" /></p>
133
  </form>
134
  </div>
partials/main-settings-page.php CHANGED
@@ -93,7 +93,7 @@
93
  <?php
94
  $link_start = '<a href="' . esc_url( admin_url( 'nav-menus.php' ) ) .'">';
95
  $link_end = '</a>';
96
- printf( wp_kses( __( 'Go to %1$s Appearance -> Menus%2$s to add languages to the Language Switcher in any menu.', 'translatepress-multilingual' ), [ 'a' => [ 'href' => [] ] ] ), $link_start, $link_end ); ?>
97
  <a href="https://translatepress.com/docs/settings/#language-switcher"><?php esc_html_e( 'Learn more in our documentation.', 'translatepress-multilingual' ); ?></a>
98
  </p>
99
  </div>
@@ -120,6 +120,6 @@
120
  <?php do_action ( 'trp_extra_settings', $this->settings ); ?>
121
  </table>
122
 
123
- <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save Changes' ); ?>" /></p>
124
  </form>
125
  </div>
93
  <?php
94
  $link_start = '<a href="' . esc_url( admin_url( 'nav-menus.php' ) ) .'">';
95
  $link_end = '</a>';
96
+ printf( wp_kses( __( 'Go to %1$s Appearance -> Menus%2$s to add languages to the Language Switcher in any menu.', 'translatepress-multilingual' ), [ 'a' => [ 'href' => [] ] ] ), $link_start, $link_end ); //phpcs:ignore ?>
97
  <a href="https://translatepress.com/docs/settings/#language-switcher"><?php esc_html_e( 'Learn more in our documentation.', 'translatepress-multilingual' ); ?></a>
98
  </p>
99
  </div>
120
  <?php do_action ( 'trp_extra_settings', $this->settings ); ?>
121
  </table>
122
 
123
+ <p class="submit"><input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save Changes', 'translatepress-multilingual' ); ?>" /></p>
124
  </form>
125
  </div>
partials/test-api-settings-page.php CHANGED
@@ -14,7 +14,7 @@ $api_key = $machine_translator->get_api_key();
14
  <div class="grid feat-header">
15
  <div class="grid-cell">
16
  <?php if( $api_key != false ) : ?>
17
- <h2><?php esc_html_e('API Key from settings page:', 'translatepress-multilingual');?> <span style="font-family:monospace"><?php echo $api_key; ?></span></h2>
18
  <?php endif; ?>
19
 
20
  <h2><?php esc_html_e('HTTP Referrer:', 'translatepress-multilingual');?> <span style="font-family:monospace"><?php echo esc_url( $machine_translator->get_referer() ); ?></span></h2>
14
  <div class="grid feat-header">
15
  <div class="grid-cell">
16
  <?php if( $api_key != false ) : ?>
17
+ <h2><?php esc_html_e('API Key from settings page:', 'translatepress-multilingual');?> <span style="font-family:monospace"><?php echo esc_html( $api_key ); ?></span></h2>
18
  <?php endif; ?>
19
 
20
  <h2><?php esc_html_e('HTTP Referrer:', 'translatepress-multilingual');?> <span style="font-family:monospace"><?php echo esc_url( $machine_translator->get_referer() ); ?></span></h2>
partials/trp-remove-duplicate-rows.php CHANGED
@@ -21,7 +21,7 @@
21
  </td>
22
  </tr>
23
  </table>
24
- <input type="hidden" name="trp_rm_nonce" value="<?php echo wp_create_nonce('tpremoveduplicaterows')?>">
25
  <input type="hidden" name="page" value="trp_remove_duplicate_rows">
26
  <input type="hidden" name="trp_rm_batch" value="1">
27
  <input type="hidden" name="trp_rm_duplicates" value="<?php echo esc_attr( $this->settings['translation-languages'][0] ); ?>">
21
  </td>
22
  </tr>
23
  </table>
24
+ <input type="hidden" name="trp_rm_nonce" value="<?php echo esc_attr( wp_create_nonce('tpremoveduplicaterows') )?>">
25
  <input type="hidden" name="page" value="trp_remove_duplicate_rows">
26
  <input type="hidden" name="trp_rm_batch" value="1">
27
  <input type="hidden" name="trp_rm_duplicates" value="<?php echo esc_attr( $this->settings['translation-languages'][0] ); ?>">
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: translate, translation, multilingual, automatic translation, bilingual, fr
5
  Requires at least: 3.1.0
6
  Tested up to: 5.8
7
  Requires PHP: 5.6.20
8
- Stable tag: 2.0.6
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -140,6 +140,17 @@ For more information please check out our [documentation](https://translatepress
140
 
141
 
142
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
143
  = 2.0.6 =
144
  * Added support for translating form reset button
145
  * Fixed custom flags getting resized
5
  Requires at least: 3.1.0
6
  Tested up to: 5.8
7
  Requires PHP: 5.6.20
8
+ Stable tag: 2.0.7
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
140
 
141
 
142
  == Changelog ==
143
+ = 2.0.7 =
144
+ * Security improvements
145
+ * Added support for WooCommerce /shop/%product_cat% product permalink structure
146
+ * Fixed URL issues with post category when using encoded characters
147
+ * Fixed an issue with Woocommerce product links not being translated when loaded with ajax
148
+ * Fixed notices when using WP Bakery
149
+ * Fixed excerpt character limit in Chinese language
150
+ * Fixed some cases of trimming custom language name in language switcher
151
+ * Fixed adding current-menu-item class on empty menu links
152
+ * Compatibility with Brizy to load correct assets on other languages
153
+
154
  = 2.0.6 =
155
  * Added support for translating form reset button
156
  * Fixed custom flags getting resized