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

Version Description

Fixed critical error loading plugin classes when there are uppercase letters in the path.

Download this release

Release Info

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

Code changes from version 2.0.0 to 2.0.1

README.txt CHANGED
@@ -2,10 +2,10 @@
2
  Contributors: daveshine, p4fbradjohnson, deckerweb, wpautobahn, pacotole, creapuntome
3
  Donate link: https://www.paypal.me/pacotole
4
  Tags: elementor, polylang, multilingual, language switcher, languages, templates, widget, finder, dynamic tags
5
- Requires at least: 4.7
6
  Tested up to: 5.9
7
  Requires PHP: 5.6
8
- Stable tag: 2.0.0
9
  License: GPL-2.0-or-later
10
  License URI: https://opensource.org/licenses/GPL-2.0
11
 
@@ -19,20 +19,20 @@ Connect Polylang multilingual plugin with Elementor Page Builder: **Translate yo
19
 
20
  ### What the Plugin Does
21
 
22
- #### Template translation and show in the correct language
23
  Create translations for your Elementor templates especially for (Elementor Pro) Theme Builder.
24
 
25
- #### Language Switcher
26
  A native Elementor Widget to easily build a nice and fully customizable language switcher:
27
 
28
  * Show or hide flags, language name, language code.
29
  * Vertical list, Horizontal list or **styled dropdown**.
30
  * **SVG scalable flags**.
31
 
32
- #### Language Visibility Conditions
33
  Allow to **show or hide every widget**, section or column **by language**.
34
 
35
- #### Language Dynamic Tags
36
  Use language dynamic tags (on Elementor Pro) that you can set with an specific language or the "current" one. Available tags are:
37
 
38
  * **Language Code** tag type text
@@ -40,13 +40,13 @@ Use language dynamic tags (on Elementor Pro) that you can set with an specific l
40
  * **Language Url** tag type url
41
  * **Language Flag** tag type image
42
 
43
- #### Elementor Editor integration
44
  Now you can view the language of the current template and change to its translations or create them **from the Elementor editor**.
45
 
46
- #### Elementor Finder integration
47
  From Elementor Finder you can access to Polylang settings pages and go the site in the selected language.
48
 
49
- #### Plugins integration fixes and tweaks
50
 
51
  * Automatically generate display conditions on new template translation.
52
  * Automatically generate Elementor CSS styles on create new template translation.
@@ -75,9 +75,9 @@ Site languages:
75
  ╚═ Archive Template A (IT) -> none (in front checks if category is IT translation of "Red (EN)")
76
 
77
  - Option 2 (not linked translations, all languages has display conditions):
78
- Archive Template B (EN) -> condition category is "Red (EN)"
79
- Archive Template B (ES) -> condition category is "Rojo (ES)"
80
- Archive Template B (IT) -> condition category is "Rosso (IT)"
81
  `
82
 
83
  ### Support
@@ -202,6 +202,9 @@ There are quite a few:
202
 
203
  == Changelog ==
204
 
 
 
 
205
  = 2.0.0 =
206
  **Fully rewrited and upgraded!!**
207
 
@@ -277,6 +280,9 @@ There are quite a few:
277
 
278
  == Upgrade Notice ==
279
 
 
 
 
280
  = 2.0.0 =
281
  **Warning** breaking changes with v1. Language Switcher and Dynamic Tags has been renamed and neeed to re-added again in your templates.
282
 
2
  Contributors: daveshine, p4fbradjohnson, deckerweb, wpautobahn, pacotole, creapuntome
3
  Donate link: https://www.paypal.me/pacotole
4
  Tags: elementor, polylang, multilingual, language switcher, languages, templates, widget, finder, dynamic tags
5
+ Requires at least: 5.4
6
  Tested up to: 5.9
7
  Requires PHP: 5.6
8
+ Stable tag: 2.0.1
9
  License: GPL-2.0-or-later
10
  License URI: https://opensource.org/licenses/GPL-2.0
11
 
19
 
20
  ### What the Plugin Does
21
 
22
+ #### 📍 Template translation and show in the correct language
23
  Create translations for your Elementor templates especially for (Elementor Pro) Theme Builder.
24
 
25
+ #### 🔄 Language Switcher
26
  A native Elementor Widget to easily build a nice and fully customizable language switcher:
27
 
28
  * Show or hide flags, language name, language code.
29
  * Vertical list, Horizontal list or **styled dropdown**.
30
  * **SVG scalable flags**.
31
 
32
+ #### 👁️ Language Visibility Conditions
33
  Allow to **show or hide every widget**, section or column **by language**.
34
 
35
+ #### 🏷️ Language Dynamic Tags
36
  Use language dynamic tags (on Elementor Pro) that you can set with an specific language or the "current" one. Available tags are:
37
 
38
  * **Language Code** tag type text
40
  * **Language Url** tag type url
41
  * **Language Flag** tag type image
42
 
43
+ #### ✏️ Elementor Editor integration
44
  Now you can view the language of the current template and change to its translations or create them **from the Elementor editor**.
45
 
46
+ #### 🔍 Elementor Finder integration
47
  From Elementor Finder you can access to Polylang settings pages and go the site in the selected language.
48
 
49
+ #### 🔨 Plugins integration fixes and tweaks
50
 
51
  * Automatically generate display conditions on new template translation.
52
  * Automatically generate Elementor CSS styles on create new template translation.
75
  ╚═ Archive Template A (IT) -> none (in front checks if category is IT translation of "Red (EN)")
76
 
77
  - Option 2 (not linked translations, all languages has display conditions):
78
+ ══ Archive Template B (EN) -> condition category is "Red (EN)"
79
+ ══ Archive Template B (ES) -> condition category is "Rojo (ES)"
80
+ ══ Archive Template B (IT) -> condition category is "Rosso (IT)"
81
  `
82
 
83
  ### Support
202
 
203
  == Changelog ==
204
 
205
+ = 2.0.1 =
206
+ Fixed critical error loading plugin classes when there are uppercase letters in the path.
207
+
208
  = 2.0.0 =
209
  **Fully rewrited and upgraded!!**
210
 
280
 
281
  == Upgrade Notice ==
282
 
283
+ = 2.0.1 =
284
+ **Warning** breaking changes with v1. Language Switcher and Dynamic Tags has been renamed and neeed to re-added again in your templates.
285
+
286
  = 2.0.0 =
287
  **Warning** breaking changes with v1. Language Switcher and Dynamic Tags has been renamed and neeed to re-added again in your templates.
288
 
connect-polylang-elementor.php CHANGED
@@ -7,15 +7,15 @@
7
  * @wordpress-plugin
8
  * Plugin Name: Polylang Connect for Elementor
9
  * Plugin URI: https://github.com/creame/connect-polylang-elementor
10
- * Description: Connect Polylang with Elementor Page Builder. Display templates in the correct language, language switcher widget, widget language visibility settings and language dynamic tags.
11
- * Version: 2.0.0
12
  * Author: Creame
13
  * Author URI: https://crea.me/
14
  * License: GPL-2.0-or-later
15
  * License URI: https://opensource.org/licenses/GPL-2.0
16
  * Text Domain: connect-polylang-elementor
17
  * Domain Path: /languages/
18
- * Requires WP: 5.0
19
  * Requires PHP: 5.6
20
  *
21
  * Copyright (c) 2021 Paco Toledo - CREAME
@@ -31,7 +31,7 @@ defined( 'ABSPATH' ) || exit;
31
  *
32
  * @since 2.0.0
33
  */
34
- define( 'CPEL_PLUGIN_VERSION', '2.0.0' );
35
  define( 'CPEL_FILE', __FILE__ );
36
  define( 'CPEL_DIR', plugin_dir_path( CPEL_FILE ) );
37
  define( 'CPEL_BASENAME', plugin_basename( CPEL_FILE ) );
@@ -57,8 +57,9 @@ spl_autoload_register(
57
  // Replace the namespace prefix with the base directory, replace namespace
58
  // separators with directory separators in the relative class name, append
59
  // with .php and transform CamelCase to lower-dashed
60
- $file = $base_dir . str_replace( '\\', '/', $relative_class_name ) . '.php';
61
  $file = strtolower( preg_replace( '/([a-zA-Z])(?=[A-Z])/', '$1-', $file ) );
 
62
 
63
  if ( file_exists( $file ) ) {
64
  require $file;
7
  * @wordpress-plugin
8
  * Plugin Name: Polylang Connect for Elementor
9
  * Plugin URI: https://github.com/creame/connect-polylang-elementor
10
+ * Description: Connect Polylang with Elementor. Display templates in the correct language, language switcher widget, language visibility conditions and dynamic tags.
11
+ * Version: 2.0.1
12
  * Author: Creame
13
  * Author URI: https://crea.me/
14
  * License: GPL-2.0-or-later
15
  * License URI: https://opensource.org/licenses/GPL-2.0
16
  * Text Domain: connect-polylang-elementor
17
  * Domain Path: /languages/
18
+ * Requires WP: 5.4
19
  * Requires PHP: 5.6
20
  *
21
  * Copyright (c) 2021 Paco Toledo - CREAME
31
  *
32
  * @since 2.0.0
33
  */
34
+ define( 'CPEL_PLUGIN_VERSION', '2.0.1' );
35
  define( 'CPEL_FILE', __FILE__ );
36
  define( 'CPEL_DIR', plugin_dir_path( CPEL_FILE ) );
37
  define( 'CPEL_BASENAME', plugin_basename( CPEL_FILE ) );
57
  // Replace the namespace prefix with the base directory, replace namespace
58
  // separators with directory separators in the relative class name, append
59
  // with .php and transform CamelCase to lower-dashed
60
+ $file = str_replace( '\\', '/', $relative_class_name ) . '.php';
61
  $file = strtolower( preg_replace( '/([a-zA-Z])(?=[A-Z])/', '$1-', $file ) );
62
+ $file = $base_dir . $file;
63
 
64
  if ( file_exists( $file ) ) {
65
  require $file;
includes/admin-extras.php CHANGED
@@ -1,8 +1,6 @@
1
  <?php
2
  namespace ConnectPolylangElementor;
3
 
4
- use \ConnectPolylangElementor\Util\Info;
5
-
6
  defined( 'ABSPATH' ) || exit;
7
 
8
 
@@ -10,13 +8,6 @@ class AdminExtras {
10
 
11
  use \ConnectPolylangElementor\Util\Singleton;
12
 
13
- /**
14
- * Current template ID.
15
- *
16
- * @var int|null
17
- */
18
- private $template_id = null;
19
-
20
  /**
21
  * __construct
22
  *
@@ -95,8 +86,6 @@ class AdminExtras {
95
  *
96
  * @since 1.0.0
97
  *
98
- * @uses Info::link()
99
- *
100
  * @param array $cpel_links (Default) Array of plugin meta links
101
  * @param string $cpel_file Path of base plugin file
102
  * @return array $cpel_links Array of plugin link strings to build HTML markup.
1
  <?php
2
  namespace ConnectPolylangElementor;
3
 
 
 
4
  defined( 'ABSPATH' ) || exit;
5
 
6
 
8
 
9
  use \ConnectPolylangElementor\Util\Singleton;
10
 
 
 
 
 
 
 
 
11
  /**
12
  * __construct
13
  *
86
  *
87
  * @since 1.0.0
88
  *
 
 
89
  * @param array $cpel_links (Default) Array of plugin meta links
90
  * @param string $cpel_file Path of base plugin file
91
  * @return array $cpel_links Array of plugin link strings to build HTML markup.
includes/util/info.php DELETED
@@ -1,84 +0,0 @@
1
- <?php
2
- namespace ConnectPolylangElementor\Util;
3
-
4
- defined( 'ABSPATH' ) || exit;
5
-
6
-
7
- class Info {
8
-
9
- public static function val( $key ) {
10
-
11
- $values = array(
12
- 'url_translate' => 'https://translate.wordpress.org/projects/wp-plugins/connect-polylang-elementor',
13
- 'url_wporg_faq' => 'https://wordpress.org/plugins/connect-polylang-elementor/#faq',
14
- 'url_wporg_forum' => 'https://wordpress.org/support/plugin/connect-polylang-elementor',
15
- 'url_wporg_review' => 'https://wordpress.org/support/plugin/connect-polylang-elementor/reviews/?filter=5/#new-post',
16
- 'url_wporg_profile' => 'https://profiles.wordpress.org/daveshine/',
17
- 'url_fb_group' => 'https://www.facebook.com/groups/deckerweb.wordpress.plugins/',
18
- // 'url_snippets' => 'https://github.com/deckerweb/connect-polylang-elementor/wiki/Code-Snippets',
19
- 'author' => __( 'David Decker - DECKERWEB', 'connect-polylang-elementor' ),
20
- 'author_uri' => 'https://deckerweb.de/',
21
- 'license' => 'GPL-2.0-or-later',
22
- 'url_license' => 'https://opensource.org/licenses/GPL-2.0',
23
- 'first_code' => '2018',
24
- 'url_donate' => 'https://www.paypal.me/deckerweb',
25
- 'url_plugin' => 'https://github.com/deckerweb/connect-polylang-elementor',
26
- // 'url_plugin_docs' => 'https://github.com/deckerweb/connect-polylang-elementor/wiki',
27
- // 'url_plugin_faq' => 'https://wordpress.org/plugins/connect-polylang-elementor/#faq',
28
- 'url_github' => 'https://github.com/deckerweb/connect-polylang-elementor',
29
- 'url_github_issues' => 'https://github.com/deckerweb/connect-polylang-elementor/issues',
30
- 'url_twitter' => 'https://twitter.com/deckerweb',
31
- 'url_github_follow' => 'https://github.com/deckerweb',
32
- );
33
-
34
- return isset( $values[ $key ] ) ? $values[ $key ] : false;
35
-
36
- }
37
-
38
- /**
39
- * Get URL of specific BTC info value.
40
- *
41
- * @since 1.0.0
42
- *
43
- * @uses cpel_info_values()
44
- *
45
- * @param string $url_key String of value key from array of cpel_info_values()
46
- * @param bool $raw If raw escaping or regular escaping of URL gets used
47
- * @return string URL for info value.
48
- */
49
- public static function url( $url_key = '', $raw = false ) {
50
-
51
- $output = self::val( sanitize_key( $url_key ) );
52
-
53
- if ( ! empty( $output ) ) {
54
- return $raw ? esc_url_raw( $output ) : esc_url( $output );
55
- }
56
-
57
- return '';
58
-
59
- }
60
-
61
- /**
62
- * Get link with complete markup for a specific BTC info value.
63
- *
64
- * @since 1.0.0
65
- *
66
- * @param string $url_key String of value key
67
- * @param string $text String of text and link attribute
68
- * @param string $class String of CSS class
69
- * @return string HTML markup for linked URL.
70
- */
71
- public static function link( $url_key = '', $text = '', $class = '' ) {
72
-
73
- $link = sprintf(
74
- '<a class="%1$s" href="%2$s" target="_blank" rel="nofollow noopener noreferrer" title="%3$s">%3$s</a>',
75
- strtolower( esc_attr( $class ) ), // sanitize_html_class( $class ),
76
- self::url( $url_key ),
77
- esc_html( $text )
78
- );
79
-
80
- return $link;
81
-
82
- }
83
-
84
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/widgets/polylang-language-switcher.php CHANGED
@@ -765,7 +765,7 @@ class PolylangLanguageSwitcher extends Widget_Base {
765
 
766
  // Dropdown toggle link
767
  if ( count( $lang_links ) && 'dropdown' === $settings['layout'] ) {
768
- $lang_code = array_key_exists( $lang_curr, $lang_links ) ? $lang_curr : array_key_first( $lang_links );
769
  $lang_link = $lang_links[ $lang_code ];
770
 
771
  unset( $lang_links[ $lang_code ] );
765
 
766
  // Dropdown toggle link
767
  if ( count( $lang_links ) && 'dropdown' === $settings['layout'] ) {
768
+ $lang_code = array_key_exists( $lang_curr, $lang_links ) ? $lang_curr : current( array_keys( $lang_links ) );
769
  $lang_link = $lang_links[ $lang_code ];
770
 
771
  unset( $lang_links[ $lang_code ] );