TranslatePress – Translate Multilingual sites - Version 1.3.5

Version Description

  • Fixed translation problems introduced in the last two versions
  • Added a console message when trp-ajax request uses fall back to admin ajax for debugging purposes.
Download this release

Release Info

Developer madalin.ungureanu
Plugin Icon 128x128 TranslatePress – Translate Multilingual sites
Version 1.3.5
Comparing to
See all releases

Code changes from version 1.3.4 to 1.3.5

assets/js/trp-translate-dom-changes.js CHANGED
@@ -32,6 +32,7 @@ function TRP_Translator(){
32
  success: function( response ) {
33
  if ( response === 'error' ) {
34
  _this.ajax_get_translation( strings_to_query, wp_ajax_url );
 
35
  }else{
36
  _this.update_strings( response, strings_to_query );
37
  //window.parent.jQuery('#trp-preview-iframe').trigger('load');
@@ -40,6 +41,7 @@ function TRP_Translator(){
40
  error: function( errorThrown ){
41
  if ( url == ajax_url ){
42
  _this.ajax_get_translation( strings_to_query, wp_ajax_url );
 
43
  }else{
44
  _this.update_strings( null, strings_to_query );
45
  console.log( 'TranslatePress AJAX Request Error' );
32
  success: function( response ) {
33
  if ( response === 'error' ) {
34
  _this.ajax_get_translation( strings_to_query, wp_ajax_url );
35
+ console.log( 'Notice: TranslatePress trp-ajax request uses fall back to admin ajax.' );
36
  }else{
37
  _this.update_strings( response, strings_to_query );
38
  //window.parent.jQuery('#trp-preview-iframe').trigger('load');
41
  error: function( errorThrown ){
42
  if ( url == ajax_url ){
43
  _this.ajax_get_translation( strings_to_query, wp_ajax_url );
44
+ console.log( 'Notice: TranslatePress trp-ajax request uses fall back to admin ajax.' );
45
  }else{
46
  _this.update_strings( null, strings_to_query );
47
  console.log( 'TranslatePress AJAX Request Error' );
class-translate-press.php CHANGED
@@ -40,7 +40,7 @@ class TRP_Translate_Press{
40
  define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
41
  define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
42
  define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
43
- define( 'TRP_PLUGIN_VERSION', '1.3.4' );
44
 
45
  $this->load_dependencies();
46
  $this->initialize_components();
40
  define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
41
  define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
42
  define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
43
+ define( 'TRP_PLUGIN_VERSION', '1.3.5' );
44
 
45
  $this->load_dependencies();
46
  $this->initialize_components();
includes/class-translation-render.php CHANGED
@@ -526,14 +526,17 @@ class TRP_Translation_Render{
526
  && $row->parent()->tag != 'title'
527
  && strpos($row->outertext,'[vc_') === false )
528
  {
 
529
  array_push( $translateable_strings, $this->full_trim( $row->outertext ) );
530
  if( $row->parent()->tag == 'button') {
531
  array_push($nodes, array('node' => $row, 'type' => 'button'));
532
  }
533
- if( $row->parent()->tag == 'option') {
534
- array_push($nodes, array('node' => $row, 'type' => 'option'));
535
- }else{
536
- array_push($nodes, array('node' => $row, 'type' => 'text'));
 
 
537
  }
538
  }
539
  }
526
  && $row->parent()->tag != 'title'
527
  && strpos($row->outertext,'[vc_') === false )
528
  {
529
+ // $translateable_strings array needs to be in sync in $nodes array
530
  array_push( $translateable_strings, $this->full_trim( $row->outertext ) );
531
  if( $row->parent()->tag == 'button') {
532
  array_push($nodes, array('node' => $row, 'type' => 'button'));
533
  }
534
+ else {
535
+ if ( $row->parent()->tag == 'option' ) {
536
+ array_push( $nodes, array( 'node' => $row, 'type' => 'option' ) );
537
+ } else {
538
+ array_push( $nodes, array( 'node' => $row, 'type' => 'text' ) );
539
+ }
540
  }
541
  }
542
  }
includes/trp-ajax.php CHANGED
@@ -23,7 +23,11 @@ class TRP_Ajax{
23
 
24
  if ( $this->connect_to_db() ){
25
 
26
- $this->output_translations( $this->sanitize_strings( $_POST['strings'] ), mysqli_real_escape_string(filter_var( $_POST['language'], FILTER_SANITIZE_STRING), $this->connection), mysqli_real_escape_string(filter_var( $_POST['language'], FILTER_SANITIZE_STRING ), $this->connection));
 
 
 
 
27
  //Successful connection to DB
28
  mysqli_close($this->connection);
29
  }else{
@@ -46,7 +50,7 @@ class TRP_Ajax{
46
  if ( is_array( $strings ) ) {
47
  foreach ($strings as $key => $string) {
48
  if ( isset($string->original ) ) {
49
- $original_array[$key] = mysqli_real_escape_string(filter_var( $string->original, FILTER_SANITIZE_STRING ), $this->connection);
50
  }
51
  }
52
  }
23
 
24
  if ( $this->connect_to_db() ){
25
 
26
+ $this->output_translations(
27
+ $this->sanitize_strings( $_POST['strings'] ),
28
+ mysqli_real_escape_string( $this->connection, filter_var( $_POST['language'], FILTER_SANITIZE_STRING ) ),
29
+ mysqli_real_escape_string( $this->connection, filter_var( $_POST['original_language'], FILTER_SANITIZE_STRING ) )
30
+ );
31
  //Successful connection to DB
32
  mysqli_close($this->connection);
33
  }else{
50
  if ( is_array( $strings ) ) {
51
  foreach ($strings as $key => $string) {
52
  if ( isset($string->original ) ) {
53
+ $original_array[$key] = mysqli_real_escape_string( $this->connection, filter_var( $string->original, FILTER_SANITIZE_STRING ) );
54
  }
55
  }
56
  }
index.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: TranslatePress - Multilingual
4
  Plugin URI: https://translatepress.com/
5
  Description: Experience a better way of translating your WordPress site, with full support for WooCommerce and site builders.
6
- Version: 1.3.4
7
  Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
8
  Author URI: https://cozmoslabs.com/
9
  Text Domain: translatepress-multilingual
3
  Plugin Name: TranslatePress - Multilingual
4
  Plugin URI: https://translatepress.com/
5
  Description: Experience a better way of translating your WordPress site, with full support for WooCommerce and site builders.
6
+ Version: 1.3.5
7
  Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
8
  Author URI: https://cozmoslabs.com/
9
  Text Domain: translatepress-multilingual
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.cozmoslabs.com/
4
  Tags: translate, translation, multilingual, automatic translation, bilingual, front-end translation, google translate, language
5
  Requires at least: 3.1.0
6
  Tested up to: 4.9.8
7
- Stable tag: 1.3.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -124,6 +124,10 @@ For more information please check out [TranslatePress - Multilingual plugin docu
124
  6. Menu Language Switcher
125
 
126
  == Changelog ==
 
 
 
 
127
  = 1.3.4 =
128
  * Fixed issue with options in select tag that couldn't be translated
129
  * Fixed force language in custom links
4
  Tags: translate, translation, multilingual, automatic translation, bilingual, front-end translation, google translate, language
5
  Requires at least: 3.1.0
6
  Tested up to: 4.9.8
7
+ Stable tag: 1.3.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
124
  6. Menu Language Switcher
125
 
126
  == Changelog ==
127
+ = 1.3.5 =
128
+ * Fixed translation problems introduced in the last two versions
129
+ * Added a console message when trp-ajax request uses fall back to admin ajax for debugging purposes.
130
+
131
  = 1.3.4 =
132
  * Fixed issue with options in select tag that couldn't be translated
133
  * Fixed force language in custom links