Polylang Connect for Elementor – Templates Translation & Language Switcher - Version 2.3.3

Version Description

  • Fix PHP warning on multidomain image undefined srcset.
  • Bump tested versions WordPress 6.1 & Elementor 3.8.
Download this release

Release Info

Developer pacotole
Plugin Icon 128x128 Polylang Connect for Elementor – Templates Translation & Language Switcher
Version 2.3.3
Comparing to
See all releases

Code changes from version 2.3.2 to 2.3.3

README.txt CHANGED
@@ -5,7 +5,7 @@ Tags: elementor, polylang, multilingual, language switcher, languages, templates
5
  Requires at least: 5.4
6
  Tested up to: 6.1
7
  Requires PHP: 5.6
8
- Stable tag: 2.3.2
9
  License: GPL-2.0-or-later
10
  License URI: https://opensource.org/licenses/GPL-2.0
11
 
@@ -198,6 +198,10 @@ There are quite a few:
198
 
199
  == Changelog ==
200
 
 
 
 
 
201
  = 2.3.2 =
202
  * Fix dynamic tag image language flag don't return svg scalable file.
203
  * Fix Language Switcher dropdown styles with many languages.
5
  Requires at least: 5.4
6
  Tested up to: 6.1
7
  Requires PHP: 5.6
8
+ Stable tag: 2.3.3
9
  License: GPL-2.0-or-later
10
  License URI: https://opensource.org/licenses/GPL-2.0
11
 
198
 
199
  == Changelog ==
200
 
201
+ = 2.3.3 =
202
+ * Fix PHP warning on multidomain image undefined srcset.
203
+ * Bump tested versions WordPress 6.1 & Elementor 3.8.
204
+
205
  = 2.3.2 =
206
  * Fix dynamic tag image language flag don't return svg scalable file.
207
  * Fix Language Switcher dropdown styles with many languages.
connect-polylang-elementor.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: Polylang Connect for Elementor
11
  * Plugin URI: https://github.com/creame/connect-polylang-elementor
12
  * Description: Connect Polylang with Elementor. Display templates in the correct language, language switcher widget, language visibility conditions and dynamic tags.
13
- * Version: 2.3.2
14
  * Author: Creame
15
  * Author URI: https://crea.me/
16
  * License: GPL-2.0-or-later
@@ -19,8 +19,8 @@
19
  * Domain Path: /languages/
20
  * Requires WP: 5.4
21
  * Requires PHP: 5.6
22
- * Elementor tested up to: 3.7.7
23
- * Elementor Pro tested up to: 3.7.7
24
  *
25
  * Copyright (c) 2021 Paco Toledo - CREAME
26
  * Copyright (c) 2018-2021 David Decker - DECKERWEB
10
  * Plugin Name: Polylang Connect for Elementor
11
  * Plugin URI: https://github.com/creame/connect-polylang-elementor
12
  * Description: Connect Polylang with Elementor. Display templates in the correct language, language switcher widget, language visibility conditions and dynamic tags.
13
+ * Version: 2.3.3
14
  * Author: Creame
15
  * Author URI: https://crea.me/
16
  * License: GPL-2.0-or-later
19
  * Domain Path: /languages/
20
  * Requires WP: 5.4
21
  * Requires PHP: 5.6
22
+ * Elementor tested up to: 3.8.0
23
+ * Elementor Pro tested up to: 3.8.1
24
  *
25
  * Copyright (c) 2021 Paco Toledo - CREAME
26
  * Copyright (c) 2018-2021 David Decker - DECKERWEB
includes/elementor-assets.php CHANGED
@@ -23,11 +23,13 @@ class ElementorAssets {
23
  */
24
  protected function __construct() {
25
 
26
- if ( cpel_is_polylang_multidomain() ) {
27
- add_action( 'init', array( $this, 'init' ) );
28
- add_action( 'admin_init', array( $this, 'editor_domain_redirect' ) );
29
  }
30
 
 
 
 
31
  }
32
 
33
  /**
@@ -53,15 +55,10 @@ class ElementorAssets {
53
  return;
54
  }
55
 
56
- $languages = pll_the_languages( array( 'raw' => true ) );
57
- $server_host = wp_parse_url( "//{$_SERVER['HTTP_HOST']}", PHP_URL_HOST );
58
 
59
  foreach ( $languages as $language ) {
60
- $this->all_domains[] = $language['url'];
61
- if ( false !== stripos( $language['url'], $server_host ) ) {
62
- $current_language = PLL()->model->get_language( $language['slug'] );
63
- break;
64
- }
65
  }
66
 
67
  $this->current_domain = $current_language->home_url;
@@ -121,10 +118,11 @@ class ElementorAssets {
121
  */
122
  public function add_allowed_origins( $origins ) {
123
 
124
- $origins[] = $this->current_domain;
125
- $origins = array_merge( $origins, $this->all_domains );
 
126
 
127
- return $origins;
128
 
129
  }
130
 
@@ -153,8 +151,11 @@ class ElementorAssets {
153
  */
154
  public function replace_src( $attr, $attachment ) {
155
 
156
- $attr['src'] = $this->translate_url( $attr['src'] );
157
- $attr['srcset'] = $this->translate_url( $attr['srcset'] );
 
 
 
158
 
159
  return $attr;
160
 
23
  */
24
  protected function __construct() {
25
 
26
+ if ( ! cpel_is_polylang_multidomain() ) {
27
+ return;
 
28
  }
29
 
30
+ add_action( 'init', array( $this, 'init' ) );
31
+ add_action( 'admin_init', array( $this, 'editor_domain_redirect' ) );
32
+
33
  }
34
 
35
  /**
55
  return;
56
  }
57
 
58
+ $languages = pll_the_languages( array( 'raw' => true ) );
 
59
 
60
  foreach ( $languages as $language ) {
61
+ $this->all_domains[] = wp_parse_url( $language['url'], PHP_URL_HOST );
 
 
 
 
62
  }
63
 
64
  $this->current_domain = $current_language->home_url;
118
  */
119
  public function add_allowed_origins( $origins ) {
120
 
121
+ foreach ( $this->all_domains as $domain ) {
122
+ $origins = array_merge( $origins, array( 'http://' . $domain, 'https://' . $domain ) );
123
+ }
124
 
125
+ return array_unique( $origins );
126
 
127
  }
128
 
151
  */
152
  public function replace_src( $attr, $attachment ) {
153
 
154
+ $attr['src'] = $this->translate_url( $attr['src'] );
155
+
156
+ if ( isset( $attr['srcset'] ) ) {
157
+ $attr['srcset'] = $this->translate_url( $attr['srcset'] );
158
+ }
159
 
160
  return $attr;
161